diff --git a/backend/routers/gateway_proxy.py b/backend/routers/gateway_proxy.py index 9f8c8f8..a822666 100644 --- a/backend/routers/gateway_proxy.py +++ b/backend/routers/gateway_proxy.py @@ -4,7 +4,8 @@ from fastapi.responses import JSONResponse, StreamingResponse from config import LLAMA_SWAP_URL from services.gateway_stream import record_stream_chunk, record_usage -from services.router_logic import FAST, FAST_NO_THINK, LANES, choose_for_lane +from services.router_logic import LANES, choose_for_lane +from services.routing_policy import load_policy router = APIRouter(prefix="/v1") @@ -37,7 +38,8 @@ async def _proxy(path: str, request: Request): alias = requested routed = {"x-mc-routed-to": requested} # fast-Spur: Thinking aus für flotte Antworten (sofern Client es nicht selbst setzt). - if FAST_NO_THINK and alias == FAST and "chat_template_kwargs" not in body: + pol = load_policy() + if pol["fast_no_think"] and alias == pol["fast"] and "chat_template_kwargs" not in body: body["chat_template_kwargs"] = {"enable_thinking": False} url = f"{LLAMA_SWAP_URL}{path}" diff --git a/backend/routers/routing.py b/backend/routers/routing.py index 0fe0318..2f3a713 100644 --- a/backend/routers/routing.py +++ b/backend/routers/routing.py @@ -1,8 +1,10 @@ -"""Routing-Endpoint: zeigt den eingebauten Gateway (model:auto fast↔heavy).""" +"""Routing-Endpoints: Lane-Summary (chat/coding) + UI-editierbare Policy (hot-reload).""" -from fastapi import APIRouter +from fastapi import APIRouter, HTTPException +from pydantic import BaseModel from services import gateway +from services.routing_policy import policy_meta, save_policy router = APIRouter(prefix="/api") @@ -10,3 +12,32 @@ router = APIRouter(prefix="/api") @router.get("/routing") def routing() -> dict: return {**gateway.routing_summary(), "gateway_reachable": gateway.gateway_reachable()} + + +@router.get("/routing/policy") +def get_policy() -> dict: + """Aktuelle Policy + Defaults (für „Zurücksetzen“) + Feld-Spezifikation für den Editor.""" + return policy_meta() + + +class PolicyPatch(BaseModel): + fast: str | None = None + heavy: str | None = None + coder: str | None = None + coder_lite: str | None = None + heavy_chars: int | None = None + coding_escalate_chars: int | None = None + fast_no_think: bool | None = None + + +@router.put("/routing/policy") +def put_policy(patch: PolicyPatch) -> dict: + """Teil-Update der Routing-Policy. Validiert, persistiert atomar, sofort wirksam (hot-reload).""" + fields = {k: v for k, v in patch.model_dump().items() if v is not None} + if not fields: + raise HTTPException(status_code=400, detail="Keine Felder zum Aktualisieren.") + try: + new_policy = save_policy(fields) + except (ValueError, TypeError) as e: + raise HTTPException(status_code=400, detail=f"Ungültige Policy: {e}") + return {"policy": new_policy} diff --git a/backend/services/gateway.py b/backend/services/gateway.py index b9b5402..16e4813 100644 --- a/backend/services/gateway.py +++ b/backend/services/gateway.py @@ -6,20 +6,36 @@ LiteLLM-Dienst nötig (baut auf Python 3.14 nicht); bleibt später austauschbar. from config import PORT from services.llamaswap import engine_reachable -from services.router_logic import FAST, HEAVY, HEAVY_CHARS +from services.routing_policy import load_policy def routing_summary() -> dict: + p = load_policy() + coding_default = p["coder_lite"] or p["coder"] return { "mode": "builtin", "endpoint": f":{PORT}/v1 (OpenAI-kompatibel)", + # Virtuelle Lanes, die Clients/IDEs als „Modell" wählen (Router pickt das echte Alias). + "lanes": [ + { + "name": "chat", + "aka": "auto", + "target": f"{p['fast']} ↔ {p['heavy']} (nach Komplexität)", + "threshold_chars": p["heavy_chars"], + }, + { + "name": "coding", + "target": f"{coding_default} ↔ {p['coder']} (Eskalation)", + "escalate_chars": p["coding_escalate_chars"], + }, + ], + # Rückwärtskompatible Flach-Liste (alte UI/Clients). "routes": [ - {"name": "auto", "target": f"{FAST} ↔ {HEAVY} (nach Komplexität)"}, - {"name": FAST, "target": "llama-swap-Alias 'fast'"}, - {"name": HEAVY, "target": "llama-swap-Alias 'heavy'"}, + {"name": "chat", "target": f"{p['fast']} ↔ {p['heavy']} (nach Komplexität)"}, + {"name": "coding", "target": f"{coding_default} ↔ {p['coder']} (Eskalation)"}, {"name": "", "target": "llama-swap-Passthrough (lädt bei Bedarf)"}, ], - "heavy_threshold_chars": HEAVY_CHARS, + "heavy_threshold_chars": p["heavy_chars"], "fallbacks": [], "context_window_fallbacks": [], } diff --git a/backend/services/router_logic.py b/backend/services/router_logic.py index 05ac53d..90fa715 100644 --- a/backend/services/router_logic.py +++ b/backend/services/router_logic.py @@ -6,26 +6,18 @@ Zwei virtuelle Lanes, die Clients/IDEs auswählen — der Router pickt das echte - **coding**: Code-Arbeit → `coder` (Qwen3-Coder-Next); riesiger/architektonischer Kontext → `heavy`; triviale Kurzfrage ohne Code → `fast` (Tempo). -Regelbasiert, sub-ms, ohne Cloud. Schwellen/Aliases via Env überschreibbar (Phase 2: UI-editierbare -Policy-JSON). Lucy läuft NICHT hierüber — die ist der Hermes-Agent (:8642), eigene Ebene. +Regelbasiert, sub-ms, ohne Cloud. Schwellen/Aliases liegen in einer UI-editierbaren Policy +(routing_policy.py, hot-reload; Env = Defaults). Lucy läuft NICHT hierüber — die ist der +Hermes-Agent (:8642), eigene Ebene. """ -import os import re -# Echte Modell-Aliases hinter den Lanes (Env-überschreibbar). -FAST = os.environ.get("MC_ROUTE_FAST", "fast") -HEAVY = os.environ.get("MC_ROUTE_HEAVY", "heavy") -CODER = os.environ.get("MC_ROUTE_CODER", "coder") +from services.routing_policy import load_policy -# Schwellen (Zeichen). -HEAVY_CHARS = int(os.environ.get("MC_GATEWAY_HEAVY_CHARS", "8000")) # chat → heavy -# coding-Lane: leichter/schneller Coder als Default (wenn gesetzt = Phase 2b), starker Coder als Eskalation. -CODER_LITE = os.environ.get("MC_ROUTE_CODER_LITE", "").strip() # z.B. "coder-lite" -CODING_ESCALATE_CHARS = int(os.environ.get("MC_CODING_ESCALATE_CHARS", "120000")) # darüber → starker Coder - -# Thinking auf der fast-Spur aus → flotte Alltags-Antworten (Qwen3.6 ist ein Reasoning-Modell). -FAST_NO_THINK = os.environ.get("MC_FAST_NO_THINK", "1") not in ("0", "false", "") +# Modell-Aliases & Zeichen-Schwellen liegen jetzt in der UI-editierbaren Policy +# (routing_policy.py) und kommen pro Request via load_policy() (hot-reload). Die Env-Vars +# sind dort die Defaults. Die Regex-Keyword-Listen unten bleiben bewusst im Code. # Virtuelle Lanes, die im Gateway als „Modelle" sichtbar sind. LANES = ["coding", "chat"] @@ -64,21 +56,23 @@ def _text_of(body: dict) -> str: def _route_chat(text: str, n: int) -> tuple[str, str]: - if n > HEAVY_CHARS: - return HEAVY, f"langer Kontext ({n} > {HEAVY_CHARS} Zeichen)" + p = load_policy() + if n > p["heavy_chars"]: + return p["heavy"], f"langer Kontext ({n} > {p['heavy_chars']} Zeichen)" if _HEAVY_KW.search(text): - return HEAVY, "Komplexitäts-Schlüsselwort erkannt" - return FAST, "Standard" + return p["heavy"], "Komplexitäts-Schlüsselwort erkannt" + return p["fast"], "Standard" def _route_coding(text: str, n: int) -> tuple[str, str]: # Agentisches Coden (OpenCode/RooCode/…) bleibt IMMER beim dedizierten Coder — NIE heavy/fast # (das sind Allzweck-Modelle, schwächer bei Code). Die Qwen-Coder packen 256K–1M Kontext selbst, # langer Repo-Kontext ist bei Agenten der Normalfall und darf NICHT zu heavy umrouten. - # (Phase 2b: warme schnelle Coder-Stufe CODER_LITE als Default + CODER als Eskalation.) - if CODER_LITE and not _CODING_HEAVY_KW.search(text) and n <= CODING_ESCALATE_CHARS: - return CODER_LITE, "Coding (schneller Coder)" - return CODER, "Coding -> starker Coder" + # (Phase 2b: warme schnelle Coder-Stufe coder_lite als Default + coder als Eskalation.) + p = load_policy() + if p["coder_lite"] and not _CODING_HEAVY_KW.search(text) and n <= p["coding_escalate_chars"]: + return p["coder_lite"], "Coding (schneller Coder)" + return p["coder"], "Coding -> starker Coder" def choose_for_lane(lane: str, body: dict) -> tuple[str, str]: diff --git a/backend/services/routing_policy.py b/backend/services/routing_policy.py new file mode 100644 index 0000000..1db24bd --- /dev/null +++ b/backend/services/routing_policy.py @@ -0,0 +1,127 @@ +""" +UI-editierbare Routing-Policy für die Gateway-Lanes (coding/chat). + +Persistiert als JSON unter MC_ROUTING_POLICY_PATH (Default MODELS_DIR/mc2-routing.json — +gleiche Konvention wie mc2-discover.json). **Hot-reload:** load_policy() liest die Datei nur +bei Änderung neu (mtime-Cache) → UI-Edits greifen ohne Dienst-Neustart. Die Env-Vars (bisher +einzige Stellschraube in router_logic.py) bleiben als Defaults/Fallback erhalten. + +Bewusst NICHT editierbar (v1): die Regex-Keyword-Listen (heavy/coding-heavy/code-hint) — die +bleiben in router_logic.py im Code. +""" + +import json +import os +import threading +from pathlib import Path + +from config import MODELS_DIR + +POLICY_PATH = Path(os.environ.get("MC_ROUTING_POLICY_PATH", str(MODELS_DIR / "mc2-routing.json"))) + + +def _env_bool(name: str, default: str) -> bool: + return os.environ.get(name, default) not in ("0", "false", "") + + +# Defaults aus den Env-Vars — Quelle der Wahrheit, solange keine Policy-Datei existiert. +DEFAULTS: dict = { + "fast": os.environ.get("MC_ROUTE_FAST", "fast"), + "heavy": os.environ.get("MC_ROUTE_HEAVY", "heavy"), + "coder": os.environ.get("MC_ROUTE_CODER", "coder"), + "coder_lite": os.environ.get("MC_ROUTE_CODER_LITE", "").strip(), + "heavy_chars": int(os.environ.get("MC_GATEWAY_HEAVY_CHARS", "8000")), + "coding_escalate_chars": int(os.environ.get("MC_CODING_ESCALATE_CHARS", "120000")), + "fast_no_think": _env_bool("MC_FAST_NO_THINK", "1"), +} + +# Feld-Spezifikation für die UI (Typ + Grenzen + Label). Treibt Editor & Validierung. +FIELDS: list[dict] = [ + {"key": "fast", "label": "fast-Alias (chat: Standard)", "type": "str"}, + {"key": "heavy", "label": "heavy-Alias (chat: lang/komplex)", "type": "str"}, + {"key": "coder", "label": "coder-Alias (coding: stark / Eskalation)", "type": "str"}, + {"key": "coder_lite", "label": "coder-lite-Alias (coding: schneller Default; leer = aus)", "type": "str"}, + {"key": "heavy_chars", "label": "chat → heavy ab N Zeichen", "type": "int", "min": 500, "max": 1_000_000}, + {"key": "coding_escalate_chars", "label": "coding → starker Coder ab N Zeichen", "type": "int", "min": 1000, "max": 4_000_000}, + {"key": "fast_no_think", "label": "fast-Spur: Thinking aus (flotte Antworten)", "type": "bool"}, +] + +_LOCK = threading.Lock() +_CACHE: dict = {"mtime": None, "policy": None} + + +def _read_file() -> dict: + try: + with open(POLICY_PATH, "r", encoding="utf-8") as f: + data = json.load(f) + return data if isinstance(data, dict) else {} + except (FileNotFoundError, json.JSONDecodeError, OSError): + return {} + + +def _coerce(patch: dict) -> dict: + """Nur bekannte Keys, typ-/bereichsvalidiert. Wirft ValueError bei ungültigen Werten.""" + spec = {f["key"]: f for f in FIELDS} + out: dict = {} + for k, v in (patch or {}).items(): + f = spec.get(k) + if not f: + continue # unbekannte Keys still verwerfen + if f["type"] == "int": + iv = int(v) + lo, hi = f.get("min", 1), f.get("max", 10**9) + if not (lo <= iv <= hi): + raise ValueError(f"{k}={iv} außerhalb [{lo}, {hi}]") + out[k] = iv + elif f["type"] == "bool": + out[k] = bool(v) + else: # str + sv = str(v).strip() + if k != "coder_lite" and not sv: + raise ValueError(f"{k} darf nicht leer sein") + out[k] = sv + return out + + +def _coerce_safe(patch: dict) -> dict: + """Wie _coerce, aber schluckt Fehler — kaputte Datei darf den Betrieb nicht stoppen.""" + try: + return _coerce(patch) + except (ValueError, TypeError): + return {} + + +def load_policy() -> dict: + """Aktuelle Policy (Datei über DEFAULTS gemerged). Hot-reload via mtime-Cache, pro Request billig.""" + try: + mtime = POLICY_PATH.stat().st_mtime + except OSError: + mtime = None + with _LOCK: + if _CACHE["policy"] is None or _CACHE["mtime"] != mtime: + merged = {**DEFAULTS} + if mtime is not None: + merged.update(_coerce_safe(_read_file())) + _CACHE["mtime"] = mtime + _CACHE["policy"] = merged + return dict(_CACHE["policy"]) + + +def save_policy(patch: dict) -> dict: + """Validiert + persistiert atomar. Gibt die neue, vollständige Policy zurück.""" + clean = _coerce(patch) # wirft bei ungültigem Input + with _LOCK: + current = {**DEFAULTS, **_coerce_safe(_read_file()), **clean} + POLICY_PATH.parent.mkdir(parents=True, exist_ok=True) + tmp = POLICY_PATH.with_suffix(".json.tmp") + with open(tmp, "w", encoding="utf-8") as f: + json.dump(current, f, ensure_ascii=False, indent=2) + os.replace(tmp, POLICY_PATH) + _CACHE["mtime"] = None # nächster load_policy() lädt frisch + _CACHE["policy"] = None + return current + + +def policy_meta() -> dict: + """Für den UI-Editor: aktuelle Werte + Defaults (für „Zurücksetzen“) + Feld-Spezifikation.""" + return {"policy": load_policy(), "defaults": dict(DEFAULTS), "fields": FIELDS} diff --git a/frontend/dist/assets/GraphView-BtEGVbX5.js b/frontend/dist/assets/GraphView-CDHhai9o.js similarity index 99% rename from frontend/dist/assets/GraphView-BtEGVbX5.js rename to frontend/dist/assets/GraphView-CDHhai9o.js index f1aa9aa..5eaf263 100644 --- a/frontend/dist/assets/GraphView-BtEGVbX5.js +++ b/frontend/dist/assets/GraphView-CDHhai9o.js @@ -1,4 +1,4 @@ -import{g as bi,r as ce,j as H,R as rr,S as nr,a as Ut,T as ar}from"./index-BK9pTA8z.js";var et={exports:{}},zt;function or(){if(zt)return et.exports;zt=1;var n=typeof Reflect=="object"?Reflect:null,i=n&&typeof n.apply=="function"?n.apply:function(b,R,A){return Function.prototype.apply.call(b,R,A)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(b){return Object.getOwnPropertyNames(b).concat(Object.getOwnPropertySymbols(b))}:t=function(b){return Object.getOwnPropertyNames(b)};function e(p){console&&console.warn&&console.warn(p)}var r=Number.isNaN||function(b){return b!==b};function a(){a.init.call(this)}et.exports=a,et.exports.once=D,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(p){if(typeof p!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof p)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(p){if(typeof p!="number"||p<0||r(p))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+p+".");o=p}}),a.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(b){if(typeof b!="number"||b<0||r(b))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+b+".");return this._maxListeners=b,this};function u(p){return p._maxListeners===void 0?a.defaultMaxListeners:p._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(b){for(var R=[],A=1;A0&&(P=R[0]),P instanceof Error)throw P;var V=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw V.context=P,V}var z=F[b];if(z===void 0)return!1;if(typeof z=="function")i(z,this,R);else for(var g=z.length,K=y(z,g),A=0;A0&&P.length>G&&!P.warned){P.warned=!0;var V=new Error("Possible EventEmitter memory leak detected. "+P.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");V.name="MaxListenersExceededWarning",V.emitter=p,V.type=b,V.count=P.length,e(V)}return p}a.prototype.addListener=function(b,R){return h(this,b,R,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(b,R){return h(this,b,R,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(p,b,R){var A={fired:!1,wrapFn:void 0,target:p,type:b,listener:R},G=d.bind(A);return G.listener=R,A.wrapFn=G,G}a.prototype.once=function(b,R){return s(R),this.on(b,l(this,b,R)),this},a.prototype.prependOnceListener=function(b,R){return s(R),this.prependListener(b,l(this,b,R)),this},a.prototype.removeListener=function(b,R){var A,G,F,P,V;if(s(R),G=this._events,G===void 0)return this;if(A=G[b],A===void 0)return this;if(A===R||A.listener===R)--this._eventsCount===0?this._events=Object.create(null):(delete G[b],G.removeListener&&this.emit("removeListener",b,A.listener||R));else if(typeof A!="function"){for(F=-1,P=A.length-1;P>=0;P--)if(A[P]===R||A[P].listener===R){V=A[P].listener,F=P;break}if(F<0)return this;F===0?A.shift():w(A,F),A.length===1&&(G[b]=A[0]),G.removeListener!==void 0&&this.emit("removeListener",b,V||R)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(b){var R,A,G;if(A=this._events,A===void 0)return this;if(A.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):A[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete A[b]),this;if(arguments.length===0){var F=Object.keys(A),P;for(G=0;G=0;G--)this.removeListener(b,R[G]);return this};function f(p,b,R){var A=p._events;if(A===void 0)return[];var G=A[b];return G===void 0?[]:typeof G=="function"?R?[G.listener||G]:[G]:R?T(G):y(G,G.length)}a.prototype.listeners=function(b){return f(this,b,!0)},a.prototype.rawListeners=function(b){return f(this,b,!1)},a.listenerCount=function(p,b){return typeof p.listenerCount=="function"?p.listenerCount(b):c.call(p,b)},a.prototype.listenerCount=c;function c(p){var b=this._events;if(b!==void 0){var R=b[p];if(typeof R=="function")return 1;if(R!==void 0)return R.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function y(p,b){for(var R=new Array(b),A=0;An++}function me(){const n=arguments;let i=null,t=-1;return{[Symbol.iterator](){return this},next(){let e=null;do{if(i===null){if(t++,t>=n.length)return{done:!0};i=n[t][Symbol.iterator]()}if(e=i.next(),e.done){i=null;continue}break}while(!0);return e}}}function Le(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Lt extends Error{constructor(i){super(),this.name="GraphError",this.message=i}}class k extends Lt{constructor(i){super(i),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,k.prototype.constructor)}}class C extends Lt{constructor(i){super(i),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,C.prototype.constructor)}}class I extends Lt{constructor(i){super(i),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,I.prototype.constructor)}}function _i(n,i){this.key=n,this.attributes=i,this.clear()}_i.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function Ti(n,i){this.key=n,this.attributes=i,this.clear()}Ti.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Si(n,i){this.key=n,this.attributes=i,this.clear()}Si.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ge(n,i,t,e,r){this.key=i,this.attributes=r,this.undirected=n,this.source=t,this.target=e}Ge.prototype.attach=function(){let n="out",i="in";this.undirected&&(n=i="undirected");const t=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&t===e)&&(this.target[i][t]=this)};Ge.prototype.attachMulti=function(){let n="out",i="in";const t=this.source.key,e=this.target.key;this.undirected&&(n=i="undirected");const r=this.source[n],a=r[e];if(typeof a>"u"){r[e]=this,this.undirected&&t===e||(this.target[i][t]=this);return}a.previous=this,this.next=a,r[e]=this,this.target[i][t]=this};Ge.prototype.detach=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),delete this.source[t][i],delete this.target[e][n]};Ge.prototype.detachMulti=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][i],delete this.target[e][n]):(this.next.previous=void 0,this.source[t][i]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Ri=0,Ai=1,hr=2,xi=3;function ye(n,i,t,e,r,a,o){let s,u,h,d;if(e=""+e,t===Ri){if(s=n._nodes.get(e),!s)throw new C(`Graph.${i}: could not find the "${e}" node in the graph.`);h=r,d=a}else if(t===xi){if(r=""+r,u=n._edges.get(r),!u)throw new C(`Graph.${i}: could not find the "${r}" edge in the graph.`);const l=u.source.key,f=u.target.key;if(e===l)s=u.target;else if(e===f)s=u.source;else throw new C(`Graph.${i}: the "${e}" node is not attached to the "${r}" edge (${l}, ${f}).`);h=a,d=o}else{if(u=n._edges.get(e),!u)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`);t===Ai?s=u.source:s=u.target,h=r,d=a}return[s,h,d]}function dr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);return o.attributes[s]}}function lr(n,i,t){n.prototype[i]=function(e,r){const[a]=ye(this,i,t,e,r);return a.attributes}}function cr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);return o.attributes.hasOwnProperty(s)}}function fr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ye(this,i,t,e,r,a,o);return s.attributes[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function gr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ye(this,i,t,e,r,a,o);if(typeof h!="function")throw new k(`Graph.${i}: updater should be a function.`);const d=s.attributes,l=h(d[u]);return d[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function pr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function vr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);if(!J(s))throw new k(`Graph.${i}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function mr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);if(!J(s))throw new k(`Graph.${i}: provided attributes are not a plain object.`);return Z(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function yr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);if(typeof s!="function")throw new k(`Graph.${i}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const br=[{name:n=>`get${n}Attribute`,attacher:dr},{name:n=>`get${n}Attributes`,attacher:lr},{name:n=>`has${n}Attribute`,attacher:cr},{name:n=>`set${n}Attribute`,attacher:fr},{name:n=>`update${n}Attribute`,attacher:gr},{name:n=>`remove${n}Attribute`,attacher:pr},{name:n=>`replace${n}Attributes`,attacher:vr},{name:n=>`merge${n}Attributes`,attacher:mr},{name:n=>`update${n}Attributes`,attacher:yr}];function wr(n){br.forEach(function({name:i,attacher:t}){t(n,i("Node"),Ri),t(n,i("Source"),Ai),t(n,i("Target"),hr),t(n,i("Opposite"),xi)})}function Er(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]}}function _r(n,i,t){n.prototype[i]=function(e){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(r=oe(this,a,o,t),!r)throw new C(`Graph.${i}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,r=this._edges.get(e),!r)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function Tr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(r)}}function Sr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new C(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return o.attributes[r]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Rr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new C(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new k(`Graph.${i}: updater should be a function.`);return o.attributes[r]=a(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Ar(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[r],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:r}),this}}function xr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new k(`Graph.${i}: provided attributes are not a plain object.`);return a.attributes=r,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function Cr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new k(`Graph.${i}: provided attributes are not a plain object.`);return Z(a.attributes,r),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:r}),this}}function kr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof r!="function")throw new k(`Graph.${i}: provided updater is not a function.`);return a.attributes=r(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Dr=[{name:n=>`get${n}Attribute`,attacher:Er},{name:n=>`get${n}Attributes`,attacher:_r},{name:n=>`has${n}Attribute`,attacher:Tr},{name:n=>`set${n}Attribute`,attacher:Sr},{name:n=>`update${n}Attribute`,attacher:Rr},{name:n=>`remove${n}Attribute`,attacher:Ar},{name:n=>`replace${n}Attributes`,attacher:xr},{name:n=>`merge${n}Attributes`,attacher:Cr},{name:n=>`update${n}Attributes`,attacher:kr}];function Lr(n){Dr.forEach(function({name:i,attacher:t}){t(n,i("Edge"),"mixed"),t(n,i("DirectedEdge"),"directed"),t(n,i("UndirectedEdge"),"undirected")})}const Gr=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Fr(n,i,t,e){let r=!1;for(const a in i){if(a===e)continue;const o=i[a];if(r=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&r)return o.key}}function Nr(n,i,t,e){let r,a,o,s=!1;for(const u in i)if(u!==e){r=i[u];do{if(a=r.source,o=r.target,s=t(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected),n&&s)return r.key;r=r.next}while(r!==void 0)}}function lt(n,i){const t=Object.keys(n),e=t.length;let r,a=0;return{[Symbol.iterator](){return this},next(){do if(r)r=r.next;else{if(a>=e)return{done:!0};const o=t[a++];if(o===i){r=void 0;continue}r=n[o]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}}}}function Pr(n,i,t,e){const r=i[t];if(!r)return;const a=r.source,o=r.target;if(e(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected)&&n)return r.key}function Ir(n,i,t,e){let r=i[t];if(!r)return;let a=!1;do{if(a=e(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),n&&a)return r.key;r=r.next}while(r!==void 0)}function ct(n,i){let t=n[i];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const r={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:r}}};let e=!1;return{[Symbol.iterator](){return this},next(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function Or(n,i){if(n.size===0)return[];if(i==="mixed"||i===n.type)return Array.from(n._edges.keys());const t=i==="undirected"?n.undirectedSize:n.directedSize,e=new Array(t),r=i==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===r&&(e[o++]=u.key);return e}function Ci(n,i,t,e){if(i.size===0)return;const r=t!=="mixed"&&t!==i.type,a=t==="undirected";let o,s,u=!1;const h=i._edges.values();for(;o=h.next(),o.done!==!0;){if(s=o.value,r&&s.undirected!==a)continue;const{key:d,attributes:l,source:f,target:c}=s;if(u=e(d,l,f.key,c.key,f.attributes,c.attributes,s.undirected),n&&u)return d}}function Ur(n,i){if(n.size===0)return Le();const t=i!=="mixed"&&i!==n.type,e=i==="undirected",r=n._edges.values();return{[Symbol.iterator](){return this},next(){let a,o;for(;;){if(a=r.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==e))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function Gt(n,i,t,e,r,a){const o=i?Nr:Fr;let s;if(t!=="undirected"&&(e!=="out"&&(s=o(n,r.in,a),n&&s)||e!=="in"&&(s=o(n,r.out,a,e?void 0:r.key),n&&s))||t!=="directed"&&(s=o(n,r.undirected,a),n&&s))return s}function zr(n,i,t,e){const r=[];return Gt(!1,n,i,t,e,function(a){r.push(a)}),r}function $r(n,i,t){let e=Le();return n!=="undirected"&&(i!=="out"&&typeof t.in<"u"&&(e=me(e,lt(t.in))),i!=="in"&&typeof t.out<"u"&&(e=me(e,lt(t.out,i?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=me(e,lt(t.undirected))),e}function Ft(n,i,t,e,r,a,o){const s=t?Ir:Pr;let u;if(i!=="undirected"&&(typeof r.in<"u"&&e!=="out"&&(u=s(n,r.in,a,o),n&&u)||typeof r.out<"u"&&e!=="in"&&(e||r.key!==a)&&(u=s(n,r.out,a,o),n&&u))||i!=="directed"&&typeof r.undirected<"u"&&(u=s(n,r.undirected,a,o),n&&u))return u}function Br(n,i,t,e,r){const a=[];return Ft(!1,n,i,t,e,r,function(o){a.push(o)}),a}function Mr(n,i,t,e){let r=Le();return n!=="undirected"&&(typeof t.in<"u"&&i!=="out"&&e in t.in&&(r=me(r,ct(t.in,e))),typeof t.out<"u"&&i!=="in"&&e in t.out&&(i||t.key!==e)&&(r=me(r,ct(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(r=me(r,ct(t.undirected,e))),r}function Hr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return Or(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new C(`Graph.${t}: could not find the "${a}" node in the graph.`);return zr(this.multi,e==="mixed"?this.type:e,r,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new C(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new C(`Graph.${t}: could not find the "${o}" target node in the graph.`);return Br(e,this.multi,r,s,o)}throw new k(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Wr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d,l){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return l=h,Ci(!1,this,e,l);if(arguments.length===2){h=""+h,l=d;const f=this._nodes.get(h);if(typeof f>"u")throw new C(`Graph.${a}: could not find the "${h}" node in the graph.`);return Gt(!1,this.multi,e==="mixed"?this.type:e,r,f,l)}if(arguments.length===3){h=""+h,d=""+d;const f=this._nodes.get(h);if(!f)throw new C(`Graph.${a}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(d))throw new C(`Graph.${a}: could not find the "${d}" target node in the graph.`);return Ft(!1,e,this.multi,r,f,d,l)}throw new k(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop();let l;if(h.length===0){let f=0;e!=="directed"&&(f+=this.undirectedSize),e!=="undirected"&&(f+=this.directedSize),l=new Array(f);let c=0;h.push((y,w,T,D,m,S,p)=>{l[c++]=d(y,w,T,D,m,S,p)})}else l=[],h.push((f,c,y,w,T,D,m)=>{l.push(d(f,c,y,w,T,D,m))});return this[a].apply(this,h),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop(),l=[];return h.push((f,c,y,w,T,D,m)=>{d(f,c,y,w,T,D,m)&&l.push(f)}),this[a].apply(this,h),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(){let h=Array.prototype.slice.call(arguments);if(h.length<2||h.length>4)throw new k(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${h.length}).`);if(typeof h[h.length-1]=="function"&&typeof h[h.length-2]!="function")throw new k(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let d,l;h.length===2?(d=h[0],l=h[1],h=[]):h.length===3?(d=h[1],l=h[2],h=[h[0]]):h.length===4&&(d=h[2],l=h[3],h=[h[0],h[1]]);let f=l;return h.push((c,y,w,T,D,m,S)=>{f=d(f,c,y,w,T,D,m,S)}),this[a].apply(this,h),f}}function jr(n,i){const{name:t,type:e,direction:r}=i,a="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(u,h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return d=u,Ci(!0,this,e,d);if(arguments.length===2){u=""+u,d=h;const l=this._nodes.get(u);if(typeof l>"u")throw new C(`Graph.${a}: could not find the "${u}" node in the graph.`);return Gt(!0,this.multi,e==="mixed"?this.type:e,r,l,d)}if(arguments.length===3){u=""+u,h=""+h;const l=this._nodes.get(u);if(!l)throw new C(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(h))throw new C(`Graph.${a}: could not find the "${h}" target node in the graph.`);return Ft(!0,e,this.multi,r,l,h,d)}throw new k(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,f,c,y,w,T,D)=>h(l,f,c,y,w,T,D)),!!this[a].apply(this,u)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,f,c,y,w,T,D)=>!h(l,f,c,y,w,T,D)),!this[a].apply(this,u)}}function Vr(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();if(!arguments.length)return Ur(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new C(`Graph.${a}: could not find the "${o}" node in the graph.`);return $r(e,r,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new C(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new C(`Graph.${a}: could not find the "${s}" target node in the graph.`);return Mr(e,r,u,s)}throw new k(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function qr(n){Gr.forEach(i=>{Hr(n,i),Wr(n,i),jr(n,i),Vr(n,i)})}const Kr=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function ut(){this.A=null,this.B=null}ut.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};ut.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function Oe(n,i,t,e,r){for(const a in e){const o=e[a],s=o.source,u=o.target,h=s===t?u:s;if(i&&i.has(h.key))continue;const d=r(h.key,h.attributes);if(n&&d)return h.key}}function Nt(n,i,t,e,r){if(i!=="mixed"){if(i==="undirected")return Oe(n,null,e,e.undirected,r);if(typeof t=="string")return Oe(n,null,e,e[t],r)}const a=new ut;let o;if(i!=="undirected"){if(t!=="out"){if(o=Oe(n,null,e,e.in,r),n&&o)return o;a.wrap(e.in)}if(t!=="in"){if(o=Oe(n,a,e,e.out,r),n&&o)return o;a.wrap(e.out)}}if(i!=="directed"&&(o=Oe(n,a,e,e.undirected,r),n&&o))return o}function Yr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof i=="string")return Object.keys(t[i])}const e=[];return Nt(!1,n,i,t,function(r){e.push(r)}),e}function Ue(n,i,t){const e=Object.keys(t),r=e.length;let a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=r)return n&&n.wrap(t),{done:!0};const s=t[e[a++]],u=s.source,h=s.target;if(o=u===i?h:u,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Zr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Ue(null,t,t.undirected);if(typeof i=="string")return Ue(null,t,t[i])}let e=Le();const r=new ut;return n!=="undirected"&&(i!=="out"&&(e=me(e,Ue(r,t,t.in))),i!=="in"&&(e=me(e,Ue(r,t,t.out)))),n!=="directed"&&(e=me(e,Ue(r,t,t.undirected))),e}function Xr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new C(`Graph.${t}: could not find the "${a}" node in the graph.`);return Yr(e==="mixed"?this.type:e,r,o)}}function Jr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new C(`Graph.${a}: could not find the "${h}" node in the graph.`);Nt(!1,e==="mixed"?this.type:e,r,l,d)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(h,d){const l=[];return this[a](h,(f,c)=>{l.push(d(f,c))}),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(h,d){const l=[];return this[a](h,(f,c)=>{d(f,c)&&l.push(f)}),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(h,d,l){if(arguments.length<3)throw new k(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let f=l;return this[a](h,(c,y)=>{f=d(f,c,y)}),f}}function Qr(n,i){const{name:t,type:e,direction:r}=i,a=t[0].toUpperCase()+t.slice(1,-1),o="find"+a;n.prototype[o]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new C(`Graph.${o}: could not find the "${h}" node in the graph.`);return Nt(!0,e==="mixed"?this.type:e,r,l,d)};const s="some"+a;n.prototype[s]=function(h,d){return!!this[o](h,d)};const u="every"+a;n.prototype[u]=function(h,d){return!this[o](h,(f,c)=>!d(f,c))}}function en(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new C(`Graph.${a}: could not find the "${o}" node in the graph.`);return Zr(e==="mixed"?this.type:e,r,s)}}function tn(n){Kr.forEach(i=>{Xr(n,i),Jr(n,i),Qr(n,i),en(n,i)})}function tt(n,i,t,e,r){const a=e._nodes.values(),o=e.type;let s,u,h,d,l,f;for(;s=a.next(),s.done!==!0;){let c=!1;if(u=s.value,o!=="undirected"){d=u.out;for(h in d){l=d[h];do f=l.target,c=!0,r(u.key,f.key,u.attributes,f.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}if(o!=="directed"){d=u.undirected;for(h in d)if(!(i&&u.key>h)){l=d[h];do f=l.target,f.key!==h&&(f=l.source),c=!0,r(u.key,f.key,u.attributes,f.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}t&&!c&&r(u.key,null,u.attributes,null,null,null,null)}}function rn(n,i){const t={key:n};return Ei(i.attributes)||(t.attributes=Z({},i.attributes)),t}function nn(n,i,t){const e={key:i,source:t.source.key,target:t.target.key};return Ei(t.attributes)||(e.attributes=Z({},t.attributes)),n==="mixed"&&t.undirected&&(e.undirected=!0),e}function an(n){if(!J(n))throw new k('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new k("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new k("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function on(n){if(!J(n))throw new k('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new k("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new k("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new k("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new k("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const sn=ur(),un=new Set(["directed","undirected","mixed"]),Bt=new Set(["domain","_events","_eventsCount","_maxListeners"]),hn=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],dn={allowSelfLoops:!0,multi:!1,type:"mixed"};function ln(n,i,t){if(t&&!J(t))throw new k(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(i=""+i,t=t||{},n._nodes.has(i))throw new I(`Graph.addNode: the "${i}" node already exist in the graph.`);const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function Mt(n,i,t){const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function ki(n,i,t,e,r,a,o,s){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!J(s))throw new k(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),h=n._nodes.get(o);if(!u)throw new C(`Graph.${i}: source node "${a}" not found.`);if(!h)throw new C(`Graph.${i}: target node "${o}" not found.`);const d={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new I(`Graph.${i}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const l=new Ge(e,r,u,h,s);n._edges.set(r,l);const f=a===o;return e?(u.undirectedDegree++,h.undirectedDegree++,f&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,f&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),e?n._undirectedSize++:n._directedSize++,d.key=r,n.emit("edgeAdded",d),r}function cn(n,i,t,e,r,a,o,s,u){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new k(`Graph.${i}: invalid updater function. Expecting a function but got "${s}"`)}else if(!J(s))throw new k(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let h;if(u&&(h=s,s=void 0),!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=n._nodes.get(a),l=n._nodes.get(o),f,c;if(!t&&(f=n._edges.get(r),f)){if((f.source.key!==a||f.target.key!==o)&&(!e||f.source.key!==o||f.target.key!==a))throw new I(`Graph.${i}: inconsistency detected when attempting to merge the "${r}" edge with "${a}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);c=f}if(!c&&!n.multi&&d&&(c=e?d.undirected[o]:d.out[o]),c){const m=[c.key,!1,!1,!1];if(u?!h:!s)return m;if(u){const S=c.attributes;c.attributes=h(S),n.emit("edgeAttributesUpdated",{type:"replace",key:c.key,attributes:c.attributes})}else Z(c.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:c.key,attributes:c.attributes,data:s});return m}s=s||{},u&&h&&(s=h(s));const y={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);let w=!1,T=!1;d||(d=Mt(n,a,{}),w=!0,a===o&&(l=d,T=!0)),l||(l=Mt(n,o,{}),T=!0),f=new Ge(e,r,d,l,s),n._edges.set(r,f);const D=a===o;return e?(d.undirectedDegree++,l.undirectedDegree++,D&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,l.inDegree++,D&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?f.attachMulti():f.attach(),e?n._undirectedSize++:n._directedSize++,y.key=r,n.emit("edgeAdded",y),[r,!0,w,T]}function xe(n,i){n._edges.delete(i.key);const{source:t,target:e,attributes:r}=i,a=i.undirected,o=t===e;a?(t.undirectedDegree--,e.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,e.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?i.detachMulti():i.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:i.key,attributes:r,source:t.key,target:e.key,undirected:a})}class j extends wi.EventEmitter{constructor(i){if(super(),i=Z({},dn,i),typeof i.multi!="boolean")throw new k(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${i.multi}".`);if(!un.has(i.type))throw new k(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${i.type}".`);if(typeof i.allowSelfLoops!="boolean")throw new k(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${i.allowSelfLoops}".`);const t=i.type==="mixed"?_i:i.type==="directed"?Ti:Si;ae(this,"NodeDataClass",t);const e="geid_"+sn()+"_";let r=0;const a=()=>{let o;do o=e+r++;while(this._edges.has(o));return o};ae(this,"_attributes",{}),ae(this,"_nodes",new Map),ae(this,"_edges",new Map),ae(this,"_directedSize",0),ae(this,"_undirectedSize",0),ae(this,"_directedSelfLoopCount",0),ae(this,"_undirectedSelfLoopCount",0),ae(this,"_edgeKeyGenerator",a),ae(this,"_options",i),Bt.forEach(o=>ae(this,o,this[o])),he(this,"order",()=>this._nodes.size),he(this,"size",()=>this._edges.size),he(this,"directedSize",()=>this._directedSize),he(this,"undirectedSize",()=>this._undirectedSize),he(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),he(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),he(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),he(this,"multi",this._options.multi),he(this,"type",this._options.type),he(this,"allowSelfLoops",this._options.allowSelfLoops),he(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(i){return this._nodes.has(""+i)}hasDirectedEdge(i,t){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&!r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.out.hasOwnProperty(t):!1}throw new k(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(i,t){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.undirected.hasOwnProperty(t):!1}throw new k(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(i,t){if(arguments.length===1){const e=""+i;return this._edges.has(e)}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?typeof e.out<"u"&&e.out.hasOwnProperty(t)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(t):!1}throw new k(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(i,t){if(this.type==="undirected")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(i);if(!e)throw new C(`Graph.directedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new C(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||void 0;if(r)return r.key}undirectedEdge(i,t){if(this.type==="directed")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(i);if(!e)throw new C(`Graph.undirectedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new C(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=e.undirected&&e.undirected[t]||void 0;if(r)return r.key}edge(i,t){if(this.multi)throw new I("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.edge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new C(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||e.undirected&&e.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areDirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in||t in e.out}areOutNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areOutNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.out}areInNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areInNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in}areUndirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areUndirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="directed"?!1:t in e.undirected}areNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&(t in e.in||t in e.out)||this.type!=="directed"&&t in e.undirected}areInboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areInboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.in||this.type!=="directed"&&t in e.undirected}areOutboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areOutboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.out||this.type!=="directed"&&t in e.undirected}inDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.inDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.outDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.directedDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.undirectedDegree: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.inboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree),e}outboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.outboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.outDegree),e}degree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.degree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree),e}inDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.inDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.outDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.directedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree,r+=t.directedLoops),e-r}outboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.outDegree,r+=t.directedLoops),e-r}degreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.degreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree,r+=t.directedLoops*2),e-r}source(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.source: could not find the "${i}" edge in the graph.`);return t.source.key}target(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.target: could not find the "${i}" edge in the graph.`);return t.target.key}extremities(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.extremities: could not find the "${i}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(i,t){i=""+i,t=""+t;const e=this._edges.get(t);if(!e)throw new C(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=e.source.key,a=e.target.key;if(i===r)return a;if(i===a)return r;throw new C(`Graph.opposite: the "${i}" node is not attached to the "${t}" edge (${r}, ${a}).`)}hasExtremity(i,t){i=""+i,t=""+t;const e=this._edges.get(i);if(!e)throw new C(`Graph.hasExtremity: could not find the "${i}" edge in the graph.`);return e.source.key===t||e.target.key===t}isUndirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.isUndirected: could not find the "${i}" edge in the graph.`);return t.undirected}isDirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.isDirected: could not find the "${i}" edge in the graph.`);return!t.undirected}isSelfLoop(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.isSelfLoop: could not find the "${i}" edge in the graph.`);return t.source===t.target}addNode(i,t){return ln(this,i,t).key}mergeNode(i,t){if(t&&!J(t))throw new k(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);i=""+i,t=t||{};let e=this._nodes.get(i);return e?(t&&(Z(e.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:i,attributes:e.attributes,data:t})),[i,!1]):(e=new this.NodeDataClass(i,t),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:t}),[i,!0])}updateNode(i,t){if(t&&typeof t!="function")throw new k(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);i=""+i;let e=this._nodes.get(i);if(e){if(t){const a=e.attributes;e.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:i,attributes:e.attributes})}return[i,!1]}const r=t?t({}):{};return e=new this.NodeDataClass(i,r),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:r}),[i,!0]}dropNode(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.dropNode: could not find the "${i}" node in the graph.`);let e;if(this.type!=="undirected"){for(const r in t.out){e=t.out[r];do xe(this,e),e=e.next;while(e)}for(const r in t.in){e=t.in[r];do xe(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const r in t.undirected){e=t.undirected[r];do xe(this,e),e=e.next;while(e)}this._nodes.delete(i),this.emit("nodeDropped",{key:i,attributes:t.attributes})}dropEdge(i){let t;if(arguments.length>1){const e=""+arguments[0],r=""+arguments[1];if(t=oe(this,e,r,this.type),!t)throw new C(`Graph.dropEdge: could not find the "${e}" -> "${r}" edge in the graph.`)}else if(i=""+i,t=this._edges.get(i),!t)throw new C(`Graph.dropEdge: could not find the "${i}" edge in the graph.`);return xe(this,t),this}dropDirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");i=""+i,t=""+t;const e=oe(this,i,t,"directed");if(!e)throw new C(`Graph.dropDirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return xe(this,e),this}dropUndirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const e=oe(this,i,t,"undirected");if(!e)throw new C(`Graph.dropUndirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return xe(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const i=this._nodes.values();let t;for(;t=i.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(i){return this._attributes[i]}getAttributes(){return this._attributes}hasAttribute(i){return this._attributes.hasOwnProperty(i)}setAttribute(i,t){return this._attributes[i]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}updateAttribute(i,t){if(typeof t!="function")throw new k("Graph.updateAttribute: updater should be a function.");const e=this._attributes[i];return this._attributes[i]=t(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}removeAttribute(i){return delete this._attributes[i],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:i}),this}replaceAttributes(i){if(!J(i))throw new k("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=i,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(i){if(!J(i))throw new k("Graph.mergeAttributes: provided attributes are not a plain object.");return Z(this._attributes,i),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:i}),this}updateAttributes(i){if(typeof i!="function")throw new k("Graph.updateAttributes: provided updater is not a function.");return this._attributes=i(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(i,t){if(typeof i!="function")throw new k("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!$t(t))throw new k("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,a.attributes=i(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(i,t){if(typeof i!="function")throw new k("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!$t(t))throw new k("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let r,a,o,s;for(;r=e.next(),r.done!==!0;)a=r.value,o=a.source,s=a.target,a.attributes=i(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(i){if(typeof i!="function")throw new k("Graph.forEachAdjacencyEntry: expecting a callback.");tt(!1,!1,!1,this,i)}forEachAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new k("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");tt(!1,!1,!0,this,i)}forEachAssymetricAdjacencyEntry(i){if(typeof i!="function")throw new k("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");tt(!1,!0,!1,this,i)}forEachAssymetricAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new k("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");tt(!1,!0,!0,this,i)}nodes(){return Array.from(this._nodes.keys())}forEachNode(i){if(typeof i!="function")throw new k("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)}findNode(i){if(typeof i!="function")throw new k("Graph.findNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return r.key}mapNodes(i){if(typeof i!="function")throw new k("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let e,r;const a=new Array(this.order);let o=0;for(;e=t.next(),e.done!==!0;)r=e.value,a[o++]=i(r.key,r.attributes);return a}someNode(i){if(typeof i!="function")throw new k("Graph.someNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return!0;return!1}everyNode(i){if(typeof i!="function")throw new k("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,!i(r.key,r.attributes))return!1;return!0}filterNodes(i){if(typeof i!="function")throw new k("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let e,r;const a=[];for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)&&a.push(r.key);return a}reduceNodes(i,t){if(typeof i!="function")throw new k("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new k("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let e=t;const r=this._nodes.values();let a,o;for(;a=r.next(),a.done!==!0;)o=a.value,e=i(e,o.key,o.attributes);return e}nodeEntries(){const i=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=i.next();if(t.done)return t;const e=t.value;return{value:{node:e.key,attributes:e.attributes},done:!1}}}}export(){const i=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,a)=>{i[t++]=rn(a,r)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((r,a)=>{e[t++]=nn(this.type,a,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:i,edges:e}}import(i,t=!1){if(i instanceof j)return i.forEachNode((u,h)=>{t?this.mergeNode(u,h):this.addNode(u,h)}),i.forEachEdge((u,h,d,l,f,c,y)=>{t?y?this.mergeUndirectedEdgeWithKey(u,d,l,h):this.mergeDirectedEdgeWithKey(u,d,l,h):y?this.addUndirectedEdgeWithKey(u,d,l,h):this.addDirectedEdgeWithKey(u,d,l,h)}),this;if(!J(i))throw new k("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(i.attributes){if(!J(i.attributes))throw new k("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(i.attributes):this.replaceAttributes(i.attributes)}let e,r,a,o,s;if(i.nodes){if(a=i.nodes,!Array.isArray(a))throw new k("Graph.import: invalid nodes. Expecting an array.");for(e=0,r=a.length;e{const a=Z({},e.attributes);e=new t.NodeDataClass(r,a),t._nodes.set(r,e)}),t}copy(i){if(i=i||{},typeof i.type=="string"&&i.type!==this.type&&i.type!=="mixed")throw new I(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${i.type}" because this would mean losing information about the current graph.`);if(typeof i.multi=="boolean"&&i.multi!==this.multi&&i.multi!==!0)throw new I("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof i.allowSelfLoops=="boolean"&&i.allowSelfLoops!==this.allowSelfLoops&&i.allowSelfLoops!==!0)throw new I("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(i),e=this._edges.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,ki(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,Z({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const i={};this._nodes.forEach((a,o)=>{i[o]=a.attributes});const t={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",h=a.source.key,d=a.target.key,l;a.undirected&&h>d&&(l=h,h=d,d=l);const f=`(${h})${s}(${d})`;o.startsWith("geid_")?this.multi&&(typeof e[f]>"u"?e[f]=0:e[f]++,u+=`${e[f]}. `):u+=`[${o}]: `,u+=f,t[u]=a.attributes});const r={};for(const a in this)this.hasOwnProperty(a)&&!Bt.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(r[a]=this[a]);return r.attributes=this._attributes,r.nodes=i,r.edges=t,ae(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(j.prototype[Symbol.for("nodejs.util.inspect.custom")]=j.prototype.inspect);hn.forEach(n=>{["add","merge","update"].forEach(i=>{const t=n.name(i),e=i==="add"?ki:cn;n.generateKey?j.prototype[t]=function(r,a,o){return e(this,t,!0,(n.type||this.type)==="undirected",null,r,a,o,i==="update")}:j.prototype[t]=function(r,a,o,s){return e(this,t,!1,(n.type||this.type)==="undirected",r,a,o,s,i==="update")}})});wr(j);Lr(j);qr(j);tn(j);class Di extends j{constructor(i){const t=Z({type:"directed"},i);if("multi"in t&&t.multi!==!1)throw new k("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new k('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Li extends j{constructor(i){const t=Z({type:"undirected"},i);if("multi"in t&&t.multi!==!1)throw new k("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new k('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Gi extends j{constructor(i){const t=Z({multi:!0},i);if("multi"in t&&t.multi!==!0)throw new k("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class Fi extends j{constructor(i){const t=Z({type:"directed",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new k("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new k('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Ni extends j{constructor(i){const t=Z({type:"undirected",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new k("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new k('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Fe(n){n.from=function(i,t){const e=Z({},i.options,t),r=new n(e);return r.import(i),r}}Fe(j);Fe(Di);Fe(Li);Fe(Gi);Fe(Fi);Fe(Ni);j.Graph=j;j.DirectedGraph=Di;j.UndirectedGraph=Li;j.MultiGraph=Gi;j.MultiDirectedGraph=Fi;j.MultiUndirectedGraph=Ni;j.InvalidArgumentsGraphError=k;j.NotFoundGraphError=C;j.UsageGraphError=I;var ft,Ht;function Pi(){return Ht||(Ht=1,ft=function(i){return i!==null&&typeof i=="object"&&typeof i.addUndirectedEdgeWithKey=="function"&&typeof i.dropNode=="function"&&typeof i.multi=="boolean"}),ft}var ze={},Wt;function fn(){if(Wt)return ze;Wt=1;function n(e){return typeof e!="number"||isNaN(e)?1:e}function i(e,r){var a={},o=function(h){return typeof h>"u"?r:h};typeof r=="function"&&(o=r);var s=function(h){return o(h[e])},u=function(){return o(void 0)};return typeof e=="string"?(a.fromAttributes=s,a.fromGraph=function(h,d){return s(h.getNodeAttributes(d))},a.fromEntry=function(h,d){return s(d)}):typeof e=="function"?(a.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},a.fromGraph=function(h,d){return o(e(d,h.getNodeAttributes(d)))},a.fromEntry=function(h,d){return o(e(h,d))}):(a.fromAttributes=u,a.fromGraph=u,a.fromEntry=u),a}function t(e,r){var a={},o=function(h){return typeof h>"u"?r:h};typeof r=="function"&&(o=r);var s=function(h){return o(h[e])},u=function(){return o(void 0)};return typeof e=="string"?(a.fromAttributes=s,a.fromGraph=function(h,d){return s(h.getEdgeAttributes(d))},a.fromEntry=function(h,d){return s(d)},a.fromPartialEntry=a.fromEntry,a.fromMinimalEntry=a.fromEntry):typeof e=="function"?(a.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},a.fromGraph=function(h,d){var l=h.extremities(d);return o(e(d,h.getEdgeAttributes(d),l[0],l[1],h.getNodeAttributes(l[0]),h.getNodeAttributes(l[1]),h.isUndirected(d)))},a.fromEntry=function(h,d,l,f,c,y,w){return o(e(h,d,l,f,c,y,w))},a.fromPartialEntry=function(h,d,l,f){return o(e(h,d,l,f))},a.fromMinimalEntry=function(h,d){return o(e(h,d))}):(a.fromAttributes=u,a.fromGraph=u,a.fromEntry=u,a.fromMinimalEntry=u),a}return ze.createNodeValueGetter=i,ze.createEdgeValueGetter=t,ze.createEdgeWeightGetter=function(e){return t(e,n)},ze}var gt,jt;function gn(){if(jt)return gt;jt=1;var n=0,i=1,t=2,e=3,r=4,a=5,o=6,s=7,u=8,h=9,d=0,l=1,f=2,c=0,y=1,w=2,T=3,D=4,m=5,S=6,p=7,b=8,R=3,A=10,G=3,F=9,P=10;return gt=function(z,g,K){var te,x,v,$,W,X,ie,Y,N,Ne,re=g.length,tr=K.length,Pe=z.adjustSizes,ir=z.barnesHutTheta*z.barnesHutTheta,qe,q,B,M,fe,U,O,E=[];for(v=0;vYe?(Ee-=(Ke-Ye)/2,Re=Ee+Ke):(we-=(Ye-Ke)/2,Se=we+Ye),E[0+c]=-1,E[0+y]=(we+Se)/2,E[0+w]=(Ee+Re)/2,E[0+T]=Math.max(Se-we,Re-Ee),E[0+D]=-1,E[0+m]=-1,E[0+S]=0,E[0+p]=0,E[0+b]=0,te=1,v=0;v=0){g[v+n]=0)if(U=Math.pow(g[v+n]-E[x+p],2)+Math.pow(g[v+i]-E[x+b],2),Ne=E[x+T],4*Ne*Ne/U0?(O=q*g[v+o]*E[x+S]/U,g[v+t]+=B*O,g[v+e]+=M*O):U<0&&(O=-q*g[v+o]*E[x+S]/Math.sqrt(U),g[v+t]+=B*O,g[v+e]+=M*O):U>0&&(O=q*g[v+o]*E[x+S]/U,g[v+t]+=B*O,g[v+e]+=M*O),x=E[x+D],x<0)break;continue}else{x=E[x+m];continue}else{if(X=E[x+c],X>=0&&X!==v&&(B=g[v+n]-g[X+n],M=g[v+i]-g[X+i],U=B*B+M*M,Pe===!0?U>0?(O=q*g[v+o]*g[X+o]/U,g[v+t]+=B*O,g[v+e]+=M*O):U<0&&(O=-q*g[v+o]*g[X+o]/Math.sqrt(U),g[v+t]+=B*O,g[v+e]+=M*O):U>0&&(O=q*g[v+o]*g[X+o]/U,g[v+t]+=B*O,g[v+e]+=M*O)),x=E[x+D],x<0)break;continue}else for(q=z.scalingRatio,$=0;$0?(O=q*g[$+o]*g[W+o]/U/U,g[$+t]+=B*O,g[$+e]+=M*O,g[W+t]-=B*O,g[W+e]-=M*O):U<0&&(O=100*q*g[$+o]*g[W+o],g[$+t]+=B*O,g[$+e]+=M*O,g[W+t]-=B*O,g[W+e]-=M*O)):(U=Math.sqrt(B*B+M*M),U>0&&(O=q*g[$+o]*g[W+o]/U/U,g[$+t]+=B*O,g[$+e]+=M*O,g[W+t]-=B*O,g[W+e]-=M*O));for(N=z.gravity/z.scalingRatio,q=z.scalingRatio,v=0;v0&&(O=q*g[v+o]*N):U>0&&(O=q*g[v+o]*N/U),g[v+t]-=B*O,g[v+e]-=M*O;for(q=1*(z.outboundAttractionDistribution?qe:1),ie=0;ie0&&(O=-q*fe*Math.log(1+U)/U/g[$+o]):U>0&&(O=-q*fe*Math.log(1+U)/U):z.outboundAttractionDistribution?U>0&&(O=-q*fe/g[$+o]):U>0&&(O=-q*fe)):(U=Math.sqrt(Math.pow(B,2)+Math.pow(M,2)),z.linLogMode?z.outboundAttractionDistribution?U>0&&(O=-q*fe*Math.log(1+U)/U/g[$+o]):U>0&&(O=-q*fe*Math.log(1+U)/U):z.outboundAttractionDistribution?(U=1,O=-q*fe/g[$+o]):(U=1,O=-q*fe)),U>0&&(g[$+t]+=B*O,g[$+e]+=M*O,g[W+t]-=B*O,g[W+e]-=M*O);var Ze,Ie,Xe,_e,Je,Qe;if(Pe===!0)for(v=0;vP&&(g[v+t]=g[v+t]*P/Ze,g[v+e]=g[v+e]*P/Ze),Ie=g[v+o]*Math.sqrt((g[v+r]-g[v+t])*(g[v+r]-g[v+t])+(g[v+a]-g[v+e])*(g[v+a]-g[v+e])),Xe=Math.sqrt((g[v+r]+g[v+t])*(g[v+r]+g[v+t])+(g[v+a]+g[v+e])*(g[v+a]+g[v+e]))/2,_e=.1*Math.log(1+Xe)/(1+Math.sqrt(Ie)),Je=g[v+n]+g[v+t]*(_e/z.slowDown),g[v+n]=Je,Qe=g[v+i]+g[v+e]*(_e/z.slowDown),g[v+i]=Qe);else for(v=0;v=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in t&&typeof t.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in t&&!(typeof t.gravity=="number"&&t.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in t&&!(typeof t.slowDown=="number"||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&typeof t.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in t&&!(typeof t.barnesHutTheta=="number"&&t.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},ge.graphToByteArrays=function(t,e){var r=t.order,a=t.size,o={},s,u=new Float32Array(r*n),h=new Float32Array(a*i);return s=0,t.forEachNode(function(d,l){o[d]=s,u[s]=l.x,u[s+1]=l.y,u[s+2]=0,u[s+3]=0,u[s+4]=0,u[s+5]=0,u[s+6]=1,u[s+7]=1,u[s+8]=l.size||1,u[s+9]=l.fixed?1:0,s+=n}),s=0,t.forEachEdge(function(d,l,f,c,y,w,T){var D=o[f],m=o[c],S=e(d,l,f,c,y,w,T);u[D+6]+=S,u[m+6]+=S,h[s]=D,h[s+1]=m,h[s+2]=S,s+=i}),{nodes:u,edges:h}},ge.assignLayoutChanges=function(t,e,r){var a=0;t.updateEachNodeAttributes(function(o,s){return s.x=e[a],s.y=e[a+1],a+=n,r?r(o,s):s})},ge.readGraphPositions=function(t,e){var r=0;t.forEachNode(function(a,o){e[r]=o.x,e[r+1]=o.y,r+=n})},ge.collectLayoutChanges=function(t,e,r){for(var a=t.nodes(),o={},s=0,u=0,h=e.length;s2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(h)}}var s=a.bind(null,!1);return s.assign=a.bind(null,!0),s.inferSettings=o,vt=s,vt}var yn=mn();const it=bi(yn);function bn(n,i){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,i);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function je(n){var i=bn(n,"string");return typeof i=="symbol"?i:i+""}function Q(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}function Yt(n,i){for(var t=0;tn.length)&&(i=n.length);for(var t=0,e=Array(i);t0&&(P=R[0]),P instanceof Error)throw P;var V=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw V.context=P,V}var z=F[b];if(z===void 0)return!1;if(typeof z=="function")i(z,this,R);else for(var g=z.length,K=y(z,g),A=0;A0&&P.length>G&&!P.warned){P.warned=!0;var V=new Error("Possible EventEmitter memory leak detected. "+P.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");V.name="MaxListenersExceededWarning",V.emitter=p,V.type=b,V.count=P.length,e(V)}return p}a.prototype.addListener=function(b,R){return h(this,b,R,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(b,R){return h(this,b,R,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(p,b,R){var A={fired:!1,wrapFn:void 0,target:p,type:b,listener:R},G=d.bind(A);return G.listener=R,A.wrapFn=G,G}a.prototype.once=function(b,R){return s(R),this.on(b,l(this,b,R)),this},a.prototype.prependOnceListener=function(b,R){return s(R),this.prependListener(b,l(this,b,R)),this},a.prototype.removeListener=function(b,R){var A,G,F,P,V;if(s(R),G=this._events,G===void 0)return this;if(A=G[b],A===void 0)return this;if(A===R||A.listener===R)--this._eventsCount===0?this._events=Object.create(null):(delete G[b],G.removeListener&&this.emit("removeListener",b,A.listener||R));else if(typeof A!="function"){for(F=-1,P=A.length-1;P>=0;P--)if(A[P]===R||A[P].listener===R){V=A[P].listener,F=P;break}if(F<0)return this;F===0?A.shift():w(A,F),A.length===1&&(G[b]=A[0]),G.removeListener!==void 0&&this.emit("removeListener",b,V||R)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(b){var R,A,G;if(A=this._events,A===void 0)return this;if(A.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):A[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete A[b]),this;if(arguments.length===0){var F=Object.keys(A),P;for(G=0;G=0;G--)this.removeListener(b,R[G]);return this};function f(p,b,R){var A=p._events;if(A===void 0)return[];var G=A[b];return G===void 0?[]:typeof G=="function"?R?[G.listener||G]:[G]:R?T(G):y(G,G.length)}a.prototype.listeners=function(b){return f(this,b,!0)},a.prototype.rawListeners=function(b){return f(this,b,!1)},a.listenerCount=function(p,b){return typeof p.listenerCount=="function"?p.listenerCount(b):c.call(p,b)},a.prototype.listenerCount=c;function c(p){var b=this._events;if(b!==void 0){var R=b[p];if(typeof R=="function")return 1;if(R!==void 0)return R.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function y(p,b){for(var R=new Array(b),A=0;An++}function me(){const n=arguments;let i=null,t=-1;return{[Symbol.iterator](){return this},next(){let e=null;do{if(i===null){if(t++,t>=n.length)return{done:!0};i=n[t][Symbol.iterator]()}if(e=i.next(),e.done){i=null;continue}break}while(!0);return e}}}function Le(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Lt extends Error{constructor(i){super(),this.name="GraphError",this.message=i}}class k extends Lt{constructor(i){super(i),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,k.prototype.constructor)}}class C extends Lt{constructor(i){super(i),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,C.prototype.constructor)}}class I extends Lt{constructor(i){super(i),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,I.prototype.constructor)}}function _i(n,i){this.key=n,this.attributes=i,this.clear()}_i.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function Ti(n,i){this.key=n,this.attributes=i,this.clear()}Ti.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Si(n,i){this.key=n,this.attributes=i,this.clear()}Si.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Ge(n,i,t,e,r){this.key=i,this.attributes=r,this.undirected=n,this.source=t,this.target=e}Ge.prototype.attach=function(){let n="out",i="in";this.undirected&&(n=i="undirected");const t=this.source.key,e=this.target.key;this.source[n][e]=this,!(this.undirected&&t===e)&&(this.target[i][t]=this)};Ge.prototype.attachMulti=function(){let n="out",i="in";const t=this.source.key,e=this.target.key;this.undirected&&(n=i="undirected");const r=this.source[n],a=r[e];if(typeof a>"u"){r[e]=this,this.undirected&&t===e||(this.target[i][t]=this);return}a.previous=this,this.next=a,r[e]=this,this.target[i][t]=this};Ge.prototype.detach=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),delete this.source[t][i],delete this.target[e][n]};Ge.prototype.detachMulti=function(){const n=this.source.key,i=this.target.key;let t="out",e="in";this.undirected&&(t=e="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][i],delete this.target[e][n]):(this.next.previous=void 0,this.source[t][i]=this.next,this.target[e][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Ri=0,Ai=1,hr=2,xi=3;function ye(n,i,t,e,r,a,o){let s,u,h,d;if(e=""+e,t===Ri){if(s=n._nodes.get(e),!s)throw new C(`Graph.${i}: could not find the "${e}" node in the graph.`);h=r,d=a}else if(t===xi){if(r=""+r,u=n._edges.get(r),!u)throw new C(`Graph.${i}: could not find the "${r}" edge in the graph.`);const l=u.source.key,f=u.target.key;if(e===l)s=u.target;else if(e===f)s=u.source;else throw new C(`Graph.${i}: the "${e}" node is not attached to the "${r}" edge (${l}, ${f}).`);h=a,d=o}else{if(u=n._edges.get(e),!u)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`);t===Ai?s=u.source:s=u.target,h=r,d=a}return[s,h,d]}function dr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);return o.attributes[s]}}function lr(n,i,t){n.prototype[i]=function(e,r){const[a]=ye(this,i,t,e,r);return a.attributes}}function cr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);return o.attributes.hasOwnProperty(s)}}function fr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ye(this,i,t,e,r,a,o);return s.attributes[u]=h,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function gr(n,i,t){n.prototype[i]=function(e,r,a,o){const[s,u,h]=ye(this,i,t,e,r,a,o);if(typeof h!="function")throw new k(`Graph.${i}: updater should be a function.`);const d=s.attributes,l=h(d[u]);return d[u]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:u}),this}}function pr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);return delete o.attributes[s],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:s}),this}}function vr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);if(!J(s))throw new k(`Graph.${i}: provided attributes are not a plain object.`);return o.attributes=s,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function mr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);if(!J(s))throw new k(`Graph.${i}: provided attributes are not a plain object.`);return Z(o.attributes,s),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:s}),this}}function yr(n,i,t){n.prototype[i]=function(e,r,a){const[o,s]=ye(this,i,t,e,r,a);if(typeof s!="function")throw new k(`Graph.${i}: provided updater is not a function.`);return o.attributes=s(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const br=[{name:n=>`get${n}Attribute`,attacher:dr},{name:n=>`get${n}Attributes`,attacher:lr},{name:n=>`has${n}Attribute`,attacher:cr},{name:n=>`set${n}Attribute`,attacher:fr},{name:n=>`update${n}Attribute`,attacher:gr},{name:n=>`remove${n}Attribute`,attacher:pr},{name:n=>`replace${n}Attributes`,attacher:vr},{name:n=>`merge${n}Attributes`,attacher:mr},{name:n=>`update${n}Attributes`,attacher:yr}];function wr(n){br.forEach(function({name:i,attacher:t}){t(n,i("Node"),Ri),t(n,i("Source"),Ai),t(n,i("Target"),hr),t(n,i("Opposite"),xi)})}function Er(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]}}function _r(n,i,t){n.prototype[i]=function(e){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+e,o=""+arguments[1];if(r=oe(this,a,o,t),!r)throw new C(`Graph.${i}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,r=this._edges.get(e),!r)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function Tr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(r)}}function Sr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new C(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return o.attributes[r]=a,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Rr(n,i,t){n.prototype[i]=function(e,r,a){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+e,u=""+r;if(r=arguments[2],a=arguments[3],o=oe(this,s,u,t),!o)throw new C(`Graph.${i}: could not find an edge for the given path ("${s}" - "${u}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,o=this._edges.get(e),!o)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new k(`Graph.${i}: updater should be a function.`);return o.attributes[r]=a(o.attributes[r]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:r}),this}}function Ar(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return delete a.attributes[r],this.emit("edgeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:r}),this}}function xr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new k(`Graph.${i}: provided attributes are not a plain object.`);return a.attributes=r,this.emit("edgeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function Cr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new k(`Graph.${i}: provided attributes are not a plain object.`);return Z(a.attributes,r),this.emit("edgeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:r}),this}}function kr(n,i,t){n.prototype[i]=function(e,r){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new I(`Graph.${i}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new I(`Graph.${i}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+e,s=""+r;if(r=arguments[2],a=oe(this,o,s,t),!a)throw new C(`Graph.${i}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new I(`Graph.${i}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=""+e,a=this._edges.get(e),!a)throw new C(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof r!="function")throw new k(`Graph.${i}: provided updater is not a function.`);return a.attributes=r(a.attributes),this.emit("edgeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Dr=[{name:n=>`get${n}Attribute`,attacher:Er},{name:n=>`get${n}Attributes`,attacher:_r},{name:n=>`has${n}Attribute`,attacher:Tr},{name:n=>`set${n}Attribute`,attacher:Sr},{name:n=>`update${n}Attribute`,attacher:Rr},{name:n=>`remove${n}Attribute`,attacher:Ar},{name:n=>`replace${n}Attributes`,attacher:xr},{name:n=>`merge${n}Attributes`,attacher:Cr},{name:n=>`update${n}Attributes`,attacher:kr}];function Lr(n){Dr.forEach(function({name:i,attacher:t}){t(n,i("Edge"),"mixed"),t(n,i("DirectedEdge"),"directed"),t(n,i("UndirectedEdge"),"undirected")})}const Gr=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Fr(n,i,t,e){let r=!1;for(const a in i){if(a===e)continue;const o=i[a];if(r=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),n&&r)return o.key}}function Nr(n,i,t,e){let r,a,o,s=!1;for(const u in i)if(u!==e){r=i[u];do{if(a=r.source,o=r.target,s=t(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected),n&&s)return r.key;r=r.next}while(r!==void 0)}}function lt(n,i){const t=Object.keys(n),e=t.length;let r,a=0;return{[Symbol.iterator](){return this},next(){do if(r)r=r.next;else{if(a>=e)return{done:!0};const o=t[a++];if(o===i){r=void 0;continue}r=n[o]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}}}}function Pr(n,i,t,e){const r=i[t];if(!r)return;const a=r.source,o=r.target;if(e(r.key,r.attributes,a.key,o.key,a.attributes,o.attributes,r.undirected)&&n)return r.key}function Ir(n,i,t,e){let r=i[t];if(!r)return;let a=!1;do{if(a=e(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),n&&a)return r.key;r=r.next}while(r!==void 0)}function ct(n,i){let t=n[i];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const r={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:r}}};let e=!1;return{[Symbol.iterator](){return this},next(){return e===!0?{done:!0}:(e=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function Or(n,i){if(n.size===0)return[];if(i==="mixed"||i===n.type)return Array.from(n._edges.keys());const t=i==="undirected"?n.undirectedSize:n.directedSize,e=new Array(t),r=i==="undirected",a=n._edges.values();let o=0,s,u;for(;s=a.next(),s.done!==!0;)u=s.value,u.undirected===r&&(e[o++]=u.key);return e}function Ci(n,i,t,e){if(i.size===0)return;const r=t!=="mixed"&&t!==i.type,a=t==="undirected";let o,s,u=!1;const h=i._edges.values();for(;o=h.next(),o.done!==!0;){if(s=o.value,r&&s.undirected!==a)continue;const{key:d,attributes:l,source:f,target:c}=s;if(u=e(d,l,f.key,c.key,f.attributes,c.attributes,s.undirected),n&&u)return d}}function Ur(n,i){if(n.size===0)return Le();const t=i!=="mixed"&&i!==n.type,e=i==="undirected",r=n._edges.values();return{[Symbol.iterator](){return this},next(){let a,o;for(;;){if(a=r.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==e))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}}}}function Gt(n,i,t,e,r,a){const o=i?Nr:Fr;let s;if(t!=="undirected"&&(e!=="out"&&(s=o(n,r.in,a),n&&s)||e!=="in"&&(s=o(n,r.out,a,e?void 0:r.key),n&&s))||t!=="directed"&&(s=o(n,r.undirected,a),n&&s))return s}function zr(n,i,t,e){const r=[];return Gt(!1,n,i,t,e,function(a){r.push(a)}),r}function $r(n,i,t){let e=Le();return n!=="undirected"&&(i!=="out"&&typeof t.in<"u"&&(e=me(e,lt(t.in))),i!=="in"&&typeof t.out<"u"&&(e=me(e,lt(t.out,i?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=me(e,lt(t.undirected))),e}function Ft(n,i,t,e,r,a,o){const s=t?Ir:Pr;let u;if(i!=="undirected"&&(typeof r.in<"u"&&e!=="out"&&(u=s(n,r.in,a,o),n&&u)||typeof r.out<"u"&&e!=="in"&&(e||r.key!==a)&&(u=s(n,r.out,a,o),n&&u))||i!=="directed"&&typeof r.undirected<"u"&&(u=s(n,r.undirected,a,o),n&&u))return u}function Br(n,i,t,e,r){const a=[];return Ft(!1,n,i,t,e,r,function(o){a.push(o)}),a}function Mr(n,i,t,e){let r=Le();return n!=="undirected"&&(typeof t.in<"u"&&i!=="out"&&e in t.in&&(r=me(r,ct(t.in,e))),typeof t.out<"u"&&i!=="in"&&e in t.out&&(i||t.key!==e)&&(r=me(r,ct(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(r=me(r,ct(t.undirected,e))),r}function Hr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a,o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];if(!arguments.length)return Or(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new C(`Graph.${t}: could not find the "${a}" node in the graph.`);return zr(this.multi,e==="mixed"?this.type:e,r,s)}if(arguments.length===2){a=""+a,o=""+o;const s=this._nodes.get(a);if(!s)throw new C(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new C(`Graph.${t}: could not find the "${o}" target node in the graph.`);return Br(e,this.multi,r,s,o)}throw new k(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Wr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d,l){if(!(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)){if(arguments.length===1)return l=h,Ci(!1,this,e,l);if(arguments.length===2){h=""+h,l=d;const f=this._nodes.get(h);if(typeof f>"u")throw new C(`Graph.${a}: could not find the "${h}" node in the graph.`);return Gt(!1,this.multi,e==="mixed"?this.type:e,r,f,l)}if(arguments.length===3){h=""+h,d=""+d;const f=this._nodes.get(h);if(!f)throw new C(`Graph.${a}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(d))throw new C(`Graph.${a}: could not find the "${d}" target node in the graph.`);return Ft(!1,e,this.multi,r,f,d,l)}throw new k(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop();let l;if(h.length===0){let f=0;e!=="directed"&&(f+=this.undirectedSize),e!=="undirected"&&(f+=this.directedSize),l=new Array(f);let c=0;h.push((y,w,T,D,m,S,p)=>{l[c++]=d(y,w,T,D,m,S,p)})}else l=[],h.push((f,c,y,w,T,D,m)=>{l.push(d(f,c,y,w,T,D,m))});return this[a].apply(this,h),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const h=Array.prototype.slice.call(arguments),d=h.pop(),l=[];return h.push((f,c,y,w,T,D,m)=>{d(f,c,y,w,T,D,m)&&l.push(f)}),this[a].apply(this,h),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(){let h=Array.prototype.slice.call(arguments);if(h.length<2||h.length>4)throw new k(`Graph.${u}: invalid number of arguments (expecting 2, 3 or 4 and got ${h.length}).`);if(typeof h[h.length-1]=="function"&&typeof h[h.length-2]!="function")throw new k(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let d,l;h.length===2?(d=h[0],l=h[1],h=[]):h.length===3?(d=h[1],l=h[2],h=[h[0]]):h.length===4&&(d=h[2],l=h[3],h=[h[0],h[1]]);let f=l;return h.push((c,y,w,T,D,m,S)=>{f=d(f,c,y,w,T,D,m,S)}),this[a].apply(this,h),f}}function jr(n,i){const{name:t,type:e,direction:r}=i,a="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(u,h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return!1;if(arguments.length===1)return d=u,Ci(!0,this,e,d);if(arguments.length===2){u=""+u,d=h;const l=this._nodes.get(u);if(typeof l>"u")throw new C(`Graph.${a}: could not find the "${u}" node in the graph.`);return Gt(!0,this.multi,e==="mixed"?this.type:e,r,l,d)}if(arguments.length===3){u=""+u,h=""+h;const l=this._nodes.get(u);if(!l)throw new C(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(h))throw new C(`Graph.${a}: could not find the "${h}" target node in the graph.`);return Ft(!0,e,this.multi,r,l,h,d)}throw new k(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,f,c,y,w,T,D)=>h(l,f,c,y,w,T,D)),!!this[a].apply(this,u)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const u=Array.prototype.slice.call(arguments),h=u.pop();return u.push((l,f,c,y,w,T,D)=>!h(l,f,c,y,w,T,D)),!this[a].apply(this,u)}}function Vr(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o,s){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();if(!arguments.length)return Ur(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new C(`Graph.${a}: could not find the "${o}" node in the graph.`);return $r(e,r,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new C(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new C(`Graph.${a}: could not find the "${s}" target node in the graph.`);return Mr(e,r,u,s)}throw new k(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function qr(n){Gr.forEach(i=>{Hr(n,i),Wr(n,i),jr(n,i),Vr(n,i)})}const Kr=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function ut(){this.A=null,this.B=null}ut.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};ut.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function Oe(n,i,t,e,r){for(const a in e){const o=e[a],s=o.source,u=o.target,h=s===t?u:s;if(i&&i.has(h.key))continue;const d=r(h.key,h.attributes);if(n&&d)return h.key}}function Nt(n,i,t,e,r){if(i!=="mixed"){if(i==="undirected")return Oe(n,null,e,e.undirected,r);if(typeof t=="string")return Oe(n,null,e,e[t],r)}const a=new ut;let o;if(i!=="undirected"){if(t!=="out"){if(o=Oe(n,null,e,e.in,r),n&&o)return o;a.wrap(e.in)}if(t!=="in"){if(o=Oe(n,a,e,e.out,r),n&&o)return o;a.wrap(e.out)}}if(i!=="directed"&&(o=Oe(n,a,e,e.undirected,r),n&&o))return o}function Yr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof i=="string")return Object.keys(t[i])}const e=[];return Nt(!1,n,i,t,function(r){e.push(r)}),e}function Ue(n,i,t){const e=Object.keys(t),r=e.length;let a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=r)return n&&n.wrap(t),{done:!0};const s=t[e[a++]],u=s.source,h=s.target;if(o=u===i?h:u,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Zr(n,i,t){if(n!=="mixed"){if(n==="undirected")return Ue(null,t,t.undirected);if(typeof i=="string")return Ue(null,t,t[i])}let e=Le();const r=new ut;return n!=="undirected"&&(i!=="out"&&(e=me(e,Ue(r,t,t.in))),i!=="in"&&(e=me(e,Ue(r,t,t.out)))),n!=="directed"&&(e=me(e,Ue(r,t,t.undirected))),e}function Xr(n,i){const{name:t,type:e,direction:r}=i;n.prototype[t]=function(a){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return[];a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new C(`Graph.${t}: could not find the "${a}" node in the graph.`);return Yr(e==="mixed"?this.type:e,r,o)}}function Jr(n,i){const{name:t,type:e,direction:r}=i,a="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new C(`Graph.${a}: could not find the "${h}" node in the graph.`);Nt(!1,e==="mixed"?this.type:e,r,l,d)};const o="map"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(h,d){const l=[];return this[a](h,(f,c)=>{l.push(d(f,c))}),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(h,d){const l=[];return this[a](h,(f,c)=>{d(f,c)&&l.push(f)}),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(h,d,l){if(arguments.length<3)throw new k(`Graph.${u}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let f=l;return this[a](h,(c,y)=>{f=d(f,c,y)}),f}}function Qr(n,i){const{name:t,type:e,direction:r}=i,a=t[0].toUpperCase()+t.slice(1,-1),o="find"+a;n.prototype[o]=function(h,d){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return;h=""+h;const l=this._nodes.get(h);if(typeof l>"u")throw new C(`Graph.${o}: could not find the "${h}" node in the graph.`);return Nt(!0,e==="mixed"?this.type:e,r,l,d)};const s="some"+a;n.prototype[s]=function(h,d){return!!this[o](h,d)};const u="every"+a;n.prototype[u]=function(h,d){return!this[o](h,(f,c)=>!d(f,c))}}function en(n,i){const{name:t,type:e,direction:r}=i,a=t.slice(0,-1)+"Entries";n.prototype[a]=function(o){if(e!=="mixed"&&this.type!=="mixed"&&e!==this.type)return Le();o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new C(`Graph.${a}: could not find the "${o}" node in the graph.`);return Zr(e==="mixed"?this.type:e,r,s)}}function tn(n){Kr.forEach(i=>{Xr(n,i),Jr(n,i),Qr(n,i),en(n,i)})}function tt(n,i,t,e,r){const a=e._nodes.values(),o=e.type;let s,u,h,d,l,f;for(;s=a.next(),s.done!==!0;){let c=!1;if(u=s.value,o!=="undirected"){d=u.out;for(h in d){l=d[h];do f=l.target,c=!0,r(u.key,f.key,u.attributes,f.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}if(o!=="directed"){d=u.undirected;for(h in d)if(!(i&&u.key>h)){l=d[h];do f=l.target,f.key!==h&&(f=l.source),c=!0,r(u.key,f.key,u.attributes,f.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}t&&!c&&r(u.key,null,u.attributes,null,null,null,null)}}function rn(n,i){const t={key:n};return Ei(i.attributes)||(t.attributes=Z({},i.attributes)),t}function nn(n,i,t){const e={key:i,source:t.source.key,target:t.target.key};return Ei(t.attributes)||(e.attributes=Z({},t.attributes)),n==="mixed"&&t.undirected&&(e.undirected=!0),e}function an(n){if(!J(n))throw new k('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new k("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new k("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function on(n){if(!J(n))throw new k('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new k("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new k("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new k("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new k("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const sn=ur(),un=new Set(["directed","undirected","mixed"]),Bt=new Set(["domain","_events","_eventsCount","_maxListeners"]),hn=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],dn={allowSelfLoops:!0,multi:!1,type:"mixed"};function ln(n,i,t){if(t&&!J(t))throw new k(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(i=""+i,t=t||{},n._nodes.has(i))throw new I(`Graph.addNode: the "${i}" node already exist in the graph.`);const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function Mt(n,i,t){const e=new n.NodeDataClass(i,t);return n._nodes.set(i,e),n.emit("nodeAdded",{key:i,attributes:t}),e}function ki(n,i,t,e,r,a,o,s){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!J(s))throw new k(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`);if(a=""+a,o=""+o,s=s||{},!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const u=n._nodes.get(a),h=n._nodes.get(o);if(!u)throw new C(`Graph.${i}: source node "${a}" not found.`);if(!h)throw new C(`Graph.${i}: target node "${o}" not found.`);const d={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);if(!n.multi&&(e?typeof u.undirected[o]<"u":typeof u.out[o]<"u"))throw new I(`Graph.${i}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const l=new Ge(e,r,u,h,s);n._edges.set(r,l);const f=a===o;return e?(u.undirectedDegree++,h.undirectedDegree++,f&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,f&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),e?n._undirectedSize++:n._directedSize++,d.key=r,n.emit("edgeAdded",d),r}function cn(n,i,t,e,r,a,o,s,u){if(!e&&n.type==="undirected")throw new I(`Graph.${i}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(e&&n.type==="directed")throw new I(`Graph.${i}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(u){if(typeof s!="function")throw new k(`Graph.${i}: invalid updater function. Expecting a function but got "${s}"`)}else if(!J(s))throw new k(`Graph.${i}: invalid attributes. Expecting an object but got "${s}"`)}a=""+a,o=""+o;let h;if(u&&(h=s,s=void 0),!n.allowSelfLoops&&a===o)throw new I(`Graph.${i}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=n._nodes.get(a),l=n._nodes.get(o),f,c;if(!t&&(f=n._edges.get(r),f)){if((f.source.key!==a||f.target.key!==o)&&(!e||f.source.key!==o||f.target.key!==a))throw new I(`Graph.${i}: inconsistency detected when attempting to merge the "${r}" edge with "${a}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);c=f}if(!c&&!n.multi&&d&&(c=e?d.undirected[o]:d.out[o]),c){const m=[c.key,!1,!1,!1];if(u?!h:!s)return m;if(u){const S=c.attributes;c.attributes=h(S),n.emit("edgeAttributesUpdated",{type:"replace",key:c.key,attributes:c.attributes})}else Z(c.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:c.key,attributes:c.attributes,data:s});return m}s=s||{},u&&h&&(s=h(s));const y={key:null,undirected:e,source:a,target:o,attributes:s};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new I(`Graph.${i}: the "${r}" edge already exists in the graph.`);let w=!1,T=!1;d||(d=Mt(n,a,{}),w=!0,a===o&&(l=d,T=!0)),l||(l=Mt(n,o,{}),T=!0),f=new Ge(e,r,d,l,s),n._edges.set(r,f);const D=a===o;return e?(d.undirectedDegree++,l.undirectedDegree++,D&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,l.inDegree++,D&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?f.attachMulti():f.attach(),e?n._undirectedSize++:n._directedSize++,y.key=r,n.emit("edgeAdded",y),[r,!0,w,T]}function xe(n,i){n._edges.delete(i.key);const{source:t,target:e,attributes:r}=i,a=i.undirected,o=t===e;a?(t.undirectedDegree--,e.undirectedDegree--,o&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,e.inDegree--,o&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?i.detachMulti():i.detach(),a?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:i.key,attributes:r,source:t.key,target:e.key,undirected:a})}class j extends wi.EventEmitter{constructor(i){if(super(),i=Z({},dn,i),typeof i.multi!="boolean")throw new k(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${i.multi}".`);if(!un.has(i.type))throw new k(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${i.type}".`);if(typeof i.allowSelfLoops!="boolean")throw new k(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${i.allowSelfLoops}".`);const t=i.type==="mixed"?_i:i.type==="directed"?Ti:Si;ae(this,"NodeDataClass",t);const e="geid_"+sn()+"_";let r=0;const a=()=>{let o;do o=e+r++;while(this._edges.has(o));return o};ae(this,"_attributes",{}),ae(this,"_nodes",new Map),ae(this,"_edges",new Map),ae(this,"_directedSize",0),ae(this,"_undirectedSize",0),ae(this,"_directedSelfLoopCount",0),ae(this,"_undirectedSelfLoopCount",0),ae(this,"_edgeKeyGenerator",a),ae(this,"_options",i),Bt.forEach(o=>ae(this,o,this[o])),he(this,"order",()=>this._nodes.size),he(this,"size",()=>this._edges.size),he(this,"directedSize",()=>this._directedSize),he(this,"undirectedSize",()=>this._undirectedSize),he(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),he(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),he(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),he(this,"multi",this._options.multi),he(this,"type",this._options.type),he(this,"allowSelfLoops",this._options.allowSelfLoops),he(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(i){return this._nodes.has(""+i)}hasDirectedEdge(i,t){if(this.type==="undirected")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&!r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.out.hasOwnProperty(t):!1}throw new k(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(i,t){if(this.type==="directed")return!1;if(arguments.length===1){const e=""+i,r=this._edges.get(e);return!!r&&r.undirected}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?e.undirected.hasOwnProperty(t):!1}throw new k(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(i,t){if(arguments.length===1){const e=""+i;return this._edges.has(e)}else if(arguments.length===2){i=""+i,t=""+t;const e=this._nodes.get(i);return e?typeof e.out<"u"&&e.out.hasOwnProperty(t)||typeof e.undirected<"u"&&e.undirected.hasOwnProperty(t):!1}throw new k(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(i,t){if(this.type==="undirected")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const e=this._nodes.get(i);if(!e)throw new C(`Graph.directedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new C(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||void 0;if(r)return r.key}undirectedEdge(i,t){if(this.type==="directed")return;if(i=""+i,t=""+t,this.multi)throw new I("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const e=this._nodes.get(i);if(!e)throw new C(`Graph.undirectedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new C(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=e.undirected&&e.undirected[t]||void 0;if(r)return r.key}edge(i,t){if(this.multi)throw new I("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.edge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new C(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=e.out&&e.out[t]||e.undirected&&e.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areDirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in||t in e.out}areOutNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areOutNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.out}areInNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areInNeighbors: could not find the "${i}" node in the graph.`);return this.type==="undirected"?!1:t in e.in}areUndirectedNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areUndirectedNeighbors: could not find the "${i}" node in the graph.`);return this.type==="directed"?!1:t in e.undirected}areNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&(t in e.in||t in e.out)||this.type!=="directed"&&t in e.undirected}areInboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areInboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.in||this.type!=="directed"&&t in e.undirected}areOutboundNeighbors(i,t){i=""+i,t=""+t;const e=this._nodes.get(i);if(!e)throw new C(`Graph.areOutboundNeighbors: could not find the "${i}" node in the graph.`);return this.type!=="undirected"&&t in e.out||this.type!=="directed"&&t in e.undirected}inDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.inDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.outDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.directedDegree: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.undirectedDegree: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.inboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree),e}outboundDegree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.outboundDegree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.outDegree),e}degree(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.degree: could not find the "${i}" node in the graph.`);let e=0;return this.type!=="directed"&&(e+=t.undirectedDegree),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree),e}inDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.inDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.outDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.directedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree,r+=t.directedLoops),e-r}outboundDegreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.outDegree,r+=t.directedLoops),e-r}degreeWithoutSelfLoops(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.degreeWithoutSelfLoops: could not find the "${i}" node in the graph.`);let e=0,r=0;return this.type!=="directed"&&(e+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(e+=t.inDegree+t.outDegree,r+=t.directedLoops*2),e-r}source(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.source: could not find the "${i}" edge in the graph.`);return t.source.key}target(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.target: could not find the "${i}" edge in the graph.`);return t.target.key}extremities(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.extremities: could not find the "${i}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(i,t){i=""+i,t=""+t;const e=this._edges.get(t);if(!e)throw new C(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=e.source.key,a=e.target.key;if(i===r)return a;if(i===a)return r;throw new C(`Graph.opposite: the "${i}" node is not attached to the "${t}" edge (${r}, ${a}).`)}hasExtremity(i,t){i=""+i,t=""+t;const e=this._edges.get(i);if(!e)throw new C(`Graph.hasExtremity: could not find the "${i}" edge in the graph.`);return e.source.key===t||e.target.key===t}isUndirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.isUndirected: could not find the "${i}" edge in the graph.`);return t.undirected}isDirected(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.isDirected: could not find the "${i}" edge in the graph.`);return!t.undirected}isSelfLoop(i){i=""+i;const t=this._edges.get(i);if(!t)throw new C(`Graph.isSelfLoop: could not find the "${i}" edge in the graph.`);return t.source===t.target}addNode(i,t){return ln(this,i,t).key}mergeNode(i,t){if(t&&!J(t))throw new k(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);i=""+i,t=t||{};let e=this._nodes.get(i);return e?(t&&(Z(e.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:i,attributes:e.attributes,data:t})),[i,!1]):(e=new this.NodeDataClass(i,t),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:t}),[i,!0])}updateNode(i,t){if(t&&typeof t!="function")throw new k(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);i=""+i;let e=this._nodes.get(i);if(e){if(t){const a=e.attributes;e.attributes=t(a),this.emit("nodeAttributesUpdated",{type:"replace",key:i,attributes:e.attributes})}return[i,!1]}const r=t?t({}):{};return e=new this.NodeDataClass(i,r),this._nodes.set(i,e),this.emit("nodeAdded",{key:i,attributes:r}),[i,!0]}dropNode(i){i=""+i;const t=this._nodes.get(i);if(!t)throw new C(`Graph.dropNode: could not find the "${i}" node in the graph.`);let e;if(this.type!=="undirected"){for(const r in t.out){e=t.out[r];do xe(this,e),e=e.next;while(e)}for(const r in t.in){e=t.in[r];do xe(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const r in t.undirected){e=t.undirected[r];do xe(this,e),e=e.next;while(e)}this._nodes.delete(i),this.emit("nodeDropped",{key:i,attributes:t.attributes})}dropEdge(i){let t;if(arguments.length>1){const e=""+arguments[0],r=""+arguments[1];if(t=oe(this,e,r,this.type),!t)throw new C(`Graph.dropEdge: could not find the "${e}" -> "${r}" edge in the graph.`)}else if(i=""+i,t=this._edges.get(i),!t)throw new C(`Graph.dropEdge: could not find the "${i}" edge in the graph.`);return xe(this,t),this}dropDirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");i=""+i,t=""+t;const e=oe(this,i,t,"directed");if(!e)throw new C(`Graph.dropDirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return xe(this,e),this}dropUndirectedEdge(i,t){if(arguments.length<2)throw new I("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new I("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const e=oe(this,i,t,"undirected");if(!e)throw new C(`Graph.dropUndirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return xe(this,e),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const i=this._nodes.values();let t;for(;t=i.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(i){return this._attributes[i]}getAttributes(){return this._attributes}hasAttribute(i){return this._attributes.hasOwnProperty(i)}setAttribute(i,t){return this._attributes[i]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}updateAttribute(i,t){if(typeof t!="function")throw new k("Graph.updateAttribute: updater should be a function.");const e=this._attributes[i];return this._attributes[i]=t(e),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:i}),this}removeAttribute(i){return delete this._attributes[i],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:i}),this}replaceAttributes(i){if(!J(i))throw new k("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=i,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(i){if(!J(i))throw new k("Graph.mergeAttributes: provided attributes are not a plain object.");return Z(this._attributes,i),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:i}),this}updateAttributes(i){if(typeof i!="function")throw new k("Graph.updateAttributes: provided updater is not a function.");return this._attributes=i(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(i,t){if(typeof i!="function")throw new k("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!$t(t))throw new k("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._nodes.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,a.attributes=i(a.key,a.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(i,t){if(typeof i!="function")throw new k("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!$t(t))throw new k("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const e=this._edges.values();let r,a,o,s;for(;r=e.next(),r.done!==!0;)a=r.value,o=a.source,s=a.target,a.attributes=i(a.key,a.attributes,o.key,s.key,o.attributes,s.attributes,a.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(i){if(typeof i!="function")throw new k("Graph.forEachAdjacencyEntry: expecting a callback.");tt(!1,!1,!1,this,i)}forEachAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new k("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");tt(!1,!1,!0,this,i)}forEachAssymetricAdjacencyEntry(i){if(typeof i!="function")throw new k("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");tt(!1,!0,!1,this,i)}forEachAssymetricAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new k("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");tt(!1,!0,!0,this,i)}nodes(){return Array.from(this._nodes.keys())}forEachNode(i){if(typeof i!="function")throw new k("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)}findNode(i){if(typeof i!="function")throw new k("Graph.findNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return r.key}mapNodes(i){if(typeof i!="function")throw new k("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let e,r;const a=new Array(this.order);let o=0;for(;e=t.next(),e.done!==!0;)r=e.value,a[o++]=i(r.key,r.attributes);return a}someNode(i){if(typeof i!="function")throw new k("Graph.someNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,i(r.key,r.attributes))return!0;return!1}everyNode(i){if(typeof i!="function")throw new k("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let e,r;for(;e=t.next(),e.done!==!0;)if(r=e.value,!i(r.key,r.attributes))return!1;return!0}filterNodes(i){if(typeof i!="function")throw new k("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let e,r;const a=[];for(;e=t.next(),e.done!==!0;)r=e.value,i(r.key,r.attributes)&&a.push(r.key);return a}reduceNodes(i,t){if(typeof i!="function")throw new k("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new k("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let e=t;const r=this._nodes.values();let a,o;for(;a=r.next(),a.done!==!0;)o=a.value,e=i(e,o.key,o.attributes);return e}nodeEntries(){const i=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=i.next();if(t.done)return t;const e=t.value;return{value:{node:e.key,attributes:e.attributes},done:!1}}}}export(){const i=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,a)=>{i[t++]=rn(a,r)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((r,a)=>{e[t++]=nn(this.type,a,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:i,edges:e}}import(i,t=!1){if(i instanceof j)return i.forEachNode((u,h)=>{t?this.mergeNode(u,h):this.addNode(u,h)}),i.forEachEdge((u,h,d,l,f,c,y)=>{t?y?this.mergeUndirectedEdgeWithKey(u,d,l,h):this.mergeDirectedEdgeWithKey(u,d,l,h):y?this.addUndirectedEdgeWithKey(u,d,l,h):this.addDirectedEdgeWithKey(u,d,l,h)}),this;if(!J(i))throw new k("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(i.attributes){if(!J(i.attributes))throw new k("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(i.attributes):this.replaceAttributes(i.attributes)}let e,r,a,o,s;if(i.nodes){if(a=i.nodes,!Array.isArray(a))throw new k("Graph.import: invalid nodes. Expecting an array.");for(e=0,r=a.length;e{const a=Z({},e.attributes);e=new t.NodeDataClass(r,a),t._nodes.set(r,e)}),t}copy(i){if(i=i||{},typeof i.type=="string"&&i.type!==this.type&&i.type!=="mixed")throw new I(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${i.type}" because this would mean losing information about the current graph.`);if(typeof i.multi=="boolean"&&i.multi!==this.multi&&i.multi!==!0)throw new I("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof i.allowSelfLoops=="boolean"&&i.allowSelfLoops!==this.allowSelfLoops&&i.allowSelfLoops!==!0)throw new I("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(i),e=this._edges.values();let r,a;for(;r=e.next(),r.done!==!0;)a=r.value,ki(t,"copy",!1,a.undirected,a.key,a.source.key,a.target.key,Z({},a.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const i={};this._nodes.forEach((a,o)=>{i[o]=a.attributes});const t={},e={};this._edges.forEach((a,o)=>{const s=a.undirected?"--":"->";let u="",h=a.source.key,d=a.target.key,l;a.undirected&&h>d&&(l=h,h=d,d=l);const f=`(${h})${s}(${d})`;o.startsWith("geid_")?this.multi&&(typeof e[f]>"u"?e[f]=0:e[f]++,u+=`${e[f]}. `):u+=`[${o}]: `,u+=f,t[u]=a.attributes});const r={};for(const a in this)this.hasOwnProperty(a)&&!Bt.has(a)&&typeof this[a]!="function"&&typeof a!="symbol"&&(r[a]=this[a]);return r.attributes=this._attributes,r.nodes=i,r.edges=t,ae(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(j.prototype[Symbol.for("nodejs.util.inspect.custom")]=j.prototype.inspect);hn.forEach(n=>{["add","merge","update"].forEach(i=>{const t=n.name(i),e=i==="add"?ki:cn;n.generateKey?j.prototype[t]=function(r,a,o){return e(this,t,!0,(n.type||this.type)==="undirected",null,r,a,o,i==="update")}:j.prototype[t]=function(r,a,o,s){return e(this,t,!1,(n.type||this.type)==="undirected",r,a,o,s,i==="update")}})});wr(j);Lr(j);qr(j);tn(j);class Di extends j{constructor(i){const t=Z({type:"directed"},i);if("multi"in t&&t.multi!==!1)throw new k("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new k('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Li extends j{constructor(i){const t=Z({type:"undirected"},i);if("multi"in t&&t.multi!==!1)throw new k("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new k('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Gi extends j{constructor(i){const t=Z({multi:!0},i);if("multi"in t&&t.multi!==!0)throw new k("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class Fi extends j{constructor(i){const t=Z({type:"directed",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new k("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new k('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Ni extends j{constructor(i){const t=Z({type:"undirected",multi:!0},i);if("multi"in t&&t.multi!==!0)throw new k("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new k('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Fe(n){n.from=function(i,t){const e=Z({},i.options,t),r=new n(e);return r.import(i),r}}Fe(j);Fe(Di);Fe(Li);Fe(Gi);Fe(Fi);Fe(Ni);j.Graph=j;j.DirectedGraph=Di;j.UndirectedGraph=Li;j.MultiGraph=Gi;j.MultiDirectedGraph=Fi;j.MultiUndirectedGraph=Ni;j.InvalidArgumentsGraphError=k;j.NotFoundGraphError=C;j.UsageGraphError=I;var ft,Ht;function Pi(){return Ht||(Ht=1,ft=function(i){return i!==null&&typeof i=="object"&&typeof i.addUndirectedEdgeWithKey=="function"&&typeof i.dropNode=="function"&&typeof i.multi=="boolean"}),ft}var ze={},Wt;function fn(){if(Wt)return ze;Wt=1;function n(e){return typeof e!="number"||isNaN(e)?1:e}function i(e,r){var a={},o=function(h){return typeof h>"u"?r:h};typeof r=="function"&&(o=r);var s=function(h){return o(h[e])},u=function(){return o(void 0)};return typeof e=="string"?(a.fromAttributes=s,a.fromGraph=function(h,d){return s(h.getNodeAttributes(d))},a.fromEntry=function(h,d){return s(d)}):typeof e=="function"?(a.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},a.fromGraph=function(h,d){return o(e(d,h.getNodeAttributes(d)))},a.fromEntry=function(h,d){return o(e(h,d))}):(a.fromAttributes=u,a.fromGraph=u,a.fromEntry=u),a}function t(e,r){var a={},o=function(h){return typeof h>"u"?r:h};typeof r=="function"&&(o=r);var s=function(h){return o(h[e])},u=function(){return o(void 0)};return typeof e=="string"?(a.fromAttributes=s,a.fromGraph=function(h,d){return s(h.getEdgeAttributes(d))},a.fromEntry=function(h,d){return s(d)},a.fromPartialEntry=a.fromEntry,a.fromMinimalEntry=a.fromEntry):typeof e=="function"?(a.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},a.fromGraph=function(h,d){var l=h.extremities(d);return o(e(d,h.getEdgeAttributes(d),l[0],l[1],h.getNodeAttributes(l[0]),h.getNodeAttributes(l[1]),h.isUndirected(d)))},a.fromEntry=function(h,d,l,f,c,y,w){return o(e(h,d,l,f,c,y,w))},a.fromPartialEntry=function(h,d,l,f){return o(e(h,d,l,f))},a.fromMinimalEntry=function(h,d){return o(e(h,d))}):(a.fromAttributes=u,a.fromGraph=u,a.fromEntry=u,a.fromMinimalEntry=u),a}return ze.createNodeValueGetter=i,ze.createEdgeValueGetter=t,ze.createEdgeWeightGetter=function(e){return t(e,n)},ze}var gt,jt;function gn(){if(jt)return gt;jt=1;var n=0,i=1,t=2,e=3,r=4,a=5,o=6,s=7,u=8,h=9,d=0,l=1,f=2,c=0,y=1,w=2,T=3,D=4,m=5,S=6,p=7,b=8,R=3,A=10,G=3,F=9,P=10;return gt=function(z,g,K){var te,x,v,$,W,X,ie,Y,N,Ne,re=g.length,tr=K.length,Pe=z.adjustSizes,ir=z.barnesHutTheta*z.barnesHutTheta,qe,q,B,M,fe,U,O,E=[];for(v=0;vYe?(Ee-=(Ke-Ye)/2,Re=Ee+Ke):(we-=(Ye-Ke)/2,Se=we+Ye),E[0+c]=-1,E[0+y]=(we+Se)/2,E[0+w]=(Ee+Re)/2,E[0+T]=Math.max(Se-we,Re-Ee),E[0+D]=-1,E[0+m]=-1,E[0+S]=0,E[0+p]=0,E[0+b]=0,te=1,v=0;v=0){g[v+n]=0)if(U=Math.pow(g[v+n]-E[x+p],2)+Math.pow(g[v+i]-E[x+b],2),Ne=E[x+T],4*Ne*Ne/U0?(O=q*g[v+o]*E[x+S]/U,g[v+t]+=B*O,g[v+e]+=M*O):U<0&&(O=-q*g[v+o]*E[x+S]/Math.sqrt(U),g[v+t]+=B*O,g[v+e]+=M*O):U>0&&(O=q*g[v+o]*E[x+S]/U,g[v+t]+=B*O,g[v+e]+=M*O),x=E[x+D],x<0)break;continue}else{x=E[x+m];continue}else{if(X=E[x+c],X>=0&&X!==v&&(B=g[v+n]-g[X+n],M=g[v+i]-g[X+i],U=B*B+M*M,Pe===!0?U>0?(O=q*g[v+o]*g[X+o]/U,g[v+t]+=B*O,g[v+e]+=M*O):U<0&&(O=-q*g[v+o]*g[X+o]/Math.sqrt(U),g[v+t]+=B*O,g[v+e]+=M*O):U>0&&(O=q*g[v+o]*g[X+o]/U,g[v+t]+=B*O,g[v+e]+=M*O)),x=E[x+D],x<0)break;continue}else for(q=z.scalingRatio,$=0;$0?(O=q*g[$+o]*g[W+o]/U/U,g[$+t]+=B*O,g[$+e]+=M*O,g[W+t]-=B*O,g[W+e]-=M*O):U<0&&(O=100*q*g[$+o]*g[W+o],g[$+t]+=B*O,g[$+e]+=M*O,g[W+t]-=B*O,g[W+e]-=M*O)):(U=Math.sqrt(B*B+M*M),U>0&&(O=q*g[$+o]*g[W+o]/U/U,g[$+t]+=B*O,g[$+e]+=M*O,g[W+t]-=B*O,g[W+e]-=M*O));for(N=z.gravity/z.scalingRatio,q=z.scalingRatio,v=0;v0&&(O=q*g[v+o]*N):U>0&&(O=q*g[v+o]*N/U),g[v+t]-=B*O,g[v+e]-=M*O;for(q=1*(z.outboundAttractionDistribution?qe:1),ie=0;ie0&&(O=-q*fe*Math.log(1+U)/U/g[$+o]):U>0&&(O=-q*fe*Math.log(1+U)/U):z.outboundAttractionDistribution?U>0&&(O=-q*fe/g[$+o]):U>0&&(O=-q*fe)):(U=Math.sqrt(Math.pow(B,2)+Math.pow(M,2)),z.linLogMode?z.outboundAttractionDistribution?U>0&&(O=-q*fe*Math.log(1+U)/U/g[$+o]):U>0&&(O=-q*fe*Math.log(1+U)/U):z.outboundAttractionDistribution?(U=1,O=-q*fe/g[$+o]):(U=1,O=-q*fe)),U>0&&(g[$+t]+=B*O,g[$+e]+=M*O,g[W+t]-=B*O,g[W+e]-=M*O);var Ze,Ie,Xe,_e,Je,Qe;if(Pe===!0)for(v=0;vP&&(g[v+t]=g[v+t]*P/Ze,g[v+e]=g[v+e]*P/Ze),Ie=g[v+o]*Math.sqrt((g[v+r]-g[v+t])*(g[v+r]-g[v+t])+(g[v+a]-g[v+e])*(g[v+a]-g[v+e])),Xe=Math.sqrt((g[v+r]+g[v+t])*(g[v+r]+g[v+t])+(g[v+a]+g[v+e])*(g[v+a]+g[v+e]))/2,_e=.1*Math.log(1+Xe)/(1+Math.sqrt(Ie)),Je=g[v+n]+g[v+t]*(_e/z.slowDown),g[v+n]=Je,Qe=g[v+i]+g[v+e]*(_e/z.slowDown),g[v+i]=Qe);else for(v=0;v=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in t&&typeof t.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in t&&!(typeof t.gravity=="number"&&t.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in t&&!(typeof t.slowDown=="number"||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&typeof t.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in t&&!(typeof t.barnesHutTheta=="number"&&t.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},ge.graphToByteArrays=function(t,e){var r=t.order,a=t.size,o={},s,u=new Float32Array(r*n),h=new Float32Array(a*i);return s=0,t.forEachNode(function(d,l){o[d]=s,u[s]=l.x,u[s+1]=l.y,u[s+2]=0,u[s+3]=0,u[s+4]=0,u[s+5]=0,u[s+6]=1,u[s+7]=1,u[s+8]=l.size||1,u[s+9]=l.fixed?1:0,s+=n}),s=0,t.forEachEdge(function(d,l,f,c,y,w,T){var D=o[f],m=o[c],S=e(d,l,f,c,y,w,T);u[D+6]+=S,u[m+6]+=S,h[s]=D,h[s+1]=m,h[s+2]=S,s+=i}),{nodes:u,edges:h}},ge.assignLayoutChanges=function(t,e,r){var a=0;t.updateEachNodeAttributes(function(o,s){return s.x=e[a],s.y=e[a+1],a+=n,r?r(o,s):s})},ge.readGraphPositions=function(t,e){var r=0;t.forEachNode(function(a,o){e[r]=o.x,e[r+1]=o.y,r+=n})},ge.collectLayoutChanges=function(t,e,r){for(var a=t.nodes(),o={},s=0,u=0,h=e.length;s2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(h)}}var s=a.bind(null,!1);return s.assign=a.bind(null,!0),s.inferSettings=o,vt=s,vt}var yn=mn();const it=bi(yn);function bn(n,i){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var e=t.call(n,i);if(typeof e!="object")return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}function je(n){var i=bn(n,"string");return typeof i=="symbol"?i:i+""}function Q(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}function Yt(n,i){for(var t=0;tn.length)&&(i=n.length);for(var t=0,e=Array(i);t>>16,t=(n&65280)>>>8,e=n&255,r=255,a=zi(i,t,e,r);return bt[n]=a,a}function Zt(n,i,t,e){return t+(i<<8)+(n<<16)}function Xt(n,i,t,e,r,a){var o=Math.floor(t/a*r),s=Math.floor(n.drawingBufferHeight/a-e/a*r),u=new Uint8Array(4);n.bindFramebuffer(n.FRAMEBUFFER,i),n.readPixels(o,s,1,1,n.RGBA,n.UNSIGNED_BYTE,u);var h=De(u,4),d=h[0],l=h[1],f=h[2],c=h[3];return[d,l,f,c]}function _(n,i,t){return(i=je(i))in n?Object.defineProperty(n,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[i]=t,n}function Jt(n,i){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);i&&(e=e.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,e)}return t}function L(n){for(var i=1;i:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-7>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 7) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 7) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-1{row-gap:var(--spacing)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-br-sm{border-bottom-right-radius:calc(var(--radius) - 4px)}.rounded-bl{border-bottom-left-radius:.25rem}.rounded-bl-sm{border-bottom-left-radius:calc(var(--radius) - 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/25{border-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/25{border-color:color-mix(in oklab,var(--color-amber-500) 25%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500) 40%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500) 30%,transparent)}}.border-border,.border-border\/10{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/10{border-color:color-mix(in oklab,hsl(var(--border)) 10%,transparent)}}.border-border\/20{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/20{border-color:color-mix(in oklab,hsl(var(--border)) 20%,transparent)}}.border-border\/30{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/30{border-color:color-mix(in oklab,hsl(var(--border)) 30%,transparent)}}.border-border\/40{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/40{border-color:color-mix(in oklab,hsl(var(--border)) 40%,transparent)}}.border-border\/50{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,hsl(var(--border)) 50%,transparent)}}.border-border\/60{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/60{border-color:color-mix(in oklab,hsl(var(--border)) 60%,transparent)}}.border-border\/70{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/70{border-color:color-mix(in oklab,hsl(var(--border)) 70%,transparent)}}.border-border\/80{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/80{border-color:color-mix(in oklab,hsl(var(--border)) 80%,transparent)}}.border-cyan-500\/20{border-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/20{border-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.border-cyan-500\/25{border-color:#00b7d740}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/25{border-color:color-mix(in oklab,var(--color-cyan-500) 25%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500) 30%,transparent)}}.border-emerald-500\/10{border-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/10{border-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.border-emerald-500\/15{border-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/15{border-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/20{border-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-emerald-500\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/40{border-color:color-mix(in oklab,var(--color-emerald-500) 40%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500) 50%,transparent)}}.border-fuchsia-500\/30{border-color:#e12afb4d}@supports (color:color-mix(in lab,red,red)){.border-fuchsia-500\/30{border-color:color-mix(in oklab,var(--color-fuchsia-500) 30%,transparent)}}.border-fuchsia-500\/40{border-color:#e12afb66}@supports (color:color-mix(in lab,red,red)){.border-fuchsia-500\/40{border-color:color-mix(in oklab,var(--color-fuchsia-500) 40%,transparent)}}.border-indigo-500\/25{border-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/25{border-color:color-mix(in oklab,var(--color-indigo-500) 25%,transparent)}}.border-indigo-500\/30{border-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/30{border-color:color-mix(in oklab,var(--color-indigo-500) 30%,transparent)}}.border-indigo-500\/40{border-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/40{border-color:color-mix(in oklab,var(--color-indigo-500) 40%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500) 30%,transparent)}}.border-pink-500\/25{border-color:#f6339a40}@supports (color:color-mix(in lab,red,red)){.border-pink-500\/25{border-color:color-mix(in oklab,var(--color-pink-500) 25%,transparent)}}.border-primary,.border-primary\/20{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/20{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.border-primary\/25{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/25{border-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.border-primary\/30{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/30{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.border-primary\/40{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/40{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.border-primary\/45{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/45{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.border-primary\/50{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/50{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.border-primary\/60{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/60{border-color:color-mix(in oklab,hsl(var(--primary)) 60%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500) 30%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.border-red-500\/25{border-color:#fb2c3640}@supports (color:color-mix(in lab,red,red)){.border-red-500\/25{border-color:color-mix(in oklab,var(--color-red-500) 25%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab,red,red)){.border-red-500\/40{border-color:color-mix(in oklab,var(--color-red-500) 40%,transparent)}}.border-slate-500\/25{border-color:#62748e40}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/25{border-color:color-mix(in oklab,var(--color-slate-500) 25%,transparent)}}.border-slate-500\/30{border-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/30{border-color:color-mix(in oklab,var(--color-slate-500) 30%,transparent)}}.border-teal-500\/25{border-color:#00baa740}@supports (color:color-mix(in lab,red,red)){.border-teal-500\/25{border-color:color-mix(in oklab,var(--color-teal-500) 25%,transparent)}}.border-transparent{border-color:#0000}.border-violet-500\/20{border-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/20{border-color:color-mix(in oklab,var(--color-violet-500) 20%,transparent)}}.border-violet-500\/25{border-color:#8d54ff40}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/25{border-color:color-mix(in oklab,var(--color-violet-500) 25%,transparent)}}.border-t-primary\/70{border-top-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-t-primary\/70{border-top-color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.border-t-violet-500\/70{border-top-color:#8d54ffb3}@supports (color:color-mix(in lab,red,red)){.border-t-violet-500\/70{border-top-color:color-mix(in oklab,var(--color-violet-500) 70%,transparent)}}.border-l-amber-500\/80{border-left-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.border-l-amber-500\/80{border-left-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.border-l-cyan-500\/80{border-left-color:#00b7d7cc}@supports (color:color-mix(in lab,red,red)){.border-l-cyan-500\/80{border-left-color:color-mix(in oklab,var(--color-cyan-500) 80%,transparent)}}.border-l-indigo-500\/80{border-left-color:#625fffcc}@supports (color:color-mix(in lab,red,red)){.border-l-indigo-500\/80{border-left-color:color-mix(in oklab,var(--color-indigo-500) 80%,transparent)}}.border-l-muted{border-left-color:hsl(var(--muted))}.border-l-violet-500\/80{border-left-color:#8d54ffcc}@supports (color:color-mix(in lab,red,red)){.border-l-violet-500\/80{border-left-color:color-mix(in oklab,var(--color-violet-500) 80%,transparent)}}.bg-\[\#070a0f\]{background-color:#070a0f}.bg-\[hsl\(224\,30\%\,6\%\)\]{background-color:#0b0d14}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.bg-amber-500\/80{background-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/80{background-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.bg-amber-500\/\[0\.06\]{background-color:#f99c000f}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/\[0\.06\]{background-color:color-mix(in oklab,var(--color-amber-500) 6%,transparent)}}.bg-background\/10{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/10{background-color:color-mix(in oklab,hsl(var(--background)) 10%,transparent)}}.bg-background\/20{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/20{background-color:color-mix(in oklab,hsl(var(--background)) 20%,transparent)}}.bg-background\/25{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/25{background-color:color-mix(in oklab,hsl(var(--background)) 25%,transparent)}}.bg-background\/30{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/30{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.bg-background\/35{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/35{background-color:color-mix(in oklab,hsl(var(--background)) 35%,transparent)}}.bg-background\/40{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/40{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.bg-background\/50{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/50{background-color:color-mix(in oklab,hsl(var(--background)) 50%,transparent)}}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/25{background-color:#00000040}@supports (color:color-mix(in lab,red,red)){.bg-black\/25{background-color:color-mix(in oklab,var(--color-black) 25%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500) 20%,transparent)}}.bg-border\/30{background-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.bg-border\/30{background-color:color-mix(in oklab,hsl(var(--border)) 30%,transparent)}}.bg-card,.bg-card\/10{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/10{background-color:color-mix(in oklab,hsl(var(--card)) 10%,transparent)}}.bg-card\/20{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/20{background-color:color-mix(in oklab,hsl(var(--card)) 20%,transparent)}}.bg-card\/30{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/30{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.bg-card\/40{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/40{background-color:color-mix(in oklab,hsl(var(--card)) 40%,transparent)}}.bg-card\/45{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/45{background-color:color-mix(in oklab,hsl(var(--card)) 45%,transparent)}}.bg-card\/50{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/50{background-color:color-mix(in oklab,hsl(var(--card)) 50%,transparent)}}.bg-card\/70{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/70{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.bg-card\/75{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/75{background-color:color-mix(in oklab,hsl(var(--card)) 75%,transparent)}}.bg-card\/85{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/85{background-color:color-mix(in oklab,hsl(var(--card)) 85%,transparent)}}.bg-card\/90{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/90{background-color:color-mix(in oklab,hsl(var(--card)) 90%,transparent)}}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/10{background-color:color-mix(in oklab,var(--color-cyan-500) 10%,transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500) 15%,transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/5{background-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/5{background-color:color-mix(in oklab,var(--color-emerald-500) 5%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.bg-emerald-500\/80{background-color:#00bb7fcc}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/80{background-color:color-mix(in oklab,var(--color-emerald-500) 80%,transparent)}}.bg-emerald-500\/\[0\.07\]{background-color:#00bb7f12}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/\[0\.07\]{background-color:color-mix(in oklab,var(--color-emerald-500) 7%,transparent)}}.bg-fuchsia-500\/10{background-color:#e12afb1a}@supports (color:color-mix(in lab,red,red)){.bg-fuchsia-500\/10{background-color:color-mix(in oklab,var(--color-fuchsia-500) 10%,transparent)}}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500) 10%,transparent)}}.bg-indigo-500\/15{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground,.bg-muted-foreground\/40{background-color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.bg-muted-foreground\/40{background-color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.bg-muted\/10{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/10{background-color:color-mix(in oklab,hsl(var(--muted)) 10%,transparent)}}.bg-muted\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,hsl(var(--muted)) 20%,transparent)}}.bg-muted\/40{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/40{background-color:color-mix(in oklab,hsl(var(--muted)) 40%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500) 20%,transparent)}}.bg-pink-500\/15{background-color:#f6339a26}@supports (color:color-mix(in lab,red,red)){.bg-pink-500\/15{background-color:color-mix(in oklab,var(--color-pink-500) 15%,transparent)}}.bg-popover,.bg-popover\/95{background-color:hsl(var(--popover))}@supports (color:color-mix(in lab,red,red)){.bg-popover\/95{background-color:color-mix(in oklab,hsl(var(--popover)) 95%,transparent)}}.bg-primary,.bg-primary\/5{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.bg-primary\/10{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.bg-primary\/15{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/15{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.bg-primary\/\[0\.06\]{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/\[0\.06\]{background-color:color-mix(in oklab,hsl(var(--primary)) 6%,transparent)}}.bg-purple-500\/15{background-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/15{background-color:color-mix(in oklab,var(--color-purple-500) 15%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500) 20%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/5{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500) 15%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500) 80%,transparent)}}.bg-slate-500\/15{background-color:#62748e26}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/15{background-color:color-mix(in oklab,var(--color-slate-500) 15%,transparent)}}.bg-slate-500\/20{background-color:#62748e33}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/20{background-color:color-mix(in oklab,var(--color-slate-500) 20%,transparent)}}.bg-teal-500\/15{background-color:#00baa726}@supports (color:color-mix(in lab,red,red)){.bg-teal-500\/15{background-color:color-mix(in oklab,var(--color-teal-500) 15%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/5{background-color:#8d54ff0d}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/5{background-color:color-mix(in oklab,var(--color-violet-500) 5%,transparent)}}.bg-violet-500\/10{background-color:#8d54ff1a}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/10{background-color:color-mix(in oklab,var(--color-violet-500) 10%,transparent)}}.bg-violet-500\/15{background-color:#8d54ff26}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/15{background-color:color-mix(in oklab,var(--color-violet-500) 15%,transparent)}}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-tr{--tw-gradient-position:to top right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-cyan-500{--tw-gradient-from:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-foreground{--tw-gradient-from:hsl(var(--foreground));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-500{--tw-gradient-from:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500{--tw-gradient-from:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500\/20{--tw-gradient-from:#00baa733}@supports (color:color-mix(in lab,red,red)){.from-teal-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-teal-500) 20%, transparent)}}.from-teal-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-foreground{--tw-gradient-via:hsl(var(--foreground));--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-indigo-500\/15{--tw-gradient-via:#625fff26}@supports (color:color-mix(in lab,red,red)){.via-indigo-500\/15{--tw-gradient-via:color-mix(in oklab, var(--color-indigo-500) 15%, transparent)}}.via-indigo-500\/15{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-blue-500{--tw-gradient-to:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-500{--tw-gradient-to:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary{--tw-gradient-to:hsl(var(--primary));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-purple-500\/20{--tw-gradient-to:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-purple-500) 20%, transparent)}}.to-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-500{--tw-gradient-to:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.bg-repeat{background-repeat:repeat}.fill-primary\/20{fill:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.fill-primary\/20{fill:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-12{padding:calc(var(--spacing) * 12)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[12vh\]{padding-top:12vh}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:JetBrains Mono,ui-monospace,SFMono-Regular,monospace}.font-sans{font-family:Inter,ui-sans-serif,system-ui,-apple-system,sans-serif}.font-space{font-family:Space Grotesk,sans-serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[7px\]{font-size:7px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400) 80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400) 90%,transparent)}}.text-amber-500{color:var(--color-amber-500)}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-cyan-200\/90{color:#a2f4fde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-200\/90{color:color-mix(in oklab,var(--color-cyan-200) 90%,transparent)}}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-300\/90{color:#53eafde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-300\/90{color:color-mix(in oklab,var(--color-cyan-300) 90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/90{color:#00d294e6}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/90{color:color-mix(in oklab,var(--color-emerald-400) 90%,transparent)}}.text-foreground,.text-foreground\/90{color:hsl(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.text-foreground\/90{color:color-mix(in oklab,hsl(var(--foreground)) 90%,transparent)}}.text-fuchsia-300{color:var(--color-fuchsia-300)}.text-fuchsia-400{color:var(--color-fuchsia-400)}.text-indigo-300{color:var(--color-indigo-300)}.text-indigo-400{color:var(--color-indigo-400)}.text-muted-foreground,.text-muted-foreground\/40{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.text-muted-foreground\/50{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/50{color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.text-muted-foreground\/55{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/55{color:color-mix(in oklab,hsl(var(--muted-foreground)) 55%,transparent)}}.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.text-muted-foreground\/70{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,hsl(var(--muted-foreground)) 70%,transparent)}}.text-muted-foreground\/75{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/75{color:color-mix(in oklab,hsl(var(--muted-foreground)) 75%,transparent)}}.text-muted-foreground\/80{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/80{color:color-mix(in oklab,hsl(var(--muted-foreground)) 80%,transparent)}}.text-orange-300{color:var(--color-orange-300)}.text-pink-400{color:var(--color-pink-400)}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/70{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/70{color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.text-primary\/80{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/80{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-400\/80{color:#ff6568cc}@supports (color:color-mix(in lab,red,red)){.text-red-400\/80{color:color-mix(in oklab,var(--color-red-400) 80%,transparent)}}.text-rose-400{color:var(--color-rose-400)}.text-sky-400{color:var(--color-sky-400)}.text-slate-300{color:var(--color-slate-300)}.text-teal-400{color:var(--color-teal-400)}.text-transparent{color:#0000}.text-violet-200\/90{color:#ddd6ffe6}@supports (color:color-mix(in lab,red,red)){.text-violet-200\/90{color:color-mix(in oklab,var(--color-violet-200) 90%,transparent)}}.text-violet-300{color:var(--color-violet-300)}.text-violet-300\/80{color:#c4b4ffcc}@supports (color:color-mix(in lab,red,red)){.text-violet-300\/80{color:color-mix(in oklab,var(--color-violet-300) 80%,transparent)}}.text-violet-400{color:var(--color-violet-400)}.text-violet-400\/70{color:#a685ffb3}@supports (color:color-mix(in lab,red,red)){.text-violet-400\/70{color:color-mix(in oklab,var(--color-violet-400) 70%,transparent)}}.text-white{color:var(--color-white)}.text-white\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\/95{color:color-mix(in oklab,var(--color-white) 95%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-primary{accent-color:hsl(var(--primary))}.opacity-0{opacity:0}.opacity-35{opacity:.35}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow\!{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-500\/10{--tw-shadow-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.shadow-amber-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/5{--tw-shadow-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.shadow-black\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/10{--tw-shadow-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.shadow-black\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/15{--tw-shadow-color:#00000026}@supports (color:color-mix(in lab,red,red)){.shadow-black\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/20{--tw-shadow-color:#0003}@supports (color:color-mix(in lab,red,red)){.shadow-black\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/25{--tw-shadow-color:#00000040}@supports (color:color-mix(in lab,red,red)){.shadow-black\/25{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 25%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/5{--tw-shadow-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/5{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/10{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/20{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/10{--tw-shadow-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/30{--tw-shadow-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-black\/40{--tw-ring-color:#0006}@supports (color:color-mix(in lab,red,red)){.ring-black\/40{--tw-ring-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[130px\]{--tw-blur:blur(130px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[140px\]{--tw-blur:blur(140px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[160px\]{--tw-blur:blur(160px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a)) drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.sepia{--tw-sepia:sepia(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\!filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.select-text{-webkit-user-select:text;user-select:text}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-primary:is(:where(.group):hover *){color:hsl(var(--primary))}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}@media(hover:hover){.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:border-primary:hover,.hover\:border-primary\/20:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/20:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:border-primary\/30:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/30:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.hover\:border-primary\/40:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.hover\:border-primary\/45:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/45:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-400:hover{background-color:var(--color-amber-400)}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.hover\:bg-amber-500\/15:hover{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/15:hover{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.hover\:bg-background\/30:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/30:hover{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.hover\:bg-background\/40:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/40:hover{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.hover\:bg-background\/60:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/60:hover{background-color:color-mix(in oklab,hsl(var(--background)) 60%,transparent)}}.hover\:bg-background\/80:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/80:hover{background-color:color-mix(in oklab,hsl(var(--background)) 80%,transparent)}}.hover\:bg-card\/30:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/30:hover{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.hover\:bg-card\/70:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/70:hover{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.hover\:bg-emerald-500\/10:hover{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/10:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.hover\:bg-emerald-500\/15:hover{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/15:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.hover\:bg-fuchsia-500\/20:hover{background-color:#e12afb33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-fuchsia-500\/20:hover{background-color:color-mix(in oklab,var(--color-fuchsia-500) 20%,transparent)}}.hover\:bg-indigo-500\/15:hover{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/15:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.hover\:bg-primary\/5:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/5:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/10:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.hover\:bg-primary\/15:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/15:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.hover\:bg-primary\/20:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/20:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:bg-primary\/25:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/25:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 90%,transparent)}}.hover\:bg-primary\/95:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/95:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 95%,transparent)}}.hover\:bg-red-400:hover{background-color:var(--color-red-400)}.hover\:bg-red-500\/5:hover{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/5:hover{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}}.focus\:border-primary:focus,.focus\:border-primary\/50:focus{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:border-primary\/50:focus{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-primary:focus,.focus\:ring-primary\/50:focus{--tw-ring-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:ring-primary\/50:focus{--tw-ring-color:color-mix(in oklab, hsl(var(--primary)) 50%, transparent)}}.focus\:ring-violet-500\/50:focus{--tw-ring-color:#8d54ff80}@supports (color:color-mix(in lab,red,red)){.focus\:ring-violet-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}@media(min-width:40rem){.sm\:w-\[640px\]{width:640px}.sm\:max-w-\[400px\]{max-width:400px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-auto{align-self:auto}.sm\:p-10{padding:calc(var(--spacing) * 10)}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-\[170px_1fr\]{grid-template-columns:170px 1fr}}@media(min-width:64rem){.lg\:flex{display:flex}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-\[1fr_300px\]{grid-template-columns:1fr 300px}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}}}:root{--background:224 30% 6%;--foreground:210 20% 92%;--card:224 25% 10%;--card-foreground:210 20% 94%;--popover:224 28% 9%;--popover-foreground:210 20% 94%;--primary:172 72% 50%;--primary-foreground:224 47% 8%;--muted:220 16% 14%;--muted-foreground:215 14% 64%;--accent:220 16% 16%;--accent-foreground:210 20% 94%;--border:222 18% 23%;--input:222 18% 23%;--ring:172 72% 50%;--radius:.75rem}.light{--background:0 0% 100%;--foreground:222 22% 12%;--card:0 0% 100%;--card-foreground:222 22% 12%;--popover:0 0% 100%;--popover-foreground:222 22% 12%;--primary:172 70% 38%;--primary-foreground:0 0% 100%;--muted:220 14% 95%;--muted-foreground:220 9% 42%;--accent:220 14% 94%;--accent-foreground:222 22% 12%;--border:220 13% 88%;--input:220 13% 88%;--ring:172 66% 50%}@keyframes aurora{0%{background-position:0%}50%{background-position:100%}to{background-position:0%}}.animate-aurora{background-size:200% 200%;animation:25s infinite aurora}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:9999px}*{border-color:hsl(var(--border) / .85);outline-color:hsl(var(--primary) / .5)}html,body,#root{height:100%;overflow:hidden}body{background-color:hsl(var(--background));color:hsl(var(--foreground));font-family:var(--font-sans);-webkit-font-smoothing:antialiased;margin:0}@keyframes flow-cyan{0%{stroke-dasharray:6 3;stroke-dashoffset:18px}to{stroke-dasharray:6 3;stroke-dashoffset:0}}.animate-flow-cyan{animation:1.2s linear infinite flow-cyan}.rounded-2xl.border.bg-card\/45{position:relative;overflow:hidden;background-color:hsl(var(--card) / .85)!important;border-color:hsl(var(--border) / .95)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;box-shadow:0 10px 30px -15px #00000073,inset 0 1px #ffffff0d!important}.rounded-2xl.border.bg-card\/45:before{content:"";background:linear-gradient(90deg,hsl(var(--primary)),#6366f1,#a855f7);opacity:.75;height:3.5px;position:absolute;top:0;left:0;right:0;transition:opacity .3s!important}.rounded-2xl.border.bg-card\/45:hover{transform:translateY(-3px);background-color:hsl(var(--card) / .92)!important;border-color:hsl(var(--primary) / .35)!important;box-shadow:0 20px 40px -20px #000000a6,0 0 18px 2px hsl(var(--primary) / .05)!important}.rounded-2xl.border.bg-card\/45:hover:before{opacity:1}.rounded-xl.border.bg-card\/45{background-color:hsl(var(--card) / .88)!important;border-color:hsl(var(--border) / .9)!important;transition:all .2s!important}.rounded-xl.border.bg-card\/45:hover{background-color:hsl(var(--card) / .95)!important;border-color:hsl(var(--primary) / .3)!important}aside nav button[class*="bg-primary/15"]:not([class*=justify-center]){background:linear-gradient(90deg,hsl(var(--primary) / .18),#6366f11f)!important;color:hsl(var(--primary))!important;border-left:3.5px solid hsl(var(--primary))!important;border-radius:0 var(--radius) var(--radius) 0!important;padding-left:calc(.75rem - 3.5px)!important;box-shadow:inset 0 1px #ffffff05!important}aside nav button[class*="bg-primary/15"][class*=justify-center]{background:hsl(var(--primary) / .18)!important;color:hsl(var(--primary))!important;box-shadow:0 0 12px 1px hsl(var(--primary) / .1)!important;border:1px solid hsl(var(--primary) / .3)!important}::-webkit-scrollbar-thumb{border-radius:9999px;background:hsl(var(--primary) / .25)!important}::-webkit-scrollbar-thumb:hover{background:hsl(var(--primary) / .5)!important}input:focus,textarea:focus,select:focus{outline:none;border-color:hsl(var(--primary))!important;box-shadow:0 0 0 2px hsl(var(--primary) / .15)!important}@media(min-width:1440px){html{font-size:16.5px}}@media(min-width:1920px){html{font-size:17.5px}}@media(min-width:2560px){html{font-size:19px}}@media(min-width:3440px){html{font-size:20px}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}} +@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap";/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-200:oklch(89.4% .057 293.283);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-500:oklch(62.7% .265 303.9);--color-fuchsia-300:oklch(83.3% .145 321.434);--color-fuchsia-400:oklch(74% .238 322.16);--color-fuchsia-500:oklch(66.7% .295 322.15);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-400:oklch(71.2% .194 13.428);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-500:oklch(55.4% .046 257.417);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-normal:1.5;--leading-relaxed:1.625;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--default-mono-font-family:"JetBrains Mono", ui-monospace, SFMono-Regular, monospace}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.visible\!{visibility:visible!important}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{inset-inline:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-3{top:calc(var(--spacing) * 3)}.top-\[-10\%\]{top:-10%}.top-\[30\%\]{top:30%}.right-0{right:0}.right-3{right:calc(var(--spacing) * 3)}.right-\[-10\%\]{right:-10%}.right-\[20\%\]{right:20%}.bottom-3{bottom:calc(var(--spacing) * 3)}.bottom-\[-10\%\]{bottom:-10%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-\[-10\%\]{left:-10%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.-z-50{z-index:-50}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[60\]{z-index:60}.z-\[99\]{z-index:99}.col-span-full{grid-column:1/-1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.mx-auto{margin-inline:auto}.-mt-1{margin-top:calc(var(--spacing) * -1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-3\.5{margin-top:calc(var(--spacing) * 3.5)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-auto{margin-top:auto}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:var(--spacing)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-4\.5{height:calc(var(--spacing) * 4.5)}.h-5{height:calc(var(--spacing) * 5)}.h-5\.5{height:calc(var(--spacing) * 5.5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-44{height:calc(var(--spacing) * 44)}.h-96{height:calc(var(--spacing) * 96)}.h-\[40\%\]{height:40%}.h-\[50\%\]{height:50%}.h-\[150px\]{height:150px}.h-\[480px\]{height:480px}.h-\[calc\(100vh-13rem\)\]{height:calc(100vh - 13rem)}.h-full{height:100%}.h-px{height:1px}.max-h-20{max-height:calc(var(--spacing) * 20)}.max-h-36{max-height:calc(var(--spacing) * 36)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\[80vh\]{max-height:80vh}.min-h-0{min-height:0}.min-h-\[68vh\]{min-height:68vh}.min-h-\[90px\]{min-height:90px}.min-h-\[300px\]{min-height:300px}.min-h-\[560px\]{min-height:560px}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-4\.5{width:calc(var(--spacing) * 4.5)}.w-5{width:calc(var(--spacing) * 5)}.w-5\.5{width:calc(var(--spacing) * 5.5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-28{width:calc(var(--spacing) * 28)}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-52{width:calc(var(--spacing) * 52)}.w-60{width:calc(var(--spacing) * 60)}.w-80{width:calc(var(--spacing) * 80)}.w-\[40\%\]{width:40%}.w-\[50\%\]{width:50%}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[88\%\]{max-width:88%}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[260px\]{max-width:260px}.max-w-\[280px\]{max-width:280px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:0;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-full{--tw-translate-x:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.scroll-mt-20{scroll-margin-top:calc(var(--spacing) * 20)}.scrollbar-thin{scrollbar-width:thin}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-7>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 7) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 7) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-1{row-gap:var(--spacing)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-br-sm{border-bottom-right-radius:calc(var(--radius) - 4px)}.rounded-bl{border-bottom-left-radius:.25rem}.rounded-bl-sm{border-bottom-left-radius:calc(var(--radius) - 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/25{border-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/25{border-color:color-mix(in oklab,var(--color-amber-500) 25%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500) 40%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500) 30%,transparent)}}.border-border,.border-border\/10{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/10{border-color:color-mix(in oklab,hsl(var(--border)) 10%,transparent)}}.border-border\/20{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/20{border-color:color-mix(in oklab,hsl(var(--border)) 20%,transparent)}}.border-border\/30{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/30{border-color:color-mix(in oklab,hsl(var(--border)) 30%,transparent)}}.border-border\/40{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/40{border-color:color-mix(in oklab,hsl(var(--border)) 40%,transparent)}}.border-border\/50{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,hsl(var(--border)) 50%,transparent)}}.border-border\/60{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/60{border-color:color-mix(in oklab,hsl(var(--border)) 60%,transparent)}}.border-border\/70{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/70{border-color:color-mix(in oklab,hsl(var(--border)) 70%,transparent)}}.border-border\/80{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/80{border-color:color-mix(in oklab,hsl(var(--border)) 80%,transparent)}}.border-cyan-500\/20{border-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/20{border-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.border-cyan-500\/25{border-color:#00b7d740}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/25{border-color:color-mix(in oklab,var(--color-cyan-500) 25%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500) 30%,transparent)}}.border-emerald-500\/10{border-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/10{border-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.border-emerald-500\/15{border-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/15{border-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/20{border-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-emerald-500\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/40{border-color:color-mix(in oklab,var(--color-emerald-500) 40%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500) 50%,transparent)}}.border-fuchsia-500\/30{border-color:#e12afb4d}@supports (color:color-mix(in lab,red,red)){.border-fuchsia-500\/30{border-color:color-mix(in oklab,var(--color-fuchsia-500) 30%,transparent)}}.border-fuchsia-500\/40{border-color:#e12afb66}@supports (color:color-mix(in lab,red,red)){.border-fuchsia-500\/40{border-color:color-mix(in oklab,var(--color-fuchsia-500) 40%,transparent)}}.border-indigo-500\/25{border-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/25{border-color:color-mix(in oklab,var(--color-indigo-500) 25%,transparent)}}.border-indigo-500\/30{border-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/30{border-color:color-mix(in oklab,var(--color-indigo-500) 30%,transparent)}}.border-indigo-500\/40{border-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/40{border-color:color-mix(in oklab,var(--color-indigo-500) 40%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500) 30%,transparent)}}.border-pink-500\/25{border-color:#f6339a40}@supports (color:color-mix(in lab,red,red)){.border-pink-500\/25{border-color:color-mix(in oklab,var(--color-pink-500) 25%,transparent)}}.border-primary,.border-primary\/20{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/20{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.border-primary\/25{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/25{border-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.border-primary\/30{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/30{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.border-primary\/40{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/40{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.border-primary\/45{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/45{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.border-primary\/50{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/50{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.border-primary\/60{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/60{border-color:color-mix(in oklab,hsl(var(--primary)) 60%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500) 30%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.border-red-500\/25{border-color:#fb2c3640}@supports (color:color-mix(in lab,red,red)){.border-red-500\/25{border-color:color-mix(in oklab,var(--color-red-500) 25%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab,red,red)){.border-red-500\/40{border-color:color-mix(in oklab,var(--color-red-500) 40%,transparent)}}.border-slate-500\/25{border-color:#62748e40}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/25{border-color:color-mix(in oklab,var(--color-slate-500) 25%,transparent)}}.border-slate-500\/30{border-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/30{border-color:color-mix(in oklab,var(--color-slate-500) 30%,transparent)}}.border-teal-500\/25{border-color:#00baa740}@supports (color:color-mix(in lab,red,red)){.border-teal-500\/25{border-color:color-mix(in oklab,var(--color-teal-500) 25%,transparent)}}.border-transparent{border-color:#0000}.border-violet-500\/20{border-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/20{border-color:color-mix(in oklab,var(--color-violet-500) 20%,transparent)}}.border-violet-500\/25{border-color:#8d54ff40}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/25{border-color:color-mix(in oklab,var(--color-violet-500) 25%,transparent)}}.border-t-primary\/70{border-top-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-t-primary\/70{border-top-color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.border-t-violet-500\/70{border-top-color:#8d54ffb3}@supports (color:color-mix(in lab,red,red)){.border-t-violet-500\/70{border-top-color:color-mix(in oklab,var(--color-violet-500) 70%,transparent)}}.border-l-amber-500\/80{border-left-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.border-l-amber-500\/80{border-left-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.border-l-cyan-500\/80{border-left-color:#00b7d7cc}@supports (color:color-mix(in lab,red,red)){.border-l-cyan-500\/80{border-left-color:color-mix(in oklab,var(--color-cyan-500) 80%,transparent)}}.border-l-indigo-500\/80{border-left-color:#625fffcc}@supports (color:color-mix(in lab,red,red)){.border-l-indigo-500\/80{border-left-color:color-mix(in oklab,var(--color-indigo-500) 80%,transparent)}}.border-l-muted{border-left-color:hsl(var(--muted))}.border-l-violet-500\/80{border-left-color:#8d54ffcc}@supports (color:color-mix(in lab,red,red)){.border-l-violet-500\/80{border-left-color:color-mix(in oklab,var(--color-violet-500) 80%,transparent)}}.bg-\[\#070a0f\]{background-color:#070a0f}.bg-\[hsl\(224\,30\%\,6\%\)\]{background-color:#0b0d14}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.bg-amber-500\/80{background-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/80{background-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.bg-amber-500\/\[0\.06\]{background-color:#f99c000f}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/\[0\.06\]{background-color:color-mix(in oklab,var(--color-amber-500) 6%,transparent)}}.bg-background\/10{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/10{background-color:color-mix(in oklab,hsl(var(--background)) 10%,transparent)}}.bg-background\/20{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/20{background-color:color-mix(in oklab,hsl(var(--background)) 20%,transparent)}}.bg-background\/25{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/25{background-color:color-mix(in oklab,hsl(var(--background)) 25%,transparent)}}.bg-background\/30{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/30{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.bg-background\/35{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/35{background-color:color-mix(in oklab,hsl(var(--background)) 35%,transparent)}}.bg-background\/40{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/40{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.bg-background\/50{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/50{background-color:color-mix(in oklab,hsl(var(--background)) 50%,transparent)}}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/25{background-color:#00000040}@supports (color:color-mix(in lab,red,red)){.bg-black\/25{background-color:color-mix(in oklab,var(--color-black) 25%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500) 20%,transparent)}}.bg-border\/30{background-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.bg-border\/30{background-color:color-mix(in oklab,hsl(var(--border)) 30%,transparent)}}.bg-card,.bg-card\/10{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/10{background-color:color-mix(in oklab,hsl(var(--card)) 10%,transparent)}}.bg-card\/20{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/20{background-color:color-mix(in oklab,hsl(var(--card)) 20%,transparent)}}.bg-card\/30{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/30{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.bg-card\/40{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/40{background-color:color-mix(in oklab,hsl(var(--card)) 40%,transparent)}}.bg-card\/45{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/45{background-color:color-mix(in oklab,hsl(var(--card)) 45%,transparent)}}.bg-card\/50{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/50{background-color:color-mix(in oklab,hsl(var(--card)) 50%,transparent)}}.bg-card\/70{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/70{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.bg-card\/75{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/75{background-color:color-mix(in oklab,hsl(var(--card)) 75%,transparent)}}.bg-card\/85{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/85{background-color:color-mix(in oklab,hsl(var(--card)) 85%,transparent)}}.bg-card\/90{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/90{background-color:color-mix(in oklab,hsl(var(--card)) 90%,transparent)}}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/10{background-color:color-mix(in oklab,var(--color-cyan-500) 10%,transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500) 15%,transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/5{background-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/5{background-color:color-mix(in oklab,var(--color-emerald-500) 5%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.bg-emerald-500\/80{background-color:#00bb7fcc}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/80{background-color:color-mix(in oklab,var(--color-emerald-500) 80%,transparent)}}.bg-emerald-500\/\[0\.07\]{background-color:#00bb7f12}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/\[0\.07\]{background-color:color-mix(in oklab,var(--color-emerald-500) 7%,transparent)}}.bg-fuchsia-500\/10{background-color:#e12afb1a}@supports (color:color-mix(in lab,red,red)){.bg-fuchsia-500\/10{background-color:color-mix(in oklab,var(--color-fuchsia-500) 10%,transparent)}}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500) 10%,transparent)}}.bg-indigo-500\/15{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground,.bg-muted-foreground\/40{background-color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.bg-muted-foreground\/40{background-color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.bg-muted\/10{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/10{background-color:color-mix(in oklab,hsl(var(--muted)) 10%,transparent)}}.bg-muted\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,hsl(var(--muted)) 20%,transparent)}}.bg-muted\/40{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/40{background-color:color-mix(in oklab,hsl(var(--muted)) 40%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500) 20%,transparent)}}.bg-pink-500\/15{background-color:#f6339a26}@supports (color:color-mix(in lab,red,red)){.bg-pink-500\/15{background-color:color-mix(in oklab,var(--color-pink-500) 15%,transparent)}}.bg-popover,.bg-popover\/95{background-color:hsl(var(--popover))}@supports (color:color-mix(in lab,red,red)){.bg-popover\/95{background-color:color-mix(in oklab,hsl(var(--popover)) 95%,transparent)}}.bg-primary,.bg-primary\/5{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.bg-primary\/10{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.bg-primary\/15{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/15{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.bg-primary\/\[0\.06\]{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/\[0\.06\]{background-color:color-mix(in oklab,hsl(var(--primary)) 6%,transparent)}}.bg-purple-500\/15{background-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/15{background-color:color-mix(in oklab,var(--color-purple-500) 15%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500) 20%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/5{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500) 15%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500) 80%,transparent)}}.bg-slate-500\/15{background-color:#62748e26}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/15{background-color:color-mix(in oklab,var(--color-slate-500) 15%,transparent)}}.bg-slate-500\/20{background-color:#62748e33}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/20{background-color:color-mix(in oklab,var(--color-slate-500) 20%,transparent)}}.bg-teal-500\/15{background-color:#00baa726}@supports (color:color-mix(in lab,red,red)){.bg-teal-500\/15{background-color:color-mix(in oklab,var(--color-teal-500) 15%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/5{background-color:#8d54ff0d}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/5{background-color:color-mix(in oklab,var(--color-violet-500) 5%,transparent)}}.bg-violet-500\/10{background-color:#8d54ff1a}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/10{background-color:color-mix(in oklab,var(--color-violet-500) 10%,transparent)}}.bg-violet-500\/15{background-color:#8d54ff26}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/15{background-color:color-mix(in oklab,var(--color-violet-500) 15%,transparent)}}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-tr{--tw-gradient-position:to top right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-cyan-500{--tw-gradient-from:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-foreground{--tw-gradient-from:hsl(var(--foreground));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-500{--tw-gradient-from:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500{--tw-gradient-from:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500\/20{--tw-gradient-from:#00baa733}@supports (color:color-mix(in lab,red,red)){.from-teal-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-teal-500) 20%, transparent)}}.from-teal-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-foreground{--tw-gradient-via:hsl(var(--foreground));--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-indigo-500\/15{--tw-gradient-via:#625fff26}@supports (color:color-mix(in lab,red,red)){.via-indigo-500\/15{--tw-gradient-via:color-mix(in oklab, var(--color-indigo-500) 15%, transparent)}}.via-indigo-500\/15{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-blue-500{--tw-gradient-to:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-500{--tw-gradient-to:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-indigo-500{--tw-gradient-to:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary{--tw-gradient-to:hsl(var(--primary));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-purple-500\/20{--tw-gradient-to:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-purple-500) 20%, transparent)}}.to-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-500{--tw-gradient-to:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.bg-repeat{background-repeat:repeat}.fill-primary\/20{fill:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.fill-primary\/20{fill:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-12{padding:calc(var(--spacing) * 12)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[12vh\]{padding-top:12vh}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:JetBrains Mono,ui-monospace,SFMono-Regular,monospace}.font-sans{font-family:Inter,ui-sans-serif,system-ui,-apple-system,sans-serif}.font-space{font-family:Space Grotesk,sans-serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[7px\]{font-size:7px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400) 80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400) 90%,transparent)}}.text-amber-500{color:var(--color-amber-500)}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-cyan-200\/90{color:#a2f4fde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-200\/90{color:color-mix(in oklab,var(--color-cyan-200) 90%,transparent)}}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-300\/90{color:#53eafde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-300\/90{color:color-mix(in oklab,var(--color-cyan-300) 90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/90{color:#00d294e6}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/90{color:color-mix(in oklab,var(--color-emerald-400) 90%,transparent)}}.text-foreground,.text-foreground\/90{color:hsl(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.text-foreground\/90{color:color-mix(in oklab,hsl(var(--foreground)) 90%,transparent)}}.text-fuchsia-300{color:var(--color-fuchsia-300)}.text-fuchsia-400{color:var(--color-fuchsia-400)}.text-indigo-300{color:var(--color-indigo-300)}.text-indigo-400{color:var(--color-indigo-400)}.text-muted-foreground,.text-muted-foreground\/40{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.text-muted-foreground\/45{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/45{color:color-mix(in oklab,hsl(var(--muted-foreground)) 45%,transparent)}}.text-muted-foreground\/50{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/50{color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.text-muted-foreground\/55{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/55{color:color-mix(in oklab,hsl(var(--muted-foreground)) 55%,transparent)}}.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.text-muted-foreground\/65{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/65{color:color-mix(in oklab,hsl(var(--muted-foreground)) 65%,transparent)}}.text-muted-foreground\/70{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,hsl(var(--muted-foreground)) 70%,transparent)}}.text-muted-foreground\/75{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/75{color:color-mix(in oklab,hsl(var(--muted-foreground)) 75%,transparent)}}.text-muted-foreground\/80{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/80{color:color-mix(in oklab,hsl(var(--muted-foreground)) 80%,transparent)}}.text-orange-300{color:var(--color-orange-300)}.text-pink-400{color:var(--color-pink-400)}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/70{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/70{color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.text-primary\/80{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/80{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-400\/80{color:#ff6568cc}@supports (color:color-mix(in lab,red,red)){.text-red-400\/80{color:color-mix(in oklab,var(--color-red-400) 80%,transparent)}}.text-rose-400{color:var(--color-rose-400)}.text-sky-400{color:var(--color-sky-400)}.text-slate-300{color:var(--color-slate-300)}.text-teal-400{color:var(--color-teal-400)}.text-transparent{color:#0000}.text-violet-200\/90{color:#ddd6ffe6}@supports (color:color-mix(in lab,red,red)){.text-violet-200\/90{color:color-mix(in oklab,var(--color-violet-200) 90%,transparent)}}.text-violet-300{color:var(--color-violet-300)}.text-violet-300\/80{color:#c4b4ffcc}@supports (color:color-mix(in lab,red,red)){.text-violet-300\/80{color:color-mix(in oklab,var(--color-violet-300) 80%,transparent)}}.text-violet-400{color:var(--color-violet-400)}.text-violet-400\/70{color:#a685ffb3}@supports (color:color-mix(in lab,red,red)){.text-violet-400\/70{color:color-mix(in oklab,var(--color-violet-400) 70%,transparent)}}.text-white{color:var(--color-white)}.text-white\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\/95{color:color-mix(in oklab,var(--color-white) 95%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-primary{accent-color:hsl(var(--primary))}.opacity-0{opacity:0}.opacity-35{opacity:.35}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow\!{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-500\/10{--tw-shadow-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.shadow-amber-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/5{--tw-shadow-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.shadow-black\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/10{--tw-shadow-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.shadow-black\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/15{--tw-shadow-color:#00000026}@supports (color:color-mix(in lab,red,red)){.shadow-black\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/20{--tw-shadow-color:#0003}@supports (color:color-mix(in lab,red,red)){.shadow-black\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/25{--tw-shadow-color:#00000040}@supports (color:color-mix(in lab,red,red)){.shadow-black\/25{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 25%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/5{--tw-shadow-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/5{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/10{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/20{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/10{--tw-shadow-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/30{--tw-shadow-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-black\/40{--tw-ring-color:#0006}@supports (color:color-mix(in lab,red,red)){.ring-black\/40{--tw-ring-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[130px\]{--tw-blur:blur(130px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[140px\]{--tw-blur:blur(140px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[160px\]{--tw-blur:blur(160px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a)) drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.sepia{--tw-sepia:sepia(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\!filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.select-text{-webkit-user-select:text;user-select:text}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-primary:is(:where(.group):hover *){color:hsl(var(--primary))}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}@media(hover:hover){.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:border-primary:hover,.hover\:border-primary\/20:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/20:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:border-primary\/30:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/30:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.hover\:border-primary\/40:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.hover\:border-primary\/45:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/45:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-400:hover{background-color:var(--color-amber-400)}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.hover\:bg-amber-500\/15:hover{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/15:hover{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.hover\:bg-background\/30:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/30:hover{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.hover\:bg-background\/40:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/40:hover{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.hover\:bg-background\/60:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/60:hover{background-color:color-mix(in oklab,hsl(var(--background)) 60%,transparent)}}.hover\:bg-background\/80:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/80:hover{background-color:color-mix(in oklab,hsl(var(--background)) 80%,transparent)}}.hover\:bg-card\/30:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/30:hover{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.hover\:bg-card\/70:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/70:hover{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.hover\:bg-emerald-500\/10:hover{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/10:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.hover\:bg-emerald-500\/15:hover{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/15:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.hover\:bg-fuchsia-500\/20:hover{background-color:#e12afb33}@supports (color:color-mix(in lab,red,red)){.hover\:bg-fuchsia-500\/20:hover{background-color:color-mix(in oklab,var(--color-fuchsia-500) 20%,transparent)}}.hover\:bg-indigo-500\/15:hover{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/15:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.hover\:bg-primary\/5:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/5:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/10:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.hover\:bg-primary\/15:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/15:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.hover\:bg-primary\/20:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/20:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:bg-primary\/25:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/25:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 90%,transparent)}}.hover\:bg-primary\/95:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/95:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 95%,transparent)}}.hover\:bg-red-400:hover{background-color:var(--color-red-400)}.hover\:bg-red-500\/5:hover{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/5:hover{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}}.focus\:border-primary:focus,.focus\:border-primary\/50:focus{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:border-primary\/50:focus{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-primary:focus,.focus\:ring-primary\/50:focus{--tw-ring-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:ring-primary\/50:focus{--tw-ring-color:color-mix(in oklab, hsl(var(--primary)) 50%, transparent)}}.focus\:ring-violet-500\/50:focus{--tw-ring-color:#8d54ff80}@supports (color:color-mix(in lab,red,red)){.focus\:ring-violet-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}@media(min-width:40rem){.sm\:w-\[640px\]{width:640px}.sm\:max-w-\[400px\]{max-width:400px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-auto{align-self:auto}.sm\:p-10{padding:calc(var(--spacing) * 10)}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-\[170px_1fr\]{grid-template-columns:170px 1fr}}@media(min-width:64rem){.lg\:flex{display:flex}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-\[1fr_300px\]{grid-template-columns:1fr 300px}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}}}:root{--background:224 30% 6%;--foreground:210 20% 92%;--card:224 25% 10%;--card-foreground:210 20% 94%;--popover:224 28% 9%;--popover-foreground:210 20% 94%;--primary:172 72% 50%;--primary-foreground:224 47% 8%;--muted:220 16% 14%;--muted-foreground:215 14% 64%;--accent:220 16% 16%;--accent-foreground:210 20% 94%;--border:222 18% 23%;--input:222 18% 23%;--ring:172 72% 50%;--radius:.75rem}.light{--background:0 0% 100%;--foreground:222 22% 12%;--card:0 0% 100%;--card-foreground:222 22% 12%;--popover:0 0% 100%;--popover-foreground:222 22% 12%;--primary:172 70% 38%;--primary-foreground:0 0% 100%;--muted:220 14% 95%;--muted-foreground:220 9% 42%;--accent:220 14% 94%;--accent-foreground:222 22% 12%;--border:220 13% 88%;--input:220 13% 88%;--ring:172 66% 50%}@keyframes aurora{0%{background-position:0%}50%{background-position:100%}to{background-position:0%}}.animate-aurora{background-size:200% 200%;animation:25s infinite aurora}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:9999px}*{border-color:hsl(var(--border) / .85);outline-color:hsl(var(--primary) / .5)}html,body,#root{height:100%;overflow:hidden}body{background-color:hsl(var(--background));color:hsl(var(--foreground));font-family:var(--font-sans);-webkit-font-smoothing:antialiased;margin:0}@keyframes flow-cyan{0%{stroke-dasharray:6 3;stroke-dashoffset:18px}to{stroke-dasharray:6 3;stroke-dashoffset:0}}.animate-flow-cyan{animation:1.2s linear infinite flow-cyan}.rounded-2xl.border.bg-card\/45{position:relative;overflow:hidden;background-color:hsl(var(--card) / .85)!important;border-color:hsl(var(--border) / .95)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;box-shadow:0 10px 30px -15px #00000073,inset 0 1px #ffffff0d!important}.rounded-2xl.border.bg-card\/45:before{content:"";background:linear-gradient(90deg,hsl(var(--primary)),#6366f1,#a855f7);opacity:.75;height:3.5px;position:absolute;top:0;left:0;right:0;transition:opacity .3s!important}.rounded-2xl.border.bg-card\/45:hover{transform:translateY(-3px);background-color:hsl(var(--card) / .92)!important;border-color:hsl(var(--primary) / .35)!important;box-shadow:0 20px 40px -20px #000000a6,0 0 18px 2px hsl(var(--primary) / .05)!important}.rounded-2xl.border.bg-card\/45:hover:before{opacity:1}.rounded-xl.border.bg-card\/45{background-color:hsl(var(--card) / .88)!important;border-color:hsl(var(--border) / .9)!important;transition:all .2s!important}.rounded-xl.border.bg-card\/45:hover{background-color:hsl(var(--card) / .95)!important;border-color:hsl(var(--primary) / .3)!important}aside nav button[class*="bg-primary/15"]:not([class*=justify-center]){background:linear-gradient(90deg,hsl(var(--primary) / .18),#6366f11f)!important;color:hsl(var(--primary))!important;border-left:3.5px solid hsl(var(--primary))!important;border-radius:0 var(--radius) var(--radius) 0!important;padding-left:calc(.75rem - 3.5px)!important;box-shadow:inset 0 1px #ffffff05!important}aside nav button[class*="bg-primary/15"][class*=justify-center]{background:hsl(var(--primary) / .18)!important;color:hsl(var(--primary))!important;box-shadow:0 0 12px 1px hsl(var(--primary) / .1)!important;border:1px solid hsl(var(--primary) / .3)!important}::-webkit-scrollbar-thumb{border-radius:9999px;background:hsl(var(--primary) / .25)!important}::-webkit-scrollbar-thumb:hover{background:hsl(var(--primary) / .5)!important}input:focus,textarea:focus,select:focus{outline:none;border-color:hsl(var(--primary))!important;box-shadow:0 0 0 2px hsl(var(--primary) / .15)!important}@media(min-width:1440px){html{font-size:16.5px}}@media(min-width:1920px){html{font-size:17.5px}}@media(min-width:2560px){html{font-size:19px}}@media(min-width:3440px){html{font-size:20px}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}} diff --git a/frontend/dist/assets/index-BK9pTA8z.js b/frontend/dist/assets/index-CyyjRWEt.js similarity index 53% rename from frontend/dist/assets/index-BK9pTA8z.js rename to frontend/dist/assets/index-CyyjRWEt.js index 781814b..4f93be5 100644 --- a/frontend/dist/assets/index-BK9pTA8z.js +++ b/frontend/dist/assets/index-CyyjRWEt.js @@ -1,4 +1,4 @@ -var bW=Object.defineProperty;var BN=t=>{throw TypeError(t)};var _W=(t,e,n)=>e in t?bW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ws=(t,e,n)=>_W(t,typeof e!="symbol"?e+"":e,n),QM=(t,e,n)=>e.has(t)||BN("Cannot "+n);var ge=(t,e,n)=>(QM(t,e,"read from private field"),n?n.call(t):e.get(t)),Kt=(t,e,n)=>e.has(t)?BN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Tt=(t,e,n,r)=>(QM(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Mn=(t,e,n)=>(QM(t,e,"access private method"),n);var db=(t,e,n,r)=>({set _(i){Tt(t,e,i,n)},get _(){return ge(t,e,r)}});function wW(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function V1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var JM={exports:{}},n0={},eE={exports:{}},xn={};/** +var MW=Object.defineProperty;var GN=t=>{throw TypeError(t)};var EW=(t,e,n)=>e in t?MW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var $s=(t,e,n)=>EW(t,typeof e!="symbol"?e+"":e,n),eE=(t,e,n)=>e.has(t)||GN("Cannot "+n);var ge=(t,e,n)=>(eE(t,e,"read from private field"),n?n.call(t):e.get(t)),Yt=(t,e,n)=>e.has(t)?GN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Tt=(t,e,n,r)=>(eE(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),En=(t,e,n)=>(eE(t,e,"access private method"),n);var db=(t,e,n,r)=>({set _(i){Tt(t,e,i,n)},get _(){return ge(t,e,r)}});function AW(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function G1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var tE={exports:{}},n0={},nE={exports:{}},yn={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var bW=Object.defineProperty;var BN=t=>{throw TypeError(t)};var _W=(t,e,n)=>e in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var HN;function SW(){if(HN)return xn;HN=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function m(V){return V===null||typeof V!="object"?null:(V=f&&V[f]||V["@@iterator"],typeof V=="function"?V:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,S={};function _(V,q,he){this.props=V,this.context=q,this.refs=S,this.updater=he||y}_.prototype.isReactComponent={},_.prototype.setState=function(V,q){if(typeof V!="object"&&typeof V!="function"&&V!=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,V,q,"setState")},_.prototype.forceUpdate=function(V){this.updater.enqueueForceUpdate(this,V,"forceUpdate")};function w(){}w.prototype=_.prototype;function E(V,q,he){this.props=V,this.context=q,this.refs=S,this.updater=he||y}var T=E.prototype=new w;T.constructor=E,x(T,_.prototype),T.isPureReactComponent=!0;var C=Array.isArray,O=Object.prototype.hasOwnProperty,N={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};function F(V,q,he){var ae,ce={},we=null,Ee=null;if(q!=null)for(ae in q.ref!==void 0&&(Ee=q.ref),q.key!==void 0&&(we=""+q.key),q)O.call(q,ae)&&!L.hasOwnProperty(ae)&&(ce[ae]=q[ae]);var Xe=arguments.length-2;if(Xe===1)ce.children=he;else if(1{throw TypeError(t)};var _W=(t,e,n)=>e in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var GN;function MW(){if(GN)return n0;GN=1;var t=$h(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,c){var d,f={},m=null,y=null;c!==void 0&&(m=""+c),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(y=l.ref);for(d in l)r.call(l,d)&&!s.hasOwnProperty(d)&&(f[d]=l[d]);if(a&&a.defaultProps)for(d in l=a.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:e,type:a,key:m,ref:y,props:f,_owner:i.current}}return n0.Fragment=n,n0.jsx=o,n0.jsxs=o,n0}var WN;function EW(){return WN||(WN=1,JM.exports=MW()),JM.exports}var g=EW(),R=$h();const WU=V1(R),G1=wW({__proto__:null,default:WU},[R]);var fb={},tE={exports:{}},$s={},nE={exports:{}},rE={};/** + */var XN;function CW(){if(XN)return n0;XN=1;var t=Xh(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,c){var d,f={},g=null,y=null;c!==void 0&&(g=""+c),l.key!==void 0&&(g=""+l.key),l.ref!==void 0&&(y=l.ref);for(d in l)r.call(l,d)&&!s.hasOwnProperty(d)&&(f[d]=l[d]);if(a&&a.defaultProps)for(d in l=a.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:e,type:a,key:g,ref:y,props:f,_owner:i.current}}return n0.Fragment=n,n0.jsx=o,n0.jsxs=o,n0}var qN;function PW(){return qN||(qN=1,tE.exports=CW()),tE.exports}var p=PW(),P=Xh();const XU=G1(P),W1=AW({__proto__:null,default:XU},[P]);var fb={},rE={exports:{}},Xs={},iE={exports:{}},sE={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var bW=Object.defineProperty;var BN=t=>{throw TypeError(t)};var _W=(t,e,n)=>e in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var $N;function AW(){return $N||($N=1,(function(t){function e(B,Q){var K=B.length;B.push(Q);e:for(;0>>1,q=B[V];if(0>>1;Vi(ce,K))wei(Ee,ce)?(B[V]=Ee,B[we]=K,V=we):(B[V]=ce,B[ae]=K,V=ae);else if(wei(Ee,K))B[V]=Ee,B[we]=K,V=we;else break e}}return Q}function i(B,Q){var K=B.sortIndex-Q.sortIndex;return K!==0?K:B.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var Q=n(c);Q!==null;){if(Q.callback===null)r(c);else if(Q.startTime<=B)r(c),Q.sortIndex=Q.expirationTime,e(l,Q);else break;Q=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,se(O);else{var Q=n(c);Q!==null&&fe(C,Q.startTime-B)}}function O(B,Q){x=!1,S&&(S=!1,w(F),F=-1),y=!0;var K=m;try{for(T(Q),f=n(l);f!==null&&(!(f.expirationTime>Q)||B&&!U());){var V=f.callback;if(typeof V=="function"){f.callback=null,m=f.priorityLevel;var q=V(f.expirationTime<=Q);Q=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(Q)}else r(l);f=n(l)}if(f!==null)var he=!0;else{var ae=n(c);ae!==null&&fe(C,ae.startTime-Q),he=!1}return he}finally{f=null,m=K,y=!1}}var N=!1,L=null,F=-1,G=5,k=-1;function U(){return!(t.unstable_now()-kB||125V?(B.sortIndex=K,e(c,B),n(l)===null&&B===n(c)&&(S?(w(F),F=-1):S=!0,fe(C,K-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,se(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var Q=m;return function(){var K=m;m=Q;try{return B.apply(this,arguments)}finally{m=K}}}})(rE)),rE}var XN;function TW(){return XN||(XN=1,nE.exports=AW()),nE.exports}/** + */var KN;function RW(){return KN||(KN=1,(function(t){function e(B,Q){var K=B.length;B.push(Q);e:for(;0>>1,q=B[V];if(0>>1;Vi(ce,K))wei(Ee,ce)?(B[V]=Ee,B[we]=K,V=we):(B[V]=ce,B[ae]=K,V=ae);else if(wei(Ee,K))B[V]=Ee,B[we]=K,V=we;else break e}}return Q}function i(B,Q){var K=B.sortIndex-Q.sortIndex;return K!==0?K:B.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,g=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var Q=n(c);Q!==null;){if(Q.callback===null)r(c);else if(Q.startTime<=B)r(c),Q.sortIndex=Q.expirationTime,e(l,Q);else break;Q=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,ie(O);else{var Q=n(c);Q!==null&&fe(C,Q.startTime-B)}}function O(B,Q){x=!1,S&&(S=!1,b(F),F=-1),y=!0;var K=g;try{for(T(Q),f=n(l);f!==null&&(!(f.expirationTime>Q)||B&&!U());){var V=f.callback;if(typeof V=="function"){f.callback=null,g=f.priorityLevel;var q=V(f.expirationTime<=Q);Q=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(Q)}else r(l);f=n(l)}if(f!==null)var he=!0;else{var ae=n(c);ae!==null&&fe(C,ae.startTime-Q),he=!1}return he}finally{f=null,g=K,y=!1}}var N=!1,L=null,F=-1,G=5,k=-1;function U(){return!(t.unstable_now()-kB||125V?(B.sortIndex=K,e(c,B),n(l)===null&&B===n(c)&&(S?(b(F),F=-1):S=!0,fe(C,K-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,ie(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var Q=g;return function(){var K=g;g=Q;try{return B.apply(this,arguments)}finally{g=K}}}})(sE)),sE}var YN;function NW(){return YN||(YN=1,iE.exports=RW()),iE.exports}/** * @license React * react-dom.production.min.js * @@ -30,420 +30,435 @@ var bW=Object.defineProperty;var BN=t=>{throw TypeError(t)};var _W=(t,e,n)=>e in * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var qN;function CW(){if(qN)return $s;qN=1;var t=$h(),e=TW();function n(u){for(var h="https://reactjs.org/docs/error-decoder.html?invariant="+u,b=1;b"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,c=/^[: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]*$/,d={},f={};function m(u){return l.call(f,u)?!0:l.call(d,u)?!1:c.test(u)?f[u]=!0:(d[u]=!0,!1)}function y(u,h,b,A){if(b!==null&&b.type===0)return!1;switch(typeof h){case"function":case"symbol":return!0;case"boolean":return A?!1:b!==null?!b.acceptsBooleans:(u=u.toLowerCase().slice(0,5),u!=="data-"&&u!=="aria-");default:return!1}}function x(u,h,b,A){if(h===null||typeof h>"u"||y(u,h,b,A))return!0;if(A)return!1;if(b!==null)switch(b.type){case 3:return!h;case 4:return h===!1;case 5:return isNaN(h);case 6:return isNaN(h)||1>h}return!1}function S(u,h,b,A,I,j,W){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=A,this.attributeNamespace=I,this.mustUseProperty=b,this.propertyName=u,this.type=h,this.sanitizeURL=j,this.removeEmptyString=W}var _={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(u){_[u]=new S(u,0,!1,u,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(u){var h=u[0];_[h]=new S(h,1,!1,u[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(u){_[u]=new S(u,2,!1,u.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(u){_[u]=new S(u,2,!1,u,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(u){_[u]=new S(u,3,!1,u.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(u){_[u]=new S(u,3,!0,u,null,!1,!1)}),["capture","download"].forEach(function(u){_[u]=new S(u,4,!1,u,null,!1,!1)}),["cols","rows","size","span"].forEach(function(u){_[u]=new S(u,6,!1,u,null,!1,!1)}),["rowSpan","start"].forEach(function(u){_[u]=new S(u,5,!1,u.toLowerCase(),null,!1,!1)});var w=/[\-:]([a-z])/g;function E(u){return u[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(u){var h=u.replace(w,E);_[h]=new S(h,1,!1,u,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(u){var h=u.replace(w,E);_[h]=new S(h,1,!1,u,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(u){var h=u.replace(w,E);_[h]=new S(h,1,!1,u,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(u){_[u]=new S(u,1,!1,u.toLowerCase(),null,!1,!1)}),_.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(u){_[u]=new S(u,1,!1,u.toLowerCase(),null,!0,!0)});function T(u,h,b,A){var I=_.hasOwnProperty(h)?_[h]:null;(I!==null?I.type!==0:A||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,c=/^[: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]*$/,d={},f={};function g(u){return l.call(f,u)?!0:l.call(d,u)?!1:c.test(u)?f[u]=!0:(d[u]=!0,!1)}function y(u,h,_,A){if(_!==null&&_.type===0)return!1;switch(typeof h){case"function":case"symbol":return!0;case"boolean":return A?!1:_!==null?!_.acceptsBooleans:(u=u.toLowerCase().slice(0,5),u!=="data-"&&u!=="aria-");default:return!1}}function x(u,h,_,A){if(h===null||typeof h>"u"||y(u,h,_,A))return!0;if(A)return!1;if(_!==null)switch(_.type){case 3:return!h;case 4:return h===!1;case 5:return isNaN(h);case 6:return isNaN(h)||1>h}return!1}function S(u,h,_,A,I,j,W){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=A,this.attributeNamespace=I,this.mustUseProperty=_,this.propertyName=u,this.type=h,this.sanitizeURL=j,this.removeEmptyString=W}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(u){w[u]=new S(u,0,!1,u,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(u){var h=u[0];w[h]=new S(h,1,!1,u[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(u){w[u]=new S(u,2,!1,u.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(u){w[u]=new S(u,2,!1,u,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(u){w[u]=new S(u,3,!1,u.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(u){w[u]=new S(u,3,!0,u,null,!1,!1)}),["capture","download"].forEach(function(u){w[u]=new S(u,4,!1,u,null,!1,!1)}),["cols","rows","size","span"].forEach(function(u){w[u]=new S(u,6,!1,u,null,!1,!1)}),["rowSpan","start"].forEach(function(u){w[u]=new S(u,5,!1,u.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function M(u){return u[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(u){var h=u.replace(b,M);w[h]=new S(h,1,!1,u,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(u){var h=u.replace(b,M);w[h]=new S(h,1,!1,u,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(u){var h=u.replace(b,M);w[h]=new S(h,1,!1,u,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(u){w[u]=new S(u,1,!1,u.toLowerCase(),null,!1,!1)}),w.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(u){w[u]=new S(u,1,!1,u.toLowerCase(),null,!0,!0)});function T(u,h,_,A){var I=w.hasOwnProperty(h)?w[h]:null;(I!==null?I.type!==0:A||!(2oe||I[W]!==j[oe]){var me=` -`+I[W].replace(" at new "," at ");return u.displayName&&me.includes("")&&(me=me.replace("",u.displayName)),me}while(1<=W&&0<=oe);break}}}finally{he=!1,Error.prepareStackTrace=b}return(u=u?u.displayName||u.name:"")?q(u):""}function ce(u){switch(u.tag){case 5:return q(u.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return u=ae(u.type,!1),u;case 11:return u=ae(u.type.render,!1),u;case 1:return u=ae(u.type,!0),u;default:return""}}function we(u){if(u==null)return null;if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case L:return"Fragment";case N:return"Portal";case G:return"Profiler";case F:return"StrictMode";case ne:return"Suspense";case ee:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case U:return(u.displayName||"Context")+".Consumer";case k:return(u._context.displayName||"Context")+".Provider";case H:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case pe:return h=u.displayName||null,h!==null?h:we(u.type)||"Memo";case se:h=u._payload,u=u._init;try{return we(u(h))}catch{}}return null}function Ee(u){var h=u.type;switch(u.tag){case 24:return"Cache";case 9:return(h.displayName||"Context")+".Consumer";case 10:return(h._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return u=h.render,u=u.displayName||u.name||"",h.displayName||(u!==""?"ForwardRef("+u+")":"ForwardRef");case 7:return"Fragment";case 5:return h;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return we(h);case 8:return h===F?"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 h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function Xe(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Se(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function je(u){var h=Se(u)?"checked":"value",b=Object.getOwnPropertyDescriptor(u.constructor.prototype,h),A=""+u[h];if(!u.hasOwnProperty(h)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var I=b.get,j=b.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function(W){A=""+W,j.call(this,W)}}),Object.defineProperty(u,h,{enumerable:b.enumerable}),{getValue:function(){return A},setValue:function(W){A=""+W},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function $e(u){u._valueTracker||(u._valueTracker=je(u))}function ue(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var b=h.getValue(),A="";return u&&(A=Se(u)?u.checked?"true":"false":u.value),u=A,u!==b?(h.setValue(u),!0):!1}function Z(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}function Ge(u,h){var b=h.checked;return K({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:b??u._wrapperState.initialChecked})}function Oe(u,h){var b=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;b=Xe(h.value!=null?h.value:b),u._wrapperState={initialChecked:A,initialValue:b,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function We(u,h){h=h.checked,h!=null&&T(u,"checked",h,!1)}function tt(u,h){We(u,h);var b=Xe(h.value),A=h.type;if(b!=null)A==="number"?(b===0&&u.value===""||u.value!=b)&&(u.value=""+b):u.value!==""+b&&(u.value=""+b);else if(A==="submit"||A==="reset"){u.removeAttribute("value");return}h.hasOwnProperty("value")?dt(u,h.type,b):h.hasOwnProperty("defaultValue")&&dt(u,h.type,Xe(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(u.defaultChecked=!!h.defaultChecked)}function wt(u,h,b){if(h.hasOwnProperty("value")||h.hasOwnProperty("defaultValue")){var A=h.type;if(!(A!=="submit"&&A!=="reset"||h.value!==void 0&&h.value!==null))return;h=""+u._wrapperState.initialValue,b||h===u.value||(u.value=h),u.defaultValue=h}b=u.name,b!==""&&(u.name=""),u.defaultChecked=!!u._wrapperState.initialChecked,b!==""&&(u.name=b)}function dt(u,h,b){(h!=="number"||Z(u.ownerDocument)!==u)&&(b==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+b&&(u.defaultValue=""+b))}var J=Array.isArray;function $(u,h,b,A){if(u=u.options,h){h={};for(var I=0;I"+h.valueOf().toString()+"",h=ht.firstChild;u.firstChild;)u.removeChild(u.firstChild);for(;h.firstChild;)u.appendChild(h.firstChild)}});function Ke(u,h){if(h){var b=u.firstChild;if(b&&b===u.lastChild&&b.nodeType===3){b.nodeValue=h;return}}u.textContent=h}var re={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},Qe=["Webkit","ms","Moz","O"];Object.keys(re).forEach(function(u){Qe.forEach(function(h){h=h+u.charAt(0).toUpperCase()+u.substring(1),re[h]=re[u]})});function St(u,h,b){return h==null||typeof h=="boolean"||h===""?"":b||typeof h!="number"||h===0||re.hasOwnProperty(u)&&re[u]?(""+h).trim():h+"px"}function mt(u,h){u=u.style;for(var b in h)if(h.hasOwnProperty(b)){var A=b.indexOf("--")===0,I=St(b,h[b],A);b==="float"&&(b="cssFloat"),A?u.setProperty(b,I):u[b]=I}}var Qt=K({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 de(u,h){if(h){if(Qt[u]&&(h.children!=null||h.dangerouslySetInnerHTML!=null))throw Error(n(137,u));if(h.dangerouslySetInnerHTML!=null){if(h.children!=null)throw Error(n(60));if(typeof h.dangerouslySetInnerHTML!="object"||!("__html"in h.dangerouslySetInnerHTML))throw Error(n(61))}if(h.style!=null&&typeof h.style!="object")throw Error(n(62))}}function qe(u,h){if(u.indexOf("-")===-1)return typeof h.is=="string";switch(u){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 le=null;function Ye(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Te=null,Fe=null,st=null;function te(u){if(u=ma(u)){if(typeof Te!="function")throw Error(n(280));var h=u.stateNode;h&&(h=jp(h),Te(u.stateNode,u.type,h))}}function ze(u){Fe?st?st.push(u):st=[u]:Fe=u}function Je(){if(Fe){var u=Fe,h=st;if(st=Fe=null,te(u),h)for(u=0;u>>=0,u===0?32:31-(wn(u)/rn|0)|0}var ui=64,Ln=4194304;function ks(u){switch(u&-u){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 u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Wn(u,h){var b=u.pendingLanes;if(b===0)return 0;var A=0,I=u.suspendedLanes,j=u.pingedLanes,W=b&268435455;if(W!==0){var oe=W&~I;oe!==0?A=ks(oe):(j&=W,j!==0&&(A=ks(j)))}else W=b&~I,W!==0?A=ks(W):j!==0&&(A=ks(j));if(A===0)return 0;if(h!==0&&h!==A&&(h&I)===0&&(I=A&-A,j=h&-h,I>=j||I===16&&(j&4194240)!==0))return h;if((A&4)!==0&&(A|=b&16),h=u.entangledLanes,h!==0)for(u=u.entanglements,h&=A;0b;b++)h.push(u);return h}function Za(u,h,b){u.pendingLanes|=h,h!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,h=31-vt(h),u[h]=b}function wM(u,h){var b=u.pendingLanes&~h;u.pendingLanes=h,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=h,u.mutableReadLanes&=h,u.entangledLanes&=h,h=u.entanglements;var A=u.eventTimes;for(u=u.expirationTimes;0=Yr),Fs=" ",vv=!1;function yv(u,h){switch(u){case"keyup":return gv.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bp(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var tl=!1;function Ax(u,h){switch(u){case"compositionend":return bp(h);case"keypress":return h.which!==32?null:(vv=!0,Fs);case"textInput":return u=h.data,u===Fs&&vv?null:u;default:return null}}function Hd(u,h){if(tl)return u==="compositionend"||!Pi&&yv(u,h)?(u=zd(),qi=uv=ro=null,tl=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1=h)return{node:b,offset:h-u};u=A}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=Vd(b)}}function nc(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?nc(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function ir(){for(var u=window,h=Z();h instanceof u.HTMLIFrameElement;){try{var b=typeof h.contentWindow.location.href=="string"}catch{b=!1}if(b)u=h.contentWindow;else break;h=Z(u.document)}return h}function Ur(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h&&(h==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||h==="textarea"||u.contentEditable==="true")}function Fr(u){var h=ir(),b=u.focusedElem,A=u.selectionRange;if(h!==b&&b&&b.ownerDocument&&nc(b.ownerDocument.documentElement,b)){if(A!==null&&Ur(b)){if(h=A.start,u=A.end,u===void 0&&(u=h),"selectionStart"in b)b.selectionStart=h,b.selectionEnd=Math.min(u,b.value.length);else if(u=(h=b.ownerDocument||document)&&h.defaultView||window,u.getSelection){u=u.getSelection();var I=b.textContent.length,j=Math.min(A.start,I);A=A.end===void 0?j:Math.min(A.end,I),!u.extend&&j>A&&(I=A,A=j,j=I),I=ps(b,j);var W=ps(b,A);I&&W&&(u.rangeCount!==1||u.anchorNode!==I.node||u.anchorOffset!==I.offset||u.focusNode!==W.node||u.focusOffset!==W.offset)&&(h=h.createRange(),h.setStart(I.node,I.offset),u.removeAllRanges(),j>A?(u.addRange(h),u.extend(W.node,W.offset)):(h.setEnd(W.node,W.offset),u.addRange(h)))}}for(h=[],u=b;u=u.parentNode;)u.nodeType===1&&h.push({element:u,left:u.scrollLeft,top:u.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b=document.documentMode,Io=null,rc=null,Gd=null,zr=!1;function Ep(u,h,b){var A=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;zr||Io==null||Io!==Z(A)||(A=Io,"selectionStart"in A&&Ur(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}),Gd&&tc(Gd,A)||(Gd=A,A=Ip(rc,"onSelect"),0Br||(u.current=Rv[Br],Rv[Br]=null,Br--)}function $n(u,h){Br++,Rv[Br]=u.current,u.current=h}var ga={},Zr=cr(ga),Ri=cr(!1),va=ga;function ac(u,h){var b=u.type.contextTypes;if(!b)return ga;var A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var I={},j;for(j in b)I[j]=h[j];return A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=h,u.__reactInternalMemoizedMaskedChildContext=I),I}function fi(u){return u=u.childContextTypes,u!=null}function Qd(){qn(Ri),qn(Zr)}function Nv(u,h,b){if(Zr.current!==ga)throw Error(n(168));$n(Zr,h),$n(Ri,b)}function Jd(u,h,b){var A=u.stateNode;if(h=h.childContextTypes,typeof A.getChildContext!="function")return b;A=A.getChildContext();for(var I in A)if(!(I in h))throw Error(n(108,Ee(u)||"Unknown",I));return K({},b,A)}function lc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||ga,va=Zr.current,$n(Zr,u),$n(Ri,Ri.current),!0}function Iv(u,h,b){var A=u.stateNode;if(!A)throw Error(n(169));b?(u=Jd(u,h,va),A.__reactInternalMemoizedMergedChildContext=u,qn(Ri),qn(Zr),$n(Zr,u)):qn(Ri),$n(Ri,b)}var ao=null,ef=!1,Up=!1;function tf(u){ao===null?ao=[u]:ao.push(u)}function Ox(u){ef=!0,tf(u)}function Oo(){if(!Up&&ao!==null){Up=!0;var u=0,h=Nn;try{var b=ao;for(Nn=1;u>=W,I-=W,ft=1<<32-vt(h)+I|b<sn?(gi=qt,qt=null):gi=qt.sibling;var Fn=Ze(Ae,qt,Pe[sn],lt);if(Fn===null){qt===null&&(qt=gi);break}u&&qt&&Fn.alternate===null&&h(Ae,qt),ve=j(Fn,ve,sn),Xt===null?Ft=Fn:Xt.sibling=Fn,Xt=Fn,qt=gi}if(sn===Pe.length)return b(Ae,qt),Yn&&ya(Ae,sn),Ft;if(qt===null){for(;snsn?(gi=qt,qt=null):gi=qt.sibling;var Vu=Ze(Ae,qt,Fn.value,lt);if(Vu===null){qt===null&&(qt=gi);break}u&&qt&&Vu.alternate===null&&h(Ae,qt),ve=j(Vu,ve,sn),Xt===null?Ft=Vu:Xt.sibling=Vu,Xt=Vu,qt=gi}if(Fn.done)return b(Ae,qt),Yn&&ya(Ae,sn),Ft;if(qt===null){for(;!Fn.done;sn++,Fn=Pe.next())Fn=nt(Ae,Fn.value,lt),Fn!==null&&(ve=j(Fn,ve,sn),Xt===null?Ft=Fn:Xt.sibling=Fn,Xt=Fn);return Yn&&ya(Ae,sn),Ft}for(qt=A(Ae,qt);!Fn.done;sn++,Fn=Pe.next())Fn=Et(qt,Ae,sn,Fn.value,lt),Fn!==null&&(u&&Fn.alternate!==null&&qt.delete(Fn.key===null?sn:Fn.key),ve=j(Fn,ve,sn),Xt===null?Ft=Fn:Xt.sibling=Fn,Xt=Fn);return u&&qt.forEach(function(xW){return h(Ae,xW)}),Yn&&ya(Ae,sn),Ft}function Or(Ae,ve,Pe,lt){if(typeof Pe=="object"&&Pe!==null&&Pe.type===L&&Pe.key===null&&(Pe=Pe.props.children),typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case O:e:{for(var Ft=Pe.key,Xt=ve;Xt!==null;){if(Xt.key===Ft){if(Ft=Pe.type,Ft===L){if(Xt.tag===7){b(Ae,Xt.sibling),ve=I(Xt,Pe.props.children),ve.return=Ae,Ae=ve;break e}}else if(Xt.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===se&&Uv(Ft)===Xt.type){b(Ae,Xt.sibling),ve=I(Xt,Pe.props),ve.ref=nf(Ae,Xt,Pe),ve.return=Ae,Ae=ve;break e}b(Ae,Xt);break}else h(Ae,Xt);Xt=Xt.sibling}Pe.type===L?(ve=_f(Pe.props.children,Ae.mode,lt,Pe.key),ve.return=Ae,Ae=ve):(lt=rb(Pe.type,Pe.key,Pe.props,null,Ae.mode,lt),lt.ref=nf(Ae,ve,Pe),lt.return=Ae,Ae=lt)}return W(Ae);case N:e:{for(Xt=Pe.key;ve!==null;){if(ve.key===Xt)if(ve.tag===4&&ve.stateNode.containerInfo===Pe.containerInfo&&ve.stateNode.implementation===Pe.implementation){b(Ae,ve.sibling),ve=I(ve,Pe.children||[]),ve.return=Ae,Ae=ve;break e}else{b(Ae,ve);break}else h(Ae,ve);ve=ve.sibling}ve=XM(Pe,Ae.mode,lt),ve.return=Ae,Ae=ve}return W(Ae);case se:return Xt=Pe._init,Or(Ae,ve,Xt(Pe._payload),lt)}if(J(Pe))return It(Ae,ve,Pe,lt);if(Q(Pe))return Lt(Ae,ve,Pe,lt);rf(Ae,Pe)}return typeof Pe=="string"&&Pe!==""||typeof Pe=="number"?(Pe=""+Pe,ve!==null&&ve.tag===6?(b(Ae,ve.sibling),ve=I(ve,Pe),ve.return=Ae,Ae=ve):(b(Ae,ve),ve=$M(Pe,Ae.mode,lt),ve.return=Ae,Ae=ve),W(Ae)):b(Ae,ve)}return Or}var dc=Fv(!0),sf=Fv(!1),fc=cr(null),hc=null,ba=null,Iu=null;function pc(){Iu=ba=hc=null}function of(u){var h=fc.current;qn(fc),u._currentValue=h}function af(u,h,b){for(;u!==null;){var A=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,A!==null&&(A.childLanes|=h)):A!==null&&(A.childLanes&h)!==h&&(A.childLanes|=h),u===b)break;u=u.return}}function al(u,h){hc=u,Iu=ba=null,u=u.dependencies,u!==null&&u.firstContext!==null&&((u.lanes&h)!==0&&(fn=!0),u.firstContext=null)}function gs(u){var h=u._currentValue;if(Iu!==u)if(u={context:u,memoizedValue:h,next:null},ba===null){if(hc===null)throw Error(n(308));ba=u,hc.dependencies={lanes:0,firstContext:u}}else ba=ba.next=u;return h}var _a=null;function zv(u){_a===null?_a=[u]:_a.push(u)}function lf(u,h,b,A){var I=h.interleaved;return I===null?(b.next=b,zv(h)):(b.next=I.next,I.next=b),h.interleaved=b,lo(u,A)}function lo(u,h){u.lanes|=h;var b=u.alternate;for(b!==null&&(b.lanes|=h),b=u,u=u.return;u!==null;)u.childLanes|=h,b=u.alternate,b!==null&&(b.childLanes|=h),b=u,u=u.return;return b.tag===3?b.stateNode:null}var Hn=!1;function un(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function gr(u,h){u=u.updateQueue,h.updateQueue===u&&(h.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,effects:u.effects})}function Vn(u,h){return{eventTime:u,lane:h,tag:0,payload:null,callback:null,next:null}}function er(u,h,b){var A=u.updateQueue;if(A===null)return null;if(A=A.shared,(Dn&2)!==0){var I=A.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),A.pending=h,lo(u,b)}return I=A.interleaved,I===null?(h.next=h,zv(A)):(h.next=I.next,I.next=h),A.interleaved=h,lo(u,b)}function hi(u,h,b){if(h=h.updateQueue,h!==null&&(h=h.shared,(b&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,b|=A,h.lanes=b,fu(u,b)}}function mc(u,h){var b=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,b===A)){var I=null,j=null;if(b=b.firstBaseUpdate,b!==null){do{var W={eventTime:b.eventTime,lane:b.lane,tag:b.tag,payload:b.payload,callback:b.callback,next:null};j===null?I=j=W:j=j.next=W,b=b.next}while(b!==null);j===null?I=j=h:j=j.next=h}else I=j=h;b={baseState:A.baseState,firstBaseUpdate:I,lastBaseUpdate:j,shared:A.shared,effects:A.effects},u.updateQueue=b;return}u=b.lastBaseUpdate,u===null?b.firstBaseUpdate=h:u.next=h,b.lastBaseUpdate=h}function ur(u,h,b,A){var I=u.updateQueue;Hn=!1;var j=I.firstBaseUpdate,W=I.lastBaseUpdate,oe=I.shared.pending;if(oe!==null){I.shared.pending=null;var me=oe,ke=me.next;me.next=null,W===null?j=ke:W.next=ke,W=me;var et=u.alternate;et!==null&&(et=et.updateQueue,oe=et.lastBaseUpdate,oe!==W&&(oe===null?et.firstBaseUpdate=ke:oe.next=ke,et.lastBaseUpdate=me))}if(j!==null){var nt=I.baseState;W=0,et=ke=me=null,oe=j;do{var Ze=oe.lane,Et=oe.eventTime;if((A&Ze)===Ze){et!==null&&(et=et.next={eventTime:Et,lane:0,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null});e:{var It=u,Lt=oe;switch(Ze=h,Et=b,Lt.tag){case 1:if(It=Lt.payload,typeof It=="function"){nt=It.call(Et,nt,Ze);break e}nt=It;break e;case 3:It.flags=It.flags&-65537|128;case 0:if(It=Lt.payload,Ze=typeof It=="function"?It.call(Et,nt,Ze):It,Ze==null)break e;nt=K({},nt,Ze);break e;case 2:Hn=!0}}oe.callback!==null&&oe.lane!==0&&(u.flags|=64,Ze=I.effects,Ze===null?I.effects=[oe]:Ze.push(oe))}else Et={eventTime:Et,lane:Ze,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null},et===null?(ke=et=Et,me=nt):et=et.next=Et,W|=Ze;if(oe=oe.next,oe===null){if(oe=I.shared.pending,oe===null)break;Ze=oe,oe=Ze.next,Ze.next=null,I.lastBaseUpdate=Ze,I.shared.pending=null}}while(!0);if(et===null&&(me=nt),I.baseState=me,I.firstBaseUpdate=ke,I.lastBaseUpdate=et,h=I.shared.interleaved,h!==null){I=h;do W|=I.lane,I=I.next;while(I!==h)}else j===null&&(I.shared.lanes=0);vf|=W,u.lanes=W,u.memoizedState=nt}}function ku(u,h,b){if(u=h.effects,h.effects=null,u!==null)for(h=0;hb?b:4,u(!0);var A=xc.transition;xc.transition={};try{u(!1),h()}finally{Nn=b,xc.transition=A}}function Ea(){return ys().memoizedState}function Xp(u,h,b){var A=zu(u);if(b={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null},mf(u))qp(h,b);else if(b=lf(u,h,b,A),b!==null){var I=_s();Pa(b,u,A,I),Kp(b,h,A)}}function bc(u,h,b){var A=zu(u),I={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null};if(mf(u))qp(h,I);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=h.lastRenderedReducer,j!==null))try{var W=h.lastRenderedState,oe=j(W,b);if(I.hasEagerState=!0,I.eagerState=oe,hs(oe,W)){var me=h.interleaved;me===null?(I.next=I,zv(h)):(I.next=me.next,me.next=I),h.interleaved=I;return}}catch{}finally{}b=lf(u,h,I,A),b!==null&&(I=_s(),Pa(b,u,A,I),Kp(b,h,A))}}function mf(u){var h=u.alternate;return u===Kn||h!==null&&h===Kn}function qp(u,h){pi=uo=!0;var b=u.pending;b===null?h.next=h:(h.next=b.next,b.next=h),u.pending=h}function Kp(u,h,b){if((b&4194240)!==0){var A=h.lanes;A&=u.pendingLanes,b|=A,h.lanes=b,fu(u,b)}}var Yp={readContext:gs,useCallback:Jr,useContext:Jr,useEffect:Jr,useImperativeHandle:Jr,useInsertionEffect:Jr,useLayoutEffect:Jr,useMemo:Jr,useReducer:Jr,useRef:Jr,useState:Jr,useDebugValue:Jr,useDeferredValue:Jr,useTransition:Jr,useMutableSource:Jr,useSyncExternalStore:Jr,useId:Jr,unstable_isNewReconciler:!1},Bx={readContext:gs,useCallback:function(u,h){return ei().memoizedState=[u,h===void 0?null:h],u},useContext:gs,useEffect:ki,useImperativeHandle:function(u,h,b){return b=b!=null?b.concat([u]):null,jo(4194308,4,Fx.bind(null,h,u),b)},useLayoutEffect:function(u,h){return jo(4194308,4,u,h)},useInsertionEffect:function(u,h){return jo(4,2,u,h)},useMemo:function(u,h){var b=ei();return h=h===void 0?null:h,u=u(),b.memoizedState=[u,h],u},useReducer:function(u,h,b){var A=ei();return h=b!==void 0?b(h):h,A.memoizedState=A.baseState=h,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:h},A.queue=u,u=u.dispatch=Xp.bind(null,Kn,u),[A.memoizedState,u]},useRef:function(u){var h=ei();return u={current:u},h.memoizedState=u},useState:Wv,useDebugValue:Wp,useDeferredValue:function(u){return ei().memoizedState=u},useTransition:function(){var u=Wv(!1),h=u[0];return u=CM.bind(null,u[1]),ei().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,b){var A=Kn,I=ei();if(Yn){if(b===void 0)throw Error(n(407));b=b()}else{if(b=h(),mi===null)throw Error(n(349));(Sa&30)!==0||Gp(A,h,b)}I.memoizedState=b;var j={value:b,getSnapshot:h};return I.queue=j,ki(Lx.bind(null,A,j,u),[u]),A.flags|=2048,fo(9,hf.bind(null,A,j,b,h),void 0,null),b},useId:function(){var u=ei(),h=mi.identifierPrefix;if(Yn){var b=zs,A=ft;b=(A&~(1<<32-vt(A)-1)).toString(32)+b,h=":"+h+"R"+b,b=cl++,0")&&(me=me.replace("",u.displayName)),me}while(1<=W&&0<=oe);break}}}finally{he=!1,Error.prepareStackTrace=_}return(u=u?u.displayName||u.name:"")?q(u):""}function ce(u){switch(u.tag){case 5:return q(u.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return u=ae(u.type,!1),u;case 11:return u=ae(u.type.render,!1),u;case 1:return u=ae(u.type,!0),u;default:return""}}function we(u){if(u==null)return null;if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case L:return"Fragment";case N:return"Portal";case G:return"Profiler";case F:return"StrictMode";case te:return"Suspense";case ee:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case U:return(u.displayName||"Context")+".Consumer";case k:return(u._context.displayName||"Context")+".Provider";case H:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case pe:return h=u.displayName||null,h!==null?h:we(u.type)||"Memo";case ie:h=u._payload,u=u._init;try{return we(u(h))}catch{}}return null}function Ee(u){var h=u.type;switch(u.tag){case 24:return"Cache";case 9:return(h.displayName||"Context")+".Consumer";case 10:return(h._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return u=h.render,u=u.displayName||u.name||"",h.displayName||(u!==""?"ForwardRef("+u+")":"ForwardRef");case 7:return"Fragment";case 5:return h;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return we(h);case 8:return h===F?"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 h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function Xe(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Se(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function je(u){var h=Se(u)?"checked":"value",_=Object.getOwnPropertyDescriptor(u.constructor.prototype,h),A=""+u[h];if(!u.hasOwnProperty(h)&&typeof _<"u"&&typeof _.get=="function"&&typeof _.set=="function"){var I=_.get,j=_.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function(W){A=""+W,j.call(this,W)}}),Object.defineProperty(u,h,{enumerable:_.enumerable}),{getValue:function(){return A},setValue:function(W){A=""+W},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function $e(u){u._valueTracker||(u._valueTracker=je(u))}function ue(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var _=h.getValue(),A="";return u&&(A=Se(u)?u.checked?"true":"false":u.value),u=A,u!==_?(h.setValue(u),!0):!1}function Z(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}function Ve(u,h){var _=h.checked;return K({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:_??u._wrapperState.initialChecked})}function Oe(u,h){var _=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;_=Xe(h.value!=null?h.value:_),u._wrapperState={initialChecked:A,initialValue:_,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function Ge(u,h){h=h.checked,h!=null&&T(u,"checked",h,!1)}function et(u,h){Ge(u,h);var _=Xe(h.value),A=h.type;if(_!=null)A==="number"?(_===0&&u.value===""||u.value!=_)&&(u.value=""+_):u.value!==""+_&&(u.value=""+_);else if(A==="submit"||A==="reset"){u.removeAttribute("value");return}h.hasOwnProperty("value")?ft(u,h.type,_):h.hasOwnProperty("defaultValue")&&ft(u,h.type,Xe(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(u.defaultChecked=!!h.defaultChecked)}function St(u,h,_){if(h.hasOwnProperty("value")||h.hasOwnProperty("defaultValue")){var A=h.type;if(!(A!=="submit"&&A!=="reset"||h.value!==void 0&&h.value!==null))return;h=""+u._wrapperState.initialValue,_||h===u.value||(u.value=h),u.defaultValue=h}_=u.name,_!==""&&(u.name=""),u.defaultChecked=!!u._wrapperState.initialChecked,_!==""&&(u.name=_)}function ft(u,h,_){(h!=="number"||Z(u.ownerDocument)!==u)&&(_==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+_&&(u.defaultValue=""+_))}var J=Array.isArray;function $(u,h,_,A){if(u=u.options,h){h={};for(var I=0;I<_.length;I++)h["$"+_[I]]=!0;for(_=0;_"+h.valueOf().toString()+"",h=pt.firstChild;u.firstChild;)u.removeChild(u.firstChild);for(;h.firstChild;)u.appendChild(h.firstChild)}});function Ke(u,h){if(h){var _=u.firstChild;if(_&&_===u.lastChild&&_.nodeType===3){_.nodeValue=h;return}}u.textContent=h}var ne={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},Qe=["Webkit","ms","Moz","O"];Object.keys(ne).forEach(function(u){Qe.forEach(function(h){h=h+u.charAt(0).toUpperCase()+u.substring(1),ne[h]=ne[u]})});function Mt(u,h,_){return h==null||typeof h=="boolean"||h===""?"":_||typeof h!="number"||h===0||ne.hasOwnProperty(u)&&ne[u]?(""+h).trim():h+"px"}function yt(u,h){u=u.style;for(var _ in h)if(h.hasOwnProperty(_)){var A=_.indexOf("--")===0,I=Mt(_,h[_],A);_==="float"&&(_="cssFloat"),A?u.setProperty(_,I):u[_]=I}}var Jt=K({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 de(u,h){if(h){if(Jt[u]&&(h.children!=null||h.dangerouslySetInnerHTML!=null))throw Error(n(137,u));if(h.dangerouslySetInnerHTML!=null){if(h.children!=null)throw Error(n(60));if(typeof h.dangerouslySetInnerHTML!="object"||!("__html"in h.dangerouslySetInnerHTML))throw Error(n(61))}if(h.style!=null&&typeof h.style!="object")throw Error(n(62))}}function qe(u,h){if(u.indexOf("-")===-1)return typeof h.is=="string";switch(u){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 le=null;function Ye(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Te=null,Fe=null,st=null;function mt(u){if(u=ma(u)){if(typeof Te!="function")throw Error(n(280));var h=u.stateNode;h&&(h=jp(h),Te(u.stateNode,u.type,h))}}function se(u){Fe?st?st.push(u):st=[u]:Fe=u}function We(){if(Fe){var u=Fe,h=st;if(st=Fe=null,mt(u),h)for(u=0;u>>=0,u===0?32:31-(Sn(u)/sn|0)|0}var fi=64,Dn=4194304;function Os(u){switch(u&-u){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 u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function Wn(u,h){var _=u.pendingLanes;if(_===0)return 0;var A=0,I=u.suspendedLanes,j=u.pingedLanes,W=_&268435455;if(W!==0){var oe=W&~I;oe!==0?A=Os(oe):(j&=W,j!==0&&(A=Os(j)))}else W=_&~I,W!==0?A=Os(W):j!==0&&(A=Os(j));if(A===0)return 0;if(h!==0&&h!==A&&(h&I)===0&&(I=A&-A,j=h&-h,I>=j||I===16&&(j&4194240)!==0))return h;if((A&4)!==0&&(A|=_&16),h=u.entangledLanes,h!==0)for(u=u.entanglements,h&=A;0_;_++)h.push(u);return h}function Za(u,h,_){u.pendingLanes|=h,h!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,h=31-xt(h),u[h]=_}function MM(u,h){var _=u.pendingLanes&~h;u.pendingLanes=h,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=h,u.mutableReadLanes&=h,u.entangledLanes&=h,h=u.entanglements;var A=u.eventTimes;for(u=u.expirationTimes;0<_;){var I=31-xt(_),j=1<=Zr),zs=" ",vv=!1;function yv(u,h){switch(u){case"keyup":return gv.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bp(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var tl=!1;function Ax(u,h){switch(u){case"compositionend":return bp(h);case"keypress":return h.which!==32?null:(vv=!0,zs);case"textInput":return u=h.data,u===zs&&vv?null:u;default:return null}}function Vd(u,h){if(tl)return u==="compositionend"||!Ri&&yv(u,h)?(u=Bd(),qi=uv=so=null,tl=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1=h)return{node:_,offset:h-u};u=A}e:{for(;_;){if(_.nextSibling){_=_.nextSibling;break e}_=_.parentNode}_=void 0}_=Gd(_)}}function nc(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?nc(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function or(){for(var u=window,h=Z();h instanceof u.HTMLIFrameElement;){try{var _=typeof h.contentWindow.location.href=="string"}catch{_=!1}if(_)u=h.contentWindow;else break;h=Z(u.document)}return h}function Fr(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h&&(h==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||h==="textarea"||u.contentEditable==="true")}function zr(u){var h=or(),_=u.focusedElem,A=u.selectionRange;if(h!==_&&_&&_.ownerDocument&&nc(_.ownerDocument.documentElement,_)){if(A!==null&&Fr(_)){if(h=A.start,u=A.end,u===void 0&&(u=h),"selectionStart"in _)_.selectionStart=h,_.selectionEnd=Math.min(u,_.value.length);else if(u=(h=_.ownerDocument||document)&&h.defaultView||window,u.getSelection){u=u.getSelection();var I=_.textContent.length,j=Math.min(A.start,I);A=A.end===void 0?j:Math.min(A.end,I),!u.extend&&j>A&&(I=A,A=j,j=I),I=ps(_,j);var W=ps(_,A);I&&W&&(u.rangeCount!==1||u.anchorNode!==I.node||u.anchorOffset!==I.offset||u.focusNode!==W.node||u.focusOffset!==W.offset)&&(h=h.createRange(),h.setStart(I.node,I.offset),u.removeAllRanges(),j>A?(u.addRange(h),u.extend(W.node,W.offset)):(h.setEnd(W.node,W.offset),u.addRange(h)))}}for(h=[],u=_;u=u.parentNode;)u.nodeType===1&&h.push({element:u,left:u.scrollLeft,top:u.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_=document.documentMode,Oo=null,rc=null,Wd=null,Br=!1;function Ep(u,h,_){var A=_.window===_?_.document:_.nodeType===9?_:_.ownerDocument;Br||Oo==null||Oo!==Z(A)||(A=Oo,"selectionStart"in A&&Fr(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}),Wd&&tc(Wd,A)||(Wd=A,A=Ip(rc,"onSelect"),0Hr||(u.current=Rv[Hr],Rv[Hr]=null,Hr--)}function $n(u,h){Hr++,Rv[Hr]=u.current,u.current=h}var ga={},Qr=dr(ga),Ni=dr(!1),va=ga;function ac(u,h){var _=u.type.contextTypes;if(!_)return ga;var A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var I={},j;for(j in _)I[j]=h[j];return A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=h,u.__reactInternalMemoizedMaskedChildContext=I),I}function pi(u){return u=u.childContextTypes,u!=null}function Jd(){qn(Ni),qn(Qr)}function Nv(u,h,_){if(Qr.current!==ga)throw Error(n(168));$n(Qr,h),$n(Ni,_)}function ef(u,h,_){var A=u.stateNode;if(h=h.childContextTypes,typeof A.getChildContext!="function")return _;A=A.getChildContext();for(var I in A)if(!(I in h))throw Error(n(108,Ee(u)||"Unknown",I));return K({},_,A)}function lc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||ga,va=Qr.current,$n(Qr,u),$n(Ni,Ni.current),!0}function Iv(u,h,_){var A=u.stateNode;if(!A)throw Error(n(169));_?(u=ef(u,h,va),A.__reactInternalMemoizedMergedChildContext=u,qn(Ni),qn(Qr),$n(Qr,u)):qn(Ni),$n(Ni,_)}var co=null,tf=!1,Up=!1;function nf(u){co===null?co=[u]:co.push(u)}function Ox(u){tf=!0,nf(u)}function Do(){if(!Up&&co!==null){Up=!0;var u=0,h=In;try{var _=co;for(In=1;u<_.length;u++){var A=_[u];do A=A(!0);while(A!==null)}co=null,tf=!1}catch(I){throw co!==null&&(co=co.slice(u+1)),Ne(Vt,Do),I}finally{In=h,Up=!1}}return null}var cc=[],Zi=0,Fp=null,zp=0,Ii=[],Vr=0,uc=null,ht=1,Bs="";function ya(u,h){cc[Zi++]=zp,cc[Zi++]=Fp,Fp=u,zp=h}function kv(u,h,_){Ii[Vr++]=ht,Ii[Vr++]=Bs,Ii[Vr++]=uc,uc=u;var A=ht;u=Bs;var I=32-xt(A)-1;A&=~(1<>=W,I-=W,ht=1<<32-xt(h)+I|_<on?(yi=Kt,Kt=null):yi=Kt.sibling;var Fn=Ze(Ae,Kt,Pe[on],lt);if(Fn===null){Kt===null&&(Kt=yi);break}u&&Kt&&Fn.alternate===null&&h(Ae,Kt),ve=j(Fn,ve,on),qt===null?zt=Fn:qt.sibling=Fn,qt=Fn,Kt=yi}if(on===Pe.length)return _(Ae,Kt),Yn&&ya(Ae,on),zt;if(Kt===null){for(;onon?(yi=Kt,Kt=null):yi=Kt.sibling;var Vu=Ze(Ae,Kt,Fn.value,lt);if(Vu===null){Kt===null&&(Kt=yi);break}u&&Kt&&Vu.alternate===null&&h(Ae,Kt),ve=j(Vu,ve,on),qt===null?zt=Vu:qt.sibling=Vu,qt=Vu,Kt=yi}if(Fn.done)return _(Ae,Kt),Yn&&ya(Ae,on),zt;if(Kt===null){for(;!Fn.done;on++,Fn=Pe.next())Fn=nt(Ae,Fn.value,lt),Fn!==null&&(ve=j(Fn,ve,on),qt===null?zt=Fn:qt.sibling=Fn,qt=Fn);return Yn&&ya(Ae,on),zt}for(Kt=A(Ae,Kt);!Fn.done;on++,Fn=Pe.next())Fn=At(Kt,Ae,on,Fn.value,lt),Fn!==null&&(u&&Fn.alternate!==null&&Kt.delete(Fn.key===null?on:Fn.key),ve=j(Fn,ve,on),qt===null?zt=Fn:qt.sibling=Fn,qt=Fn);return u&&Kt.forEach(function(SW){return h(Ae,SW)}),Yn&&ya(Ae,on),zt}function Dr(Ae,ve,Pe,lt){if(typeof Pe=="object"&&Pe!==null&&Pe.type===L&&Pe.key===null&&(Pe=Pe.props.children),typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case O:e:{for(var zt=Pe.key,qt=ve;qt!==null;){if(qt.key===zt){if(zt=Pe.type,zt===L){if(qt.tag===7){_(Ae,qt.sibling),ve=I(qt,Pe.props.children),ve.return=Ae,Ae=ve;break e}}else if(qt.elementType===zt||typeof zt=="object"&&zt!==null&&zt.$$typeof===ie&&Uv(zt)===qt.type){_(Ae,qt.sibling),ve=I(qt,Pe.props),ve.ref=rf(Ae,qt,Pe),ve.return=Ae,Ae=ve;break e}_(Ae,qt);break}else h(Ae,qt);qt=qt.sibling}Pe.type===L?(ve=wf(Pe.props.children,Ae.mode,lt,Pe.key),ve.return=Ae,Ae=ve):(lt=rb(Pe.type,Pe.key,Pe.props,null,Ae.mode,lt),lt.ref=rf(Ae,ve,Pe),lt.return=Ae,Ae=lt)}return W(Ae);case N:e:{for(qt=Pe.key;ve!==null;){if(ve.key===qt)if(ve.tag===4&&ve.stateNode.containerInfo===Pe.containerInfo&&ve.stateNode.implementation===Pe.implementation){_(Ae,ve.sibling),ve=I(ve,Pe.children||[]),ve.return=Ae,Ae=ve;break e}else{_(Ae,ve);break}else h(Ae,ve);ve=ve.sibling}ve=KM(Pe,Ae.mode,lt),ve.return=Ae,Ae=ve}return W(Ae);case ie:return qt=Pe._init,Dr(Ae,ve,qt(Pe._payload),lt)}if(J(Pe))return It(Ae,ve,Pe,lt);if(Q(Pe))return Dt(Ae,ve,Pe,lt);sf(Ae,Pe)}return typeof Pe=="string"&&Pe!==""||typeof Pe=="number"?(Pe=""+Pe,ve!==null&&ve.tag===6?(_(Ae,ve.sibling),ve=I(ve,Pe),ve.return=Ae,Ae=ve):(_(Ae,ve),ve=qM(Pe,Ae.mode,lt),ve.return=Ae,Ae=ve),W(Ae)):_(Ae,ve)}return Dr}var dc=Fv(!0),of=Fv(!1),fc=dr(null),hc=null,ba=null,Iu=null;function pc(){Iu=ba=hc=null}function af(u){var h=fc.current;qn(fc),u._currentValue=h}function lf(u,h,_){for(;u!==null;){var A=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,A!==null&&(A.childLanes|=h)):A!==null&&(A.childLanes&h)!==h&&(A.childLanes|=h),u===_)break;u=u.return}}function al(u,h){hc=u,Iu=ba=null,u=u.dependencies,u!==null&&u.firstContext!==null&&((u.lanes&h)!==0&&(dn=!0),u.firstContext=null)}function gs(u){var h=u._currentValue;if(Iu!==u)if(u={context:u,memoizedValue:h,next:null},ba===null){if(hc===null)throw Error(n(308));ba=u,hc.dependencies={lanes:0,firstContext:u}}else ba=ba.next=u;return h}var _a=null;function zv(u){_a===null?_a=[u]:_a.push(u)}function cf(u,h,_,A){var I=h.interleaved;return I===null?(_.next=_,zv(h)):(_.next=I.next,I.next=_),h.interleaved=_,uo(u,A)}function uo(u,h){u.lanes|=h;var _=u.alternate;for(_!==null&&(_.lanes|=h),_=u,u=u.return;u!==null;)u.childLanes|=h,_=u.alternate,_!==null&&(_.childLanes|=h),_=u,u=u.return;return _.tag===3?_.stateNode:null}var Hn=!1;function un(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yr(u,h){u=u.updateQueue,h.updateQueue===u&&(h.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,effects:u.effects})}function Vn(u,h){return{eventTime:u,lane:h,tag:0,payload:null,callback:null,next:null}}function nr(u,h,_){var A=u.updateQueue;if(A===null)return null;if(A=A.shared,(jn&2)!==0){var I=A.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),A.pending=h,uo(u,_)}return I=A.interleaved,I===null?(h.next=h,zv(A)):(h.next=I.next,I.next=h),A.interleaved=h,uo(u,_)}function mi(u,h,_){if(h=h.updateQueue,h!==null&&(h=h.shared,(_&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,_|=A,h.lanes=_,fu(u,_)}}function mc(u,h){var _=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,_===A)){var I=null,j=null;if(_=_.firstBaseUpdate,_!==null){do{var W={eventTime:_.eventTime,lane:_.lane,tag:_.tag,payload:_.payload,callback:_.callback,next:null};j===null?I=j=W:j=j.next=W,_=_.next}while(_!==null);j===null?I=j=h:j=j.next=h}else I=j=h;_={baseState:A.baseState,firstBaseUpdate:I,lastBaseUpdate:j,shared:A.shared,effects:A.effects},u.updateQueue=_;return}u=_.lastBaseUpdate,u===null?_.firstBaseUpdate=h:u.next=h,_.lastBaseUpdate=h}function fr(u,h,_,A){var I=u.updateQueue;Hn=!1;var j=I.firstBaseUpdate,W=I.lastBaseUpdate,oe=I.shared.pending;if(oe!==null){I.shared.pending=null;var me=oe,ke=me.next;me.next=null,W===null?j=ke:W.next=ke,W=me;var Je=u.alternate;Je!==null&&(Je=Je.updateQueue,oe=Je.lastBaseUpdate,oe!==W&&(oe===null?Je.firstBaseUpdate=ke:oe.next=ke,Je.lastBaseUpdate=me))}if(j!==null){var nt=I.baseState;W=0,Je=ke=me=null,oe=j;do{var Ze=oe.lane,At=oe.eventTime;if((A&Ze)===Ze){Je!==null&&(Je=Je.next={eventTime:At,lane:0,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null});e:{var It=u,Dt=oe;switch(Ze=h,At=_,Dt.tag){case 1:if(It=Dt.payload,typeof It=="function"){nt=It.call(At,nt,Ze);break e}nt=It;break e;case 3:It.flags=It.flags&-65537|128;case 0:if(It=Dt.payload,Ze=typeof It=="function"?It.call(At,nt,Ze):It,Ze==null)break e;nt=K({},nt,Ze);break e;case 2:Hn=!0}}oe.callback!==null&&oe.lane!==0&&(u.flags|=64,Ze=I.effects,Ze===null?I.effects=[oe]:Ze.push(oe))}else At={eventTime:At,lane:Ze,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null},Je===null?(ke=Je=At,me=nt):Je=Je.next=At,W|=Ze;if(oe=oe.next,oe===null){if(oe=I.shared.pending,oe===null)break;Ze=oe,oe=Ze.next,Ze.next=null,I.lastBaseUpdate=Ze,I.shared.pending=null}}while(!0);if(Je===null&&(me=nt),I.baseState=me,I.firstBaseUpdate=ke,I.lastBaseUpdate=Je,h=I.shared.interleaved,h!==null){I=h;do W|=I.lane,I=I.next;while(I!==h)}else j===null&&(I.shared.lanes=0);yf|=W,u.lanes=W,u.memoizedState=nt}}function ku(u,h,_){if(u=h.effects,h.effects=null,u!==null)for(h=0;h_?_:4,u(!0);var A=xc.transition;xc.transition={};try{u(!1),h()}finally{In=_,xc.transition=A}}function Ea(){return ys().memoizedState}function Xp(u,h,_){var A=zu(u);if(_={lane:A,action:_,hasEagerState:!1,eagerState:null,next:null},gf(u))qp(h,_);else if(_=cf(u,h,_,A),_!==null){var I=_s();Pa(_,u,A,I),Kp(_,h,A)}}function bc(u,h,_){var A=zu(u),I={lane:A,action:_,hasEagerState:!1,eagerState:null,next:null};if(gf(u))qp(h,I);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=h.lastRenderedReducer,j!==null))try{var W=h.lastRenderedState,oe=j(W,_);if(I.hasEagerState=!0,I.eagerState=oe,hs(oe,W)){var me=h.interleaved;me===null?(I.next=I,zv(h)):(I.next=me.next,me.next=I),h.interleaved=I;return}}catch{}finally{}_=cf(u,h,I,A),_!==null&&(I=_s(),Pa(_,u,A,I),Kp(_,h,A))}}function gf(u){var h=u.alternate;return u===Kn||h!==null&&h===Kn}function qp(u,h){gi=ho=!0;var _=u.pending;_===null?h.next=h:(h.next=_.next,_.next=h),u.pending=h}function Kp(u,h,_){if((_&4194240)!==0){var A=h.lanes;A&=u.pendingLanes,_|=A,h.lanes=_,fu(u,_)}}var Yp={readContext:gs,useCallback:ei,useContext:ei,useEffect:ei,useImperativeHandle:ei,useInsertionEffect:ei,useLayoutEffect:ei,useMemo:ei,useReducer:ei,useRef:ei,useState:ei,useDebugValue:ei,useDeferredValue:ei,useTransition:ei,useMutableSource:ei,useSyncExternalStore:ei,useId:ei,unstable_isNewReconciler:!1},Bx={readContext:gs,useCallback:function(u,h){return ti().memoizedState=[u,h===void 0?null:h],u},useContext:gs,useEffect:Oi,useImperativeHandle:function(u,h,_){return _=_!=null?_.concat([u]):null,Fo(4194308,4,Fx.bind(null,h,u),_)},useLayoutEffect:function(u,h){return Fo(4194308,4,u,h)},useInsertionEffect:function(u,h){return Fo(4,2,u,h)},useMemo:function(u,h){var _=ti();return h=h===void 0?null:h,u=u(),_.memoizedState=[u,h],u},useReducer:function(u,h,_){var A=ti();return h=_!==void 0?_(h):h,A.memoizedState=A.baseState=h,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:h},A.queue=u,u=u.dispatch=Xp.bind(null,Kn,u),[A.memoizedState,u]},useRef:function(u){var h=ti();return u={current:u},h.memoizedState=u},useState:Wv,useDebugValue:Wp,useDeferredValue:function(u){return ti().memoizedState=u},useTransition:function(){var u=Wv(!1),h=u[0];return u=RM.bind(null,u[1]),ti().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,_){var A=Kn,I=ti();if(Yn){if(_===void 0)throw Error(n(407));_=_()}else{if(_=h(),vi===null)throw Error(n(349));(Sa&30)!==0||Gp(A,h,_)}I.memoizedState=_;var j={value:_,getSnapshot:h};return I.queue=j,Oi(Lx.bind(null,A,j,u),[u]),A.flags|=2048,po(9,pf.bind(null,A,j,_,h),void 0,null),_},useId:function(){var u=ti(),h=vi.identifierPrefix;if(Yn){var _=Bs,A=ht;_=(A&~(1<<32-xt(A)-1)).toString(32)+_,h=":"+h+"R"+_,_=cl++,0<_&&(h+="H"+_.toString(32)),h+=":"}else _=Qi++,h=":"+h+"r"+_.toString(32)+":";return u.memoizedState=h},unstable_isNewReconciler:!1},Hx={readContext:gs,useCallback:zx,useContext:gs,useEffect:$v,useImperativeHandle:qv,useInsertionEffect:Xv,useLayoutEffect:Ux,useMemo:xs,useReducer:hf,useRef:jx,useState:function(){return hf(Du)},useDebugValue:Wp,useDeferredValue:function(u){var h=ys();return $p(h,hr.memoizedState,u)},useTransition:function(){var u=hf(Du)[0],h=ys().memoizedState;return[u,h]},useMutableSource:Hv,useSyncExternalStore:Vv,useId:Ea,unstable_isNewReconciler:!1},Vx={readContext:gs,useCallback:zx,useContext:gs,useEffect:$v,useImperativeHandle:qv,useInsertionEffect:Xv,useLayoutEffect:Ux,useMemo:xs,useReducer:Ma,useRef:jx,useState:function(){return Ma(Du)},useDebugValue:Wp,useDeferredValue:function(u){var h=ys();return hr===null?h.memoizedState=u:$p(h,hr.memoizedState,u)},useTransition:function(){var u=Ma(Du)[0],h=ys().memoizedState;return[u,h]},useMutableSource:Hv,useSyncExternalStore:Vv,useId:Ea,unstable_isNewReconciler:!1};function Vs(u,h){if(u&&u.defaultProps){h=K({},h),u=u.defaultProps;for(var _ in u)h[_]===void 0&&(h[_]=u[_]);return h}return h}function vf(u,h,_,A){h=u.memoizedState,_=_(A,h),_=_==null?h:K({},h,_),u.memoizedState=_,u.lanes===0&&(u.updateQueue.baseState=_)}var Zp={isMounted:function(u){return(u=u._reactInternals)?No(u)===u:!1},enqueueSetState:function(u,h,_){u=u._reactInternals;var A=_s(),I=zu(u),j=Vn(A,I);j.payload=h,_!=null&&(j.callback=_),h=nr(u,j,I),h!==null&&(Pa(h,u,I,A),mi(h,u,I))},enqueueReplaceState:function(u,h,_){u=u._reactInternals;var A=_s(),I=zu(u),j=Vn(A,I);j.tag=1,j.payload=h,_!=null&&(j.callback=_),h=nr(u,j,I),h!==null&&(Pa(h,u,I,A),mi(h,u,I))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var _=_s(),A=zu(u),I=Vn(_,A);I.tag=2,h!=null&&(I.callback=h),h=nr(u,I,A),h!==null&&(Pa(h,u,A,_),mi(h,u,A))}};function Gx(u,h,_,A,I,j,W){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(A,j,W):h.prototype&&h.prototype.isPureReactComponent?!tc(_,A)||!tc(I,j):!0}function m(u,h,_){var A=!1,I=ga,j=h.contextType;return typeof j=="object"&&j!==null?j=gs(j):(I=pi(h)?va:Qr.current,A=h.contextTypes,j=(A=A!=null)?ac(u,I):ga),h=new h(_,j),u.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Zp,u.stateNode=h,h._reactInternals=u,A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=I,u.__reactInternalMemoizedMaskedChildContext=j),h}function v(u,h,_,A){u=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(_,A),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(_,A),h.state!==u&&Zp.enqueueReplaceState(h,h.state,null)}function E(u,h,_,A){var I=u.stateNode;I.props=_,I.state=u.memoizedState,I.refs={},un(u);var j=h.contextType;typeof j=="object"&&j!==null?I.context=gs(j):(j=pi(h)?va:Qr.current,I.context=ac(u,j)),I.state=u.memoizedState,j=h.getDerivedStateFromProps,typeof j=="function"&&(vf(u,h,j,_),I.state=u.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof I.getSnapshotBeforeUpdate=="function"||typeof I.UNSAFE_componentWillMount!="function"&&typeof I.componentWillMount!="function"||(h=I.state,typeof I.componentWillMount=="function"&&I.componentWillMount(),typeof I.UNSAFE_componentWillMount=="function"&&I.UNSAFE_componentWillMount(),h!==I.state&&Zp.enqueueReplaceState(I,I.state,null),fr(u,_,I,A),I.state=u.memoizedState),typeof I.componentDidMount=="function"&&(u.flags|=4194308)}function R(u,h){try{var _="",A=h;do _+=ce(A),A=A.return;while(A);var I=_}catch(j){I=` Error generating stack: `+j.message+` -`+j.stack}return{value:u,source:h,stack:I,digest:null}}function D(u,h,b){return{value:u,source:null,stack:b??null,digest:h??null}}function z(u,h){try{console.error(h.value)}catch(b){setTimeout(function(){throw b})}}var ie=typeof WeakMap=="function"?WeakMap:Map;function ye(u,h,b){b=Vn(-1,b),b.tag=3,b.payload={element:null};var A=h.value;return b.callback=function(){Zx||(Zx=!0,UM=A),z(u,h)},b}function De(u,h,b){b=Vn(-1,b),b.tag=3;var A=u.type.getDerivedStateFromError;if(typeof A=="function"){var I=h.value;b.payload=function(){return A(I)},b.callback=function(){z(u,h)}}var j=u.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(b.callback=function(){z(u,h),typeof A!="function"&&(Uu===null?Uu=new Set([this]):Uu.add(this));var W=h.stack;this.componentDidCatch(h.value,{componentStack:W!==null?W:""})}),b}function at(u,h,b){var A=u.pingCache;if(A===null){A=u.pingCache=new ie;var I=new Set;A.set(h,I)}else I=A.get(h),I===void 0&&(I=new Set,A.set(h,I));I.has(b)||(I.add(b),u=lW.bind(null,u,h,b),h.then(u,u))}function Ct(u){do{var h;if((h=u.tag===13)&&(h=u.memoizedState,h=h!==null?h.dehydrated!==null:!0),h)return u;u=u.return}while(u!==null);return null}function on(u,h,b,A,I){return(u.mode&1)===0?(u===h?u.flags|=65536:(u.flags|=128,b.flags|=131072,b.flags&=-52805,b.tag===1&&(b.alternate===null?b.tag=17:(h=Vn(-1,1),h.tag=2,er(b,h,1))),b.lanes|=1),u):(u.flags|=65536,u.lanes=I,u)}var Wt=C.ReactCurrentOwner,fn=!1;function Mt(u,h,b,A){h.child=u===null?sf(h,null,b,A):dc(h,u.child,b,A)}function ti(u,h,b,A,I){b=b.render;var j=h.ref;return al(h,I),A=df(u,h,b,A,j,I),b=Bv(),u!==null&&!fn?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,_c(u,h,I)):(Yn&&b&&Ov(h),h.flags|=1,Mt(u,h,A,I),h.child)}function bs(u,h,b,A,I){if(u===null){var j=b.type;return typeof j=="function"&&!WM(j)&&j.defaultProps===void 0&&b.compare===null&&b.defaultProps===void 0?(h.tag=15,h.type=j,Re(u,h,j,A,I)):(u=rb(b.type,null,A,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(j=u.child,(u.lanes&I)===0){var W=j.memoizedProps;if(b=b.compare,b=b!==null?b:tc,b(W,A)&&u.ref===h.ref)return _c(u,h,I)}return h.flags|=1,u=Hu(j,A),u.ref=h.ref,u.return=h,h.child=u}function Re(u,h,b,A,I){if(u!==null){var j=u.memoizedProps;if(tc(j,A)&&u.ref===h.ref)if(fn=!1,h.pendingProps=A=j,(u.lanes&I)!==0)(u.flags&131072)!==0&&(fn=!0);else return h.lanes=u.lanes,_c(u,h,I)}return yt(u,h,b,A,I)}function be(u,h,b){var A=h.pendingProps,I=A.children,j=u!==null?u.memoizedState:null;if(A.mode==="hidden")if((h.mode&1)===0)h.memoizedState={baseLanes:0,cachePool:null,transitions:null},$n(Jp,ho),ho|=b;else{if((b&1073741824)===0)return u=j!==null?j.baseLanes|b:b,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:u,cachePool:null,transitions:null},h.updateQueue=null,$n(Jp,ho),ho|=u,null;h.memoizedState={baseLanes:0,cachePool:null,transitions:null},A=j!==null?j.baseLanes:b,$n(Jp,ho),ho|=A}else j!==null?(A=j.baseLanes|b,h.memoizedState=null):A=b,$n(Jp,ho),ho|=A;return Mt(u,h,I,b),h.child}function Le(u,h){var b=h.ref;(u===null&&b!==null||u!==null&&u.ref!==b)&&(h.flags|=512,h.flags|=2097152)}function yt(u,h,b,A,I){var j=fi(b)?va:Zr.current;return j=ac(h,j),al(h,I),b=df(u,h,b,A,j,I),A=Bv(),u!==null&&!fn?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,_c(u,h,I)):(Yn&&A&&Ov(h),h.flags|=1,Mt(u,h,b,I),h.child)}function jt(u,h,b,A,I){if(fi(b)){var j=!0;lc(h)}else j=!1;if(al(h,I),h.stateNode===null)$x(u,h),p(h,b,A),M(h,b,A,I),A=!0;else if(u===null){var W=h.stateNode,oe=h.memoizedProps;W.props=oe;var me=W.context,ke=b.contextType;typeof ke=="object"&&ke!==null?ke=gs(ke):(ke=fi(b)?va:Zr.current,ke=ac(h,ke));var et=b.getDerivedStateFromProps,nt=typeof et=="function"||typeof W.getSnapshotBeforeUpdate=="function";nt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(oe!==A||me!==ke)&&v(h,W,A,ke),Hn=!1;var Ze=h.memoizedState;W.state=Ze,ur(h,A,W,I),me=h.memoizedState,oe!==A||Ze!==me||Ri.current||Hn?(typeof et=="function"&&(gf(h,b,et,A),me=h.memoizedState),(oe=Hn||Gx(h,b,oe,A,Ze,me,ke))?(nt||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(h.flags|=4194308)):(typeof W.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=A,h.memoizedState=me),W.props=A,W.state=me,W.context=ke,A=oe):(typeof W.componentDidMount=="function"&&(h.flags|=4194308),A=!1)}else{W=h.stateNode,gr(u,h),oe=h.memoizedProps,ke=h.type===h.elementType?oe:Hs(h.type,oe),W.props=ke,nt=h.pendingProps,Ze=W.context,me=b.contextType,typeof me=="object"&&me!==null?me=gs(me):(me=fi(b)?va:Zr.current,me=ac(h,me));var Et=b.getDerivedStateFromProps;(et=typeof Et=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(oe!==nt||Ze!==me)&&v(h,W,A,me),Hn=!1,Ze=h.memoizedState,W.state=Ze,ur(h,A,W,I);var It=h.memoizedState;oe!==nt||Ze!==It||Ri.current||Hn?(typeof Et=="function"&&(gf(h,b,Et,A),It=h.memoizedState),(ke=Hn||Gx(h,b,ke,A,Ze,It,me)||!1)?(et||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(A,It,me),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(A,It,me)),typeof W.componentDidUpdate=="function"&&(h.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof W.componentDidUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=1024),h.memoizedProps=A,h.memoizedState=It),W.props=A,W.state=It,W.context=me,A=ke):(typeof W.componentDidUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=1024),A=!1)}return ln(u,h,b,A,j,I)}function ln(u,h,b,A,I,j){Le(u,h);var W=(h.flags&128)!==0;if(!A&&!W)return I&&Iv(h,b,!1),_c(u,h,j);A=h.stateNode,Wt.current=h;var oe=W&&typeof b.getDerivedStateFromError!="function"?null:A.render();return h.flags|=1,u!==null&&W?(h.child=dc(h,u.child,null,j),h.child=dc(h,null,oe,j)):Mt(u,h,oe,j),h.memoizedState=A.state,I&&Iv(h,b,!0),h.child}function an(u){var h=u.stateNode;h.pendingContext?Nv(u,h.pendingContext,h.pendingContext!==h.context):h.context&&Nv(u,h.context,!1),cf(u,h.containerInfo)}function Cn(u,h,b,A,I){return ol(),Nu(I),h.flags|=256,Mt(u,h,b,A),h.child}var wr={dehydrated:null,treeContext:null,retryLane:0};function Sn(u){return{baseLanes:u,cachePool:null,transitions:null}}function Aa(u,h,b){var A=h.pendingProps,I=Zn.current,j=!1,W=(h.flags&128)!==0,oe;if((oe=W)||(oe=u!==null&&u.memoizedState===null?!1:(I&2)!==0),oe?(j=!0,h.flags&=-129):(u===null||u.memoizedState!==null)&&(I|=1),$n(Zn,I&1),u===null)return Hp(h),u=h.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?((h.mode&1)===0?h.lanes=1:u.data==="$!"?h.lanes=8:h.lanes=1073741824,null):(W=A.children,u=A.fallback,j?(A=h.mode,j=h.child,W={mode:"hidden",children:W},(A&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=W):j=ib(W,A,0,null),u=_f(u,A,b,null),j.return=h,u.return=h,j.sibling=u,h.child=j,h.child.memoizedState=Sn(b),h.memoizedState=wr,u):Kv(h,W));if(I=u.memoizedState,I!==null&&(oe=I.dehydrated,oe!==null))return YG(u,h,W,A,oe,I,b);if(j){j=A.fallback,W=h.mode,I=u.child,oe=I.sibling;var me={mode:"hidden",children:A.children};return(W&1)===0&&h.child!==I?(A=h.child,A.childLanes=0,A.pendingProps=me,h.deletions=null):(A=Hu(I,me),A.subtreeFlags=I.subtreeFlags&14680064),oe!==null?j=Hu(oe,j):(j=_f(j,W,b,null),j.flags|=2),j.return=h,A.return=h,A.sibling=j,h.child=A,A=j,j=h.child,W=u.child.memoizedState,W=W===null?Sn(b):{baseLanes:W.baseLanes|b,cachePool:null,transitions:W.transitions},j.memoizedState=W,j.childLanes=u.childLanes&~b,h.memoizedState=wr,A}return j=u.child,u=j.sibling,A=Hu(j,{mode:"visible",children:A.children}),(h.mode&1)===0&&(A.lanes=b),A.return=h,A.sibling=null,u!==null&&(b=h.deletions,b===null?(h.deletions=[u],h.flags|=16):b.push(u)),h.child=A,h.memoizedState=null,A}function Kv(u,h){return h=ib({mode:"visible",children:h},u.mode,0,null),h.return=u,u.child=h}function Wx(u,h,b,A){return A!==null&&Nu(A),dc(h,u.child,null,b),u=Kv(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function YG(u,h,b,A,I,j,W){if(b)return h.flags&256?(h.flags&=-257,A=D(Error(n(422))),Wx(u,h,W,A)):h.memoizedState!==null?(h.child=u.child,h.flags|=128,null):(j=A.fallback,I=h.mode,A=ib({mode:"visible",children:A.children},I,0,null),j=_f(j,I,W,null),j.flags|=2,A.return=h,j.return=h,A.sibling=j,h.child=A,(h.mode&1)!==0&&dc(h,u.child,null,W),h.child.memoizedState=Sn(W),h.memoizedState=wr,j);if((h.mode&1)===0)return Wx(u,h,W,null);if(I.data==="$!"){if(A=I.nextSibling&&I.nextSibling.dataset,A)var oe=A.dgst;return A=oe,j=Error(n(419)),A=D(j,A,void 0),Wx(u,h,W,A)}if(oe=(W&u.childLanes)!==0,fn||oe){if(A=mi,A!==null){switch(W&-W){case 4:I=2;break;case 16:I=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:I=32;break;case 536870912:I=268435456;break;default:I=0}I=(I&(A.suspendedLanes|W))!==0?0:I,I!==0&&I!==j.retryLane&&(j.retryLane=I,lo(u,I),Pa(A,u,I,-1))}return GM(),A=D(Error(n(421))),Wx(u,h,W,A)}return I.data==="$?"?(h.flags|=128,h.child=u.child,h=cW.bind(null,u),I._reactRetry=h,null):(u=j.treeContext,Ii=pa(I.nextSibling),Qr=h,Yn=!0,Bs=null,u!==null&&(Ni[Hr++]=ft,Ni[Hr++]=zs,Ni[Hr++]=uc,ft=u.id,zs=u.overflow,uc=h),h=Kv(h,A.children),h.flags|=4096,h)}function uN(u,h,b){u.lanes|=h;var A=u.alternate;A!==null&&(A.lanes|=h),af(u.return,h,b)}function PM(u,h,b,A,I){var j=u.memoizedState;j===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:A,tail:b,tailMode:I}:(j.isBackwards=h,j.rendering=null,j.renderingStartTime=0,j.last=A,j.tail=b,j.tailMode=I)}function dN(u,h,b){var A=h.pendingProps,I=A.revealOrder,j=A.tail;if(Mt(u,h,A.children,b),A=Zn.current,(A&2)!==0)A=A&1|2,h.flags|=128;else{if(u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&uN(u,b,h);else if(u.tag===19)uN(u,b,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break e;for(;u.sibling===null;){if(u.return===null||u.return===h)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}A&=1}if($n(Zn,A),(h.mode&1)===0)h.memoizedState=null;else switch(I){case"forwards":for(b=h.child,I=null;b!==null;)u=b.alternate,u!==null&&co(u)===null&&(I=b),b=b.sibling;b=I,b===null?(I=h.child,h.child=null):(I=b.sibling,b.sibling=null),PM(h,!1,I,b,j);break;case"backwards":for(b=null,I=h.child,h.child=null;I!==null;){if(u=I.alternate,u!==null&&co(u)===null){h.child=I;break}u=I.sibling,I.sibling=b,b=I,I=u}PM(h,!0,b,null,j);break;case"together":PM(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function $x(u,h){(h.mode&1)===0&&u!==null&&(u.alternate=null,h.alternate=null,h.flags|=2)}function _c(u,h,b){if(u!==null&&(h.dependencies=u.dependencies),vf|=h.lanes,(b&h.childLanes)===0)return null;if(u!==null&&h.child!==u.child)throw Error(n(153));if(h.child!==null){for(u=h.child,b=Hu(u,u.pendingProps),h.child=b,b.return=h;u.sibling!==null;)u=u.sibling,b=b.sibling=Hu(u,u.pendingProps),b.return=h;b.sibling=null}return h.child}function ZG(u,h,b){switch(h.tag){case 3:an(h),ol();break;case 5:vc(h);break;case 1:fi(h.type)&&lc(h);break;case 4:cf(h,h.stateNode.containerInfo);break;case 10:var A=h.type._context,I=h.memoizedProps.value;$n(fc,A._currentValue),A._currentValue=I;break;case 13:if(A=h.memoizedState,A!==null)return A.dehydrated!==null?($n(Zn,Zn.current&1),h.flags|=128,null):(b&h.child.childLanes)!==0?Aa(u,h,b):($n(Zn,Zn.current&1),u=_c(u,h,b),u!==null?u.sibling:null);$n(Zn,Zn.current&1);break;case 19:if(A=(b&h.childLanes)!==0,(u.flags&128)!==0){if(A)return dN(u,h,b);h.flags|=128}if(I=h.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),$n(Zn,Zn.current),A)break;return null;case 22:case 23:return h.lanes=0,be(u,h,b)}return _c(u,h,b)}var fN,RM,hN,pN;fN=function(u,h){for(var b=h.child;b!==null;){if(b.tag===5||b.tag===6)u.appendChild(b.stateNode);else if(b.tag!==4&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===h)break;for(;b.sibling===null;){if(b.return===null||b.return===h)return;b=b.return}b.sibling.return=b.return,b=b.sibling}},RM=function(){},hN=function(u,h,b,A){var I=u.memoizedProps;if(I!==A){u=h.stateNode,_r(vs.current);var j=null;switch(b){case"input":I=Ge(u,I),A=Ge(u,A),j=[];break;case"select":I=K({},I,{value:void 0}),A=K({},A,{value:void 0}),j=[];break;case"textarea":I=Me(u,I),A=Me(u,A),j=[];break;default:typeof I.onClick!="function"&&typeof A.onClick=="function"&&(u.onclick=Zd)}de(b,A);var W;b=null;for(ke in I)if(!A.hasOwnProperty(ke)&&I.hasOwnProperty(ke)&&I[ke]!=null)if(ke==="style"){var oe=I[ke];for(W in oe)oe.hasOwnProperty(W)&&(b||(b={}),b[W]="")}else ke!=="dangerouslySetInnerHTML"&&ke!=="children"&&ke!=="suppressContentEditableWarning"&&ke!=="suppressHydrationWarning"&&ke!=="autoFocus"&&(i.hasOwnProperty(ke)?j||(j=[]):(j=j||[]).push(ke,null));for(ke in A){var me=A[ke];if(oe=I!=null?I[ke]:void 0,A.hasOwnProperty(ke)&&me!==oe&&(me!=null||oe!=null))if(ke==="style")if(oe){for(W in oe)!oe.hasOwnProperty(W)||me&&me.hasOwnProperty(W)||(b||(b={}),b[W]="");for(W in me)me.hasOwnProperty(W)&&oe[W]!==me[W]&&(b||(b={}),b[W]=me[W])}else b||(j||(j=[]),j.push(ke,b)),b=me;else ke==="dangerouslySetInnerHTML"?(me=me?me.__html:void 0,oe=oe?oe.__html:void 0,me!=null&&oe!==me&&(j=j||[]).push(ke,me)):ke==="children"?typeof me!="string"&&typeof me!="number"||(j=j||[]).push(ke,""+me):ke!=="suppressContentEditableWarning"&&ke!=="suppressHydrationWarning"&&(i.hasOwnProperty(ke)?(me!=null&&ke==="onScroll"&&Xn("scroll",u),j||oe===me||(j=[])):(j=j||[]).push(ke,me))}b&&(j=j||[]).push("style",b);var ke=j;(h.updateQueue=ke)&&(h.flags|=4)}},pN=function(u,h,b,A){b!==A&&(h.flags|=4)};function Yv(u,h){if(!Yn)switch(u.tailMode){case"hidden":h=u.tail;for(var b=null;h!==null;)h.alternate!==null&&(b=h),h=h.sibling;b===null?u.tail=null:b.sibling=null;break;case"collapsed":b=u.tail;for(var A=null;b!==null;)b.alternate!==null&&(A=b),b=b.sibling;A===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:A.sibling=null}}function Ji(u){var h=u.alternate!==null&&u.alternate.child===u.child,b=0,A=0;if(h)for(var I=u.child;I!==null;)b|=I.lanes|I.childLanes,A|=I.subtreeFlags&14680064,A|=I.flags&14680064,I.return=u,I=I.sibling;else for(I=u.child;I!==null;)b|=I.lanes|I.childLanes,A|=I.subtreeFlags,A|=I.flags,I.return=u,I=I.sibling;return u.subtreeFlags|=A,u.childLanes=b,h}function QG(u,h,b){var A=h.pendingProps;switch(xa(h),h.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ji(h),null;case 1:return fi(h.type)&&Qd(),Ji(h),null;case 3:return A=h.stateNode,ll(),qn(Ri),qn(Zr),Do(),A.pendingContext&&(A.context=A.pendingContext,A.pendingContext=null),(u===null||u.child===null)&&(Ru(h)?h.flags|=4:u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,Bs!==null&&(BM(Bs),Bs=null))),RM(u,h),Ji(h),null;case 5:Ou(h);var I=_r(wa.current);if(b=h.type,u!==null&&h.stateNode!=null)hN(u,h,b,A,I),u.ref!==h.ref&&(h.flags|=512,h.flags|=2097152);else{if(!A){if(h.stateNode===null)throw Error(n(166));return Ji(h),null}if(u=_r(vs.current),Ru(h)){A=h.stateNode,b=h.type;var j=h.memoizedProps;switch(A[kr]=h,A[Pu]=j,u=(h.mode&1)!==0,b){case"dialog":Xn("cancel",A),Xn("close",A);break;case"iframe":case"object":case"embed":Xn("load",A);break;case"video":case"audio":for(I=0;I<\/script>",u=u.removeChild(u.firstChild)):typeof A.is=="string"?u=W.createElement(b,{is:A.is}):(u=W.createElement(b),b==="select"&&(W=u,A.multiple?W.multiple=!0:A.size&&(W.size=A.size))):u=W.createElementNS(u,b),u[kr]=h,u[Pu]=A,fN(u,h,!1,!1),h.stateNode=u;e:{switch(W=qe(b,A),b){case"dialog":Xn("cancel",u),Xn("close",u),I=A;break;case"iframe":case"object":case"embed":Xn("load",u),I=A;break;case"video":case"audio":for(I=0;Iem&&(h.flags|=128,A=!0,Yv(j,!1),h.lanes=4194304)}else{if(!A)if(u=co(W),u!==null){if(h.flags|=128,A=!0,b=u.updateQueue,b!==null&&(h.updateQueue=b,h.flags|=4),Yv(j,!0),j.tail===null&&j.tailMode==="hidden"&&!W.alternate&&!Yn)return Ji(h),null}else 2*ct()-j.renderingStartTime>em&&b!==1073741824&&(h.flags|=128,A=!0,Yv(j,!1),h.lanes=4194304);j.isBackwards?(W.sibling=h.child,h.child=W):(b=j.last,b!==null?b.sibling=W:h.child=W,j.last=W)}return j.tail!==null?(h=j.tail,j.rendering=h,j.tail=h.sibling,j.renderingStartTime=ct(),h.sibling=null,b=Zn.current,$n(Zn,A?b&1|2:b&1),h):(Ji(h),null);case 22:case 23:return VM(),A=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==A&&(h.flags|=8192),A&&(h.mode&1)!==0?(ho&1073741824)!==0&&(Ji(h),h.subtreeFlags&6&&(h.flags|=8192)):Ji(h),null;case 24:return null;case 25:return null}throw Error(n(156,h.tag))}function JG(u,h){switch(xa(h),h.tag){case 1:return fi(h.type)&&Qd(),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return ll(),qn(Ri),qn(Zr),Do(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 5:return Ou(h),null;case 13:if(qn(Zn),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(n(340));ol()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return qn(Zn),null;case 4:return ll(),null;case 10:return of(h.type._context),null;case 22:case 23:return VM(),null;case 24:return null;default:return null}}var Xx=!1,es=!1,eW=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function Qp(u,h){var b=u.ref;if(b!==null)if(typeof b=="function")try{b(null)}catch(A){Sr(u,h,A)}else b.current=null}function NM(u,h,b){try{b()}catch(A){Sr(u,h,A)}}var mN=!1;function tW(u,h){if(Cu=Os,u=ir(),Ur(u)){if("selectionStart"in u)var b={start:u.selectionStart,end:u.selectionEnd};else e:{b=(b=u.ownerDocument)&&b.defaultView||window;var A=b.getSelection&&b.getSelection();if(A&&A.rangeCount!==0){b=A.anchorNode;var I=A.anchorOffset,j=A.focusNode;A=A.focusOffset;try{b.nodeType,j.nodeType}catch{b=null;break e}var W=0,oe=-1,me=-1,ke=0,et=0,nt=u,Ze=null;t:for(;;){for(var Et;nt!==b||I!==0&&nt.nodeType!==3||(oe=W+I),nt!==j||A!==0&&nt.nodeType!==3||(me=W+A),nt.nodeType===3&&(W+=nt.nodeValue.length),(Et=nt.firstChild)!==null;)Ze=nt,nt=Et;for(;;){if(nt===u)break t;if(Ze===b&&++ke===I&&(oe=W),Ze===j&&++et===A&&(me=W),(Et=nt.nextSibling)!==null)break;nt=Ze,Ze=nt.parentNode}nt=Et}b=oe===-1||me===-1?null:{start:oe,end:me}}else b=null}b=b||{start:0,end:0}}else b=null;for(Ev={focusedElem:u,selectionRange:b},Os=!1,Rt=h;Rt!==null;)if(h=Rt,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,Rt=u;else for(;Rt!==null;){h=Rt;try{var It=h.alternate;if((h.flags&1024)!==0)switch(h.tag){case 0:case 11:case 15:break;case 1:if(It!==null){var Lt=It.memoizedProps,Or=It.memoizedState,Ae=h.stateNode,ve=Ae.getSnapshotBeforeUpdate(h.elementType===h.type?Lt:Hs(h.type,Lt),Or);Ae.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var Pe=h.stateNode.containerInfo;Pe.nodeType===1?Pe.textContent="":Pe.nodeType===9&&Pe.documentElement&&Pe.removeChild(Pe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(lt){Sr(h,h.return,lt)}if(u=h.sibling,u!==null){u.return=h.return,Rt=u;break}Rt=h.return}return It=mN,mN=!1,It}function Zv(u,h,b){var A=h.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var I=A=A.next;do{if((I.tag&u)===u){var j=I.destroy;I.destroy=void 0,j!==void 0&&NM(h,b,j)}I=I.next}while(I!==A)}}function qx(u,h){if(h=h.updateQueue,h=h!==null?h.lastEffect:null,h!==null){var b=h=h.next;do{if((b.tag&u)===u){var A=b.create;b.destroy=A()}b=b.next}while(b!==h)}}function IM(u){var h=u.ref;if(h!==null){var b=u.stateNode;switch(u.tag){case 5:u=b;break;default:u=b}typeof h=="function"?h(u):h.current=u}}function gN(u){var h=u.alternate;h!==null&&(u.alternate=null,gN(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&(delete h[kr],delete h[Pu],delete h[oc],delete h[Lp],delete h[Dp])),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function vN(u){return u.tag===5||u.tag===3||u.tag===4}function yN(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||vN(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function kM(u,h,b){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?b.nodeType===8?b.parentNode.insertBefore(u,h):b.insertBefore(u,h):(b.nodeType===8?(h=b.parentNode,h.insertBefore(u,b)):(h=b,h.appendChild(u)),b=b._reactRootContainer,b!=null||h.onclick!==null||(h.onclick=Zd));else if(A!==4&&(u=u.child,u!==null))for(kM(u,h,b),u=u.sibling;u!==null;)kM(u,h,b),u=u.sibling}function OM(u,h,b){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?b.insertBefore(u,h):b.appendChild(u);else if(A!==4&&(u=u.child,u!==null))for(OM(u,h,b),u=u.sibling;u!==null;)OM(u,h,b),u=u.sibling}var Oi=null,Ta=!1;function ju(u,h,b){for(b=b.child;b!==null;)xN(u,h,b),b=b.sibling}function xN(u,h,b){if(en&&typeof en.onCommitFiberUnmount=="function")try{en.onCommitFiberUnmount(_n,b)}catch{}switch(b.tag){case 5:es||Qp(b,h);case 6:var A=Oi,I=Ta;Oi=null,ju(u,h,b),Oi=A,Ta=I,Oi!==null&&(Ta?(u=Oi,b=b.stateNode,u.nodeType===8?u.parentNode.removeChild(b):u.removeChild(b)):Oi.removeChild(b.stateNode));break;case 18:Oi!==null&&(Ta?(u=Oi,b=b.stateNode,u.nodeType===8?Op(u.parentNode,b):u.nodeType===1&&Op(u,b),Fd(u)):Op(Oi,b.stateNode));break;case 4:A=Oi,I=Ta,Oi=b.stateNode.containerInfo,Ta=!0,ju(u,h,b),Oi=A,Ta=I;break;case 0:case 11:case 14:case 15:if(!es&&(A=b.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){I=A=A.next;do{var j=I,W=j.destroy;j=j.tag,W!==void 0&&((j&2)!==0||(j&4)!==0)&&NM(b,h,W),I=I.next}while(I!==A)}ju(u,h,b);break;case 1:if(!es&&(Qp(b,h),A=b.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=b.memoizedProps,A.state=b.memoizedState,A.componentWillUnmount()}catch(oe){Sr(b,h,oe)}ju(u,h,b);break;case 21:ju(u,h,b);break;case 22:b.mode&1?(es=(A=es)||b.memoizedState!==null,ju(u,h,b),es=A):ju(u,h,b);break;default:ju(u,h,b)}}function bN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var b=u.stateNode;b===null&&(b=u.stateNode=new eW),h.forEach(function(A){var I=uW.bind(null,u,A);b.has(A)||(b.add(A),A.then(I,I))})}}function Ca(u,h){var b=h.deletions;if(b!==null)for(var A=0;AI&&(I=W),A&=~j}if(A=I,A=ct()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*rW(A/1960))-A,10u?16:u,Fu===null)var A=!1;else{if(u=Fu,Fu=null,Jx=0,(Dn&6)!==0)throw Error(n(331));var I=Dn;for(Dn|=4,Rt=u.current;Rt!==null;){var j=Rt,W=j.child;if((Rt.flags&16)!==0){var oe=j.deletions;if(oe!==null){for(var me=0;mect()-jM?xf(u,0):DM|=b),Gs(u,h)}function kN(u,h){h===0&&((u.mode&1)===0?h=1:(h=Ln,Ln<<=1,(Ln&130023424)===0&&(Ln=4194304)));var b=_s();u=lo(u,h),u!==null&&(Za(u,h,b),Gs(u,b))}function cW(u){var h=u.memoizedState,b=0;h!==null&&(b=h.retryLane),kN(u,b)}function uW(u,h){var b=0;switch(u.tag){case 13:var A=u.stateNode,I=u.memoizedState;I!==null&&(b=I.retryLane);break;case 19:A=u.stateNode;break;default:throw Error(n(314))}A!==null&&A.delete(h),kN(u,b)}var ON;ON=function(u,h,b){if(u!==null)if(u.memoizedProps!==h.pendingProps||Ri.current)fn=!0;else{if((u.lanes&b)===0&&(h.flags&128)===0)return fn=!1,ZG(u,h,b);fn=(u.flags&131072)!==0}else fn=!1,Yn&&(h.flags&1048576)!==0&&kv(h,zp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;$x(u,h),u=h.pendingProps;var I=ac(h,Zr.current);al(h,b),I=df(null,h,A,u,I,b);var j=Bv();return h.flags|=1,typeof I=="object"&&I!==null&&typeof I.render=="function"&&I.$$typeof===void 0?(h.tag=1,h.memoizedState=null,h.updateQueue=null,fi(A)?(j=!0,lc(h)):j=!1,h.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,un(h),I.updater=Zp,h.stateNode=I,I._reactInternals=h,M(h,A,u,b),h=ln(null,h,A,!0,j,b)):(h.tag=0,Yn&&j&&Ov(h),Mt(null,h,I,b),h=h.child),h;case 16:A=h.elementType;e:{switch($x(u,h),u=h.pendingProps,I=A._init,A=I(A._payload),h.type=A,I=h.tag=fW(A),u=Hs(A,u),I){case 0:h=yt(null,h,A,u,b);break e;case 1:h=jt(null,h,A,u,b);break e;case 11:h=ti(null,h,A,u,b);break e;case 14:h=bs(null,h,A,Hs(A.type,u),b);break e}throw Error(n(306,A,""))}return h;case 0:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Hs(A,I),yt(u,h,A,I,b);case 1:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Hs(A,I),jt(u,h,A,I,b);case 3:e:{if(an(h),u===null)throw Error(n(387));A=h.pendingProps,j=h.memoizedState,I=j.element,gr(u,h),ur(h,A,null,b);var W=h.memoizedState;if(A=W.element,j.isDehydrated)if(j={element:A,isDehydrated:!1,cache:W.cache,pendingSuspenseBoundaries:W.pendingSuspenseBoundaries,transitions:W.transitions},h.updateQueue.baseState=j,h.memoizedState=j,h.flags&256){I=P(Error(n(423)),h),h=Cn(u,h,A,b,I);break e}else if(A!==I){I=P(Error(n(424)),h),h=Cn(u,h,A,b,I);break e}else for(Ii=pa(h.stateNode.containerInfo.firstChild),Qr=h,Yn=!0,Bs=null,b=sf(h,null,A,b),h.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(ol(),A===I){h=_c(u,h,b);break e}Mt(u,h,A,b)}h=h.child}return h;case 5:return vc(h),u===null&&Hp(h),A=h.type,I=h.pendingProps,j=u!==null?u.memoizedProps:null,W=I.children,Av(A,I)?W=null:j!==null&&Av(A,j)&&(h.flags|=32),Le(u,h),Mt(u,h,W,b),h.child;case 6:return u===null&&Hp(h),null;case 13:return Aa(u,h,b);case 4:return cf(h,h.stateNode.containerInfo),A=h.pendingProps,u===null?h.child=dc(h,null,A,b):Mt(u,h,A,b),h.child;case 11:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Hs(A,I),ti(u,h,A,I,b);case 7:return Mt(u,h,h.pendingProps,b),h.child;case 8:return Mt(u,h,h.pendingProps.children,b),h.child;case 12:return Mt(u,h,h.pendingProps.children,b),h.child;case 10:e:{if(A=h.type._context,I=h.pendingProps,j=h.memoizedProps,W=I.value,$n(fc,A._currentValue),A._currentValue=W,j!==null)if(hs(j.value,W)){if(j.children===I.children&&!Ri.current){h=_c(u,h,b);break e}}else for(j=h.child,j!==null&&(j.return=h);j!==null;){var oe=j.dependencies;if(oe!==null){W=j.child;for(var me=oe.firstContext;me!==null;){if(me.context===A){if(j.tag===1){me=Vn(-1,b&-b),me.tag=2;var ke=j.updateQueue;if(ke!==null){ke=ke.shared;var et=ke.pending;et===null?me.next=me:(me.next=et.next,et.next=me),ke.pending=me}}j.lanes|=b,me=j.alternate,me!==null&&(me.lanes|=b),af(j.return,b,h),oe.lanes|=b;break}me=me.next}}else if(j.tag===10)W=j.type===h.type?null:j.child;else if(j.tag===18){if(W=j.return,W===null)throw Error(n(341));W.lanes|=b,oe=W.alternate,oe!==null&&(oe.lanes|=b),af(W,b,h),W=j.sibling}else W=j.child;if(W!==null)W.return=j;else for(W=j;W!==null;){if(W===h){W=null;break}if(j=W.sibling,j!==null){j.return=W.return,W=j;break}W=W.return}j=W}Mt(u,h,I.children,b),h=h.child}return h;case 9:return I=h.type,A=h.pendingProps.children,al(h,b),I=gs(I),A=A(I),h.flags|=1,Mt(u,h,A,b),h.child;case 14:return A=h.type,I=Hs(A,h.pendingProps),I=Hs(A.type,I),bs(u,h,A,I,b);case 15:return Re(u,h,h.type,h.pendingProps,b);case 17:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Hs(A,I),$x(u,h),h.tag=1,fi(A)?(u=!0,lc(h)):u=!1,al(h,b),p(h,A,I),M(h,A,I,b),ln(null,h,A,!0,u,b);case 19:return dN(u,h,b);case 22:return be(u,h,b)}throw Error(n(156,h.tag))};function LN(u,h){return Ne(u,h)}function dW(u,h,b,A){this.tag=u,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=h,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 Fo(u,h,b,A){return new dW(u,h,b,A)}function WM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function fW(u){if(typeof u=="function")return WM(u)?1:0;if(u!=null){if(u=u.$$typeof,u===H)return 11;if(u===pe)return 14}return 2}function Hu(u,h){var b=u.alternate;return b===null?(b=Fo(u.tag,h,u.key,u.mode),b.elementType=u.elementType,b.type=u.type,b.stateNode=u.stateNode,b.alternate=u,u.alternate=b):(b.pendingProps=h,b.type=u.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=u.flags&14680064,b.childLanes=u.childLanes,b.lanes=u.lanes,b.child=u.child,b.memoizedProps=u.memoizedProps,b.memoizedState=u.memoizedState,b.updateQueue=u.updateQueue,h=u.dependencies,b.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},b.sibling=u.sibling,b.index=u.index,b.ref=u.ref,b}function rb(u,h,b,A,I,j){var W=2;if(A=u,typeof u=="function")WM(u)&&(W=1);else if(typeof u=="string")W=5;else e:switch(u){case L:return _f(b.children,I,j,h);case F:W=8,I|=8;break;case G:return u=Fo(12,b,h,I|2),u.elementType=G,u.lanes=j,u;case ne:return u=Fo(13,b,h,I),u.elementType=ne,u.lanes=j,u;case ee:return u=Fo(19,b,h,I),u.elementType=ee,u.lanes=j,u;case fe:return ib(b,I,j,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:W=10;break e;case U:W=9;break e;case H:W=11;break e;case pe:W=14;break e;case se:W=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=Fo(W,b,h,I),h.elementType=u,h.type=A,h.lanes=j,h}function _f(u,h,b,A){return u=Fo(7,u,A,h),u.lanes=b,u}function ib(u,h,b,A){return u=Fo(22,u,A,h),u.elementType=fe,u.lanes=b,u.stateNode={isHidden:!1},u}function $M(u,h,b){return u=Fo(6,u,null,h),u.lanes=b,u}function XM(u,h,b){return h=Fo(4,u.children!==null?u.children:[],u.key,h),h.lanes=b,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function hW(u,h,b,A,I){this.tag=h,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ld(0),this.expirationTimes=Ld(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ld(0),this.identifierPrefix=A,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function qM(u,h,b,A,I,j,W,oe,me){return u=new hW(u,h,b,oe,me),h===1?(h=1,j===!0&&(h|=8)):h=0,j=Fo(3,null,null,h),u.current=j,j.stateNode=u,j.memoizedState={element:A,isDehydrated:b,cache:null,transitions:null,pendingSuspenseBoundaries:null},un(j),u}function pW(u,h,b){var A=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),tE.exports=CW(),tE.exports}var YN;function PW(){if(YN)return fb;YN=1;var t=$U();return fb.createRoot=t.createRoot,fb.hydrateRoot=t.hydrateRoot,fb}var RW=PW();const NW=V1(RW);var Gy=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},dh,dd,og,LU,IW=(LU=class extends Gy{constructor(){super();Kt(this,dh);Kt(this,dd);Kt(this,og);Tt(this,og,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ge(this,dd)||this.setEventListener(ge(this,og))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,dd))==null||e.call(this),Tt(this,dd,void 0))}setEventListener(e){var n;Tt(this,og,e),(n=ge(this,dd))==null||n.call(this),Tt(this,dd,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ge(this,dh)!==e&&(Tt(this,dh,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ge(this,dh)=="boolean"?ge(this,dh):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},dh=new WeakMap,dd=new WeakMap,og=new WeakMap,LU),vP=new IW,kW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},fd,gP,DU,OW=(DU=class{constructor(){Kt(this,fd,kW);Kt(this,gP,!1)}setTimeoutProvider(t){Tt(this,fd,t)}setTimeout(t,e){return ge(this,fd).setTimeout(t,e)}clearTimeout(t){ge(this,fd).clearTimeout(t)}setInterval(t,e){return ge(this,fd).setInterval(t,e)}clearInterval(t){ge(this,fd).clearInterval(t)}},fd=new WeakMap,gP=new WeakMap,DU),Jf=new OW;function LW(t){setTimeout(t,0)}var DW=typeof window>"u"||"Deno"in globalThis;function Ks(){}function jW(t,e){return typeof t=="function"?t(e):t}function mT(t){return typeof t=="number"&&t>=0&&t!==1/0}function XU(t,e){return Math.max(t+(e||0)-Date.now(),0)}function bd(t,e){return typeof t=="function"?t(e):t}function yo(t,e){return typeof t=="function"?t(e):t}function ZN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==yP(o,e.options))return!1}else if(!sy(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function QN(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(iy(e.options.mutationKey)!==iy(s))return!1}else if(!sy(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function yP(t,e){return((e==null?void 0:e.queryKeyHashFn)||iy)(t)}function iy(t){return JSON.stringify(t,(e,n)=>vT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function sy(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>sy(t[n],e[n])):!1}var UW=Object.prototype.hasOwnProperty;function qU(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=JN(t)&&JN(e);if(!r&&!(vT(t)&&vT(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let c=0;for(let d=0;d{Jf.setTimeout(e,t)})}function yT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?qU(t,e):e}function zW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function BW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var xP=Symbol();function KU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===xP?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function YU(t,e){return typeof t=="function"?t(...e):!!t}function HW(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var oy=(()=>{let t=()=>DW;return{isServer(){return t()},setIsServer(e){t=e}}})();function xT(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var VW=LW;function GW(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=VW;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var zi=GW(),ag,hd,lg,jU,WW=(jU=class extends Gy{constructor(){super();Kt(this,ag,!0);Kt(this,hd);Kt(this,lg);Tt(this,lg,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ge(this,hd)||this.setEventListener(ge(this,lg))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,hd))==null||e.call(this),Tt(this,hd,void 0))}setEventListener(e){var n;Tt(this,lg,e),(n=ge(this,hd))==null||n.call(this),Tt(this,hd,e(this.setOnline.bind(this)))}setOnline(e){ge(this,ag)!==e&&(Tt(this,ag,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ge(this,ag)}},ag=new WeakMap,hd=new WeakMap,lg=new WeakMap,jU),J_=new WW;function $W(t){return Math.min(1e3*2**t,3e4)}function ZU(t){return(t??"online")==="online"?J_.isOnline():!0}var bT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function QU(t){let e=!1,n=0,r;const i=xT(),s=()=>i.status!=="pending",o=S=>{var _;if(!s()){const w=new bT(S);m(w),(_=t.onCancel)==null||_.call(t,w)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>vP.isFocused()&&(t.networkMode==="always"||J_.isOnline())&&t.canRun(),d=()=>ZU(t.networkMode)&&t.canRun(),f=S=>{s()||(r==null||r(),i.resolve(S))},m=S=>{s()||(r==null||r(),i.reject(S))},y=()=>new Promise(S=>{var _;r=w=>{(s()||c())&&S(w)},(_=t.onPause)==null||_.call(t)}).then(()=>{var S;r=void 0,s()||(S=t.onContinue)==null||S.call(t)}),x=()=>{if(s())return;let S;const _=n===0?t.initialPromise:void 0;try{S=_??t.fn()}catch(w){S=Promise.reject(w)}Promise.resolve(S).then(f).catch(w=>{var N;if(s())return;const E=t.retry??(oy.isServer()?0:3),T=t.retryDelay??$W,C=typeof T=="function"?T(n,w):T,O=E===!0||typeof E=="number"&&nc()?void 0:y()).then(()=>{e?m(w):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?x():y().then(x),i)}}var fh,UU,JU=(UU=class{constructor(){Kt(this,fh)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mT(this.gcTime)&&Tt(this,fh,Jf.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(oy.isServer()?1/0:300*1e3))}clearGcTimeout(){ge(this,fh)!==void 0&&(Jf.clearTimeout(ge(this,fh)),Tt(this,fh,void 0))}},fh=new WeakMap,UU);function XW(t){return{onFetch:(e,n)=>{var d,f,m,y,x;const r=e.options,i=(m=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let S=!1;const _=T=>{HW(T,()=>e.signal,()=>S=!0)},w=KU(e.options,e.fetchOptions),E=async(T,C,O)=>{if(S)return Promise.reject(e.signal.reason);if(C==null&&T.pages.length)return Promise.resolve(T);const L=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:C,direction:O?"backward":"forward",meta:e.options.meta};return _(U),U})(),F=await w(L),{maxPages:G}=e.options,k=O?BW:zW;return{pages:k(T.pages,F,G),pageParams:k(T.pageParams,C,G)}};if(i&&s.length){const T=i==="backward",C=T?qW:tI,O={pages:s,pageParams:o},N=C(r,O);a=await E(O,N,T)}else{const T=t??s.length;do{const C=l===0?o[0]??r.initialPageParam:tI(r,a);if(l>0&&C==null)break;a=await E(a,C),l++}while(l{var S,_;return(_=(S=e.options).persister)==null?void 0:_.call(S,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function tI(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function qW(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var cg,hh,ug,Wo,ph,yi,Fy,mh,vo,eF,Rc,FU,KW=(FU=class extends JU{constructor(e){super();Kt(this,vo);Kt(this,cg);Kt(this,hh);Kt(this,ug);Kt(this,Wo);Kt(this,ph);Kt(this,yi);Kt(this,Fy);Kt(this,mh);Tt(this,mh,!1),Tt(this,Fy,e.defaultOptions),this.setOptions(e.options),this.observers=[],Tt(this,ph,e.client),Tt(this,Wo,ge(this,ph).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Tt(this,hh,rI(this.options)),this.state=e.state??ge(this,hh),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return ge(this,cg)}get promise(){var e;return(e=ge(this,yi))==null?void 0:e.promise}setOptions(e){if(this.options={...ge(this,Fy),...e},e!=null&&e._type&&Tt(this,cg,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=rI(this.options);n.data!==void 0&&(this.setState(nI(n.data,n.dataUpdatedAt)),Tt(this,hh,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ge(this,Wo).remove(this)}setData(e,n){const r=yT(this.state.data,e,this.options);return Mn(this,vo,Rc).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){Mn(this,vo,Rc).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=ge(this,yi))==null?void 0:r.promise;return(i=ge(this,yi))==null||i.cancel(e),n?n.then(Ks).catch(Ks):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return ge(this,hh)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>yo(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===xP||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>bd(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!XU(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,yi))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,yi))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ge(this,Wo).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(ge(this,yi)&&(ge(this,mh)||Mn(this,vo,eF).call(this)?ge(this,yi).cancel({revert:!0}):ge(this,yi).cancelRetry()),this.scheduleGc()),ge(this,Wo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Mn(this,vo,Rc).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,m,y,x,S,_,w,E,T;if(this.state.fetchStatus!=="idle"&&((c=ge(this,yi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ge(this,yi))return ge(this,yi).continueRetry(),ge(this,yi).promise}if(e&&this.setOptions(e),!this.options.queryFn){const C=this.observers.find(O=>O.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,i=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(Tt(this,mh,!0),r.signal)})},s=()=>{const C=KU(this.options,n),N=(()=>{const L={client:ge(this,ph),queryKey:this.queryKey,meta:this.meta};return i(L),L})();return Tt(this,mh,!1),this.options.persister?this.options.persister(C,N,this):C(N)},a=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ge(this,ph),state:this.state,fetchFn:s};return i(C),C})(),l=ge(this,cg)==="infinite"?XW(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),Tt(this,ug,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&Mn(this,vo,Rc).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Tt(this,yi,QU({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:C=>{C instanceof bT&&C.revert&&this.setState({...ge(this,ug),fetchStatus:"idle"}),r.abort()},onFail:(C,O)=>{Mn(this,vo,Rc).call(this,{type:"failed",failureCount:C,error:O})},onPause:()=>{Mn(this,vo,Rc).call(this,{type:"pause"})},onContinue:()=>{Mn(this,vo,Rc).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const C=await ge(this,yi).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(y=(m=ge(this,Wo).config).onSuccess)==null||y.call(m,C,this),(S=(x=ge(this,Wo).config).onSettled)==null||S.call(x,C,this.state.error,this),C}catch(C){if(C instanceof bT){if(C.silent)return ge(this,yi).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw Mn(this,vo,Rc).call(this,{type:"error",error:C}),(w=(_=ge(this,Wo).config).onError)==null||w.call(_,C,this),(T=(E=ge(this,Wo).config).onSettled)==null||T.call(E,this.state.data,C,this),C}finally{this.scheduleGc()}}},cg=new WeakMap,hh=new WeakMap,ug=new WeakMap,Wo=new WeakMap,ph=new WeakMap,yi=new WeakMap,Fy=new WeakMap,mh=new WeakMap,vo=new WeakSet,eF=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Rc=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...tF(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...nI(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Tt(this,ug,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),zi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ge(this,Wo).notify({query:this,type:"updated",action:e})})},FU);function tF(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ZU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function nI(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function rI(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var qs,Pn,zy,Ms,gh,dg,Oc,pd,By,fg,hg,vh,yh,md,pg,Gn,F0,_T,wT,ST,MT,ET,AT,TT,nF,zU,YW=(zU=class extends Gy{constructor(e,n){super();Kt(this,Gn);Kt(this,qs);Kt(this,Pn);Kt(this,zy);Kt(this,Ms);Kt(this,gh);Kt(this,dg);Kt(this,Oc);Kt(this,pd);Kt(this,By);Kt(this,fg);Kt(this,hg);Kt(this,vh);Kt(this,yh);Kt(this,md);Kt(this,pg,new Set);this.options=n,Tt(this,qs,e),Tt(this,pd,null),Tt(this,Oc,xT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ge(this,Pn).addObserver(this),iI(ge(this,Pn),this.options)?Mn(this,Gn,F0).call(this):this.updateResult(),Mn(this,Gn,MT).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return CT(ge(this,Pn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return CT(ge(this,Pn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Mn(this,Gn,ET).call(this),Mn(this,Gn,AT).call(this),ge(this,Pn).removeObserver(this)}setOptions(e){const n=this.options,r=ge(this,Pn);if(this.options=ge(this,qs).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof yo(this.options.enabled,ge(this,Pn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Mn(this,Gn,TT).call(this),ge(this,Pn).setOptions(this.options),n._defaulted&&!gT(this.options,n)&&ge(this,qs).getQueryCache().notify({type:"observerOptionsUpdated",query:ge(this,Pn),observer:this});const i=this.hasListeners();i&&sI(ge(this,Pn),r,this.options,n)&&Mn(this,Gn,F0).call(this),this.updateResult(),i&&(ge(this,Pn)!==r||yo(this.options.enabled,ge(this,Pn))!==yo(n.enabled,ge(this,Pn))||bd(this.options.staleTime,ge(this,Pn))!==bd(n.staleTime,ge(this,Pn)))&&Mn(this,Gn,_T).call(this);const s=Mn(this,Gn,wT).call(this);i&&(ge(this,Pn)!==r||yo(this.options.enabled,ge(this,Pn))!==yo(n.enabled,ge(this,Pn))||s!==ge(this,md))&&Mn(this,Gn,ST).call(this,s)}getOptimisticResult(e){const n=ge(this,qs).getQueryCache().build(ge(this,qs),e),r=this.createResult(n,e);return QW(this,r)&&(Tt(this,Ms,r),Tt(this,dg,this.options),Tt(this,gh,ge(this,Pn).state)),r}getCurrentResult(){return ge(this,Ms)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&ge(this,Oc).status==="pending"&&ge(this,Oc).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){ge(this,pg).add(e)}getCurrentQuery(){return ge(this,Pn)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=ge(this,qs).defaultQueryOptions(e),r=ge(this,qs).getQueryCache().build(ge(this,qs),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Mn(this,Gn,F0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),ge(this,Ms)))}createResult(e,n){var G;const r=ge(this,Pn),i=this.options,s=ge(this,Ms),o=ge(this,gh),a=ge(this,dg),c=e!==r?e.state:ge(this,zy),{state:d}=e;let f={...d},m=!1,y;if(n._optimisticResults){const k=this.hasListeners(),U=!k&&iI(e,n),H=k&&sI(e,r,n,i);(U||H)&&(f={...f,...tF(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:_}=f;y=f.data;let w=!1;if(n.placeholderData!==void 0&&y===void 0&&_==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(k=s.data,w=!0):k=typeof n.placeholderData=="function"?n.placeholderData((G=ge(this,hg))==null?void 0:G.state.data,ge(this,hg)):n.placeholderData,k!==void 0&&(_="success",y=yT(s==null?void 0:s.data,k,n),m=!0)}if(n.select&&y!==void 0&&!w)if(s&&y===(o==null?void 0:o.data)&&n.select===ge(this,By))y=ge(this,fg);else try{Tt(this,By,n.select),y=n.select(y),y=yT(s==null?void 0:s.data,y,n),Tt(this,fg,y),Tt(this,pd,null)}catch(k){Tt(this,pd,k)}ge(this,pd)&&(x=ge(this,pd),y=ge(this,fg),S=Date.now(),_="error");const E=f.fetchStatus==="fetching",T=_==="pending",C=_==="error",O=T&&E,N=y!==void 0,F={status:_,fetchStatus:f.fetchStatus,isPending:T,isSuccess:_==="success",isError:C,isInitialLoading:O,isLoading:O,data:y,dataUpdatedAt:f.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:E,isRefetching:E&&!T,isLoadingError:C&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&N,isStale:bP(e,n),refetch:this.refetch,promise:ge(this,Oc),isEnabled:yo(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=F.data!==void 0,U=F.status==="error"&&!k,H=pe=>{U?pe.reject(F.error):k&&pe.resolve(F.data)},ne=()=>{const pe=Tt(this,Oc,F.promise=xT());H(pe)},ee=ge(this,Oc);switch(ee.status){case"pending":e.queryHash===r.queryHash&&H(ee);break;case"fulfilled":(U||F.data!==ee.value)&&ne();break;case"rejected":(!U||F.error!==ee.reason)&&ne();break}}return F}updateResult(){const e=ge(this,Ms),n=this.createResult(ge(this,Pn),this.options);if(Tt(this,gh,ge(this,Pn).state),Tt(this,dg,this.options),ge(this,gh).data!==void 0&&Tt(this,hg,ge(this,Pn)),gT(n,e))return;Tt(this,Ms,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!ge(this,pg).size)return!0;const o=new Set(s??ge(this,pg));return this.options.throwOnError&&o.add("error"),Object.keys(ge(this,Ms)).some(a=>{const l=a;return ge(this,Ms)[l]!==e[l]&&o.has(l)})};Mn(this,Gn,nF).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Mn(this,Gn,MT).call(this)}},qs=new WeakMap,Pn=new WeakMap,zy=new WeakMap,Ms=new WeakMap,gh=new WeakMap,dg=new WeakMap,Oc=new WeakMap,pd=new WeakMap,By=new WeakMap,fg=new WeakMap,hg=new WeakMap,vh=new WeakMap,yh=new WeakMap,md=new WeakMap,pg=new WeakMap,Gn=new WeakSet,F0=function(e){Mn(this,Gn,TT).call(this);let n=ge(this,Pn).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Ks)),n},_T=function(){Mn(this,Gn,ET).call(this);const e=bd(this.options.staleTime,ge(this,Pn));if(oy.isServer()||ge(this,Ms).isStale||!mT(e))return;const r=XU(ge(this,Ms).dataUpdatedAt,e)+1;Tt(this,vh,Jf.setTimeout(()=>{ge(this,Ms).isStale||this.updateResult()},r))},wT=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ge(this,Pn)):this.options.refetchInterval)??!1},ST=function(e){Mn(this,Gn,AT).call(this),Tt(this,md,e),!(oy.isServer()||yo(this.options.enabled,ge(this,Pn))===!1||!mT(ge(this,md))||ge(this,md)===0)&&Tt(this,yh,Jf.setInterval(()=>{(this.options.refetchIntervalInBackground||vP.isFocused())&&Mn(this,Gn,F0).call(this)},ge(this,md)))},MT=function(){Mn(this,Gn,_T).call(this),Mn(this,Gn,ST).call(this,Mn(this,Gn,wT).call(this))},ET=function(){ge(this,vh)!==void 0&&(Jf.clearTimeout(ge(this,vh)),Tt(this,vh,void 0))},AT=function(){ge(this,yh)!==void 0&&(Jf.clearInterval(ge(this,yh)),Tt(this,yh,void 0))},TT=function(){const e=ge(this,qs).getQueryCache().build(ge(this,qs),this.options);if(e===ge(this,Pn))return;const n=ge(this,Pn);Tt(this,Pn,e),Tt(this,zy,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},nF=function(e){zi.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(ge(this,Ms))}),ge(this,qs).getQueryCache().notify({query:ge(this,Pn),type:"observerResultsUpdated"})})},zU);function ZW(t,e){return yo(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&yo(e.retryOnMount,t)===!1)}function iI(t,e){return ZW(t,e)||t.state.data!==void 0&&CT(t,e,e.refetchOnMount)}function CT(t,e,n){if(yo(e.enabled,t)!==!1&&bd(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&bP(t,e)}return!1}function sI(t,e,n,r){return(t!==e||yo(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&bP(t,n)}function bP(t,e){return yo(e.enabled,t)!==!1&&t.isStaleByTime(bd(e.staleTime,t))}function QW(t,e){return!gT(t.getCurrentResult(),e)}var Hy,yl,is,xh,xl,sd,BU,JW=(BU=class extends JU{constructor(e){super();Kt(this,xl);Kt(this,Hy);Kt(this,yl);Kt(this,is);Kt(this,xh);Tt(this,Hy,e.client),this.mutationId=e.mutationId,Tt(this,is,e.mutationCache),Tt(this,yl,[]),this.state=e.state||e8(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ge(this,yl).includes(e)||(ge(this,yl).push(e),this.clearGcTimeout(),ge(this,is).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Tt(this,yl,ge(this,yl).filter(n=>n!==e)),this.scheduleGc(),ge(this,is).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ge(this,yl).length||(this.state.status==="pending"?this.scheduleGc():ge(this,is).remove(this))}continue(){var e;return((e=ge(this,xh))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,d,f,m,y,x,S,_,w,E,T,C,O,N,L;const n=()=>{Mn(this,xl,sd).call(this,{type:"continue"})},r={client:ge(this,Hy),meta:this.options.meta,mutationKey:this.options.mutationKey};Tt(this,xh,QU({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(F,G)=>{Mn(this,xl,sd).call(this,{type:"failed",failureCount:F,error:G})},onPause:()=>{Mn(this,xl,sd).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ge(this,is).canRun(this)}));const i=this.state.status==="pending",s=!ge(this,xh).canStart();try{if(i)n();else{Mn(this,xl,sd).call(this,{type:"pending",variables:e,isPaused:s}),ge(this,is).config.onMutate&&await ge(this,is).config.onMutate(e,this,r);const G=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));G!==this.state.context&&Mn(this,xl,sd).call(this,{type:"pending",context:G,variables:e,isPaused:s})}const F=await ge(this,xh).start();return await((c=(l=ge(this,is).config).onSuccess)==null?void 0:c.call(l,F,e,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,F,e,this.state.context,r)),await((y=(m=ge(this,is).config).onSettled)==null?void 0:y.call(m,F,null,this.state.variables,this.state.context,this,r)),await((S=(x=this.options).onSettled)==null?void 0:S.call(x,F,null,e,this.state.context,r)),Mn(this,xl,sd).call(this,{type:"success",data:F}),F}catch(F){try{await((w=(_=ge(this,is).config).onError)==null?void 0:w.call(_,F,e,this.state.context,this,r))}catch(G){Promise.reject(G)}try{await((T=(E=this.options).onError)==null?void 0:T.call(E,F,e,this.state.context,r))}catch(G){Promise.reject(G)}try{await((O=(C=ge(this,is).config).onSettled)==null?void 0:O.call(C,void 0,F,this.state.variables,this.state.context,this,r))}catch(G){Promise.reject(G)}try{await((L=(N=this.options).onSettled)==null?void 0:L.call(N,void 0,F,e,this.state.context,r))}catch(G){Promise.reject(G)}throw Mn(this,xl,sd).call(this,{type:"error",error:F}),F}finally{ge(this,is).runNext(this)}}},Hy=new WeakMap,yl=new WeakMap,is=new WeakMap,xh=new WeakMap,xl=new WeakSet,sd=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),zi.batch(()=>{ge(this,yl).forEach(r=>{r.onMutationUpdate(e)}),ge(this,is).notify({mutation:this,type:"updated",action:e})})},BU);function e8(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Lc,Da,Vy,HU,t8=(HU=class extends Gy{constructor(e={}){super();Kt(this,Lc);Kt(this,Da);Kt(this,Vy);this.config=e,Tt(this,Lc,new Set),Tt(this,Da,new Map),Tt(this,Vy,0)}build(e,n,r){const i=new JW({client:e,mutationCache:this,mutationId:++db(this,Vy)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){ge(this,Lc).add(e);const n=hb(e);if(typeof n=="string"){const r=ge(this,Da).get(n);r?r.push(e):ge(this,Da).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ge(this,Lc).delete(e)){const n=hb(e);if(typeof n=="string"){const r=ge(this,Da).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&ge(this,Da).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=hb(e);if(typeof n=="string"){const r=ge(this,Da).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=hb(e);if(typeof n=="string"){const i=(r=ge(this,Da).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){zi.batch(()=>{ge(this,Lc).forEach(e=>{this.notify({type:"removed",mutation:e})}),ge(this,Lc).clear(),ge(this,Da).clear()})}getAll(){return Array.from(ge(this,Lc))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>QN(n,r))}findAll(e={}){return this.getAll().filter(n=>QN(e,n))}notify(e){zi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return zi.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ks))))}},Lc=new WeakMap,Da=new WeakMap,Vy=new WeakMap,HU);function hb(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,VU,n8=(VU=class extends Gy{constructor(e={}){super();Kt(this,bl);this.config=e,Tt(this,bl,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??yP(i,n);let o=this.get(s);return o||(o=new KW({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){ge(this,bl).has(e.queryHash)||(ge(this,bl).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ge(this,bl).get(e.queryHash);n&&(e.destroy(),n===e&&ge(this,bl).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){zi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ge(this,bl).get(e)}getAll(){return[...ge(this,bl).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>ZN(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>ZN(e,r)):n}notify(e){zi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){zi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){zi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bl=new WeakMap,VU),Er,gd,vd,mg,gg,yd,vg,yg,GU,r8=(GU=class{constructor(t={}){Kt(this,Er);Kt(this,gd);Kt(this,vd);Kt(this,mg);Kt(this,gg);Kt(this,yd);Kt(this,vg);Kt(this,yg);Tt(this,Er,t.queryCache||new n8),Tt(this,gd,t.mutationCache||new t8),Tt(this,vd,t.defaultOptions||{}),Tt(this,mg,new Map),Tt(this,gg,new Map),Tt(this,yd,0)}mount(){db(this,yd)._++,ge(this,yd)===1&&(Tt(this,vg,vP.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Er).onFocus())})),Tt(this,yg,J_.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Er).onOnline())})))}unmount(){var t,e;db(this,yd)._--,ge(this,yd)===0&&((t=ge(this,vg))==null||t.call(this),Tt(this,vg,void 0),(e=ge(this,yg))==null||e.call(this),Tt(this,yg,void 0))}isFetching(t){return ge(this,Er).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ge(this,gd).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Er).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=ge(this,Er).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(bd(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return ge(this,Er).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=ge(this,Er).get(r.queryHash),s=i==null?void 0:i.state.data,o=jW(e,s);if(o!==void 0)return ge(this,Er).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return zi.batch(()=>ge(this,Er).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Er).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ge(this,Er);zi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ge(this,Er);return zi.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=zi.batch(()=>ge(this,Er).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Ks).catch(Ks)}invalidateQueries(t,e={}){return zi.batch(()=>(ge(this,Er).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=zi.batch(()=>ge(this,Er).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ks)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ks)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ge(this,Er).build(this,e);return n.isStaleByTime(bd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ks).catch(Ks)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ks).catch(Ks)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return J_.isOnline()?ge(this,gd).resumePausedMutations():Promise.resolve()}getQueryCache(){return ge(this,Er)}getMutationCache(){return ge(this,gd)}getDefaultOptions(){return ge(this,vd)}setDefaultOptions(t){Tt(this,vd,t)}setQueryDefaults(t,e){ge(this,mg).set(iy(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ge(this,mg).values()],n={};return e.forEach(r=>{sy(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){ge(this,gg).set(iy(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ge(this,gg).values()],n={};return e.forEach(r=>{sy(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ge(this,vd).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=yP(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===xP&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ge(this,vd).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ge(this,Er).clear(),ge(this,gd).clear()}},Er=new WeakMap,gd=new WeakMap,vd=new WeakMap,mg=new WeakMap,gg=new WeakMap,yd=new WeakMap,vg=new WeakMap,yg=new WeakMap,GU),rF=R.createContext(void 0),Xh=t=>{const e=R.useContext(rF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},i8=({client:t,children:e})=>(R.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(rF.Provider,{value:t,children:e})),iF=R.createContext(!1),s8=()=>R.useContext(iF);iF.Provider;function o8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var a8=R.createContext(o8()),l8=()=>R.useContext(a8),c8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?YU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},u8=t=>{R.useEffect(()=>{t.clearReset()},[t])},d8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||YU(n,[t.error,r])),f8=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},h8=(t,e)=>t.isLoading&&t.isFetching&&!e,p8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,oI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function m8(t,e,n){var y,x,S,_;const r=s8(),i=l8(),s=Xh(),o=s.defaultQueryOptions(t);(x=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,o);const a=s.getQueryCache().get(o.queryHash),l=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,f8(o),c8(o,i,a),u8(i);const c=!s.getQueryCache().get(o.queryHash),[d]=R.useState(()=>new e(s,o)),f=d.getOptimisticResult(o),m=!r&&l;if(R.useSyncExternalStore(R.useCallback(w=>{const E=m?d.subscribe(zi.batchCalls(w)):Ks;return d.updateResult(),E},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(o)},[o,d]),p8(o,f))throw oI(o,d,i);if(d8({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((_=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||_.call(S,o,f),o.experimental_prefetchInRender&&!oy.isServer()&&h8(f,r)){const w=c?oI(o,d,i):a==null?void 0:a.promise;w==null||w.catch(Ks).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function Gi(t,e){return m8(t,YW)}/** +`+j.stack}return{value:u,source:h,stack:I,digest:null}}function D(u,h,_){return{value:u,source:null,stack:_??null,digest:h??null}}function z(u,h){try{console.error(h.value)}catch(_){setTimeout(function(){throw _})}}var re=typeof WeakMap=="function"?WeakMap:Map;function ye(u,h,_){_=Vn(-1,_),_.tag=3,_.payload={element:null};var A=h.value;return _.callback=function(){Zx||(Zx=!0,zM=A),z(u,h)},_}function De(u,h,_){_=Vn(-1,_),_.tag=3;var A=u.type.getDerivedStateFromError;if(typeof A=="function"){var I=h.value;_.payload=function(){return A(I)},_.callback=function(){z(u,h)}}var j=u.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(_.callback=function(){z(u,h),typeof A!="function"&&(Uu===null?Uu=new Set([this]):Uu.add(this));var W=h.stack;this.componentDidCatch(h.value,{componentStack:W!==null?W:""})}),_}function at(u,h,_){var A=u.pingCache;if(A===null){A=u.pingCache=new re;var I=new Set;A.set(h,I)}else I=A.get(h),I===void 0&&(I=new Set,A.set(h,I));I.has(_)||(I.add(_),u=fW.bind(null,u,h,_),h.then(u,u))}function Ct(u){do{var h;if((h=u.tag===13)&&(h=u.memoizedState,h=h!==null?h.dehydrated!==null:!0),h)return u;u=u.return}while(u!==null);return null}function an(u,h,_,A,I){return(u.mode&1)===0?(u===h?u.flags|=65536:(u.flags|=128,_.flags|=131072,_.flags&=-52805,_.tag===1&&(_.alternate===null?_.tag=17:(h=Vn(-1,1),h.tag=2,nr(_,h,1))),_.lanes|=1),u):(u.flags|=65536,u.lanes=I,u)}var $t=C.ReactCurrentOwner,dn=!1;function Et(u,h,_,A){h.child=u===null?of(h,null,_,A):dc(h,u.child,_,A)}function ni(u,h,_,A,I){_=_.render;var j=h.ref;return al(h,I),A=ff(u,h,_,A,j,I),_=Bv(),u!==null&&!dn?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,_c(u,h,I)):(Yn&&_&&Ov(h),h.flags|=1,Et(u,h,A,I),h.child)}function bs(u,h,_,A,I){if(u===null){var j=_.type;return typeof j=="function"&&!XM(j)&&j.defaultProps===void 0&&_.compare===null&&_.defaultProps===void 0?(h.tag=15,h.type=j,Re(u,h,j,A,I)):(u=rb(_.type,null,A,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(j=u.child,(u.lanes&I)===0){var W=j.memoizedProps;if(_=_.compare,_=_!==null?_:tc,_(W,A)&&u.ref===h.ref)return _c(u,h,I)}return h.flags|=1,u=Hu(j,A),u.ref=h.ref,u.return=h,h.child=u}function Re(u,h,_,A,I){if(u!==null){var j=u.memoizedProps;if(tc(j,A)&&u.ref===h.ref)if(dn=!1,h.pendingProps=A=j,(u.lanes&I)!==0)(u.flags&131072)!==0&&(dn=!0);else return h.lanes=u.lanes,_c(u,h,I)}return bt(u,h,_,A,I)}function be(u,h,_){var A=h.pendingProps,I=A.children,j=u!==null?u.memoizedState:null;if(A.mode==="hidden")if((h.mode&1)===0)h.memoizedState={baseLanes:0,cachePool:null,transitions:null},$n(Jp,mo),mo|=_;else{if((_&1073741824)===0)return u=j!==null?j.baseLanes|_:_,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:u,cachePool:null,transitions:null},h.updateQueue=null,$n(Jp,mo),mo|=u,null;h.memoizedState={baseLanes:0,cachePool:null,transitions:null},A=j!==null?j.baseLanes:_,$n(Jp,mo),mo|=A}else j!==null?(A=j.baseLanes|_,h.memoizedState=null):A=_,$n(Jp,mo),mo|=A;return Et(u,h,I,_),h.child}function Le(u,h){var _=h.ref;(u===null&&_!==null||u!==null&&u.ref!==_)&&(h.flags|=512,h.flags|=2097152)}function bt(u,h,_,A,I){var j=pi(_)?va:Qr.current;return j=ac(h,j),al(h,I),_=ff(u,h,_,A,j,I),A=Bv(),u!==null&&!dn?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,_c(u,h,I)):(Yn&&A&&Ov(h),h.flags|=1,Et(u,h,_,I),h.child)}function Ut(u,h,_,A,I){if(pi(_)){var j=!0;lc(h)}else j=!1;if(al(h,I),h.stateNode===null)$x(u,h),m(h,_,A),E(h,_,A,I),A=!0;else if(u===null){var W=h.stateNode,oe=h.memoizedProps;W.props=oe;var me=W.context,ke=_.contextType;typeof ke=="object"&&ke!==null?ke=gs(ke):(ke=pi(_)?va:Qr.current,ke=ac(h,ke));var Je=_.getDerivedStateFromProps,nt=typeof Je=="function"||typeof W.getSnapshotBeforeUpdate=="function";nt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(oe!==A||me!==ke)&&v(h,W,A,ke),Hn=!1;var Ze=h.memoizedState;W.state=Ze,fr(h,A,W,I),me=h.memoizedState,oe!==A||Ze!==me||Ni.current||Hn?(typeof Je=="function"&&(vf(h,_,Je,A),me=h.memoizedState),(oe=Hn||Gx(h,_,oe,A,Ze,me,ke))?(nt||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(h.flags|=4194308)):(typeof W.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=A,h.memoizedState=me),W.props=A,W.state=me,W.context=ke,A=oe):(typeof W.componentDidMount=="function"&&(h.flags|=4194308),A=!1)}else{W=h.stateNode,yr(u,h),oe=h.memoizedProps,ke=h.type===h.elementType?oe:Vs(h.type,oe),W.props=ke,nt=h.pendingProps,Ze=W.context,me=_.contextType,typeof me=="object"&&me!==null?me=gs(me):(me=pi(_)?va:Qr.current,me=ac(h,me));var At=_.getDerivedStateFromProps;(Je=typeof At=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(oe!==nt||Ze!==me)&&v(h,W,A,me),Hn=!1,Ze=h.memoizedState,W.state=Ze,fr(h,A,W,I);var It=h.memoizedState;oe!==nt||Ze!==It||Ni.current||Hn?(typeof At=="function"&&(vf(h,_,At,A),It=h.memoizedState),(ke=Hn||Gx(h,_,ke,A,Ze,It,me)||!1)?(Je||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(A,It,me),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(A,It,me)),typeof W.componentDidUpdate=="function"&&(h.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof W.componentDidUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=1024),h.memoizedProps=A,h.memoizedState=It),W.props=A,W.state=It,W.context=me,A=ke):(typeof W.componentDidUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=1024),A=!1)}return cn(u,h,_,A,j,I)}function cn(u,h,_,A,I,j){Le(u,h);var W=(h.flags&128)!==0;if(!A&&!W)return I&&Iv(h,_,!1),_c(u,h,j);A=h.stateNode,$t.current=h;var oe=W&&typeof _.getDerivedStateFromError!="function"?null:A.render();return h.flags|=1,u!==null&&W?(h.child=dc(h,u.child,null,j),h.child=dc(h,null,oe,j)):Et(u,h,oe,j),h.memoizedState=A.state,I&&Iv(h,_,!0),h.child}function ln(u){var h=u.stateNode;h.pendingContext?Nv(u,h.pendingContext,h.pendingContext!==h.context):h.context&&Nv(u,h.context,!1),uf(u,h.containerInfo)}function Pn(u,h,_,A,I){return ol(),Nu(I),h.flags|=256,Et(u,h,_,A),h.child}var Mr={dehydrated:null,treeContext:null,retryLane:0};function Mn(u){return{baseLanes:u,cachePool:null,transitions:null}}function Aa(u,h,_){var A=h.pendingProps,I=Zn.current,j=!1,W=(h.flags&128)!==0,oe;if((oe=W)||(oe=u!==null&&u.memoizedState===null?!1:(I&2)!==0),oe?(j=!0,h.flags&=-129):(u===null||u.memoizedState!==null)&&(I|=1),$n(Zn,I&1),u===null)return Hp(h),u=h.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?((h.mode&1)===0?h.lanes=1:u.data==="$!"?h.lanes=8:h.lanes=1073741824,null):(W=A.children,u=A.fallback,j?(A=h.mode,j=h.child,W={mode:"hidden",children:W},(A&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=W):j=ib(W,A,0,null),u=wf(u,A,_,null),j.return=h,u.return=h,j.sibling=u,h.child=j,h.child.memoizedState=Mn(_),h.memoizedState=Mr,u):Kv(h,W));if(I=u.memoizedState,I!==null&&(oe=I.dehydrated,oe!==null))return eW(u,h,W,A,oe,I,_);if(j){j=A.fallback,W=h.mode,I=u.child,oe=I.sibling;var me={mode:"hidden",children:A.children};return(W&1)===0&&h.child!==I?(A=h.child,A.childLanes=0,A.pendingProps=me,h.deletions=null):(A=Hu(I,me),A.subtreeFlags=I.subtreeFlags&14680064),oe!==null?j=Hu(oe,j):(j=wf(j,W,_,null),j.flags|=2),j.return=h,A.return=h,A.sibling=j,h.child=A,A=j,j=h.child,W=u.child.memoizedState,W=W===null?Mn(_):{baseLanes:W.baseLanes|_,cachePool:null,transitions:W.transitions},j.memoizedState=W,j.childLanes=u.childLanes&~_,h.memoizedState=Mr,A}return j=u.child,u=j.sibling,A=Hu(j,{mode:"visible",children:A.children}),(h.mode&1)===0&&(A.lanes=_),A.return=h,A.sibling=null,u!==null&&(_=h.deletions,_===null?(h.deletions=[u],h.flags|=16):_.push(u)),h.child=A,h.memoizedState=null,A}function Kv(u,h){return h=ib({mode:"visible",children:h},u.mode,0,null),h.return=u,u.child=h}function Wx(u,h,_,A){return A!==null&&Nu(A),dc(h,u.child,null,_),u=Kv(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function eW(u,h,_,A,I,j,W){if(_)return h.flags&256?(h.flags&=-257,A=D(Error(n(422))),Wx(u,h,W,A)):h.memoizedState!==null?(h.child=u.child,h.flags|=128,null):(j=A.fallback,I=h.mode,A=ib({mode:"visible",children:A.children},I,0,null),j=wf(j,I,W,null),j.flags|=2,A.return=h,j.return=h,A.sibling=j,h.child=A,(h.mode&1)!==0&&dc(h,u.child,null,W),h.child.memoizedState=Mn(W),h.memoizedState=Mr,j);if((h.mode&1)===0)return Wx(u,h,W,null);if(I.data==="$!"){if(A=I.nextSibling&&I.nextSibling.dataset,A)var oe=A.dgst;return A=oe,j=Error(n(419)),A=D(j,A,void 0),Wx(u,h,W,A)}if(oe=(W&u.childLanes)!==0,dn||oe){if(A=vi,A!==null){switch(W&-W){case 4:I=2;break;case 16:I=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:I=32;break;case 536870912:I=268435456;break;default:I=0}I=(I&(A.suspendedLanes|W))!==0?0:I,I!==0&&I!==j.retryLane&&(j.retryLane=I,uo(u,I),Pa(A,u,I,-1))}return $M(),A=D(Error(n(421))),Wx(u,h,W,A)}return I.data==="$?"?(h.flags|=128,h.child=u.child,h=hW.bind(null,u),I._reactRetry=h,null):(u=j.treeContext,ki=pa(I.nextSibling),Jr=h,Yn=!0,Hs=null,u!==null&&(Ii[Vr++]=ht,Ii[Vr++]=Bs,Ii[Vr++]=uc,ht=u.id,Bs=u.overflow,uc=h),h=Kv(h,A.children),h.flags|=4096,h)}function hN(u,h,_){u.lanes|=h;var A=u.alternate;A!==null&&(A.lanes|=h),lf(u.return,h,_)}function NM(u,h,_,A,I){var j=u.memoizedState;j===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:A,tail:_,tailMode:I}:(j.isBackwards=h,j.rendering=null,j.renderingStartTime=0,j.last=A,j.tail=_,j.tailMode=I)}function pN(u,h,_){var A=h.pendingProps,I=A.revealOrder,j=A.tail;if(Et(u,h,A.children,_),A=Zn.current,(A&2)!==0)A=A&1|2,h.flags|=128;else{if(u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&hN(u,_,h);else if(u.tag===19)hN(u,_,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break e;for(;u.sibling===null;){if(u.return===null||u.return===h)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}A&=1}if($n(Zn,A),(h.mode&1)===0)h.memoizedState=null;else switch(I){case"forwards":for(_=h.child,I=null;_!==null;)u=_.alternate,u!==null&&fo(u)===null&&(I=_),_=_.sibling;_=I,_===null?(I=h.child,h.child=null):(I=_.sibling,_.sibling=null),NM(h,!1,I,_,j);break;case"backwards":for(_=null,I=h.child,h.child=null;I!==null;){if(u=I.alternate,u!==null&&fo(u)===null){h.child=I;break}u=I.sibling,I.sibling=_,_=I,I=u}NM(h,!0,_,null,j);break;case"together":NM(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function $x(u,h){(h.mode&1)===0&&u!==null&&(u.alternate=null,h.alternate=null,h.flags|=2)}function _c(u,h,_){if(u!==null&&(h.dependencies=u.dependencies),yf|=h.lanes,(_&h.childLanes)===0)return null;if(u!==null&&h.child!==u.child)throw Error(n(153));if(h.child!==null){for(u=h.child,_=Hu(u,u.pendingProps),h.child=_,_.return=h;u.sibling!==null;)u=u.sibling,_=_.sibling=Hu(u,u.pendingProps),_.return=h;_.sibling=null}return h.child}function tW(u,h,_){switch(h.tag){case 3:ln(h),ol();break;case 5:vc(h);break;case 1:pi(h.type)&&lc(h);break;case 4:uf(h,h.stateNode.containerInfo);break;case 10:var A=h.type._context,I=h.memoizedProps.value;$n(fc,A._currentValue),A._currentValue=I;break;case 13:if(A=h.memoizedState,A!==null)return A.dehydrated!==null?($n(Zn,Zn.current&1),h.flags|=128,null):(_&h.child.childLanes)!==0?Aa(u,h,_):($n(Zn,Zn.current&1),u=_c(u,h,_),u!==null?u.sibling:null);$n(Zn,Zn.current&1);break;case 19:if(A=(_&h.childLanes)!==0,(u.flags&128)!==0){if(A)return pN(u,h,_);h.flags|=128}if(I=h.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),$n(Zn,Zn.current),A)break;return null;case 22:case 23:return h.lanes=0,be(u,h,_)}return _c(u,h,_)}var mN,IM,gN,vN;mN=function(u,h){for(var _=h.child;_!==null;){if(_.tag===5||_.tag===6)u.appendChild(_.stateNode);else if(_.tag!==4&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===h)break;for(;_.sibling===null;){if(_.return===null||_.return===h)return;_=_.return}_.sibling.return=_.return,_=_.sibling}},IM=function(){},gN=function(u,h,_,A){var I=u.memoizedProps;if(I!==A){u=h.stateNode,Sr(vs.current);var j=null;switch(_){case"input":I=Ve(u,I),A=Ve(u,A),j=[];break;case"select":I=K({},I,{value:void 0}),A=K({},A,{value:void 0}),j=[];break;case"textarea":I=Me(u,I),A=Me(u,A),j=[];break;default:typeof I.onClick!="function"&&typeof A.onClick=="function"&&(u.onclick=Qd)}de(_,A);var W;_=null;for(ke in I)if(!A.hasOwnProperty(ke)&&I.hasOwnProperty(ke)&&I[ke]!=null)if(ke==="style"){var oe=I[ke];for(W in oe)oe.hasOwnProperty(W)&&(_||(_={}),_[W]="")}else ke!=="dangerouslySetInnerHTML"&&ke!=="children"&&ke!=="suppressContentEditableWarning"&&ke!=="suppressHydrationWarning"&&ke!=="autoFocus"&&(i.hasOwnProperty(ke)?j||(j=[]):(j=j||[]).push(ke,null));for(ke in A){var me=A[ke];if(oe=I!=null?I[ke]:void 0,A.hasOwnProperty(ke)&&me!==oe&&(me!=null||oe!=null))if(ke==="style")if(oe){for(W in oe)!oe.hasOwnProperty(W)||me&&me.hasOwnProperty(W)||(_||(_={}),_[W]="");for(W in me)me.hasOwnProperty(W)&&oe[W]!==me[W]&&(_||(_={}),_[W]=me[W])}else _||(j||(j=[]),j.push(ke,_)),_=me;else ke==="dangerouslySetInnerHTML"?(me=me?me.__html:void 0,oe=oe?oe.__html:void 0,me!=null&&oe!==me&&(j=j||[]).push(ke,me)):ke==="children"?typeof me!="string"&&typeof me!="number"||(j=j||[]).push(ke,""+me):ke!=="suppressContentEditableWarning"&&ke!=="suppressHydrationWarning"&&(i.hasOwnProperty(ke)?(me!=null&&ke==="onScroll"&&Xn("scroll",u),j||oe===me||(j=[])):(j=j||[]).push(ke,me))}_&&(j=j||[]).push("style",_);var ke=j;(h.updateQueue=ke)&&(h.flags|=4)}},vN=function(u,h,_,A){_!==A&&(h.flags|=4)};function Yv(u,h){if(!Yn)switch(u.tailMode){case"hidden":h=u.tail;for(var _=null;h!==null;)h.alternate!==null&&(_=h),h=h.sibling;_===null?u.tail=null:_.sibling=null;break;case"collapsed":_=u.tail;for(var A=null;_!==null;)_.alternate!==null&&(A=_),_=_.sibling;A===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:A.sibling=null}}function Ji(u){var h=u.alternate!==null&&u.alternate.child===u.child,_=0,A=0;if(h)for(var I=u.child;I!==null;)_|=I.lanes|I.childLanes,A|=I.subtreeFlags&14680064,A|=I.flags&14680064,I.return=u,I=I.sibling;else for(I=u.child;I!==null;)_|=I.lanes|I.childLanes,A|=I.subtreeFlags,A|=I.flags,I.return=u,I=I.sibling;return u.subtreeFlags|=A,u.childLanes=_,h}function nW(u,h,_){var A=h.pendingProps;switch(xa(h),h.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ji(h),null;case 1:return pi(h.type)&&Jd(),Ji(h),null;case 3:return A=h.stateNode,ll(),qn(Ni),qn(Qr),Uo(),A.pendingContext&&(A.context=A.pendingContext,A.pendingContext=null),(u===null||u.child===null)&&(Ru(h)?h.flags|=4:u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,Hs!==null&&(VM(Hs),Hs=null))),IM(u,h),Ji(h),null;case 5:Ou(h);var I=Sr(wa.current);if(_=h.type,u!==null&&h.stateNode!=null)gN(u,h,_,A,I),u.ref!==h.ref&&(h.flags|=512,h.flags|=2097152);else{if(!A){if(h.stateNode===null)throw Error(n(166));return Ji(h),null}if(u=Sr(vs.current),Ru(h)){A=h.stateNode,_=h.type;var j=h.memoizedProps;switch(A[Lr]=h,A[Pu]=j,u=(h.mode&1)!==0,_){case"dialog":Xn("cancel",A),Xn("close",A);break;case"iframe":case"object":case"embed":Xn("load",A);break;case"video":case"audio":for(I=0;I<\/script>",u=u.removeChild(u.firstChild)):typeof A.is=="string"?u=W.createElement(_,{is:A.is}):(u=W.createElement(_),_==="select"&&(W=u,A.multiple?W.multiple=!0:A.size&&(W.size=A.size))):u=W.createElementNS(u,_),u[Lr]=h,u[Pu]=A,mN(u,h,!1,!1),h.stateNode=u;e:{switch(W=qe(_,A),_){case"dialog":Xn("cancel",u),Xn("close",u),I=A;break;case"iframe":case"object":case"embed":Xn("load",u),I=A;break;case"video":case"audio":for(I=0;Iem&&(h.flags|=128,A=!0,Yv(j,!1),h.lanes=4194304)}else{if(!A)if(u=fo(W),u!==null){if(h.flags|=128,A=!0,_=u.updateQueue,_!==null&&(h.updateQueue=_,h.flags|=4),Yv(j,!0),j.tail===null&&j.tailMode==="hidden"&&!W.alternate&&!Yn)return Ji(h),null}else 2*ct()-j.renderingStartTime>em&&_!==1073741824&&(h.flags|=128,A=!0,Yv(j,!1),h.lanes=4194304);j.isBackwards?(W.sibling=h.child,h.child=W):(_=j.last,_!==null?_.sibling=W:h.child=W,j.last=W)}return j.tail!==null?(h=j.tail,j.rendering=h,j.tail=h.sibling,j.renderingStartTime=ct(),h.sibling=null,_=Zn.current,$n(Zn,A?_&1|2:_&1),h):(Ji(h),null);case 22:case 23:return WM(),A=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==A&&(h.flags|=8192),A&&(h.mode&1)!==0?(mo&1073741824)!==0&&(Ji(h),h.subtreeFlags&6&&(h.flags|=8192)):Ji(h),null;case 24:return null;case 25:return null}throw Error(n(156,h.tag))}function rW(u,h){switch(xa(h),h.tag){case 1:return pi(h.type)&&Jd(),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return ll(),qn(Ni),qn(Qr),Uo(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 5:return Ou(h),null;case 13:if(qn(Zn),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(n(340));ol()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return qn(Zn),null;case 4:return ll(),null;case 10:return af(h.type._context),null;case 22:case 23:return WM(),null;case 24:return null;default:return null}}var Xx=!1,es=!1,iW=typeof WeakSet=="function"?WeakSet:Set,Rt=null;function Qp(u,h){var _=u.ref;if(_!==null)if(typeof _=="function")try{_(null)}catch(A){Er(u,h,A)}else _.current=null}function kM(u,h,_){try{_()}catch(A){Er(u,h,A)}}var yN=!1;function sW(u,h){if(Cu=Ls,u=or(),Fr(u)){if("selectionStart"in u)var _={start:u.selectionStart,end:u.selectionEnd};else e:{_=(_=u.ownerDocument)&&_.defaultView||window;var A=_.getSelection&&_.getSelection();if(A&&A.rangeCount!==0){_=A.anchorNode;var I=A.anchorOffset,j=A.focusNode;A=A.focusOffset;try{_.nodeType,j.nodeType}catch{_=null;break e}var W=0,oe=-1,me=-1,ke=0,Je=0,nt=u,Ze=null;t:for(;;){for(var At;nt!==_||I!==0&&nt.nodeType!==3||(oe=W+I),nt!==j||A!==0&&nt.nodeType!==3||(me=W+A),nt.nodeType===3&&(W+=nt.nodeValue.length),(At=nt.firstChild)!==null;)Ze=nt,nt=At;for(;;){if(nt===u)break t;if(Ze===_&&++ke===I&&(oe=W),Ze===j&&++Je===A&&(me=W),(At=nt.nextSibling)!==null)break;nt=Ze,Ze=nt.parentNode}nt=At}_=oe===-1||me===-1?null:{start:oe,end:me}}else _=null}_=_||{start:0,end:0}}else _=null;for(Ev={focusedElem:u,selectionRange:_},Ls=!1,Rt=h;Rt!==null;)if(h=Rt,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,Rt=u;else for(;Rt!==null;){h=Rt;try{var It=h.alternate;if((h.flags&1024)!==0)switch(h.tag){case 0:case 11:case 15:break;case 1:if(It!==null){var Dt=It.memoizedProps,Dr=It.memoizedState,Ae=h.stateNode,ve=Ae.getSnapshotBeforeUpdate(h.elementType===h.type?Dt:Vs(h.type,Dt),Dr);Ae.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var Pe=h.stateNode.containerInfo;Pe.nodeType===1?Pe.textContent="":Pe.nodeType===9&&Pe.documentElement&&Pe.removeChild(Pe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(lt){Er(h,h.return,lt)}if(u=h.sibling,u!==null){u.return=h.return,Rt=u;break}Rt=h.return}return It=yN,yN=!1,It}function Zv(u,h,_){var A=h.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var I=A=A.next;do{if((I.tag&u)===u){var j=I.destroy;I.destroy=void 0,j!==void 0&&kM(h,_,j)}I=I.next}while(I!==A)}}function qx(u,h){if(h=h.updateQueue,h=h!==null?h.lastEffect:null,h!==null){var _=h=h.next;do{if((_.tag&u)===u){var A=_.create;_.destroy=A()}_=_.next}while(_!==h)}}function OM(u){var h=u.ref;if(h!==null){var _=u.stateNode;switch(u.tag){case 5:u=_;break;default:u=_}typeof h=="function"?h(u):h.current=u}}function xN(u){var h=u.alternate;h!==null&&(u.alternate=null,xN(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&(delete h[Lr],delete h[Pu],delete h[oc],delete h[Lp],delete h[Dp])),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function bN(u){return u.tag===5||u.tag===3||u.tag===4}function _N(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||bN(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function LM(u,h,_){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?_.nodeType===8?_.parentNode.insertBefore(u,h):_.insertBefore(u,h):(_.nodeType===8?(h=_.parentNode,h.insertBefore(u,_)):(h=_,h.appendChild(u)),_=_._reactRootContainer,_!=null||h.onclick!==null||(h.onclick=Qd));else if(A!==4&&(u=u.child,u!==null))for(LM(u,h,_),u=u.sibling;u!==null;)LM(u,h,_),u=u.sibling}function DM(u,h,_){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?_.insertBefore(u,h):_.appendChild(u);else if(A!==4&&(u=u.child,u!==null))for(DM(u,h,_),u=u.sibling;u!==null;)DM(u,h,_),u=u.sibling}var Li=null,Ta=!1;function ju(u,h,_){for(_=_.child;_!==null;)wN(u,h,_),_=_.sibling}function wN(u,h,_){if(tn&&typeof tn.onCommitFiberUnmount=="function")try{tn.onCommitFiberUnmount(wn,_)}catch{}switch(_.tag){case 5:es||Qp(_,h);case 6:var A=Li,I=Ta;Li=null,ju(u,h,_),Li=A,Ta=I,Li!==null&&(Ta?(u=Li,_=_.stateNode,u.nodeType===8?u.parentNode.removeChild(_):u.removeChild(_)):Li.removeChild(_.stateNode));break;case 18:Li!==null&&(Ta?(u=Li,_=_.stateNode,u.nodeType===8?Op(u.parentNode,_):u.nodeType===1&&Op(u,_),zd(u)):Op(Li,_.stateNode));break;case 4:A=Li,I=Ta,Li=_.stateNode.containerInfo,Ta=!0,ju(u,h,_),Li=A,Ta=I;break;case 0:case 11:case 14:case 15:if(!es&&(A=_.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){I=A=A.next;do{var j=I,W=j.destroy;j=j.tag,W!==void 0&&((j&2)!==0||(j&4)!==0)&&kM(_,h,W),I=I.next}while(I!==A)}ju(u,h,_);break;case 1:if(!es&&(Qp(_,h),A=_.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=_.memoizedProps,A.state=_.memoizedState,A.componentWillUnmount()}catch(oe){Er(_,h,oe)}ju(u,h,_);break;case 21:ju(u,h,_);break;case 22:_.mode&1?(es=(A=es)||_.memoizedState!==null,ju(u,h,_),es=A):ju(u,h,_);break;default:ju(u,h,_)}}function SN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var _=u.stateNode;_===null&&(_=u.stateNode=new iW),h.forEach(function(A){var I=pW.bind(null,u,A);_.has(A)||(_.add(A),A.then(I,I))})}}function Ca(u,h){var _=h.deletions;if(_!==null)for(var A=0;A<_.length;A++){var I=_[A];try{var j=u,W=h,oe=W;e:for(;oe!==null;){switch(oe.tag){case 5:Li=oe.stateNode,Ta=!1;break e;case 3:Li=oe.stateNode.containerInfo,Ta=!0;break e;case 4:Li=oe.stateNode.containerInfo,Ta=!0;break e}oe=oe.return}if(Li===null)throw Error(n(160));wN(j,W,I),Li=null,Ta=!1;var me=I.alternate;me!==null&&(me.return=null),I.return=null}catch(ke){Er(I,h,ke)}}if(h.subtreeFlags&12854)for(h=h.child;h!==null;)MN(h,u),h=h.sibling}function MN(u,h){var _=u.alternate,A=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:if(Ca(h,u),ul(u),A&4){try{Zv(3,u,u.return),qx(3,u)}catch(Dt){Er(u,u.return,Dt)}try{Zv(5,u,u.return)}catch(Dt){Er(u,u.return,Dt)}}break;case 1:Ca(h,u),ul(u),A&512&&_!==null&&Qp(_,_.return);break;case 5:if(Ca(h,u),ul(u),A&512&&_!==null&&Qp(_,_.return),u.flags&32){var I=u.stateNode;try{Ke(I,"")}catch(Dt){Er(u,u.return,Dt)}}if(A&4&&(I=u.stateNode,I!=null)){var j=u.memoizedProps,W=_!==null?_.memoizedProps:j,oe=u.type,me=u.updateQueue;if(u.updateQueue=null,me!==null)try{oe==="input"&&j.type==="radio"&&j.name!=null&&Ge(I,j),qe(oe,W);var ke=qe(oe,j);for(W=0;WI&&(I=W),A&=~j}if(A=I,A=ct()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*aW(A/1960))-A,10u?16:u,Fu===null)var A=!1;else{if(u=Fu,Fu=null,Jx=0,(jn&6)!==0)throw Error(n(331));var I=jn;for(jn|=4,Rt=u.current;Rt!==null;){var j=Rt,W=j.child;if((Rt.flags&16)!==0){var oe=j.deletions;if(oe!==null){for(var me=0;mect()-FM?bf(u,0):UM|=_),Ws(u,h)}function DN(u,h){h===0&&((u.mode&1)===0?h=1:(h=Dn,Dn<<=1,(Dn&130023424)===0&&(Dn=4194304)));var _=_s();u=uo(u,h),u!==null&&(Za(u,h,_),Ws(u,_))}function hW(u){var h=u.memoizedState,_=0;h!==null&&(_=h.retryLane),DN(u,_)}function pW(u,h){var _=0;switch(u.tag){case 13:var A=u.stateNode,I=u.memoizedState;I!==null&&(_=I.retryLane);break;case 19:A=u.stateNode;break;default:throw Error(n(314))}A!==null&&A.delete(h),DN(u,_)}var jN;jN=function(u,h,_){if(u!==null)if(u.memoizedProps!==h.pendingProps||Ni.current)dn=!0;else{if((u.lanes&_)===0&&(h.flags&128)===0)return dn=!1,tW(u,h,_);dn=(u.flags&131072)!==0}else dn=!1,Yn&&(h.flags&1048576)!==0&&kv(h,zp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;$x(u,h),u=h.pendingProps;var I=ac(h,Qr.current);al(h,_),I=ff(null,h,A,u,I,_);var j=Bv();return h.flags|=1,typeof I=="object"&&I!==null&&typeof I.render=="function"&&I.$$typeof===void 0?(h.tag=1,h.memoizedState=null,h.updateQueue=null,pi(A)?(j=!0,lc(h)):j=!1,h.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,un(h),I.updater=Zp,h.stateNode=I,I._reactInternals=h,E(h,A,u,_),h=cn(null,h,A,!0,j,_)):(h.tag=0,Yn&&j&&Ov(h),Et(null,h,I,_),h=h.child),h;case 16:A=h.elementType;e:{switch($x(u,h),u=h.pendingProps,I=A._init,A=I(A._payload),h.type=A,I=h.tag=gW(A),u=Vs(A,u),I){case 0:h=bt(null,h,A,u,_);break e;case 1:h=Ut(null,h,A,u,_);break e;case 11:h=ni(null,h,A,u,_);break e;case 14:h=bs(null,h,A,Vs(A.type,u),_);break e}throw Error(n(306,A,""))}return h;case 0:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Vs(A,I),bt(u,h,A,I,_);case 1:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Vs(A,I),Ut(u,h,A,I,_);case 3:e:{if(ln(h),u===null)throw Error(n(387));A=h.pendingProps,j=h.memoizedState,I=j.element,yr(u,h),fr(h,A,null,_);var W=h.memoizedState;if(A=W.element,j.isDehydrated)if(j={element:A,isDehydrated:!1,cache:W.cache,pendingSuspenseBoundaries:W.pendingSuspenseBoundaries,transitions:W.transitions},h.updateQueue.baseState=j,h.memoizedState=j,h.flags&256){I=R(Error(n(423)),h),h=Pn(u,h,A,_,I);break e}else if(A!==I){I=R(Error(n(424)),h),h=Pn(u,h,A,_,I);break e}else for(ki=pa(h.stateNode.containerInfo.firstChild),Jr=h,Yn=!0,Hs=null,_=of(h,null,A,_),h.child=_;_;)_.flags=_.flags&-3|4096,_=_.sibling;else{if(ol(),A===I){h=_c(u,h,_);break e}Et(u,h,A,_)}h=h.child}return h;case 5:return vc(h),u===null&&Hp(h),A=h.type,I=h.pendingProps,j=u!==null?u.memoizedProps:null,W=I.children,Av(A,I)?W=null:j!==null&&Av(A,j)&&(h.flags|=32),Le(u,h),Et(u,h,W,_),h.child;case 6:return u===null&&Hp(h),null;case 13:return Aa(u,h,_);case 4:return uf(h,h.stateNode.containerInfo),A=h.pendingProps,u===null?h.child=dc(h,null,A,_):Et(u,h,A,_),h.child;case 11:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Vs(A,I),ni(u,h,A,I,_);case 7:return Et(u,h,h.pendingProps,_),h.child;case 8:return Et(u,h,h.pendingProps.children,_),h.child;case 12:return Et(u,h,h.pendingProps.children,_),h.child;case 10:e:{if(A=h.type._context,I=h.pendingProps,j=h.memoizedProps,W=I.value,$n(fc,A._currentValue),A._currentValue=W,j!==null)if(hs(j.value,W)){if(j.children===I.children&&!Ni.current){h=_c(u,h,_);break e}}else for(j=h.child,j!==null&&(j.return=h);j!==null;){var oe=j.dependencies;if(oe!==null){W=j.child;for(var me=oe.firstContext;me!==null;){if(me.context===A){if(j.tag===1){me=Vn(-1,_&-_),me.tag=2;var ke=j.updateQueue;if(ke!==null){ke=ke.shared;var Je=ke.pending;Je===null?me.next=me:(me.next=Je.next,Je.next=me),ke.pending=me}}j.lanes|=_,me=j.alternate,me!==null&&(me.lanes|=_),lf(j.return,_,h),oe.lanes|=_;break}me=me.next}}else if(j.tag===10)W=j.type===h.type?null:j.child;else if(j.tag===18){if(W=j.return,W===null)throw Error(n(341));W.lanes|=_,oe=W.alternate,oe!==null&&(oe.lanes|=_),lf(W,_,h),W=j.sibling}else W=j.child;if(W!==null)W.return=j;else for(W=j;W!==null;){if(W===h){W=null;break}if(j=W.sibling,j!==null){j.return=W.return,W=j;break}W=W.return}j=W}Et(u,h,I.children,_),h=h.child}return h;case 9:return I=h.type,A=h.pendingProps.children,al(h,_),I=gs(I),A=A(I),h.flags|=1,Et(u,h,A,_),h.child;case 14:return A=h.type,I=Vs(A,h.pendingProps),I=Vs(A.type,I),bs(u,h,A,I,_);case 15:return Re(u,h,h.type,h.pendingProps,_);case 17:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Vs(A,I),$x(u,h),h.tag=1,pi(A)?(u=!0,lc(h)):u=!1,al(h,_),m(h,A,I),E(h,A,I,_),cn(null,h,A,!0,u,_);case 19:return pN(u,h,_);case 22:return be(u,h,_)}throw Error(n(156,h.tag))};function UN(u,h){return Ne(u,h)}function mW(u,h,_,A){this.tag=u,this.key=_,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=h,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 Bo(u,h,_,A){return new mW(u,h,_,A)}function XM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function gW(u){if(typeof u=="function")return XM(u)?1:0;if(u!=null){if(u=u.$$typeof,u===H)return 11;if(u===pe)return 14}return 2}function Hu(u,h){var _=u.alternate;return _===null?(_=Bo(u.tag,h,u.key,u.mode),_.elementType=u.elementType,_.type=u.type,_.stateNode=u.stateNode,_.alternate=u,u.alternate=_):(_.pendingProps=h,_.type=u.type,_.flags=0,_.subtreeFlags=0,_.deletions=null),_.flags=u.flags&14680064,_.childLanes=u.childLanes,_.lanes=u.lanes,_.child=u.child,_.memoizedProps=u.memoizedProps,_.memoizedState=u.memoizedState,_.updateQueue=u.updateQueue,h=u.dependencies,_.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},_.sibling=u.sibling,_.index=u.index,_.ref=u.ref,_}function rb(u,h,_,A,I,j){var W=2;if(A=u,typeof u=="function")XM(u)&&(W=1);else if(typeof u=="string")W=5;else e:switch(u){case L:return wf(_.children,I,j,h);case F:W=8,I|=8;break;case G:return u=Bo(12,_,h,I|2),u.elementType=G,u.lanes=j,u;case te:return u=Bo(13,_,h,I),u.elementType=te,u.lanes=j,u;case ee:return u=Bo(19,_,h,I),u.elementType=ee,u.lanes=j,u;case fe:return ib(_,I,j,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:W=10;break e;case U:W=9;break e;case H:W=11;break e;case pe:W=14;break e;case ie:W=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=Bo(W,_,h,I),h.elementType=u,h.type=A,h.lanes=j,h}function wf(u,h,_,A){return u=Bo(7,u,A,h),u.lanes=_,u}function ib(u,h,_,A){return u=Bo(22,u,A,h),u.elementType=fe,u.lanes=_,u.stateNode={isHidden:!1},u}function qM(u,h,_){return u=Bo(6,u,null,h),u.lanes=_,u}function KM(u,h,_){return h=Bo(4,u.children!==null?u.children:[],u.key,h),h.lanes=_,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function vW(u,h,_,A,I){this.tag=h,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Dd(0),this.expirationTimes=Dd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dd(0),this.identifierPrefix=A,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function YM(u,h,_,A,I,j,W,oe,me){return u=new vW(u,h,_,oe,me),h===1?(h=1,j===!0&&(h|=8)):h=0,j=Bo(3,null,null,h),u.current=j,j.stateNode=u,j.memoizedState={element:A,isDehydrated:_,cache:null,transitions:null,pendingSuspenseBoundaries:null},un(j),u}function yW(u,h,_){var A=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),rE.exports=IW(),rE.exports}var JN;function kW(){if(JN)return fb;JN=1;var t=qU();return fb.createRoot=t.createRoot,fb.hydrateRoot=t.hydrateRoot,fb}var OW=kW();const LW=G1(OW);var Gy=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},fh,dd,og,jU,DW=(jU=class extends Gy{constructor(){super();Yt(this,fh);Yt(this,dd);Yt(this,og);Tt(this,og,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ge(this,dd)||this.setEventListener(ge(this,og))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,dd))==null||e.call(this),Tt(this,dd,void 0))}setEventListener(e){var n;Tt(this,og,e),(n=ge(this,dd))==null||n.call(this),Tt(this,dd,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ge(this,fh)!==e&&(Tt(this,fh,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ge(this,fh)=="boolean"?ge(this,fh):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},fh=new WeakMap,dd=new WeakMap,og=new WeakMap,jU),_P=new DW,jW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},fd,bP,UU,UW=(UU=class{constructor(){Yt(this,fd,jW);Yt(this,bP,!1)}setTimeoutProvider(t){Tt(this,fd,t)}setTimeout(t,e){return ge(this,fd).setTimeout(t,e)}clearTimeout(t){ge(this,fd).clearTimeout(t)}setInterval(t,e){return ge(this,fd).setInterval(t,e)}clearInterval(t){ge(this,fd).clearInterval(t)}},fd=new WeakMap,bP=new WeakMap,UU),eh=new UW;function FW(t){setTimeout(t,0)}var zW=typeof window>"u"||"Deno"in globalThis;function Ys(){}function BW(t,e){return typeof t=="function"?t(e):t}function xT(t){return typeof t=="number"&&t>=0&&t!==1/0}function KU(t,e){return Math.max(t+(e||0)-Date.now(),0)}function bd(t,e){return typeof t=="function"?t(e):t}function bo(t,e){return typeof t=="function"?t(e):t}function eI(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==wP(o,e.options))return!1}else if(!sy(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function tI(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(iy(e.options.mutationKey)!==iy(s))return!1}else if(!sy(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function wP(t,e){return((e==null?void 0:e.queryKeyHashFn)||iy)(t)}function iy(t){return JSON.stringify(t,(e,n)=>_T(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function sy(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>sy(t[n],e[n])):!1}var HW=Object.prototype.hasOwnProperty;function YU(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=nI(t)&&nI(e);if(!r&&!(_T(t)&&_T(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let c=0;for(let d=0;d{eh.setTimeout(e,t)})}function wT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?YU(t,e):e}function GW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function WW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var SP=Symbol();function ZU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===SP?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function QU(t,e){return typeof t=="function"?t(...e):!!t}function $W(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var oy=(()=>{let t=()=>zW;return{isServer(){return t()},setIsServer(e){t=e}}})();function ST(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var XW=FW;function qW(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=XW;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Bi=qW(),ag,hd,lg,FU,KW=(FU=class extends Gy{constructor(){super();Yt(this,ag,!0);Yt(this,hd);Yt(this,lg);Tt(this,lg,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ge(this,hd)||this.setEventListener(ge(this,lg))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,hd))==null||e.call(this),Tt(this,hd,void 0))}setEventListener(e){var n;Tt(this,lg,e),(n=ge(this,hd))==null||n.call(this),Tt(this,hd,e(this.setOnline.bind(this)))}setOnline(e){ge(this,ag)!==e&&(Tt(this,ag,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ge(this,ag)}},ag=new WeakMap,hd=new WeakMap,lg=new WeakMap,FU),ew=new KW;function YW(t){return Math.min(1e3*2**t,3e4)}function JU(t){return(t??"online")==="online"?ew.isOnline():!0}var MT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function eF(t){let e=!1,n=0,r;const i=ST(),s=()=>i.status!=="pending",o=S=>{var w;if(!s()){const b=new MT(S);g(b),(w=t.onCancel)==null||w.call(t,b)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>_P.isFocused()&&(t.networkMode==="always"||ew.isOnline())&&t.canRun(),d=()=>JU(t.networkMode)&&t.canRun(),f=S=>{s()||(r==null||r(),i.resolve(S))},g=S=>{s()||(r==null||r(),i.reject(S))},y=()=>new Promise(S=>{var w;r=b=>{(s()||c())&&S(b)},(w=t.onPause)==null||w.call(t)}).then(()=>{var S;r=void 0,s()||(S=t.onContinue)==null||S.call(t)}),x=()=>{if(s())return;let S;const w=n===0?t.initialPromise:void 0;try{S=w??t.fn()}catch(b){S=Promise.reject(b)}Promise.resolve(S).then(f).catch(b=>{var N;if(s())return;const M=t.retry??(oy.isServer()?0:3),T=t.retryDelay??YW,C=typeof T=="function"?T(n,b):T,O=M===!0||typeof M=="number"&&nc()?void 0:y()).then(()=>{e?g(b):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?x():y().then(x),i)}}var hh,zU,tF=(zU=class{constructor(){Yt(this,hh)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),xT(this.gcTime)&&Tt(this,hh,eh.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(oy.isServer()?1/0:300*1e3))}clearGcTimeout(){ge(this,hh)!==void 0&&(eh.clearTimeout(ge(this,hh)),Tt(this,hh,void 0))}},hh=new WeakMap,zU);function ZW(t){return{onFetch:(e,n)=>{var d,f,g,y,x;const r=e.options,i=(g=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:g.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let S=!1;const w=T=>{$W(T,()=>e.signal,()=>S=!0)},b=ZU(e.options,e.fetchOptions),M=async(T,C,O)=>{if(S)return Promise.reject(e.signal.reason);if(C==null&&T.pages.length)return Promise.resolve(T);const L=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:C,direction:O?"backward":"forward",meta:e.options.meta};return w(U),U})(),F=await b(L),{maxPages:G}=e.options,k=O?WW:GW;return{pages:k(T.pages,F,G),pageParams:k(T.pageParams,C,G)}};if(i&&s.length){const T=i==="backward",C=T?QW:iI,O={pages:s,pageParams:o},N=C(r,O);a=await M(O,N,T)}else{const T=t??s.length;do{const C=l===0?o[0]??r.initialPageParam:iI(r,a);if(l>0&&C==null)break;a=await M(a,C),l++}while(l{var S,w;return(w=(S=e.options).persister)==null?void 0:w.call(S,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function iI(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function QW(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var cg,ph,ug,Xo,mh,bi,Fy,gh,xo,nF,Rc,BU,JW=(BU=class extends tF{constructor(e){super();Yt(this,xo);Yt(this,cg);Yt(this,ph);Yt(this,ug);Yt(this,Xo);Yt(this,mh);Yt(this,bi);Yt(this,Fy);Yt(this,gh);Tt(this,gh,!1),Tt(this,Fy,e.defaultOptions),this.setOptions(e.options),this.observers=[],Tt(this,mh,e.client),Tt(this,Xo,ge(this,mh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Tt(this,ph,oI(this.options)),this.state=e.state??ge(this,ph),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return ge(this,cg)}get promise(){var e;return(e=ge(this,bi))==null?void 0:e.promise}setOptions(e){if(this.options={...ge(this,Fy),...e},e!=null&&e._type&&Tt(this,cg,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=oI(this.options);n.data!==void 0&&(this.setState(sI(n.data,n.dataUpdatedAt)),Tt(this,ph,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ge(this,Xo).remove(this)}setData(e,n){const r=wT(this.state.data,e,this.options);return En(this,xo,Rc).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){En(this,xo,Rc).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=ge(this,bi))==null?void 0:r.promise;return(i=ge(this,bi))==null||i.cancel(e),n?n.then(Ys).catch(Ys):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return ge(this,ph)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>bo(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===SP||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>bd(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!KU(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,bi))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,bi))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ge(this,Xo).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(ge(this,bi)&&(ge(this,gh)||En(this,xo,nF).call(this)?ge(this,bi).cancel({revert:!0}):ge(this,bi).cancelRetry()),this.scheduleGc()),ge(this,Xo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||En(this,xo,Rc).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,g,y,x,S,w,b,M,T;if(this.state.fetchStatus!=="idle"&&((c=ge(this,bi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ge(this,bi))return ge(this,bi).continueRetry(),ge(this,bi).promise}if(e&&this.setOptions(e),!this.options.queryFn){const C=this.observers.find(O=>O.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,i=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(Tt(this,gh,!0),r.signal)})},s=()=>{const C=ZU(this.options,n),N=(()=>{const L={client:ge(this,mh),queryKey:this.queryKey,meta:this.meta};return i(L),L})();return Tt(this,gh,!1),this.options.persister?this.options.persister(C,N,this):C(N)},a=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ge(this,mh),state:this.state,fetchFn:s};return i(C),C})(),l=ge(this,cg)==="infinite"?ZW(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),Tt(this,ug,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&En(this,xo,Rc).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),Tt(this,bi,eF({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:C=>{C instanceof MT&&C.revert&&this.setState({...ge(this,ug),fetchStatus:"idle"}),r.abort()},onFail:(C,O)=>{En(this,xo,Rc).call(this,{type:"failed",failureCount:C,error:O})},onPause:()=>{En(this,xo,Rc).call(this,{type:"pause"})},onContinue:()=>{En(this,xo,Rc).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const C=await ge(this,bi).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(y=(g=ge(this,Xo).config).onSuccess)==null||y.call(g,C,this),(S=(x=ge(this,Xo).config).onSettled)==null||S.call(x,C,this.state.error,this),C}catch(C){if(C instanceof MT){if(C.silent)return ge(this,bi).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw En(this,xo,Rc).call(this,{type:"error",error:C}),(b=(w=ge(this,Xo).config).onError)==null||b.call(w,C,this),(T=(M=ge(this,Xo).config).onSettled)==null||T.call(M,this.state.data,C,this),C}finally{this.scheduleGc()}}},cg=new WeakMap,ph=new WeakMap,ug=new WeakMap,Xo=new WeakMap,mh=new WeakMap,bi=new WeakMap,Fy=new WeakMap,gh=new WeakMap,xo=new WeakSet,nF=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Rc=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...rF(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...sI(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Tt(this,ug,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Bi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ge(this,Xo).notify({query:this,type:"updated",action:e})})},BU);function rF(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:JU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function sI(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function oI(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ks,Rn,zy,Ms,vh,dg,Oc,pd,By,fg,hg,yh,xh,md,pg,Gn,F0,ET,AT,TT,CT,PT,RT,NT,iF,HU,e8=(HU=class extends Gy{constructor(e,n){super();Yt(this,Gn);Yt(this,Ks);Yt(this,Rn);Yt(this,zy);Yt(this,Ms);Yt(this,vh);Yt(this,dg);Yt(this,Oc);Yt(this,pd);Yt(this,By);Yt(this,fg);Yt(this,hg);Yt(this,yh);Yt(this,xh);Yt(this,md);Yt(this,pg,new Set);this.options=n,Tt(this,Ks,e),Tt(this,pd,null),Tt(this,Oc,ST()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ge(this,Rn).addObserver(this),aI(ge(this,Rn),this.options)?En(this,Gn,F0).call(this):this.updateResult(),En(this,Gn,CT).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return IT(ge(this,Rn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return IT(ge(this,Rn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,En(this,Gn,PT).call(this),En(this,Gn,RT).call(this),ge(this,Rn).removeObserver(this)}setOptions(e){const n=this.options,r=ge(this,Rn);if(this.options=ge(this,Ks).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof bo(this.options.enabled,ge(this,Rn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");En(this,Gn,NT).call(this),ge(this,Rn).setOptions(this.options),n._defaulted&&!bT(this.options,n)&&ge(this,Ks).getQueryCache().notify({type:"observerOptionsUpdated",query:ge(this,Rn),observer:this});const i=this.hasListeners();i&&lI(ge(this,Rn),r,this.options,n)&&En(this,Gn,F0).call(this),this.updateResult(),i&&(ge(this,Rn)!==r||bo(this.options.enabled,ge(this,Rn))!==bo(n.enabled,ge(this,Rn))||bd(this.options.staleTime,ge(this,Rn))!==bd(n.staleTime,ge(this,Rn)))&&En(this,Gn,ET).call(this);const s=En(this,Gn,AT).call(this);i&&(ge(this,Rn)!==r||bo(this.options.enabled,ge(this,Rn))!==bo(n.enabled,ge(this,Rn))||s!==ge(this,md))&&En(this,Gn,TT).call(this,s)}getOptimisticResult(e){const n=ge(this,Ks).getQueryCache().build(ge(this,Ks),e),r=this.createResult(n,e);return n8(this,r)&&(Tt(this,Ms,r),Tt(this,dg,this.options),Tt(this,vh,ge(this,Rn).state)),r}getCurrentResult(){return ge(this,Ms)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&ge(this,Oc).status==="pending"&&ge(this,Oc).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){ge(this,pg).add(e)}getCurrentQuery(){return ge(this,Rn)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=ge(this,Ks).defaultQueryOptions(e),r=ge(this,Ks).getQueryCache().build(ge(this,Ks),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return En(this,Gn,F0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),ge(this,Ms)))}createResult(e,n){var G;const r=ge(this,Rn),i=this.options,s=ge(this,Ms),o=ge(this,vh),a=ge(this,dg),c=e!==r?e.state:ge(this,zy),{state:d}=e;let f={...d},g=!1,y;if(n._optimisticResults){const k=this.hasListeners(),U=!k&&aI(e,n),H=k&&lI(e,r,n,i);(U||H)&&(f={...f,...rF(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:w}=f;y=f.data;let b=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(k=s.data,b=!0):k=typeof n.placeholderData=="function"?n.placeholderData((G=ge(this,hg))==null?void 0:G.state.data,ge(this,hg)):n.placeholderData,k!==void 0&&(w="success",y=wT(s==null?void 0:s.data,k,n),g=!0)}if(n.select&&y!==void 0&&!b)if(s&&y===(o==null?void 0:o.data)&&n.select===ge(this,By))y=ge(this,fg);else try{Tt(this,By,n.select),y=n.select(y),y=wT(s==null?void 0:s.data,y,n),Tt(this,fg,y),Tt(this,pd,null)}catch(k){Tt(this,pd,k)}ge(this,pd)&&(x=ge(this,pd),y=ge(this,fg),S=Date.now(),w="error");const M=f.fetchStatus==="fetching",T=w==="pending",C=w==="error",O=T&&M,N=y!==void 0,F={status:w,fetchStatus:f.fetchStatus,isPending:T,isSuccess:w==="success",isError:C,isInitialLoading:O,isLoading:O,data:y,dataUpdatedAt:f.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:M,isRefetching:M&&!T,isLoadingError:C&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:C&&N,isStale:MP(e,n),refetch:this.refetch,promise:ge(this,Oc),isEnabled:bo(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=F.data!==void 0,U=F.status==="error"&&!k,H=pe=>{U?pe.reject(F.error):k&&pe.resolve(F.data)},te=()=>{const pe=Tt(this,Oc,F.promise=ST());H(pe)},ee=ge(this,Oc);switch(ee.status){case"pending":e.queryHash===r.queryHash&&H(ee);break;case"fulfilled":(U||F.data!==ee.value)&&te();break;case"rejected":(!U||F.error!==ee.reason)&&te();break}}return F}updateResult(){const e=ge(this,Ms),n=this.createResult(ge(this,Rn),this.options);if(Tt(this,vh,ge(this,Rn).state),Tt(this,dg,this.options),ge(this,vh).data!==void 0&&Tt(this,hg,ge(this,Rn)),bT(n,e))return;Tt(this,Ms,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!ge(this,pg).size)return!0;const o=new Set(s??ge(this,pg));return this.options.throwOnError&&o.add("error"),Object.keys(ge(this,Ms)).some(a=>{const l=a;return ge(this,Ms)[l]!==e[l]&&o.has(l)})};En(this,Gn,iF).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&En(this,Gn,CT).call(this)}},Ks=new WeakMap,Rn=new WeakMap,zy=new WeakMap,Ms=new WeakMap,vh=new WeakMap,dg=new WeakMap,Oc=new WeakMap,pd=new WeakMap,By=new WeakMap,fg=new WeakMap,hg=new WeakMap,yh=new WeakMap,xh=new WeakMap,md=new WeakMap,pg=new WeakMap,Gn=new WeakSet,F0=function(e){En(this,Gn,NT).call(this);let n=ge(this,Rn).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Ys)),n},ET=function(){En(this,Gn,PT).call(this);const e=bd(this.options.staleTime,ge(this,Rn));if(oy.isServer()||ge(this,Ms).isStale||!xT(e))return;const r=KU(ge(this,Ms).dataUpdatedAt,e)+1;Tt(this,yh,eh.setTimeout(()=>{ge(this,Ms).isStale||this.updateResult()},r))},AT=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ge(this,Rn)):this.options.refetchInterval)??!1},TT=function(e){En(this,Gn,RT).call(this),Tt(this,md,e),!(oy.isServer()||bo(this.options.enabled,ge(this,Rn))===!1||!xT(ge(this,md))||ge(this,md)===0)&&Tt(this,xh,eh.setInterval(()=>{(this.options.refetchIntervalInBackground||_P.isFocused())&&En(this,Gn,F0).call(this)},ge(this,md)))},CT=function(){En(this,Gn,ET).call(this),En(this,Gn,TT).call(this,En(this,Gn,AT).call(this))},PT=function(){ge(this,yh)!==void 0&&(eh.clearTimeout(ge(this,yh)),Tt(this,yh,void 0))},RT=function(){ge(this,xh)!==void 0&&(eh.clearInterval(ge(this,xh)),Tt(this,xh,void 0))},NT=function(){const e=ge(this,Ks).getQueryCache().build(ge(this,Ks),this.options);if(e===ge(this,Rn))return;const n=ge(this,Rn);Tt(this,Rn,e),Tt(this,zy,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},iF=function(e){Bi.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(ge(this,Ms))}),ge(this,Ks).getQueryCache().notify({query:ge(this,Rn),type:"observerResultsUpdated"})})},HU);function t8(t,e){return bo(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&bo(e.retryOnMount,t)===!1)}function aI(t,e){return t8(t,e)||t.state.data!==void 0&&IT(t,e,e.refetchOnMount)}function IT(t,e,n){if(bo(e.enabled,t)!==!1&&bd(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&MP(t,e)}return!1}function lI(t,e,n,r){return(t!==e||bo(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&MP(t,n)}function MP(t,e){return bo(e.enabled,t)!==!1&&t.isStaleByTime(bd(e.staleTime,t))}function n8(t,e){return!bT(t.getCurrentResult(),e)}var Hy,yl,is,bh,xl,sd,VU,r8=(VU=class extends tF{constructor(e){super();Yt(this,xl);Yt(this,Hy);Yt(this,yl);Yt(this,is);Yt(this,bh);Tt(this,Hy,e.client),this.mutationId=e.mutationId,Tt(this,is,e.mutationCache),Tt(this,yl,[]),this.state=e.state||i8(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ge(this,yl).includes(e)||(ge(this,yl).push(e),this.clearGcTimeout(),ge(this,is).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Tt(this,yl,ge(this,yl).filter(n=>n!==e)),this.scheduleGc(),ge(this,is).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ge(this,yl).length||(this.state.status==="pending"?this.scheduleGc():ge(this,is).remove(this))}continue(){var e;return((e=ge(this,bh))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,d,f,g,y,x,S,w,b,M,T,C,O,N,L;const n=()=>{En(this,xl,sd).call(this,{type:"continue"})},r={client:ge(this,Hy),meta:this.options.meta,mutationKey:this.options.mutationKey};Tt(this,bh,eF({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(F,G)=>{En(this,xl,sd).call(this,{type:"failed",failureCount:F,error:G})},onPause:()=>{En(this,xl,sd).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ge(this,is).canRun(this)}));const i=this.state.status==="pending",s=!ge(this,bh).canStart();try{if(i)n();else{En(this,xl,sd).call(this,{type:"pending",variables:e,isPaused:s}),ge(this,is).config.onMutate&&await ge(this,is).config.onMutate(e,this,r);const G=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));G!==this.state.context&&En(this,xl,sd).call(this,{type:"pending",context:G,variables:e,isPaused:s})}const F=await ge(this,bh).start();return await((c=(l=ge(this,is).config).onSuccess)==null?void 0:c.call(l,F,e,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,F,e,this.state.context,r)),await((y=(g=ge(this,is).config).onSettled)==null?void 0:y.call(g,F,null,this.state.variables,this.state.context,this,r)),await((S=(x=this.options).onSettled)==null?void 0:S.call(x,F,null,e,this.state.context,r)),En(this,xl,sd).call(this,{type:"success",data:F}),F}catch(F){try{await((b=(w=ge(this,is).config).onError)==null?void 0:b.call(w,F,e,this.state.context,this,r))}catch(G){Promise.reject(G)}try{await((T=(M=this.options).onError)==null?void 0:T.call(M,F,e,this.state.context,r))}catch(G){Promise.reject(G)}try{await((O=(C=ge(this,is).config).onSettled)==null?void 0:O.call(C,void 0,F,this.state.variables,this.state.context,this,r))}catch(G){Promise.reject(G)}try{await((L=(N=this.options).onSettled)==null?void 0:L.call(N,void 0,F,e,this.state.context,r))}catch(G){Promise.reject(G)}throw En(this,xl,sd).call(this,{type:"error",error:F}),F}finally{ge(this,is).runNext(this)}}},Hy=new WeakMap,yl=new WeakMap,is=new WeakMap,bh=new WeakMap,xl=new WeakSet,sd=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Bi.batch(()=>{ge(this,yl).forEach(r=>{r.onMutationUpdate(e)}),ge(this,is).notify({mutation:this,type:"updated",action:e})})},VU);function i8(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Lc,Da,Vy,GU,s8=(GU=class extends Gy{constructor(e={}){super();Yt(this,Lc);Yt(this,Da);Yt(this,Vy);this.config=e,Tt(this,Lc,new Set),Tt(this,Da,new Map),Tt(this,Vy,0)}build(e,n,r){const i=new r8({client:e,mutationCache:this,mutationId:++db(this,Vy)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){ge(this,Lc).add(e);const n=hb(e);if(typeof n=="string"){const r=ge(this,Da).get(n);r?r.push(e):ge(this,Da).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ge(this,Lc).delete(e)){const n=hb(e);if(typeof n=="string"){const r=ge(this,Da).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&ge(this,Da).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=hb(e);if(typeof n=="string"){const r=ge(this,Da).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=hb(e);if(typeof n=="string"){const i=(r=ge(this,Da).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Bi.batch(()=>{ge(this,Lc).forEach(e=>{this.notify({type:"removed",mutation:e})}),ge(this,Lc).clear(),ge(this,Da).clear()})}getAll(){return Array.from(ge(this,Lc))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>tI(n,r))}findAll(e={}){return this.getAll().filter(n=>tI(e,n))}notify(e){Bi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Bi.batch(()=>Promise.all(e.map(n=>n.continue().catch(Ys))))}},Lc=new WeakMap,Da=new WeakMap,Vy=new WeakMap,GU);function hb(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,WU,o8=(WU=class extends Gy{constructor(e={}){super();Yt(this,bl);this.config=e,Tt(this,bl,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??wP(i,n);let o=this.get(s);return o||(o=new JW({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){ge(this,bl).has(e.queryHash)||(ge(this,bl).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ge(this,bl).get(e.queryHash);n&&(e.destroy(),n===e&&ge(this,bl).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Bi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ge(this,bl).get(e)}getAll(){return[...ge(this,bl).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>eI(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>eI(e,r)):n}notify(e){Bi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Bi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Bi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bl=new WeakMap,WU),Tr,gd,vd,mg,gg,yd,vg,yg,$U,a8=($U=class{constructor(t={}){Yt(this,Tr);Yt(this,gd);Yt(this,vd);Yt(this,mg);Yt(this,gg);Yt(this,yd);Yt(this,vg);Yt(this,yg);Tt(this,Tr,t.queryCache||new o8),Tt(this,gd,t.mutationCache||new s8),Tt(this,vd,t.defaultOptions||{}),Tt(this,mg,new Map),Tt(this,gg,new Map),Tt(this,yd,0)}mount(){db(this,yd)._++,ge(this,yd)===1&&(Tt(this,vg,_P.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Tr).onFocus())})),Tt(this,yg,ew.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Tr).onOnline())})))}unmount(){var t,e;db(this,yd)._--,ge(this,yd)===0&&((t=ge(this,vg))==null||t.call(this),Tt(this,vg,void 0),(e=ge(this,yg))==null||e.call(this),Tt(this,yg,void 0))}isFetching(t){return ge(this,Tr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ge(this,gd).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Tr).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=ge(this,Tr).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(bd(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return ge(this,Tr).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=ge(this,Tr).get(r.queryHash),s=i==null?void 0:i.state.data,o=BW(e,s);if(o!==void 0)return ge(this,Tr).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Bi.batch(()=>ge(this,Tr).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Tr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ge(this,Tr);Bi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ge(this,Tr);return Bi.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Bi.batch(()=>ge(this,Tr).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Ys).catch(Ys)}invalidateQueries(t,e={}){return Bi.batch(()=>(ge(this,Tr).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Bi.batch(()=>ge(this,Tr).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Ys)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Ys)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ge(this,Tr).build(this,e);return n.isStaleByTime(bd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Ys).catch(Ys)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Ys).catch(Ys)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return ew.isOnline()?ge(this,gd).resumePausedMutations():Promise.resolve()}getQueryCache(){return ge(this,Tr)}getMutationCache(){return ge(this,gd)}getDefaultOptions(){return ge(this,vd)}setDefaultOptions(t){Tt(this,vd,t)}setQueryDefaults(t,e){ge(this,mg).set(iy(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ge(this,mg).values()],n={};return e.forEach(r=>{sy(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){ge(this,gg).set(iy(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ge(this,gg).values()],n={};return e.forEach(r=>{sy(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ge(this,vd).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=wP(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===SP&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ge(this,vd).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ge(this,Tr).clear(),ge(this,gd).clear()}},Tr=new WeakMap,gd=new WeakMap,vd=new WeakMap,mg=new WeakMap,gg=new WeakMap,yd=new WeakMap,vg=new WeakMap,yg=new WeakMap,$U),sF=P.createContext(void 0),Rd=t=>{const e=P.useContext(sF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},l8=({client:t,children:e})=>(P.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),p.jsx(sF.Provider,{value:t,children:e})),oF=P.createContext(!1),c8=()=>P.useContext(oF);oF.Provider;function u8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var d8=P.createContext(u8()),f8=()=>P.useContext(d8),h8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?QU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},p8=t=>{P.useEffect(()=>{t.clearReset()},[t])},m8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||QU(n,[t.error,r])),g8=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},v8=(t,e)=>t.isLoading&&t.isFetching&&!e,y8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,cI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function x8(t,e,n){var y,x,S,w;const r=c8(),i=f8(),s=Rd(),o=s.defaultQueryOptions(t);(x=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,o);const a=s.getQueryCache().get(o.queryHash),l=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,g8(o),h8(o,i,a),p8(i);const c=!s.getQueryCache().get(o.queryHash),[d]=P.useState(()=>new e(s,o)),f=d.getOptimisticResult(o),g=!r&&l;if(P.useSyncExternalStore(P.useCallback(b=>{const M=g?d.subscribe(Bi.batchCalls(b)):Ys;return d.updateResult(),M},[d,g]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),P.useEffect(()=>{d.setOptions(o)},[o,d]),y8(o,f))throw cI(o,d,i);if(m8({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((w=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,o,f),o.experimental_prefetchInRender&&!oy.isServer()&&v8(f,r)){const b=c?cI(o,d,i):a==null?void 0:a.promise;b==null||b.catch(Ys).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function ci(t,e){return x8(t,e8)}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const g8=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),sF=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** + */const b8=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),aF=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var v8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + */var _8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const y8=R.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>R.createElement("svg",{ref:l,...v8,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:sF("lucide",i),...a},[...o.map(([c,d])=>R.createElement(c,d)),...Array.isArray(s)?s:[s]]));/** + */const w8=P.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>P.createElement("svg",{ref:l,..._8,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:aF("lucide",i),...a},[...o.map(([c,d])=>P.createElement(c,d)),...Array.isArray(s)?s:[s]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const gt=(t,e)=>{const n=R.forwardRef(({className:r,...i},s)=>R.createElement(y8,{ref:s,iconNode:e,className:sF(`lucide-${g8(t)}`,r),...i}));return n.displayName=`${t}`,n};/** + */const vt=(t,e)=>{const n=P.forwardRef(({className:r,...i},s)=>P.createElement(w8,{ref:s,iconNode:e,className:aF(`lucide-${b8(t)}`,r),...i}));return n.displayName=`${t}`,n};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ay=gt("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + */const ay=vt("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ew=gt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const tw=vt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const x8=gt("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** + */const S8=vt("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PT=gt("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + */const kT=vt("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Il=gt("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + */const Il=vt("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const b8=gt("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** + */const M8=vt("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const RT=gt("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + */const OT=vt("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const W1=gt("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + */const $1=vt("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _8=gt("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** + */const E8=vt("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $o=gt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const So=vt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const w8=gt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const A8=vt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const S8=gt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const T8=vt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const oF=gt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const lF=vt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const M8=gt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + */const C8=vt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const E8=gt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const P8=vt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const A8=gt("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const R8=vt("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const T8=gt("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + */const N8=vt("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const C8=gt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + */const I8=vt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aF=gt("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + */const k8=vt("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const P8=gt("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** + */const cF=vt("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NT=gt("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const O8=vt("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const R8=gt("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** + */const LT=vt("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tw=gt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const L8=vt("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const El=gt("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const nw=vt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const N8=gt("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** + */const El=vt("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xg=gt("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const D8=vt("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bg=gt("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + */const xg=vt("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aI=gt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + */const bg=vt("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IT=gt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const uI=vt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const I8=gt("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + */const DT=vt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const k8=gt("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** + */const j8=vt("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const O8=gt("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** + */const U8=vt("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const L8=gt("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/** + */const uF=vt("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const D8=gt("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + */const F8=vt("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const iE=gt("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** + */const z8=vt("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lI=gt("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + */const oE=vt("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const j8=gt("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** + */const dI=vt("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const U8=gt("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** + */const B8=vt("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $1=gt("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + */const H8=vt("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const F8=gt("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + */const X1=vt("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const z8=gt("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** + */const V8=vt("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const B8=gt("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** + */const G8=vt("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const H8=gt("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** + */const W8=vt("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _P=gt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const $8=vt("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const V8=gt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** + */const q1=vt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const G8=gt("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** + */const X8=vt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lF=gt("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** + */const q8=vt("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const W8=gt("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** + */const K8=vt("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $8=gt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** + */const dF=vt("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const X8=gt("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + */const Y8=vt("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const q8=gt("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** + */const Z8=vt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const K8=gt("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** + */const Q8=vt("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kT=gt("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** + */const J8=vt("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OT=gt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const e9=vt("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Y8=gt("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** + */const jT=vt("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Z8=gt("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** + */const UT=vt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zf=gt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + */const t9=vt("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Q8=gt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + */const n9=vt("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const J8=gt("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** + */const Qf=vt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wP=gt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const fF=vt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const e9=gt("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** + */const r9=vt("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nw=gt("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + */const EP=vt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const t9=gt("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** + */const i9=vt("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const n9=gt("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** + */const rw=vt("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zm=gt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + */const s9=vt("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cI=gt("Shuffle",[["path",{d:"M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22",key:"1wmou1"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 6h1.9c1.5 0 2.9.9 3.6 2.2",key:"10bdb2"}],["path",{d:"M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8",key:"vgxac0"}],["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}]]);/** + */const o9=vt("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gm=gt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + */const Zm=vt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cF=gt("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** + */const fI=vt("Shuffle",[["path",{d:"M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22",key:"1wmou1"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 6h1.9c1.5 0 2.9.9 3.6 2.2",key:"10bdb2"}],["path",{d:"M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8",key:"vgxac0"}],["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const r9=gt("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** + */const a9=vt("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const uF=gt("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + */const Gm=vt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LT=gt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const hF=vt("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _g=gt("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const l9=vt("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const i9=gt("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + */const pF=vt("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DT=gt("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** + */const FT=vt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rw=gt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + */const _g=vt("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Al=gt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + */const c9=vt("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bh=gt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),jT=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:F8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:RT},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:W1},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:kT},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:Il},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:cF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:lF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:A8}];var uI=1,s9=.9,o9=.8,a9=.17,sE=.1,oE=.999,l9=.9999,c9=.99,u9=/[\\\/_+.#"@\[\(\{&]/,d9=/[\\\/_+.#"@\[\(\{&]/g,f9=/[\s-]/,dF=/[\s-]/g;function UT(t,e,n,r,i,s,o){if(s===e.length)return i===t.length?uI:c9;var a=`${i},${s}`;if(o[a]!==void 0)return o[a];for(var l=r.charAt(s),c=n.indexOf(l,i),d=0,f,m,y,x;c>=0;)f=UT(t,e,n,r,c+1,s+1,o),f>d&&(c===i?f*=uI:u9.test(t.charAt(c-1))?(f*=o9,y=t.slice(i,c-1).match(d9),y&&i>0&&(f*=Math.pow(oE,y.length))):f9.test(t.charAt(c-1))?(f*=s9,x=t.slice(i,c-1).match(dF),x&&i>0&&(f*=Math.pow(oE,x.length))):(f*=a9,i>0&&(f*=Math.pow(oE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=l9)),(ff&&(f=m*sE)),f>d&&(d=f),c=n.indexOf(l,c+1);return o[a]=d,d}function dI(t){return t.toLowerCase().replace(dF," ")}function h9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,UT(t,e,dI(t),dI(e),0,0,{})}function _d(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function fI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function wg(...t){return e=>{let n=!1;const r=t.map(i=>{const s=fI(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i{var w;const{scope:m,children:y,...x}=f,S=((w=m==null?void 0:m[t])==null?void 0:w[l])||a,_=R.useMemo(()=>x,Object.values(x));return g.jsx(S.Provider,{value:_,children:y})};c.displayName=s+"Provider";function d(f,m){var S;const y=((S=m==null?void 0:m[t])==null?void 0:S[l])||a,x=R.useContext(y);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(o=>R.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return R.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,m9(i,...e)]}function m9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var ly=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},g9=G1[" useId ".trim().toString()]||(()=>{}),v9=0;function Vc(t){const[e,n]=R.useState(g9());return ly(()=>{n(r=>r??String(v9++))},[t]),e?`radix-${e}`:""}var y9=G1[" useInsertionEffect ".trim().toString()]||ly;function x9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=b9({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=R.useRef(t!==void 0);R.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const c=R.useCallback(d=>{var f;if(a){const m=_9(d)?d(t):d;m!==t&&((f=o.current)==null||f.call(o,m))}else s(d)},[a,t,s,o]);return[l,c]}function b9({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return y9(()=>{s.current=e},[e]),R.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function _9(t){return typeof t=="function"}var X1=$U();function fF(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];hI(i)&&typeof pb=="function"&&(i=pb(i._payload)),R.Children.forEach(i,m=>{var y;if(A9(m)){a=!0;const x=m;let S="child"in x.props?x.props.child:x.props.children;hI(S)&&typeof pb=="function"&&(S=pb(S._payload)),o=S9(x,S),l.push((y=o==null?void 0:o.props)==null?void 0:y.children)}else l.push(m)}),o?o=R.cloneElement(o,void 0,l):!a&&R.Children.count(i)===1&&R.isValidElement(i)&&(o=i);const c=o?E9(o):void 0,d=qh(r,c);if(!o){if(i||i===0)throw new Error(a?R9(t):P9(t));return i}const f=M9(s,o.props??{});return o.type!==R.Fragment&&(f.ref=r?d:c),R.cloneElement(o,f)});return e.displayName=`${t}.Slot`,e}var w9=Symbol.for("radix.slottable"),S9=(t,e)=>{if("child"in t.props){const n=t.props.child;return R.isValidElement(n)?R.cloneElement(n,void 0,t.props.children(n.props.children)):null}return R.isValidElement(e)?e:null};function M9(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function E9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function A9(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===w9}var T9=Symbol.for("react.lazy");function hI(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===T9&&"_payload"in t&&C9(t._payload)}function C9(t){return typeof t=="object"&&t!==null&&"then"in t}var P9=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,R9=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,pb=G1[" use ".trim().toString()],N9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wi=N9.reduce((t,e)=>{const n=fF(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function I9(t,e){t&&X1.flushSync(()=>t.dispatchEvent(e))}function cy(t){const e=R.useRef(t);return R.useEffect(()=>{e.current=t}),R.useMemo(()=>((...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)}),[])}function k9(t,e=globalThis==null?void 0:globalThis.document){const n=cy(t);R.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var O9="DismissableLayer",FT="dismissableLayer.update",L9="dismissableLayer.pointerDownOutside",D9="dismissableLayer.focusOutside",pI,SP=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),hF=R.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,d=R.useContext(SP),[f,m]=R.useState(null),y=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=R.useState({}),S=qh(e,G=>m(G)),_=Array.from(d.layers),[w]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),E=_.indexOf(w),T=f?_.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=E,N=R.useRef(!1),L=z9(G=>{const k=G.target;if(!(k instanceof Node))return;const U=[...d.branches].some(H=>H.contains(k));!O||U||(s==null||s(G),a==null||a(G),G.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),F=B9(G=>{if(r&&N.current)return;const k=G.target;[...d.branches].some(H=>H.contains(k))||(o==null||o(G),a==null||a(G),G.defaultPrevented||l==null||l())},y);return k9(G=>{T===d.layers.size-1&&(i==null||i(G),!G.defaultPrevented&&l&&(G.preventDefault(),l()))},y),R.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(pI=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),mI(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=pI))}},[f,y,n,d]),R.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),mI())},[f,d]),R.useEffect(()=>{const G=()=>x({});return document.addEventListener(FT,G),()=>document.removeEventListener(FT,G)},[]),g.jsx(Wi.div,{...c,ref:S,style:{pointerEvents:C?O?"auto":"none":void 0,...t.style},onFocusCapture:_d(t.onFocusCapture,F.onFocusCapture),onBlurCapture:_d(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:_d(t.onPointerDownCapture,L.onPointerDownCapture)})});hF.displayName=O9;var j9="DismissableLayerBranch",U9=R.forwardRef((t,e)=>{const n=R.useContext(SP),r=R.useRef(null),i=qh(e,r);return R.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),g.jsx(Wi.div,{...t,ref:i})});U9.displayName=j9;function F9(){const t=R.useContext(SP),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function z9(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,o=cy(t),a=R.useRef(!1),l=R.useRef(!1),c=R.useRef(new Map),d=R.useRef(()=>{});return R.useEffect(()=>{function f(){l.current=!1,i.current=!1,c.current.clear()}function m(){return Array.from(c.current.values()).some(Boolean)}function y(E){if(!l.current)return;const T=E.target;T instanceof Node&&[...s].some(O=>O.contains(T))||c.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}function x(E){l.current&&c.current.set(E.type,!1)}const S=E=>{if(E.target&&!a.current){let T=function(){n.removeEventListener("click",d.current);const O=m();f(),O||pF(L9,o,C,{discrete:!0})};const C={originalEvent:E};l.current=!0,i.current=r&&E.button===0,c.current.clear(),!r||E.button!==0?T():(n.removeEventListener("click",d.current),d.current=T,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();a.current=!1},_=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const E of _)n.addEventListener(E,y,!0),n.addEventListener(E,x);const w=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(w),n.removeEventListener("pointerdown",S),n.removeEventListener("click",d.current);for(const E of _)n.removeEventListener(E,y,!0),n.removeEventListener(E,x)}},[n,o,r,i,s]),{onPointerDownCapture:()=>a.current=!0}}function B9(t,e=globalThis==null?void 0:globalThis.document){const n=cy(t),r=R.useRef(!1);return R.useEffect(()=>{const i=s=>{s.target&&!r.current&&pF(D9,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function mI(){const t=new CustomEvent(FT);document.dispatchEvent(t)}function pF(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?I9(i,s):i.dispatchEvent(s)}var aE="focusScope.autoFocusOnMount",lE="focusScope.autoFocusOnUnmount",gI={bubbles:!1,cancelable:!0},H9="FocusScope",mF=R.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=R.useState(null),c=cy(i),d=cy(s),f=R.useRef(null),m=qh(e,S=>l(S)),y=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let S=function(T){if(y.paused||!a)return;const C=T.target;a.contains(C)?f.current=C:od(f.current,{select:!0})},_=function(T){if(y.paused||!a)return;const C=T.relatedTarget;C!==null&&(a.contains(C)||od(f.current,{select:!0}))},w=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&od(a)};document.addEventListener("focusin",S),document.addEventListener("focusout",_);const E=new MutationObserver(w);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",_),E.disconnect()}}},[r,a,y.paused]),R.useEffect(()=>{if(a){yI.add(y);const S=document.activeElement;if(!a.contains(S)){const w=new CustomEvent(aE,gI);a.addEventListener(aE,c),a.dispatchEvent(w),w.defaultPrevented||(V9(q9(gF(a)),{select:!0}),document.activeElement===S&&od(a))}return()=>{a.removeEventListener(aE,c),setTimeout(()=>{const w=new CustomEvent(lE,gI);a.addEventListener(lE,d),a.dispatchEvent(w),w.defaultPrevented||od(S??document.body,{select:!0}),a.removeEventListener(lE,d),yI.remove(y)},0)}}},[a,c,d,y]);const x=R.useCallback(S=>{if(!n&&!r||y.paused)return;const _=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,w=document.activeElement;if(_&&w){const E=S.currentTarget,[T,C]=G9(E);T&&C?!S.shiftKey&&w===C?(S.preventDefault(),n&&od(T,{select:!0})):S.shiftKey&&w===T&&(S.preventDefault(),n&&od(C,{select:!0})):w===E&&S.preventDefault()}},[n,r,y.paused]);return g.jsx(Wi.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});mF.displayName=H9;function V9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(od(r,{select:e}),document.activeElement!==n)return}function G9(t){const e=gF(t),n=vI(e,t),r=vI(e.reverse(),t);return[n,r]}function gF(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function vI(t,e){for(const n of t)if(!W9(n,{upTo:e}))return n}function W9(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function $9(t){return t instanceof HTMLInputElement&&"select"in t}function od(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&$9(t)&&e&&t.select()}}var yI=X9();function X9(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=xI(t,e),t.unshift(e)},remove(e){var n;t=xI(t,e),(n=t[0])==null||n.resume()}}}function xI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function q9(t){return t.filter(e=>e.tagName!=="A")}var K9="Portal",vF=R.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=R.useState(!1);ly(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?X1.createPortal(g.jsx(Wi.div,{...r,ref:e}),o):null});vF.displayName=K9;function Y9(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}var q1=t=>{const{present:e,children:n}=t,r=Z9(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=Q9(r.ref,J9(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null};q1.displayName="Presence";function Z9(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Y9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=mb(r.current);s.current=a==="mounted"?c:"none"},[a]),ly(()=>{const c=r.current,d=i.current;if(d!==t){const m=s.current,y=mb(c);t?l("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&m!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),ly(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=mb(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&S&&(l("ANIMATION_END"),!i.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},m=y=>{y.target===e&&(s.current=mb(r.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:R.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function bI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Q9(...t){const e=R.useRef(t);return e.current=t,R.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(o=>{const a=bI(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o{dl||(dl={start:_I(),end:_I()});const{start:t,end:e}=dl;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),gb++,()=>{gb===1&&(dl==null||dl.start.remove(),dl==null||dl.end.remove(),dl=null),gb=Math.max(0,gb-1)}},[])}function _I(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var _l=function(){return _l=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return v$;var e=y$(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},b$=_F(),Qm="data-scroll-locked",_$=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),` - .`.concat(n$,` { + */const zT=vt("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iw=vt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Al=vt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _h=vt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),BT=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:V8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:OT},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:$1},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:jT},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:Il},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:hF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:dF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:R8}];var hI=1,u9=.9,d9=.8,f9=.17,aE=.1,lE=.999,h9=.9999,p9=.99,m9=/[\\\/_+.#"@\[\(\{&]/,g9=/[\\\/_+.#"@\[\(\{&]/g,v9=/[\s-]/,mF=/[\s-]/g;function HT(t,e,n,r,i,s,o){if(s===e.length)return i===t.length?hI:p9;var a=`${i},${s}`;if(o[a]!==void 0)return o[a];for(var l=r.charAt(s),c=n.indexOf(l,i),d=0,f,g,y,x;c>=0;)f=HT(t,e,n,r,c+1,s+1,o),f>d&&(c===i?f*=hI:m9.test(t.charAt(c-1))?(f*=d9,y=t.slice(i,c-1).match(g9),y&&i>0&&(f*=Math.pow(lE,y.length))):v9.test(t.charAt(c-1))?(f*=u9,x=t.slice(i,c-1).match(mF),x&&i>0&&(f*=Math.pow(lE,x.length))):(f*=f9,i>0&&(f*=Math.pow(lE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=h9)),(ff&&(f=g*aE)),f>d&&(d=f),c=n.indexOf(l,c+1);return o[a]=d,d}function pI(t){return t.toLowerCase().replace(mF," ")}function y9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,HT(t,e,pI(t),pI(e),0,0,{})}function _d(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function mI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function wg(...t){return e=>{let n=!1;const r=t.map(i=>{const s=mI(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i{var b;const{scope:g,children:y,...x}=f,S=((b=g==null?void 0:g[t])==null?void 0:b[l])||a,w=P.useMemo(()=>x,Object.values(x));return p.jsx(S.Provider,{value:w,children:y})};c.displayName=s+"Provider";function d(f,g){var S;const y=((S=g==null?void 0:g[t])==null?void 0:S[l])||a,x=P.useContext(y);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(o=>P.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return P.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,b9(i,...e)]}function b9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return P.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var ly=globalThis!=null&&globalThis.document?P.useLayoutEffect:()=>{},_9=W1[" useId ".trim().toString()]||(()=>{}),w9=0;function Vc(t){const[e,n]=P.useState(_9());return ly(()=>{n(r=>r??String(w9++))},[t]),e?`radix-${e}`:""}var S9=W1[" useInsertionEffect ".trim().toString()]||ly;function M9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=E9({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=P.useRef(t!==void 0);P.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const c=P.useCallback(d=>{var f;if(a){const g=A9(d)?d(t):d;g!==t&&((f=o.current)==null||f.call(o,g))}else s(d)},[a,t,s,o]);return[l,c]}function E9({defaultProp:t,onChange:e}){const[n,r]=P.useState(t),i=P.useRef(n),s=P.useRef(e);return S9(()=>{s.current=e},[e]),P.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function A9(t){return typeof t=="function"}var K1=qU();function gF(t){const e=P.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];gI(i)&&typeof pb=="function"&&(i=pb(i._payload)),P.Children.forEach(i,g=>{var y;if(N9(g)){a=!0;const x=g;let S="child"in x.props?x.props.child:x.props.children;gI(S)&&typeof pb=="function"&&(S=pb(S._payload)),o=C9(x,S),l.push((y=o==null?void 0:o.props)==null?void 0:y.children)}else l.push(g)}),o?o=P.cloneElement(o,void 0,l):!a&&P.Children.count(i)===1&&P.isValidElement(i)&&(o=i);const c=o?R9(o):void 0,d=qh(r,c);if(!o){if(i||i===0)throw new Error(a?L9(t):O9(t));return i}const f=P9(s,o.props??{});return o.type!==P.Fragment&&(f.ref=r?d:c),P.cloneElement(o,f)});return e.displayName=`${t}.Slot`,e}var T9=Symbol.for("radix.slottable"),C9=(t,e)=>{if("child"in t.props){const n=t.props.child;return P.isValidElement(n)?P.cloneElement(n,void 0,t.props.children(n.props.children)):null}return P.isValidElement(e)?e:null};function P9(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function R9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function N9(t){return P.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===T9}var I9=Symbol.for("react.lazy");function gI(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===I9&&"_payload"in t&&k9(t._payload)}function k9(t){return typeof t=="object"&&t!==null&&"then"in t}var O9=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,L9=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,pb=W1[" use ".trim().toString()],D9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Wi=D9.reduce((t,e)=>{const n=gF(`Primitive.${e}`),r=P.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function j9(t,e){t&&K1.flushSync(()=>t.dispatchEvent(e))}function cy(t){const e=P.useRef(t);return P.useEffect(()=>{e.current=t}),P.useMemo(()=>((...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)}),[])}function U9(t,e=globalThis==null?void 0:globalThis.document){const n=cy(t);P.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var F9="DismissableLayer",VT="dismissableLayer.update",z9="dismissableLayer.pointerDownOutside",B9="dismissableLayer.focusOutside",vI,AP=P.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),vF=P.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,d=P.useContext(AP),[f,g]=P.useState(null),y=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=P.useState({}),S=qh(e,G=>g(G)),w=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),M=w.indexOf(b),T=f?w.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=M,N=P.useRef(!1),L=W9(G=>{const k=G.target;if(!(k instanceof Node))return;const U=[...d.branches].some(H=>H.contains(k));!O||U||(s==null||s(G),a==null||a(G),G.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),F=$9(G=>{if(r&&N.current)return;const k=G.target;[...d.branches].some(H=>H.contains(k))||(o==null||o(G),a==null||a(G),G.defaultPrevented||l==null||l())},y);return U9(G=>{T===d.layers.size-1&&(i==null||i(G),!G.defaultPrevented&&l&&(G.preventDefault(),l()))},y),P.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(vI=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),yI(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=vI))}},[f,y,n,d]),P.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),yI())},[f,d]),P.useEffect(()=>{const G=()=>x({});return document.addEventListener(VT,G),()=>document.removeEventListener(VT,G)},[]),p.jsx(Wi.div,{...c,ref:S,style:{pointerEvents:C?O?"auto":"none":void 0,...t.style},onFocusCapture:_d(t.onFocusCapture,F.onFocusCapture),onBlurCapture:_d(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:_d(t.onPointerDownCapture,L.onPointerDownCapture)})});vF.displayName=F9;var H9="DismissableLayerBranch",V9=P.forwardRef((t,e)=>{const n=P.useContext(AP),r=P.useRef(null),i=qh(e,r);return P.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),p.jsx(Wi.div,{...t,ref:i})});V9.displayName=H9;function G9(){const t=P.useContext(AP),[e,n]=P.useState(null);return P.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function W9(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,o=cy(t),a=P.useRef(!1),l=P.useRef(!1),c=P.useRef(new Map),d=P.useRef(()=>{});return P.useEffect(()=>{function f(){l.current=!1,i.current=!1,c.current.clear()}function g(){return Array.from(c.current.values()).some(Boolean)}function y(M){if(!l.current)return;const T=M.target;T instanceof Node&&[...s].some(O=>O.contains(T))||c.current.set(M.type,!0),M.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}function x(M){l.current&&c.current.set(M.type,!1)}const S=M=>{if(M.target&&!a.current){let T=function(){n.removeEventListener("click",d.current);const O=g();f(),O||yF(z9,o,C,{discrete:!0})};const C={originalEvent:M};l.current=!0,i.current=r&&M.button===0,c.current.clear(),!r||M.button!==0?T():(n.removeEventListener("click",d.current),d.current=T,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();a.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const M of w)n.addEventListener(M,y,!0),n.addEventListener(M,x);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",S),n.removeEventListener("click",d.current);for(const M of w)n.removeEventListener(M,y,!0),n.removeEventListener(M,x)}},[n,o,r,i,s]),{onPointerDownCapture:()=>a.current=!0}}function $9(t,e=globalThis==null?void 0:globalThis.document){const n=cy(t),r=P.useRef(!1);return P.useEffect(()=>{const i=s=>{s.target&&!r.current&&yF(B9,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function yI(){const t=new CustomEvent(VT);document.dispatchEvent(t)}function yF(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?j9(i,s):i.dispatchEvent(s)}var cE="focusScope.autoFocusOnMount",uE="focusScope.autoFocusOnUnmount",xI={bubbles:!1,cancelable:!0},X9="FocusScope",xF=P.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=P.useState(null),c=cy(i),d=cy(s),f=P.useRef(null),g=qh(e,S=>l(S)),y=P.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;P.useEffect(()=>{if(r){let S=function(T){if(y.paused||!a)return;const C=T.target;a.contains(C)?f.current=C:od(f.current,{select:!0})},w=function(T){if(y.paused||!a)return;const C=T.relatedTarget;C!==null&&(a.contains(C)||od(f.current,{select:!0}))},b=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&od(a)};document.addEventListener("focusin",S),document.addEventListener("focusout",w);const M=new MutationObserver(b);return a&&M.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",w),M.disconnect()}}},[r,a,y.paused]),P.useEffect(()=>{if(a){_I.add(y);const S=document.activeElement;if(!a.contains(S)){const b=new CustomEvent(cE,xI);a.addEventListener(cE,c),a.dispatchEvent(b),b.defaultPrevented||(q9(J9(bF(a)),{select:!0}),document.activeElement===S&&od(a))}return()=>{a.removeEventListener(cE,c),setTimeout(()=>{const b=new CustomEvent(uE,xI);a.addEventListener(uE,d),a.dispatchEvent(b),b.defaultPrevented||od(S??document.body,{select:!0}),a.removeEventListener(uE,d),_I.remove(y)},0)}}},[a,c,d,y]);const x=P.useCallback(S=>{if(!n&&!r||y.paused)return;const w=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,b=document.activeElement;if(w&&b){const M=S.currentTarget,[T,C]=K9(M);T&&C?!S.shiftKey&&b===C?(S.preventDefault(),n&&od(T,{select:!0})):S.shiftKey&&b===T&&(S.preventDefault(),n&&od(C,{select:!0})):b===M&&S.preventDefault()}},[n,r,y.paused]);return p.jsx(Wi.div,{tabIndex:-1,...o,ref:g,onKeyDown:x})});xF.displayName=X9;function q9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(od(r,{select:e}),document.activeElement!==n)return}function K9(t){const e=bF(t),n=bI(e,t),r=bI(e.reverse(),t);return[n,r]}function bF(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function bI(t,e){for(const n of t)if(!Y9(n,{upTo:e}))return n}function Y9(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Z9(t){return t instanceof HTMLInputElement&&"select"in t}function od(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Z9(t)&&e&&t.select()}}var _I=Q9();function Q9(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=wI(t,e),t.unshift(e)},remove(e){var n;t=wI(t,e),(n=t[0])==null||n.resume()}}}function wI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function J9(t){return t.filter(e=>e.tagName!=="A")}var e$="Portal",_F=P.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=P.useState(!1);ly(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?K1.createPortal(p.jsx(Wi.div,{...r,ref:e}),o):null});_F.displayName=e$;function t$(t,e){return P.useReducer((n,r)=>e[n][r]??n,t)}var Y1=t=>{const{present:e,children:n}=t,r=n$(e),i=typeof n=="function"?n({present:r.isPresent}):P.Children.only(n),s=r$(r.ref,i$(i));return typeof n=="function"||r.isPresent?P.cloneElement(i,{ref:s}):null};Y1.displayName="Presence";function n$(t){const[e,n]=P.useState(),r=P.useRef(null),i=P.useRef(t),s=P.useRef("none"),o=t?"mounted":"unmounted",[a,l]=t$(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return P.useEffect(()=>{const c=mb(r.current);s.current=a==="mounted"?c:"none"},[a]),ly(()=>{const c=r.current,d=i.current;if(d!==t){const g=s.current,y=mb(c);t?l("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&g!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),ly(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=mb(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&S&&(l("ANIMATION_END"),!i.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},g=y=>{y.target===e&&(s.current=mb(r.current))};return e.addEventListener("animationstart",g),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",g),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:P.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function SI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function r$(...t){const e=P.useRef(t);return e.current=t,P.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(o=>{const a=SI(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o{dl||(dl={start:MI(),end:MI()});const{start:t,end:e}=dl;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),gb++,()=>{gb===1&&(dl==null||dl.start.remove(),dl==null||dl.end.remove(),dl=null),gb=Math.max(0,gb-1)}},[])}function MI(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var _l=function(){return _l=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return w$;var e=S$(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},E$=EF(),Qm="data-scroll-locked",A$=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),` + .`.concat(a$,` { overflow: hidden `).concat(r,`; padding-right: `).concat(a,"px ").concat(r,`; } @@ -460,29 +475,29 @@ Error generating stack: `+j.message+` `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` } - .`).concat(j_,` { + .`).concat(U_,` { right: `).concat(a,"px ").concat(r,`; } - .`).concat(U_,` { + .`).concat(F_,` { margin-right: `).concat(a,"px ").concat(r,`; } - .`).concat(j_," .").concat(j_,` { + .`).concat(U_," .").concat(U_,` { right: 0 `).concat(r,`; } - .`).concat(U_," .").concat(U_,` { + .`).concat(F_," .").concat(F_,` { margin-right: 0 `).concat(r,`; } body[`).concat(Qm,`] { - `).concat(r$,": ").concat(a,`px; + `).concat(l$,": ").concat(a,`px; } -`)},SI=function(){var t=parseInt(document.body.getAttribute(Qm)||"0",10);return isFinite(t)?t:0},w$=function(){R.useEffect(function(){return document.body.setAttribute(Qm,(SI()+1).toString()),function(){var t=SI()-1;t<=0?document.body.removeAttribute(Qm):document.body.setAttribute(Qm,t.toString())}},[])},S$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;w$();var s=R.useMemo(function(){return x$(i)},[i]);return R.createElement(b$,{styles:_$(s,!e,i,n?"":"!important")})},zT=!1;if(typeof window<"u")try{var vb=Object.defineProperty({},"passive",{get:function(){return zT=!0,!0}});window.addEventListener("test",vb,vb),window.removeEventListener("test",vb,vb)}catch{zT=!1}var nm=zT?{passive:!1}:!1,M$=function(t){return t.tagName==="TEXTAREA"},wF=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!M$(t)&&n[e]==="visible")},E$=function(t){return wF(t,"overflowY")},A$=function(t){return wF(t,"overflowX")},MI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=SF(t,r);if(i){var s=MF(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},T$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},C$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},SF=function(t,e){return t==="v"?E$(e):A$(e)},MF=function(t,e){return t==="v"?T$(e):C$(e)},P$=function(t,e){return t==="h"&&e==="rtl"?-1:1},R$=function(t,e,n,r,i){var s=P$(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,d=o>0,f=0,m=0;do{if(!a)break;var y=MF(t,a),x=y[0],S=y[1],_=y[2],w=S-_-s*x;(x||w)&&SF(t,a)&&(f+=w,m+=x);var E=a.parentNode;a=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(c=!0),c},yb=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},EI=function(t){return[t.deltaX,t.deltaY]},AI=function(t){return t&&"current"in t?t.current:t},N$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},I$=function(t){return` +`)},AI=function(){var t=parseInt(document.body.getAttribute(Qm)||"0",10);return isFinite(t)?t:0},T$=function(){P.useEffect(function(){return document.body.setAttribute(Qm,(AI()+1).toString()),function(){var t=AI()-1;t<=0?document.body.removeAttribute(Qm):document.body.setAttribute(Qm,t.toString())}},[])},C$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;T$();var s=P.useMemo(function(){return M$(i)},[i]);return P.createElement(E$,{styles:A$(s,!e,i,n?"":"!important")})},GT=!1;if(typeof window<"u")try{var vb=Object.defineProperty({},"passive",{get:function(){return GT=!0,!0}});window.addEventListener("test",vb,vb),window.removeEventListener("test",vb,vb)}catch{GT=!1}var nm=GT?{passive:!1}:!1,P$=function(t){return t.tagName==="TEXTAREA"},AF=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!P$(t)&&n[e]==="visible")},R$=function(t){return AF(t,"overflowY")},N$=function(t){return AF(t,"overflowX")},TI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=TF(t,r);if(i){var s=CF(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},I$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},k$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},TF=function(t,e){return t==="v"?R$(e):N$(e)},CF=function(t,e){return t==="v"?I$(e):k$(e)},O$=function(t,e){return t==="h"&&e==="rtl"?-1:1},L$=function(t,e,n,r,i){var s=O$(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,d=o>0,f=0,g=0;do{if(!a)break;var y=CF(t,a),x=y[0],S=y[1],w=y[2],b=S-w-s*x;(x||b)&&TF(t,a)&&(f+=b,g+=x);var M=a.parentNode;a=M&&M.nodeType===Node.DOCUMENT_FRAGMENT_NODE?M.host:M}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&Math.abs(f)<1||!d&&Math.abs(g)<1)&&(c=!0),c},yb=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},CI=function(t){return[t.deltaX,t.deltaY]},PI=function(t){return t&&"current"in t?t.current:t},D$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},j$=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},k$=0,rm=[];function O$(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(k$++)[0],s=R.useState(_F)[0],o=R.useRef(t);R.useEffect(function(){o.current=t},[t]),R.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=t$([t.lockRef.current],(t.shards||[]).map(AI),!0).filter(Boolean);return S.forEach(function(_){return _.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=R.useCallback(function(S,_){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!o.current.allowPinchZoom;var w=yb(S),E=n.current,T="deltaX"in S?S.deltaX:E[0]-w[0],C="deltaY"in S?S.deltaY:E[1]-w[1],O,N=S.target,L=Math.abs(T)>Math.abs(C)?"h":"v";if("touches"in S&&L==="h"&&N.type==="range")return!1;var F=window.getSelection(),G=F&&F.anchorNode,k=G?G===N||G.contains(N):!1;if(k)return!1;var U=MI(L,N);if(!U)return!0;if(U?O=L:(O=L==="v"?"h":"v",U=MI(L,N)),!U)return!1;if(!r.current&&"changedTouches"in S&&(T||C)&&(r.current=O),!O)return!0;var H=r.current||O;return R$(H,_,S,H==="h"?T:C)},[]),l=R.useCallback(function(S){var _=S;if(!(!rm.length||rm[rm.length-1]!==s)){var w="deltaY"in _?EI(_):yb(_),E=e.current.filter(function(O){return O.name===_.type&&(O.target===_.target||_.target===O.shadowParent)&&N$(O.delta,w)})[0];if(E&&E.should){_.cancelable&&_.preventDefault();return}if(!E){var T=(o.current.shards||[]).map(AI).filter(Boolean).filter(function(O){return O.contains(_.target)}),C=T.length>0?a(_,T[0]):!o.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),c=R.useCallback(function(S,_,w,E){var T={name:S,delta:_,target:w,should:E,shadowParent:L$(w)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(C){return C!==T})},1)},[]),d=R.useCallback(function(S){n.current=yb(S),r.current=void 0},[]),f=R.useCallback(function(S){c(S.type,EI(S),S.target,a(S,t.lockRef.current))},[]),m=R.useCallback(function(S){c(S.type,yb(S),S.target,a(S,t.lockRef.current))},[]);R.useEffect(function(){return rm.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,nm),document.addEventListener("touchmove",l,nm),document.addEventListener("touchstart",d,nm),function(){rm=rm.filter(function(S){return S!==s}),document.removeEventListener("wheel",l,nm),document.removeEventListener("touchmove",l,nm),document.removeEventListener("touchstart",d,nm)}},[]);var y=t.removeScrollBar,x=t.inert;return R.createElement(R.Fragment,null,x?R.createElement(s,{styles:I$(i)}):null,y?R.createElement(S$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function L$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const D$=u$(bF,O$);var EF=R.forwardRef(function(t,e){return R.createElement(K1,_l({},t,{ref:e,sideCar:D$}))});EF.classNames=K1.classNames;var j$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},im=new WeakMap,xb=new WeakMap,bb={},fE=0,AF=function(t){return t&&(t.host||AF(t.parentNode))},U$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=AF(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},F$=function(t,e,n,r){var i=U$(e,Array.isArray(t)?t:[t]);bb[n]||(bb[n]=new WeakMap);var s=bb[n],o=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))d(m);else try{var y=m.getAttribute(r),x=y!==null&&y!=="false",S=(im.get(m)||0)+1,_=(s.get(m)||0)+1;im.set(m,S),s.set(m,_),o.push(m),S===1&&x&&xb.set(m,!0),_===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",m,w)}})};return d(e),a.clear(),fE++,function(){o.forEach(function(f){var m=im.get(f)-1,y=s.get(f)-1;im.set(f,m),s.set(f,y),m||(xb.has(f)||f.removeAttribute(r),xb.delete(f)),y||f.removeAttribute(n)}),fE--,fE||(im=new WeakMap,im=new WeakMap,xb=new WeakMap,bb={})}},z$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=j$(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),F$(r,i,n,"aria-hidden")):function(){return null}},Y1="Dialog",[TF]=p9(Y1),[B$,$a]=TF(Y1),CF=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=R.useRef(null),l=R.useRef(null),[c,d]=x9({prop:r,defaultProp:i??!1,onChange:s,caller:Y1});return g.jsx(B$,{scope:e,triggerRef:a,contentRef:l,contentId:Vc(),titleId:Vc(),descriptionId:Vc(),open:c,onOpenChange:d,onOpenToggle:R.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};CF.displayName=Y1;var PF="DialogTrigger",H$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$a(PF,n),s=qh(e,i.triggerRef);return g.jsx(Wi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":EP(i.open),...r,ref:s,onClick:_d(t.onClick,i.onOpenToggle)})});H$.displayName=PF;var MP="DialogPortal",[V$,RF]=TF(MP,{forceMount:void 0}),NF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=$a(MP,e);return g.jsx(V$,{scope:e,forceMount:n,children:R.Children.map(r,o=>g.jsx(q1,{present:n||s.open,children:g.jsx(vF,{asChild:!0,container:i,children:o})}))})};NF.displayName=MP;var iw="DialogOverlay",IF=R.forwardRef((t,e)=>{const n=RF(iw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=$a(iw,t.__scopeDialog);return s.modal?g.jsx(q1,{present:r||s.open,children:g.jsx(W$,{...i,ref:e})}):null});IF.displayName=iw;var G$=fF("DialogOverlay.RemoveScroll"),W$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$a(iw,n),s=F9(),o=qh(e,s);return g.jsx(EF,{as:G$,allowPinchZoom:!0,shards:[i.contentRef],children:g.jsx(Wi.div,{"data-state":EP(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),Sg="DialogContent",kF=R.forwardRef((t,e)=>{const n=RF(Sg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=$a(Sg,t.__scopeDialog);return g.jsx(q1,{present:r||s.open,children:s.modal?g.jsx($$,{...i,ref:e}):g.jsx(X$,{...i,ref:e})})});kF.displayName=Sg;var $$=R.forwardRef((t,e)=>{const n=$a(Sg,t.__scopeDialog),r=R.useRef(null),i=qh(e,n.contentRef,r);return R.useEffect(()=>{const s=r.current;if(s)return z$(s)},[]),g.jsx(OF,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_d(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:_d(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:_d(t.onFocusOutside,s=>s.preventDefault())})}),X$=R.forwardRef((t,e)=>{const n=$a(Sg,t.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return g.jsx(OF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),OF=R.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=$a(Sg,n);return e$(),g.jsx(g.Fragment,{children:g.jsx(mF,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:g.jsx(hF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":EP(a.open),...o,ref:e,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),LF="DialogTitle",q$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$a(LF,n);return g.jsx(Wi.h2,{id:i.titleId,...r,ref:e})});q$.displayName=LF;var DF="DialogDescription",K$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$a(DF,n);return g.jsx(Wi.p,{id:i.descriptionId,...r,ref:e})});K$.displayName=DF;var jF="DialogClose",Y$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$a(jF,n);return g.jsx(Wi.button,{type:"button",...r,ref:e,onClick:_d(t.onClick,()=>i.onOpenChange(!1))})});Y$.displayName=jF;function EP(t){return t?"open":"closed"}var r0='[cmdk-group=""]',hE='[cmdk-group-items=""]',Z$='[cmdk-group-heading=""]',UF='[cmdk-item=""]',TI=`${UF}:not([aria-disabled="true"])`,BT="cmdk-item-select",jm="data-value",Q$=(t,e,n)=>h9(t,e,n),FF=R.createContext(void 0),Wy=()=>R.useContext(FF),zF=R.createContext(void 0),AP=()=>R.useContext(zF),BF=R.createContext(void 0),HF=R.forwardRef((t,e)=>{let n=Um(()=>{var q,he;return{search:"",value:(he=(q=t.value)!=null?q:t.defaultValue)!=null?he:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Um(()=>new Set),i=Um(()=>new Map),s=Um(()=>new Map),o=Um(()=>new Set),a=VF(t),{label:l,children:c,value:d,onValueChange:f,filter:m,shouldFilter:y,loop:x,disablePointerSelection:S=!1,vimBindings:_=!0,...w}=t,E=Vc(),T=Vc(),C=Vc(),O=R.useRef(null),N=c7();Ph(()=>{if(d!==void 0){let q=d.trim();n.current.value=q,L.emit()}},[d]),Ph(()=>{N(6,ne)},[]);let L=R.useMemo(()=>({subscribe:q=>(o.current.add(q),()=>o.current.delete(q)),snapshot:()=>n.current,setState:(q,he,ae)=>{var ce,we,Ee,Xe;if(!Object.is(n.current[q],he)){if(n.current[q]=he,q==="search")H(),k(),N(1,U);else if(q==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Se=document.getElementById(C);Se?Se.focus():(ce=document.getElementById(E))==null||ce.focus()}if(N(7,()=>{var Se;n.current.selectedItemId=(Se=ee())==null?void 0:Se.id,L.emit()}),ae||N(5,ne),((we=a.current)==null?void 0:we.value)!==void 0){let Se=he??"";(Xe=(Ee=a.current).onValueChange)==null||Xe.call(Ee,Se);return}}L.emit()}},emit:()=>{o.current.forEach(q=>q())}}),[]),F=R.useMemo(()=>({value:(q,he,ae)=>{var ce;he!==((ce=s.current.get(q))==null?void 0:ce.value)&&(s.current.set(q,{value:he,keywords:ae}),n.current.filtered.items.set(q,G(he,ae)),N(2,()=>{k(),L.emit()}))},item:(q,he)=>(r.current.add(q),he&&(i.current.has(he)?i.current.get(he).add(q):i.current.set(he,new Set([q]))),N(3,()=>{H(),k(),n.current.value||U(),L.emit()}),()=>{s.current.delete(q),r.current.delete(q),n.current.filtered.items.delete(q);let ae=ee();N(4,()=>{H(),(ae==null?void 0:ae.getAttribute("id"))===q&&U(),L.emit()})}),group:q=>(i.current.has(q)||i.current.set(q,new Set),()=>{s.current.delete(q),i.current.delete(q)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:E,inputId:C,labelId:T,listInnerRef:O}),[]);function G(q,he){var ae,ce;let we=(ce=(ae=a.current)==null?void 0:ae.filter)!=null?ce:Q$;return q?we(q,n.current.search,he):0}function k(){if(!n.current.search||a.current.shouldFilter===!1)return;let q=n.current.filtered.items,he=[];n.current.filtered.groups.forEach(ce=>{let we=i.current.get(ce),Ee=0;we.forEach(Xe=>{let Se=q.get(Xe);Ee=Math.max(Se,Ee)}),he.push([ce,Ee])});let ae=O.current;pe().sort((ce,we)=>{var Ee,Xe;let Se=ce.getAttribute("id"),je=we.getAttribute("id");return((Ee=q.get(je))!=null?Ee:0)-((Xe=q.get(Se))!=null?Xe:0)}).forEach(ce=>{let we=ce.closest(hE);we?we.appendChild(ce.parentElement===we?ce:ce.closest(`${hE} > *`)):ae.appendChild(ce.parentElement===ae?ce:ce.closest(`${hE} > *`))}),he.sort((ce,we)=>we[1]-ce[1]).forEach(ce=>{var we;let Ee=(we=O.current)==null?void 0:we.querySelector(`${r0}[${jm}="${encodeURIComponent(ce[0])}"]`);Ee==null||Ee.parentElement.appendChild(Ee)})}function U(){let q=pe().find(ae=>ae.getAttribute("aria-disabled")!=="true"),he=q==null?void 0:q.getAttribute(jm);L.setState("value",he||void 0)}function H(){var q,he,ae,ce;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let we=0;for(let Ee of r.current){let Xe=(he=(q=s.current.get(Ee))==null?void 0:q.value)!=null?he:"",Se=(ce=(ae=s.current.get(Ee))==null?void 0:ae.keywords)!=null?ce:[],je=G(Xe,Se);n.current.filtered.items.set(Ee,je),je>0&&we++}for(let[Ee,Xe]of i.current)for(let Se of Xe)if(n.current.filtered.items.get(Se)>0){n.current.filtered.groups.add(Ee);break}n.current.filtered.count=we}function ne(){var q,he,ae;let ce=ee();ce&&(((q=ce.parentElement)==null?void 0:q.firstChild)===ce&&((ae=(he=ce.closest(r0))==null?void 0:he.querySelector(Z$))==null||ae.scrollIntoView({block:"nearest"})),ce.scrollIntoView({block:"nearest"}))}function ee(){var q;return(q=O.current)==null?void 0:q.querySelector(`${UF}[aria-selected="true"]`)}function pe(){var q;return Array.from(((q=O.current)==null?void 0:q.querySelectorAll(TI))||[])}function se(q){let he=pe()[q];he&&L.setState("value",he.getAttribute(jm))}function fe(q){var he;let ae=ee(),ce=pe(),we=ce.findIndex(Xe=>Xe===ae),Ee=ce[we+q];(he=a.current)!=null&&he.loop&&(Ee=we+q<0?ce[ce.length-1]:we+q===ce.length?ce[0]:ce[we+q]),Ee&&L.setState("value",Ee.getAttribute(jm))}function B(q){let he=ee(),ae=he==null?void 0:he.closest(r0),ce;for(;ae&&!ce;)ae=q>0?a7(ae,r0):l7(ae,r0),ce=ae==null?void 0:ae.querySelector(TI);ce?L.setState("value",ce.getAttribute(jm)):fe(q)}let Q=()=>se(pe().length-1),K=q=>{q.preventDefault(),q.metaKey?Q():q.altKey?B(1):fe(1)},V=q=>{q.preventDefault(),q.metaKey?se(0):q.altKey?B(-1):fe(-1)};return R.createElement(Wi.div,{ref:e,tabIndex:-1,...w,"cmdk-root":"",onKeyDown:q=>{var he;(he=w.onKeyDown)==null||he.call(w,q);let ae=q.nativeEvent.isComposing||q.keyCode===229;if(!(q.defaultPrevented||ae))switch(q.key){case"n":case"j":{_&&q.ctrlKey&&K(q);break}case"ArrowDown":{K(q);break}case"p":case"k":{_&&q.ctrlKey&&V(q);break}case"ArrowUp":{V(q);break}case"Home":{q.preventDefault(),se(0);break}case"End":{q.preventDefault(),Q();break}case"Enter":{q.preventDefault();let ce=ee();if(ce){let we=new Event(BT);ce.dispatchEvent(we)}}}}},R.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:d7},l),Z1(t,q=>R.createElement(zF.Provider,{value:L},R.createElement(FF.Provider,{value:F},q))))}),J$=R.forwardRef((t,e)=>{var n,r;let i=Vc(),s=R.useRef(null),o=R.useContext(BF),a=Wy(),l=VF(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Ph(()=>{if(!c)return a.item(i,o==null?void 0:o.id)},[c]);let d=GF(i,s,[t.value,t.children,s],t.keywords),f=AP(),m=Ed(N=>N.value&&N.value===d.current),y=Ed(N=>c||a.filter()===!1?!0:N.search?N.filtered.items.get(i)>0:!0);R.useEffect(()=>{let N=s.current;if(!(!N||t.disabled))return N.addEventListener(BT,x),()=>N.removeEventListener(BT,x)},[y,t.onSelect,t.disabled]);function x(){var N,L;S(),(L=(N=l.current).onSelect)==null||L.call(N,d.current)}function S(){f.setState("value",d.current,!0)}if(!y)return null;let{disabled:_,value:w,onSelect:E,forceMount:T,keywords:C,...O}=t;return R.createElement(Wi.div,{ref:wg(s,e),...O,id:i,"cmdk-item":"",role:"option","aria-disabled":!!_,"aria-selected":!!m,"data-disabled":!!_,"data-selected":!!m,onPointerMove:_||a.getDisablePointerSelection()?void 0:S,onClick:_?void 0:x},t.children)}),e7=R.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,o=Vc(),a=R.useRef(null),l=R.useRef(null),c=Vc(),d=Wy(),f=Ed(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(o):!0);Ph(()=>d.group(o),[]),GF(o,a,[t.value,t.heading,l]);let m=R.useMemo(()=>({id:o,forceMount:i}),[i]);return R.createElement(Wi.div,{ref:wg(a,e),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&R.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),Z1(t,y=>R.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},R.createElement(BF.Provider,{value:m},y))))}),t7=R.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=R.useRef(null),s=Ed(o=>!o.search);return!n&&!s?null:R.createElement(Wi.div,{ref:wg(i,e),...r,"cmdk-separator":"",role:"separator"})}),n7=R.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=AP(),o=Ed(c=>c.search),a=Ed(c=>c.selectedItemId),l=Wy();return R.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),R.createElement(Wi.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?t.value:o,onChange:c=>{i||s.setState("search",c.target.value),n==null||n(c.target.value)}})}),r7=R.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=R.useRef(null),o=R.useRef(null),a=Ed(c=>c.selectedItemId),l=Wy();return R.useEffect(()=>{if(o.current&&s.current){let c=o.current,d=s.current,f,m=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let y=c.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return m.observe(c),()=>{cancelAnimationFrame(f),m.unobserve(c)}}},[]),R.createElement(Wi.div,{ref:wg(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},Z1(t,c=>R.createElement("div",{ref:wg(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),i7=R.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=t;return R.createElement(CF,{open:n,onOpenChange:r},R.createElement(NF,{container:o},R.createElement(IF,{"cmdk-overlay":"",className:i}),R.createElement(kF,{"aria-label":t.label,"cmdk-dialog":"",className:s},R.createElement(HF,{ref:e,...a}))))}),s7=R.forwardRef((t,e)=>Ed(n=>n.filtered.count===0)?R.createElement(Wi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),o7=R.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return R.createElement(Wi.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Z1(t,o=>R.createElement("div",{"aria-hidden":!0},o)))}),sm=Object.assign(HF,{List:r7,Item:J$,Input:n7,Group:e7,Separator:t7,Dialog:i7,Empty:s7,Loading:o7});function a7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function l7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function VF(t){let e=R.useRef(t);return Ph(()=>{e.current=t}),e}var Ph=typeof window>"u"?R.useEffect:R.useLayoutEffect;function Um(t){let e=R.useRef();return e.current===void 0&&(e.current=t()),e}function Ed(t){let e=AP(),n=()=>t(e.snapshot());return R.useSyncExternalStore(e.subscribe,n,n)}function GF(t,e,n,r=[]){let i=R.useRef(),s=Wy();return Ph(()=>{var o;let a=(()=>{var c;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(c=d.current.textContent)==null?void 0:c.trim():i.current}})(),l=r.map(c=>c.trim());s.value(t,a,l),(o=e.current)==null||o.setAttribute(jm,a),i.current=a}),i}var c7=()=>{let[t,e]=R.useState(),n=Um(()=>new Map);return Ph(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function u7(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Z1({asChild:t,children:e},n){return t&&R.isValidElement(e)?R.cloneElement(u7(e),{ref:e.ref},n(e.props.children)):n(e)}var d7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function f7({onNavigate:t}){const[e,n]=R.useState(!1);return R.useEffect(()=>{const r=i=>{(i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"&&(i.preventDefault(),n(s=>!s))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),g.jsx(sm.Dialog,{open:e,onOpenChange:n,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>n(!1),children:g.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:r=>r.stopPropagation(),children:[g.jsx(sm.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),g.jsxs(sm.List,{className:"max-h-80 overflow-y-auto p-2",children:[g.jsx(sm.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),g.jsx(sm.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:jT.map(r=>g.jsxs(sm.Item,{value:`${r.label} ${r.hint}`,onSelect:()=>{t(r.id),n(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[g.jsx(r.icon,{className:"h-4 w-4 text-primary"}),g.jsx("span",{children:r.label}),g.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:r.hint})]},r.id))})]})]})})}async function zt(t,e){var l;const n={"Content-Type":"application/json",...e==null?void 0:e.headers},r=localStorage.getItem("mc_sudo_password"),i=localStorage.getItem("mc_hf_token");r&&(n["X-Sudo-Password"]=r);let s=e==null?void 0:e.body;if((((l=e==null?void 0:e.method)==null?void 0:l.toUpperCase())||"GET")==="POST"){if(typeof s=="string")try{const c=JSON.parse(s);let d=!1;r&&!("sudo_password"in c)&&(c.sudo_password=r,d=!0),i&&!("hf_token"in c)&&(c.hf_token=i,d=!0),d&&(s=JSON.stringify(c))}catch{}else if(!s){const c={};r&&(c.sudo_password=r),i&&(c.hf_token=i),Object.keys(c).length>0&&(s=JSON.stringify(c))}}const a=await fetch(t,{...e,headers:n,body:s});if(!a.ok)throw new Error(`${a.status} ${a.statusText}`);return a.json()}const h7=(t,e,n=!1,r=!0)=>zt("/api/groups",{method:"PUT",body:JSON.stringify({group:t,members:e,swap:n,persist:r})}),br={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],groups:["groups"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:t=>["drafts",t??""],connect:t=>["connect",t??""],connectHealth:["connect-health"],memory:(t,e)=>["memory",t??"",e??""],memoryGraph:["memory-graph"]},p7=(t=!0)=>Gi({queryKey:br.memoryGraph,queryFn:()=>zt("/api/memory/graph"),enabled:t}),m7=()=>Gi({queryKey:br.health,queryFn:()=>zt("/api/health"),refetchInterval:1e4}),Q1=(t=5e3)=>Gi({queryKey:br.systemStatus,queryFn:()=>zt("/api/system/status"),refetchInterval:t}),g7=(t=3e3)=>Gi({queryKey:br.services,queryFn:()=>zt("/api/system/services"),refetchInterval:t}),Kh=(t=4e3)=>Gi({queryKey:br.models,queryFn:()=>zt("/api/models"),refetchInterval:t}),v7=(t=8e3)=>Gi({queryKey:br.groups,queryFn:()=>zt("/api/groups"),refetchInterval:t}),y7=(t=4e3)=>Gi({queryKey:br.routing,queryFn:()=>zt("/api/routing"),refetchInterval:t}),x7=(t=2e3)=>Gi({queryKey:br.jobs,queryFn:()=>zt("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),TP=(t=3e3)=>Gi({queryKey:br.tokenStats,queryFn:()=>zt("/api/system/token-stats"),refetchInterval:t}),CP=(t=5e3)=>Gi({queryKey:br.agentStatus,queryFn:()=>zt("/api/agent/status"),refetchInterval:t}),b7=(t=6e4)=>Gi({queryKey:br.hermesBrain,queryFn:()=>zt("/api/agent/brain"),refetchInterval:t}),PP=t=>Gi({queryKey:br.updates,queryFn:()=>zt("/api/maintenance/updates"),refetchInterval:t}),_7=()=>Gi({queryKey:br.discover,queryFn:()=>zt("/api/discover")}),w7=t=>Gi({queryKey:br.drafts(t),queryFn:()=>zt(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),WF=t=>Gi({queryKey:br.connect(t),queryFn:()=>zt(t?`/api/connect?${t}`:"/api/connect")}),S7=()=>Gi({queryKey:br.connectHealth,queryFn:()=>zt("/api/connect/health"),refetchInterval:15e3}),HT=t=>Gi({queryKey:br.memory(t==null?void 0:t.q,t==null?void 0:t.category),queryFn:()=>{const e=new URLSearchParams;return t!=null&&t.q&&e.set("q",t.q),t!=null&&t.category&&e.set("category",t.category),zt(`/api/memory?${e}`)},select:e=>t!=null&&t.limit?e.slice(0,t.limit):e});function om(t){return(t/1024**3).toFixed(1)}function VT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Vo(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function M7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function CI(t){return t?`${Math.round(t/1024)}k`:"—"}function $F(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=T7(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(RP);return a[0]===""&&a.length!==1&&a.shift(),XF(a,e)||A7(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},XF=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?XF(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(RP);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},PI=/^\[(.+)\]$/,A7=t=>{if(PI.test(t)){const e=PI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},T7=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return P7(Object.entries(t.classGroups),n).forEach(([s,o])=>{GT(o,r,s,e)}),r},GT=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:RI(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(C7(i)){GT(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{GT(o,RI(e,s),n,r)})})},RI=(t,e)=>{let n=t;return e.split(RP).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},C7=t=>t.isThemeGetter,P7=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[n,i]}):t,R7=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},qF="!",N7=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=a=>{const l=[];let c=0,d=0,f;for(let _=0;_d?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:S}};return n?a=>n({className:a,parseClassName:o}):o},I7=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},k7=t=>({cache:R7(t.cacheSize),parseClassName:N7(t),...E7(t)}),O7=/\s+/,L7=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(O7);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:y}=n(c);let x=!!y,S=r(x?m.substring(0,y):m);if(!S){if(!x){a=c+(a.length>0?" "+a:a);continue}if(S=r(m),!S){a=c+(a.length>0?" "+a:a);continue}x=!1}const _=I7(d).join(":"),w=f?_+qF:_,E=w+S;if(s.includes(E))continue;s.push(E);const T=i(S,x);for(let C=0;C0?" "+a:a)}return a};function D7(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=k7(c),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=L7(l,n);return i(l,d),d}return function(){return s(D7.apply(null,arguments))}}const sr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},YF=/^\[(?:([a-z-]+):)?(.+)\]$/i,U7=/^\d+\/\d+$/,F7=new Set(["px","full","screen"]),z7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,B7=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,H7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,V7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,G7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sc=t=>Jm(t)||F7.has(t)||U7.test(t),Gu=t=>Hg(t,"length",Q7),Jm=t=>!!t&&!Number.isNaN(Number(t)),pE=t=>Hg(t,"number",Jm),i0=t=>!!t&&Number.isInteger(Number(t)),W7=t=>t.endsWith("%")&&Jm(t.slice(0,-1)),mn=t=>YF.test(t),Wu=t=>z7.test(t),$7=new Set(["length","size","percentage"]),X7=t=>Hg(t,$7,ZF),q7=t=>Hg(t,"position",ZF),K7=new Set(["image","url"]),Y7=t=>Hg(t,K7,eX),Z7=t=>Hg(t,"",J7),s0=()=>!0,Hg=(t,e,n)=>{const r=YF.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},Q7=t=>B7.test(t)&&!H7.test(t),ZF=()=>!1,J7=t=>V7.test(t),eX=t=>G7.test(t),tX=()=>{const t=sr("colors"),e=sr("spacing"),n=sr("blur"),r=sr("brightness"),i=sr("borderColor"),s=sr("borderRadius"),o=sr("borderSpacing"),a=sr("borderWidth"),l=sr("contrast"),c=sr("grayscale"),d=sr("hueRotate"),f=sr("invert"),m=sr("gap"),y=sr("gradientColorStops"),x=sr("gradientColorStopPositions"),S=sr("inset"),_=sr("margin"),w=sr("opacity"),E=sr("padding"),T=sr("saturate"),C=sr("scale"),O=sr("sepia"),N=sr("skew"),L=sr("space"),F=sr("translate"),G=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",mn,e],H=()=>[mn,e],ne=()=>["",Sc,Gu],ee=()=>["auto",Jm,mn],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],se=()=>["solid","dashed","dotted","double","none"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",mn],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[Jm,mn];return{cacheSize:500,separator:":",theme:{colors:[s0],spacing:[Sc,Gu],blur:["none","",Wu,mn],brightness:V(),borderColor:[t],borderRadius:["none","","full",Wu,mn],borderSpacing:H(),borderWidth:ne(),contrast:V(),grayscale:Q(),hueRotate:V(),invert:Q(),gap:H(),gradientColorStops:[t],gradientColorStopPositions:[W7,Gu],inset:U(),margin:U(),opacity:V(),padding:H(),saturate:V(),scale:V(),sepia:Q(),skew:V(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",mn]}],container:["container"],columns:[{columns:[Wu]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...pe(),mn]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",i0,mn]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",mn]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",i0,mn]}],"grid-cols":[{"grid-cols":[s0]}],"col-start-end":[{col:["auto",{span:["full",i0,mn]},mn]}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":[s0]}],"row-start-end":[{row:["auto",{span:[i0,mn]},mn]}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",mn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",mn]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[_]}],mx:[{mx:[_]}],my:[{my:[_]}],ms:[{ms:[_]}],me:[{me:[_]}],mt:[{mt:[_]}],mr:[{mr:[_]}],mb:[{mb:[_]}],ml:[{ml:[_]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",mn,e]}],"min-w":[{"min-w":[mn,e,"min","max","fit"]}],"max-w":[{"max-w":[mn,e,"none","full","min","max","fit","prose",{screen:[Wu]},Wu]}],h:[{h:[mn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[mn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[mn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[mn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Wu,Gu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",pE]}],"font-family":[{font:[s0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",mn]}],"line-clamp":[{"line-clamp":["none",Jm,pE]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Sc,mn]}],"list-image":[{"list-image":["none",mn]}],"list-style-type":[{list:["none","disc","decimal",mn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Sc,Gu]}],"underline-offset":[{"underline-offset":["auto",Sc,mn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",mn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...pe(),q7]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",X7]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Y7]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...se(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:se()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...se()]}],"outline-offset":[{"outline-offset":[Sc,mn]}],"outline-w":[{outline:[Sc,Gu]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[Sc,Gu]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Wu,Z7]}],"shadow-color":[{shadow:[s0]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...fe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":fe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wu,mn]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[T]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",mn]}],duration:[{duration:V()}],ease:[{ease:["linear","in","out","in-out",mn]}],delay:[{delay:V()}],animate:[{animate:["none","spin","ping","pulse","bounce",mn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[i0,mn]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",mn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",mn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",mn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Sc,Gu,pE]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},nX=j7(tX);function rt(...t){return nX(nr(t))}function Mg(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const QF=["fast","heavy","coder","vision","scout"],rX={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"},NP=t=>t&&rX[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function iX({fit:t}){const e={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[t.level];return g.jsxs("span",{className:rt("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",e),children:[t.text," • ",t.req_gb," GB RAM"]})}function NI(t){const e=t.toLowerCase();return e.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:e.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:e.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:e.includes("mistral")||e.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:e.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:e.includes("hermes")||e.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:e.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function sX(){const{data:t}=Kh(2e3),{data:e}=TP(2e3),n=(t==null?void 0:t.models)??[],r=(t==null?void 0:t.running)??[],i=n.filter(l=>r.includes(l.name)),s=R.useRef(null),[o,a]=R.useState(!1);return R.useEffect(()=>{if(!e)return;const l=e.total_tokens;if(s.current!==null&&l>s.current){a(!0);const c=setTimeout(()=>a(!1),4e3);return s.current=l,()=>clearTimeout(c)}s.current=l},[e==null?void 0:e.total_tokens]),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"flex items-center justify-between mb-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(ay,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),g.jsxs("span",{className:rt("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",o?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[o?g.jsx(bh,{className:"h-3 w-3 animate-pulse"}):g.jsx($8,{className:"h-3 w-3"}),o?"Inferenz aktiv":"Idle"]})]}),i.length===0?g.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):g.jsx("div",{className:"grid gap-2",children:i.map(l=>{var c;return g.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.role&&g.jsx("span",{className:rt("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",NP(l.role)),children:l.role}),g.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(c=l.name.split("/").pop())==null?void 0:c.replace(/\.gguf$/i,"")})]}),g.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[Vo(l.size_bytes)," im Unified-RAM"]})]}),g.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[g.jsx("span",{className:rt("h-1.5 w-1.5 rounded-full bg-emerald-500",o&&"animate-pulse")})," warm"]})]},l.name)})})]})}let WT=[],$T=[];const XT=new Set,JF=()=>XT.forEach(t=>t());function e5(t){return XT.add(t),()=>{XT.delete(t)}}function oX(t){WT=[...WT,t].slice(-40),JF()}function aX(t){$T=[...$T,t].slice(-40),JF()}const lX=()=>R.useSyncExternalStore(e5,()=>WT),cX=()=>R.useSyncExternalStore(e5,()=>$T);function uX(){const{data:t,dataUpdatedAt:e}=Q1(3e3),{data:n,dataUpdatedAt:r}=TP(3e3),i=R.useRef(null);R.useEffect(()=>{var s,o,a,l;t&&oX({t:Date.now(),cpu:((s=t.cpu)==null?void 0:s.percent)??0,ram:((o=t.ram)==null?void 0:o.percent)??0,gpu:((a=t.gpu)==null?void 0:a.busy_percent)??null,disk:((l=t.disk)==null?void 0:l.percent)??null})},[e]),R.useEffect(()=>{if(!n)return;const s=Date.now(),o=n.prompt_tokens,a=n.completion_tokens;if(i.current){const l=Math.max((s-i.current.t)/1e3,.001);aX({t:s,prompt:Math.max(0,(o-i.current.p)/l),completion:Math.max(0,(a-i.current.c)/l)})}i.current={p:o,c:a,t:s}},[r])}function dX(){const{data:t,error:e}=Q1(3e3),n=lX();return{sys:t,hist:n,error:e}}var fX=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function IP(t){if(typeof t!="string")return!1;var e=fX;return e.includes(t)}var hX=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],pX=new Set(hX);function t5(t){return typeof t!="string"?!1:pX.has(t)}function n5(t){return typeof t=="string"&&t.startsWith("data-")}function Ba(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t5(n)||n5(n))&&(e[n]=t[n]);return e}function J1(t){if(t==null)return null;if(R.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return Ba(e)}return typeof t=="object"&&!Array.isArray(t)?Ba(t):null}function Zo(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t5(n)||n5(n)||IP(n))&&(e[n]=t[n]);return e}function mX(t){return t==null?null:R.isValidElement(t)?Zo(t.props):typeof t=="object"&&!Array.isArray(t)?Zo(t):null}var gX=["children","width","height","viewBox","className","style","title","desc"];function qT(){return qT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.width,i=t.height,s=t.viewBox,o=t.className,a=t.style,l=t.title,c=t.desc,d=vX(t,gX),f=s||{width:r,height:i,x:0,y:0},m=nr("recharts-surface",o);return R.createElement("svg",qT({},Zo(d),{className:m,width:r,height:i,style:a,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),R.createElement("title",null,l),R.createElement("desc",null,c),n)}),xX=["children","className"];function KT(){return KT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.className,i=bX(t,xX),s=nr("recharts-layer",r);return R.createElement("g",KT({className:s},Zo(i),{ref:e}),n)}),wX=R.createContext(null);function Ar(t){return function(){return t}}const YT=Math.PI,ZT=2*YT,Gf=1e-6,SX=ZT-Gf;function i5(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return i5;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;iGf)if(!(Math.abs(f*l-c*d)>Gf)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let y=r-o,x=i-a,S=l*l+c*c,_=y*y+x*x,w=Math.sqrt(S),E=Math.sqrt(m),T=s*Math.tan((YT-Math.acos((S+m-_)/(2*w*E)))/2),C=T/E,O=T/w;Math.abs(C-1)>Gf&&this._append`L${e+C*d},${n+C*f}`,this._append`A${s},${s},0,0,${+(f*y>d*x)},${this._x1=e+O*l},${this._y1=n+O*c}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),l=r*Math.sin(i),c=e+a,d=n+l,f=1^o,m=o?i-s:s-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Gf||Math.abs(this._y1-d)>Gf)&&this._append`L${c},${d}`,r&&(m<0&&(m=m%ZT+ZT),m>SX?this._append`A${r},${r},0,1,${f},${e-a},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=d}`:m>Gf&&this._append`A${r},${r},0,${+(m>=YT)},${f},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function s5(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new EX(e)}function kP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function o5(t){this._context=t}o5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function eS(t){return new o5(t)}function a5(t){return t[0]}function l5(t){return t[1]}function c5(t,e){var n=Ar(!0),r=null,i=eS,s=null,o=s5(a);t=typeof t=="function"?t:t===void 0?a5:Ar(t),e=typeof e=="function"?e:e===void 0?l5:Ar(e);function a(l){var c,d=(l=kP(l)).length,f,m=!1,y;for(r==null&&(s=i(y=o())),c=0;c<=d;++c)!(c=y;--x)a.point(T[x],C[x]);a.lineEnd(),a.areaEnd()}w&&(T[m]=+t(_,m,f),C[m]=+e(_,m,f),a.point(r?+r(_,m,f):T[m],n?+n(_,m,f):C[m]))}if(E)return a=null,E+""||null}function d(){return c5().defined(i).curve(o).context(s)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:Ar(+f),r=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Ar(+f),c):t},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ar(+f),c):r},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:Ar(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Ar(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ar(+f),c):n},c.lineX0=c.lineY0=function(){return d().x(t).y(e)},c.lineY1=function(){return d().x(t).y(n)},c.lineX1=function(){return d().x(r).y(e)},c.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Ar(!!f),c):i},c.curve=function(f){return arguments.length?(o=f,s!=null&&(a=o(s)),c):o},c.context=function(f){return arguments.length?(f==null?s=a=null:a=o(s=f),c):s},c}class u5{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function AX(t){return new u5(t,!0)}function TX(t){return new u5(t,!1)}function sw(){}function ow(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function d5(t){this._context=t}d5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ow(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ow(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function CX(t){return new d5(t)}function f5(t){this._context=t}f5.prototype={areaStart:sw,areaEnd:sw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ow(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function PX(t){return new f5(t)}function h5(t){this._context=t}h5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ow(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function RX(t){return new h5(t)}function p5(t){this._context=t}p5.prototype={areaStart:sw,areaEnd:sw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function NX(t){return new p5(t)}function II(t){return t<0?-1:1}function kI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),a=(s*i+o*r)/(r+i);return(II(s)+II(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function OI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function mE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-r)/3;t._context.bezierCurveTo(r+a,i+a*e,s-a,o-a*n,s,o)}function aw(t){this._context=t}aw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:mE(this,this._t0,OI(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,mE(this,OI(this,n=kI(this,t,e)),n);break;default:mE(this,this._t0,n=kI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function m5(t){this._context=new g5(t)}(m5.prototype=Object.create(aw.prototype)).point=function(t,e){aw.prototype.point.call(this,e,t)};function g5(t){this._context=t}g5.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}};function IX(t){return new aw(t)}function kX(t){return new m5(t)}function v5(t){this._context=t}v5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=LI(t),i=LI(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function LX(t){return new tS(t,.5)}function DX(t){return new tS(t,0)}function jX(t){return new tS(t,1)}function Rh(t,e){if((o=t.length)>1)for(var n=1,r,i,s=t[e[0]],o,a=s.length;n=0;)n[e]=e;return n}function UX(t,e){return t[e]}function FX(t){const e=[];return e.key=t,e}function zX(){var t=Ar([]),e=QT,n=Rh,r=UX;function i(s){var o=Array.from(t.apply(this,arguments),FX),a,l=o.length,c=-1,d;for(const f of s)for(a=0,++c;a0){for(var n,r,i=0,s=t[0].length,o;i0){for(var n=0,r=t[e[0]],i,s=r.length;n0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:WX,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function ji(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{var a=n[o-1];return typeof a=="string"?i+a+s:a!==void 0?i+xd(a)+s:i+s},"")}var Xo=t=>t===0?0:t>0?1:-1,kl=t=>typeof t=="number"&&t!=+t,Nh=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,Dt=t=>(typeof t=="number"||t instanceof Number)&&!kl(t),Ol=t=>Dt(t)||typeof t=="string",$X=0,uy=t=>{var e=++$X;return"".concat(t||"").concat(e)},Ad=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Dt(e)&&typeof e!="string")return r;var s;if(Nh(e)){if(n==null)return r;var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return kl(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},b5=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;rr&&(typeof e=="function"?e(r):Yh(r,e))===n)}var Vi=t=>t===null||typeof t>"u",DP=t=>Vi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Zs(t){return t!=null}function Vg(){}var w5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,jP=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(R.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{IP(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},XX=(t,e,n)=>r=>(t(e,n,r),null),qX=(t,e,n)=>{if(t===null||typeof t!="object"&&typeof t!="function")return null;var r=null;return Object.keys(t).forEach(i=>{var s=t[i];IP(i)&&typeof s=="function"&&(r||(r={}),r[i]=XX(s,e,n))}),r};function DI(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function KX(t){for(var e=1;e(o[a]===void 0&&r[a]!==void 0&&(o[a]=r[a]),o),n);return s}function JX(t,e){const n=new Map;for(let r=0;rObject.prototype.propertyIsEnumerable.call(t,e))}function UP(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const iq="[object RegExp]",M5="[object String]",E5="[object Number]",A5="[object Boolean]",T5="[object Arguments]",sq="[object Symbol]",oq="[object Date]",aq="[object Map]",lq="[object Set]",cq="[object Array]",uq="[object ArrayBuffer]",dq="[object Object]",fq="[object DataView]",hq="[object Uint8Array]",pq="[object Uint8ClampedArray]",mq="[object Uint16Array]",gq="[object Uint32Array]",vq="[object Int8Array]",yq="[object Int16Array]",xq="[object Int32Array]",bq="[object Float32Array]",_q="[object Float64Array]",jI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function wq(t){return typeof jI.Buffer<"u"&&jI.Buffer.isBuffer(t)}function Sq(t,e){return eh(t,void 0,t,new Map,e)}function eh(t,e,n,r=new Map,i=void 0){const s=i==null?void 0:i(t,e,n,r);if(s!==void 0)return s;if(eC(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const o=new Array(t.length);r.set(t,o);for(let a=0;a{}):tC(t,e,function r(i,s,o,a,l,c){const d=n(i,s,o,a,l,c);return d!==void 0?!!d:tC(i,s,r,c,!1)},new Map,!0)}function tC(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return Aq(t,e,n,r);case"function":return Object.keys(e).length>0?tC(t,{...e},n,r,i):F_(t,e);default:return C5(t)&&i?typeof e=="string"?e==="":!0:F_(t,e)}}function Aq(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return R5(t,e,n,r);if(e instanceof Map)return Tq(t,e,n,r);if(e instanceof Set)return Cq(t,e,n,r);const i=Object.keys(e);if(t==null||eC(t))return i.length===0;if(i.length===0)return!0;if(r!=null&&r.has(e))return r.get(e)===t;r==null||r.set(e,t);try{for(let s=0;s{})}function Pq(t){return t=Eq(t),e=>N5(e,t)}function Rq(t,e){return Sq(t,(n,r,i,s)=>{if(typeof t=="object"){if(UP(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),Oa(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case E5:case M5:case A5:{const o=new t.constructor(t==null?void 0:t.valueOf());return Oa(o,t),o}case T5:{const o={};return Oa(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function Nq(t){return Rq(t)}const Iq=/^(?:0|[1-9]\d*)$/;function I5(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t=0}function k5(t){return t!=null&&typeof t!="function"&&jq(t.length)}function Uq(t){return typeof t=="object"&&t!==null}function Fq(t){return Uq(t)&&k5(t)}function UI(t,e=S5){return Fq(t)?JX(Array.from(t),eq(Dq(e),1)):[]}function zq(t,e,n){return e===!0?UI(t,n):typeof e=="function"?UI(t,e):t}var gE={exports:{}},vE={},yE={exports:{}},xE={};/** +`)},U$=0,rm=[];function F$(t){var e=P.useRef([]),n=P.useRef([0,0]),r=P.useRef(),i=P.useState(U$++)[0],s=P.useState(EF)[0],o=P.useRef(t);P.useEffect(function(){o.current=t},[t]),P.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=o$([t.lockRef.current],(t.shards||[]).map(PI),!0).filter(Boolean);return S.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=P.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!o.current.allowPinchZoom;var b=yb(S),M=n.current,T="deltaX"in S?S.deltaX:M[0]-b[0],C="deltaY"in S?S.deltaY:M[1]-b[1],O,N=S.target,L=Math.abs(T)>Math.abs(C)?"h":"v";if("touches"in S&&L==="h"&&N.type==="range")return!1;var F=window.getSelection(),G=F&&F.anchorNode,k=G?G===N||G.contains(N):!1;if(k)return!1;var U=TI(L,N);if(!U)return!0;if(U?O=L:(O=L==="v"?"h":"v",U=TI(L,N)),!U)return!1;if(!r.current&&"changedTouches"in S&&(T||C)&&(r.current=O),!O)return!0;var H=r.current||O;return L$(H,w,S,H==="h"?T:C)},[]),l=P.useCallback(function(S){var w=S;if(!(!rm.length||rm[rm.length-1]!==s)){var b="deltaY"in w?CI(w):yb(w),M=e.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&D$(O.delta,b)})[0];if(M&&M.should){w.cancelable&&w.preventDefault();return}if(!M){var T=(o.current.shards||[]).map(PI).filter(Boolean).filter(function(O){return O.contains(w.target)}),C=T.length>0?a(w,T[0]):!o.current.noIsolation;C&&w.cancelable&&w.preventDefault()}}},[]),c=P.useCallback(function(S,w,b,M){var T={name:S,delta:w,target:b,should:M,shadowParent:z$(b)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(C){return C!==T})},1)},[]),d=P.useCallback(function(S){n.current=yb(S),r.current=void 0},[]),f=P.useCallback(function(S){c(S.type,CI(S),S.target,a(S,t.lockRef.current))},[]),g=P.useCallback(function(S){c(S.type,yb(S),S.target,a(S,t.lockRef.current))},[]);P.useEffect(function(){return rm.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",l,nm),document.addEventListener("touchmove",l,nm),document.addEventListener("touchstart",d,nm),function(){rm=rm.filter(function(S){return S!==s}),document.removeEventListener("wheel",l,nm),document.removeEventListener("touchmove",l,nm),document.removeEventListener("touchstart",d,nm)}},[]);var y=t.removeScrollBar,x=t.inert;return P.createElement(P.Fragment,null,x?P.createElement(s,{styles:j$(i)}):null,y?P.createElement(C$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function z$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const B$=m$(MF,F$);var PF=P.forwardRef(function(t,e){return P.createElement(Z1,_l({},t,{ref:e,sideCar:B$}))});PF.classNames=Z1.classNames;var H$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},im=new WeakMap,xb=new WeakMap,bb={},pE=0,RF=function(t){return t&&(t.host||RF(t.parentNode))},V$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=RF(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},G$=function(t,e,n,r){var i=V$(e,Array.isArray(t)?t:[t]);bb[n]||(bb[n]=new WeakMap);var s=bb[n],o=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(g){if(a.has(g))d(g);else try{var y=g.getAttribute(r),x=y!==null&&y!=="false",S=(im.get(g)||0)+1,w=(s.get(g)||0)+1;im.set(g,S),s.set(g,w),o.push(g),S===1&&x&&xb.set(g,!0),w===1&&g.setAttribute(n,"true"),x||g.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",g,b)}})};return d(e),a.clear(),pE++,function(){o.forEach(function(f){var g=im.get(f)-1,y=s.get(f)-1;im.set(f,g),s.set(f,y),g||(xb.has(f)||f.removeAttribute(r),xb.delete(f)),y||f.removeAttribute(n)}),pE--,pE||(im=new WeakMap,im=new WeakMap,xb=new WeakMap,bb={})}},W$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=H$(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),G$(r,i,n,"aria-hidden")):function(){return null}},Q1="Dialog",[NF]=x9(Q1),[$$,$a]=NF(Q1),IF=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=P.useRef(null),l=P.useRef(null),[c,d]=M9({prop:r,defaultProp:i??!1,onChange:s,caller:Q1});return p.jsx($$,{scope:e,triggerRef:a,contentRef:l,contentId:Vc(),titleId:Vc(),descriptionId:Vc(),open:c,onOpenChange:d,onOpenToggle:P.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};IF.displayName=Q1;var kF="DialogTrigger",X$=P.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$a(kF,n),s=qh(e,i.triggerRef);return p.jsx(Wi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":CP(i.open),...r,ref:s,onClick:_d(t.onClick,i.onOpenToggle)})});X$.displayName=kF;var TP="DialogPortal",[q$,OF]=NF(TP,{forceMount:void 0}),LF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=$a(TP,e);return p.jsx(q$,{scope:e,forceMount:n,children:P.Children.map(r,o=>p.jsx(Y1,{present:n||s.open,children:p.jsx(_F,{asChild:!0,container:i,children:o})}))})};LF.displayName=TP;var sw="DialogOverlay",DF=P.forwardRef((t,e)=>{const n=OF(sw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=$a(sw,t.__scopeDialog);return s.modal?p.jsx(Y1,{present:r||s.open,children:p.jsx(Y$,{...i,ref:e})}):null});DF.displayName=sw;var K$=gF("DialogOverlay.RemoveScroll"),Y$=P.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$a(sw,n),s=G9(),o=qh(e,s);return p.jsx(PF,{as:K$,allowPinchZoom:!0,shards:[i.contentRef],children:p.jsx(Wi.div,{"data-state":CP(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),Sg="DialogContent",jF=P.forwardRef((t,e)=>{const n=OF(Sg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=$a(Sg,t.__scopeDialog);return p.jsx(Y1,{present:r||s.open,children:s.modal?p.jsx(Z$,{...i,ref:e}):p.jsx(Q$,{...i,ref:e})})});jF.displayName=Sg;var Z$=P.forwardRef((t,e)=>{const n=$a(Sg,t.__scopeDialog),r=P.useRef(null),i=qh(e,n.contentRef,r);return P.useEffect(()=>{const s=r.current;if(s)return W$(s)},[]),p.jsx(UF,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_d(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:_d(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:_d(t.onFocusOutside,s=>s.preventDefault())})}),Q$=P.forwardRef((t,e)=>{const n=$a(Sg,t.__scopeDialog),r=P.useRef(!1),i=P.useRef(!1);return p.jsx(UF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),UF=P.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=$a(Sg,n);return s$(),p.jsx(p.Fragment,{children:p.jsx(xF,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:p.jsx(vF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":CP(a.open),...o,ref:e,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),FF="DialogTitle",J$=P.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$a(FF,n);return p.jsx(Wi.h2,{id:i.titleId,...r,ref:e})});J$.displayName=FF;var zF="DialogDescription",e7=P.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$a(zF,n);return p.jsx(Wi.p,{id:i.descriptionId,...r,ref:e})});e7.displayName=zF;var BF="DialogClose",t7=P.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=$a(BF,n);return p.jsx(Wi.button,{type:"button",...r,ref:e,onClick:_d(t.onClick,()=>i.onOpenChange(!1))})});t7.displayName=BF;function CP(t){return t?"open":"closed"}var r0='[cmdk-group=""]',mE='[cmdk-group-items=""]',n7='[cmdk-group-heading=""]',HF='[cmdk-item=""]',RI=`${HF}:not([aria-disabled="true"])`,WT="cmdk-item-select",jm="data-value",r7=(t,e,n)=>y9(t,e,n),VF=P.createContext(void 0),Wy=()=>P.useContext(VF),GF=P.createContext(void 0),PP=()=>P.useContext(GF),WF=P.createContext(void 0),$F=P.forwardRef((t,e)=>{let n=Um(()=>{var q,he;return{search:"",value:(he=(q=t.value)!=null?q:t.defaultValue)!=null?he:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Um(()=>new Set),i=Um(()=>new Map),s=Um(()=>new Map),o=Um(()=>new Set),a=XF(t),{label:l,children:c,value:d,onValueChange:f,filter:g,shouldFilter:y,loop:x,disablePointerSelection:S=!1,vimBindings:w=!0,...b}=t,M=Vc(),T=Vc(),C=Vc(),O=P.useRef(null),N=p7();Rh(()=>{if(d!==void 0){let q=d.trim();n.current.value=q,L.emit()}},[d]),Rh(()=>{N(6,te)},[]);let L=P.useMemo(()=>({subscribe:q=>(o.current.add(q),()=>o.current.delete(q)),snapshot:()=>n.current,setState:(q,he,ae)=>{var ce,we,Ee,Xe;if(!Object.is(n.current[q],he)){if(n.current[q]=he,q==="search")H(),k(),N(1,U);else if(q==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Se=document.getElementById(C);Se?Se.focus():(ce=document.getElementById(M))==null||ce.focus()}if(N(7,()=>{var Se;n.current.selectedItemId=(Se=ee())==null?void 0:Se.id,L.emit()}),ae||N(5,te),((we=a.current)==null?void 0:we.value)!==void 0){let Se=he??"";(Xe=(Ee=a.current).onValueChange)==null||Xe.call(Ee,Se);return}}L.emit()}},emit:()=>{o.current.forEach(q=>q())}}),[]),F=P.useMemo(()=>({value:(q,he,ae)=>{var ce;he!==((ce=s.current.get(q))==null?void 0:ce.value)&&(s.current.set(q,{value:he,keywords:ae}),n.current.filtered.items.set(q,G(he,ae)),N(2,()=>{k(),L.emit()}))},item:(q,he)=>(r.current.add(q),he&&(i.current.has(he)?i.current.get(he).add(q):i.current.set(he,new Set([q]))),N(3,()=>{H(),k(),n.current.value||U(),L.emit()}),()=>{s.current.delete(q),r.current.delete(q),n.current.filtered.items.delete(q);let ae=ee();N(4,()=>{H(),(ae==null?void 0:ae.getAttribute("id"))===q&&U(),L.emit()})}),group:q=>(i.current.has(q)||i.current.set(q,new Set),()=>{s.current.delete(q),i.current.delete(q)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:M,inputId:C,labelId:T,listInnerRef:O}),[]);function G(q,he){var ae,ce;let we=(ce=(ae=a.current)==null?void 0:ae.filter)!=null?ce:r7;return q?we(q,n.current.search,he):0}function k(){if(!n.current.search||a.current.shouldFilter===!1)return;let q=n.current.filtered.items,he=[];n.current.filtered.groups.forEach(ce=>{let we=i.current.get(ce),Ee=0;we.forEach(Xe=>{let Se=q.get(Xe);Ee=Math.max(Se,Ee)}),he.push([ce,Ee])});let ae=O.current;pe().sort((ce,we)=>{var Ee,Xe;let Se=ce.getAttribute("id"),je=we.getAttribute("id");return((Ee=q.get(je))!=null?Ee:0)-((Xe=q.get(Se))!=null?Xe:0)}).forEach(ce=>{let we=ce.closest(mE);we?we.appendChild(ce.parentElement===we?ce:ce.closest(`${mE} > *`)):ae.appendChild(ce.parentElement===ae?ce:ce.closest(`${mE} > *`))}),he.sort((ce,we)=>we[1]-ce[1]).forEach(ce=>{var we;let Ee=(we=O.current)==null?void 0:we.querySelector(`${r0}[${jm}="${encodeURIComponent(ce[0])}"]`);Ee==null||Ee.parentElement.appendChild(Ee)})}function U(){let q=pe().find(ae=>ae.getAttribute("aria-disabled")!=="true"),he=q==null?void 0:q.getAttribute(jm);L.setState("value",he||void 0)}function H(){var q,he,ae,ce;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let we=0;for(let Ee of r.current){let Xe=(he=(q=s.current.get(Ee))==null?void 0:q.value)!=null?he:"",Se=(ce=(ae=s.current.get(Ee))==null?void 0:ae.keywords)!=null?ce:[],je=G(Xe,Se);n.current.filtered.items.set(Ee,je),je>0&&we++}for(let[Ee,Xe]of i.current)for(let Se of Xe)if(n.current.filtered.items.get(Se)>0){n.current.filtered.groups.add(Ee);break}n.current.filtered.count=we}function te(){var q,he,ae;let ce=ee();ce&&(((q=ce.parentElement)==null?void 0:q.firstChild)===ce&&((ae=(he=ce.closest(r0))==null?void 0:he.querySelector(n7))==null||ae.scrollIntoView({block:"nearest"})),ce.scrollIntoView({block:"nearest"}))}function ee(){var q;return(q=O.current)==null?void 0:q.querySelector(`${HF}[aria-selected="true"]`)}function pe(){var q;return Array.from(((q=O.current)==null?void 0:q.querySelectorAll(RI))||[])}function ie(q){let he=pe()[q];he&&L.setState("value",he.getAttribute(jm))}function fe(q){var he;let ae=ee(),ce=pe(),we=ce.findIndex(Xe=>Xe===ae),Ee=ce[we+q];(he=a.current)!=null&&he.loop&&(Ee=we+q<0?ce[ce.length-1]:we+q===ce.length?ce[0]:ce[we+q]),Ee&&L.setState("value",Ee.getAttribute(jm))}function B(q){let he=ee(),ae=he==null?void 0:he.closest(r0),ce;for(;ae&&!ce;)ae=q>0?f7(ae,r0):h7(ae,r0),ce=ae==null?void 0:ae.querySelector(RI);ce?L.setState("value",ce.getAttribute(jm)):fe(q)}let Q=()=>ie(pe().length-1),K=q=>{q.preventDefault(),q.metaKey?Q():q.altKey?B(1):fe(1)},V=q=>{q.preventDefault(),q.metaKey?ie(0):q.altKey?B(-1):fe(-1)};return P.createElement(Wi.div,{ref:e,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:q=>{var he;(he=b.onKeyDown)==null||he.call(b,q);let ae=q.nativeEvent.isComposing||q.keyCode===229;if(!(q.defaultPrevented||ae))switch(q.key){case"n":case"j":{w&&q.ctrlKey&&K(q);break}case"ArrowDown":{K(q);break}case"p":case"k":{w&&q.ctrlKey&&V(q);break}case"ArrowUp":{V(q);break}case"Home":{q.preventDefault(),ie(0);break}case"End":{q.preventDefault(),Q();break}case"Enter":{q.preventDefault();let ce=ee();if(ce){let we=new Event(WT);ce.dispatchEvent(we)}}}}},P.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:g7},l),J1(t,q=>P.createElement(GF.Provider,{value:L},P.createElement(VF.Provider,{value:F},q))))}),i7=P.forwardRef((t,e)=>{var n,r;let i=Vc(),s=P.useRef(null),o=P.useContext(WF),a=Wy(),l=XF(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Rh(()=>{if(!c)return a.item(i,o==null?void 0:o.id)},[c]);let d=qF(i,s,[t.value,t.children,s],t.keywords),f=PP(),g=Ed(N=>N.value&&N.value===d.current),y=Ed(N=>c||a.filter()===!1?!0:N.search?N.filtered.items.get(i)>0:!0);P.useEffect(()=>{let N=s.current;if(!(!N||t.disabled))return N.addEventListener(WT,x),()=>N.removeEventListener(WT,x)},[y,t.onSelect,t.disabled]);function x(){var N,L;S(),(L=(N=l.current).onSelect)==null||L.call(N,d.current)}function S(){f.setState("value",d.current,!0)}if(!y)return null;let{disabled:w,value:b,onSelect:M,forceMount:T,keywords:C,...O}=t;return P.createElement(Wi.div,{ref:wg(s,e),...O,id:i,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!g,"data-disabled":!!w,"data-selected":!!g,onPointerMove:w||a.getDisablePointerSelection()?void 0:S,onClick:w?void 0:x},t.children)}),s7=P.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,o=Vc(),a=P.useRef(null),l=P.useRef(null),c=Vc(),d=Wy(),f=Ed(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(o):!0);Rh(()=>d.group(o),[]),qF(o,a,[t.value,t.heading,l]);let g=P.useMemo(()=>({id:o,forceMount:i}),[i]);return P.createElement(Wi.div,{ref:wg(a,e),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&P.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),J1(t,y=>P.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},P.createElement(WF.Provider,{value:g},y))))}),o7=P.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=P.useRef(null),s=Ed(o=>!o.search);return!n&&!s?null:P.createElement(Wi.div,{ref:wg(i,e),...r,"cmdk-separator":"",role:"separator"})}),a7=P.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=PP(),o=Ed(c=>c.search),a=Ed(c=>c.selectedItemId),l=Wy();return P.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),P.createElement(Wi.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?t.value:o,onChange:c=>{i||s.setState("search",c.target.value),n==null||n(c.target.value)}})}),l7=P.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=P.useRef(null),o=P.useRef(null),a=Ed(c=>c.selectedItemId),l=Wy();return P.useEffect(()=>{if(o.current&&s.current){let c=o.current,d=s.current,f,g=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let y=c.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return g.observe(c),()=>{cancelAnimationFrame(f),g.unobserve(c)}}},[]),P.createElement(Wi.div,{ref:wg(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},J1(t,c=>P.createElement("div",{ref:wg(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),c7=P.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=t;return P.createElement(IF,{open:n,onOpenChange:r},P.createElement(LF,{container:o},P.createElement(DF,{"cmdk-overlay":"",className:i}),P.createElement(jF,{"aria-label":t.label,"cmdk-dialog":"",className:s},P.createElement($F,{ref:e,...a}))))}),u7=P.forwardRef((t,e)=>Ed(n=>n.filtered.count===0)?P.createElement(Wi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),d7=P.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return P.createElement(Wi.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},J1(t,o=>P.createElement("div",{"aria-hidden":!0},o)))}),sm=Object.assign($F,{List:l7,Item:i7,Input:a7,Group:s7,Separator:o7,Dialog:c7,Empty:u7,Loading:d7});function f7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function h7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function XF(t){let e=P.useRef(t);return Rh(()=>{e.current=t}),e}var Rh=typeof window>"u"?P.useEffect:P.useLayoutEffect;function Um(t){let e=P.useRef();return e.current===void 0&&(e.current=t()),e}function Ed(t){let e=PP(),n=()=>t(e.snapshot());return P.useSyncExternalStore(e.subscribe,n,n)}function qF(t,e,n,r=[]){let i=P.useRef(),s=Wy();return Rh(()=>{var o;let a=(()=>{var c;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(c=d.current.textContent)==null?void 0:c.trim():i.current}})(),l=r.map(c=>c.trim());s.value(t,a,l),(o=e.current)==null||o.setAttribute(jm,a),i.current=a}),i}var p7=()=>{let[t,e]=P.useState(),n=Um(()=>new Map);return Rh(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function m7(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function J1({asChild:t,children:e},n){return t&&P.isValidElement(e)?P.cloneElement(m7(e),{ref:e.ref},n(e.props.children)):n(e)}var g7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function v7({onNavigate:t}){const[e,n]=P.useState(!1);return P.useEffect(()=>{const r=i=>{(i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"&&(i.preventDefault(),n(s=>!s))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),p.jsx(sm.Dialog,{open:e,onOpenChange:n,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>n(!1),children:p.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:r=>r.stopPropagation(),children:[p.jsx(sm.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),p.jsxs(sm.List,{className:"max-h-80 overflow-y-auto p-2",children:[p.jsx(sm.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),p.jsx(sm.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:BT.map(r=>p.jsxs(sm.Item,{value:`${r.label} ${r.hint}`,onSelect:()=>{t(r.id),n(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[p.jsx(r.icon,{className:"h-4 w-4 text-primary"}),p.jsx("span",{children:r.label}),p.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:r.hint})]},r.id))})]})]})})}async function Lt(t,e){var l;const n={"Content-Type":"application/json",...e==null?void 0:e.headers},r=localStorage.getItem("mc_sudo_password"),i=localStorage.getItem("mc_hf_token");r&&(n["X-Sudo-Password"]=r);let s=e==null?void 0:e.body;if((((l=e==null?void 0:e.method)==null?void 0:l.toUpperCase())||"GET")==="POST"){if(typeof s=="string")try{const c=JSON.parse(s);let d=!1;r&&!("sudo_password"in c)&&(c.sudo_password=r,d=!0),i&&!("hf_token"in c)&&(c.hf_token=i,d=!0),d&&(s=JSON.stringify(c))}catch{}else if(!s){const c={};r&&(c.sudo_password=r),i&&(c.hf_token=i),Object.keys(c).length>0&&(s=JSON.stringify(c))}}const a=await fetch(t,{...e,headers:n,body:s});if(!a.ok)throw new Error(`${a.status} ${a.statusText}`);return a.json()}const y7=(t,e,n=!1,r=!0)=>Lt("/api/groups",{method:"PUT",body:JSON.stringify({group:t,members:e,swap:n,persist:r})}),x7=t=>Lt("/api/routing/policy",{method:"PUT",body:JSON.stringify(t)}),Jn={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],groups:["groups"],routing:["routing"],routingPolicy:["routing-policy"],voiceMetrics:["voice-metrics"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:t=>["drafts",t??""],connect:t=>["connect",t??""],connectHealth:["connect-health"],memory:(t,e)=>["memory",t??"",e??""],memoryGraph:["memory-graph"]},b7=(t=!0)=>ci({queryKey:Jn.memoryGraph,queryFn:()=>Lt("/api/memory/graph"),enabled:t}),_7=()=>ci({queryKey:Jn.health,queryFn:()=>Lt("/api/health"),refetchInterval:1e4}),eS=(t=5e3)=>ci({queryKey:Jn.systemStatus,queryFn:()=>Lt("/api/system/status"),refetchInterval:t}),w7=(t=3e3)=>ci({queryKey:Jn.services,queryFn:()=>Lt("/api/system/services"),refetchInterval:t}),Kh=(t=4e3)=>ci({queryKey:Jn.models,queryFn:()=>Lt("/api/models"),refetchInterval:t}),S7=(t=8e3)=>ci({queryKey:Jn.groups,queryFn:()=>Lt("/api/groups"),refetchInterval:t}),M7=(t=4e3)=>ci({queryKey:Jn.routing,queryFn:()=>Lt("/api/routing"),refetchInterval:t}),E7=(t=5e3)=>ci({queryKey:Jn.voiceMetrics,queryFn:()=>Lt("/api/voice/metrics"),refetchInterval:t}),A7=()=>ci({queryKey:Jn.routingPolicy,queryFn:()=>Lt("/api/routing/policy")}),T7=(t=2e3)=>ci({queryKey:Jn.jobs,queryFn:()=>Lt("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),RP=(t=3e3)=>ci({queryKey:Jn.tokenStats,queryFn:()=>Lt("/api/system/token-stats"),refetchInterval:t}),NP=(t=5e3)=>ci({queryKey:Jn.agentStatus,queryFn:()=>Lt("/api/agent/status"),refetchInterval:t}),C7=(t=6e4)=>ci({queryKey:Jn.hermesBrain,queryFn:()=>Lt("/api/agent/brain"),refetchInterval:t}),IP=t=>ci({queryKey:Jn.updates,queryFn:()=>Lt("/api/maintenance/updates"),refetchInterval:t}),P7=()=>ci({queryKey:Jn.discover,queryFn:()=>Lt("/api/discover")}),R7=t=>ci({queryKey:Jn.drafts(t),queryFn:()=>Lt(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),KF=t=>ci({queryKey:Jn.connect(t),queryFn:()=>Lt(t?`/api/connect?${t}`:"/api/connect")}),N7=()=>ci({queryKey:Jn.connectHealth,queryFn:()=>Lt("/api/connect/health"),refetchInterval:15e3}),$T=t=>ci({queryKey:Jn.memory(t==null?void 0:t.q,t==null?void 0:t.category),queryFn:()=>{const e=new URLSearchParams;return t!=null&&t.q&&e.set("q",t.q),t!=null&&t.category&&e.set("category",t.category),Lt(`/api/memory?${e}`)},select:e=>t!=null&&t.limit?e.slice(0,t.limit):e});function om(t){return(t/1024**3).toFixed(1)}function XT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Wo(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function I7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function NI(t){return t?`${Math.round(t/1024)}k`:"—"}function YF(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=L7(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(kP);return a[0]===""&&a.length!==1&&a.shift(),ZF(a,e)||O7(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},ZF=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?ZF(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(kP);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},II=/^\[(.+)\]$/,O7=t=>{if(II.test(t)){const e=II.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},L7=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return j7(Object.entries(t.classGroups),n).forEach(([s,o])=>{qT(o,r,s,e)}),r},qT=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:kI(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(D7(i)){qT(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{qT(o,kI(e,s),n,r)})})},kI=(t,e)=>{let n=t;return e.split(kP).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},D7=t=>t.isThemeGetter,j7=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[n,i]}):t,U7=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},QF="!",F7=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=a=>{const l=[];let c=0,d=0,f;for(let w=0;wd?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:S}};return n?a=>n({className:a,parseClassName:o}):o},z7=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},B7=t=>({cache:U7(t.cacheSize),parseClassName:F7(t),...k7(t)}),H7=/\s+/,V7=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(H7);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:d,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:y}=n(c);let x=!!y,S=r(x?g.substring(0,y):g);if(!S){if(!x){a=c+(a.length>0?" "+a:a);continue}if(S=r(g),!S){a=c+(a.length>0?" "+a:a);continue}x=!1}const w=z7(d).join(":"),b=f?w+QF:w,M=b+S;if(s.includes(M))continue;s.push(M);const T=i(S,x);for(let C=0;C0?" "+a:a)}return a};function G7(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=B7(c),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=V7(l,n);return i(l,d),d}return function(){return s(G7.apply(null,arguments))}}const ar=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},e5=/^\[(?:([a-z-]+):)?(.+)\]$/i,$7=/^\d+\/\d+$/,X7=new Set(["px","full","screen"]),q7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,K7=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Y7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Z7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Q7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sc=t=>Jm(t)||X7.has(t)||$7.test(t),Gu=t=>Hg(t,"length",oX),Jm=t=>!!t&&!Number.isNaN(Number(t)),gE=t=>Hg(t,"number",Jm),i0=t=>!!t&&Number.isInteger(Number(t)),J7=t=>t.endsWith("%")&&Jm(t.slice(0,-1)),pn=t=>e5.test(t),Wu=t=>q7.test(t),eX=new Set(["length","size","percentage"]),tX=t=>Hg(t,eX,t5),nX=t=>Hg(t,"position",t5),rX=new Set(["image","url"]),iX=t=>Hg(t,rX,lX),sX=t=>Hg(t,"",aX),s0=()=>!0,Hg=(t,e,n)=>{const r=e5.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},oX=t=>K7.test(t)&&!Y7.test(t),t5=()=>!1,aX=t=>Z7.test(t),lX=t=>Q7.test(t),cX=()=>{const t=ar("colors"),e=ar("spacing"),n=ar("blur"),r=ar("brightness"),i=ar("borderColor"),s=ar("borderRadius"),o=ar("borderSpacing"),a=ar("borderWidth"),l=ar("contrast"),c=ar("grayscale"),d=ar("hueRotate"),f=ar("invert"),g=ar("gap"),y=ar("gradientColorStops"),x=ar("gradientColorStopPositions"),S=ar("inset"),w=ar("margin"),b=ar("opacity"),M=ar("padding"),T=ar("saturate"),C=ar("scale"),O=ar("sepia"),N=ar("skew"),L=ar("space"),F=ar("translate"),G=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",pn,e],H=()=>[pn,e],te=()=>["",Sc,Gu],ee=()=>["auto",Jm,pn],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ie=()=>["solid","dashed","dotted","double","none"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",pn],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[Jm,pn];return{cacheSize:500,separator:":",theme:{colors:[s0],spacing:[Sc,Gu],blur:["none","",Wu,pn],brightness:V(),borderColor:[t],borderRadius:["none","","full",Wu,pn],borderSpacing:H(),borderWidth:te(),contrast:V(),grayscale:Q(),hueRotate:V(),invert:Q(),gap:H(),gradientColorStops:[t],gradientColorStopPositions:[J7,Gu],inset:U(),margin:U(),opacity:V(),padding:H(),saturate:V(),scale:V(),sepia:Q(),skew:V(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",pn]}],container:["container"],columns:[{columns:[Wu]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...pe(),pn]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",i0,pn]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",pn]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",i0,pn]}],"grid-cols":[{"grid-cols":[s0]}],"col-start-end":[{col:["auto",{span:["full",i0,pn]},pn]}],"col-start":[{"col-start":ee()}],"col-end":[{"col-end":ee()}],"grid-rows":[{"grid-rows":[s0]}],"row-start-end":[{row:["auto",{span:[i0,pn]},pn]}],"row-start":[{"row-start":ee()}],"row-end":[{"row-end":ee()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",pn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",pn]}],gap:[{gap:[g]}],"gap-x":[{"gap-x":[g]}],"gap-y":[{"gap-y":[g]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[M]}],px:[{px:[M]}],py:[{py:[M]}],ps:[{ps:[M]}],pe:[{pe:[M]}],pt:[{pt:[M]}],pr:[{pr:[M]}],pb:[{pb:[M]}],pl:[{pl:[M]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",pn,e]}],"min-w":[{"min-w":[pn,e,"min","max","fit"]}],"max-w":[{"max-w":[pn,e,"none","full","min","max","fit","prose",{screen:[Wu]},Wu]}],h:[{h:[pn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[pn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[pn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[pn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Wu,Gu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",gE]}],"font-family":[{font:[s0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",pn]}],"line-clamp":[{"line-clamp":["none",Jm,gE]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Sc,pn]}],"list-image":[{"list-image":["none",pn]}],"list-style-type":[{list:["none","disc","decimal",pn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ie(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Sc,Gu]}],"underline-offset":[{"underline-offset":["auto",Sc,pn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",pn]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",pn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...pe(),nX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",tX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},iX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...ie(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:ie()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...ie()]}],"outline-offset":[{"outline-offset":[Sc,pn]}],"outline-w":[{outline:[Sc,Gu]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Sc,Gu]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Wu,sX]}],"shadow-color":[{shadow:[s0]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...fe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":fe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wu,pn]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[T]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",pn]}],duration:[{duration:V()}],ease:[{ease:["linear","in","out","in-out",pn]}],delay:[{delay:V()}],animate:[{animate:["none","spin","ping","pulse","bounce",pn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[i0,pn]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",pn]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",pn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",pn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Sc,Gu,gE]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},uX=W7(cX);function tt(...t){return uX(ir(t))}function Mg(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const n5=["fast","heavy","coder","vision","scout"],dX={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"},OP=t=>t&&dX[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function fX({fit:t}){const e={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[t.level];return p.jsxs("span",{className:tt("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",e),children:[t.text," • ",t.req_gb," GB RAM"]})}function OI(t){const e=t.toLowerCase();return e.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:e.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:e.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:e.includes("mistral")||e.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:e.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:e.includes("hermes")||e.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:e.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function hX(){const{data:t}=Kh(2e3),{data:e}=RP(2e3),n=(t==null?void 0:t.models)??[],r=(t==null?void 0:t.running)??[],i=n.filter(l=>r.includes(l.name)),s=P.useRef(null),[o,a]=P.useState(!1);return P.useEffect(()=>{if(!e)return;const l=e.total_tokens;if(s.current!==null&&l>s.current){a(!0);const c=setTimeout(()=>a(!1),4e3);return s.current=l,()=>clearTimeout(c)}s.current=l},[e==null?void 0:e.total_tokens]),p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[p.jsxs("div",{className:"flex items-center justify-between mb-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(ay,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),p.jsxs("span",{className:tt("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",o?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[o?p.jsx(_h,{className:"h-3 w-3 animate-pulse"}):p.jsx(Z8,{className:"h-3 w-3"}),o?"Inferenz aktiv":"Idle"]})]}),i.length===0?p.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):p.jsx("div",{className:"grid gap-2",children:i.map(l=>{var c;return p.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.role&&p.jsx("span",{className:tt("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",OP(l.role)),children:l.role}),p.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(c=l.name.split("/").pop())==null?void 0:c.replace(/\.gguf$/i,"")})]}),p.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[Wo(l.size_bytes)," im Unified-RAM"]})]}),p.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[p.jsx("span",{className:tt("h-1.5 w-1.5 rounded-full bg-emerald-500",o&&"animate-pulse")})," warm"]})]},l.name)})})]})}let KT=[],YT=[];const ZT=new Set,r5=()=>ZT.forEach(t=>t());function i5(t){return ZT.add(t),()=>{ZT.delete(t)}}function pX(t){KT=[...KT,t].slice(-40),r5()}function mX(t){YT=[...YT,t].slice(-40),r5()}const gX=()=>P.useSyncExternalStore(i5,()=>KT),vX=()=>P.useSyncExternalStore(i5,()=>YT);function yX(){const{data:t,dataUpdatedAt:e}=eS(3e3),{data:n,dataUpdatedAt:r}=RP(3e3),i=P.useRef(null);P.useEffect(()=>{var s,o,a,l;t&&pX({t:Date.now(),cpu:((s=t.cpu)==null?void 0:s.percent)??0,ram:((o=t.ram)==null?void 0:o.percent)??0,gpu:((a=t.gpu)==null?void 0:a.busy_percent)??null,disk:((l=t.disk)==null?void 0:l.percent)??null})},[e]),P.useEffect(()=>{if(!n)return;const s=Date.now(),o=n.prompt_tokens,a=n.completion_tokens;if(i.current){const l=Math.max((s-i.current.t)/1e3,.001);mX({t:s,prompt:Math.max(0,(o-i.current.p)/l),completion:Math.max(0,(a-i.current.c)/l)})}i.current={p:o,c:a,t:s}},[r])}function xX(){const{data:t,error:e}=eS(3e3),n=gX();return{sys:t,hist:n,error:e}}var bX=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function LP(t){if(typeof t!="string")return!1;var e=bX;return e.includes(t)}var _X=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],wX=new Set(_X);function s5(t){return typeof t!="string"?!1:wX.has(t)}function o5(t){return typeof t=="string"&&t.startsWith("data-")}function Ba(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s5(n)||o5(n))&&(e[n]=t[n]);return e}function tS(t){if(t==null)return null;if(P.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return Ba(e)}return typeof t=="object"&&!Array.isArray(t)?Ba(t):null}function Qo(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s5(n)||o5(n)||LP(n))&&(e[n]=t[n]);return e}function SX(t){return t==null?null:P.isValidElement(t)?Qo(t.props):typeof t=="object"&&!Array.isArray(t)?Qo(t):null}var MX=["children","width","height","viewBox","className","style","title","desc"];function QT(){return QT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.width,i=t.height,s=t.viewBox,o=t.className,a=t.style,l=t.title,c=t.desc,d=EX(t,MX),f=s||{width:r,height:i,x:0,y:0},g=ir("recharts-surface",o);return P.createElement("svg",QT({},Qo(d),{className:g,width:r,height:i,style:a,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),P.createElement("title",null,l),P.createElement("desc",null,c),n)}),TX=["children","className"];function JT(){return JT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.className,i=CX(t,TX),s=ir("recharts-layer",r);return P.createElement("g",JT({className:s},Qo(i),{ref:e}),n)}),RX=P.createContext(null);function Cr(t){return function(){return t}}const eC=Math.PI,tC=2*eC,Wf=1e-6,NX=tC-Wf;function l5(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return l5;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;iWf)if(!(Math.abs(f*l-c*d)>Wf)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let y=r-o,x=i-a,S=l*l+c*c,w=y*y+x*x,b=Math.sqrt(S),M=Math.sqrt(g),T=s*Math.tan((eC-Math.acos((S+g-w)/(2*b*M)))/2),C=T/M,O=T/b;Math.abs(C-1)>Wf&&this._append`L${e+C*d},${n+C*f}`,this._append`A${s},${s},0,0,${+(f*y>d*x)},${this._x1=e+O*l},${this._y1=n+O*c}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),l=r*Math.sin(i),c=e+a,d=n+l,f=1^o,g=o?i-s:s-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Wf||Math.abs(this._y1-d)>Wf)&&this._append`L${c},${d}`,r&&(g<0&&(g=g%tC+tC),g>NX?this._append`A${r},${r},0,1,${f},${e-a},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=d}`:g>Wf&&this._append`A${r},${r},0,${+(g>=eC)},${f},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function c5(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new kX(e)}function DP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function u5(t){this._context=t}u5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function nS(t){return new u5(t)}function d5(t){return t[0]}function f5(t){return t[1]}function h5(t,e){var n=Cr(!0),r=null,i=nS,s=null,o=c5(a);t=typeof t=="function"?t:t===void 0?d5:Cr(t),e=typeof e=="function"?e:e===void 0?f5:Cr(e);function a(l){var c,d=(l=DP(l)).length,f,g=!1,y;for(r==null&&(s=i(y=o())),c=0;c<=d;++c)!(c=y;--x)a.point(T[x],C[x]);a.lineEnd(),a.areaEnd()}b&&(T[g]=+t(w,g,f),C[g]=+e(w,g,f),a.point(r?+r(w,g,f):T[g],n?+n(w,g,f):C[g]))}if(M)return a=null,M+""||null}function d(){return h5().defined(i).curve(o).context(s)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:Cr(+f),r=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Cr(+f),c):t},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Cr(+f),c):r},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:Cr(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Cr(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Cr(+f),c):n},c.lineX0=c.lineY0=function(){return d().x(t).y(e)},c.lineY1=function(){return d().x(t).y(n)},c.lineX1=function(){return d().x(r).y(e)},c.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Cr(!!f),c):i},c.curve=function(f){return arguments.length?(o=f,s!=null&&(a=o(s)),c):o},c.context=function(f){return arguments.length?(f==null?s=a=null:a=o(s=f),c):s},c}class p5{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function OX(t){return new p5(t,!0)}function LX(t){return new p5(t,!1)}function ow(){}function aw(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function m5(t){this._context=t}m5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:aw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:aw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function DX(t){return new m5(t)}function g5(t){this._context=t}g5.prototype={areaStart:ow,areaEnd:ow,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:aw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function jX(t){return new g5(t)}function v5(t){this._context=t}v5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:aw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function UX(t){return new v5(t)}function y5(t){this._context=t}y5.prototype={areaStart:ow,areaEnd:ow,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function FX(t){return new y5(t)}function LI(t){return t<0?-1:1}function DI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),a=(s*i+o*r)/(r+i);return(LI(s)+LI(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function jI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function vE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-r)/3;t._context.bezierCurveTo(r+a,i+a*e,s-a,o-a*n,s,o)}function lw(t){this._context=t}lw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:vE(this,this._t0,jI(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,vE(this,jI(this,n=DI(this,t,e)),n);break;default:vE(this,this._t0,n=DI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function x5(t){this._context=new b5(t)}(x5.prototype=Object.create(lw.prototype)).point=function(t,e){lw.prototype.point.call(this,e,t)};function b5(t){this._context=t}b5.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}};function zX(t){return new lw(t)}function BX(t){return new x5(t)}function _5(t){this._context=t}_5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=UI(t),i=UI(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function VX(t){return new rS(t,.5)}function GX(t){return new rS(t,0)}function WX(t){return new rS(t,1)}function Nh(t,e){if((o=t.length)>1)for(var n=1,r,i,s=t[e[0]],o,a=s.length;n=0;)n[e]=e;return n}function $X(t,e){return t[e]}function XX(t){const e=[];return e.key=t,e}function qX(){var t=Cr([]),e=nC,n=Nh,r=$X;function i(s){var o=Array.from(t.apply(this,arguments),XX),a,l=o.length,c=-1,d;for(const f of s)for(a=0,++c;a0){for(var n,r,i=0,s=t[0].length,o;i0){for(var n=0,r=t[e[0]],i,s=r.length;n0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:JX,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function Ui(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{var a=n[o-1];return typeof a=="string"?i+a+s:a!==void 0?i+xd(a)+s:i+s},"")}var qo=t=>t===0?0:t>0?1:-1,kl=t=>typeof t=="number"&&t!=+t,Ih=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,jt=t=>(typeof t=="number"||t instanceof Number)&&!kl(t),Ol=t=>jt(t)||typeof t=="string",eq=0,uy=t=>{var e=++eq;return"".concat(t||"").concat(e)},Ad=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!jt(e)&&typeof e!="string")return r;var s;if(Ih(e)){if(n==null)return r;var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return kl(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},M5=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;rr&&(typeof e=="function"?e(r):Yh(r,e))===n)}var Gi=t=>t===null||typeof t>"u",FP=t=>Gi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Qs(t){return t!=null}function Vg(){}var A5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,zP=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(P.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{LP(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},tq=(t,e,n)=>r=>(t(e,n,r),null),nq=(t,e,n)=>{if(t===null||typeof t!="object"&&typeof t!="function")return null;var r=null;return Object.keys(t).forEach(i=>{var s=t[i];LP(i)&&typeof s=="function"&&(r||(r={}),r[i]=tq(s,e,n))}),r};function FI(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rq(t){for(var e=1;e(o[a]===void 0&&r[a]!==void 0&&(o[a]=r[a]),o),n);return s}function aq(t,e){const n=new Map;for(let r=0;rObject.prototype.propertyIsEnumerable.call(t,e))}function BP(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const fq="[object RegExp]",C5="[object String]",P5="[object Number]",R5="[object Boolean]",N5="[object Arguments]",hq="[object Symbol]",pq="[object Date]",mq="[object Map]",gq="[object Set]",vq="[object Array]",yq="[object ArrayBuffer]",xq="[object Object]",bq="[object DataView]",_q="[object Uint8Array]",wq="[object Uint8ClampedArray]",Sq="[object Uint16Array]",Mq="[object Uint32Array]",Eq="[object Int8Array]",Aq="[object Int16Array]",Tq="[object Int32Array]",Cq="[object Float32Array]",Pq="[object Float64Array]",zI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function Rq(t){return typeof zI.Buffer<"u"&&zI.Buffer.isBuffer(t)}function Nq(t,e){return th(t,void 0,t,new Map,e)}function th(t,e,n,r=new Map,i=void 0){const s=i==null?void 0:i(t,e,n,r);if(s!==void 0)return s;if(iC(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const o=new Array(t.length);r.set(t,o);for(let a=0;a{}):sC(t,e,function r(i,s,o,a,l,c){const d=n(i,s,o,a,l,c);return d!==void 0?!!d:sC(i,s,r,c,!1)},new Map,!0)}function sC(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return Oq(t,e,n,r);case"function":return Object.keys(e).length>0?sC(t,{...e},n,r,i):z_(t,e);default:return I5(t)&&i?typeof e=="string"?e==="":!0:z_(t,e)}}function Oq(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return O5(t,e,n,r);if(e instanceof Map)return Lq(t,e,n,r);if(e instanceof Set)return Dq(t,e,n,r);const i=Object.keys(e);if(t==null||iC(t))return i.length===0;if(i.length===0)return!0;if(r!=null&&r.has(e))return r.get(e)===t;r==null||r.set(e,t);try{for(let s=0;s{})}function jq(t){return t=kq(t),e=>L5(e,t)}function Uq(t,e){return Nq(t,(n,r,i,s)=>{if(typeof t=="object"){if(BP(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),Oa(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case P5:case C5:case R5:{const o=new t.constructor(t==null?void 0:t.valueOf());return Oa(o,t),o}case N5:{const o={};return Oa(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function Fq(t){return Uq(t)}const zq=/^(?:0|[1-9]\d*)$/;function D5(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t=0}function j5(t){return t!=null&&typeof t!="function"&&Wq(t.length)}function $q(t){return typeof t=="object"&&t!==null}function Xq(t){return $q(t)&&j5(t)}function BI(t,e=T5){return Xq(t)?aq(Array.from(t),lq(Gq(e),1)):[]}function qq(t,e,n){return e===!0?BI(t,n):typeof e=="function"?BI(t,e):t}var yE={exports:{}},xE={},bE={exports:{}},_E={};/** * @license React * use-sync-external-store-shim.production.js * @@ -490,7 +505,7 @@ Error generating stack: `+j.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var FI;function Bq(){if(FI)return xE;FI=1;var t=$h();function e(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(f,m){var y=m(),x=r({inst:{value:y,getSnapshot:m}}),S=x[0].inst,_=x[1];return s(function(){S.value=y,S.getSnapshot=m,l(S)&&_({inst:S})},[f,y,m]),i(function(){return l(S)&&_({inst:S}),f(function(){l(S)&&_({inst:S})})},[f]),o(y),y}function l(f){var m=f.getSnapshot;f=f.value;try{var y=m();return!n(f,y)}catch{return!0}}function c(f,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return xE.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,xE}var zI;function Hq(){return zI||(zI=1,yE.exports=Bq()),yE.exports}/** + */var HI;function Kq(){if(HI)return _E;HI=1;var t=Xh();function e(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(f,g){var y=g(),x=r({inst:{value:y,getSnapshot:g}}),S=x[0].inst,w=x[1];return s(function(){S.value=y,S.getSnapshot=g,l(S)&&w({inst:S})},[f,y,g]),i(function(){return l(S)&&w({inst:S}),f(function(){l(S)&&w({inst:S})})},[f]),o(y),y}function l(f){var g=f.getSnapshot;f=f.value;try{var y=g();return!n(f,y)}catch{return!0}}function c(f,g){return g()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return _E.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,_E}var VI;function Yq(){return VI||(VI=1,bE.exports=Kq()),bE.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -498,12 +513,12 @@ Error generating stack: `+j.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var BI;function Vq(){if(BI)return vE;BI=1;var t=$h(),e=Hq();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return vE.useSyncExternalStoreWithSelector=function(c,d,f,m,y){var x=s(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=a(function(){function w(N){if(!E){if(E=!0,T=N,N=m(N),y!==void 0&&S.hasValue){var L=S.value;if(y(L,N))return C=L}return C=N}if(L=C,r(T,N))return L;var F=m(N);return y!==void 0&&y(L,F)?(T=N,L):(T=N,C=F)}var E=!1,T,C,O=f===void 0?null:f;return[function(){return w(d())},O===null?void 0:function(){return w(O())}]},[d,f,m,y]);var _=i(c,x[0],x[1]);return o(function(){S.hasValue=!0,S.value=_},[_]),l(_),_},vE}var HI;function Gq(){return HI||(HI=1,gE.exports=Vq()),gE.exports}var Wq=Gq(),FP=R.createContext(null),$q=t=>t,Xr=()=>{var t=R.useContext(FP);return t?t.store.dispatch:$q},z_=()=>{},Xq=()=>z_,qq=(t,e)=>t===e;function Vt(t){var e=R.useContext(FP),n=R.useMemo(()=>e?r=>{if(r!=null)return t(r)}:z_,[e,t]);return Wq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:Xq,e?e.store.getState:z_,e?e.store.getState:z_,n,qq)}function Kq(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Yq(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var VI=t=>Array.isArray(t)?t:[t];function Zq(t){const e=Array.isArray(t[0])?t[0]:t;return Yq(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function Qq(t,e){const n=[],{length:r}=t;for(let i=0;itypeof WeakRef>"u"?Jq:WeakRef,O5=eK(),tK=0,GI=1;function wb(){return{s:tK,v:void 0,o:null,p:null}}function nK(t){return t instanceof O5?t.deref():t}function L5(t,e={}){let n=wb();const{resultEqualityCheck:r}=e;let i,s=0;function o(){let a=n;const{length:l}=arguments;for(let f=0,m=l;f{n=wb(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function rK(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,o=0,a,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),Kq(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:m=[],argsMemoize:y=L5,argsMemoizeOptions:x=[]}=d,S=VI(m),_=VI(x),w=Zq(i),E=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){o++;const O=Qq(w,arguments);return a=E.apply(null,O),a},..._);return Object.assign(T,{resultFunc:c,memoizedResultFunc:E,dependencies:w,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var Ie=rK(L5);function iK(t,e=1){const n=[],r=Math.floor(e),i=(s,o)=>{for(let a=0;a{if(t!==e){const r=WI(t),i=WI(e);if(r===i&&r===0){if(te)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function D5(t){return typeof t=="symbol"||t instanceof Symbol}const oK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,aK=/^\w*$/;function lK(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||D5(t)?!0:typeof t=="string"&&(aK.test(t)||!oK.test(t))||e!=null}function cK(t,e,n,r){if(t==null)return[];n=n,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(a=>String(a));const i=(a,l)=>{let c=a;for(let d=0;dl==null||a==null?l:typeof a=="object"&&"key"in a?Object.hasOwn(l,a.key)?l[a.key]:i(l,a.path):typeof a=="function"?a(l):Array.isArray(a)?i(l,a):typeof l=="object"?l[a]:l,o=e.map(a=>(Array.isArray(a)&&a.length===1&&(a=a[0]),a==null||typeof a=="function"||Array.isArray(a)||lK(a)?a:{key:a,path:LP(a)}));return t.map(a=>({original:a,criteria:o.map(l=>s(l,a))})).slice().sort((a,l)=>{for(let c=0;ca.original)}function nS(t,...e){const n=e.length;return n>1&&nC(t,e[0],e[1])?e=[]:n>2&&nC(e[0],e[1],e[2])&&(e=[e[0]]),cK(t,iK(e),["asc"])}var j5=t=>t.legend.settings,uK=t=>t.legend.size,dK=t=>t.legend.payload;Ie([dK,j5],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?nS(r,n):r});function fK(t,e){return gK(t)||mK(t,e)||pK(t,e)||hK()}function hK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pK(t,e){if(t){if(typeof t=="string")return $I(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$I(t,e):void 0}}function $I(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nSb||Math.abs(t.left-e.left)>Sb||Math.abs(t.top-e.top)>Sb||Math.abs(t.width-e.width)>Sb}function qI(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function vK(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=R.useState({height:0,left:0,top:0,width:0}),n=fK(e,2),r=n[0],i=n[1],s=R.useRef(null),o=R.useRef(r);o.current=r;var a=R.useCallback(l=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),l!=null){var c=qI(l);if(XI(c,o.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=qI(l);XI(f,o.current)&&i(f)});d.observe(l),s.current=d}}},[...t]);return R.useEffect(()=>()=>{var l;(l=s.current)===null||l===void 0||l.disconnect()},[]),[r,a]}function Di(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var yK=typeof Symbol=="function"&&Symbol.observable||"@@observable",KI=yK,bE=()=>Math.random().toString(36).substring(7).split("").join("."),xK={INIT:`@@redux/INIT${bE()}`,REPLACE:`@@redux/REPLACE${bE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${bE()}`},lw=xK;function zP(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function U5(t,e,n){if(typeof t!="function")throw new Error(Di(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Di(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Di(1));return n(U5)(t,e)}let r=t,i=e,s=new Map,o=s,a=0,l=!1;function c(){o===s&&(o=new Map,s.forEach((_,w)=>{o.set(w,_)}))}function d(){if(l)throw new Error(Di(3));return i}function f(_){if(typeof _!="function")throw new Error(Di(4));if(l)throw new Error(Di(5));let w=!0;c();const E=a++;return o.set(E,_),function(){if(w){if(l)throw new Error(Di(6));w=!1,c(),o.delete(E),s=null}}}function m(_){if(!zP(_))throw new Error(Di(7));if(typeof _.type>"u")throw new Error(Di(8));if(typeof _.type!="string")throw new Error(Di(17));if(l)throw new Error(Di(9));try{l=!0,i=r(i,_)}finally{l=!1}return(s=o).forEach(E=>{E()}),_}function y(_){if(typeof _!="function")throw new Error(Di(10));r=_,m({type:lw.REPLACE})}function x(){const _=f;return{subscribe(w){if(typeof w!="object"||w===null)throw new Error(Di(11));function E(){const C=w;C.next&&C.next(d())}return E(),{unsubscribe:_(E)}},[KI](){return this}}}return m({type:lw.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:y,[KI]:x}}function bK(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:lw.INIT})>"u")throw new Error(Di(12));if(typeof n(void 0,{type:lw.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Di(13))})}function F5(t){const e=Object.keys(t),n={};for(let s=0;s"u")throw a&&a.type,new Error(Di(14));c[f]=x,l=l||x!==y}return l=l||r.length!==Object.keys(o).length,l?c:o}}function cw(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function _K(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(Di(15))};const o={getState:i.getState,dispatch:(l,...c)=>s(l,...c)},a=t.map(l=>l(o));return s=cw(...a)(i.dispatch),{...i,dispatch:s}}}function z5(t){return zP(t)&&"type"in t&&typeof t.type=="string"}var B5=Symbol.for("immer-nothing"),YI=Symbol.for("immer-draftable"),Rs=Symbol.for("immer-state");function Ua(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var _o=Object,Eg=_o.getPrototypeOf,uw="constructor",rS="prototype",rC="configurable",dw="enumerable",B_="writable",dy="value",Kc=t=>!!t&&!!t[Rs];function Ha(t){var e;return t?H5(t)||sS(t)||!!t[YI]||!!((e=t[uw])!=null&&e[YI])||oS(t)||aS(t):!1}var wK=_o[rS][uw].toString(),ZI=new WeakMap;function H5(t){if(!t||!BP(t))return!1;const e=Eg(t);if(e===null||e===_o[rS])return!0;const n=_o.hasOwnProperty.call(e,uw)&&e[uw];if(n===Object)return!0;if(!Fm(n))return!1;let r=ZI.get(n);return r===void 0&&(r=Function.toString.call(n),ZI.set(n,r)),r===wK}function iS(t,e,n=!0){$y(t)===0?(n?Reflect.ownKeys(t):_o.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function $y(t){const e=t[Rs];return e?e.type_:sS(t)?1:oS(t)?2:aS(t)?3:0}var QI=(t,e,n=$y(t))=>n===2?t.has(e):_o[rS].hasOwnProperty.call(t,e),iC=(t,e,n=$y(t))=>n===2?t.get(e):t[e],fw=(t,e,n,r=$y(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function SK(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var sS=Array.isArray,oS=t=>t instanceof Map,aS=t=>t instanceof Set,BP=t=>typeof t=="object",Fm=t=>typeof t=="function",_E=t=>typeof t=="boolean";function MK(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Ic=t=>t.copy_||t.base_,HP=t=>t.modified_?t.copy_:t.base_;function sC(t,e){if(oS(t))return new Map(t);if(aS(t))return new Set(t);if(sS(t))return Array[rS].slice.call(t);const n=H5(t);if(e===!0||e==="class_only"&&!n){const r=_o.getOwnPropertyDescriptors(t);delete r[Rs];let i=Reflect.ownKeys(r);for(let s=0;s1&&_o.defineProperties(t,{set:Mb,add:Mb,clear:Mb,delete:Mb}),_o.freeze(t),e&&iS(t,(n,r)=>{VP(r,!0)},!1)),t}function EK(){Ua(2)}var Mb={[dy]:EK};function lS(t){return t===null||!BP(t)?!0:_o.isFrozen(t)}var hw="MapSet",oC="Patches",JI="ArrayMethods",V5={};function Ih(t){const e=V5[t];return e||Ua(0,t),e}var ek=t=>!!V5[t],fy,G5=()=>fy,AK=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ek(hw)?Ih(hw):void 0,arrayMethodsPlugin_:ek(JI)?Ih(JI):void 0});function tk(t,e){e&&(t.patchPlugin_=Ih(oC),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function aC(t){lC(t),t.drafts_.forEach(TK),t.drafts_=null}function lC(t){t===fy&&(fy=t.parent_)}var nk=t=>fy=AK(fy,t);function TK(t){const e=t[Rs];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function rk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Rs].modified_&&(aC(e),Ua(4)),Ha(t)&&(t=ik(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Rs].base_,t,e)}else t=ik(e,n);return CK(e,t,!0),aC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==B5?t:void 0}function ik(t,e){if(lS(e))return e;const n=e[Rs];if(!n)return pw(e,t.handledSet_,t);if(!cS(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);X5(n,t)}return n.copy_}function CK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&VP(e,n)}function W5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var cS=(t,e)=>t.scope_===e,PK=[];function $5(t,e,n,r){const i=Ic(t),s=t.type_;if(r!==void 0&&iC(i,r,s)===e){fw(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;iS(i,(l,c)=>{if(Kc(c)){const d=a.get(c)||[];d.push(l),a.set(c,d)}})}const o=t.draftLocations_.get(e)??PK;for(const a of o)fw(i,a,n,s)}function RK(t,e,n){t.callbacks_.push(function(i){var a;const s=e;if(!s||!cS(s,i))return;(a=i.mapSetPlugin_)==null||a.fixSetContents(s);const o=HP(s);$5(t,s.draft_??s,o,n),X5(s,i)})}function X5(t,e){var r;if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(((r=t.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=e;if(i){const s=i.getPath(t);s&&i.generatePatches_(t,s,e)}W5(t)}}function NK(t,e,n){const{scope_:r}=t;if(Kc(n)){const i=n[Rs];cS(i,r)&&i.callbacks_.push(function(){H_(t);const o=HP(i);$5(t,n,o,e)})}else Ha(n)&&t.callbacks_.push(function(){const s=Ic(t);t.type_===3?s.has(n)&&pw(n,r.handledSet_,r):iC(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&pw(iC(t.copy_,e,t.type_),r.handledSet_,r)})}function pw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Kc(t)||e.has(t)||!Ha(t)||lS(t)||(e.add(t),iS(t,(r,i)=>{if(Kc(i)){const s=i[Rs];if(cS(s,n)){const o=HP(s);fw(t,r,o,t.type_),W5(s)}}else Ha(i)&&pw(i,e,n)})),t}function IK(t,e){const n=sS(t),r={type_:n?1:0,scope_:e?e.scope_:G5(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=mw;n&&(i=[r],s=hy);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var mw={get(t,e){if(e===Rs)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n!=null&&n.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=Ic(t);if(!QI(i,e,t.type_))return kK(t,i,e);const s=i[e];if(t.finalized_||!Ha(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&MK(e))return s;if(s===wE(t.base_,e)){H_(t);const o=t.type_===1?+e:e,a=uC(t.scope_,s,t,o);return t.copy_[o]=a}return s},has(t,e){return e in Ic(t)},ownKeys(t){return Reflect.ownKeys(Ic(t))},set(t,e,n){const r=q5(Ic(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=wE(Ic(t),e),s=i==null?void 0:i[Rs];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(SK(n,i)&&(n!==void 0||QI(t.base_,e,t.type_)))return!0;H_(t),cC(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),NK(t,e,n)),!0},deleteProperty(t,e){return H_(t),wE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),cC(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Ic(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[B_]:!0,[rC]:t.type_!==1||e!=="length",[dw]:r[dw],[dy]:n[e]}},defineProperty(){Ua(11)},getPrototypeOf(t){return Eg(t.base_)},setPrototypeOf(){Ua(12)}},hy={};for(let t in mw){let e=mw[t];hy[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}hy.deleteProperty=function(t,e){return hy.set.call(this,t,e,void 0)};hy.set=function(t,e,n){return mw.set.call(this,t[0],e,n,t[0])};function wE(t,e){const n=t[Rs];return(n?Ic(n):t)[e]}function kK(t,e,n){var i;const r=q5(e,n);return r?dy in r?r[dy]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function q5(t,e){if(!(e in t))return;let n=Eg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Eg(n)}}function cC(t){t.modified_||(t.modified_=!0,t.parent_&&cC(t.parent_))}function H_(t){t.copy_||(t.assigned_=new Map,t.copy_=sC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var OK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Fm(n)&&!Fm(r)){const o=r;r=n;const a=this;return function(c=o,...d){return a.produce(c,f=>r.call(this,f,...d))}}Fm(r)||Ua(6),i!==void 0&&!Fm(i)&&Ua(7);let s;if(Ha(n)){const o=nk(this),a=uC(o,n,void 0);let l=!0;try{s=r(a),l=!1}finally{l?aC(o):lC(o)}return tk(o,i),rk(s,o)}else if(!n||!BP(n)){if(s=r(n),s===void 0&&(s=n),s===B5&&(s=void 0),this.autoFreeze_&&VP(s,!0),i){const o=[],a=[];Ih(oC).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:a}),i(o,a)}return s}else Ua(1,n)},this.produceWithPatches=(n,r)=>{if(Fm(n))return(a,...l)=>this.produceWithPatches(a,c=>n(c,...l));let i,s;return[this.produce(n,r,(a,l)=>{i=a,s=l}),i,s]},_E(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),_E(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),_E(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ha(e)||Ua(8),Kc(e)&&(e=qo(e));const n=nk(this),r=uC(n,e,void 0);return r[Rs].isManual_=!0,lC(n),r}finishDraft(e,n){const r=e&&e[Rs];(!r||!r.isManual_)&&Ua(9);const{scope_:i}=r;return tk(i,n),rk(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}r>-1&&(n=n.slice(r+1));const i=Ih(oC).applyPatches_;return Kc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function uC(t,e,n,r){const[i,s]=oS(e)?Ih(hw).proxyMap_(e,n):aS(e)?Ih(hw).proxySet_(e,n):IK(e,n);return((n==null?void 0:n.scope_)??G5()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?RK(n,s,r):s.callbacks_.push(function(l){var d;(d=l.mapSetPlugin_)==null||d.fixSetContents(s);const{patchPlugin_:c}=l;s.modified_&&c&&c.generatePatches_(s,[],l)}),i}function qo(t){return Kc(t)||Ua(10,t),K5(t)}function K5(t){if(!Ha(t)||lS(t))return t;const e=t[Rs];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=sC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=sC(t,!0);return iS(n,(i,s)=>{fw(n,i,K5(s))},r),e&&(e.finalized_=!1),n}var LK=new OK,Y5=LK.produce;function Z5(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var DK=Z5(),jK=Z5,UK=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?cw:cw.apply(null,arguments)};function Eo(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(So(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>z5(r)&&r.type===t,n}var Q5=class z0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,z0.prototype)}static get[Symbol.species](){return z0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new z0(...e[0].concat(this)):new z0(...e.concat(this))}};function sk(t){return Ha(t)?Y5(t,()=>{}):t}function Eb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function FK(t){return typeof t=="boolean"}var zK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new Q5;return n&&(FK(n)?o.push(DK):o.push(jK(n.extraArgument))),o},J5="RTK_autoBatch",ar=()=>t=>({payload:t,meta:{[J5]:!0}}),ok=t=>e=>{setTimeout(e,t)},BK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(o),n())},s=t(i),o=setTimeout(i,e)},e4=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,o=!1;const a=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?BK(window.requestAnimationFrame,100):ok(10):t.type==="callback"?t.queueNotification:ok(t.timeout),c=()=>{o=!1,s&&(s=!1,a.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),m=r.subscribe(f);return a.add(d),()=>{m(),a.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[J5]),s=!i,s&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},HK=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new Q5(t);return r&&i.push(e4(typeof r=="object"?r:void 0)),i};function VK(t){const e=zK(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let a;if(typeof n=="function")a=n;else if(zP(n))a=F5(n);else throw new Error(So(1));let l;typeof r=="function"?l=r(e):l=e();let c=cw;i&&(c=UK({trace:!1,...typeof i=="object"&&i}));const d=_K(...l),f=HK(d);let m=typeof o=="function"?o(f):f();const y=c(...m);return U5(a,s,y)}function t4(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(So(28));if(a in e)throw new Error(So(29));return e[a]=o,i},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function GK(t){return typeof t=="function"}function WK(t,e){let[n,r,i]=t4(e),s;if(GK(t))s=()=>sk(t());else{const a=sk(t);s=()=>a}function o(a=s(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[i]),c.reduce((d,f)=>{if(f)if(Kc(d)){const y=f(d,l);return y===void 0?d:y}else{if(Ha(d))return Y5(d,m=>f(m,l));{const m=f(d,l);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},a)}return o.getInitialState=s,o}var $K="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",XK=(t=21)=>{let e="",n=t;for(;n--;)e+=$K[Math.random()*64|0];return e},qK=Symbol.for("rtk-slice-createasyncthunk");function KK(t,e){return`${t}/${e}`}function YK({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[qK];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(So(11));const a=(typeof i.reducers=="function"?i.reducers(QK()):i.reducers)||{},l=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(C,O){const N=typeof C=="string"?C:C.type;if(!N)throw new Error(So(12));if(N in c.sliceCaseReducersByType)throw new Error(So(13));return c.sliceCaseReducersByType[N]=O,d},addMatcher(C,O){return c.sliceMatchers.push({matcher:C,reducer:O}),d},exposeAction(C,O){return c.actionCreators[C]=O,d},exposeCaseReducer(C,O){return c.sliceCaseReducersByName[C]=O,d}};l.forEach(C=>{const O=a[C],N={reducerName:C,type:KK(s,C),createNotation:typeof i.reducers=="function"};eY(O)?nY(N,O,d,e):JK(N,O,d)});function f(){const[C={},O=[],N=void 0]=typeof i.extraReducers=="function"?t4(i.extraReducers):[i.extraReducers],L={...C,...c.sliceCaseReducersByType};return WK(i.initialState,F=>{for(let G in L)F.addCase(G,L[G]);for(let G of c.sliceMatchers)F.addMatcher(G.matcher,G.reducer);for(let G of O)F.addMatcher(G.matcher,G.reducer);N&&F.addDefaultCase(N)})}const m=C=>C,y=new Map,x=new WeakMap;let S;function _(C,O){return S||(S=f()),S(C,O)}function w(){return S||(S=f()),S.getInitialState()}function E(C,O=!1){function N(F){let G=F[C];return typeof G>"u"&&O&&(G=Eb(x,N,w)),G}function L(F=m){const G=Eb(y,O,()=>new WeakMap);return Eb(G,F,()=>{const k={};for(const[U,H]of Object.entries(i.selectors??{}))k[U]=ZK(H,F,()=>Eb(x,F,w),O);return k})}return{reducerPath:C,getSelectors:L,get selectors(){return L(N)},selectSlice:N}}const T={name:s,reducer:_,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:w,...E(o),injectInto(C,{reducerPath:O,...N}={}){const L=O??o;return C.inject({reducerPath:L,reducer:_},N),{...T,...E(L,!0)}}};return T}}function ZK(t,e,n,r){function i(s,...o){let a=e(s);return typeof a>"u"&&r&&(a=n()),t(a,...o)}return i.unwrapped=t,i}var ds=YK();function QK(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function JK({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!tY(r))throw new Error(So(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Eo(t,o):Eo(t))}function eY(t){return t._reducerDefinitionType==="asyncThunk"}function tY(t){return t._reducerDefinitionType==="reducerWithPrepare"}function nY({type:t,reducerName:e},n,r,i){if(!i)throw new Error(So(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:l,settled:c,options:d}=n,f=i(t,s,d);r.exposeAction(e,f),o&&r.addCase(f.fulfilled,o),a&&r.addCase(f.pending,a),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:o||Ab,pending:a||Ab,rejected:l||Ab,settled:c||Ab})}function Ab(){}var rY="task",n4="listener",r4="completed",GP="cancelled",iY=`task-${GP}`,sY=`task-${r4}`,dC=`${n4}-${GP}`,oY=`${n4}-${r4}`,uS=class{constructor(t){Ws(this,"code");Ws(this,"name","TaskAbortError");Ws(this,"message");this.code=t,this.message=`${rY} ${GP} (reason: ${t})`}},WP=(t,e)=>{if(typeof t!="function")throw new TypeError(So(32))},gw=()=>{},i4=(t,e=gw)=>(t.catch(e),t),s4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),_h=t=>{if(t.aborted)throw new uS(t.reason)};function o4(t,e){let n=gw;return new Promise((r,i)=>{const s=()=>i(new uS(t.reason));if(t.aborted){s();return}n=s4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=gw})}var aY=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof uS?"cancelled":"rejected",error:n}}finally{e==null||e()}},vw=t=>e=>i4(o4(t,e).then(n=>(_h(t),n))),a4=t=>{const e=vw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:eg}=Object,ak={},dS="listenerMiddleware",lY=(t,e)=>{const n=r=>s4(t,()=>r.abort(t.reason));return(r,i)=>{WP(r);const s=new AbortController;n(s);const o=aY(async()=>{_h(t),_h(s.signal);const a=await r({pause:vw(s.signal),delay:a4(s.signal),signal:s.signal});return _h(s.signal),a},()=>s.abort(sY));return i!=null&&i.autoJoin&&e.push(o.catch(gw)),{result:vw(t)(o),cancel(){s.abort(iY)}}}},cY=(t,e)=>{const n=async(r,i)=>{_h(e);let s=()=>{};const a=[new Promise((l,c)=>{let d=t({predicate:r,effect:(f,m)=>{m.unsubscribe(),l([f,m.getState(),m.getOriginalState()])}});s=()=>{d(),c()}})];i!=null&&a.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await o4(e,Promise.race(a));return _h(e),l}finally{s()}};return((r,i)=>i4(n(r,i)))},l4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Eo(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(So(21));return WP(s),{predicate:i,type:e,effect:s}},c4=eg(t=>{const{type:e,predicate:n,effect:r}=l4(t);return{id:XK(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(So(22))}}},{withTypes:()=>c4}),lk=(t,e)=>{const{type:n,effect:r,predicate:i}=l4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},fC=t=>{t.pending.forEach(e=>{e.abort(dC)})},uY=(t,e)=>()=>{for(const n of e.keys())fC(n);t.clear()},ck=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},u4=eg(Eo(`${dS}/add`),{withTypes:()=>u4}),dY=Eo(`${dS}/removeAll`),d4=eg(Eo(`${dS}/remove`),{withTypes:()=>d4}),fY=(...t)=>{console.error(`${dS}/error`,...t)},Xy=(t={})=>{const e=new Map,n=new Map,r=y=>{const x=n.get(y)??0;n.set(y,x+1)},i=y=>{const x=n.get(y)??1;x===1?n.delete(y):n.set(y,x-1)},{extra:s,onError:o=fY}=t;WP(o);const a=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),x=>{y.unsubscribe(),x!=null&&x.cancelActive&&fC(y)}),l=(y=>{const x=lk(e,y)??c4(y);return a(x)});eg(l,{withTypes:()=>l});const c=y=>{const x=lk(e,y);return x&&(x.unsubscribe(),y.cancelActive&&fC(x)),!!x};eg(c,{withTypes:()=>c});const d=async(y,x,S,_)=>{const w=new AbortController,E=cY(l,w.signal),T=[];try{y.pending.add(w),r(y),await Promise.resolve(y.effect(x,eg({},S,{getOriginalState:_,condition:(C,O)=>E(C,O).then(Boolean),take:E,delay:a4(w.signal),pause:vw(w.signal),extra:s,signal:w.signal,fork:lY(w.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((C,O,N)=>{C!==w&&(C.abort(dC),N.delete(C))})},cancel:()=>{w.abort(dC),y.pending.delete(w)},throwIfCancelled:()=>{_h(w.signal)}})))}catch(C){C instanceof uS||ck(o,C,{raisedBy:"effect"})}finally{await Promise.all(T),w.abort(oY),i(y),y.pending.delete(w)}},f=uY(e,n);return{middleware:y=>x=>S=>{if(!z5(S))return x(S);if(u4.match(S))return l(S.payload);if(dY.match(S)){f();return}if(d4.match(S))return c(S.payload);let _=y.getState();const w=()=>{if(_===ak)throw new Error(So(23));return _};let E;try{if(E=x(S),e.size>0){const T=y.getState(),C=Array.from(e.values());for(const O of C){let N=!1;try{N=O.predicate(S,T,_)}catch(L){N=!1,ck(o,L,{raisedBy:"predicate"})}N&&d(O,S,y,w)}}}finally{_=ak}return E},startListening:l,stopListening:c,clearListeners:f}};function So(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var hY={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},f4=ds({name:"chartLayout",initialState:hY,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){var n,r,i,s;t.margin.top=(n=e.payload.top)!==null&&n!==void 0?n:0,t.margin.right=(r=e.payload.right)!==null&&r!==void 0?r:0,t.margin.bottom=(i=e.payload.bottom)!==null&&i!==void 0?i:0,t.margin.left=(s=e.payload.left)!==null&&s!==void 0?s:0},setScale(t,e){t.scale=e.payload}}}),fS=f4.actions,pY=fS.setMargin,mY=fS.setLayout,gY=fS.setChartSize,vY=fS.setScale,yY=f4.reducer;function h4(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function En(t){return Number.isFinite(t)}function Ll(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function uk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wm(t){for(var e=1;e{if(e&&n){var r=n.width,i=n.height,s=e.align,o=e.verticalAlign,a=e.layout;if((a==="vertical"||a==="horizontal"&&o==="middle")&&s!=="center"&&Dt(t[s]))return Wm(Wm({},t),{},{[s]:t[s]+(r||0)});if((a==="horizontal"||a==="vertical"&&s==="center")&&o!=="middle"&&Dt(t[o]))return Wm(Wm({},t),{},{[o]:t[o]+(i||0)})}return t},Bl=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",p4=(t,e,n,r)=>{if(r)return t.map(a=>a.coordinate);var i,s,o=t.map(a=>(a.coordinate===e&&(i=!0),a.coordinate===n&&(s=!0),a.coordinate));return i||o.push(e),s||o.push(n),o},m4=(t,e,n)=>{if(!t)return null;var r=t.duplicateDomain,i=t.type,s=t.range,o=t.scale,a=t.realScaleType,l=t.isCategorical,c=t.categoricalDomain,d=t.tickCount,f=t.ticks,m=t.niceTicks,y=t.axisType;if(!o)return null;var x=a==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,S=i==="category"&&o.bandwidth?o.bandwidth()/x:0;if(S=y==="angleAxis"&&s&&s.length>=2?Xo(s[0]-s[1])*2*S:S,f||m){var _=(f||m||[]).map((w,E)=>{var T=r?r.indexOf(w):w,C=o.map(T);return En(C)?{coordinate:C+S,value:w,offset:S,index:E}:null}).filter(Zs);return _}return l&&c?c.map((w,E)=>{var T=o.map(w);return En(T)?{coordinate:T+S,value:w,index:E,offset:S}:null}).filter(Zs):o.ticks&&d!=null?o.ticks(d).map((w,E)=>{var T=o.map(w);return En(T)?{coordinate:T+S,value:w,index:E,offset:S}:null}).filter(Zs):o.domain().map((w,E)=>{var T=o.map(w);return En(T)?{coordinate:T+S,value:r?r[w]:w,index:E,offset:S}:null}).filter(Zs)},SY=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=m,c[1]=s):(c[0]=o,o+=m,c[1]=o)}}}},MY=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i=0?(l[0]=s,s+=c,l[1]=s):(l[0]=0,l[1]=0)}}}},EY={sign:SY,expand:BX,none:Rh,silhouette:HX,wiggle:VX,positive:MY},AY=(t,e,n)=>{var r,i=(r=EY[n])!==null&&r!==void 0?r:Rh,s=zX().keys(e).value((a,l)=>Number(bi(a,l,0))).order(QT).offset(i),o=s(t);return o.forEach((a,l)=>{a.forEach((c,d)=>{var f=bi(t[d],e[l],0);Array.isArray(f)&&f.length===2&&Dt(f[0])&&Dt(f[1])&&(c[0]=f[0],c[1]=f[1])})}),o};function TY(t){return t==null?void 0:String(t)}function dk(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Vi(i[e.dataKey])){var a=_5(n,"value",i[e.dataKey]);if(a)return a.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var l=bi(i,Vi(o)?e.dataKey:o),c=e.scale.map(l);return Dt(c)?c:null}var CY=t=>{var e=t.flat(2).filter(Dt);return[Math.min(...e),Math.max(...e)]},PY=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],RY=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return PY(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var o=s.stackedData,a=o.reduce((l,c)=>{var d=h4(c,e,n),f=CY(d);return!En(f[0])||!En(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]))},fk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,hk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,yw=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var i=nS(e,d=>d.coordinate),s=1/0,o=1,a=i.length;o{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},IY=(t,e)=>e==="centric"?t.angle:t.radius,tu=t=>t.layout.width,nu=t=>t.layout.height,kY=t=>t.layout.scale,v4=t=>t.layout.margin,hS=Ie(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),pS=Ie(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),OY="data-recharts-item-index",LY="data-recharts-item-id",qy=60;function mk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Tb(t){for(var e=1;et.brush.height;function zY(t){var e=pS(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:qy;return n+i}return n},0)}function BY(t){var e=pS(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:qy;return n+i}return n},0)}function HY(t){var e=hS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function VY(t){var e=hS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var $i=Ie([tu,nu,v4,FY,zY,BY,HY,VY,j5,uK],(t,e,n,r,i,s,o,a,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+a},m=Tb(Tb({},f),d),y=m.bottom;m.bottom+=r,m=wY(m,l,c);var x=t-m.left-m.right,S=e-m.top-m.bottom;return Tb(Tb({brushBottom:y},m),{},{width:Math.max(x,0),height:Math.max(S,0)})}),GY=Ie($i,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),y4=Ie(tu,nu,(t,e)=>({x:0,y:0,width:t,height:e})),WY=R.createContext(null),eo=()=>R.useContext(WY)!=null,mS=t=>t.brush,gS=Ie([mS,$i,v4],(t,e,n)=>({height:t.height,x:Dt(t.x)?t.x:e.left,y:Dt(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:Dt(t.width)?t.width:e.width}));function $Y(t,e,{signal:n,edges:r}={}){let i,s=null;const o=r!=null&&r.includes("leading"),a=r==null||r.includes("trailing"),l=()=>{s!==null&&(t.apply(i,s),i=void 0,s=null)},c=()=>{a&&l(),y()};let d=null;const f=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},e)},m=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{m(),i=void 0,s=null},x=()=>{l()},S=function(..._){if(n!=null&&n.aborted)return;i=this,s=_;const w=d==null;f(),o&&w&&l()};return S.schedule=f,S.cancel=y,S.flush=x,n==null||n.addEventListener("abort",y,{once:!0}),S}function XY(t,e=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:s}=n,o=Array(2);r&&(o[0]="leading"),i&&(o[1]="trailing");let a,l=null;const c=$Y(function(...m){a=t.apply(this,m),l=null},e,{edges:o}),d=function(...m){return s!=null&&(l===null&&(l=Date.now()),Date.now()-l>=s)?(a=t.apply(this,m),l=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,m),a)},f=()=>(c.flush(),a);return d.cancel=c.cancel,d.flush=f,d}function qY(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return XY(t,e,{leading:r,maxWait:e,trailing:i})}var xw=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},x4=(t,e,n)=>{var r=n.width,i=r===void 0?wl.width:r,s=n.height,o=s===void 0?wl.height:s,a=n.aspect,l=n.maxHeight,c=Nh(i)?t:Number(i),d=Nh(o)?e:Number(o);return a&&a>0&&(c?d=c/a:d&&(c=d*a),l&&d!=null&&d>l&&(d=l)),{calculatedWidth:c,calculatedHeight:d}},KY={width:0,height:0,overflow:"visible"},YY={width:0,overflowX:"visible"},ZY={height:0,overflowY:"visible"},QY={},JY=t=>{var e=t.width,n=t.height,r=Nh(e),i=Nh(n);return r&&i?KY:r?YY:i?ZY:QY};function eZ(t){var e=t.width,n=t.height,r=t.aspect,i=e,s=n;return i===void 0&&s===void 0?(i=wl.width,s=wl.height):i===void 0?i=r&&r>0?void 0:wl.width:s===void 0&&(s=r&&r>0?void 0:wl.height),{width:i,height:s}}var tZ=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function bw(){return bw=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n({width:n,height:r}),[n,r]);return fZ(i)?R.createElement(b4.Provider,{value:i},e):null}var $P=()=>R.useContext(b4),hZ=R.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,i=r===void 0?wl.initialDimension:r,s=t.width,o=t.height,a=t.minWidth,l=a===void 0?wl.minWidth:a,c=t.minHeight,d=t.maxHeight,f=t.children,m=t.debounce,y=m===void 0?wl.debounce:m,x=t.id,S=t.className,_=t.onResize,w=t.style,E=w===void 0?{}:w,T=uZ(t,tZ),C=R.useRef(null),O=R.useRef();O.current=_,R.useImperativeHandle(e,()=>C.current);var N=R.useState({containerWidth:i.width,containerHeight:i.height}),L=sZ(N,2),F=L[0],G=L[1],k=R.useCallback((se,fe)=>{G(B=>{var Q=Math.round(se),K=Math.round(fe);return B.containerWidth===Q&&B.containerHeight===K?B:{containerWidth:Q,containerHeight:K}})},[]);R.useEffect(()=>{if(C.current==null||typeof ResizeObserver>"u")return Vg;var se=V=>{var q,he=V[0];if(he!=null){var ae=he.contentRect,ce=ae.width,we=ae.height;k(ce,we),(q=O.current)===null||q===void 0||q.call(O,ce,we)}};y>0&&(se=qY(se,y,{trailing:!0,leading:!1}));var fe=new ResizeObserver(se),B=C.current.getBoundingClientRect(),Q=B.width,K=B.height;return k(Q,K),fe.observe(C.current),()=>{fe.disconnect()}},[k,y]);var U=F.containerWidth,H=F.containerHeight;xw(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ne=x4(U,H,{width:s,height:o,aspect:n,maxHeight:d}),ee=ne.calculatedWidth,pe=ne.calculatedHeight;return xw(U<0||H<0||ee!=null&&ee>0||pe!=null&&pe>0,`The width(%s) and height(%s) of chart should be greater than 0, + */var GI;function Zq(){if(GI)return xE;GI=1;var t=Xh(),e=Yq();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return xE.useSyncExternalStoreWithSelector=function(c,d,f,g,y){var x=s(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=a(function(){function b(N){if(!M){if(M=!0,T=N,N=g(N),y!==void 0&&S.hasValue){var L=S.value;if(y(L,N))return C=L}return C=N}if(L=C,r(T,N))return L;var F=g(N);return y!==void 0&&y(L,F)?(T=N,L):(T=N,C=F)}var M=!1,T,C,O=f===void 0?null:f;return[function(){return b(d())},O===null?void 0:function(){return b(O())}]},[d,f,g,y]);var w=i(c,x[0],x[1]);return o(function(){S.hasValue=!0,S.value=w},[w]),l(w),w},xE}var WI;function Qq(){return WI||(WI=1,yE.exports=Zq()),yE.exports}var Jq=Qq(),HP=P.createContext(null),eK=t=>t,qr=()=>{var t=P.useContext(HP);return t?t.store.dispatch:eK},B_=()=>{},tK=()=>B_,nK=(t,e)=>t===e;function Gt(t){var e=P.useContext(HP),n=P.useMemo(()=>e?r=>{if(r!=null)return t(r)}:B_,[e,t]);return Jq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:tK,e?e.store.getState:B_,e?e.store.getState:B_,n,nK)}function rK(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function iK(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var $I=t=>Array.isArray(t)?t:[t];function sK(t){const e=Array.isArray(t[0])?t[0]:t;return iK(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function oK(t,e){const n=[],{length:r}=t;for(let i=0;itypeof WeakRef>"u"?aK:WeakRef,U5=lK(),cK=0,XI=1;function wb(){return{s:cK,v:void 0,o:null,p:null}}function uK(t){return t instanceof U5?t.deref():t}function F5(t,e={}){let n=wb();const{resultEqualityCheck:r}=e;let i,s=0;function o(){let a=n;const{length:l}=arguments;for(let f=0,g=l;f{n=wb(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function dK(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,o=0,a,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),rK(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:g=[],argsMemoize:y=F5,argsMemoizeOptions:x=[]}=d,S=$I(g),w=$I(x),b=sK(i),M=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){o++;const O=oK(b,arguments);return a=M.apply(null,O),a},...w);return Object.assign(T,{resultFunc:c,memoizedResultFunc:M,dependencies:b,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var Ie=dK(F5);function fK(t,e=1){const n=[],r=Math.floor(e),i=(s,o)=>{for(let a=0;a{if(t!==e){const r=qI(t),i=qI(e);if(r===i&&r===0){if(te)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function z5(t){return typeof t=="symbol"||t instanceof Symbol}const pK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mK=/^\w*$/;function gK(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||z5(t)?!0:typeof t=="string"&&(mK.test(t)||!pK.test(t))||e!=null}function vK(t,e,n,r){if(t==null)return[];n=n,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(a=>String(a));const i=(a,l)=>{let c=a;for(let d=0;dl==null||a==null?l:typeof a=="object"&&"key"in a?Object.hasOwn(l,a.key)?l[a.key]:i(l,a.path):typeof a=="function"?a(l):Array.isArray(a)?i(l,a):typeof l=="object"?l[a]:l,o=e.map(a=>(Array.isArray(a)&&a.length===1&&(a=a[0]),a==null||typeof a=="function"||Array.isArray(a)||gK(a)?a:{key:a,path:UP(a)}));return t.map(a=>({original:a,criteria:o.map(l=>s(l,a))})).slice().sort((a,l)=>{for(let c=0;ca.original)}function iS(t,...e){const n=e.length;return n>1&&oC(t,e[0],e[1])?e=[]:n>2&&oC(e[0],e[1],e[2])&&(e=[e[0]]),vK(t,fK(e),["asc"])}var B5=t=>t.legend.settings,yK=t=>t.legend.size,xK=t=>t.legend.payload;Ie([xK,B5],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?iS(r,n):r});function bK(t,e){return MK(t)||SK(t,e)||wK(t,e)||_K()}function _K(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wK(t,e){if(t){if(typeof t=="string")return KI(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?KI(t,e):void 0}}function KI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nSb||Math.abs(t.left-e.left)>Sb||Math.abs(t.top-e.top)>Sb||Math.abs(t.width-e.width)>Sb}function ZI(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function EK(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=P.useState({height:0,left:0,top:0,width:0}),n=bK(e,2),r=n[0],i=n[1],s=P.useRef(null),o=P.useRef(r);o.current=r;var a=P.useCallback(l=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),l!=null){var c=ZI(l);if(YI(c,o.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=ZI(l);YI(f,o.current)&&i(f)});d.observe(l),s.current=d}}},[...t]);return P.useEffect(()=>()=>{var l;(l=s.current)===null||l===void 0||l.disconnect()},[]),[r,a]}function ji(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var AK=typeof Symbol=="function"&&Symbol.observable||"@@observable",QI=AK,wE=()=>Math.random().toString(36).substring(7).split("").join("."),TK={INIT:`@@redux/INIT${wE()}`,REPLACE:`@@redux/REPLACE${wE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${wE()}`},cw=TK;function VP(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function H5(t,e,n){if(typeof t!="function")throw new Error(ji(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(ji(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(ji(1));return n(H5)(t,e)}let r=t,i=e,s=new Map,o=s,a=0,l=!1;function c(){o===s&&(o=new Map,s.forEach((w,b)=>{o.set(b,w)}))}function d(){if(l)throw new Error(ji(3));return i}function f(w){if(typeof w!="function")throw new Error(ji(4));if(l)throw new Error(ji(5));let b=!0;c();const M=a++;return o.set(M,w),function(){if(b){if(l)throw new Error(ji(6));b=!1,c(),o.delete(M),s=null}}}function g(w){if(!VP(w))throw new Error(ji(7));if(typeof w.type>"u")throw new Error(ji(8));if(typeof w.type!="string")throw new Error(ji(17));if(l)throw new Error(ji(9));try{l=!0,i=r(i,w)}finally{l=!1}return(s=o).forEach(M=>{M()}),w}function y(w){if(typeof w!="function")throw new Error(ji(10));r=w,g({type:cw.REPLACE})}function x(){const w=f;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(ji(11));function M(){const C=b;C.next&&C.next(d())}return M(),{unsubscribe:w(M)}},[QI](){return this}}}return g({type:cw.INIT}),{dispatch:g,subscribe:f,getState:d,replaceReducer:y,[QI]:x}}function CK(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:cw.INIT})>"u")throw new Error(ji(12));if(typeof n(void 0,{type:cw.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(ji(13))})}function V5(t){const e=Object.keys(t),n={};for(let s=0;s"u")throw a&&a.type,new Error(ji(14));c[f]=x,l=l||x!==y}return l=l||r.length!==Object.keys(o).length,l?c:o}}function uw(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function PK(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(ji(15))};const o={getState:i.getState,dispatch:(l,...c)=>s(l,...c)},a=t.map(l=>l(o));return s=uw(...a)(i.dispatch),{...i,dispatch:s}}}function G5(t){return VP(t)&&"type"in t&&typeof t.type=="string"}var W5=Symbol.for("immer-nothing"),JI=Symbol.for("immer-draftable"),Rs=Symbol.for("immer-state");function Ua(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var Mo=Object,Eg=Mo.getPrototypeOf,dw="constructor",sS="prototype",aC="configurable",fw="enumerable",H_="writable",dy="value",Kc=t=>!!t&&!!t[Rs];function Ha(t){var e;return t?$5(t)||aS(t)||!!t[JI]||!!((e=t[dw])!=null&&e[JI])||lS(t)||cS(t):!1}var RK=Mo[sS][dw].toString(),ek=new WeakMap;function $5(t){if(!t||!GP(t))return!1;const e=Eg(t);if(e===null||e===Mo[sS])return!0;const n=Mo.hasOwnProperty.call(e,dw)&&e[dw];if(n===Object)return!0;if(!Fm(n))return!1;let r=ek.get(n);return r===void 0&&(r=Function.toString.call(n),ek.set(n,r)),r===RK}function oS(t,e,n=!0){$y(t)===0?(n?Reflect.ownKeys(t):Mo.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function $y(t){const e=t[Rs];return e?e.type_:aS(t)?1:lS(t)?2:cS(t)?3:0}var tk=(t,e,n=$y(t))=>n===2?t.has(e):Mo[sS].hasOwnProperty.call(t,e),lC=(t,e,n=$y(t))=>n===2?t.get(e):t[e],hw=(t,e,n,r=$y(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function NK(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var aS=Array.isArray,lS=t=>t instanceof Map,cS=t=>t instanceof Set,GP=t=>typeof t=="object",Fm=t=>typeof t=="function",SE=t=>typeof t=="boolean";function IK(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Ic=t=>t.copy_||t.base_,WP=t=>t.modified_?t.copy_:t.base_;function cC(t,e){if(lS(t))return new Map(t);if(cS(t))return new Set(t);if(aS(t))return Array[sS].slice.call(t);const n=$5(t);if(e===!0||e==="class_only"&&!n){const r=Mo.getOwnPropertyDescriptors(t);delete r[Rs];let i=Reflect.ownKeys(r);for(let s=0;s1&&Mo.defineProperties(t,{set:Mb,add:Mb,clear:Mb,delete:Mb}),Mo.freeze(t),e&&oS(t,(n,r)=>{$P(r,!0)},!1)),t}function kK(){Ua(2)}var Mb={[dy]:kK};function uS(t){return t===null||!GP(t)?!0:Mo.isFrozen(t)}var pw="MapSet",uC="Patches",nk="ArrayMethods",X5={};function kh(t){const e=X5[t];return e||Ua(0,t),e}var rk=t=>!!X5[t],fy,q5=()=>fy,OK=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:rk(pw)?kh(pw):void 0,arrayMethodsPlugin_:rk(nk)?kh(nk):void 0});function ik(t,e){e&&(t.patchPlugin_=kh(uC),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function dC(t){fC(t),t.drafts_.forEach(LK),t.drafts_=null}function fC(t){t===fy&&(fy=t.parent_)}var sk=t=>fy=OK(fy,t);function LK(t){const e=t[Rs];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function ok(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Rs].modified_&&(dC(e),Ua(4)),Ha(t)&&(t=ak(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Rs].base_,t,e)}else t=ak(e,n);return DK(e,t,!0),dC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==W5?t:void 0}function ak(t,e){if(uS(e))return e;const n=e[Rs];if(!n)return mw(e,t.handledSet_,t);if(!dS(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);Z5(n,t)}return n.copy_}function DK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&$P(e,n)}function K5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var dS=(t,e)=>t.scope_===e,jK=[];function Y5(t,e,n,r){const i=Ic(t),s=t.type_;if(r!==void 0&&lC(i,r,s)===e){hw(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;oS(i,(l,c)=>{if(Kc(c)){const d=a.get(c)||[];d.push(l),a.set(c,d)}})}const o=t.draftLocations_.get(e)??jK;for(const a of o)hw(i,a,n,s)}function UK(t,e,n){t.callbacks_.push(function(i){var a;const s=e;if(!s||!dS(s,i))return;(a=i.mapSetPlugin_)==null||a.fixSetContents(s);const o=WP(s);Y5(t,s.draft_??s,o,n),Z5(s,i)})}function Z5(t,e){var r;if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(((r=t.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=e;if(i){const s=i.getPath(t);s&&i.generatePatches_(t,s,e)}K5(t)}}function FK(t,e,n){const{scope_:r}=t;if(Kc(n)){const i=n[Rs];dS(i,r)&&i.callbacks_.push(function(){V_(t);const o=WP(i);Y5(t,n,o,e)})}else Ha(n)&&t.callbacks_.push(function(){const s=Ic(t);t.type_===3?s.has(n)&&mw(n,r.handledSet_,r):lC(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&mw(lC(t.copy_,e,t.type_),r.handledSet_,r)})}function mw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Kc(t)||e.has(t)||!Ha(t)||uS(t)||(e.add(t),oS(t,(r,i)=>{if(Kc(i)){const s=i[Rs];if(dS(s,n)){const o=WP(s);hw(t,r,o,t.type_),K5(s)}}else Ha(i)&&mw(i,e,n)})),t}function zK(t,e){const n=aS(t),r={type_:n?1:0,scope_:e?e.scope_:q5(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=gw;n&&(i=[r],s=hy);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var gw={get(t,e){if(e===Rs)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n!=null&&n.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=Ic(t);if(!tk(i,e,t.type_))return BK(t,i,e);const s=i[e];if(t.finalized_||!Ha(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&IK(e))return s;if(s===ME(t.base_,e)){V_(t);const o=t.type_===1?+e:e,a=pC(t.scope_,s,t,o);return t.copy_[o]=a}return s},has(t,e){return e in Ic(t)},ownKeys(t){return Reflect.ownKeys(Ic(t))},set(t,e,n){const r=Q5(Ic(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=ME(Ic(t),e),s=i==null?void 0:i[Rs];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(NK(n,i)&&(n!==void 0||tk(t.base_,e,t.type_)))return!0;V_(t),hC(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),FK(t,e,n)),!0},deleteProperty(t,e){return V_(t),ME(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),hC(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Ic(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[H_]:!0,[aC]:t.type_!==1||e!=="length",[fw]:r[fw],[dy]:n[e]}},defineProperty(){Ua(11)},getPrototypeOf(t){return Eg(t.base_)},setPrototypeOf(){Ua(12)}},hy={};for(let t in gw){let e=gw[t];hy[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}hy.deleteProperty=function(t,e){return hy.set.call(this,t,e,void 0)};hy.set=function(t,e,n){return gw.set.call(this,t[0],e,n,t[0])};function ME(t,e){const n=t[Rs];return(n?Ic(n):t)[e]}function BK(t,e,n){var i;const r=Q5(e,n);return r?dy in r?r[dy]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function Q5(t,e){if(!(e in t))return;let n=Eg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Eg(n)}}function hC(t){t.modified_||(t.modified_=!0,t.parent_&&hC(t.parent_))}function V_(t){t.copy_||(t.assigned_=new Map,t.copy_=cC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var HK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Fm(n)&&!Fm(r)){const o=r;r=n;const a=this;return function(c=o,...d){return a.produce(c,f=>r.call(this,f,...d))}}Fm(r)||Ua(6),i!==void 0&&!Fm(i)&&Ua(7);let s;if(Ha(n)){const o=sk(this),a=pC(o,n,void 0);let l=!0;try{s=r(a),l=!1}finally{l?dC(o):fC(o)}return ik(o,i),ok(s,o)}else if(!n||!GP(n)){if(s=r(n),s===void 0&&(s=n),s===W5&&(s=void 0),this.autoFreeze_&&$P(s,!0),i){const o=[],a=[];kh(uC).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:a}),i(o,a)}return s}else Ua(1,n)},this.produceWithPatches=(n,r)=>{if(Fm(n))return(a,...l)=>this.produceWithPatches(a,c=>n(c,...l));let i,s;return[this.produce(n,r,(a,l)=>{i=a,s=l}),i,s]},SE(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),SE(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),SE(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ha(e)||Ua(8),Kc(e)&&(e=Ko(e));const n=sk(this),r=pC(n,e,void 0);return r[Rs].isManual_=!0,fC(n),r}finishDraft(e,n){const r=e&&e[Rs];(!r||!r.isManual_)&&Ua(9);const{scope_:i}=r;return ik(i,n),ok(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}r>-1&&(n=n.slice(r+1));const i=kh(uC).applyPatches_;return Kc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function pC(t,e,n,r){const[i,s]=lS(e)?kh(pw).proxyMap_(e,n):cS(e)?kh(pw).proxySet_(e,n):zK(e,n);return((n==null?void 0:n.scope_)??q5()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?UK(n,s,r):s.callbacks_.push(function(l){var d;(d=l.mapSetPlugin_)==null||d.fixSetContents(s);const{patchPlugin_:c}=l;s.modified_&&c&&c.generatePatches_(s,[],l)}),i}function Ko(t){return Kc(t)||Ua(10,t),J5(t)}function J5(t){if(!Ha(t)||uS(t))return t;const e=t[Rs];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=cC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=cC(t,!0);return oS(n,(i,s)=>{hw(n,i,J5(s))},r),e&&(e.finalized_=!1),n}var VK=new HK,e4=VK.produce;function t4(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var GK=t4(),WK=t4,$K=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?uw:uw.apply(null,arguments)};function Co(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(Ao(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>G5(r)&&r.type===t,n}var n4=class z0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,z0.prototype)}static get[Symbol.species](){return z0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new z0(...e[0].concat(this)):new z0(...e.concat(this))}};function lk(t){return Ha(t)?e4(t,()=>{}):t}function Eb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function XK(t){return typeof t=="boolean"}var qK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new n4;return n&&(XK(n)?o.push(GK):o.push(WK(n.extraArgument))),o},r4="RTK_autoBatch",cr=()=>t=>({payload:t,meta:{[r4]:!0}}),ck=t=>e=>{setTimeout(e,t)},KK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(o),n())},s=t(i),o=setTimeout(i,e)},i4=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,o=!1;const a=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?KK(window.requestAnimationFrame,100):ck(10):t.type==="callback"?t.queueNotification:ck(t.timeout),c=()=>{o=!1,s&&(s=!1,a.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),g=r.subscribe(f);return a.add(d),()=>{g(),a.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[r4]),s=!i,s&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},YK=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new n4(t);return r&&i.push(i4(typeof r=="object"?r:void 0)),i};function ZK(t){const e=qK(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let a;if(typeof n=="function")a=n;else if(VP(n))a=V5(n);else throw new Error(Ao(1));let l;typeof r=="function"?l=r(e):l=e();let c=uw;i&&(c=$K({trace:!1,...typeof i=="object"&&i}));const d=PK(...l),f=YK(d);let g=typeof o=="function"?o(f):f();const y=c(...g);return H5(a,s,y)}function s4(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(Ao(28));if(a in e)throw new Error(Ao(29));return e[a]=o,i},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function QK(t){return typeof t=="function"}function JK(t,e){let[n,r,i]=s4(e),s;if(QK(t))s=()=>lk(t());else{const a=lk(t);s=()=>a}function o(a=s(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[i]),c.reduce((d,f)=>{if(f)if(Kc(d)){const y=f(d,l);return y===void 0?d:y}else{if(Ha(d))return e4(d,g=>f(g,l));{const g=f(d,l);if(g===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return g}}return d},a)}return o.getInitialState=s,o}var eY="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",tY=(t=21)=>{let e="",n=t;for(;n--;)e+=eY[Math.random()*64|0];return e},nY=Symbol.for("rtk-slice-createasyncthunk");function rY(t,e){return`${t}/${e}`}function iY({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[nY];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(Ao(11));const a=(typeof i.reducers=="function"?i.reducers(oY()):i.reducers)||{},l=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(C,O){const N=typeof C=="string"?C:C.type;if(!N)throw new Error(Ao(12));if(N in c.sliceCaseReducersByType)throw new Error(Ao(13));return c.sliceCaseReducersByType[N]=O,d},addMatcher(C,O){return c.sliceMatchers.push({matcher:C,reducer:O}),d},exposeAction(C,O){return c.actionCreators[C]=O,d},exposeCaseReducer(C,O){return c.sliceCaseReducersByName[C]=O,d}};l.forEach(C=>{const O=a[C],N={reducerName:C,type:rY(s,C),createNotation:typeof i.reducers=="function"};lY(O)?uY(N,O,d,e):aY(N,O,d)});function f(){const[C={},O=[],N=void 0]=typeof i.extraReducers=="function"?s4(i.extraReducers):[i.extraReducers],L={...C,...c.sliceCaseReducersByType};return JK(i.initialState,F=>{for(let G in L)F.addCase(G,L[G]);for(let G of c.sliceMatchers)F.addMatcher(G.matcher,G.reducer);for(let G of O)F.addMatcher(G.matcher,G.reducer);N&&F.addDefaultCase(N)})}const g=C=>C,y=new Map,x=new WeakMap;let S;function w(C,O){return S||(S=f()),S(C,O)}function b(){return S||(S=f()),S.getInitialState()}function M(C,O=!1){function N(F){let G=F[C];return typeof G>"u"&&O&&(G=Eb(x,N,b)),G}function L(F=g){const G=Eb(y,O,()=>new WeakMap);return Eb(G,F,()=>{const k={};for(const[U,H]of Object.entries(i.selectors??{}))k[U]=sY(H,F,()=>Eb(x,F,b),O);return k})}return{reducerPath:C,getSelectors:L,get selectors(){return L(N)},selectSlice:N}}const T={name:s,reducer:w,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:b,...M(o),injectInto(C,{reducerPath:O,...N}={}){const L=O??o;return C.inject({reducerPath:L,reducer:w},N),{...T,...M(L,!0)}}};return T}}function sY(t,e,n,r){function i(s,...o){let a=e(s);return typeof a>"u"&&r&&(a=n()),t(a,...o)}return i.unwrapped=t,i}var ds=iY();function oY(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function aY({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!cY(r))throw new Error(Ao(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Co(t,o):Co(t))}function lY(t){return t._reducerDefinitionType==="asyncThunk"}function cY(t){return t._reducerDefinitionType==="reducerWithPrepare"}function uY({type:t,reducerName:e},n,r,i){if(!i)throw new Error(Ao(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:l,settled:c,options:d}=n,f=i(t,s,d);r.exposeAction(e,f),o&&r.addCase(f.fulfilled,o),a&&r.addCase(f.pending,a),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:o||Ab,pending:a||Ab,rejected:l||Ab,settled:c||Ab})}function Ab(){}var dY="task",o4="listener",a4="completed",XP="cancelled",fY=`task-${XP}`,hY=`task-${a4}`,mC=`${o4}-${XP}`,pY=`${o4}-${a4}`,fS=class{constructor(t){$s(this,"code");$s(this,"name","TaskAbortError");$s(this,"message");this.code=t,this.message=`${dY} ${XP} (reason: ${t})`}},qP=(t,e)=>{if(typeof t!="function")throw new TypeError(Ao(32))},vw=()=>{},l4=(t,e=vw)=>(t.catch(e),t),c4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),wh=t=>{if(t.aborted)throw new fS(t.reason)};function u4(t,e){let n=vw;return new Promise((r,i)=>{const s=()=>i(new fS(t.reason));if(t.aborted){s();return}n=c4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=vw})}var mY=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof fS?"cancelled":"rejected",error:n}}finally{e==null||e()}},yw=t=>e=>l4(u4(t,e).then(n=>(wh(t),n))),d4=t=>{const e=yw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:eg}=Object,uk={},hS="listenerMiddleware",gY=(t,e)=>{const n=r=>c4(t,()=>r.abort(t.reason));return(r,i)=>{qP(r);const s=new AbortController;n(s);const o=mY(async()=>{wh(t),wh(s.signal);const a=await r({pause:yw(s.signal),delay:d4(s.signal),signal:s.signal});return wh(s.signal),a},()=>s.abort(hY));return i!=null&&i.autoJoin&&e.push(o.catch(vw)),{result:yw(t)(o),cancel(){s.abort(fY)}}}},vY=(t,e)=>{const n=async(r,i)=>{wh(e);let s=()=>{};const a=[new Promise((l,c)=>{let d=t({predicate:r,effect:(f,g)=>{g.unsubscribe(),l([f,g.getState(),g.getOriginalState()])}});s=()=>{d(),c()}})];i!=null&&a.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await u4(e,Promise.race(a));return wh(e),l}finally{s()}};return((r,i)=>l4(n(r,i)))},f4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Co(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(Ao(21));return qP(s),{predicate:i,type:e,effect:s}},h4=eg(t=>{const{type:e,predicate:n,effect:r}=f4(t);return{id:tY(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(Ao(22))}}},{withTypes:()=>h4}),dk=(t,e)=>{const{type:n,effect:r,predicate:i}=f4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},gC=t=>{t.pending.forEach(e=>{e.abort(mC)})},yY=(t,e)=>()=>{for(const n of e.keys())gC(n);t.clear()},fk=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},p4=eg(Co(`${hS}/add`),{withTypes:()=>p4}),xY=Co(`${hS}/removeAll`),m4=eg(Co(`${hS}/remove`),{withTypes:()=>m4}),bY=(...t)=>{console.error(`${hS}/error`,...t)},Xy=(t={})=>{const e=new Map,n=new Map,r=y=>{const x=n.get(y)??0;n.set(y,x+1)},i=y=>{const x=n.get(y)??1;x===1?n.delete(y):n.set(y,x-1)},{extra:s,onError:o=bY}=t;qP(o);const a=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),x=>{y.unsubscribe(),x!=null&&x.cancelActive&&gC(y)}),l=(y=>{const x=dk(e,y)??h4(y);return a(x)});eg(l,{withTypes:()=>l});const c=y=>{const x=dk(e,y);return x&&(x.unsubscribe(),y.cancelActive&&gC(x)),!!x};eg(c,{withTypes:()=>c});const d=async(y,x,S,w)=>{const b=new AbortController,M=vY(l,b.signal),T=[];try{y.pending.add(b),r(y),await Promise.resolve(y.effect(x,eg({},S,{getOriginalState:w,condition:(C,O)=>M(C,O).then(Boolean),take:M,delay:d4(b.signal),pause:yw(b.signal),extra:s,signal:b.signal,fork:gY(b.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((C,O,N)=>{C!==b&&(C.abort(mC),N.delete(C))})},cancel:()=>{b.abort(mC),y.pending.delete(b)},throwIfCancelled:()=>{wh(b.signal)}})))}catch(C){C instanceof fS||fk(o,C,{raisedBy:"effect"})}finally{await Promise.all(T),b.abort(pY),i(y),y.pending.delete(b)}},f=yY(e,n);return{middleware:y=>x=>S=>{if(!G5(S))return x(S);if(p4.match(S))return l(S.payload);if(xY.match(S)){f();return}if(m4.match(S))return c(S.payload);let w=y.getState();const b=()=>{if(w===uk)throw new Error(Ao(23));return w};let M;try{if(M=x(S),e.size>0){const T=y.getState(),C=Array.from(e.values());for(const O of C){let N=!1;try{N=O.predicate(S,T,w)}catch(L){N=!1,fk(o,L,{raisedBy:"predicate"})}N&&d(O,S,y,b)}}}finally{w=uk}return M},startListening:l,stopListening:c,clearListeners:f}};function Ao(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var _Y={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},g4=ds({name:"chartLayout",initialState:_Y,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){var n,r,i,s;t.margin.top=(n=e.payload.top)!==null&&n!==void 0?n:0,t.margin.right=(r=e.payload.right)!==null&&r!==void 0?r:0,t.margin.bottom=(i=e.payload.bottom)!==null&&i!==void 0?i:0,t.margin.left=(s=e.payload.left)!==null&&s!==void 0?s:0},setScale(t,e){t.scale=e.payload}}}),pS=g4.actions,wY=pS.setMargin,SY=pS.setLayout,MY=pS.setChartSize,EY=pS.setScale,AY=g4.reducer;function v4(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function An(t){return Number.isFinite(t)}function Ll(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function hk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wm(t){for(var e=1;e{if(e&&n){var r=n.width,i=n.height,s=e.align,o=e.verticalAlign,a=e.layout;if((a==="vertical"||a==="horizontal"&&o==="middle")&&s!=="center"&&jt(t[s]))return Wm(Wm({},t),{},{[s]:t[s]+(r||0)});if((a==="horizontal"||a==="vertical"&&s==="center")&&o!=="middle"&&jt(t[o]))return Wm(Wm({},t),{},{[o]:t[o]+(i||0)})}return t},Bl=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",y4=(t,e,n,r)=>{if(r)return t.map(a=>a.coordinate);var i,s,o=t.map(a=>(a.coordinate===e&&(i=!0),a.coordinate===n&&(s=!0),a.coordinate));return i||o.push(e),s||o.push(n),o},x4=(t,e,n)=>{if(!t)return null;var r=t.duplicateDomain,i=t.type,s=t.range,o=t.scale,a=t.realScaleType,l=t.isCategorical,c=t.categoricalDomain,d=t.tickCount,f=t.ticks,g=t.niceTicks,y=t.axisType;if(!o)return null;var x=a==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,S=i==="category"&&o.bandwidth?o.bandwidth()/x:0;if(S=y==="angleAxis"&&s&&s.length>=2?qo(s[0]-s[1])*2*S:S,f||g){var w=(f||g||[]).map((b,M)=>{var T=r?r.indexOf(b):b,C=o.map(T);return An(C)?{coordinate:C+S,value:b,offset:S,index:M}:null}).filter(Qs);return w}return l&&c?c.map((b,M)=>{var T=o.map(b);return An(T)?{coordinate:T+S,value:b,index:M,offset:S}:null}).filter(Qs):o.ticks&&d!=null?o.ticks(d).map((b,M)=>{var T=o.map(b);return An(T)?{coordinate:T+S,value:b,index:M,offset:S}:null}).filter(Qs):o.domain().map((b,M)=>{var T=o.map(b);return An(T)?{coordinate:T+S,value:r?r[b]:b,index:M,offset:S}:null}).filter(Qs)},NY=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=g,c[1]=s):(c[0]=o,o+=g,c[1]=o)}}}},IY=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i=0?(l[0]=s,s+=c,l[1]=s):(l[0]=0,l[1]=0)}}}},kY={sign:NY,expand:KX,none:Nh,silhouette:YX,wiggle:ZX,positive:IY},OY=(t,e,n)=>{var r,i=(r=kY[n])!==null&&r!==void 0?r:Nh,s=qX().keys(e).value((a,l)=>Number(wi(a,l,0))).order(nC).offset(i),o=s(t);return o.forEach((a,l)=>{a.forEach((c,d)=>{var f=wi(t[d],e[l],0);Array.isArray(f)&&f.length===2&&jt(f[0])&&jt(f[1])&&(c[0]=f[0],c[1]=f[1])})}),o};function LY(t){return t==null?void 0:String(t)}function pk(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Gi(i[e.dataKey])){var a=E5(n,"value",i[e.dataKey]);if(a)return a.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var l=wi(i,Gi(o)?e.dataKey:o),c=e.scale.map(l);return jt(c)?c:null}var DY=t=>{var e=t.flat(2).filter(jt);return[Math.min(...e),Math.max(...e)]},jY=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],UY=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return jY(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var o=s.stackedData,a=o.reduce((l,c)=>{var d=v4(c,e,n),f=DY(d);return!An(f[0])||!An(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]))},mk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,gk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,xw=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var i=iS(e,d=>d.coordinate),s=1/0,o=1,a=i.length;o{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},zY=(t,e)=>e==="centric"?t.angle:t.radius,tu=t=>t.layout.width,nu=t=>t.layout.height,BY=t=>t.layout.scale,_4=t=>t.layout.margin,mS=Ie(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),gS=Ie(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),HY="data-recharts-item-index",VY="data-recharts-item-id",qy=60;function yk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Tb(t){for(var e=1;et.brush.height;function qY(t){var e=gS(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:qy;return n+i}return n},0)}function KY(t){var e=gS(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:qy;return n+i}return n},0)}function YY(t){var e=mS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function ZY(t){var e=mS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var $i=Ie([tu,nu,_4,XY,qY,KY,YY,ZY,B5,yK],(t,e,n,r,i,s,o,a,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+a},g=Tb(Tb({},f),d),y=g.bottom;g.bottom+=r,g=RY(g,l,c);var x=t-g.left-g.right,S=e-g.top-g.bottom;return Tb(Tb({brushBottom:y},g),{},{width:Math.max(x,0),height:Math.max(S,0)})}),QY=Ie($i,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),w4=Ie(tu,nu,(t,e)=>({x:0,y:0,width:t,height:e})),JY=P.createContext(null),to=()=>P.useContext(JY)!=null,vS=t=>t.brush,yS=Ie([vS,$i,_4],(t,e,n)=>({height:t.height,x:jt(t.x)?t.x:e.left,y:jt(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:jt(t.width)?t.width:e.width}));function eZ(t,e,{signal:n,edges:r}={}){let i,s=null;const o=r!=null&&r.includes("leading"),a=r==null||r.includes("trailing"),l=()=>{s!==null&&(t.apply(i,s),i=void 0,s=null)},c=()=>{a&&l(),y()};let d=null;const f=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},e)},g=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{g(),i=void 0,s=null},x=()=>{l()},S=function(...w){if(n!=null&&n.aborted)return;i=this,s=w;const b=d==null;f(),o&&b&&l()};return S.schedule=f,S.cancel=y,S.flush=x,n==null||n.addEventListener("abort",y,{once:!0}),S}function tZ(t,e=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:s}=n,o=Array(2);r&&(o[0]="leading"),i&&(o[1]="trailing");let a,l=null;const c=eZ(function(...g){a=t.apply(this,g),l=null},e,{edges:o}),d=function(...g){return s!=null&&(l===null&&(l=Date.now()),Date.now()-l>=s)?(a=t.apply(this,g),l=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,g),a)},f=()=>(c.flush(),a);return d.cancel=c.cancel,d.flush=f,d}function nZ(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return tZ(t,e,{leading:r,maxWait:e,trailing:i})}var bw=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},S4=(t,e,n)=>{var r=n.width,i=r===void 0?wl.width:r,s=n.height,o=s===void 0?wl.height:s,a=n.aspect,l=n.maxHeight,c=Ih(i)?t:Number(i),d=Ih(o)?e:Number(o);return a&&a>0&&(c?d=c/a:d&&(c=d*a),l&&d!=null&&d>l&&(d=l)),{calculatedWidth:c,calculatedHeight:d}},rZ={width:0,height:0,overflow:"visible"},iZ={width:0,overflowX:"visible"},sZ={height:0,overflowY:"visible"},oZ={},aZ=t=>{var e=t.width,n=t.height,r=Ih(e),i=Ih(n);return r&&i?rZ:r?iZ:i?sZ:oZ};function lZ(t){var e=t.width,n=t.height,r=t.aspect,i=e,s=n;return i===void 0&&s===void 0?(i=wl.width,s=wl.height):i===void 0?i=r&&r>0?void 0:wl.width:s===void 0&&(s=r&&r>0?void 0:wl.height),{width:i,height:s}}var cZ=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function _w(){return _w=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n({width:n,height:r}),[n,r]);return bZ(i)?P.createElement(M4.Provider,{value:i},e):null}var KP=()=>P.useContext(M4),_Z=P.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,i=r===void 0?wl.initialDimension:r,s=t.width,o=t.height,a=t.minWidth,l=a===void 0?wl.minWidth:a,c=t.minHeight,d=t.maxHeight,f=t.children,g=t.debounce,y=g===void 0?wl.debounce:g,x=t.id,S=t.className,w=t.onResize,b=t.style,M=b===void 0?{}:b,T=yZ(t,cZ),C=P.useRef(null),O=P.useRef();O.current=w,P.useImperativeHandle(e,()=>C.current);var N=P.useState({containerWidth:i.width,containerHeight:i.height}),L=hZ(N,2),F=L[0],G=L[1],k=P.useCallback((ie,fe)=>{G(B=>{var Q=Math.round(ie),K=Math.round(fe);return B.containerWidth===Q&&B.containerHeight===K?B:{containerWidth:Q,containerHeight:K}})},[]);P.useEffect(()=>{if(C.current==null||typeof ResizeObserver>"u")return Vg;var ie=V=>{var q,he=V[0];if(he!=null){var ae=he.contentRect,ce=ae.width,we=ae.height;k(ce,we),(q=O.current)===null||q===void 0||q.call(O,ce,we)}};y>0&&(ie=nZ(ie,y,{trailing:!0,leading:!1}));var fe=new ResizeObserver(ie),B=C.current.getBoundingClientRect(),Q=B.width,K=B.height;return k(Q,K),fe.observe(C.current),()=>{fe.disconnect()}},[k,y]);var U=F.containerWidth,H=F.containerHeight;bw(!n||n>0,"The aspect(%s) must be greater than zero.",n);var te=S4(U,H,{width:s,height:o,aspect:n,maxHeight:d}),ee=te.calculatedWidth,pe=te.calculatedHeight;return bw(U<0||H<0||ee!=null&&ee>0||pe!=null&&pe>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,ee,pe,s,o,l,c,n),R.createElement("div",bw({id:x?"".concat(x):void 0,className:nr("recharts-responsive-container",S),style:vk(vk({},E),{},{width:s,height:o,minWidth:l,minHeight:c,maxHeight:d}),ref:C},T),R.createElement("div",{style:JY({width:s,height:o})},R.createElement(_4,{width:ee,height:pe},f)))}),pZ=R.forwardRef((t,e)=>{var n=$P();if(Ll(n.width)&&Ll(n.height))return t.children;var r=eZ({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,o=x4(void 0,void 0,{width:i,height:s,aspect:t.aspect,maxHeight:t.maxHeight}),a=o.calculatedWidth,l=o.calculatedHeight;return Dt(a)&&Dt(l)?R.createElement(_4,{width:a,height:l},t.children):R.createElement(hZ,bw({},t,{width:i,height:s,ref:e}))});function XP(t){if(t)return{x:t.x,y:t.y,upperWidth:"upperWidth"in t?t.upperWidth:t.width,lowerWidth:"lowerWidth"in t?t.lowerWidth:t.width,width:t.width,height:t.height}}var vS=()=>{var t,e=eo(),n=Vt(GY),r=Vt(gS),i=(t=Vt(mS))===null||t===void 0?void 0:t.padding;return!e||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},mZ={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},w4=()=>{var t;return(t=Vt($i))!==null&&t!==void 0?t:mZ},S4=()=>Vt(tu),M4=()=>Vt(nu),pr=t=>t.layout.layoutType,Gg=()=>Vt(pr),qP=()=>{var t=Gg();if(t==="horizontal"||t==="vertical")return t},E4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},gZ=()=>{var t=Gg();return t!==void 0},Ky=t=>{var e=Xr(),n=eo(),r=t.width,i=t.height,s=$P(),o=r,a=i;return s&&(o=s.width>0?s.width:r,a=s.height>0?s.height:i),R.useEffect(()=>{!n&&Ll(o)&&Ll(a)&&e(gY({width:o,height:a}))},[e,n,o,a]),null},A4=Symbol.for("immer-nothing"),xk=Symbol.for("immer-draftable"),Ao=Symbol.for("immer-state");function Fa(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var py=Object.getPrototypeOf;function Ag(t){return!!t&&!!t[Ao]}function kh(t){var e;return t?T4(t)||Array.isArray(t)||!!t[xk]||!!((e=t.constructor)!=null&&e[xk])||Yy(t)||xS(t):!1}var vZ=Object.prototype.constructor.toString(),bk=new WeakMap;function T4(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=bk.get(n);return r===void 0&&(r=Function.toString.call(n),bk.set(n,r)),r===vZ}function _w(t,e,n=!0){yS(t)===0?(n?Reflect.ownKeys(t):Object.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function yS(t){const e=t[Ao];return e?e.type_:Array.isArray(t)?1:Yy(t)?2:xS(t)?3:0}function hC(t,e){return yS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function C4(t,e,n){const r=yS(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function yZ(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Yy(t){return t instanceof Map}function xS(t){return t instanceof Set}function Wf(t){return t.copy_||t.base_}function pC(t,e){if(Yy(t))return new Map(t);if(xS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=T4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Ao];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(t,{set:Cb,add:Cb,clear:Cb,delete:Cb}),Object.freeze(t),e&&Object.values(t).forEach(n=>KP(n,!0))),t}function xZ(){Fa(2)}var Cb={value:xZ};function bS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var bZ={};function Oh(t){const e=bZ[t];return e||Fa(0,t),e}var my;function P4(){return my}function _Z(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function _k(t,e){e&&(Oh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function mC(t){gC(t),t.drafts_.forEach(wZ),t.drafts_=null}function gC(t){t===my&&(my=t.parent_)}function wk(t){return my=_Z(my,t)}function wZ(t){const e=t[Ao];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Sk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Ao].modified_&&(mC(e),Fa(4)),kh(t)&&(t=ww(e,t),e.parent_||Sw(e,t)),e.patches_&&Oh("Patches").generateReplacementPatches_(n[Ao].base_,t,e.patches_,e.inversePatches_)):t=ww(e,n,[]),mC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==A4?t:void 0}function ww(t,e,n){if(bS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Ao];if(!i)return _w(e,(s,o)=>Mk(t,i,e,s,o,n),r),e;if(i.scope_!==t)return e;if(!i.modified_)return Sw(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,a=!1;i.type_===3&&(o=new Set(s),s.clear(),a=!0),_w(o,(l,c)=>Mk(t,i,s,l,c,n,a),r),Sw(t,s,!1),n&&t.patches_&&Oh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function Mk(t,e,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const a=bS(i);if(!(a&&!o)){if(Ag(i)){const l=s&&e&&e.type_!==3&&!hC(e.assigned_,r)?s.concat(r):void 0,c=ww(t,i,l);if(C4(n,r,c),Ag(c))t.canAutoFreeze_=!1;else return}else o&&n.add(i);if(kh(i)&&!a){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===i&&a)return;ww(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(Yy(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Sw(t,i)}}}function Sw(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&KP(e,n)}function SZ(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:P4(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=YP;n&&(i=[r],s=gy);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,a}var YP={get(t,e){if(e===Ao)return t;const n=Wf(t);if(!hC(n,e))return MZ(t,n,e);const r=n[e];return t.finalized_||!kh(r)?r:r===SE(t.base_,e)?(ME(t),t.copy_[e]=yC(r,t)):r},has(t,e){return e in Wf(t)},ownKeys(t){return Reflect.ownKeys(Wf(t))},set(t,e,n){const r=R4(Wf(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=SE(Wf(t),e),s=i==null?void 0:i[Ao];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(yZ(n,i)&&(n!==void 0||hC(t.base_,e)))return!0;ME(t),vC(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return SE(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,ME(t),vC(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Wf(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){Fa(11)},getPrototypeOf(t){return py(t.base_)},setPrototypeOf(){Fa(12)}},gy={};_w(YP,(t,e)=>{gy[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});gy.deleteProperty=function(t,e){return gy.set.call(this,t,e,void 0)};gy.set=function(t,e,n){return YP.set.call(this,t[0],e,n,t[0])};function SE(t,e){const n=t[Ao];return(n?Wf(n):t)[e]}function MZ(t,e,n){var i;const r=R4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function R4(t,e){if(!(e in t))return;let n=py(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=py(n)}}function vC(t){t.modified_||(t.modified_=!0,t.parent_&&vC(t.parent_))}function ME(t){t.copy_||(t.copy_=pC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var EZ=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const s=n;n=e;const o=this;return function(l=s,...c){return o.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&Fa(6),r!==void 0&&typeof r!="function"&&Fa(7);let i;if(kh(e)){const s=wk(this),o=yC(e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?mC(s):gC(s)}return _k(s,r),Sk(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===A4&&(i=void 0),this.autoFreeze_&&KP(i,!0),r){const s=[],o=[];Oh("Patches").generateReplacementPatches_(e,i,s,o),r(s,o)}return i}else Fa(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(o,...a)=>this.produceWithPatches(o,l=>e(l,...a));let r,i;return[this.produce(e,n,(o,a)=>{r=o,i=a}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){kh(t)||Fa(8),Ag(t)&&(t=AZ(t));const e=wk(this),n=yC(t,void 0);return n[Ao].isManual_=!0,gC(e),n}finishDraft(t,e){const n=t&&t[Ao];(!n||!n.isManual_)&&Fa(9);const{scope_:r}=n;return _k(r,e),Sk(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=Oh("Patches").applyPatches_;return Ag(t)?r(t,e):this.produce(t,i=>r(i,e))}};function yC(t,e){const n=Yy(t)?Oh("MapSet").proxyMap_(t,e):xS(t)?Oh("MapSet").proxySet_(t,e):SZ(t,e);return(e?e.scope_:P4()).drafts_.push(n),n}function AZ(t){return Ag(t)||Fa(10,t),N4(t)}function N4(t){if(!kh(t)||bS(t))return t;const e=t[Ao];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=pC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=pC(t,!0);return _w(n,(i,s)=>{C4(n,i,N4(s))},r),e&&(e.finalized_=!1),n}var TZ=new EZ;TZ.produce;var CZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},I4=ds({name:"legend",initialState:CZ,reducers:{setLegendSize(t,e){t.size.width=e.payload.width,t.size.height=e.payload.height},setLegendSettings(t,e){t.settings.align=e.payload.align,t.settings.layout=e.payload.layout,t.settings.verticalAlign=e.payload.verticalAlign,t.settings.itemSorter=e.payload.itemSorter},addLegendPayload:{reducer(t,e){t.payload.push(e.payload)},prepare:ar()},replaceLegendPayload:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=qo(t).payload.indexOf(r);s>-1&&(t.payload[s]=i)},prepare:ar()},removeLegendPayload:{reducer(t,e){var n=qo(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:ar()}}}),Zy=I4.actions;Zy.setLegendSize;Zy.setLegendSettings;var PZ=Zy.addLegendPayload,RZ=Zy.replaceLegendPayload,NZ=Zy.removeLegendPayload,IZ=I4.reducer,EE={exports:{}},AE={};/** + height and width.`,ee,pe,s,o,l,c,n),P.createElement("div",_w({id:x?"".concat(x):void 0,className:ir("recharts-responsive-container",S),style:bk(bk({},M),{},{width:s,height:o,minWidth:l,minHeight:c,maxHeight:d}),ref:C},T),P.createElement("div",{style:aZ({width:s,height:o})},P.createElement(E4,{width:ee,height:pe},f)))}),wZ=P.forwardRef((t,e)=>{var n=KP();if(Ll(n.width)&&Ll(n.height))return t.children;var r=lZ({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,o=S4(void 0,void 0,{width:i,height:s,aspect:t.aspect,maxHeight:t.maxHeight}),a=o.calculatedWidth,l=o.calculatedHeight;return jt(a)&&jt(l)?P.createElement(E4,{width:a,height:l},t.children):P.createElement(_Z,_w({},t,{width:i,height:s,ref:e}))});function YP(t){if(t)return{x:t.x,y:t.y,upperWidth:"upperWidth"in t?t.upperWidth:t.width,lowerWidth:"lowerWidth"in t?t.lowerWidth:t.width,width:t.width,height:t.height}}var xS=()=>{var t,e=to(),n=Gt(QY),r=Gt(yS),i=(t=Gt(vS))===null||t===void 0?void 0:t.padding;return!e||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},SZ={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},A4=()=>{var t;return(t=Gt($i))!==null&&t!==void 0?t:SZ},T4=()=>Gt(tu),C4=()=>Gt(nu),gr=t=>t.layout.layoutType,Gg=()=>Gt(gr),ZP=()=>{var t=Gg();if(t==="horizontal"||t==="vertical")return t},P4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},MZ=()=>{var t=Gg();return t!==void 0},Ky=t=>{var e=qr(),n=to(),r=t.width,i=t.height,s=KP(),o=r,a=i;return s&&(o=s.width>0?s.width:r,a=s.height>0?s.height:i),P.useEffect(()=>{!n&&Ll(o)&&Ll(a)&&e(MY({width:o,height:a}))},[e,n,o,a]),null},R4=Symbol.for("immer-nothing"),wk=Symbol.for("immer-draftable"),Po=Symbol.for("immer-state");function Fa(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var py=Object.getPrototypeOf;function Ag(t){return!!t&&!!t[Po]}function Oh(t){var e;return t?N4(t)||Array.isArray(t)||!!t[wk]||!!((e=t.constructor)!=null&&e[wk])||Yy(t)||_S(t):!1}var EZ=Object.prototype.constructor.toString(),Sk=new WeakMap;function N4(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=Sk.get(n);return r===void 0&&(r=Function.toString.call(n),Sk.set(n,r)),r===EZ}function ww(t,e,n=!0){bS(t)===0?(n?Reflect.ownKeys(t):Object.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function bS(t){const e=t[Po];return e?e.type_:Array.isArray(t)?1:Yy(t)?2:_S(t)?3:0}function vC(t,e){return bS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function I4(t,e,n){const r=bS(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function AZ(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Yy(t){return t instanceof Map}function _S(t){return t instanceof Set}function $f(t){return t.copy_||t.base_}function yC(t,e){if(Yy(t))return new Map(t);if(_S(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=N4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Po];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(t,{set:Cb,add:Cb,clear:Cb,delete:Cb}),Object.freeze(t),e&&Object.values(t).forEach(n=>QP(n,!0))),t}function TZ(){Fa(2)}var Cb={value:TZ};function wS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var CZ={};function Lh(t){const e=CZ[t];return e||Fa(0,t),e}var my;function k4(){return my}function PZ(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Mk(t,e){e&&(Lh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function xC(t){bC(t),t.drafts_.forEach(RZ),t.drafts_=null}function bC(t){t===my&&(my=t.parent_)}function Ek(t){return my=PZ(my,t)}function RZ(t){const e=t[Po];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Ak(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Po].modified_&&(xC(e),Fa(4)),Oh(t)&&(t=Sw(e,t),e.parent_||Mw(e,t)),e.patches_&&Lh("Patches").generateReplacementPatches_(n[Po].base_,t,e.patches_,e.inversePatches_)):t=Sw(e,n,[]),xC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==R4?t:void 0}function Sw(t,e,n){if(wS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Po];if(!i)return ww(e,(s,o)=>Tk(t,i,e,s,o,n),r),e;if(i.scope_!==t)return e;if(!i.modified_)return Mw(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,a=!1;i.type_===3&&(o=new Set(s),s.clear(),a=!0),ww(o,(l,c)=>Tk(t,i,s,l,c,n,a),r),Mw(t,s,!1),n&&t.patches_&&Lh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function Tk(t,e,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const a=wS(i);if(!(a&&!o)){if(Ag(i)){const l=s&&e&&e.type_!==3&&!vC(e.assigned_,r)?s.concat(r):void 0,c=Sw(t,i,l);if(I4(n,r,c),Ag(c))t.canAutoFreeze_=!1;else return}else o&&n.add(i);if(Oh(i)&&!a){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===i&&a)return;Sw(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(Yy(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Mw(t,i)}}}function Mw(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&QP(e,n)}function NZ(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:k4(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=JP;n&&(i=[r],s=gy);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,a}var JP={get(t,e){if(e===Po)return t;const n=$f(t);if(!vC(n,e))return IZ(t,n,e);const r=n[e];return t.finalized_||!Oh(r)?r:r===EE(t.base_,e)?(AE(t),t.copy_[e]=wC(r,t)):r},has(t,e){return e in $f(t)},ownKeys(t){return Reflect.ownKeys($f(t))},set(t,e,n){const r=O4($f(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=EE($f(t),e),s=i==null?void 0:i[Po];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(AZ(n,i)&&(n!==void 0||vC(t.base_,e)))return!0;AE(t),_C(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return EE(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,AE(t),_C(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=$f(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){Fa(11)},getPrototypeOf(t){return py(t.base_)},setPrototypeOf(){Fa(12)}},gy={};ww(JP,(t,e)=>{gy[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});gy.deleteProperty=function(t,e){return gy.set.call(this,t,e,void 0)};gy.set=function(t,e,n){return JP.set.call(this,t[0],e,n,t[0])};function EE(t,e){const n=t[Po];return(n?$f(n):t)[e]}function IZ(t,e,n){var i;const r=O4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function O4(t,e){if(!(e in t))return;let n=py(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=py(n)}}function _C(t){t.modified_||(t.modified_=!0,t.parent_&&_C(t.parent_))}function AE(t){t.copy_||(t.copy_=yC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var kZ=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const s=n;n=e;const o=this;return function(l=s,...c){return o.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&Fa(6),r!==void 0&&typeof r!="function"&&Fa(7);let i;if(Oh(e)){const s=Ek(this),o=wC(e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?xC(s):bC(s)}return Mk(s,r),Ak(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===R4&&(i=void 0),this.autoFreeze_&&QP(i,!0),r){const s=[],o=[];Lh("Patches").generateReplacementPatches_(e,i,s,o),r(s,o)}return i}else Fa(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(o,...a)=>this.produceWithPatches(o,l=>e(l,...a));let r,i;return[this.produce(e,n,(o,a)=>{r=o,i=a}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Oh(t)||Fa(8),Ag(t)&&(t=OZ(t));const e=Ek(this),n=wC(t,void 0);return n[Po].isManual_=!0,bC(e),n}finishDraft(t,e){const n=t&&t[Po];(!n||!n.isManual_)&&Fa(9);const{scope_:r}=n;return Mk(r,e),Ak(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=Lh("Patches").applyPatches_;return Ag(t)?r(t,e):this.produce(t,i=>r(i,e))}};function wC(t,e){const n=Yy(t)?Lh("MapSet").proxyMap_(t,e):_S(t)?Lh("MapSet").proxySet_(t,e):NZ(t,e);return(e?e.scope_:k4()).drafts_.push(n),n}function OZ(t){return Ag(t)||Fa(10,t),L4(t)}function L4(t){if(!Oh(t)||wS(t))return t;const e=t[Po];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=yC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=yC(t,!0);return ww(n,(i,s)=>{I4(n,i,L4(s))},r),e&&(e.finalized_=!1),n}var LZ=new kZ;LZ.produce;var DZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},D4=ds({name:"legend",initialState:DZ,reducers:{setLegendSize(t,e){t.size.width=e.payload.width,t.size.height=e.payload.height},setLegendSettings(t,e){t.settings.align=e.payload.align,t.settings.layout=e.payload.layout,t.settings.verticalAlign=e.payload.verticalAlign,t.settings.itemSorter=e.payload.itemSorter},addLegendPayload:{reducer(t,e){t.payload.push(e.payload)},prepare:cr()},replaceLegendPayload:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=Ko(t).payload.indexOf(r);s>-1&&(t.payload[s]=i)},prepare:cr()},removeLegendPayload:{reducer(t,e){var n=Ko(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:cr()}}}),Zy=D4.actions;Zy.setLegendSize;Zy.setLegendSettings;var jZ=Zy.addLegendPayload,UZ=Zy.replaceLegendPayload,FZ=Zy.removeLegendPayload,zZ=D4.reducer,TE={exports:{}},CE={};/** * @license React * use-sync-external-store-with-selector.production.js * @@ -511,58 +526,58 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ek;function kZ(){if(Ek)return AE;Ek=1;var t=$h();function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,s=t.useEffect,o=t.useMemo,a=t.useDebugValue;return AE.useSyncExternalStoreWithSelector=function(l,c,d,f,m){var y=i(null);if(y.current===null){var x={hasValue:!1,value:null};y.current=x}else x=y.current;y=o(function(){function _(O){if(!w){if(w=!0,E=O,O=f(O),m!==void 0&&x.hasValue){var N=x.value;if(m(N,O))return T=N}return T=O}if(N=T,n(E,O))return N;var L=f(O);return m!==void 0&&m(N,L)?(E=O,N):(E=O,T=L)}var w=!1,E,T,C=d===void 0?null:d;return[function(){return _(c())},C===null?void 0:function(){return _(C())}]},[c,d,f,m]);var S=r(l,y[0],y[1]);return s(function(){x.hasValue=!0,x.value=S},[S]),a(S),S},AE}var Ak;function OZ(){return Ak||(Ak=1,EE.exports=kZ()),EE.exports}OZ();function LZ(t){t()}function DZ(){let t=null,e=null;return{clear(){t=null,e=null},notify(){LZ(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var Tk={notify(){},get:()=>[]};function jZ(t,e){let n,r=Tk,i=0,s=!1;function o(S){d();const _=r.subscribe(S);let w=!1;return()=>{w||(w=!0,_(),f())}}function a(){r.notify()}function l(){x.onStateChange&&x.onStateChange()}function c(){return s}function d(){i++,n||(n=t.subscribe(l),r=DZ())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Tk)}function m(){s||(s=!0,d())}function y(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:m,tryUnsubscribe:y,getListeners:()=>r};return x}var UZ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",FZ=UZ(),zZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",BZ=zZ(),HZ=()=>FZ||BZ?R.useLayoutEffect:R.useEffect,VZ=HZ();function Ck(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function GZ(t,e){if(Ck(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i{const l=jZ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),o=R.useMemo(()=>i.getState(),[i]);VZ(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,o]);const a=n||$Z;return R.createElement(a.Provider,{value:s},e)}var qZ=XZ,KZ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function YZ(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function _S(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(KZ.has(r)){if(t[r]==null&&e[r]==null)continue;if(!GZ(t[r],e[r]))return!1}else if(!YZ(t[r],e[r]))return!1;return!0}function xC(){return xC=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.separator,n=e===void 0?am.separator:e,r=t.contentStyle,i=t.itemStyle,s=t.labelStyle,o=s===void 0?am.labelStyle:s,a=t.payload,l=t.formatter,c=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,m=t.label,y=t.labelFormatter,x=t.accessibilityLayer,S=x===void 0?am.accessibilityLayer:x,_=()=>{if(a&&a.length){var F={padding:0,margin:0},G=oQ(a,c),k=G.map((U,H)=>{if(!U||U.type==="none")return null;var ne=U.formatter||l||sQ,ee=U.value,pe=U.name,se=ee,fe=pe;if(ne){var B=ne(ee,pe,U,H,a);if(Array.isArray(B)){var Q=eQ(B,2);se=Q[0],fe=Q[1]}else if(B!=null)se=B;else return null}var K=o0(o0({},am.itemStyle),{},{color:U.color||am.itemStyle.color},i);return R.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(H),style:K},Ol(fe)?R.createElement("span",{className:"recharts-tooltip-item-name"},fe):null,Ol(fe)?R.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,R.createElement("span",{className:"recharts-tooltip-item-value"},se),R.createElement("span",{className:"recharts-tooltip-item-unit"},U.unit||""))});return R.createElement("ul",{className:"recharts-tooltip-item-list",style:F},k)}return null},w=o0(o0({},am.contentStyle),r),E=o0({margin:0},o),T=!Vi(m),C=T?m:"",O=nr("recharts-default-tooltip",d),N=nr("recharts-tooltip-label",f);T&&y&&a!==void 0&&a!==null&&(C=y(m,a));var L=S?{role:"status","aria-live":"assertive"}:{};return R.createElement("div",xC({className:O,style:w},L),R.createElement("p",{className:N,style:E},R.isValidElement(C)?C:"".concat(C)),_())},a0="recharts-tooltip-wrapper",lQ={visibility:"hidden"};function cQ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return nr(a0,{["".concat(a0,"-right")]:Dt(n)&&e&&Dt(e.x)&&n>=e.x,["".concat(a0,"-left")]:Dt(n)&&e&&Dt(e.x)&&n=e.y,["".concat(a0,"-top")]:Dt(r)&&e&&Dt(e.y)&&r0?i:0),f=n[r]+i;if(e[r])return o[r]?d:f;var m=l[r];if(m==null)return 0;if(o[r]){var y=d,x=m;return y_?Math.max(d,m):Math.max(f,m)}function uQ(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function dQ(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,i=t.offsetLeft,s=t.position,o=t.reverseDirection,a=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,f,m;return a.height>0&&a.width>0&&n?(f=Nk({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:a.width,viewBox:c,viewBoxDimension:c.width}),m=Nk({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:a.height,viewBox:c,viewBoxDimension:c.height}),d=uQ({translateX:f,translateY:m,useTranslate3d:l})):d=lQ,{cssProperties:d,cssClasses:cQ({translateX:f,translateY:m,coordinate:n})}}var fQ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Qy={isSsr:fQ()};function hQ(t,e){return vQ(t)||gQ(t,e)||mQ(t,e)||pQ()}function pQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mQ(t,e){if(t){if(typeof t=="string")return Ik(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ik(t,e):void 0}}function Ik(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nQy.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=hQ(t,2),n=e[0],r=e[1];return R.useEffect(()=>{if(window.matchMedia){var i=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{r(i.matches)};return i.addEventListener("change",s),()=>{i.removeEventListener("change",s)}}},[]),n}function kk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function lm(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),c=_Q(l,2),d=c[0],f=c[1];R.useEffect(()=>{var w=E=>{if(E.key==="Escape"){var T,C,O,N;f({dismissed:!0,dismissedAtCoordinate:{x:(T=(C=t.coordinate)===null||C===void 0?void 0:C.x)!==null&&T!==void 0?T:0,y:(O=(N=t.coordinate)===null||N===void 0?void 0:N.y)!==null&&O!==void 0?O:0}})}};return document.addEventListener("keydown",w),()=>{document.removeEventListener("keydown",w)}},[(e=t.coordinate)===null||e===void 0?void 0:e.x,(n=t.coordinate)===null||n===void 0?void 0:n.y]),d.dismissed&&(((r=(i=t.coordinate)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)!==d.dismissedAtCoordinate.x||((s=(o=t.coordinate)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)!==d.dismissedAtCoordinate.y)&&f(lm(lm({},d),{},{dismissed:!1}));var m=dQ({allowEscapeViewBox:t.allowEscapeViewBox,coordinate:t.coordinate,offsetLeft:typeof t.offset=="number"?t.offset:t.offset.x,offsetTop:typeof t.offset=="number"?t.offset:t.offset.y,position:t.position,reverseDirection:t.reverseDirection,tooltipBox:{height:t.lastBoundingBox.height,width:t.lastBoundingBox.width},useTranslate3d:t.useTranslate3d,viewBox:t.viewBox}),y=m.cssClasses,x=m.cssProperties,S=t.hasPortalFromProps?{}:lm(lm({transition:AQ({prefersReducedMotion:a,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},x),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),_=lm(lm({},S),{},{visibility:!d.dismissed&&t.active&&t.hasPayload?"visible":"hidden"},t.wrapperStyle);return R.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:y,style:_,ref:t.innerRef},t.children)}var CQ=R.memo(TQ),O4=()=>{var t;return(t=Vt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function bC(){return bC=Object.assign?Object.assign.bind():function(t){for(var e=1;eEn(t.x)&&En(t.y),Uk=t=>t.base!=null&&Mw(t.base)&&Mw(t),l0=t=>t.x,c0=t=>t.y,IQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(DP(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=jk["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return jk[n]||eS},Fk={connectNulls:!1,type:"linear"},kQ=t=>{var e=t.type,n=e===void 0?Fk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,o=t.layout,a=t.connectNulls,l=a===void 0?Fk.connectNulls:a,c=IQ(n,o),d=l?i.filter(Mw):i;if(Array.isArray(s)){var f,m=i.map((w,E)=>Dk(Dk({},w),{},{base:s[E]}));o==="vertical"?f=_b().y(c0).x1(l0).x0(w=>w.base.x):f=_b().x(l0).y1(c0).y0(w=>w.base.y);var y=f.defined(Uk).curve(c),x=l?m.filter(Uk):m;return y(x)}var S;o==="vertical"&&Dt(s)?S=_b().y(c0).x1(l0).x0(s):Dt(s)?S=_b().x(l0).y1(c0).y0(s):S=c5().x(l0).y(c0);var _=S.defined(Mw).curve(c);return _(d)},V_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Gg();if((!n||!n.length)&&!r)return null;var o={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},a=n&&n.length?kQ(o):r;return R.createElement("path",bC({},Ba(t),jP(t),{className:nr("recharts-curve",e),d:a===null?void 0:a,ref:i}))},OQ=["x","y","top","left","width","height","className"];function _C(){return _C=Object.assign?Object.assign.bind():function(t){for(var e=1;e"M".concat(t,",").concat(i,"v").concat(r,"M").concat(s,",").concat(e,"h").concat(n),HQ=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,i=r===void 0?0:r,s=t.top,o=s===void 0?0:s,a=t.left,l=a===void 0?0:a,c=t.width,d=c===void 0?0:c,f=t.height,m=f===void 0?0:f,y=t.className,x=FQ(t,OQ),S=LQ({x:n,y:i,top:o,left:l,width:d,height:m},x);return!Dt(n)||!Dt(i)||!Dt(d)||!Dt(m)||!Dt(o)||!Dt(l)?null:R.createElement("path",_C({},Zo(S),{className:nr("recharts-cross",y),d:BQ(n,i,d,m,o,l)}))};function VQ(t,e,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-i,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}var Ew=1e-4,L4=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],D4=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),Bk=(t,e)=>n=>{var r=L4(t,e);return D4(r,n)},GQ=(t,e)=>n=>{var r=L4(t,e),i=[...r.map((s,o)=>s*o).slice(1),0];return D4(i,n)},WQ=t=>{var e,n=t.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(e=n[1])===null||e===void 0||(e=e.split(")")[0])===null||e===void 0?void 0:e.split(",");if(r==null||r.length!==4)return null;var i=r.map(s=>parseFloat(s));return[i[0],i[1],i[2],i[3]]},$Q=function(){for(var e=arguments.length,n=new Array(e),r=0;r{var i=Bk(t,n),s=Bk(e,r),o=GQ(t,n),a=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,m=0;m<8;++m){var y=i(f)-d,x=o(f);if(Math.abs(y-d)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,s=i===void 0?8:i,o=e.dt,a=o===void 0?16.67:o,l=1,c=[0],d=0,f=0,m=1e4,y=0;y{var E,T,C;if(w<=0)return 0;if(w>=1)return l;var O=w*_,N=Math.floor(O),L=O-N;return((E=c[N])!==null&&E!==void 0?E:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((C=c[N])!==null&&C!==void 0?C:0))*L}},KQ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Hk(t);case"spring":return qQ();default:if(t.split("(")[0]==="cubic-bezier")return Hk(t)}return typeof t=="function"?t:null},YQ=(t,e,n)=>{var r,i=s=>{var o=e.tick(s);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(i,o);return}r=t.setTimeout(i,o)};return r=t.setTimeout(i,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},j4=R.createContext(YQ);j4.Provider;function ZQ(t){var e=R.useContext(j4);return R.useMemo(()=>t??e,[t,e])}function QQ(t,e,n){return(e=JQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JQ(t){var e=eJ(t,"string");return typeof e=="symbol"?e:e+""}function eJ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vk="init",Gk="pending",Wk="active",tJ="completed";function PE(t){return Math.max(0,t)}class nJ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;QQ(this,"state",Vk),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=PE(e.animationDuration),this.animationBegin=PE(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(n=e.onAnimationStart)===null||n===void 0||n.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===Vk)return this.state=Gk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===Gk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Wk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):PE(this.animationBegin-n)}if(this.getState()===Wk){if(this.animationStartedTime==null)throw new Error;var r=e-this.animationStartedTime;return this.setProgress(r/this.animationDuration),this.nextAnimationUpdate(r)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var e;(e=this.onAnimationEnd)===null||e===void 0||e.call(this)}this.state=tJ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class rJ extends nJ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Fc(this.getFrom(),this.getTo(),this.getProgress()))}}class iJ{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?e(o):i=requestAnimationFrame(s)};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function sJ(t,e){return cJ(t)||lJ(t,e)||aJ(t,e)||oJ()}function oJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aJ(t,e){if(t){if(typeof t=="string")return $k(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$k(t,e):void 0}}function $k(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{},onAnimationStart:()=>{}},Xk=0,RE=1;function U4(t){var e=ta(t,uJ),n=e.animationId,r=e.isActive,i=e.canBegin,s=e.duration,o=e.easing,a=e.begin,l=e.onAnimationEnd,c=e.onAnimationStart,d=e.children,f=k4(),m=r==="auto"?!Qy.isSsr&&!f:r,y=ZQ(e.animationController),x=R.useState(m?Xk:RE),S=sJ(x,2),_=S[0],w=S[1];return R.useEffect(()=>{m||w(RE)},[m]),R.useEffect(()=>{var E=KQ(o);if(!m||!i||E==null)return Vg;var T=new iJ,C=new rJ({animationId:n,easing:E,animationDuration:s,animationBegin:a,onAnimationStart:c,onAnimationEnd:l,from:Xk,to:RE});return y(T,C,w)},[y,n,m,i,s,o,a,c,l]),d(Number(_))}function F4(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=R.useRef(uy(e)),r=R.useRef(t);return r.current!==t&&(n.current=uy(e),r.current=t),n.current}var dJ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),fJ=(t,e,n)=>t.map(r=>"".concat(dJ(r)," ").concat(e,"ms ").concat(n)).join(","),hJ=["radius"],pJ=["radius"],qk,Kk,Yk,Zk,Qk,Jk,eO,tO,nO,rO;function iO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var s=xd(n),o=xd(r),a=Math.min(Math.abs(s)/2,Math.abs(o)/2),l=o>=0?1:-1,c=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(a>0&&Array.isArray(i)){for(var m=[0,0,0,0],y=0,x=4;ya?a:_}f=ji(qk||(qk=fl(["M",",",""])),t,e+l*m[0]),m[0]>0&&(f+=ji(Kk||(Kk=fl(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,t+c*m[0],e)),f+=ji(Yk||(Yk=fl(["L ",",",""])),t+n-c*m[1],e),m[1]>0&&(f+=ji(Zk||(Zk=fl(["A ",",",",0,0,",`, - `,",",""])),m[1],m[1],d,t+n,e+l*m[1])),f+=ji(Qk||(Qk=fl(["L ",",",""])),t+n,e+r-l*m[2]),m[2]>0&&(f+=ji(Jk||(Jk=fl(["A ",",",",0,0,",`, - `,",",""])),m[2],m[2],d,t+n-c*m[2],e+r)),f+=ji(eO||(eO=fl(["L ",",",""])),t+c*m[3],e+r),m[3]>0&&(f+=ji(tO||(tO=fl(["A ",",",",0,0,",`, - `,",",""])),m[3],m[3],d,t,e+r-l*m[3])),f+="Z"}else if(a>0&&i===+i&&i>0){var w=Math.min(a,i);f=ji(nO||(nO=fl(["M ",",",` + */var Ck;function BZ(){if(Ck)return CE;Ck=1;var t=Xh();function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,s=t.useEffect,o=t.useMemo,a=t.useDebugValue;return CE.useSyncExternalStoreWithSelector=function(l,c,d,f,g){var y=i(null);if(y.current===null){var x={hasValue:!1,value:null};y.current=x}else x=y.current;y=o(function(){function w(O){if(!b){if(b=!0,M=O,O=f(O),g!==void 0&&x.hasValue){var N=x.value;if(g(N,O))return T=N}return T=O}if(N=T,n(M,O))return N;var L=f(O);return g!==void 0&&g(N,L)?(M=O,N):(M=O,T=L)}var b=!1,M,T,C=d===void 0?null:d;return[function(){return w(c())},C===null?void 0:function(){return w(C())}]},[c,d,f,g]);var S=r(l,y[0],y[1]);return s(function(){x.hasValue=!0,x.value=S},[S]),a(S),S},CE}var Pk;function HZ(){return Pk||(Pk=1,TE.exports=BZ()),TE.exports}HZ();function VZ(t){t()}function GZ(){let t=null,e=null;return{clear(){t=null,e=null},notify(){VZ(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var Rk={notify(){},get:()=>[]};function WZ(t,e){let n,r=Rk,i=0,s=!1;function o(S){d();const w=r.subscribe(S);let b=!1;return()=>{b||(b=!0,w(),f())}}function a(){r.notify()}function l(){x.onStateChange&&x.onStateChange()}function c(){return s}function d(){i++,n||(n=t.subscribe(l),r=GZ())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Rk)}function g(){s||(s=!0,d())}function y(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:g,tryUnsubscribe:y,getListeners:()=>r};return x}var $Z=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",XZ=$Z(),qZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",KZ=qZ(),YZ=()=>XZ||KZ?P.useLayoutEffect:P.useEffect,ZZ=YZ();function Nk(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function QZ(t,e){if(Nk(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i{const l=WZ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),o=P.useMemo(()=>i.getState(),[i]);ZZ(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,o]);const a=n||eQ;return P.createElement(a.Provider,{value:s},e)}var nQ=tQ,rQ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function iQ(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function SS(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(rQ.has(r)){if(t[r]==null&&e[r]==null)continue;if(!QZ(t[r],e[r]))return!1}else if(!iQ(t[r],e[r]))return!1;return!0}function SC(){return SC=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.separator,n=e===void 0?am.separator:e,r=t.contentStyle,i=t.itemStyle,s=t.labelStyle,o=s===void 0?am.labelStyle:s,a=t.payload,l=t.formatter,c=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,g=t.label,y=t.labelFormatter,x=t.accessibilityLayer,S=x===void 0?am.accessibilityLayer:x,w=()=>{if(a&&a.length){var F={padding:0,margin:0},G=pQ(a,c),k=G.map((U,H)=>{if(!U||U.type==="none")return null;var te=U.formatter||l||hQ,ee=U.value,pe=U.name,ie=ee,fe=pe;if(te){var B=te(ee,pe,U,H,a);if(Array.isArray(B)){var Q=lQ(B,2);ie=Q[0],fe=Q[1]}else if(B!=null)ie=B;else return null}var K=o0(o0({},am.itemStyle),{},{color:U.color||am.itemStyle.color},i);return P.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(H),style:K},Ol(fe)?P.createElement("span",{className:"recharts-tooltip-item-name"},fe):null,Ol(fe)?P.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,P.createElement("span",{className:"recharts-tooltip-item-value"},ie),P.createElement("span",{className:"recharts-tooltip-item-unit"},U.unit||""))});return P.createElement("ul",{className:"recharts-tooltip-item-list",style:F},k)}return null},b=o0(o0({},am.contentStyle),r),M=o0({margin:0},o),T=!Gi(g),C=T?g:"",O=ir("recharts-default-tooltip",d),N=ir("recharts-tooltip-label",f);T&&y&&a!==void 0&&a!==null&&(C=y(g,a));var L=S?{role:"status","aria-live":"assertive"}:{};return P.createElement("div",SC({className:O,style:b},L),P.createElement("p",{className:N,style:M},P.isValidElement(C)?C:"".concat(C)),w())},a0="recharts-tooltip-wrapper",gQ={visibility:"hidden"};function vQ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return ir(a0,{["".concat(a0,"-right")]:jt(n)&&e&&jt(e.x)&&n>=e.x,["".concat(a0,"-left")]:jt(n)&&e&&jt(e.x)&&n=e.y,["".concat(a0,"-top")]:jt(r)&&e&&jt(e.y)&&r0?i:0),f=n[r]+i;if(e[r])return o[r]?d:f;var g=l[r];if(g==null)return 0;if(o[r]){var y=d,x=g;return yw?Math.max(d,g):Math.max(f,g)}function yQ(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function xQ(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,i=t.offsetLeft,s=t.position,o=t.reverseDirection,a=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,f,g;return a.height>0&&a.width>0&&n?(f=Ok({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:a.width,viewBox:c,viewBoxDimension:c.width}),g=Ok({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:a.height,viewBox:c,viewBoxDimension:c.height}),d=yQ({translateX:f,translateY:g,useTranslate3d:l})):d=gQ,{cssProperties:d,cssClasses:vQ({translateX:f,translateY:g,coordinate:n})}}var bQ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Qy={isSsr:bQ()};function _Q(t,e){return EQ(t)||MQ(t,e)||SQ(t,e)||wQ()}function wQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function SQ(t,e){if(t){if(typeof t=="string")return Lk(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lk(t,e):void 0}}function Lk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nQy.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=_Q(t,2),n=e[0],r=e[1];return P.useEffect(()=>{if(window.matchMedia){var i=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{r(i.matches)};return i.addEventListener("change",s),()=>{i.removeEventListener("change",s)}}},[]),n}function Dk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function lm(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),c=PQ(l,2),d=c[0],f=c[1];P.useEffect(()=>{var b=M=>{if(M.key==="Escape"){var T,C,O,N;f({dismissed:!0,dismissedAtCoordinate:{x:(T=(C=t.coordinate)===null||C===void 0?void 0:C.x)!==null&&T!==void 0?T:0,y:(O=(N=t.coordinate)===null||N===void 0?void 0:N.y)!==null&&O!==void 0?O:0}})}};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[(e=t.coordinate)===null||e===void 0?void 0:e.x,(n=t.coordinate)===null||n===void 0?void 0:n.y]),d.dismissed&&(((r=(i=t.coordinate)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)!==d.dismissedAtCoordinate.x||((s=(o=t.coordinate)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)!==d.dismissedAtCoordinate.y)&&f(lm(lm({},d),{},{dismissed:!1}));var g=xQ({allowEscapeViewBox:t.allowEscapeViewBox,coordinate:t.coordinate,offsetLeft:typeof t.offset=="number"?t.offset:t.offset.x,offsetTop:typeof t.offset=="number"?t.offset:t.offset.y,position:t.position,reverseDirection:t.reverseDirection,tooltipBox:{height:t.lastBoundingBox.height,width:t.lastBoundingBox.width},useTranslate3d:t.useTranslate3d,viewBox:t.viewBox}),y=g.cssClasses,x=g.cssProperties,S=t.hasPortalFromProps?{}:lm(lm({transition:OQ({prefersReducedMotion:a,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},x),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),w=lm(lm({},S),{},{visibility:!d.dismissed&&t.active&&t.hasPayload?"visible":"hidden"},t.wrapperStyle);return P.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:y,style:w,ref:t.innerRef},t.children)}var DQ=P.memo(LQ),U4=()=>{var t;return(t=Gt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function MC(){return MC=Object.assign?Object.assign.bind():function(t){for(var e=1;eAn(t.x)&&An(t.y),Bk=t=>t.base!=null&&Ew(t.base)&&Ew(t),l0=t=>t.x,c0=t=>t.y,zQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(FP(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=zk["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return zk[n]||nS},Hk={connectNulls:!1,type:"linear"},BQ=t=>{var e=t.type,n=e===void 0?Hk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,o=t.layout,a=t.connectNulls,l=a===void 0?Hk.connectNulls:a,c=zQ(n,o),d=l?i.filter(Ew):i;if(Array.isArray(s)){var f,g=i.map((b,M)=>Fk(Fk({},b),{},{base:s[M]}));o==="vertical"?f=_b().y(c0).x1(l0).x0(b=>b.base.x):f=_b().x(l0).y1(c0).y0(b=>b.base.y);var y=f.defined(Bk).curve(c),x=l?g.filter(Bk):g;return y(x)}var S;o==="vertical"&&jt(s)?S=_b().y(c0).x1(l0).x0(s):jt(s)?S=_b().x(l0).y1(c0).y0(s):S=h5().x(l0).y(c0);var w=S.defined(Ew).curve(c);return w(d)},G_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Gg();if((!n||!n.length)&&!r)return null;var o={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},a=n&&n.length?BQ(o):r;return P.createElement("path",MC({},Ba(t),zP(t),{className:ir("recharts-curve",e),d:a===null?void 0:a,ref:i}))},HQ=["x","y","top","left","width","height","className"];function EC(){return EC=Object.assign?Object.assign.bind():function(t){for(var e=1;e"M".concat(t,",").concat(i,"v").concat(r,"M").concat(s,",").concat(e,"h").concat(n),YQ=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,i=r===void 0?0:r,s=t.top,o=s===void 0?0:s,a=t.left,l=a===void 0?0:a,c=t.width,d=c===void 0?0:c,f=t.height,g=f===void 0?0:f,y=t.className,x=XQ(t,HQ),S=VQ({x:n,y:i,top:o,left:l,width:d,height:g},x);return!jt(n)||!jt(i)||!jt(d)||!jt(g)||!jt(o)||!jt(l)?null:P.createElement("path",EC({},Qo(S),{className:ir("recharts-cross",y),d:KQ(n,i,d,g,o,l)}))};function ZQ(t,e,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-i,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}var Aw=1e-4,F4=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],z4=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),Gk=(t,e)=>n=>{var r=F4(t,e);return z4(r,n)},QQ=(t,e)=>n=>{var r=F4(t,e),i=[...r.map((s,o)=>s*o).slice(1),0];return z4(i,n)},JQ=t=>{var e,n=t.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(e=n[1])===null||e===void 0||(e=e.split(")")[0])===null||e===void 0?void 0:e.split(",");if(r==null||r.length!==4)return null;var i=r.map(s=>parseFloat(s));return[i[0],i[1],i[2],i[3]]},eJ=function(){for(var e=arguments.length,n=new Array(e),r=0;r{var i=Gk(t,n),s=Gk(e,r),o=QQ(t,n),a=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,g=0;g<8;++g){var y=i(f)-d,x=o(f);if(Math.abs(y-d)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,s=i===void 0?8:i,o=e.dt,a=o===void 0?16.67:o,l=1,c=[0],d=0,f=0,g=1e4,y=0;y{var M,T,C;if(b<=0)return 0;if(b>=1)return l;var O=b*w,N=Math.floor(O),L=O-N;return((M=c[N])!==null&&M!==void 0?M:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((C=c[N])!==null&&C!==void 0?C:0))*L}},rJ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Wk(t);case"spring":return nJ();default:if(t.split("(")[0]==="cubic-bezier")return Wk(t)}return typeof t=="function"?t:null},iJ=(t,e,n)=>{var r,i=s=>{var o=e.tick(s);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(i,o);return}r=t.setTimeout(i,o)};return r=t.setTimeout(i,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},B4=P.createContext(iJ);B4.Provider;function sJ(t){var e=P.useContext(B4);return P.useMemo(()=>t??e,[t,e])}function oJ(t,e,n){return(e=aJ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aJ(t){var e=lJ(t,"string");return typeof e=="symbol"?e:e+""}function lJ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var $k="init",Xk="pending",qk="active",cJ="completed";function NE(t){return Math.max(0,t)}class uJ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;oJ(this,"state",$k),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=NE(e.animationDuration),this.animationBegin=NE(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(n=e.onAnimationStart)===null||n===void 0||n.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===$k)return this.state=Xk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===Xk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=qk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):NE(this.animationBegin-n)}if(this.getState()===qk){if(this.animationStartedTime==null)throw new Error;var r=e-this.animationStartedTime;return this.setProgress(r/this.animationDuration),this.nextAnimationUpdate(r)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var e;(e=this.onAnimationEnd)===null||e===void 0||e.call(this)}this.state=cJ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class dJ extends uJ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Fc(this.getFrom(),this.getTo(),this.getProgress()))}}class fJ{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?e(o):i=requestAnimationFrame(s)};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function hJ(t,e){return vJ(t)||gJ(t,e)||mJ(t,e)||pJ()}function pJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mJ(t,e){if(t){if(typeof t=="string")return Kk(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kk(t,e):void 0}}function Kk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{},onAnimationStart:()=>{}},Yk=0,IE=1;function H4(t){var e=na(t,yJ),n=e.animationId,r=e.isActive,i=e.canBegin,s=e.duration,o=e.easing,a=e.begin,l=e.onAnimationEnd,c=e.onAnimationStart,d=e.children,f=j4(),g=r==="auto"?!Qy.isSsr&&!f:r,y=sJ(e.animationController),x=P.useState(g?Yk:IE),S=hJ(x,2),w=S[0],b=S[1];return P.useEffect(()=>{g||b(IE)},[g]),P.useEffect(()=>{var M=rJ(o);if(!g||!i||M==null)return Vg;var T=new fJ,C=new dJ({animationId:n,easing:M,animationDuration:s,animationBegin:a,onAnimationStart:c,onAnimationEnd:l,from:Yk,to:IE});return y(T,C,b)},[y,n,g,i,s,o,a,c,l]),d(Number(w))}function V4(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=P.useRef(uy(e)),r=P.useRef(t);return r.current!==t&&(n.current=uy(e),r.current=t),n.current}var xJ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),bJ=(t,e,n)=>t.map(r=>"".concat(xJ(r)," ").concat(e,"ms ").concat(n)).join(","),_J=["radius"],wJ=["radius"],Zk,Qk,Jk,eO,tO,nO,rO,iO,sO,oO;function aO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function lO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var s=xd(n),o=xd(r),a=Math.min(Math.abs(s)/2,Math.abs(o)/2),l=o>=0?1:-1,c=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(a>0&&Array.isArray(i)){for(var g=[0,0,0,0],y=0,x=4;ya?a:w}f=Ui(Zk||(Zk=fl(["M",",",""])),t,e+l*g[0]),g[0]>0&&(f+=Ui(Qk||(Qk=fl(["A ",",",",0,0,",",",",",""])),g[0],g[0],d,t+c*g[0],e)),f+=Ui(Jk||(Jk=fl(["L ",",",""])),t+n-c*g[1],e),g[1]>0&&(f+=Ui(eO||(eO=fl(["A ",",",",0,0,",`, + `,",",""])),g[1],g[1],d,t+n,e+l*g[1])),f+=Ui(tO||(tO=fl(["L ",",",""])),t+n,e+r-l*g[2]),g[2]>0&&(f+=Ui(nO||(nO=fl(["A ",",",",0,0,",`, + `,",",""])),g[2],g[2],d,t+n-c*g[2],e+r)),f+=Ui(rO||(rO=fl(["L ",",",""])),t+c*g[3],e+r),g[3]>0&&(f+=Ui(iO||(iO=fl(["A ",",",",0,0,",`, + `,",",""])),g[3],g[3],d,t,e+r-l*g[3])),f+="Z"}else if(a>0&&i===+i&&i>0){var b=Math.min(a,i);f=Ui(sO||(sO=fl(["M ",",",` A `,",",",0,0,",",",",",` L `,",",` A `,",",",0,0,",",",",",` L `,",",` A `,",",",0,0,",",",",",` L `,",",` - A `,",",",0,0,",",",","," Z"])),t,e+l*w,w,w,d,t+c*w,e,t+n-c*w,e,w,w,d,t+n,e+l*w,t+n,e+r-l*w,w,w,d,t+n-c*w,e+r,t+c*w,e+r,w,w,d,t,e+r-l*w)}else f=ji(rO||(rO=fl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},cO={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},MJ=t=>{var e=ta(t,cO),n=R.useRef(null),r=R.useState(-1),i=xJ(r,2),s=i[0],o=i[1];R.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var B=n.current.getTotalLength();B&&o(B)}catch{}},[]);var a=e.x,l=e.y,c=e.width,d=e.height,f=e.radius,m=e.className,y=e.animationEasing,x=e.animationDuration,S=e.animationBegin,_=e.isAnimationActive,w=e.isUpdateAnimationActive,E=R.useRef(c),T=R.useRef(d),C=R.useRef(a),O=R.useRef(l),N=R.useMemo(()=>({x:a,y:l,width:c,height:d,radius:f}),[a,l,c,d,f]),L=F4(N,"rectangle-");if(a!==+a||l!==+l||c!==+c||d!==+d||c===0||d===0)return null;var F=nr("recharts-rectangle",m);if(!w){var G=Zo(e);G.radius;var k=oO(G,hJ);return R.createElement("path",Aw({},k,{x:xd(a),y:xd(l),width:xd(c),height:xd(d),radius:typeof f=="number"?f:void 0,className:F,d:lO(a,l,c,d,f)}))}var U=E.current,H=T.current,ne=C.current,ee=O.current,pe="0px ".concat(s===-1?1:s,"px"),se="".concat(s,"px ").concat(s,"px"),fe=fJ(["strokeDasharray"],x,typeof y=="string"?y:cO.animationEasing);return R.createElement(U4,{animationId:L,key:L,canBegin:s>0,duration:x,easing:y,isActive:w,begin:S},B=>{var Q=Fc(U,c,B),K=Fc(H,d,B),V=Fc(ne,a,B),q=Fc(ee,l,B);n.current&&(E.current=Q,T.current=K,C.current=V,O.current=q);var he;_?B>0?he={transition:fe,strokeDasharray:se}:he={strokeDasharray:pe}:he={strokeDasharray:se};var ae=Zo(e);ae.radius;var ce=oO(ae,pJ);return R.createElement("path",Aw({},ce,{radius:typeof f=="number"?f:void 0,className:F,d:lO(V,q,Q,K,f),ref:n,style:sO(sO({},he),e.style)}))})};function uO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function dO(t){for(var e=1;et*180/Math.PI,Bi=(t,e,n,r)=>({x:t+Math.cos(-Tw*r)*n,y:e+Math.sin(-Tw*r)*n}),PJ=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},RJ=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},NJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,o=RJ({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var a=(n-i)/o,l=Math.acos(a);return r>s&&(l=2*Math.PI-l),{radius:o,angle:CJ(l),angleInRadian:l}},IJ=t=>{var e=t.startAngle,n=t.endAngle,r=Math.floor(e/360),i=Math.floor(n/360),s=Math.min(r,i);return{startAngle:e-s*360,endAngle:n-s*360}},kJ=(t,e)=>{var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return t+o*360},OJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=NJ({x:n,y:r},e),s=i.radius,o=i.angle,a=e.innerRadius,l=e.outerRadius;if(sl||s===0)return null;var c=IJ(e),d=c.startAngle,f=c.endAngle,m=o,y;if(d<=f){for(;m>f;)m-=360;for(;m=d&&m<=f}else{for(;m>d;)m-=360;for(;m=f&&m<=d}return y?dO(dO({},e),{},{radius:s,angle:kJ(m,e)}):null};function z4(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,o=Bi(e,n,r,i),a=Bi(e,n,r,s);return{points:[o,a],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}var fO,hO,pO,mO,gO,vO,yO;function wC(){return wC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=Xo(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Pb=t=>{var e=t.cx,n=t.cy,r=t.radius,i=t.angle,s=t.sign,o=t.isExternal,a=t.cornerRadius,l=t.cornerIsExternal,c=a*(o?1:-1)+r,d=Math.asin(a/c)/Tw,f=l?i:i+s*d,m=Bi(e,n,c,f),y=Bi(e,n,r,f),x=l?i-s*d:i,S=Bi(e,n,c*Math.cos(d*Tw),x);return{center:m,circleTangency:y,lineTangency:S,theta:d}},B4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,o=t.endAngle,a=LJ(s,o),l=s+a,c=Bi(e,n,i,s),d=Bi(e,n,i,l),f=ji(fO||(fO=th(["M ",",",` + A `,",",",0,0,",",",","," Z"])),t,e+l*b,b,b,d,t+c*b,e,t+n-c*b,e,b,b,d,t+n,e+l*b,t+n,e+r-l*b,b,b,d,t+n-c*b,e+r,t+c*b,e+r,b,b,d,t,e+r-l*b)}else f=Ui(oO||(oO=fl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},fO={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},IJ=t=>{var e=na(t,fO),n=P.useRef(null),r=P.useState(-1),i=TJ(r,2),s=i[0],o=i[1];P.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var B=n.current.getTotalLength();B&&o(B)}catch{}},[]);var a=e.x,l=e.y,c=e.width,d=e.height,f=e.radius,g=e.className,y=e.animationEasing,x=e.animationDuration,S=e.animationBegin,w=e.isAnimationActive,b=e.isUpdateAnimationActive,M=P.useRef(c),T=P.useRef(d),C=P.useRef(a),O=P.useRef(l),N=P.useMemo(()=>({x:a,y:l,width:c,height:d,radius:f}),[a,l,c,d,f]),L=V4(N,"rectangle-");if(a!==+a||l!==+l||c!==+c||d!==+d||c===0||d===0)return null;var F=ir("recharts-rectangle",g);if(!b){var G=Qo(e);G.radius;var k=cO(G,_J);return P.createElement("path",Tw({},k,{x:xd(a),y:xd(l),width:xd(c),height:xd(d),radius:typeof f=="number"?f:void 0,className:F,d:dO(a,l,c,d,f)}))}var U=M.current,H=T.current,te=C.current,ee=O.current,pe="0px ".concat(s===-1?1:s,"px"),ie="".concat(s,"px ").concat(s,"px"),fe=bJ(["strokeDasharray"],x,typeof y=="string"?y:fO.animationEasing);return P.createElement(H4,{animationId:L,key:L,canBegin:s>0,duration:x,easing:y,isActive:b,begin:S},B=>{var Q=Fc(U,c,B),K=Fc(H,d,B),V=Fc(te,a,B),q=Fc(ee,l,B);n.current&&(M.current=Q,T.current=K,C.current=V,O.current=q);var he;w?B>0?he={transition:fe,strokeDasharray:ie}:he={strokeDasharray:pe}:he={strokeDasharray:ie};var ae=Qo(e);ae.radius;var ce=cO(ae,wJ);return P.createElement("path",Tw({},ce,{radius:typeof f=="number"?f:void 0,className:F,d:dO(V,q,Q,K,f),ref:n,style:lO(lO({},he),e.style)}))})};function hO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pO(t){for(var e=1;et*180/Math.PI,Hi=(t,e,n,r)=>({x:t+Math.cos(-Cw*r)*n,y:e+Math.sin(-Cw*r)*n}),jJ=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},UJ=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},FJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,o=UJ({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var a=(n-i)/o,l=Math.acos(a);return r>s&&(l=2*Math.PI-l),{radius:o,angle:DJ(l),angleInRadian:l}},zJ=t=>{var e=t.startAngle,n=t.endAngle,r=Math.floor(e/360),i=Math.floor(n/360),s=Math.min(r,i);return{startAngle:e-s*360,endAngle:n-s*360}},BJ=(t,e)=>{var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return t+o*360},HJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=FJ({x:n,y:r},e),s=i.radius,o=i.angle,a=e.innerRadius,l=e.outerRadius;if(sl||s===0)return null;var c=zJ(e),d=c.startAngle,f=c.endAngle,g=o,y;if(d<=f){for(;g>f;)g-=360;for(;g=d&&g<=f}else{for(;g>d;)g-=360;for(;g=f&&g<=d}return y?pO(pO({},e),{},{radius:s,angle:BJ(g,e)}):null};function G4(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,o=Hi(e,n,r,i),a=Hi(e,n,r,s);return{points:[o,a],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}var mO,gO,vO,yO,xO,bO,_O;function AC(){return AC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=qo(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Pb=t=>{var e=t.cx,n=t.cy,r=t.radius,i=t.angle,s=t.sign,o=t.isExternal,a=t.cornerRadius,l=t.cornerIsExternal,c=a*(o?1:-1)+r,d=Math.asin(a/c)/Cw,f=l?i:i+s*d,g=Hi(e,n,c,f),y=Hi(e,n,r,f),x=l?i-s*d:i,S=Hi(e,n,c*Math.cos(d*Cw),x);return{center:g,circleTangency:y,lineTangency:S,theta:d}},W4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,o=t.endAngle,a=VJ(s,o),l=s+a,c=Hi(e,n,i,s),d=Hi(e,n,i,l),f=Ui(mO||(mO=nh(["M ",",",` A `,",",`,0, `,",",`, `,",",` - `])),c.x,c.y,i,i,+(Math.abs(a)>180),+(s>l),d.x,d.y);if(r>0){var m=Bi(e,n,r,s),y=Bi(e,n,r,l);f+=ji(hO||(hO=th(["L ",",",` + `])),c.x,c.y,i,i,+(Math.abs(a)>180),+(s>l),d.x,d.y);if(r>0){var g=Hi(e,n,r,s),y=Hi(e,n,r,l);f+=Ui(gO||(gO=nh(["L ",",",` A `,",",`,0, `,",",`, - `,","," Z"])),y.x,y.y,r,r,+(Math.abs(a)>180),+(s<=l),m.x,m.y)}else f+=ji(pO||(pO=th(["L ",","," Z"])),e,n);return f},DJ=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,o=t.forceCornerRadius,a=t.cornerIsExternal,l=t.startAngle,c=t.endAngle,d=Xo(c-l),f=Pb({cx:e,cy:n,radius:i,angle:l,sign:d,cornerRadius:s,cornerIsExternal:a}),m=f.circleTangency,y=f.lineTangency,x=f.theta,S=Pb({cx:e,cy:n,radius:i,angle:c,sign:-d,cornerRadius:s,cornerIsExternal:a}),_=S.circleTangency,w=S.lineTangency,E=S.theta,T=a?Math.abs(l-c):Math.abs(l-c)-x-E;if(T<0)return o?ji(mO||(mO=th(["M ",",",` + `,","," Z"])),y.x,y.y,r,r,+(Math.abs(a)>180),+(s<=l),g.x,g.y)}else f+=Ui(vO||(vO=nh(["L ",","," Z"])),e,n);return f},GJ=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,o=t.forceCornerRadius,a=t.cornerIsExternal,l=t.startAngle,c=t.endAngle,d=qo(c-l),f=Pb({cx:e,cy:n,radius:i,angle:l,sign:d,cornerRadius:s,cornerIsExternal:a}),g=f.circleTangency,y=f.lineTangency,x=f.theta,S=Pb({cx:e,cy:n,radius:i,angle:c,sign:-d,cornerRadius:s,cornerIsExternal:a}),w=S.circleTangency,b=S.lineTangency,M=S.theta,T=a?Math.abs(l-c):Math.abs(l-c)-x-M;if(T<0)return o?Ui(yO||(yO=nh(["M ",",",` a`,",",",0,0,1,",`,0 a`,",",",0,0,1,",`,0 - `])),y.x,y.y,s,s,s*2,s,s,-s*2):B4({cx:e,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var C=ji(gO||(gO=th(["M ",",",` + `])),y.x,y.y,s,s,s*2,s,s,-s*2):W4({cx:e,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var C=Ui(xO||(xO=nh(["M ",",",` A`,",",",0,0,",",",",",` A`,",",",0,",",",",",",",` A`,",",",0,0,",",",",",` - `])),y.x,y.y,s,s,+(d<0),m.x,m.y,i,i,+(T>180),+(d<0),_.x,_.y,s,s,+(d<0),w.x,w.y);if(r>0){var O=Pb({cx:e,cy:n,radius:r,angle:l,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),N=O.circleTangency,L=O.lineTangency,F=O.theta,G=Pb({cx:e,cy:n,radius:r,angle:c,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),k=G.circleTangency,U=G.lineTangency,H=G.theta,ne=a?Math.abs(l-c):Math.abs(l-c)-F-H;if(ne<0&&s===0)return"".concat(C,"L").concat(e,",").concat(n,"Z");C+=ji(vO||(vO=th(["L",",",` + `])),y.x,y.y,s,s,+(d<0),g.x,g.y,i,i,+(T>180),+(d<0),w.x,w.y,s,s,+(d<0),b.x,b.y);if(r>0){var O=Pb({cx:e,cy:n,radius:r,angle:l,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),N=O.circleTangency,L=O.lineTangency,F=O.theta,G=Pb({cx:e,cy:n,radius:r,angle:c,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),k=G.circleTangency,U=G.lineTangency,H=G.theta,te=a?Math.abs(l-c):Math.abs(l-c)-F-H;if(te<0&&s===0)return"".concat(C,"L").concat(e,",").concat(n,"Z");C+=Ui(bO||(bO=nh(["L",",",` A`,",",",0,0,",",",",",` A`,",",",0,",",",",",",",` - A`,",",",0,0,",",",",","Z"])),U.x,U.y,s,s,+(d<0),k.x,k.y,r,r,+(ne>180),+(d>0),N.x,N.y,s,s,+(d<0),L.x,L.y)}else C+=ji(yO||(yO=th(["L",",","Z"])),e,n);return C},jJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},UJ=t=>{var e=ta(t,jJ),n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,o=e.cornerRadius,a=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,d=e.endAngle,f=e.className;if(s0&&Math.abs(c-d)<360?S=DJ({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:a,cornerIsExternal:l,startAngle:c,endAngle:d}):S=B4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),R.createElement("path",wC({},Zo(e),{className:m,d:S}))};function FJ(t,e,n){if(t==="horizontal")return[{x:e.x,y:n.top},{x:e.x,y:n.top+n.height}];if(t==="vertical")return[{x:n.left,y:e.y},{x:n.left+n.width,y:e.y}];if(w5(e)){if(t==="centric"){var r=e.cx,i=e.cy,s=e.innerRadius,o=e.outerRadius,a=e.angle,l=Bi(r,i,s,a),c=Bi(r,i,o,a);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return z4(e)}}function zJ(t){return D5(t)?NaN:Number(t)}function NE(t){return t?(t=zJ(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function H4(t,e,n){n&&typeof n!="number"&&nC(t,e,n)&&(e=n=void 0),t=NE(t),e===void 0?(e=t,t=0):e=NE(e),n=n===void 0?tt.chartData,ZP=Ie([Xa],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),wS=(t,e,n,r)=>r?ZP(t):Xa(t),BJ=(t,e,n)=>n?ZP(t):Xa(t),HJ=Ie([wS],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});Ie([ZP],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var VJ=Ie([Xa],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function QP(t,e){return XJ(t)||$J(t,e)||WJ(t,e)||GJ()}function GJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WJ(t,e){if(t){if(typeof t=="string")return xO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xO(t,e):void 0}}function xO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.e^s.s<0?1:-1;for(r=s.d.length,i=t.d.length,e=0,n=rt.d[e]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};Nt.decimalPlaces=Nt.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*lr;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Nt.dividedBy=Nt.div=function(t){return Gc(this,new this.constructor(t))};Nt.dividedToIntegerBy=Nt.idiv=function(t){var e=this,n=e.constructor;return Qn(Gc(e,new n(t),0,1),n.precision)};Nt.equals=Nt.eq=function(t){return!this.cmp(t)};Nt.exponent=function(){return Wr(this)};Nt.greaterThan=Nt.gt=function(t){return this.cmp(t)>0};Nt.greaterThanOrEqualTo=Nt.gte=function(t){return this.cmp(t)>=0};Nt.isInteger=Nt.isint=function(){return this.e>this.d.length-2};Nt.isNegative=Nt.isneg=function(){return this.s<0};Nt.isPositive=Nt.ispos=function(){return this.s>0};Nt.isZero=function(){return this.s===0};Nt.lessThan=Nt.lt=function(t){return this.cmp(t)<0};Nt.lessThanOrEqualTo=Nt.lte=function(t){return this.cmp(t)<1};Nt.logarithm=Nt.log=function(t){var e,n=this,r=n.constructor,i=r.precision,s=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(xo))throw Error(Jo+"NaN");if(n.s<1)throw Error(Jo+(n.s?"NaN":"-Infinity"));return n.eq(xo)?new r(0):(fr=!1,e=Gc(vy(n,s),vy(t,s),s),fr=!0,Qn(e,i))};Nt.minus=Nt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?X4(e,t):W4(e,(t.s=-t.s,t))};Nt.modulo=Nt.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(Jo+"NaN");return n.s?(fr=!1,e=Gc(n,t,0,1).times(t),fr=!0,n.minus(e)):Qn(new r(n),i)};Nt.naturalExponential=Nt.exp=function(){return $4(this)};Nt.naturalLogarithm=Nt.ln=function(){return vy(this)};Nt.negated=Nt.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Nt.plus=Nt.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?W4(e,t):X4(e,(t.s=-t.s,t))};Nt.precision=Nt.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(wh+t);if(e=Wr(i)+1,r=i.d.length-1,n=r*lr+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};Nt.squareRoot=Nt.sqrt=function(){var t,e,n,r,i,s,o,a=this,l=a.constructor;if(a.s<1){if(!a.s)return new l(0);throw Error(Jo+"NaN")}for(t=Wr(a),fr=!1,i=Math.sqrt(+a),i==0||i==1/0?(e=Sl(a.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=$g((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=o=n+3;;)if(s=r,r=s.plus(Gc(a,s,o+2)).times(.5),Sl(s.d).slice(0,o)===(e=Sl(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(Qn(s,n+1,0),s.times(s).eq(a)){r=s;break}}else if(e!="9999")break;o+=4}return fr=!0,Qn(r,n)};Nt.times=Nt.mul=function(t){var e,n,r,i,s,o,a,l,c,d=this,f=d.constructor,m=d.d,y=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=m.length,c=y.length,l=0;){for(e=0,i=l+r;i>r;)a=s[i]+y[r]*m[i-r-1]+e,s[i--]=a%xi|0,e=a/xi|0;s[i]=(s[i]+e)%xi|0}for(;!s[--o];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,fr?Qn(t,f.precision):t};Nt.toDecimalPlaces=Nt.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Dl(t,0,Wg),e===void 0?e=r.rounding:Dl(e,0,8),Qn(n,t+Wr(n)+1,e))};Nt.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Lh(r,!0):(Dl(t,0,Wg),e===void 0?e=i.rounding:Dl(e,0,8),r=Qn(new i(r),t+1,e),n=Lh(r,!0,t+1)),n};Nt.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Lh(i):(Dl(t,0,Wg),e===void 0?e=s.rounding:Dl(e,0,8),r=Qn(new s(i),t+Wr(i)+1,e),n=Lh(r.abs(),!1,t+Wr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Nt.toInteger=Nt.toint=function(){var t=this,e=t.constructor;return Qn(new e(t),Wr(t)+1,e.rounding)};Nt.toNumber=function(){return+this};Nt.toPower=Nt.pow=function(t){var e,n,r,i,s,o,a=this,l=a.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(xo);if(a=new l(a),!a.s){if(t.s<1)throw Error(Jo+"Infinity");return a}if(a.eq(xo))return a;if(r=l.precision,t.eq(xo))return Qn(a,r);if(e=t.e,n=t.d.length-1,o=e>=n,s=a.s,o){if((n=d<0?-d:d)<=G4){for(i=new l(xo),e=Math.ceil(r/lr+4),fr=!1;n%2&&(i=i.times(a),wO(i.d,e)),n=$g(n/2),n!==0;)a=a.times(a),wO(a.d,e);return fr=!0,t.s<0?new l(xo).div(i):Qn(i,r)}}else if(s<0)throw Error(Jo+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,a.s=1,fr=!1,i=t.times(vy(a,r+c)),fr=!0,i=$4(i),i.s=s,i};Nt.toPrecision=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?(n=Wr(i),r=Lh(i,n<=s.toExpNeg||n>=s.toExpPos)):(Dl(t,1,Wg),e===void 0?e=s.rounding:Dl(e,0,8),i=Qn(new s(i),t,e),n=Wr(i),r=Lh(i,t<=n||n<=s.toExpNeg,t)),r};Nt.toSignificantDigits=Nt.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Dl(t,1,Wg),e===void 0?e=r.rounding:Dl(e,0,8)),Qn(new r(n),t,e)};Nt.toString=Nt.valueOf=Nt.val=Nt.toJSON=Nt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Wr(t),n=t.constructor;return Lh(t,e<=n.toExpNeg||e>=n.toExpPos)};function W4(t,e){var n,r,i,s,o,a,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),fr?Qn(e,f):e;if(l=t.d,c=e.d,o=t.e,i=e.e,l=l.slice(),s=o-i,s){for(s<0?(r=l,s=-s,a=c.length):(r=c,i=o,a=l.length),o=Math.ceil(f/lr),a=o>a?o+1:a+1,s>a&&(s=a,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(a=l.length,s=c.length,a-s<0&&(s=a,r=c,c=l,l=r),n=0;s;)n=(l[--s]=l[s]+c[s]+n)/xi|0,l[s]%=xi;for(n&&(l.unshift(n),++i),a=l.length;l[--a]==0;)l.pop();return e.d=l,e.e=i,fr?Qn(e,f):e}function Dl(t,e,n){if(t!==~~t||tn)throw Error(wh+t)}function Sl(t){var e,n,r,i=t.length-1,s="",o=t[0];if(i>0){for(s+=o,e=1;eo?1:-1;else for(a=l=0;ai[a]?1:-1;break}return l}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var a,l,c,d,f,m,y,x,S,_,w,E,T,C,O,N,L,F,G=r.constructor,k=r.s==i.s?1:-1,U=r.d,H=i.d;if(!r.s)return new G(r);if(!i.s)throw Error(Jo+"Division by zero");for(l=r.e-i.e,L=H.length,O=U.length,y=new G(k),x=y.d=[],c=0;H[c]==(U[c]||0);)++c;if(H[c]>(U[c]||0)&&--l,s==null?E=s=G.precision:o?E=s+(Wr(r)-Wr(i))+1:E=s,E<0)return new G(0);if(E=E/lr+2|0,c=0,L==1)for(d=0,H=H[0],E++;(c1&&(H=t(H,d),U=t(U,d),L=H.length,O=U.length),C=L,S=U.slice(0,L),_=S.length;_=xi/2&&++N;do d=0,a=e(H,S,L,_),a<0?(w=S[0],L!=_&&(w=w*xi+(S[1]||0)),d=w/N|0,d>1?(d>=xi&&(d=xi-1),f=t(H,d),m=f.length,_=S.length,a=e(f,S,m,_),a==1&&(d--,n(f,L16)throw Error(JP+Wr(t));if(!t.s)return new d(xo);for(fr=!1,a=f,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),c+=5;for(r=Math.log($f(2,c))/Math.LN10*2+5|0,a+=r,n=i=s=new d(xo),d.precision=a;;){if(i=Qn(i.times(t),a),n=n.times(++l),o=s.plus(Gc(i,n,a)),Sl(o.d).slice(0,a)===Sl(s.d).slice(0,a)){for(;c--;)s=Qn(s.times(s),a);return d.precision=f,e==null?(fr=!0,Qn(s,f)):s}s=o}}function Wr(t){for(var e=t.e*lr,n=t.d[0];n>=10;n/=10)e++;return e}function IE(t,e,n){if(e>t.LN10.sd())throw fr=!0,n&&(t.precision=n),Error(Jo+"LN10 precision limit exceeded");return Qn(new t(t.LN10),e)}function ad(t){for(var e="";t--;)e+="0";return e}function vy(t,e){var n,r,i,s,o,a,l,c,d,f=1,m=10,y=t,x=y.d,S=y.constructor,_=S.precision;if(y.s<1)throw Error(Jo+(y.s?"NaN":"-Infinity"));if(y.eq(xo))return new S(0);if(e==null?(fr=!1,c=_):c=e,y.eq(10))return e==null&&(fr=!0),IE(S,c);if(c+=m,S.precision=c,n=Sl(x),r=n.charAt(0),s=Wr(y),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)y=y.times(t),n=Sl(y.d),r=n.charAt(0),f++;s=Wr(y),r>1?(y=new S("0."+n),s++):y=new S(r+"."+n.slice(1))}else return l=IE(S,c+2,_).times(s+""),y=vy(new S(r+"."+n.slice(1)),c-m).plus(l),S.precision=_,e==null?(fr=!0,Qn(y,_)):y;for(a=o=y=Gc(y.minus(xo),y.plus(xo),c),d=Qn(y.times(y),c),i=3;;){if(o=Qn(o.times(d),c),l=a.plus(Gc(o,new S(i),c)),Sl(l.d).slice(0,c)===Sl(a.d).slice(0,c))return a=a.times(2),s!==0&&(a=a.plus(IE(S,c+2,_).times(s+""))),a=Gc(a,new S(f),c),S.precision=_,e==null?(fr=!0,Qn(a,_)):a;a=l,i+=2}}function _O(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=$g(n/lr),t.d=[],r=(n+1)%lr,n<0&&(r+=lr),rCw||t.e<-Cw))throw Error(JP+n)}else t.s=0,t.e=0,t.d=[0];return t}function Qn(t,e,n){var r,i,s,o,a,l,c,d,f=t.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=e-o,r<0)r+=lr,i=e,c=f[d=0];else{if(d=Math.ceil((r+1)/lr),s=f.length,d>=s)return t;for(c=s=f[d],o=1;s>=10;s/=10)o++;r%=lr,i=r-lr+o}if(n!==void 0&&(s=$f(10,o-i-1),a=c/s%10|0,l=e<0||f[d+1]!==void 0||c%s,l=n<4?(a||l)&&(n==0||n==(t.s<0?3:2)):a>5||a==5&&(n==4||l||n==6&&(r>0?i>0?c/$f(10,o-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=Wr(t),f.length=1,e=e-s-1,f[0]=$f(10,(lr-e%lr)%lr),t.e=$g(-e/lr)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=$f(10,lr-r),f[d]=i>0?(c/$f(10,o-i)%$f(10,i)|0)*s:0),l)for(;;)if(d==0){(f[0]+=s)==xi&&(f[0]=1,++t.e);break}else{if(f[d]+=s,f[d]!=xi)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(fr&&(t.e>Cw||t.e<-Cw))throw Error(JP+Wr(t));return t}function X4(t,e){var n,r,i,s,o,a,l,c,d,f,m=t.constructor,y=m.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new m(t),fr?Qn(e,y):e;if(l=t.d,f=e.d,r=e.e,c=t.e,l=l.slice(),o=c-r,o){for(d=o<0,d?(n=l,o=-o,a=f.length):(n=f,r=c,a=l.length),i=Math.max(Math.ceil(y/lr),a)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=l.length,a=f.length,d=i0;--i)l[a++]=0;for(i=f.length;i>o;){if(l[--i]0?s=s.charAt(0)+"."+s.slice(1)+ad(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ad(-i-1)+s,n&&(r=n-o)>0&&(s+=ad(r))):i>=o?(s+=ad(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ad(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ad(r))),t.s<0?"-"+s:s}function wO(t,e){if(t.length>e)return t.length=e,!0}function q4(t){var e,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(wh+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return _O(o,s.toString())}else if(typeof s!="string")throw Error(wh+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,YJ.test(s))_O(o,s);else throw Error(wh+s)}if(i.prototype=Nt,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=q4,i.config=i.set=ZJ,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(wh+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(wh+n+": "+r);return this}var e2=q4(KJ);xo=new e2(1);const Rn=e2;function K4(t){var e;return t===0?e=1:e=Math.floor(new Rn(t).abs().log(10).toNumber())+1,e}function Y4(t,e,n){for(var r=new Rn(t),i=0,s=[];r.lt(e)&&i<1e5;)s.push(r.toNumber()),r=r.add(n),i++;return s}function yy(t,e){return tee(t)||eee(t,e)||JJ(t,e)||QJ()}function QJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JJ(t,e){if(t){if(typeof t=="string")return SO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?SO(t,e):void 0}}function SO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=yy(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]},t2=(t,e,n)=>{if(t.lte(0))return new Rn(0);var r=K4(t.toNumber()),i=new Rn(10).pow(r),s=t.div(i),o=r!==1?.05:.1,a=new Rn(Math.ceil(s.div(o).toNumber())).add(n).mul(o),l=a.mul(i);return e?new Rn(l.toNumber()):new Rn(Math.ceil(l.toNumber()))},Q4=(t,e,n)=>{var r;if(t.lte(0))return new Rn(0);var i=[1,2,2.5,5],s=t.toNumber(),o=Math.floor(new Rn(s).abs().log(10).toNumber()),a=new Rn(10).pow(o),l=t.div(a).toNumber(),c=i.findIndex(y=>y>=l-1e-10);if(c===-1&&(a=a.mul(10),c=0),c+=n,c>=i.length){var d=Math.floor(c/i.length);c%=i.length,a=a.mul(new Rn(10).pow(d))}var f=(r=i[c])!==null&&r!==void 0?r:1,m=new Rn(f).mul(a);return e?m:new Rn(Math.ceil(m.toNumber()))},nee=(t,e,n)=>{var r=new Rn(1),i=new Rn(t);if(!i.isint()&&n){var s=Math.abs(t);s<1?(r=new Rn(10).pow(K4(t)-1),i=new Rn(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Rn(Math.floor(t)))}else t===0?i=new Rn(Math.floor((e-1)/2)):n||(i=new Rn(Math.floor(t)));for(var o=Math.floor((e-1)/2),a=[],l=0;l4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:t2;if(!Number.isFinite((n-e)/(r-1)))return{step:new Rn(0),tickMin:new Rn(0),tickMax:new Rn(0)};var a=o(new Rn(n).sub(e).div(r-1),i,s),l;e<=0&&n>=0?l=new Rn(0):(l=new Rn(e).add(n).div(2),l=l.sub(new Rn(l).mod(a)));var c=Math.ceil(l.sub(e).div(a).toNumber()),d=Math.ceil(new Rn(n).sub(l).div(a).toNumber()),f=c+d+1;return f>r?J4(e,n,r,i,s+1,o):(f0?d+(r-f):d,c=n>0?c:c+(r-f)),{step:a,tickMin:l.sub(new Rn(c).mul(a)),tickMax:l.add(new Rn(d).mul(a))})},MO=function(e){var n=yy(e,2),r=n[0],i=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),c=Z4([r,i]),d=yy(c,2),f=d[0],m=d[1];if(f===-1/0||m===1/0){var y=m===1/0?[f,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),m];return r>i?y.reverse():y}if(f===m)return nee(f,s,o);var x=a==="snap125"?Q4:t2,S=J4(f,m,l,o,0,x),_=S.step,w=S.tickMin,E=S.tickMax,T=Y4(w,E.add(new Rn(.1).mul(_)),_);return r>i?T.reverse():T},EO=function(e,n){var r=yy(e,2),i=r[0],s=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Z4([i,s]),c=yy(l,2),d=c[0],f=c[1];if(d===-1/0||f===1/0)return[i,s];if(d===f)return[d];var m=a==="snap125"?Q4:t2,y=Math.max(n,2),x=m(new Rn(f).sub(d).div(y-1),o,0),S=[...Y4(new Rn(d),new Rn(f),x),f];return o===!1&&(S=S.map(_=>Math.round(_))),i>s?S.reverse():S},ree=t=>t.rootProps.barCategoryGap,SS=t=>t.rootProps.stackOffset,ez=t=>t.rootProps.reverseStackOrder,n2=t=>t.options.chartName,r2=t=>t.rootProps.syncId,tz=t=>t.rootProps.syncMethod,i2=t=>t.options.eventEmitter,iee=t=>t.rootProps.baseValue,As={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},wf={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},hl={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},MS=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function ES(t,e,n){if(n!=="auto")return n;if(t!=null)return Bl(t,e)?"category":"number"}function AO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Pw(t){for(var e=1;e{if(e!=null)return t.polarAxis.angleAxis[e]},s2=Ie([lee,E4],(t,e)=>{var n;if(t!=null)return t;var r=(n=ES(e,"angleAxis",TO.type))!==null&&n!==void 0?n:"category";return Pw(Pw({},TO),{},{type:r})}),cee=(t,e)=>t.polarAxis.radiusAxis[e],o2=Ie([cee,E4],(t,e)=>{var n;if(t!=null)return t;var r=(n=ES(e,"radiusAxis",CO.type))!==null&&n!==void 0?n:"category";return Pw(Pw({},CO),{},{type:r})}),AS=t=>t.polarOptions,a2=Ie([tu,nu,$i],PJ),nz=Ie([AS,a2],(t,e)=>{if(t!=null)return Ad(t.innerRadius,e,0)}),rz=Ie([AS,a2],(t,e)=>{if(t!=null)return Ad(t.outerRadius,e,e*.8)}),uee=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},iz=Ie([AS],uee);Ie([s2,iz],MS);var sz=Ie([a2,nz,rz],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});Ie([o2,sz],MS);var oz=Ie([pr,AS,nz,rz,tu,nu],(t,e,n,r,i,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var o=e.cx,a=e.cy,l=e.startAngle,c=e.endAngle;return{cx:Ad(o,i,i/2),cy:Ad(a,s,s/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),wi=(t,e)=>e,TS=(t,e,n)=>n;function l2(t){return t==null?void 0:t.id}function az(t,e,n){var r=e.chartData,i=r===void 0?[]:r,s=n.allowDuplicatedCategory,o=n.dataKey,a=new Map;return t.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:i;if(!(d==null||d.length===0)){var f=l2(l);d.forEach((m,y)=>{var x=o==null||s?y:String(bi(m,o,null)),S=bi(m,l.dataKey,0),_;a.has(x)?_=a.get(x):_={},Object.assign(_,{[f]:S}),a.set(x,_)})}}),Array.from(a.values())}function c2(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var CS=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function PS(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function dee(t,e){if(t.length===e.length){for(var n=0;n{var e=pr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Xg=t=>t.tooltip.settings.axisId;function u2(t){if(t!=null){var e=t.ticks,n=t.bandwidth,r=t.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>t.domain(),range:(function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],a=i[1];return o<=a?s>=o&&s<=a:s>=a&&s<=o},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,o)=>{var a=t(s);if(a!=null){if(t.bandwidth&&o!==null&&o!==void 0&&o.position){var l=t.bandwidth();switch(o.position){case"middle":a+=l/2;break;case"end":a+=l;break}}return a}}}}}var fee=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!Tl(e)){for(var n,r,i=0;ir)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return e}default:return e}};function wd(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function hee(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function d2(t){let e,n,r;t.length!==2?(e=wd,n=(a,l)=>wd(t(a),l),r=(a,l)=>t(a)-l):(e=t===wd||t===hee?t:pee,n=t,r=t);function i(a,l,c=0,d=a.length){if(c>>1;n(a[f],l)<0?c=f+1:d=f}while(c>>1;n(a[f],l)<=0?c=f+1:d=f}while(cc&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function pee(){return 0}function lz(t){return t===null?NaN:+t}function*mee(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const gee=d2(wd),Jy=gee.right;d2(lz).center;class PO extends Map{constructor(e,n=xee){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(RO(this,e))}has(e){return super.has(RO(this,e))}set(e,n){return super.set(vee(this,e),n)}delete(e){return super.delete(yee(this,e))}}function RO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function vee({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function yee({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function xee(t){return t!==null&&typeof t=="object"?t.valueOf():t}function bee(t=wd){if(t===wd)return cz;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function cz(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const _ee=Math.sqrt(50),wee=Math.sqrt(10),See=Math.sqrt(2);function Rw(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=_ee?10:s>=wee?5:s>=See?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/o,a=Math.round(t*c),l=Math.round(e*c),a/ce&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(t/c),l=Math.round(e/c),a*ce&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let c=0;c=r)&&(n=r);return n}function IO(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function uz(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?cz:bee(i);r>n;){if(r-n>600){const l=r-n+1,c=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),y=Math.max(n,Math.floor(e-c*f/l+m)),x=Math.min(r,Math.floor(e+(l-c)*f/l+m));uz(t,e,y,x,i)}const s=t[e];let o=n,a=r;for(u0(t,n,e),i(t[r],s)>0&&u0(t,n,r);o0;)--a}i(t[n],s)===0?u0(t,n,a):(++a,u0(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function u0(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Mee(t,e,n){if(t=Float64Array.from(mee(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return IO(t);if(e>=1)return NO(t);var r,i=(r-1)*e,s=Math.floor(i),o=NO(uz(t,s).subarray(0,s+1)),a=IO(t.subarray(s+1));return o+(a-o)*(i-s)}}function Eee(t,e,n=lz){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,s=Math.floor(i),o=+n(t[s],s,t),a=+n(t[s+1],s+1,t);return o+(a-o)*(i-s)}}function Aee(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,s=new Array(i);++r>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Rb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Rb(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Pee.exec(t))?new Qs(e[1],e[2],e[3],1):(e=Ree.exec(t))?new Qs(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Nee.exec(t))?Rb(e[1],e[2],e[3],e[4]):(e=Iee.exec(t))?Rb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=kee.exec(t))?FO(e[1],e[2]/100,e[3]/100,1):(e=Oee.exec(t))?FO(e[1],e[2]/100,e[3]/100,e[4]):kO.hasOwnProperty(t)?DO(kO[t]):t==="transparent"?new Qs(NaN,NaN,NaN,0):null}function DO(t){return new Qs(t>>16&255,t>>8&255,t&255,1)}function Rb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Qs(t,e,n,r)}function jee(t){return t instanceof ex||(t=_y(t)),t?(t=t.rgb(),new Qs(t.r,t.g,t.b,t.opacity)):new Qs}function TC(t,e,n,r){return arguments.length===1?jee(t):new Qs(t,e,n,r??1)}function Qs(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}p2(Qs,TC,fz(ex,{brighter(t){return t=t==null?Nw:Math.pow(Nw,t),new Qs(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?xy:Math.pow(xy,t),new Qs(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Qs(Sh(this.r),Sh(this.g),Sh(this.b),Iw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:jO,formatHex:jO,formatHex8:Uee,formatRgb:UO,toString:UO}));function jO(){return`#${nh(this.r)}${nh(this.g)}${nh(this.b)}`}function Uee(){return`#${nh(this.r)}${nh(this.g)}${nh(this.b)}${nh((isNaN(this.opacity)?1:this.opacity)*255)}`}function UO(){const t=Iw(this.opacity);return`${t===1?"rgb(":"rgba("}${Sh(this.r)}, ${Sh(this.g)}, ${Sh(this.b)}${t===1?")":`, ${t})`}`}function Iw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Sh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function nh(t){return t=Sh(t),(t<16?"0":"")+t.toString(16)}function FO(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new za(t,e,n,r)}function hz(t){if(t instanceof za)return new za(t.h,t.s,t.l,t.opacity);if(t instanceof ex||(t=_y(t)),!t)return new za;if(t instanceof za)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n0&&l<1?0:o,new za(o,a,l,t.opacity)}function Fee(t,e,n,r){return arguments.length===1?hz(t):new za(t,e,n,r??1)}function za(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}p2(za,Fee,fz(ex,{brighter(t){return t=t==null?Nw:Math.pow(Nw,t),new za(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?xy:Math.pow(xy,t),new za(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Qs(kE(t>=240?t-240:t+120,i,r),kE(t,i,r),kE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new za(zO(this.h),Nb(this.s),Nb(this.l),Iw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Iw(this.opacity);return`${t===1?"hsl(":"hsla("}${zO(this.h)}, ${Nb(this.s)*100}%, ${Nb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function zO(t){return t=(t||0)%360,t<0?t+360:t}function Nb(t){return Math.max(0,Math.min(1,t||0))}function kE(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const m2=t=>()=>t;function zee(t,e){return function(n){return t+n*e}}function Bee(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Hee(t){return(t=+t)==1?pz:function(e,n){return n-e?Bee(e,n,t):m2(isNaN(e)?n:e)}}function pz(t,e){var n=e-t;return n?zee(t,n):m2(isNaN(t)?e:t)}const BO=(function t(e){var n=Hee(e);function r(i,s){var o=n((i=TC(i)).r,(s=TC(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=pz(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=a(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=t,r})(1);function Vee(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;in&&(s=e.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:kw(r,i)})),n=OE.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function ete(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i2?tte:ete,l=c=null,f}function f(m){return m==null||isNaN(m=+m)?s:(l||(l=a(t.map(r),e,n)))(r(o(m)))}return f.invert=function(m){return o(i((c||(c=a(e,t.map(r),kw)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,Ow),d()):t.slice()},f.range=function(m){return arguments.length?(e=Array.from(m),d()):e.slice()},f.rangeRound=function(m){return e=Array.from(m),n=g2,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Ts,d()):o!==Ts},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(s=m,f):s},function(m,y){return r=m,i=y,d()}}function v2(){return RS()(Ts,Ts)}function nte(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Lw(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Tg(t){return t=Lw(Math.abs(t)),t?t[1]:NaN}function rte(t,e){return function(n,r){for(var i=n.length,s=[],o=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=t[o=(o+1)%t.length];return s.reverse().join(e)}}function ite(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var ste=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wy(t){if(!(e=ste.exec(t)))throw new Error("invalid format: "+t);var e;return new y2({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}wy.prototype=y2.prototype;function y2(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}y2.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function ote(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Dw;function ate(t,e){var n=Lw(t,e);if(!n)return Dw=void 0,t.toPrecision(e);var r=n[0],i=n[1],s=i-(Dw=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Lw(t,Math.max(0,e+s-1))[0]}function VO(t,e){var n=Lw(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const GO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:nte,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>VO(t*100,e),r:VO,s:ate,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function WO(t){return t}var $O=Array.prototype.map,XO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function lte(t){var e=t.grouping===void 0||t.thousands===void 0?WO:rte($O.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?WO:ite($O.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f,m){f=wy(f);var y=f.fill,x=f.align,S=f.sign,_=f.symbol,w=f.zero,E=f.width,T=f.comma,C=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):GO[N]||(C===void 0&&(C=12),O=!0,N="g"),(w||y==="0"&&x==="=")&&(w=!0,y="0",x="=");var L=(m&&m.prefix!==void 0?m.prefix:"")+(_==="$"?n:_==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),F=(_==="$"?r:/[%p]/.test(N)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),G=GO[N],k=/[defgprs%]/.test(N);C=C===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function U(H){var ne=L,ee=F,pe,se,fe;if(N==="c")ee=G(H)+ee,H="";else{H=+H;var B=H<0||1/H<0;if(H=isNaN(H)?l:G(Math.abs(H),C),O&&(H=ote(H)),B&&+H==0&&S!=="+"&&(B=!1),ne=(B?S==="("?S:a:S==="-"||S==="("?"":S)+ne,ee=(N==="s"&&!isNaN(H)&&Dw!==void 0?XO[8+Dw/3]:"")+ee+(B&&S==="("?")":""),k){for(pe=-1,se=H.length;++pefe||fe>57){ee=(fe===46?i+H.slice(pe+1):H.slice(pe))+ee,H=H.slice(0,pe);break}}}T&&!w&&(H=e(H,1/0));var Q=ne.length+H.length+ee.length,K=Q>1)+ne+H+ee+K.slice(Q);break;default:H=K+ne+H+ee;break}return s(H)}return U.toString=function(){return f+""},U}function d(f,m){var y=Math.max(-8,Math.min(8,Math.floor(Tg(m)/3)))*3,x=Math.pow(10,-y),S=c((f=wy(f),f.type="f",f),{suffix:XO[8+y/3]});return function(_){return S(x*_)}}return{format:c,formatPrefix:d}}var Ib,x2,mz;cte({thousands:",",grouping:[3],currency:["$",""]});function cte(t){return Ib=lte(t),x2=Ib.format,mz=Ib.formatPrefix,Ib}function ute(t){return Math.max(0,-Tg(Math.abs(t)))}function dte(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Tg(e)/3)))*3-Tg(Math.abs(t)))}function fte(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Tg(e)-Tg(t))+1}function gz(t,e,n,r){var i=EC(t,e,n),s;switch(r=wy(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=dte(i,o))&&(r.precision=s),mz(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=fte(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=ute(i))&&(r.precision=s-(r.type==="%")*2);break}}return x2(r)}function Rd(t){var e=t.domain;return t.ticks=function(n){var r=e();return SC(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return gz(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,s=r.length-1,o=r[i],a=r[s],l,c,d=10;for(a0;){if(c=MC(o,a,n),c===l)return r[i]=o,r[s]=a,e(r);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return t},t}function vz(){var t=v2();return t.copy=function(){return tx(t,vz())},na.apply(t,arguments),Rd(t)}function yz(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Ow),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return yz(t).unknown(e)},t=arguments.length?Array.from(t,Ow):[0,1],Rd(n)}function xz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return sMath.pow(t,e)}function vte(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function YO(t){return(e,n)=>-t(-e,n)}function b2(t){const e=t(qO,KO),n=e.domain;let r=10,i,s;function o(){return i=vte(r),s=gte(r),n()[0]<0?(i=YO(i),s=YO(s),t(hte,pte)):t(qO,KO),e}return e.base=function(a){return arguments.length?(r=+a,o()):r},e.domain=function(a){return arguments.length?(n(a),o()):n()},e.ticks=a=>{const l=n();let c=l[0],d=l[l.length-1];const f=d0){for(;m<=y;++m)for(x=1;xd)break;w.push(S)}}else for(;m<=y;++m)for(x=r-1;x>=1;--x)if(S=m>0?x/s(-m):x*s(m),!(Sd)break;w.push(S)}w.length*2<_&&(w=SC(c,d,_))}else w=SC(m,y,Math.min(y-m,_)).map(s);return f?w.reverse():w},e.tickFormat=(a,l)=>{if(a==null&&(a=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=wy(l)).precision==null&&(l.trim=!0),l=x2(l)),a===1/0)return l;const c=Math.max(1,r*a/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(xz(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),e}function bz(){const t=b2(RS()).domain([1,10]);return t.copy=()=>tx(t,bz()).base(t.base()),na.apply(t,arguments),t}function ZO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function QO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function _2(t){var e=1,n=t(ZO(e),QO(e));return n.constant=function(r){return arguments.length?t(ZO(e=+r),QO(e)):e},Rd(n)}function _z(){var t=_2(RS());return t.copy=function(){return tx(t,_z()).constant(t.constant())},na.apply(t,arguments)}function JO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function yte(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function xte(t){return t<0?-t*t:t*t}function w2(t){var e=t(Ts,Ts),n=1;function r(){return n===1?t(Ts,Ts):n===.5?t(yte,xte):t(JO(n),JO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Rd(e)}function S2(){var t=w2(RS());return t.copy=function(){return tx(t,S2()).exponent(t.exponent())},na.apply(t,arguments),t}function bte(){return S2.apply(null,arguments).exponent(.5)}function eL(t){return Math.sign(t)*t*t}function _te(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function wz(){var t=v2(),e=[0,1],n=!1,r;function i(s){var o=_te(t(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return t.invert(eL(s))},i.domain=function(s){return arguments.length?(t.domain(s),i):t.domain()},i.range=function(s){return arguments.length?(t.range((e=Array.from(s,Ow)).map(eL)),i):e.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(t.clamp(s),i):t.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return wz(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},na.apply(i,arguments),Rd(i)}function Sz(){var t=[],e=[],n=[],r;function i(){var o=0,a=Math.max(1,e.length);for(n=new Array(a-1);++o0?n[a-1]:t[0],a=n?[r[n-1],e]:[r[c-1],r[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Mz().domain([t,e]).range(i).unknown(s)},na.apply(Rd(o),arguments)}function Ez(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[Jy(t,s,0,r)]:n}return i.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var o=e.indexOf(s);return[t[o-1],t[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return Ez().domain(t).range(e).unknown(n)},na.apply(i,arguments)}const LE=new Date,DE=new Date;function li(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const o=i(s),a=i.ceil(s);return s-o(e(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,a)=>{const l=[];if(s=i.ceil(s),a=a==null?1:Math.floor(a),!(s0))return l;let c;do l.push(c=new Date(+s)),e(s,a),t(s);while(cli(o=>{if(o>=o)for(;t(o),!s(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;e(o,-1),!s(o););else for(;--a>=0;)for(;e(o,1),!s(o););}),n&&(i.count=(s,o)=>(LE.setTime(+s),DE.setTime(+o),t(LE),t(DE),Math.floor(n(LE,DE))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const jw=li(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);jw.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?li(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):jw);jw.range;const zc=1e3,Ko=zc*60,Bc=Ko*60,Yc=Bc*24,M2=Yc*7,tL=Yc*30,jE=Yc*365,rh=li(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*zc)},(t,e)=>(e-t)/zc,t=>t.getUTCSeconds());rh.range;const E2=li(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zc)},(t,e)=>{t.setTime(+t+e*Ko)},(t,e)=>(e-t)/Ko,t=>t.getMinutes());E2.range;const A2=li(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Ko)},(t,e)=>(e-t)/Ko,t=>t.getUTCMinutes());A2.range;const T2=li(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zc-t.getMinutes()*Ko)},(t,e)=>{t.setTime(+t+e*Bc)},(t,e)=>(e-t)/Bc,t=>t.getHours());T2.range;const C2=li(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Bc)},(t,e)=>(e-t)/Bc,t=>t.getUTCHours());C2.range;const nx=li(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Ko)/Yc,t=>t.getDate()-1);nx.range;const NS=li(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>t.getUTCDate()-1);NS.range;const Az=li(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>Math.floor(t/Yc));Az.range;function Zh(t){return li(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Ko)/M2)}const IS=Zh(0),Uw=Zh(1),wte=Zh(2),Ste=Zh(3),Cg=Zh(4),Mte=Zh(5),Ete=Zh(6);IS.range;Uw.range;wte.range;Ste.range;Cg.range;Mte.range;Ete.range;function Qh(t){return li(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/M2)}const kS=Qh(0),Fw=Qh(1),Ate=Qh(2),Tte=Qh(3),Pg=Qh(4),Cte=Qh(5),Pte=Qh(6);kS.range;Fw.range;Ate.range;Tte.range;Pg.range;Cte.range;Pte.range;const P2=li(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());P2.range;const R2=li(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());R2.range;const Zc=li(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Zc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:li(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Zc.range;const Qc=li(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Qc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:li(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Qc.range;function Tz(t,e,n,r,i,s){const o=[[rh,1,zc],[rh,5,5*zc],[rh,15,15*zc],[rh,30,30*zc],[s,1,Ko],[s,5,5*Ko],[s,15,15*Ko],[s,30,30*Ko],[i,1,Bc],[i,3,3*Bc],[i,6,6*Bc],[i,12,12*Bc],[r,1,Yc],[r,2,2*Yc],[n,1,M2],[e,1,tL],[e,3,3*tL],[t,1,jE]];function a(c,d,f){const m=d_).right(o,m);if(y===o.length)return t.every(EC(c/jE,d/jE,f));if(y===0)return jw.every(Math.max(EC(c,d,f),1));const[x,S]=o[m/o[y-1][2]53)return null;"w"in ue||(ue.w=1),"Z"in ue?(Ge=FE(d0(ue.y,0,1)),Oe=Ge.getUTCDay(),Ge=Oe>4||Oe===0?Fw.ceil(Ge):Fw(Ge),Ge=NS.offset(Ge,(ue.V-1)*7),ue.y=Ge.getUTCFullYear(),ue.m=Ge.getUTCMonth(),ue.d=Ge.getUTCDate()+(ue.w+6)%7):(Ge=UE(d0(ue.y,0,1)),Oe=Ge.getDay(),Ge=Oe>4||Oe===0?Uw.ceil(Ge):Uw(Ge),Ge=nx.offset(Ge,(ue.V-1)*7),ue.y=Ge.getFullYear(),ue.m=Ge.getMonth(),ue.d=Ge.getDate()+(ue.w+6)%7)}else("W"in ue||"U"in ue)&&("w"in ue||(ue.w="u"in ue?ue.u%7:"W"in ue?1:0),Oe="Z"in ue?FE(d0(ue.y,0,1)).getUTCDay():UE(d0(ue.y,0,1)).getDay(),ue.m=0,ue.d="W"in ue?(ue.w+6)%7+ue.W*7-(Oe+5)%7:ue.w+ue.U*7-(Oe+6)%7);return"Z"in ue?(ue.H+=ue.Z/100|0,ue.M+=ue.Z%100,FE(ue)):UE(ue)}}function F(Se,je,$e,ue){for(var Z=0,Ge=je.length,Oe=$e.length,We,tt;Z=Oe)return-1;if(We=je.charCodeAt(Z++),We===37){if(We=je.charAt(Z++),tt=O[We in nL?je.charAt(Z++):We],!tt||(ue=tt(Se,$e,ue))<0)return-1}else if(We!=$e.charCodeAt(ue++))return-1}return ue}function G(Se,je,$e){var ue=c.exec(je.slice($e));return ue?(Se.p=d.get(ue[0].toLowerCase()),$e+ue[0].length):-1}function k(Se,je,$e){var ue=y.exec(je.slice($e));return ue?(Se.w=x.get(ue[0].toLowerCase()),$e+ue[0].length):-1}function U(Se,je,$e){var ue=f.exec(je.slice($e));return ue?(Se.w=m.get(ue[0].toLowerCase()),$e+ue[0].length):-1}function H(Se,je,$e){var ue=w.exec(je.slice($e));return ue?(Se.m=E.get(ue[0].toLowerCase()),$e+ue[0].length):-1}function ne(Se,je,$e){var ue=S.exec(je.slice($e));return ue?(Se.m=_.get(ue[0].toLowerCase()),$e+ue[0].length):-1}function ee(Se,je,$e){return F(Se,e,je,$e)}function pe(Se,je,$e){return F(Se,n,je,$e)}function se(Se,je,$e){return F(Se,r,je,$e)}function fe(Se){return o[Se.getDay()]}function B(Se){return s[Se.getDay()]}function Q(Se){return l[Se.getMonth()]}function K(Se){return a[Se.getMonth()]}function V(Se){return i[+(Se.getHours()>=12)]}function q(Se){return 1+~~(Se.getMonth()/3)}function he(Se){return o[Se.getUTCDay()]}function ae(Se){return s[Se.getUTCDay()]}function ce(Se){return l[Se.getUTCMonth()]}function we(Se){return a[Se.getUTCMonth()]}function Ee(Se){return i[+(Se.getUTCHours()>=12)]}function Xe(Se){return 1+~~(Se.getUTCMonth()/3)}return{format:function(Se){var je=N(Se+="",T);return je.toString=function(){return Se},je},parse:function(Se){var je=L(Se+="",!1);return je.toString=function(){return Se},je},utcFormat:function(Se){var je=N(Se+="",C);return je.toString=function(){return Se},je},utcParse:function(Se){var je=L(Se+="",!0);return je.toString=function(){return Se},je}}}var nL={"-":"",_:" ",0:"0"},Mi=/^\s*\d+/,Lte=/^%/,Dte=/[\\^$*+?|[\]().{}]/g;function Bn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ute(t,e,n){var r=Mi.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Fte(t,e,n){var r=Mi.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function zte(t,e,n){var r=Mi.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Bte(t,e,n){var r=Mi.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hte(t,e,n){var r=Mi.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function rL(t,e,n){var r=Mi.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function iL(t,e,n){var r=Mi.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Vte(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Gte(t,e,n){var r=Mi.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Wte(t,e,n){var r=Mi.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function sL(t,e,n){var r=Mi.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function $te(t,e,n){var r=Mi.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function oL(t,e,n){var r=Mi.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Xte(t,e,n){var r=Mi.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qte(t,e,n){var r=Mi.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Kte(t,e,n){var r=Mi.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Yte(t,e,n){var r=Mi.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Zte(t,e,n){var r=Lte.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Qte(t,e,n){var r=Mi.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Jte(t,e,n){var r=Mi.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function aL(t,e){return Bn(t.getDate(),e,2)}function ene(t,e){return Bn(t.getHours(),e,2)}function tne(t,e){return Bn(t.getHours()%12||12,e,2)}function nne(t,e){return Bn(1+nx.count(Zc(t),t),e,3)}function Cz(t,e){return Bn(t.getMilliseconds(),e,3)}function rne(t,e){return Cz(t,e)+"000"}function ine(t,e){return Bn(t.getMonth()+1,e,2)}function sne(t,e){return Bn(t.getMinutes(),e,2)}function one(t,e){return Bn(t.getSeconds(),e,2)}function ane(t){var e=t.getDay();return e===0?7:e}function lne(t,e){return Bn(IS.count(Zc(t)-1,t),e,2)}function Pz(t){var e=t.getDay();return e>=4||e===0?Cg(t):Cg.ceil(t)}function cne(t,e){return t=Pz(t),Bn(Cg.count(Zc(t),t)+(Zc(t).getDay()===4),e,2)}function une(t){return t.getDay()}function dne(t,e){return Bn(Uw.count(Zc(t)-1,t),e,2)}function fne(t,e){return Bn(t.getFullYear()%100,e,2)}function hne(t,e){return t=Pz(t),Bn(t.getFullYear()%100,e,2)}function pne(t,e){return Bn(t.getFullYear()%1e4,e,4)}function mne(t,e){var n=t.getDay();return t=n>=4||n===0?Cg(t):Cg.ceil(t),Bn(t.getFullYear()%1e4,e,4)}function gne(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Bn(e/60|0,"0",2)+Bn(e%60,"0",2)}function lL(t,e){return Bn(t.getUTCDate(),e,2)}function vne(t,e){return Bn(t.getUTCHours(),e,2)}function yne(t,e){return Bn(t.getUTCHours()%12||12,e,2)}function xne(t,e){return Bn(1+NS.count(Qc(t),t),e,3)}function Rz(t,e){return Bn(t.getUTCMilliseconds(),e,3)}function bne(t,e){return Rz(t,e)+"000"}function _ne(t,e){return Bn(t.getUTCMonth()+1,e,2)}function wne(t,e){return Bn(t.getUTCMinutes(),e,2)}function Sne(t,e){return Bn(t.getUTCSeconds(),e,2)}function Mne(t){var e=t.getUTCDay();return e===0?7:e}function Ene(t,e){return Bn(kS.count(Qc(t)-1,t),e,2)}function Nz(t){var e=t.getUTCDay();return e>=4||e===0?Pg(t):Pg.ceil(t)}function Ane(t,e){return t=Nz(t),Bn(Pg.count(Qc(t),t)+(Qc(t).getUTCDay()===4),e,2)}function Tne(t){return t.getUTCDay()}function Cne(t,e){return Bn(Fw.count(Qc(t)-1,t),e,2)}function Pne(t,e){return Bn(t.getUTCFullYear()%100,e,2)}function Rne(t,e){return t=Nz(t),Bn(t.getUTCFullYear()%100,e,2)}function Nne(t,e){return Bn(t.getUTCFullYear()%1e4,e,4)}function Ine(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Pg(t):Pg.ceil(t),Bn(t.getUTCFullYear()%1e4,e,4)}function kne(){return"+0000"}function cL(){return"%"}function uL(t){return+t}function dL(t){return Math.floor(+t/1e3)}var cm,Iz,kz;One({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function One(t){return cm=Ote(t),Iz=cm.format,cm.parse,kz=cm.utcFormat,cm.utcParse,cm}function Lne(t){return new Date(t)}function Dne(t){return t instanceof Date?+t:+new Date(+t)}function N2(t,e,n,r,i,s,o,a,l,c){var d=v2(),f=d.invert,m=d.domain,y=c(".%L"),x=c(":%S"),S=c("%I:%M"),_=c("%I %p"),w=c("%a %d"),E=c("%b %d"),T=c("%B"),C=c("%Y");function O(N){return(l(N)e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>Mee(t,s/r))},n.copy=function(){return jz(e).domain(t)},ru.apply(n,arguments)}function LS(){var t=0,e=.5,n=1,r=1,i,s,o,a,l,c=Ts,d,f=!1,m;function y(S){return isNaN(S=+S)?m:(S=.5+((S=+d(S))-s)*(r*S{if(t!=null){var r=t.scale,i=t.type;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!e)?"point":i==="category"?"band":"linear";if(typeof r=="string")return Vne(r)?r:"point"}};function Gne(t,e){for(var n=0,r=t.length,i=t[0]e)?n=s+1:r=s}return n}function Vz(t,e){if(t){var n=e??t.domain(),r=n.map(s=>{var o;return(o=t(s))!==null&&o!==void 0?o:0}),i=t.range();if(!(n.length===0||i.length<2))return s=>{var o,a,l=Gne(r,s);if(l<=0)return n[0];if(l>=n.length)return n[n.length-1];var c=(o=r[l-1])!==null&&o!==void 0?o:0,d=(a=r[l])!==null&&a!==void 0?a:0;return Math.abs(s-c)<=Math.abs(s-d)?n[l-1]:n[l]}}}function Wne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Vz(t,void 0)}function hL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function zw(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);nt.cartesianAxis.xAxis[e],iu=(t,e)=>{var n=Wz(t,e);return n??ri},ii={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:RC,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:qy},$z=(t,e)=>t.cartesianAxis.yAxis[e],su=(t,e)=>{var n=$z(t,e);return n??ii},Jne={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},L2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Jne},Ns=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"zAxis":return L2(t,n);case"angleAxis":return s2(t,n);case"radiusAxis":return o2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},ere=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},rx=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"angleAxis":return s2(t,n);case"radiusAxis":return o2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Xz=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function qz(t,e){return n=>{switch(t){case"xAxis":return"xAxisId"in n&&n.xAxisId===e;case"yAxis":return"yAxisId"in n&&n.yAxisId===e;case"zAxis":return"zAxisId"in n&&n.zAxisId===e;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===e;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===e;default:return!1}}}var Kz=t=>t.graphicalItems.cartesianItems,tre=Ie([wi,TS],qz),Yz=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),Kg=Ie([Kz,Ns,tre],Yz,{memoizeOptions:{resultEqualityCheck:PS}}),Zz=Ie([Kg],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(c2)),Qz=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),nre=Ie([Kg],Qz),Jz=t=>t.map(e=>e.data).filter(Boolean).flat(1),rre=Ie([Kg],t=>t.some(e=>!e.data)),eB=Ie([Kg],Jz,{memoizeOptions:{resultEqualityCheck:PS}}),tB=(t,e)=>{var n=e.chartData,r=n===void 0?[]:n,i=e.dataStartIndex,s=e.dataEndIndex;return t.length>0?t:r.slice(i,s+1)},D2=Ie([eB,wS],tB),ire=(t,e,n)=>(e==null?void 0:e.dataKey)!=null?t.map(r=>({value:bi(r,e.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>t.map(i=>({value:bi(i,r)}))):t.map(r=>({value:r})),nB=(t,e,n,r,i,s)=>{var o=r.chartData,a=o===void 0?[]:o,l=r.dataStartIndex,c=r.dataEndIndex,d=ire(t,e,n);if(i&&(e==null?void 0:e.dataKey)!=null&&s.length>0){var f=a.slice(l,c+1),m=f.map(y=>({value:bi(y,e.dataKey)})).filter(y=>y.value!=null);return[...m,...d]}return d},ix=Ie([D2,Ns,Kg,wS,rre,eB],nB);function ng(t){if(Ol(t)||t instanceof Date){var e=Number(t);if(En(e))return e}}function mL(t){if(Array.isArray(t)){var e=[ng(t[0]),ng(t[1])];return Tl(e)?e:void 0}var n=ng(t);if(n!=null)return[n,n]}function jl(t){return t.map(ng).filter(Zs)}function sre(t,e){var n=ng(t),r=ng(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var ore=Ie([ix],t=>t==null?void 0:t.map(e=>e.value).sort(sre));function rB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function are(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!kl(e))r=e;else if(Array.isArray(e)){var i=jl(e);i.length>0&&(r=Math.max(...i))}return r==null?[]:jl(n.flatMap(s=>{var o=bi(t,s.dataKey),a,l;if(Array.isArray(o)){var c=Gz(o,2);a=c[0],l=c[1]}else a=l=o;if(!(!En(a)||!En(l)))return[r-a,r+l]}))}var ci=t=>{var e=Si(t),n=Xg(t);return rx(t,e,n)},Rg=Ie([ci],t=>t==null?void 0:t.dataKey),lre=Ie([Zz,wS,ci],az),iB=(t,e,n,r)=>{var i={},s=e.reduce((o,a)=>{if(a.stackId==null)return o;var l=o[a.stackId];return l==null&&(l=[]),l.push(a),o[a.stackId]=l,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var a=Gz(o,2),l=a[0],c=a[1],d=r?[...c].reverse():c,f=d.map(l2);return[l,{stackedData:AY(t,f,n),graphicalItems:d}]}))},sB=Ie([lre,Zz,SS,ez],iB),oB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return RY(t,i,s)},cre=Ie([Ns],t=>t.allowDataOverflow),j2=t=>{var e;if(t==null||!("domain"in t))return RC;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=jl(t.ticks);return[Math.min(...n),Math.max(...n)]}if(t.type==="category")return t.ticks.map(String)}return(e=t==null?void 0:t.domain)!==null&&e!==void 0?e:RC},aB=Ie([Ns],j2),lB=Ie([aB,cre],V4),ure=Ie([sB,Xa,wi,lB],oB,{memoizeOptions:{resultEqualityCheck:CS}}),U2=t=>t.errorBars,dre=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>rB(n,r)),Bw=function(){for(var e=arguments.length,n=new Array(e),r=0;r5&&arguments[5]!==void 0?arguments[5]:[],a,l;if(r.length>0&&r.forEach(c=>{var d,f=c.data!=null?[...c.data]:o,m=(d=i[c.id])===null||d===void 0?void 0:d.filter(y=>rB(s,y));f.forEach(y=>{var x,S=bi(y,(x=n.dataKey)!==null&&x!==void 0?x:c.dataKey),_=are(y,S,m);if(_.length>=2){var w=Math.min(..._),E=Math.max(..._);(a==null||wl)&&(l=E)}var T=mL(S);T!=null&&(a=a==null?T[0]:Math.min(a,T[0]),l=l==null?T[1]:Math.max(l,T[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&e.forEach(c=>{var d=mL(bi(c,n.dataKey));d!=null&&(a=a==null?d[0]:Math.min(a,d[0]),l=l==null?d[1]:Math.max(l,d[1]))}),En(a)&&En(l))return[a,l]},fre=Ie([D2,Ns,nre,U2,wi,HJ],cB,{memoizeOptions:{resultEqualityCheck:CS}});function hre(t){var e=t.value;if(Ol(e)||e instanceof Date)return e}var pre=(t,e,n)=>{var r=t.map(hre).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&b5(r))?H4(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},uB=t=>t.referenceElements.dots,Yg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),mre=Ie([uB,wi,TS],Yg),dB=t=>t.referenceElements.areas,gre=Ie([dB,wi,TS],Yg),fB=t=>t.referenceElements.lines,vre=Ie([fB,wi,TS],Yg),hB=(t,e)=>{if(t!=null){var n=jl(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},yre=Ie(mre,wi,hB),pB=(t,e)=>{if(t!=null){var n=jl(t.flatMap(r=>[e==="xAxis"?r.x1:r.y1,e==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},xre=Ie([gre,wi],pB);function bre(t){var e;if(t.x!=null)return jl([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:jl(n)}function _re(t){var e;if(t.y!=null)return jl([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:jl(n)}var mB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?bre(r):_re(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},wre=Ie([vre,wi],mB),Sre=Ie(yre,wre,xre,(t,e,n)=>Bw(t,n,e)),gB=(t,e,n,r,i,s,o,a)=>{if(n!=null)return n;var l=o==="vertical"&&a==="xAxis"||o==="horizontal"&&a==="yAxis",c=l?Bw(r,s,i):Bw(s,i);return qJ(e,c,t.allowDataOverflow)},Mre=Ie([Ns,aB,lB,ure,fre,Sre,pr,wi],gB,{memoizeOptions:{resultEqualityCheck:CS}}),Ere=[0,1],vB=(t,e,n,r,i,s,o)=>{if(!((t==null||n==null||n.length===0)&&o===void 0)){var a=t.dataKey,l=t.type,c=Bl(e,s);if(c&&a==null){var d;return H4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?pre(r,t,c):i==="expand"&&!c?Ere:o}},F2=Ie([Ns,pr,D2,ix,SS,wi,Mre],vB),Zg=Ie([Ns,Xz,n2],Hz),yB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=j2(e),s=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&Tl(t)){if(s)return MO(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return EO(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&Tl(t))return MO(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&Tl(t))return EO(t,e.tickCount,e.allowDecimals,"adaptive")}}},z2=Ie([F2,rx,Zg],yB),xB=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&Tl(e)&&Array.isArray(n)&&n.length>0){var i,s,o=e[0],a=(i=n[0])!==null&&i!==void 0?i:0,l=e[1],c=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,a),Math.max(l,c)]}return e},Are=Ie([Ns,F2,z2,wi],xB),Tre=Ie(ix,Ns,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(jl(t.map(f=>f.value))).sort((f,m)=>f-m),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var a=0;ai,(t,e,n,r,i)=>{if(!En(t))return 0;var s=e==="vertical"?r.height:r.width;if(i==="gap")return t*s/2;if(i==="no-gap"){var o=Ad(n,t*s),a=t*s/2;return a-o-(a-o)/s*o}return 0}),Cre=(t,e,n)=>{var r=iu(t,e);return r==null||typeof r.padding!="string"?0:bB(t,"xAxis",e,n,r.padding)},Pre=(t,e,n)=>{var r=su(t,e);return r==null||typeof r.padding!="string"?0:bB(t,"yAxis",e,n,r.padding)},Rre=Ie(iu,Cre,(t,e)=>{var n,r;if(t==null)return{left:0,right:0};var i=t.padding;return typeof i=="string"?{left:e,right:e}:{left:((n=i.left)!==null&&n!==void 0?n:0)+e,right:((r=i.right)!==null&&r!==void 0?r:0)+e}}),Nre=Ie(su,Pre,(t,e)=>{var n,r;if(t==null)return{top:0,bottom:0};var i=t.padding;return typeof i=="string"?{top:e,bottom:e}:{top:((n=i.top)!==null&&n!==void 0?n:0)+e,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+e}}),_B=Ie([$i,Rre,gS,mS,(t,e,n)=>n],(t,e,n,r,i)=>{var s=r.padding;return i?[s.left,n.width-s.right]:[t.left+e.left,t.left+t.width-e.right]}),wB=Ie([$i,pr,Nre,gS,mS,(t,e,n)=>n],(t,e,n,r,i,s)=>{var o=i.padding;return s?[r.height-o.bottom,o.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),sx=(t,e,n,r)=>{var i;switch(e){case"xAxis":return _B(t,n,r);case"yAxis":return wB(t,n,r);case"zAxis":return(i=L2(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return iz(t);case"radiusAxis":return sz(t,n);default:return}},SB=Ie([Ns,sx],MS),Ire=Ie([Zg,Are],fee),B2=Ie([Ns,Zg,Ire,SB],O2),MB=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var i=n.type,s=n.scale,o=Bl(t,r);if(o&&(i==="number"||s!=="auto"))return e.map(a=>a.value)}},H2=Ie([pr,ix,rx,wi],MB),DS=Ie([B2],u2);Ie([B2],Wne);Ie([B2,ore],Vz);Ie([Kg,U2,wi],dre);function EB(t,e){return t.ide.id?1:0}var jS=(t,e)=>e,US=(t,e,n)=>n,kre=Ie(hS,jS,US,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(EB)),Ore=Ie(pS,jS,US,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(EB)),AB=(t,e)=>({width:t.width,height:e.height}),Lre=(t,e)=>{var n=typeof e.width=="number"?e.width:qy;return{width:n,height:t.height}},Dre=Ie($i,iu,AB),jre=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},Ure=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},Fre=Ie(nu,$i,kre,jS,US,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=AB(e,a);o==null&&(o=jre(e,r,t));var c=r==="top"&&!i||r==="bottom"&&i;s[a.id]=o-Number(c)*l.height,o+=(c?-1:1)*l.height}),s}),zre=Ie(tu,$i,Ore,jS,US,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=Lre(e,a);o==null&&(o=Ure(e,r,t));var c=r==="left"&&!i||r==="right"&&i;s[a.id]=o-Number(c)*l.width,o+=(c?-1:1)*l.width}),s}),Bre=(t,e)=>{var n=iu(t,e);if(n!=null)return Fre(t,n.orientation,n.mirror)},Hre=Ie([$i,iu,Bre,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n==null?void 0:n[r];return i==null?{x:t.left,y:0}:{x:t.left,y:i}}}),Vre=(t,e)=>{var n=su(t,e);if(n!=null)return zre(t,n.orientation,n.mirror)},Gre=Ie([$i,su,Vre,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:t.top}:{x:i,y:t.top}}}),Wre=Ie($i,su,(t,e)=>{var n=typeof e.width=="number"?e.width:qy;return{width:n,height:t.height}}),TB=(t,e,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,s=n.type,o=n.dataKey,a=Bl(t,r),l=e.map(d=>d.value),c=l.filter(d=>d!=null);if(o&&a&&s==="category"&&i&&b5(c))return l}},V2=Ie([pr,ix,Ns,wi],TB),gL=Ie([pr,ere,Zg,DS,V2,H2,sx,z2,wi],(t,e,n,r,i,s,o,a,l)=>{if(e!=null){var c=Bl(t,l);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:l,categoricalDomain:s,duplicateDomain:i,isCategorical:c,niceTicks:a,range:o,realScaleType:n,scale:r}}}),$re=(t,e,n,r,i,s,o,a,l)=>{if(!(e==null||r==null)){var c=Bl(t,l),d=e.type,f=e.ticks,m=e.tickCount,y=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/y:0;x=l==="angleAxis"&&s!=null&&s.length>=2?Xo(s[0]-s[1])*2*x:x;var S=f||i;return S?S.map((_,w)=>{var E=o?o.indexOf(_):_,T=r.map(E);return En(T)?{index:w,coordinate:T+x,value:_,offset:x}:null}).filter(Zs):c&&a?a.map((_,w)=>{var E=r.map(_);return En(E)?{coordinate:E+x,value:_,index:w,offset:x}:null}).filter(Zs):r.ticks?r.ticks(m).map((_,w)=>{var E=r.map(_);return En(E)?{coordinate:E+x,value:_,index:w,offset:x}:null}).filter(Zs):r.domain().map((_,w)=>{var E=r.map(_);return En(E)?{coordinate:E+x,value:o?o[_]:_,index:w,offset:x}:null}).filter(Zs)}},CB=Ie([pr,rx,Zg,DS,z2,sx,V2,H2,wi],$re),Xre=(t,e,n,r,i,s,o)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var a=Bl(t,o),l=e.tickCount,c=0;return c=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Xo(r[0]-r[1])*2*c:c,a&&s?s.map((d,f)=>{var m=n.map(d);return En(m)?{coordinate:m+c,value:d,index:f,offset:c}:null}).filter(Zs):n.ticks?n.ticks(l).map((d,f)=>{var m=n.map(d);return En(m)?{coordinate:m+c,value:d,index:f,offset:c}:null}).filter(Zs):n.domain().map((d,f)=>{var m=n.map(d);return En(m)?{coordinate:m+c,value:i?i[d]:d,index:f,offset:c}:null}).filter(Zs)}},PB=Ie([pr,rx,DS,sx,V2,H2,wi],Xre),RB=Ie(Ns,DS,(t,e)=>{if(!(t==null||e==null))return zw(zw({},t),{},{scale:e})}),qre=Ie([Ns,Zg,F2,SB],O2),Kre=Ie([qre],u2);Ie((t,e,n)=>L2(t,n),Kre,(t,e)=>{if(!(t==null||e==null))return zw(zw({},t),{},{scale:e})});var Yre=Ie([pr,hS,pS],(t,e,n)=>{switch(t){case"horizontal":return e.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),Zre=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};Ie([Zre],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,i=t[0];for(var s of t){var o=Math.abs(s.coordinate-e);ot.options.defaultTooltipEventType,IB=t=>t.options.validateTooltipEventTypes;function kB(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function ox(t,e){var n=NB(t),r=IB(t);return kB(e,n,r)}function Qre(t){return Vt(e=>ox(e,t))}var OB=(t,e)=>{var n,r=Number(e);if(!(kl(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},Jre=t=>t.tooltip.settings,cd={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},eie={itemInteraction:{click:cd,hover:cd},axisInteraction:{click:cd,hover:cd},keyboardInteraction:cd,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},LB=ds({name:"tooltip",initialState:eie,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:ar()},replaceTooltipEntrySettings:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=qo(t).tooltipItemPayloads.indexOf(r);s>-1&&(t.tooltipItemPayloads[s]=i)},prepare:ar()},removeTooltipEntrySettings:{reducer(t,e){var n=qo(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:ar()},setTooltipSettingsState(t,e){t.settings=e.payload},setActiveMouseOverItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.itemInteraction.hover.active=!0,t.itemInteraction.hover.index=e.payload.activeIndex,t.itemInteraction.hover.dataKey=e.payload.activeDataKey,t.itemInteraction.hover.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.hover.coordinate=e.payload.activeCoordinate},mouseLeaveChart(t){t.itemInteraction.hover.active=!1,t.axisInteraction.hover.active=!1},mouseLeaveItem(t){t.itemInteraction.hover.active=!1},setActiveClickItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.itemInteraction.click.active=!0,t.keyboardInteraction.active=!1,t.itemInteraction.click.index=e.payload.activeIndex,t.itemInteraction.click.dataKey=e.payload.activeDataKey,t.itemInteraction.click.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.click.coordinate=e.payload.activeCoordinate},setMouseOverAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.axisInteraction.hover.active=!0,t.keyboardInteraction.active=!1,t.axisInteraction.hover.index=e.payload.activeIndex,t.axisInteraction.hover.dataKey=e.payload.activeDataKey,t.axisInteraction.hover.coordinate=e.payload.activeCoordinate},setMouseClickAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.axisInteraction.click.active=!0,t.axisInteraction.click.index=e.payload.activeIndex,t.axisInteraction.click.dataKey=e.payload.activeDataKey,t.axisInteraction.click.coordinate=e.payload.activeCoordinate},setSyncInteraction(t,e){t.syncInteraction=e.payload},setKeyboardInteraction(t,e){t.keyboardInteraction.active=e.payload.active,t.keyboardInteraction.index=e.payload.activeIndex,t.keyboardInteraction.coordinate=e.payload.activeCoordinate}}}),ra=LB.actions,tie=ra.addTooltipEntrySettings,nie=ra.replaceTooltipEntrySettings,rie=ra.removeTooltipEntrySettings,iie=ra.setTooltipSettingsState,sie=ra.setActiveMouseOverItemIndex;ra.mouseLeaveItem;var DB=ra.mouseLeaveChart;ra.setActiveClickItemIndex;var jB=ra.setMouseOverAxisIndex,oie=ra.setMouseClickAxisIndex,B0=ra.setSyncInteraction,Hw=ra.setKeyboardInteraction,aie=LB.reducer;function vL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function kb(t){for(var e=1;e{if(e==null)return cd;var i=die(t,e,n);if(i==null)return cd;if(i.active)return i;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&t.syncInteraction.index!=null)return t.syncInteraction;var s=t.settings.active===!0;if(fie(i)){if(s)return kb(kb({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return kb(kb({},cd),{},{coordinate:i.coordinate})};function hie(t){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(t instanceof Date){var e=t.valueOf();return Number.isFinite(e)?e:void 0}var n=Number(t);return Number.isFinite(n)?n:void 0}function pie(t,e){var n=hie(t),r=e[0],i=e[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function mie(t,e,n){if(n==null||e==null)return!0;var r=bi(t,e);return r==null||!Tl(n)?!0:pie(r,n)}var $0=(t,e,n,r)=>{var i=t==null?void 0:t.index;if(i==null)return null;var s=Number(i);if(!En(s))return i;var o=0,a=1/0;e.length>0&&(a=e.length-1);var l=Math.max(o,Math.min(s,a)),c=e[l];return c==null||mie(c,n,r)?String(l):null},FB=(t,e,n,r,i,s,o)=>{if(s!=null){var a=o[0],l=a==null?void 0:a.getPosition(s);if(l!=null)return l;var c=i==null?void 0:i[Number(s)];if(c)switch(n){case"horizontal":return{x:c.coordinate,y:(r.top+e)/2};default:return{x:(r.left+t)/2,y:c.coordinate}}}},zB=(t,e,n,r)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=t.itemInteraction.hover.graphicalItemId:i=t.itemInteraction.click.graphicalItemId,t.syncInteraction.active&&i==null)return t.tooltipItemPayloads;if(i==null&&(r!=null||t.keyboardInteraction.active)){var s=t.tooltipItemPayloads[0];return s!=null?[s]:[]}return t.tooltipItemPayloads.filter(o=>{var a;return((a=o.settings)===null||a===void 0?void 0:a.graphicalItemId)===i})},BB=t=>t.options.tooltipPayloadSearcher,Qg=t=>t.tooltip;function yL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function xL(t){for(var e=1;et(e)}function bL(t){if(typeof t=="string")return t}function wie(t){if(!(t==null||typeof t!="object")){var e="name"in t?xie(t.name):void 0,n="unit"in t?bie(t.unit):void 0,r="dataKey"in t?_ie(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?bL(t.color):void 0,o="fill"in t?bL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:o}}}function Sie(t,e){return t??e}var HB=(t,e,n,r,i,s,o)=>{if(!(e==null||s==null)){var a=n.chartData,l=n.computedData,c=n.dataStartIndex,d=n.dataEndIndex,f=[];return t.reduce((m,y)=>{var x,S=y.dataDefinedOnItem,_=y.settings,w=Sie(S,a),E=Array.isArray(w)?h4(w,c,d):w,T=(x=_==null?void 0:_.dataKey)!==null&&x!==void 0?x:r,C=_==null?void 0:_.nameKey,O;if(r&&Array.isArray(E)&&!Array.isArray(E[0])&&o==="axis"?O=_5(E,r,i):O=s(E,e,l,C),Array.isArray(O))O.forEach(L=>{var F,G,k=wie(L),U=k==null?void 0:k.name,H=k==null?void 0:k.dataKey,ne=k==null?void 0:k.payload,ee=xL(xL({},_),{},{name:U,unit:k==null?void 0:k.unit,color:(F=k==null?void 0:k.color)!==null&&F!==void 0?F:_==null?void 0:_.color,fill:(G=k==null?void 0:k.fill)!==null&&G!==void 0?G:_==null?void 0:_.fill});m.push(pk({tooltipEntrySettings:ee,dataKey:H,payload:ne,value:bi(ne,H),name:U==null?void 0:String(U)}))});else{var N;m.push(pk({tooltipEntrySettings:_,dataKey:T,payload:O,value:bi(O,T),name:(N=bi(O,C))!==null&&N!==void 0?N:_==null?void 0:_.name}))}return m},f)}},G2=Ie([ci,Xz,n2],Hz),Mie=Ie([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),Eie=Ie([Si,Xg],qz),Jh=Ie([Mie,ci,Eie],Yz,{memoizeOptions:{resultEqualityCheck:PS}}),Aie=Ie([Jh],t=>t.filter(c2)),VB=Ie([Jh],Jz,{memoizeOptions:{resultEqualityCheck:PS}}),Tie=Ie([Jh],t=>t.some(e=>!e.data)),Dh=Ie([VB,Xa],tB),Cie=Ie([Aie,Xa,ci],az),W2=Ie([Dh,ci,Jh,Xa,Tie,VB],nB),GB=Ie([ci],j2),Pie=Ie([ci],t=>t.allowDataOverflow),WB=Ie([GB,Pie],V4),Rie=Ie([Jh],t=>t.filter(c2)),Nie=Ie([Cie,Rie,SS,ez],iB),Iie=Ie([Nie,Xa,Si,WB],oB),kie=Ie([Jh],Qz),Oie=Ie([Dh,ci,kie,U2,Si,VJ],cB,{memoizeOptions:{resultEqualityCheck:CS}}),Lie=Ie([uB,Si,Xg],Yg),Die=Ie([Lie,Si],hB),jie=Ie([dB,Si,Xg],Yg),Uie=Ie([jie,Si],pB),Fie=Ie([fB,Si,Xg],Yg),zie=Ie([Fie,Si],mB),Bie=Ie([Die,zie,Uie],Bw),Hie=Ie([ci,GB,WB,Iie,Oie,Bie,pr,Si],gB),Ng=Ie([ci,pr,Dh,W2,SS,Si,Hie],vB),Vie=Ie([Ng,ci,G2],yB),Gie=Ie([ci,Ng,Vie,Si],xB),$B=t=>{var e=Si(t),n=Xg(t),r=!1;return sx(t,e,n,r)},XB=Ie([ci,$B],MS),Wie=Ie([ci,G2,Gie,XB],O2),qB=Ie([Wie],u2),$ie=Ie([pr,W2,ci,Si],TB),Xie=Ie([pr,W2,ci,Si],MB),qie=(t,e,n,r,i,s,o,a)=>{if(e){var l=e.type,c=Bl(t,a);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=l==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=a==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Xo(i[0]-i[1])*2*f:f,c&&o?o.map((m,y)=>{var x=r.map(m);return En(x)?{coordinate:x+f,value:m,index:y,offset:f}:null}).filter(Zs):r.domain().map((m,y)=>{var x=r.map(m);return En(x)?{coordinate:x+f,value:s?s[m]:m,index:y,offset:f}:null}).filter(Zs)}}},ou=Ie([pr,ci,G2,qB,$B,$ie,Xie,Si],qie),$2=Ie([NB,IB,Jre],(t,e,n)=>kB(n.shared,t,e)),KB=t=>t.tooltip.settings.trigger,X2=t=>t.tooltip.settings.defaultIndex,ax=Ie([Qg,$2,KB,X2],UB),Sy=Ie([ax,Dh,Rg,Ng],$0),YB=Ie([ou,Sy],OB),Kie=Ie([ax],t=>{if(t)return t.dataKey}),Yie=Ie([ax],t=>{if(t)return t.graphicalItemId}),ZB=Ie([Qg,$2,KB,X2],zB),Zie=Ie([tu,nu,pr,$i,ou,X2,ZB],FB),Qie=Ie([ax,Zie],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Jie=Ie([ax],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),ese=Ie([ZB,Sy,Xa,Rg,YB,BB,$2],HB),tse=Ie([ese],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function _L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wL(t){for(var e=1;eVt(ci),ose=()=>{var t=sse(),e=Vt(ou),n=Vt(qB);return yw(!t||!n?void 0:wL(wL({},t),{},{scale:n}),e)};function SL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function um(t){for(var e=1;e{var i=e.find(s=>s&&s.index===n);if(i){if(t==="horizontal")return{x:i.coordinate,y:r.relativeY};if(t==="vertical")return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},dse=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="centric"){var s=i.coordinate,o=r.radius;return um(um(um({},r),Bi(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var a=i.coordinate,l=r.angle;return um(um(um({},r),Bi(r.cx,r.cy,a,l)),{},{angle:l,radius:a})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function fse(t,e){var n=t.relativeX,r=t.relativeY;return n>=e.left&&n<=e.left+e.width&&r>=e.top&&r<=e.top+e.height}var QB=(t,e,n,r,i)=>{var s,o=(s=e==null?void 0:e.length)!==null&&s!==void 0?s:0;if(o<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var a=0;a0?(l=n[a-1])===null||l===void 0?void 0:l.coordinate:(c=n[o-1])===null||c===void 0?void 0:c.coordinate,x=(d=n[a])===null||d===void 0?void 0:d.coordinate,S=a>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(m=n[a+1])===null||m===void 0?void 0:m.coordinate,_=void 0;if(!(y==null||x==null||S==null))if(Xo(x-y)!==Xo(S-x)){var w=[];if(Xo(S-x)===Xo(i[1]-i[0])){_=S;var E=x+i[1]-i[0];w[0]=Math.min(E,(E+y)/2),w[1]=Math.max(E,(E+y)/2)}else{_=y;var T=S+i[1]-i[0];w[0]=Math.min(x,(T+x)/2),w[1]=Math.max(x,(T+x)/2)}var C=[Math.min(x,(_+x)/2),Math.max(x,(_+x)/2)];if(t>C[0]&&t<=C[1]||t>=w[0]&&t<=w[1]){var O;return(O=n[a])===null||O===void 0?void 0:O.index}}else{var N=Math.min(y,S),L=Math.max(y,S);if(t>(N+x)/2&&t<=(L+x)/2){var F;return(F=n[a])===null||F===void 0?void 0:F.index}}}else if(e)for(var G=0;G(k.coordinate+H.coordinate)/2||G>0&&G(k.coordinate+H.coordinate)/2&&t<=(k.coordinate+U.coordinate)/2)return k.index}}return-1},JB=()=>Vt(n2),q2=(t,e)=>e,eH=(t,e,n)=>n,K2=(t,e,n,r)=>r,hse=Ie(ou,t=>nS(t,e=>e.coordinate)),Y2=Ie([Qg,q2,eH,K2],UB),Z2=Ie([Y2,Dh,Rg,Ng],$0),pse=(t,e,n)=>{if(e!=null){var r=Qg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},tH=Ie([Qg,q2,eH,K2],zB),Vw=Ie([tu,nu,pr,$i,ou,K2,tH],FB),mse=Ie([Y2,Vw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),nH=Ie([ou,Z2],OB),gse=Ie([tH,Z2,Xa,Rg,nH,BB,q2],HB),vse=Ie([Y2,Z2],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),yse=(t,e,n,r,i,s,o)=>{if(!(!t||!n||!r||!i)&&fse(t,o)){var a=NY(t,e),l=QB(a,s,i,n,r),c=use(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},xse=(t,e,n,r,i,s,o)=>{if(!(!t||!r||!i||!s||!n)){var a=OJ(t,n);if(a){var l=IY(a,e),c=QB(l,o,s,r,i),d=dse(e,s,c,a);return{activeIndex:String(c),activeCoordinate:d}}}},bse=(t,e,n,r,i,s,o,a)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?yse(t,e,r,i,s,o,a):xse(t,e,n,r,i,s,o)},_se=Ie(t=>t.zIndex.zIndexMap,(t,e)=>e,(t,e,n)=>n,(t,e,n)=>{if(e!=null){var r=t[e];if(r!=null)return n?r.panoramaElement:r.element}}),wse=Ie(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(r=>parseInt(r,10)).concat(Object.values(As)),n=Array.from(new Set(e));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:dee}});function ML(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function EL(t){for(var e=1;eEL(EL({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),Ase)},Cse=new Set(Object.values(As));function Pse(t){return Cse.has(t)}var rH=ds({name:"zIndex",initialState:Tse,reducers:{registerZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]?t.zIndexMap[n].consumers+=1:t.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:ar()},unregisterZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!Pse(n)&&delete t.zIndexMap[n])},prepare:ar()},registerZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload,r=n.zIndex,i=n.element,s=n.isPanorama;t.zIndexMap[r]?s?t.zIndexMap[r].panoramaElement=i:t.zIndexMap[r].element=i:t.zIndexMap[r]={consumers:0,element:s?void 0:i,panoramaElement:s?i:void 0}},prepare:ar()},unregisterZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(e.payload.isPanorama?t.zIndexMap[n].panoramaElement=void 0:t.zIndexMap[n].element=void 0)},prepare:ar()}}}),FS=rH.actions,Rse=FS.registerZIndexPortal,zE=FS.unregisterZIndexPortal,Nse=FS.registerZIndexPortalElement,Ise=FS.unregisterZIndexPortalElement,kse=rH.reducer;function au(t){var e=t.zIndex,n=t.children,r=gZ(),i=r&&e!==void 0&&e!==0,s=eo(),o=R.useRef(void 0),a=R.useRef(new Set),l=Xr(),c=Vt(f=>_se(f,e,s));if(R.useLayoutEffect(()=>{if(!i){var f=a.current;f.forEach(y=>{l(zE({zIndex:y}))}),f.clear(),o.current=void 0;return}if(a.current.has(e)||(l(Rse({zIndex:e})),a.current.add(e)),c){o.current=c;var m=a.current;m.forEach(y=>{y!==e&&(l(zE({zIndex:y})),m.delete(y))})}},[l,e,i,c]),R.useLayoutEffect(()=>{var f=a.current;return()=>{f.forEach(m=>{l(zE({zIndex:m}))}),f.clear()}},[l]),!i)return n;var d=c??o.current;return d?X1.createPortal(n,d):null}function NC(){return NC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.useContext(iH),BE={exports:{}},TL;function Bse(){return TL||(TL=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function s(l,c,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new i(d,f||l,m),x=n?n+c:c;return l._events[x]?l._events[x].fn?l._events[x]=[l._events[x],y]:l._events[x].push(y):(l._events[x]=y,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],d,f;if(this._eventsCount===0)return c;for(f in d=this._events)e.call(d,f)&&c.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},a.prototype.listeners=function(c){var d=n?n+c:c,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,y=f.length,x=new Array(y);m{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!kl(n))return t[n]}},Wse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},sH=ds({name:"options",initialState:Wse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),$se=sH.reducer,Xse=sH.actions.createEventEmitter;function qse(t){return t.tooltip.syncInteraction}var Kse={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},oH=ds({name:"chartData",initialState:Kse,reducers:{setChartData(t,e){if(t.chartData=e.payload,e.payload==null){t.dataStartIndex=0,t.dataEndIndex=0;return}e.payload.length>0&&t.dataEndIndex!==e.payload.length-1&&(t.dataEndIndex=e.payload.length-1)},setComputedData(t,e){t.computedData=e.payload},setDataStartEndIndexes(t,e){var n=e.payload,r=n.startIndex,i=n.endIndex;r!=null&&(t.dataStartIndex=r),i!=null&&(t.dataEndIndex=i)}}}),Q2=oH.actions,PL=Q2.setChartData,Yse=Q2.setDataStartEndIndexes;Q2.setComputedData;var Zse=oH.reducer,Qse=["x","y"];function RL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function dm(t){for(var e=1;el.rootProps.className);R.useEffect(()=>{if(t==null)return Vg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var m;if(o&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var y=d.payload.coordinate,x=y.x,S=y.y,_=noe(y,Qse),w=d.payload.sourceViewBox,E=w.x,T=w.y,C=w.width,O=w.height,N=dm(dm({},_),{},{x:o.x+(C?(x-E)/C:0)*o.width,y:o.y+(O?(S-T)/O:0)*o.height});n(dm(dm({},d),{},{payload:dm(dm({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var L;if(typeof r=="function"){var F={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},G=r(i,F);L=i[G]}else r==="value"&&(L=i.find(fe=>String(fe.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||o==null){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(L==null){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var U=k.x,H=k.y,ne=Math.min(U,o.x+o.width),ee=Math.min(H,o.y+o.height),pe={x:s==="horizontal"?L.coordinate:ne,y:s==="horizontal"?ee:L.coordinate},se=B0({active:d.payload.active,coordinate:pe,dataKey:d.payload.dataKey,index:String(L.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(se)}}};return My.on(IC,l),()=>{My.off(IC,l)}},[a,n,e,t,r,i,s,o])}function soe(){var t=Vt(r2),e=Vt(i2),n=Xr();R.useEffect(()=>{if(t==null)return Vg;var r=(i,s,o)=>{e!==o&&t===i&&n(Yse(s))};return My.on(CL,r),()=>{My.off(CL,r)}},[n,e,t])}function ooe(){var t=Xr();R.useEffect(()=>{t(Xse())},[t]),ioe(),soe()}function aoe(t,e,n,r,i,s){var o=Vt(x=>pse(x,t,e)),a=Vt(Yie),l=Vt(i2),c=Vt(r2),d=Vt(tz),f=Vt(qse),m=(f==null?void 0:f.sourceViewBox)!=null,y=vS();R.useEffect(()=>{if(!m&&c!=null&&l!=null){var x=B0({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:a});My.emit(IC,c,x,l)}},[m,n,o,a,i,r,l,c,d,s,y])}function NL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function IL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{L(iie({shared:E,trigger:T,axisId:N,active:i,defaultIndex:F}))},[L,E,T,N,i,F]);var G=vS(),k=O4(),U=Qre(E),H=(e=Vt($e=>vse($e,U,T,F)))!==null&&e!==void 0?e:{},ne=H.activeIndex,ee=H.isActive,pe=Vt($e=>gse($e,U,T,F)),se=Vt($e=>nH($e,U,T,F)),fe=Vt($e=>mse($e,U,T,F)),B=pe,Q=zse(),K=(n=i??ee)!==null&&n!==void 0?n:!1,V=vK([B,K]),q=doe(V,2),he=q[0],ae=q[1],ce=U==="axis"?se:void 0;aoe(U,T,fe,ce,ne,K);var we=O??Q;if(we==null||G==null||U==null)return null;var Ee=B??OL;K||(Ee=OL),c&&Ee.length&&(Ee=zq(Ee.filter($e=>$e.value!=null&&($e.hide!==!0||r.includeHidden)),m,goe));var Xe=Ee.length>0,Se=IL(IL({},r),{},{payload:Ee,label:ce,active:K,activeIndex:ne,coordinate:fe,accessibilityLayer:k}),je=R.createElement(CQ,{allowEscapeViewBox:s,animationDuration:o,animationEasing:a,isAnimationActive:d,active:K,coordinate:fe,hasPayload:Xe,offset:f,position:y,reverseDirection:x,useTranslate3d:S,viewBox:G,wrapperStyle:_,lastBoundingBox:he,innerRef:ae,hasPortalFromProps:!!O},voe(l,Se));return R.createElement(R.Fragment,null,X1.createPortal(je,we),K&&R.createElement(Fse,{cursor:w,tooltipEventType:U,coordinate:fe,payload:Ee,index:ne}))}function boe(t,e,n){return(e=_oe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _oe(t){var e=woe(t,"string");return typeof e=="symbol"?e:e+""}function woe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Soe{constructor(e){boe(this,"cache",new Map),this.maxSize=e}get(e){var n=this.cache.get(e);return n!==void 0&&(this.cache.delete(e),this.cache.set(e,n)),n}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(e,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function LL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Moe(t){for(var e=1;e{try{var n=document.getElementById(jL);n||(n=document.createElement("span"),n.setAttribute("id",jL),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Poe,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},X0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Qy.isSsr)return{width:0,height:0};if(!aH.enableCache)return UL(e,n);var r=Roe(e,n),i=DL.get(r);if(i)return i;var s=UL(e,n);return DL.set(r,s),s},lH;function Gw(t,e){return Ooe(t)||koe(t,e)||Ioe(t,e)||Noe()}function Noe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ioe(t,e){if(t){if(typeof t=="string")return FL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?FL(t,e):void 0}}function FL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=t.breakAll,r=t.style;try{var i=[];Vi(e)||(n?i=e.toString().split(""):i=e.toString().split(uH));var s=i.map(a=>({word:a,width:X0(a,r).width})),o=n?0:X0(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function fH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function eae(t){return Vi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var hH=(t,e,n,r)=>t.reduce((i,s)=>{var o=s.word,a=s.width,l=i[i.length-1];if(l&&a!=null&&(e==null||r||l.width+a+nt.reduce((e,n)=>e.width>n.width?e:n),tae="…",$L=(t,e,n,r,i,s,o,a)=>{var l=t.slice(0,e),c=dH({breakAll:n,style:r,children:l+tae});if(!c)return[!1,[]];var d=hH(c.wordsWithComputedWidth,s,o,a),f=d.length>i||pH(d).width>Number(s);return[f,d]},nae=(t,e,n,r,i)=>{var s=t.maxLines,o=t.children,a=t.style,l=t.breakAll,c=Dt(s),d=String(o),f=hH(e,r,n,i);if(!c||i)return f;var m=f.length>s||pH(f).width>Number(r);if(!m)return f;for(var y=0,x=d.length-1,S=0,_;y<=x&&S<=d.length-1;){var w=Math.floor((y+x)/2),E=w-1,T=$L(d,E,l,a,s,r,n,i),C=GL(T,2),O=C[0],N=C[1],L=$L(d,w,l,a,s,r,n,i),F=GL(L,1),G=F[0];if(!O&&!G&&(y=w+1),O&&G&&(x=w-1),!O&&G){_=N;break}S++}return _||f},XL=t=>{var e=Vi(t)?[]:t.toString().split(uH);return[{words:e,width:void 0}]},rae=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,o=t.maxLines;if((e||n)&&!Qy.isSsr){var a,l,c=dH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;a=d,l=f}else return XL(r);return nae({breakAll:s,children:r,maxLines:o,style:i},a,l,e,!!n)}return XL(r)},mH="#808080",iae={angle:0,breakAll:!1,capHeight:"0.71em",fill:mH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},J2=R.forwardRef((t,e)=>{var n=ta(t,iae),r=n.x,i=n.y,s=n.lineHeight,o=n.capHeight,a=n.fill,l=n.scaleToFit,c=n.textAnchor,d=n.verticalAnchor,f=VL(n,Xoe),m=R.useMemo(()=>rae({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),y=f.dx,x=f.dy,S=f.angle,_=f.className,w=f.breakAll,E=VL(f,qoe);if(!Ol(r)||!Ol(i)||m.length===0)return null;var T=Number(r)+(Dt(y)?y:0),C=Number(i)+(Dt(x)?x:0);if(!En(T)||!En(C))return null;var O;switch(d){case"start":O=HE("calc(".concat(o,")"));break;case"middle":O=HE("calc(".concat((m.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:O=HE("calc(".concat(m.length-1," * -").concat(s,")"));break}var N=[],L=m[0];if(l&&L!=null){var F=L.width,G=f.width;N.push("scale(".concat(Dt(G)&&Dt(F)?G/F:1,")"))}return S&&N.push("rotate(".concat(S,", ").concat(T,", ").concat(C,")")),N.length&&(E.transform=N.join(" ")),R.createElement("text",kC({},Zo(E),{ref:e,x:T,y:C,className:nr("recharts-text",_),textAnchor:c,fill:a.includes("url")?mH:a}),m.map((k,U)=>{var H=k.words.join(w?"":" ");return R.createElement("tspan",{x:T,dy:U===0?O:s,key:"".concat(H,"-").concat(U)},H)}))});J2.displayName="Text";function qL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pl(t){for(var e=1;e{var e=t.viewBox,n=t.position,r=t.offset,i=r===void 0?0:r,s=t.parentViewBox,o=XP(e),a=o.x,l=o.y,c=o.height,d=o.upperWidth,f=o.lowerWidth,m=a,y=a+(d-f)/2,x=(m+y)/2,S=(d+f)/2,_=m+d/2,w=c>=0?1:-1,E=w*i,T=w>0?"end":"start",C=w>0?"start":"end",O=d>=0?1:-1,N=O*i,L=O>0?"end":"start",F=O>0?"start":"end",G=s;if(n==="top"){var k={x:m+d/2,y:l-E,horizontalAnchor:"middle",verticalAnchor:T};return G&&(k.height=Math.max(l-G.y,0),k.width=d),k}if(n==="bottom"){var U={x:y+f/2,y:l+c+E,horizontalAnchor:"middle",verticalAnchor:C};return G&&(U.height=Math.max(G.y+G.height-(l+c),0),U.width=f),U}if(n==="left"){var H={x:x-N,y:l+c/2,horizontalAnchor:L,verticalAnchor:"middle"};return G&&(H.width=Math.max(H.x-G.x,0),H.height=c),H}if(n==="right"){var ne={x:x+S+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"};return G&&(ne.width=Math.max(G.x+G.width-ne.x,0),ne.height=c),ne}var ee=G?{width:S,height:c}:{};return n==="insideLeft"?pl({x:x+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"},ee):n==="insideRight"?pl({x:x+S-N,y:l+c/2,horizontalAnchor:L,verticalAnchor:"middle"},ee):n==="insideTop"?pl({x:m+d/2,y:l+E,horizontalAnchor:"middle",verticalAnchor:C},ee):n==="insideBottom"?pl({x:y+f/2,y:l+c-E,horizontalAnchor:"middle",verticalAnchor:T},ee):n==="insideTopLeft"?pl({x:m+N,y:l+E,horizontalAnchor:F,verticalAnchor:C},ee):n==="insideTopRight"?pl({x:m+d-N,y:l+E,horizontalAnchor:L,verticalAnchor:C},ee):n==="insideBottomLeft"?pl({x:y+N,y:l+c-E,horizontalAnchor:F,verticalAnchor:T},ee):n==="insideBottomRight"?pl({x:y+f-N,y:l+c-E,horizontalAnchor:L,verticalAnchor:T},ee):n&&typeof n=="object"&&(Dt(n.x)||Nh(n.x))&&(Dt(n.y)||Nh(n.y))?pl({x:a+Ad(n.x,S),y:l+Ad(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},ee):pl({x:_,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},ee)},cae=["labelRef"],uae=["content"];function KL(t,e){if(t==null)return{};var n,r,i=dae(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var e=t.x,n=t.y,r=t.upperWidth,i=t.lowerWidth,s=t.width,o=t.height,a=t.children,l=R.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:i,width:s,height:o}),[e,n,r,i,s,o]);return R.createElement(gH.Provider,{value:l},a)},vH=()=>{var t=R.useContext(gH),e=vS();return t||(e?XP(e):void 0)},gae=R.createContext(null),vae=()=>{var t=R.useContext(gae),e=Vt(oz);return t||e},yae=t=>{var e=t.value,n=t.formatter,r=Vi(t.children)?e:t.children;return typeof n=="function"?n(r):r},eR=t=>t!=null&&typeof t=="function",xae=(t,e)=>{var n=Xo(e-t),r=Math.min(Math.abs(e-t),360);return n*r},bae=(t,e,n,r,i)=>{var s=t.offset,o=t.className,a=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,m=i.endAngle,y=i.clockWise,x=(c+d)/2,S=xae(f,m),_=S>=0?1:-1,w,E;switch(e){case"insideStart":w=f+_*s,E=y;break;case"insideEnd":w=m-_*s,E=!y;break;case"end":w=m+_*s,E=y;break;default:throw new Error("Unsupported position ".concat(e))}E=S<=0?E:!E;var T=Bi(a,l,x,w),C=Bi(a,l,x,w+(E?1:-1)*359),O="M".concat(T.x,",").concat(T.y,` - A`).concat(x,",").concat(x,",0,1,").concat(E?0:1,`, - `).concat(C.x,",").concat(C.y),N=Vi(t.id)?uy("recharts-radial-line-"):t.id;return R.createElement("text",Dc({},r,{dominantBaseline:"central",className:nr("recharts-radial-bar-label",o)}),R.createElement("defs",null,R.createElement("path",{id:N,d:O})),R.createElement("textPath",{xlinkHref:"#".concat(N)},n))},_ae=(t,e,n)=>{var r=t.cx,i=t.cy,s=t.innerRadius,o=t.outerRadius,a=t.startAngle,l=t.endAngle,c=(a+l)/2;if(n==="outside"){var d=Bi(r,i,o+e,c),f=d.x,m=d.y;return{x:f,y:m,textAnchor:f>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var y=(s+o)/2,x=Bi(r,i,y,c),S=x.x,_=x.y;return{x:S,y:_,textAnchor:"middle",verticalAnchor:"middle"}},G_=t=>t!=null&&"cx"in t&&Dt(t.cx),wae={angle:0,offset:5,zIndex:As.label,position:"middle",textBreakAll:!1};function Sae(t){if(!G_(t))return t;var e=t.cx,n=t.cy,r=t.outerRadius,i=r*2;return{x:e-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function ld(t){var e=ta(t,wae),n=e.viewBox,r=e.parentViewBox,i=e.position,s=e.value,o=e.children,a=e.content,l=e.className,c=l===void 0?"":l,d=e.textBreakAll,f=e.labelRef,m=vae(),y=vH(),x=i==="center"?y:m??y,S,_,w;n==null?S=x:G_(n)?S=n:S=XP(n);var E=Sae(S);if(!S||Vi(s)&&Vi(o)&&!R.isValidElement(a)&&typeof a!="function")return null;var T=H0(H0({},e),{},{viewBox:S});if(R.isValidElement(a)){T.labelRef;var C=KL(T,cae);return R.cloneElement(a,C)}if(typeof a=="function"){T.content;var O=KL(T,uae);if(_=R.createElement(a,O),R.isValidElement(_))return _}else _=yae(e);var N=Zo(e);if(G_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return bae(e,i,_,N,S);w=_ae(S,e.offset,e.position)}else{if(!E)return null;var L=lae({viewBox:E,position:i,offset:e.offset,parentViewBox:G_(r)?void 0:r});w=H0(H0({x:L.x,y:L.y,textAnchor:L.horizontalAnchor,verticalAnchor:L.verticalAnchor},L.width!==void 0?{width:L.width}:{}),L.height!==void 0?{height:L.height}:{})}return R.createElement(au,{zIndex:e.zIndex},R.createElement(J2,Dc({ref:f,className:nr("recharts-label",c)},N,w,{textAnchor:fH(N.textAnchor)?N.textAnchor:w.textAnchor,breakAll:d}),_))}ld.displayName="Label";var Mae=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?R.createElement(ld,Dc({key:"label-implicit"},r)):Ol(t)?R.createElement(ld,Dc({key:"label-implicit",value:t},r)):R.isValidElement(t)?t.type===ld?R.cloneElement(t,H0({key:"label-implicit"},r)):R.createElement(ld,Dc({key:"label-implicit",content:t},r)):eR(t)?R.createElement(ld,Dc({key:"label-implicit",content:t},r)):t&&typeof t=="object"?R.createElement(ld,Dc({},t,{key:"label-implicit"},r)):null};function Eae(t){var e=t.label,n=t.labelRef,r=vH();return Mae(e,r,n)||null}var Aae=["valueAccessor"],Tae=["dataKey","clockWise","id","textBreakAll","zIndex"];function Ww(){return Ww=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e=Array.isArray(t.value)?t.value[t.value.length-1]:t.value;if(eae(e))return e},yH=R.createContext(void 0),Rae=yH.Provider,xH=R.createContext(void 0);xH.Provider;function Nae(){return R.useContext(yH)}function Iae(){return R.useContext(xH)}function W_(t){var e=t.valueAccessor,n=e===void 0?Pae:e,r=ZL(t,Aae),i=r.dataKey;r.clockWise;var s=r.id,o=r.textBreakAll,a=r.zIndex,l=ZL(r,Tae),c=Nae(),d=Iae(),f=c||d;return!f||!f.length?null:R.createElement(au,{zIndex:a??As.label},R.createElement(Qo,{className:"recharts-label-list"},f.map((m,y)=>{var x,S=Vi(i)?n(m,y):bi(m.payload,i),_=Vi(s)?{}:{id:"".concat(s,"-").concat(y)};return R.createElement(ld,Ww({key:"label-".concat(y)},Zo(m),l,_,{fill:(x=r.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:S,textBreakAll:o,viewBox:m.viewBox,index:y,zIndex:0}))})))}W_.displayName="LabelList";function kae(t){var e=t.label;return e?e===!0?R.createElement(W_,{key:"labelList-implicit"}):R.isValidElement(e)||eR(e)?R.createElement(W_,{key:"labelList-implicit",content:e}):typeof e=="object"?R.createElement(W_,Ww({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function OC(){return OC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e=t.cx,n=t.cy,r=t.r,i=t.className,s=nr("recharts-dot",i);return Dt(e)&&Dt(n)&&Dt(r)?R.createElement("circle",OC({},Ba(t),jP(t),{className:s,cx:e,cy:n,r})):null},Oae={radiusAxis:{},angleAxis:{}},_H=ds({name:"polarAxis",initialState:Oae,reducers:{addRadiusAxis(t,e){t.radiusAxis[e.payload.id]=e.payload},removeRadiusAxis(t,e){delete t.radiusAxis[e.payload.id]},addAngleAxis(t,e){t.angleAxis[e.payload.id]=e.payload},removeAngleAxis(t,e){delete t.angleAxis[e.payload.id]}}}),zS=_H.actions;zS.addRadiusAxis;zS.removeRadiusAxis;zS.addAngleAxis;zS.removeAngleAxis;var Lae=_H.reducer;function Dae(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var wH=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;function QL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function JL(t){for(var e=1;e{r||(i.current===null?n(tie(e)):i.current!==e&&n(nie({prev:i.current,next:e})),i.current=e)},[e,n,r]),R.useLayoutEffect(()=>()=>{i.current&&(n(rie(i.current)),i.current=null)},[n]),null}function $ae(t){var e=t.legendPayload,n=Xr(),r=eo(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(PZ(e)):i.current!==e&&n(RZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),R.useLayoutEffect(()=>()=>{i.current&&(n(NZ(i.current)),i.current=null)},[n]),null}function Xae(t,e){return Zae(t)||Yae(t,e)||Kae(t,e)||qae()}function qae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kae(t,e){if(t){if(typeof t=="string")return e3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e3(t,e):void 0}}function e3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var i of n)r.push({status:"removed",prev:i});for(var s=0;st[Math.floor(s*n)]);return nR(r,e)}function ele(t,e){var n=e.map((r,i)=>t[i]);return nR(n,e)}function tle(t,e){for(var n=new Map,r=0;r{var y=n(f,m);if(y!=null){var x=r.get(y);if(x!==void 0)return i.add(y),x}}),o=[];for(var a of r){var l=Xae(a,2),c=l[0],d=l[1];i.has(c)||o.push(d)}return nR(s,e,o)}function LC(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===tR?Jae(t,e):n===Qae?ele(t,e):nle(t,e,n)}function MH(t,e){var n=R.useRef(t),r=R.useRef(e.current),i=R.useRef(!0);n.current!==t&&(n.current=t,r.current=e.current,i.current=!1);var s=R.useCallback(function(o,a){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(a===0){i.current=!0;return}a===1&&(r.current=o),a>0&&i.current&&l&&(e.current=o)},[e]);return{startValue:r.current,syncStepValue:s}}function rle(t,e){return ale(t)||ole(t,e)||sle(t,e)||ile()}function ile(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sle(t,e){if(t){if(typeof t=="string")return t3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t3(t,e):void 0}}function t3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{typeof t=="function"&&t(),s(!0)},[t]),a=R.useCallback(()=>{typeof e=="function"&&e(),s(!1)},[e]);return{isAnimating:i,handleAnimationStart:o,handleAnimationEnd:a}}function cle(t){var e,n=t.animationInput,r=t.animationIdPrefix,i=t.items,s=t.previousItemsRef,o=t.isAnimationActive,a=t.animationBegin,l=t.animationDuration,c=t.animationEasing,d=t.onAnimationStart,f=t.onAnimationEnd,m=t.animationInterpolateFn,y=t.animationMatchBy,x=t.shouldUpdatePreviousRef,S=t.children,_=t.layout,w=F4(n,r),E=MH(w,s),T=(e=E.startValue)!==null&&e!==void 0?e:null,C=LC(T,i,y??tR);return R.createElement(U4,{animationId:w,begin:a,duration:l,isActive:o,easing:c,onAnimationEnd:f,onAnimationStart:d,key:w},O=>{var N=T==null,L=i==null?i:m(C,O,_),F=x?x(O):O>0;return E.syncStepValue(L,O,F),L==null?null:S(L,O,N)})}var VE;function ule(t,e){return ple(t)||hle(t,e)||fle(t,e)||dle()}function dle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fle(t,e){if(t){if(typeof t=="string")return n3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?n3(t,e):void 0}}function n3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var t=R.useState(()=>uy("uid-")),e=ule(t,1),n=e[0];return n},EH=(VE=G1.useId)!==null&&VE!==void 0?VE:mle;function gle(t,e){var n=EH();return e||(t?"".concat(t,"-").concat(n):n)}var vle=R.createContext(void 0),yle=t=>{var e=t.id,n=t.type,r=t.children,i=gle("recharts-".concat(n),e);return R.createElement(vle.Provider,{value:i},r(i))},xle={cartesianItems:[],polarItems:[]},AH=ds({name:"graphicalItems",initialState:xle,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:ar()},replaceCartesianGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=qo(t).cartesianItems.indexOf(r);s>-1&&(t.cartesianItems[s]=i)},prepare:ar()},removeCartesianGraphicalItem:{reducer(t,e){var n=qo(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:ar()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:ar()},removePolarGraphicalItem:{reducer(t,e){var n=qo(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:ar()},replacePolarGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=qo(t).polarItems.indexOf(r);s>-1&&(t.polarItems[s]=i)},prepare:ar()}}}),Jg=AH.actions,ble=Jg.addCartesianGraphicalItem,_le=Jg.replaceCartesianGraphicalItem,wle=Jg.removeCartesianGraphicalItem;Jg.addPolarGraphicalItem;Jg.removePolarGraphicalItem;Jg.replacePolarGraphicalItem;var Sle=AH.reducer,Mle=t=>{var e=Xr(),n=R.useRef(null);return R.useLayoutEffect(()=>{n.current===null?e(ble(t)):n.current!==t&&e(_le({prev:n.current,next:t})),n.current=t},[e,t]),R.useLayoutEffect(()=>()=>{n.current&&(e(wle(n.current)),n.current=null)},[e]),null},Ele=R.memo(Mle),Ale=["points"];function r3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function GE(t){for(var e=1;e{var w,E,T=GE(GE(GE({r:3},o),m),{},{index:_,cx:(w=S.x)!==null&&w!==void 0?w:void 0,cy:(E=S.y)!==null&&E!==void 0?E:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return R.createElement(Ile,{key:"dot-".concat(_),option:n,dotProps:T,className:i})}),x={};return a&&l!=null&&(x.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(l,")")),R.createElement(au,{zIndex:d},R.createElement(Qo,$w({className:r},x),y))}function i3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function s3(t){for(var e=1;e({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),qle=Ie([Xle,tu,nu],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),rR=()=>Vt(qle),Kle=()=>Vt(tse);function o3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function WE(t){for(var e=1;e{var e=t.point,n=t.childIndex,r=t.mainColor,i=t.activeDot,s=t.dataKey,o=t.clipPath;if(i===!1||e.x==null||e.y==null)return null;var a={index:n,dataKey:s,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},l=WE(WE(WE({},a),J1(i)),jP(i)),c;return R.isValidElement(i)?c=R.cloneElement(i,l):typeof i=="function"?c=i(l):c=R.createElement(bH,l),R.createElement(Qo,{className:"recharts-active-dot",clipPath:o},c)};function a3(t){var e=t.points,n=t.mainColor,r=t.activeDot,i=t.itemDataKey,s=t.clipPath,o=t.zIndex,a=o===void 0?As.activeDot:o,l=Vt(Sy),c=Kle();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return Vi(d)?null:R.createElement(au,{zIndex:a},R.createElement(Jle,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var ece=t=>{var e=t.chartData,n=Xr(),r=eo();return R.useEffect(()=>r?()=>{}:(n(PL(e)),()=>{n(PL(void 0))}),[e,n,r]),null},l3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},PH=ds({name:"brush",initialState:l3,reducers:{setBrushSettings(t,e){return e.payload==null?l3:e.payload}}});PH.actions.setBrushSettings;var tce=PH.reducer;function nce(t){return(t%180+180)%180}var rce=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=nce(i),o=s*Math.PI/180,a=Math.atan(r/n),l=o>a&&o{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=qo(t).dots.findIndex(r=>r===e.payload);n!==-1&&t.dots.splice(n,1)},addArea:(t,e)=>{t.areas.push(e.payload)},removeArea:(t,e)=>{var n=qo(t).areas.findIndex(r=>r===e.payload);n!==-1&&t.areas.splice(n,1)},addLine:(t,e)=>{t.lines.push(e.payload)},removeLine:(t,e)=>{var n=qo(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),ev=RH.actions;ev.addDot;ev.removeDot;ev.addArea;ev.removeArea;ev.addLine;ev.removeLine;var sce=RH.reducer;function oce(t,e){return uce(t)||cce(t,e)||lce(t,e)||ace()}function ace(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lce(t,e){if(t){if(typeof t=="string")return c3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c3(t,e):void 0}}function c3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=R.useState("".concat(uy("recharts"),"-clip")),r=oce(n,1),i=r[0],s=rR();if(s==null)return null;var o=s.x,a=s.y,l=s.width,c=s.height;return R.createElement(dce.Provider,{value:i},R.createElement("defs",null,R.createElement("clipPath",{id:i},R.createElement("rect",{x:o,y:a,height:c,width:l}))),e)};function NH(t,e){if(e<1)return[];if(e===1)return t;for(var n=[],r=0;rt*i)return!1;var s=n();return t*(e-t*s/2-r)>=0&&t*(e+t*s/2-i)<=0}function mce(t,e){return NH(t,e+1)}function gce(t,e,n,r,i){for(var s=(r||[]).slice(),o=e.start,a=e.end,l=0,c=1,d=o,f=function(){var x=r==null?void 0:r[l];if(x===void 0)return{v:NH(r,c)};var S=l,_,w=()=>(_===void 0&&(_=n(x,S)),_),E=x.coordinate,T=l===0||Ey(t,E,w,d,a);T||(l=0,d=o,c+=1),T&&(d=E+t*(w()/2+i),l+=c)},m;c<=s.length;)if(m=f(),m)return m.v;return[]}function vce(t,e,n,r,i){var s=(r||[]).slice(),o=s.length;if(o===0)return[];for(var a=e.start,l=e.end,c=1;c<=o;c++){for(var d=(o-1)%c,f=a,m=!0,y=function(){var C=r[S];if(C==null)return 0;var O=S,N,L=()=>(N===void 0&&(N=n(C,O)),N),F=C.coordinate,G=S===d||Ey(t,F,L,f,l);if(!G)return m=!1,1;G&&(f=F+t*(L()/2+i))},x,S=d;S(S===void 0&&(S=n(y,m)),S);if(m===o-1){var w=t*(x.coordinate+t*_()/2-l);s[m]=x=ss(ss({},x),{},{tickCoord:w>0?x.coordinate-w*t:x.coordinate})}else s[m]=x=ss(ss({},x),{},{tickCoord:x.coordinate});if(x.tickCoord!=null){var E=Ey(t,x.tickCoord,_,a,l);E&&(l=x.tickCoord-t*(_()/2+i),s[m]=ss(ss({},x),{},{isShow:!0}))}},d=o-1;d>=0;d--)c(d);return s}function wce(t,e,n,r,i,s){var o=(r||[]).slice(),a=o.length,l=e.start,c=e.end;if(s){var d=r[a-1];if(d!=null){var f=n(d,a-1),m=t*(d.coordinate+t*f/2-c);if(o[a-1]=d=ss(ss({},d),{},{tickCoord:m>0?d.coordinate-m*t:d.coordinate}),d.tickCoord!=null){var y=Ey(t,d.tickCoord,()=>f,l,c);y&&(c=d.tickCoord-t*(f/2+i),o[a-1]=ss(ss({},d),{},{isShow:!0}))}}}for(var x=s?a-1:a,S=function(E){var T=o[E];if(T==null)return 1;var C=T,O,N=()=>(O===void 0&&(O=n(T,E)),O);if(E===0){var L=t*(C.coordinate-t*N()/2-l);o[E]=C=ss(ss({},C),{},{tickCoord:L<0?C.coordinate-L*t:C.coordinate})}else o[E]=C=ss(ss({},C),{},{tickCoord:C.coordinate});if(C.tickCoord!=null){var F=Ey(t,C.tickCoord,N,l,c);F&&(l=C.tickCoord+t*(N()/2+i),o[E]=ss(ss({},C),{},{isShow:!0}))}},_=0;_{var L=typeof c=="function"?c(O.value,N):O.value;return x==="width"?hce(X0(L,{fontSize:e,letterSpacing:n}),S,f):X0(L,{fontSize:e,letterSpacing:n})[x]},w=i[0],E=i[1],T=i.length>=2&&w!=null&&E!=null?Xo(E.coordinate-w.coordinate):1,C=pce(s,T,x);return l==="equidistantPreserveStart"?gce(T,C,_,i,o):l==="equidistantPreserveEnd"?vce(T,C,_,i,o):(l==="preserveStart"||l==="preserveStartEnd"?y=wce(T,C,_,i,o,l==="preserveStartEnd"):y=_ce(T,C,_,i,o),y.filter(O=>O.isShow))}var Sce=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,i=r,s=t.tickSize,o=s===void 0?0:s,a=t.tickMargin,l=a===void 0?0:a,c=0;if(e){Array.from(e).forEach(y=>{if(y){var x=y.getBoundingClientRect();x.width>c&&(c=x.width)}});var d=n?n.getBoundingClientRect().width:0,f=o+l,m=c+f+d+(n?i:0);return Math.round(m)}return 0},Mce={xAxis:{},yAxis:{}},IH=ds({name:"renderedTicks",initialState:Mce,reducers:{setRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,i=n.axisId,s=n.ticks;t[r][i]=s},removeRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,i=n.axisId;delete t[r][i]}}}),kH=IH.actions,Ece=kH.setRenderedTicks,Ace=kH.removeRenderedTicks,Tce=IH.reducer,Cce=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function d3(t,e){return Ice(t)||Nce(t,e)||Rce(t,e)||Pce()}function Pce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rce(t,e){if(t){if(typeof t=="string")return f3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f3(t,e):void 0}}function f3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r==null||n==null)return Vg;var s=e.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return i(Ece({ticks:s,axisId:r,axisType:n})),()=>{i(Ace({axisId:r,axisType:n}))}},[i,e,r,n]),null}var Gce=R.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,i=t.tick,s=t.tickLine,o=t.stroke,a=t.tickFormatter,l=t.unit,c=t.padding,d=t.tickTextProps,f=t.orientation,m=t.mirror,y=t.x,x=t.y,S=t.width,_=t.height,w=t.tickSize,E=t.tickMargin,T=t.fontSize,C=t.letterSpacing,O=t.getTicksConfig,N=t.events,L=t.axisType,F=t.axisId,G=iR(Tr(Tr({},O),{},{ticks:r}),T,C),k=Ba(O),U=J1(i),H=fH(k.textAnchor)?k.textAnchor:zce(f,m),ne=Bce(f,m),ee={};typeof s=="object"&&(ee=s);var pe=Tr(Tr({},k),{},{fill:"none"},ee),se=G.map(Q=>Tr({entry:Q},Fce(Q,y,x,S,_,f,w,m,E))),fe=se.map(Q=>{var K=Q.entry,V=Q.line;return R.createElement(Qo,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(K.value,"-").concat(K.coordinate,"-").concat(K.tickCoord)},s&&R.createElement("line",jh({},pe,V,{className:nr("recharts-cartesian-axis-tick-line",Yh(s,"className"))})))}),B=se.map((Q,K)=>{var V,q,he=Q.entry,ae=Q.tick,ce=Tr(Tr(Tr(Tr({verticalAnchor:ne},k),{},{textAnchor:H,stroke:"none",fill:o},ae),{},{index:K,payload:he,visibleTicksCount:G.length,tickFormatter:a,padding:c},d),{},{angle:(V=(q=d==null?void 0:d.angle)!==null&&q!==void 0?q:k.angle)!==null&&V!==void 0?V:0}),we=Tr(Tr({},ce),U);return R.createElement(Qo,jh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(he.value,"-").concat(he.coordinate,"-").concat(he.tickCoord)},qX(N,he,K)),i&&R.createElement(Hce,{option:i,tickProps:we,value:"".concat(typeof a=="function"?a(he.value,K):he.value).concat(l||"")}))});return R.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(L,"-ticks")},R.createElement(Vce,{ticks:G,axisId:F,axisType:L}),B.length>0&&R.createElement(au,{zIndex:As.label},R.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(L,"-tick-labels"),ref:e},B)),fe.length>0&&R.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(L,"-tick-lines")},fe))}),Wce=R.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,i=t.height,s=t.className,o=t.hide,a=t.ticks,l=t.axisType,c=t.axisId,d=kce(t,Cce),f=R.useState(""),m=d3(f,2),y=m[0],x=m[1],S=R.useState(""),_=d3(S,2),w=_[0],E=_[1],T=R.useRef(null);R.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return Sce({ticks:T.current,label:(O=t.labelRef)===null||O===void 0?void 0:O.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var C=R.useCallback(O=>{if(O){var N=O.getElementsByClassName("recharts-cartesian-axis-tick-value");T.current=N;var L=N[0];if(L){var F=window.getComputedStyle(L),G=F.fontSize,k=F.letterSpacing;(G!==y||k!==w)&&(x(G),E(k))}}},[y,w]);return o||r!=null&&r<=0||i!=null&&i<=0?null:R.createElement(au,{zIndex:t.zIndex},R.createElement(Qo,{className:nr("recharts-cartesian-axis",s)},R.createElement(Uce,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:Ba(t)}),R.createElement(Gce,{ref:C,axisType:l,events:d,fontSize:y,getTicksConfig:t,height:t.height,letterSpacing:w,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:a,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),R.createElement(mae,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},R.createElement(Eae,{label:t.label,labelRef:t.labelRef}),t.children)))}),sR=R.forwardRef((t,e)=>{var n=ta(t,Wc);return R.createElement(Wce,jh({},n,{ref:e}))});sR.displayName="CartesianAxis";var $ce=["x1","y1","x2","y2","key"],Xce=["offset"],qce=["xAxisId","yAxisId"],Kce=["xAxisId","yAxisId"];function p3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function os(t){for(var e=1;e{var e=t.fill;if(!e||e==="none")return null;var n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.ry;return R.createElement("rect",{x:r,y:i,ry:a,width:s,height:o,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function OH(t){var e=t.option,n=t.lineItemProps,r;if(R.isValidElement(e))r=R.cloneElement(e,n);else if(typeof e=="function")r=e(n);else{var i,s=n.x1,o=n.y1,a=n.x2,l=n.y2,c=n.key,d=Xw(n,$ce),f=(i=Ba(d))!==null&&i!==void 0?i:{};f.offset;var m=Xw(f,Xce);r=R.createElement("line",ih({},m,{x1:s,y1:o,x2:a,y2:l,fill:"none",key:c}))}return r}function tue(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,s=t.horizontalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=Xw(t,qce),a=s.map((l,c)=>{var d=os(os({},o),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return R.createElement(OH,{key:"line-".concat(c),option:i,lineItemProps:d})});return R.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function nue(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,s=t.verticalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=Xw(t,Kce),a=s.map((l,c)=>{var d=os(os({},o),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return R.createElement(OH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return R.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function rue(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.horizontalPoints,l=t.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length||a==null)return null;var d=a.map(m=>Math.round(m+i-i)).sort((m,y)=>m-y);i!==d[0]&&d.unshift(0);var f=d.map((m,y)=>{var x=d[y+1],S=x==null,_=S?i+o-m:x-m;if(_<=0)return null;var w=y%e.length;return R.createElement("rect",{key:"react-".concat(y),y:m,x:r,height:_,width:s,stroke:"none",fill:e[w],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function iue(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,o=t.y,a=t.width,l=t.height,c=t.verticalPoints;if(!n||!r||!r.length)return null;var d=c.map(m=>Math.round(m+s-s)).sort((m,y)=>m-y);s!==d[0]&&d.unshift(0);var f=d.map((m,y)=>{var x=d[y+1],S=x==null,_=S?s+a-m:x-m;if(_<=0)return null;var w=y%r.length;return R.createElement("rect",{key:"react-".concat(y),x:m,y:o,width:_,height:l,stroke:"none",fill:r[w],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var sue=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return p4(iR(os(os(os({},Wc),n),{},{ticks:m4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},oue=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return p4(iR(os(os(os({},Wc),n),{},{ticks:m4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},aue={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:As.grid};function LH(t){var e=S4(),n=M4(),r=w4(),i=os(os({},ta(t,aue)),{},{x:Dt(t.x)?t.x:r.left,y:Dt(t.y)?t.y:r.top,width:Dt(t.width)?t.width:r.width,height:Dt(t.height)?t.height:r.height}),s=i.xAxisId,o=i.yAxisId,a=i.x,l=i.y,c=i.width,d=i.height,f=i.syncWithTicks,m=i.horizontalValues,y=i.verticalValues,x=eo(),S=Vt(G=>gL(G,"xAxis",s,x)),_=Vt(G=>gL(G,"yAxis",o,x));if(!Ll(c)||!Ll(d)||!Dt(a)||!Dt(l))return null;var w=i.verticalCoordinatesGenerator||sue,E=i.horizontalCoordinatesGenerator||oue,T=i.horizontalPoints,C=i.verticalPoints;if((!T||!T.length)&&typeof E=="function"){var O=m&&m.length,N=E({yAxis:_?os(os({},_),{},{ticks:O?m:_.ticks}):void 0,width:e??c,height:n??d,offset:r},O?!0:f);xw(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(T=N)}if((!C||!C.length)&&typeof w=="function"){var L=y&&y.length,F=w({xAxis:S?os(os({},S),{},{ticks:L?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},L?!0:f);xw(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof F,"]")),Array.isArray(F)&&(C=F)}return R.createElement(au,{zIndex:i.zIndex},R.createElement("g",{className:"recharts-cartesian-grid"},R.createElement(eue,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),R.createElement(rue,ih({},i,{horizontalPoints:T})),R.createElement(iue,ih({},i,{verticalPoints:C})),R.createElement(tue,ih({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:_})),R.createElement(nue,ih({},i,{offset:r,verticalPoints:C,xAxis:S,yAxis:_}))))}LH.displayName="CartesianGrid";var lue={},DH=ds({name:"errorBars",initialState:lue,reducers:{addErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]||(t[r]=[]),t[r].push(i)},replaceErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.prev,s=n.next;t[r]&&(t[r]=t[r].map(o=>o.dataKey===i.dataKey&&o.direction===i.direction?s:o))},removeErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]&&(t[r]=t[r].filter(s=>s.dataKey!==i.dataKey||s.direction!==i.direction))}}}),oR=DH.actions;oR.addErrorBar;oR.replaceErrorBar;oR.removeErrorBar;var cue=DH.reducer;function jH(t,e){var n,r,i=Vt(c=>iu(c,t)),s=Vt(c=>su(c,e)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:ri.allowDataOverflow,a=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:ii.allowDataOverflow,l=o||a;return{needClip:l,needClipX:o,needClipY:a}}function uue(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=rR(),s=jH(e,n),o=s.needClipX,a=s.needClipY,l=s.needClip,c=Vt(T=>_B(T,e,!1)),d=Vt(T=>wB(T,n,!1));if(!l||!i)return null;var f=i.x,m=i.y,y=i.width,x=i.height,S=o&&c?Math.min(c[0],c[1]):f-y/2,_=a&&d?Math.min(d[0],d[1]):m-x/2,w=o&&c?Math.abs(c[1]-c[0]):y*2,E=a&&d?Math.abs(d[1]-d[0]):x*2;return R.createElement("clipPath",{id:"clipPath-".concat(r)},R.createElement("rect",{x:S,y:_,width:w,height:E}))}function due(t){var e=J1(t),n=3,r=2;if(e!=null){var i=e.r,s=e.strokeWidth,o=Number(i),a=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(a)||a<0)&&(a=r),{r:o,strokeWidth:a}}return{r:n,strokeWidth:r}}function aR(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:TH}function lR(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:TH}var UH=(t,e,n)=>RB(t,"xAxis",aR(t,e),n),FH=(t,e,n)=>PB(t,"xAxis",aR(t,e),n),zH=(t,e,n)=>RB(t,"yAxis",lR(t,e),n),BH=(t,e,n)=>PB(t,"yAxis",lR(t,e),n),fue=Ie([pr,UH,zH,FH,BH],(t,e,n,r,i)=>Bl(t,"xAxis")?yw(e,r,!1):yw(n,i,!1)),hue=(t,e)=>e,HH=Ie([Kz,hue],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),VH=t=>{var e=pr(t),n=Bl(e,"xAxis");return n?"yAxis":"xAxis"},pue=(t,e)=>{var n=VH(t);return n==="yAxis"?lR(t,e):aR(t,e)},mue=(t,e,n)=>sB(t,VH(t),pue(t,e),n),gue=Ie([HH,mue],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=l2(t);if(!(r==null||i==null)){var s=(n=e[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(a=>a.key===i);if(o!=null)return o.map(a=>[a[0],a[1]])}}}),vue=Ie([pr,UH,zH,FH,BH,gue,BJ,fue,HH,iee],(t,e,n,r,i,s,o,a,l,c)=>{var d=o.chartData,f=o.dataStartIndex,m=o.dataEndIndex;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||a==null)){var y=l.data,x;if(y&&y.length>0?x=y:x=d==null?void 0:d.slice(f,m+1),x!=null)return Vue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:x,chartBaseValue:c,bandSize:a})}}),yue=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],xue=["id","baseLine"];function q0(){return q0=Object.assign?Object.assign.bind():function(t){for(var e=1;ef.y||0));return Dt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),Dt(d)?R.createElement("rect",{x:af.x||0));return Dt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),Dt(d)?R.createElement("rect",{x:0,y:at==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Ig(Ig({},n.next),{},{x:Fc(n.prev.x,n.next.x,e),y:Fc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),WH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:tR,animationInterpolateFn:Nue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:Mue,xAxisId:0,yAxisId:0,zIndex:As.area};function Kw(t,e){return t&&t!=="none"?t:e}var Iue=t=>{var e=t.dataKey,n=t.name,r=t.stroke,i=t.fill,s=t.legendType,o=t.hide;return[{inactive:o,dataKey:e,type:s,color:Kw(r,i),value:g4(n,e),payload:t}]},kue=R.memo(t=>{var e=t.dataKey,n=t.data,r=t.stroke,i=t.strokeWidth,s=t.fill,o=t.name,a=t.hide,l=t.unit,c=t.tooltipType,d=t.id,f={dataDefinedOnItem:n,getPosition:Vg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:g4(o,e),hide:a,type:c,color:Kw(r,s),unit:l,graphicalItemId:d}};return R.createElement(Wae,{tooltipEntrySettings:f})});function Oue(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,o=r.dataKey,a=Ba(r);return R.createElement(Ole,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function Lue(t){var e=t.showLabels,n=t.children,r=t.points,i=r.map(s=>{var o,a,l={x:(o=s.x)!==null&&o!==void 0?o:0,y:(a=s.y)!==null&&a!==void 0?a:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Ig(Ig({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return R.createElement(Rae,{value:e?i:void 0},n)}function Due(t){var e=t.points,n=t.baseLine,r=t.needClip,i=t.clipPathId,s=t.props,o=t.animationElapsedTime,a=t.isAnimating,l=t.isEntrance,c=s.layout,d=s.type,f=s.stroke,m=s.connectNulls,y=s.isRange,x=s.shape,S=s.id,_=GH(s,Eue),w=Zo(_),E=Ig(Ig({},w),{},{id:S,points:e,connectNulls:m,type:d,baseLine:n,layout:c,stroke:f,isRange:y,animationElapsedTime:o,isAnimating:a,isEntrance:l});return R.createElement(R.Fragment,null,(e==null?void 0:e.length)>1&&R.createElement(Qo,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},R.createElement(Gae,{option:x,DefaultShape:WH.shape,shapeProps:E})),R.createElement(Oue,{points:e,props:_,clipPathId:i}))}function jue(t,e,n){if(Dt(t)){var r=Dt(e)?e:void 0;return Fc(r,t,n)}if(Vi(t)||kl(t)){var i=Dt(e)?e:void 0;return Fc(i,0,n)}return t}function Uue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=t.previousPointsRef,s=t.previousBaselineRef,o=r.points,a=r.baseLine,l=r.isAnimationActive,c=r.animationBegin,d=r.animationDuration,f=r.animationEasing,m=r.animationMatchBy,y=r.animationInterpolateFn,x=R.useMemo(()=>({points:o,baseLine:a}),[o,a]),S=MH(x,s),_=qP(),w=lle(r.onAnimationStart,r.onAnimationEnd),E=w.isAnimating,T=w.handleAnimationStart,C=w.handleAnimationEnd,O=S.startValue;if(_==null)return null;var N;return Array.isArray(a)&&Array.isArray(O)?N=LC(O,a,m):Array.isArray(a)?N=LC(null,a,m):N=null,R.createElement(cle,{animationInput:x,animationIdPrefix:"recharts-area-",items:o,previousItemsRef:i,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:T,onAnimationEnd:C,animationInterpolateFn:y,animationMatchBy:m,layout:_},(L,F,G)=>{var k;return F===1?k=a:Array.isArray(a)?k=y(N,F,_):k=G?a:jue(a,O,F),S.syncStepValue(k,F),R.createElement(Lue,{showLabels:!E,points:o},r.children,R.createElement(Due,{points:L,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:F,isAnimating:E||F<1,isEntrance:G}),R.createElement(kae,{label:r.label}))})}function Fue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=R.useRef(null),s=R.useRef();return R.createElement(Uue,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class zue extends R.PureComponent{render(){var e=this.props,n=e.hide,r=e.dot,i=e.points,s=e.className,o=e.top,a=e.left,l=e.needClip,c=e.xAxisId,d=e.yAxisId,f=e.width,m=e.height,y=e.id,x=e.baseLine,S=e.zIndex;if(n)return null;var _=nr("recharts-area",s),w=y,E=due(r),T=E.r,C=E.strokeWidth,O=wH(r),N=T*2+C,L=l?"url(#clipPath-".concat(O?"":"dots-").concat(w,")"):void 0;return R.createElement(au,{zIndex:S},R.createElement(Qo,{className:_},l&&R.createElement("defs",null,R.createElement(uue,{clipPathId:w,xAxisId:c,yAxisId:d}),!O&&R.createElement("clipPath",{id:"clipPath-dots-".concat(w)},R.createElement("rect",{x:a-N/2,y:o-N/2,width:f+N,height:m+N}))),R.createElement(Fue,{needClip:l,clipPathId:w,props:this.props})),R.createElement(a3,{points:i,mainColor:Kw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:L}),this.props.isRange&&Array.isArray(x)&&R.createElement(a3,{points:x,mainColor:Kw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:L}))}}function Bue(t){var e,n=t.activeDot,r=t.animationBegin,i=t.animationDuration,s=t.animationEasing,o=t.connectNulls,a=t.dot,l=t.fill,c=t.fillOpacity,d=t.hide,f=t.isAnimationActive,m=t.legendType,y=t.stroke,x=t.xAxisId,S=t.yAxisId,_=GH(t,Aue),w=Gg(),E=JB(),T=jH(x,S),C=T.needClip,O=eo(),N=(e=Vt(pe=>vue(pe,t.id,O)))!==null&&e!==void 0?e:{},L=N.points,F=N.isRange,G=N.baseLine,k=rR();if(w!=="horizontal"&&w!=="vertical"||k==null||E!=="AreaChart"&&E!=="ComposedChart")return null;var U=k.height,H=k.width,ne=k.x,ee=k.y;return!L||!L.length?null:R.createElement(zue,qw({},_,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:G,connectNulls:o,dot:a,fill:l,fillOpacity:c,height:U,hide:d,layout:w,isAnimationActive:f,isRange:F,legendType:m,needClip:C,points:L,stroke:y,width:H,left:ne,top:ee,xAxisId:x,yAxisId:S}))}var Hue=(t,e,n,r,i)=>{var s=n??e;if(Dt(s))return s;var o=t==="horizontal"?i:r,a=o.scale.domain();if(o.type==="number"){var l=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]);return s==="dataMin"?c:s==="dataMax"||l<0?l:Math.max(Math.min(a[0],a[1]),0)}return s==="dataMin"?a[0]:s==="dataMax"?a[1]:a[0]};function Vue(t){var e=t.areaSettings,n=e.connectNulls,r=e.baseValue,i=e.dataKey,s=t.stackedData,o=t.layout,a=t.chartBaseValue,l=t.xAxis,c=t.yAxis,d=t.displayedData,f=t.dataStartIndex,m=t.xAxisTicks,y=t.yAxisTicks,x=t.bandSize,S=s&&s.length,_=Hue(o,a,r,l,c),w=o==="horizontal",E=!1,T=d.map((O,N)=>{var L,F,G,k;if(S)k=s[f+N];else{var U=bi(O,i);Array.isArray(U)?(k=U,E=!0):k=[_,U]}var H=(L=(F=k)===null||F===void 0?void 0:F[1])!==null&&L!==void 0?L:null,ne=H==null||S&&!n&&bi(O,i)==null;if(w){var ee;return{x:dk({axis:l,ticks:m,bandSize:x,entry:O,index:N}),y:ne?null:(ee=c.scale.map(H))!==null&&ee!==void 0?ee:null,value:k,payload:O}}return{x:ne?null:(G=l.scale.map(H))!==null&&G!==void 0?G:null,y:dk({axis:c,ticks:y,bandSize:x,entry:O,index:N}),value:k,payload:O}}),C;return S||E?C=T.map(O=>{var N,L=Array.isArray(O.value)?O.value[0]:null;if(w){var F;return{x:O.x,y:L!=null&&O.y!=null&&(F=c.scale.map(L))!==null&&F!==void 0?F:null,payload:O.payload}}return{x:L!=null&&(N=l.scale.map(L))!==null&&N!==void 0?N:null,y:O.y,payload:O.payload}}):C=w?c.scale.map(_):l.scale.map(_),{points:T,baseLine:C??0,isRange:E}}function Gue(t){var e=ta(t,WH),n=eo();return R.createElement(yle,{id:e.id,type:"area"},r=>R.createElement(R.Fragment,null,R.createElement($ae,{legendPayload:Iue(e)}),R.createElement(kue,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:r}),R.createElement(Ele,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:TY(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),R.createElement(Bue,qw({},e,{id:r}))))}var $H=R.memo(Gue,_S);$H.displayName="Area";var Wue=["domain","range"],$ue=["domain","range"];function v3(t,e){if(t==null)return{};var n,r,i=Xue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{if(o!=null)return b3(b3({},s),{},{type:o})},[s,o]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Fle(a)):n.current!==a&&e(zle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Ble(n.current)),n.current=null)},[e]),null}var nde=t=>{var e=t.xAxisId,n=t.className,r=Vt(y4),i=eo(),s="xAxis",o=Vt(m=>CB(m,s,e,i)),a=Vt(m=>Dre(m,e)),l=Vt(m=>Hre(m,e)),c=Vt(m=>Wz(m,e));if(a==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=jC(t,Kue);c.id,c.scale;var f=jC(c,Yue);return R.createElement(sR,DC({},d,f,{x:l.x,y:l.y,width:a.width,height:a.height,className:nr("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:o,axisType:s,axisId:e}))},rde={allowDataOverflow:ri.allowDataOverflow,allowDecimals:ri.allowDecimals,allowDuplicatedCategory:ri.allowDuplicatedCategory,angle:ri.angle,axisLine:Wc.axisLine,height:ri.height,hide:!1,includeHidden:ri.includeHidden,interval:ri.interval,label:!1,minTickGap:ri.minTickGap,mirror:ri.mirror,orientation:ri.orientation,padding:ri.padding,reversed:ri.reversed,scale:ri.scale,tick:ri.tick,tickCount:ri.tickCount,tickLine:Wc.tickLine,tickSize:Wc.tickSize,type:ri.type,niceTicks:ri.niceTicks,xAxisId:0},ide=t=>{var e=ta(t,rde);return R.createElement(R.Fragment,null,R.createElement(tde,{allowDataOverflow:e.allowDataOverflow,allowDecimals:e.allowDecimals,allowDuplicatedCategory:e.allowDuplicatedCategory,angle:e.angle,dataKey:e.dataKey,domain:e.domain,height:e.height,hide:e.hide,id:e.xAxisId,includeHidden:e.includeHidden,interval:e.interval,minTickGap:e.minTickGap,mirror:e.mirror,name:e.name,orientation:e.orientation,padding:e.padding,reversed:e.reversed,scale:e.scale,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,niceTicks:e.niceTicks}),R.createElement(nde,e))},qH=R.memo(ide,XH);qH.displayName="XAxis";var sde=["type"],ode=["dangerouslySetInnerHTML","ticks","scale"],ade=["id","scale"];function UC(){return UC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(o!=null)return w3(w3({},s),{},{type:o})},[o,s]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Hle(a)):n.current!==a&&e(Vle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Gle(n.current)),n.current=null)},[e]),null}function hde(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=R.useRef(null),o=R.useRef(null),a=Vt(y4),l=eo(),c=Xr(),d="yAxis",f=Vt(w=>Wre(w,e)),m=Vt(w=>Gre(w,e)),y=Vt(w=>CB(w,d,e,l)),x=Vt(w=>$z(w,e));if(R.useLayoutEffect(()=>{if(!(r!=="auto"||!f||eR(i)||R.isValidElement(i)||x==null)){var w=s.current;if(w){var E=w.getCalculatedWidth();Math.round(f.width)!==Math.round(E)&&c(Wle({id:e,width:E}))}}},[y,f,c,i,e,r,x]),f==null||m==null||x==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=FC(t,ode);x.id,x.scale;var _=FC(x,ade);return R.createElement(sR,UC({},S,_,{ref:s,labelRef:o,x:m.x,y:m.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:f.width,height:f.height,className:nr("recharts-".concat(d," ").concat(d),n),viewBox:a,ticks:y,axisType:d,axisId:e}))}var pde={allowDataOverflow:ii.allowDataOverflow,allowDecimals:ii.allowDecimals,allowDuplicatedCategory:ii.allowDuplicatedCategory,angle:ii.angle,axisLine:Wc.axisLine,hide:!1,includeHidden:ii.includeHidden,interval:ii.interval,label:!1,minTickGap:ii.minTickGap,mirror:ii.mirror,orientation:ii.orientation,padding:ii.padding,reversed:ii.reversed,scale:ii.scale,tick:ii.tick,tickCount:ii.tickCount,tickLine:Wc.tickLine,tickSize:Wc.tickSize,type:ii.type,niceTicks:ii.niceTicks,width:ii.width,yAxisId:0},mde=t=>{var e=ta(t,pde);return R.createElement(R.Fragment,null,R.createElement(fde,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter,niceTicks:e.niceTicks}),R.createElement(hde,e))},KH=R.memo(mde,XH);KH.displayName="YAxis";var gde=(t,e)=>e,cR=Ie([gde,pr,oz,Si,XB,ou,hse,$i],bse);function vde(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function uR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(vde(t)){var i=t.currentTarget.getBBox();n=i.width>0?e.width/i.width:1,r=i.height>0?e.height/i.height:1}else{var s=t.currentTarget;n=s.offsetWidth>0?e.width/s.offsetWidth:1,r=s.offsetHeight>0?e.height/s.offsetHeight:1}var o=(a,l)=>({relativeX:Math.round((a-e.left)/n),relativeY:Math.round((l-e.top)/r)});return"touches"in t?Array.from(t.touches).map(a=>o(a.clientX,a.clientY)):o(t.clientX,t.clientY)}var YH=Eo("mouseClick"),ZH=Xy();ZH.startListening({actionCreator:YH,effect:(t,e)=>{var n=t.payload,r=cR(e.getState(),uR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(oie({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var zC=Eo("mouseMove"),QH=Xy(),fm=null,Sf=null,$E=null;QH.startListening({actionCreator:zC,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||(o==null?void 0:o.includes("mousemove"));fm!==null&&(cancelAnimationFrame(fm),fm=null),Sf!==null&&(typeof s!="number"||!a)&&(clearTimeout(Sf),Sf=null),$E=uR(n);var l=()=>{var c=e.getState(),d=ox(c,c.tooltip.settings.shared);if(!$E){fm=null,Sf=null;return}if(d==="axis"){var f=cR(c,$E);(f==null?void 0:f.activeIndex)!=null?e.dispatch(jB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(DB())}fm=null,Sf=null};if(!a){l();return}s==="raf"?fm=requestAnimationFrame(l):typeof s=="number"&&Sf===null&&(Sf=setTimeout(l,s))}});function yde(t,e){return e instanceof HTMLElement?"HTMLElement <".concat(e.tagName,' class="').concat(e.className,'">'):e===window?"global.window":t==="children"&&typeof e=="object"&&e!==null?"<>":e}var S3={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},JH=ds({name:"rootProps",initialState:S3,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:S3.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className,t.baseValue=e.payload.baseValue,t.reverseStackOrder=e.payload.reverseStackOrder}}}),xde=JH.reducer,bde=JH.actions.updateOptions,_de=null,wde={updatePolarOptions:(t,e)=>t===null?e.payload:(t.startAngle=e.payload.startAngle,t.endAngle=e.payload.endAngle,t.cx=e.payload.cx,t.cy=e.payload.cy,t.innerRadius=e.payload.innerRadius,t.outerRadius=e.payload.outerRadius,t)},eV=ds({name:"polarOptions",initialState:_de,reducers:wde});eV.actions.updatePolarOptions;var Sde=eV.reducer,tV=Eo("keyDown"),nV=Eo("focus"),rV=Eo("blur"),BS=Xy(),hm=null,Mf=null,Lb=null;BS.startListening({actionCreator:tV,effect:(t,e)=>{Lb=t.payload,hm!==null&&(cancelAnimationFrame(hm),hm=null);var n=e.getState(),r=n.eventSettings,i=r.throttleDelay,s=r.throttledEvents,o=s==="all"||s.includes("keydown");Mf!==null&&(typeof i!="number"||!o)&&(clearTimeout(Mf),Mf=null);var a=()=>{try{var l=e.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var d=l.tooltip.keyboardInteraction,f=Lb;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var m=$0(d,Dh(l),Rg(l),Ng(l)),y=m==null?-1:Number(m),x=!Number.isFinite(y)||y<0,S=ou(l),_=Dh(l),w=ox(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var E=Vw(l,w,"hover",String(d.index));e.dispatch(Hw({active:!d.active,activeIndex:d.index,activeCoordinate:E}));return}var T=Yre(l),C=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(x){var L=Rg(l),F=Ng(l),G=O*C,k=pe=>({active:!1,index:String(pe),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(N=-1,G>0){for(var U=0;U<_.length;U++)if($0(k(U),_,L,F)!=null){N=U;break}}else for(var H=_.length-1;H>=0;H--)if($0(k(H),_,L,F)!=null){N=H;break}if(N<0)return}else{N=y+O*C;var ne=(S==null?void 0:S.length)||_.length;if(ne===0||N>=ne||N<0)return}var ee=Vw(l,w,"hover",String(N));e.dispatch(Hw({active:!0,activeIndex:N.toString(),activeCoordinate:ee}))}finally{hm=null,Mf=null}};if(!o){a();return}i==="raf"?hm=requestAnimationFrame(a):typeof i=="number"&&Mf===null&&(a(),Lb=null,Mf=setTimeout(()=>{Lb?a():(Mf=null,hm=null)},i))}});BS.startListening({actionCreator:nV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;if(!i.active&&i.index==null){var s="0",o=ox(n,n.tooltip.settings.shared),a=Vw(n,o,"hover",String(s));e.dispatch(Hw({active:!0,activeIndex:s,activeCoordinate:a}))}}}});BS.startListening({actionCreator:rV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;i.active&&e.dispatch(Hw({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function iV(t){t.persist();var e=t.currentTarget;return new Proxy(t,{get:(n,r)=>{if(r==="currentTarget")return e;var i=Reflect.get(n,r);return typeof i=="function"?i.bind(n):i}})}var Ho=Eo("externalEvent"),sV=Xy(),Db=new Map,p0=new Map,XE=new Map;sV.startListening({actionCreator:Ho,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,o=iV(i);XE.set(s,{handler:r,reactEvent:o});var a=Db.get(s);a!==void 0&&(cancelAnimationFrame(a),Db.delete(s));var l=e.getState(),c=l.eventSettings,d=c.throttleDelay,f=c.throttledEvents,m=f,y=m==="all"||(m==null?void 0:m.includes(s)),x=p0.get(s);x!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(x),p0.delete(s));var S=()=>{var E=XE.get(s);try{if(!E)return;var T=E.handler,C=E.reactEvent,O=e.getState(),N={activeCoordinate:Qie(O),activeDataKey:Kie(O),activeIndex:Sy(O),activeLabel:YB(O),activeTooltipIndex:Sy(O),isTooltipActive:Jie(O)};T&&T(N,C)}finally{Db.delete(s),p0.delete(s),XE.delete(s)}};if(!y){S();return}if(d==="raf"){var _=requestAnimationFrame(S);Db.set(s,_)}else if(typeof d=="number"){if(!p0.has(s)){S();var w=setTimeout(S,d);p0.set(s,w)}}else S()}}});var Mde=Ie([Qg],t=>t.tooltipItemPayloads),Ede=Ie([Mde,(t,e)=>e,(t,e,n)=>n],(t,e,n)=>{if(e!=null){var r=t.find(s=>s.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(e)}}}),oV=Eo("touchMove"),aV=Xy(),Ef=null,$u=null,M3=null,m0=null;aV.startListening({actionCreator:oV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){m0=iV(n);var r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||o.includes("touchmove");Ef!==null&&(cancelAnimationFrame(Ef),Ef=null),$u!==null&&(typeof s!="number"||!a)&&(clearTimeout($u),$u=null),M3=Array.from(n.touches).map(c=>uR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(m0!=null){var c=e.getState(),d=ox(c,c.tooltip.settings.shared);if(d==="axis"){var f,m=(f=M3)===null||f===void 0?void 0:f[0];if(m==null){Ef=null,$u=null;return}var y=cR(c,m);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(jB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var x,S=m0.touches[0];if(document.elementFromPoint==null||S==null)return;var _=document.elementFromPoint(S.clientX,S.clientY);if(!_||!_.getAttribute)return;var w=_.getAttribute(OY),E=(x=_.getAttribute(LY))!==null&&x!==void 0?x:void 0,T=Jh(c).find(N=>N.id===E);if(w==null||T==null||E==null)return;var C=T.dataKey,O=Ede(c,w,E);e.dispatch(sie({activeDataKey:C,activeIndex:w,activeCoordinate:O,activeGraphicalItemId:E}))}Ef=null,$u=null}};if(!a){l();return}s==="raf"?Ef=requestAnimationFrame(l):typeof s=="number"&&$u===null&&(l(),m0=null,$u=setTimeout(()=>{m0?l():($u=null,Ef=null)},s))}}});var lV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},cV=ds({name:"eventSettings",initialState:lV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),Ade=cV.actions.setEventSettings,Tde=cV.reducer,Cde=F5({brush:tce,cartesianAxis:$le,chartData:Zse,errorBars:cue,eventSettings:Tde,graphicalItems:Sle,layout:yY,legend:IZ,options:$se,polarAxis:Lae,polarOptions:Sde,referenceElements:sce,renderedTicks:Tce,rootProps:xde,tooltip:aie,zIndex:kse}),Pde=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return VK({reducer:Cde,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([ZH.middleware,QH.middleware,BS.middleware,sV.middleware,aV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(e4({type:"raf"}))},devTools:{serialize:{replacer:yde},name:"recharts-".concat(n)}})};function Rde(t){var e=t.preloadedState,n=t.children,r=t.reduxStoreName,i=eo(),s=R.useRef(null);if(i)return n;s.current==null&&(s.current=Pde(e,r));var o=FP;return R.createElement(qZ,{context:o,store:s.current},n)}function Nde(t){var e=t.layout,n=t.margin,r=Xr(),i=eo();return R.useEffect(()=>{i||(r(mY(e)),r(pY(n)))},[r,i,e,n]),null}var Ide=R.memo(Nde,_S);function kde(t){var e=Xr();return R.useEffect(()=>{e(bde(t))},[e,t]),null}var Ode=t=>{var e=Xr();return R.useEffect(()=>{e(Ade(t))},[e,t]),null},Lde=R.memo(Ode,_S);function E3(t){var e=t.zIndex,n=t.isPanorama,r=R.useRef(null),i=Xr();return R.useLayoutEffect(()=>(r.current&&i(Nse({zIndex:e,element:r.current,isPanorama:n})),()=>{i(Ise({zIndex:e,isPanorama:n}))}),[i,e,n]),R.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function A3(t){var e=t.children,n=t.isPanorama,r=Vt(wse);if(!r||r.length===0)return e;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return R.createElement(R.Fragment,null,i.map(o=>R.createElement(E3,{key:o,zIndex:o,isPanorama:n})),e,s.map(o=>R.createElement(E3,{key:o,zIndex:o,isPanorama:n})))}var Dde=["children"];function jde(t,e){if(t==null)return{};var n,r,i=Ude(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=S4(),r=M4(),i=O4();if(!Ll(n)||!Ll(r))return null;var s=t.children,o=t.otherAttributes,a=t.title,l=t.desc,c,d;return o!=null&&(typeof o.tabIndex=="number"?c=o.tabIndex:c=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),R.createElement(r5,Yw({},o,{title:a,desc:l,role:d,tabIndex:c,width:n,height:r,style:Fde,ref:e}),s)}),Bde=t=>{var e=t.children,n=Vt(gS);if(!n)return null;var r=n.width,i=n.height,s=n.y,o=n.x;return R.createElement(r5,{width:r,height:i,x:o,y:s},e)},T3=R.forwardRef((t,e)=>{var n=t.children,r=jde(t,Dde),i=eo();return i?R.createElement(Bde,null,R.createElement(A3,{isPanorama:!0},n)):R.createElement(zde,Yw({ref:e},r),R.createElement(A3,{isPanorama:!1},n))});function Hde(t,e){return $de(t)||Wde(t,e)||Gde(t,e)||Vde()}function Vde(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gde(t,e){if(t){if(typeof t=="string")return C3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C3(t,e):void 0}}function C3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r!=null){var o=r.getBoundingClientRect(),a=o.width/r.offsetWidth;En(a)&&a!==s&&t(vY(a))}},[r,t,s]),i}function P3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function qde(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n(ooe(),null);function Qw(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var rfe=R.forwardRef((t,e)=>{var n,r,i=R.useRef(null),s=R.useState({containerWidth:Qw((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:Qw((r=t.style)===null||r===void 0?void 0:r.height)}),o=Zw(s,2),a=o[0],l=o[1],c=R.useCallback((f,m)=>{l(y=>{var x=Math.round(f),S=Math.round(m);return y.containerWidth===x&&y.containerHeight===S?y:{containerWidth:x,containerHeight:S}})},[]),d=R.useCallback(f=>{if(typeof e=="function"&&e(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var m=f.getBoundingClientRect(),y=m.width,x=m.height;c(y,x);var S=w=>{var E=w[0];if(E!=null){var T=E.contentRect,C=T.width,O=T.height;c(C,O)}},_=new ResizeObserver(S);_.observe(f),i.current=_}},[e,c]);return R.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),R.createElement(R.Fragment,null,R.createElement(Ky,{width:a.containerWidth,height:a.containerHeight}),R.createElement("div",Sd({ref:d},t)))}),ife=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=R.useState({containerWidth:Qw(n),containerHeight:Qw(r)}),s=Zw(i,2),o=s[0],a=s[1],l=R.useCallback((d,f)=>{a(m=>{var y=Math.round(d),x=Math.round(f);return m.containerWidth===y&&m.containerHeight===x?m:{containerWidth:y,containerHeight:x}})},[]),c=R.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var f=d.getBoundingClientRect(),m=f.width,y=f.height;l(m,y)}},[e,l]);return R.createElement(R.Fragment,null,R.createElement(Ky,{width:o.containerWidth,height:o.containerHeight}),R.createElement("div",Sd({ref:c},t)))}),sfe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return R.createElement(R.Fragment,null,R.createElement(Ky,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))}),ofe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?R.createElement(ife,Sd({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?R.createElement(sfe,Sd({},t,{width:n,height:r,ref:e})):R.createElement(R.Fragment,null,R.createElement(Ky,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))});function afe(t){return t?rfe:ofe}var lfe=R.forwardRef((t,e)=>{var n=t.children,r=t.className,i=t.height,s=t.onClick,o=t.onContextMenu,a=t.onDoubleClick,l=t.onMouseDown,c=t.onMouseEnter,d=t.onMouseLeave,f=t.onMouseMove,m=t.onMouseUp,y=t.onTouchEnd,x=t.onTouchMove,S=t.onTouchStart,_=t.style,w=t.width,E=t.responsive,T=t.dispatchTouchEvents,C=T===void 0?!0:T,O=R.useRef(null),N=Xr(),L=R.useState(null),F=Zw(L,2),G=F[0],k=F[1],U=R.useState(null),H=Zw(U,2),ne=H[0],ee=H[1],pe=Xde(),se=$P(),fe=(se==null?void 0:se.width)>0?se.width:w,B=(se==null?void 0:se.height)>0?se.height:i,Q=R.useCallback(Oe=>{pe(Oe),typeof e=="function"&&e(Oe),k(Oe),ee(Oe),Oe!=null&&(O.current=Oe)},[pe,e,k,ee]),K=R.useCallback(Oe=>{N(YH(Oe)),N(Ho({handler:s,reactEvent:Oe}))},[N,s]),V=R.useCallback(Oe=>{N(zC(Oe)),N(Ho({handler:c,reactEvent:Oe}))},[N,c]),q=R.useCallback(Oe=>{N(DB()),N(Ho({handler:d,reactEvent:Oe}))},[N,d]),he=R.useCallback(Oe=>{N(zC(Oe)),N(Ho({handler:f,reactEvent:Oe}))},[N,f]),ae=R.useCallback(()=>{N(nV())},[N]),ce=R.useCallback(()=>{N(rV())},[N]),we=R.useCallback(Oe=>{N(tV(Oe.key))},[N]),Ee=R.useCallback(Oe=>{N(Ho({handler:o,reactEvent:Oe}))},[N,o]),Xe=R.useCallback(Oe=>{N(Ho({handler:a,reactEvent:Oe}))},[N,a]),Se=R.useCallback(Oe=>{N(Ho({handler:l,reactEvent:Oe}))},[N,l]),je=R.useCallback(Oe=>{N(Ho({handler:m,reactEvent:Oe}))},[N,m]),$e=R.useCallback(Oe=>{N(Ho({handler:S,reactEvent:Oe}))},[N,S]),ue=R.useCallback(Oe=>{C&&N(oV(Oe)),N(Ho({handler:x,reactEvent:Oe}))},[N,C,x]),Z=R.useCallback(Oe=>{N(Ho({handler:y,reactEvent:Oe}))},[N,y]),Ge=afe(E);return R.createElement(iH.Provider,{value:G},R.createElement(wX.Provider,{value:ne},R.createElement(Ge,{width:fe??(_==null?void 0:_.width),height:B??(_==null?void 0:_.height),className:nr("recharts-wrapper",r),style:qde({position:"relative",cursor:"default",width:fe,height:B},_),onClick:K,onContextMenu:Ee,onDoubleClick:Xe,onFocus:ae,onBlur:ce,onKeyDown:we,onMouseDown:Se,onMouseEnter:V,onMouseLeave:q,onMouseMove:he,onMouseUp:je,onTouchEnd:Z,onTouchMove:ue,onTouchStart:$e,ref:Q},R.createElement(nfe,null),n)))}),cfe=["width","height","responsive","children","className","style","compact","title","desc"];function ufe(t,e){if(t==null)return{};var n,r,i=dfe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=t.width,r=t.height,i=t.responsive,s=t.children,o=t.className,a=t.style,l=t.compact,c=t.title,d=t.desc,f=ufe(t,cfe),m=Ba(f);return l?R.createElement(R.Fragment,null,R.createElement(Ky,{width:n,height:r}),R.createElement(T3,{otherAttributes:m,title:c,desc:d},s)):R.createElement(lfe,{className:o,style:a,width:n,height:r,responsive:i??!1,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},R.createElement(T3,{otherAttributes:m,title:c,desc:d,ref:e},R.createElement(fce,null,s)))});function BC(){return BC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.createElement(xfe,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:bfe,tooltipPayloadSearcher:Gse,categoricalChartProps:t,ref:e}));const wfe="rgba(130,130,150,0.14)",I3="rgba(130,130,150,0.85)";function Sfe(t){if(t<=0)return 10;const e=Math.pow(10,Math.floor(Math.log10(t))),n=t/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function uV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function Mfe({active:t,payload:e,unit:n}){return!t||!(e!=null&&e.length)?null:g.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:g.jsx("div",{className:"space-y-1",children:e.map(r=>g.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[g.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:r.color}}),g.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:r.name}),g.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:uV(r.value,n)})]},r.dataKey))})})}function dV({data:t,series:e,unit:n="%",yMode:r="percent",height:i=176}){const s=t.reduce((a,l)=>e.reduce((c,d)=>Math.max(c,Number(l[d.key])||0),a),0),o=r==="percent"?Math.min(100,Math.max(25,Math.ceil(s*1.2/25)*25)):Math.max(Sfe(s*1.15),10);return g.jsx("div",{style:{height:i},className:"w-full",children:g.jsx(pZ,{width:"100%",height:"100%",children:g.jsxs(_fe,{data:t,margin:{top:8,right:6,bottom:0,left:-12},children:[g.jsx("defs",{children:e.map(a=>g.jsxs("linearGradient",{id:`grad-${a.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:a.color,stopOpacity:.22}),g.jsx("stop",{offset:"100%",stopColor:a.color,stopOpacity:0})]},a.key))}),g.jsx(LH,{vertical:!1,stroke:wfe}),g.jsx(qH,{dataKey:"t",hide:!0}),g.jsx(KH,{domain:[0,o],ticks:[0,o/2,o],tickFormatter:a=>uV(a,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:I3}}),g.jsx(xoe,{content:g.jsx(Mfe,{unit:n}),cursor:{stroke:I3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(a=>g.jsx($H,{type:"monotone",dataKey:a.key,name:a.label,stroke:a.color,strokeWidth:2,fill:`url(#grad-${a.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},a.key))]})})})}const Efe=[{key:"cpu",label:"CPU",color:"#2dd4bf"},{key:"ram",label:"RAM",color:"#38bdf8"},{key:"gpu",label:"GPU",color:"#a78bfa"},{key:"disk",label:"Disk",color:"#fbbf24"}];function Afe(){var o,a,l,c;const{sys:t,hist:e}=dX(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=Efe.filter(d=>d.key!=="gpu"||n),i={cpu:(o=t==null?void 0:t.cpu)==null?void 0:o.percent,ram:(a=t==null?void 0:t.ram)==null?void 0:a.percent,gpu:n?t.gpu.busy_percent:null,disk:(l=t==null?void 0:t.disk)==null?void 0:l.percent},s={cpu:(c=t==null?void 0:t.cpu)!=null&&c.cores?`${t.cpu.cores} Cores`:"",ram:t?`${om(t.ram.used)}/${om(t.ram.total)} GB`:"",gpu:n?`${om(t.gpu.gtt_used)}/${om(t.gpu.gtt_total)} GB`:"",disk:t!=null&&t.disk?`${om(t.disk.used)}/${om(t.disk.total)} GB`:""};return g.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[g.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),g.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:r.map(d=>g.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:d.color}}),g.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:d.label}),g.jsxs("span",{className:"shrink-0 font-mono text-xs font-bold tabular-nums text-foreground",children:[Math.round(i[d.key]??0),"%"]}),s[d.key]&&g.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:s[d.key]})]},d.key))}),g.jsx(dV,{data:e,series:r,unit:"%",yMode:"percent",height:176})]}):g.jsx("div",{className:"flex h-44 items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(t==null?void 0:t.temp)&&(t.temp.cpu||t.temp.gpu)&&g.jsxs("div",{className:"mt-3 flex gap-4 border-t border-border/30 pt-3 font-mono text-xs text-muted-foreground/80",children:[t.temp.cpu!=null&&g.jsxs("span",{children:["CPU Temp: ",t.temp.cpu," °C"]}),t.temp.gpu!=null&&g.jsxs("span",{children:["GPU Temp: ",t.temp.gpu," °C"]})]})]})}function g0({label:t,value:e,tone:n}){return g.jsxs("div",{className:rt("flex items-center justify-between rounded-lg border px-3 py-1.5 text-xs",n==="alert"?"border-amber-500/30 bg-amber-500/5 font-semibold text-amber-400":n==="accent"?"border-primary/30 bg-primary/5 font-semibold text-primary":"border-border/30 bg-background/25 text-muted-foreground"),children:[g.jsx("span",{className:"flex items-center gap-1.5",children:t}),g.jsx("span",{className:"font-mono text-[10px]",children:e})]})}function Tfe(){var n;const{data:t}=PP(3e3),e=()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}}));return g.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/20 pb-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(n9,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Updates & Pflege"})]}),(t==null?void 0:t.last_check)&&g.jsxs("span",{className:"font-mono text-[9px] text-muted-foreground/80",children:["Zuletzt gesucht: ",new Date(t.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),t?g.jsxs("div",{className:"space-y-1.5",children:[g.jsx(g0,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),g.jsx(g0,{label:"Inferenz-Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),g.jsx(g0,{label:"Router (llama-swap)",tone:t.swap>0?"alert":"muted",value:t.swap>0?"Update verfügbar":"aktuell"}),g.jsx(g0,{label:"Modell-Upgrades",tone:t.models>0?"accent":"muted",value:t.models>0?`${t.models} verfügbar`:"aktuell"}),(n=t.components)==null?void 0:n.map(r=>g.jsx(g0,{tone:r.update===!0?"alert":"muted",label:g.jsxs(g.Fragment,{children:[r.name,r.reachable===!1&&g.jsx("span",{className:"text-[8px] font-bold uppercase text-red-400/80",children:"offline"})]}),value:r.update===!0?`Update: ${r.latest}`:r.update===!1?"aktuell":r.latest?`neueste: ${r.latest}`:"—"},r.key))]}):g.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."})]}),g.jsxs("button",{onClick:e,className:"mt-4 flex h-9 w-full items-center justify-center gap-1.5 rounded-lg bg-primary text-xs font-semibold text-primary-foreground shadow-md shadow-primary/10 transition-all hover:opacity-90 cursor-pointer",children:["Updates verwalten & Pflege ",g.jsx(oF,{className:"h-3.5 w-3.5"})]})]})}function fV({type:t,title:e,message:n,defaultValue:r,autoValue:i,autoLabel:s,onConfirm:o,onCancel:a}){const l=R.useRef(null);return g.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:e}),g.jsx("button",{onClick:a||(()=>o()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:n}),t==="prompt"&&g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{ref:l,type:"text",defaultValue:r,className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:c=>{var d;c.key==="Enter"&&o((d=l.current)==null?void 0:d.value)}}),i!==void 0&&g.jsx("button",{type:"button",onClick:()=>{l.current&&(l.current.value=i)},title:"Setup-bewussten Optimalwert eintragen",className:"h-9 px-3 shrink-0 text-xs font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg transition-colors cursor-pointer",children:s||"Auto"})]}),g.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(t==="confirm"||t==="prompt")&&g.jsx("button",{onClick:a,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),g.jsx("button",{onClick:()=>{var d;const c=t==="prompt"?(d=l.current)==null?void 0:d.value:void 0;o(c)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:t==="confirm"?"Ja, fortfahren":t==="prompt"?"Übernehmen":"OK"})]})]})})}function tv(){const[t,e]=R.useState(null),n=R.useCallback(()=>e(null),[]),r=R.useCallback((a,l,c)=>{e({type:"alert",title:a,message:l,onConfirm:()=>{e(null),c==null||c()}})},[]),i=R.useCallback((a,l,c,d)=>{e({type:"confirm",title:a,message:l,onConfirm:()=>{e(null),c()},onCancel:()=>{e(null),d==null||d()}})},[]),s=R.useCallback((a,l,c,d,f,m)=>{e({type:"prompt",title:a,message:l,defaultValue:c,autoValue:m==null?void 0:m.autoValue,autoLabel:m==null?void 0:m.autoLabel,onConfirm:y=>{e(null),d(y)},onCancel:()=>{e(null),f==null||f()}})},[]),o=t?g.jsx(fV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:o}}function Cfe(){const t=Xh(),{data:e}=CP(3e3),{data:n}=Kh(),{showAlert:r,dialogElement:i}=tv(),[s,o]=R.useState(!1),a=(n==null?void 0:n.models)??[];async function l(c){try{await zt("/api/agent/brain",{method:"POST",body:JSON.stringify({model:c})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${c}' geändert. Der Gateway-Dienst wurde neu gestartet.`),t.invalidateQueries({queryKey:br.agentStatus}),o(!1)}catch(d){r("Fehler",`Fehler beim Wechseln des Gehirns: ${d.message}`)}}return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center justify-between mb-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Il,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(e==null?void 0:e.terminal_url)&&g.jsxs("a",{href:Mg(e.terminal_url),target:"_blank",rel:"noopener",className:rt("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",e.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[g.jsx(bg,{className:"h-3 w-3"})," Terminal öffnen"]})]}),e?g.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[g.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[g.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),g.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[g.jsx("span",{className:rt("h-2 w-2 rounded-full",e.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-medium",children:e.gateway_reachable?"Online":"Offline"})]})]}),g.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[g.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Terminal"}),g.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[g.jsx("span",{className:rt("h-2 w-2 rounded-full",e.terminal_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-medium",children:e.terminal_reachable?"Online":"Offline"})]})]}),g.jsxs("div",{onClick:()=>o(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),g.jsx(El,{className:"h-3 w-3 text-primary"})]}),g.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[g.jsx($1,{className:"h-3 w-3 shrink-0"}),e.brain_model||"auto"]})]}),g.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),g.jsx(rw,{className:"h-3 w-3 text-primary"})]}),g.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[g.jsxs("div",{children:["Config: ",e.has_config?g.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),g.jsxs("div",{children:["Skills: ",e.has_skills?g.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),g.jsxs("div",{children:["Memory: ",e.has_memories?g.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):g.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),e&&g.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[g.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[g.jsx("span",{children:"Telegram"}),g.jsx("span",{className:rt("font-semibold",e.telegram_enabled?"text-emerald-400":""),children:e.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),g.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[g.jsx("span",{children:"MCP-Server"}),g.jsxs("span",{className:"font-semibold text-foreground",children:[e.mcp_server_count??0," verbunden"]})]}),g.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[g.jsx("span",{children:"PC Executor"}),g.jsx("span",{className:rt("font-semibold",e.pc_executor_reachable?"text-emerald-400":""),children:e.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),e&&s&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[g.jsx(El,{className:"h-4 w-4"}),g.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),g.jsx("button",{onClick:()=>o(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',g.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),g.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...a.map(c=>{var d;return((d=c.name.split("/").pop())==null?void 0:d.replace(".gguf",""))||c.name})].map(c=>{const d=["auto","fast","heavy"].includes(c);return g.jsxs("button",{onClick:()=>l(c),className:rt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",e.brain_model===c||!e.brain_model&&c==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[g.jsxs("div",{className:"flex flex-col text-left",children:[g.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:c}),g.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:d?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(e.brain_model===c||!e.brain_model&&c==="auto")&&g.jsx($o,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function Pfe(){const{data:t}=Kh(3e3),e=(t==null?void 0:t.models)??[],n=(t==null?void 0:t.running)??[];return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[g.jsx($1,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),g.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:QF.map(r=>{var o;const i=e.find(a=>a.role===r),s=i?n.includes(i.name):!1;return g.jsxs("div",{className:rt("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",s?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":i?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[g.jsx("div",{className:"min-w-0 flex-1 mr-2",children:g.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[g.jsx("span",{className:rt("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",NP(r)),children:r}),g.jsxs("div",{className:"flex flex-col min-w-0",children:[g.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:i?(o=i.name.split("/").pop())==null?void 0:o.replace(/\.gguf$/i,""):"nicht zugewiesen"}),i&&g.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[i.prompt_cache&&g.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),i.spec_active&&g.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${i.spec_draft_model})`,children:"SPEC"}),i.parallel_slots>1&&g.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${i.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",i.parallel_slots]}),i.incomplete&&g.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),g.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:i?s?g.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):g.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):g.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},r)})})]}),g.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]})}function Rfe(){const t=Xh(),{data:e=[]}=HT({limit:3}),[n,r]=R.useState(""),[i,s]=R.useState("stable"),[o,a]=R.useState(!1);async function l(){if(!(!n.trim()||o)){a(!0);try{await zt("/api/memory",{method:"POST",body:JSON.stringify({content:n,category:i,source:"dashboard"})}),r(""),t.invalidateQueries({queryKey:["memory"]})}catch(c){console.error(c)}finally{a(!1)}}}return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[g.jsx(W1,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsx("textarea",{value:n,onChange:c=>r(c.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),g.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[g.jsxs("select",{value:i,onChange:c=>s(c.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[g.jsx("option",{value:"stable",children:"🔵 Fakt"}),g.jsx("option",{value:"instruction",children:"📋 Regel"}),g.jsx("option",{value:"user",children:"👤 User"}),g.jsx("option",{value:"versioned",children:"🟡 Version"})]}),g.jsxs("button",{onClick:l,disabled:!n.trim()||o,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[g.jsx(OT,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),g.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[g.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),g.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:e.length===0?g.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):e.map(c=>g.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[g.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:c.category}),g.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:c.content,children:c.content})]},c.id))})]})]}),g.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}const k3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Nfe(){const{data:t}=TP(3e3),e=cX(),n=e[e.length-1],r=n?Math.round(n.prompt+n.completion):0;return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(ay,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),g.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t&&g.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[g.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:r.toLocaleString("de-DE")}),g.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),t&&g.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[g.jsxs("div",{children:[t.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",g.jsxs("span",{className:"text-emerald-400/90",children:[t.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),g.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",t.prompt_tokens.toLocaleString("de-DE")," · Output ",t.completion_tokens.toLocaleString("de-DE")]})]})]}),g.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:k3.map(i=>g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),g.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),g.jsx("span",{className:"font-mono text-xs font-bold tabular-nums text-foreground",children:Math.round((n==null?void 0:n[i.key])??0)})]},i.key))})]}),t?g.jsx(dV,{data:e,series:k3,unit:" tok/s",yMode:"auto",height:150}):g.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),g.jsx("div",{className:"mt-2 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:"Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf."})]})}function Ife(){const{data:t}=g7(3e3),{showAlert:e,dialogElement:n}=tv(),[r,i]=R.useState({});async function s(o){i(a=>({...a,[o]:!0}));try{const a=await zt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:o})});a.ok||e("Fehler",`Neustart fehlgeschlagen: ${a.err||"Unbekannt"}`)}catch(a){e("Fehler",`Fehler: ${a.message}`)}finally{i(a=>({...a,[o]:!1}))}}return g.jsxs("div",{className:"flex flex-col rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(nw,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Dienste"})]}),g.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground transition-colors hover:text-primary cursor-pointer",children:"Logs / Pflege"})]}),t?g.jsxs("div",{className:"flex flex-1 flex-col",children:[g.jsx("div",{className:"space-y-1.5",children:t.services.map(o=>g.jsxs("div",{className:"group flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[g.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[g.jsx("span",{className:rt("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",o.ok?"bg-emerald-500":"bg-amber-500")}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-xs font-bold text-foreground",children:o.name}),g.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:o.url})]})]}),g.jsx("button",{onClick:()=>s(o.name),disabled:r[o.name],className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground opacity-0 transition-all hover:bg-primary/5 hover:text-primary group-hover:opacity-100",title:"Dienst neu starten",children:g.jsx(Zf,{className:rt("h-3.5 w-3.5",r[o.name]&&"animate-spin")})})]},o.name))}),g.jsxs("div",{className:"mt-auto flex flex-wrap gap-3 border-t border-border/20 pt-2.5 text-[10px] font-semibold text-muted-foreground",children:[g.jsxs("a",{href:Mg(t.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[g.jsx(bg,{className:"h-3 w-3"})," Engine"]}),g.jsxs("a",{href:Mg(t.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[g.jsx(bg,{className:"h-3 w-3"})," Gateway"]})]})]}):g.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Dienste…"}),n]})}function O3({children:t}){return g.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t})}function kfe(){return g.jsxs("div",{className:"space-y-7",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),g.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),g.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[g.jsx(Afe,{}),g.jsx(Nfe,{}),g.jsx(sX,{})]}),g.jsxs("section",{children:[g.jsx(O3,{children:"Stack-Status"}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[g.jsx(Pfe,{}),g.jsx(Ife,{})]})]}),g.jsxs("section",{children:[g.jsx(O3,{children:"Betrieb & Wissen"}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[g.jsx(Tfe,{}),g.jsx(Cfe,{}),g.jsx(Rfe,{})]})]})]})}function Ofe(){const t=Xh(),{data:e=[]}=x7(2e3),{showAlert:n,dialogElement:r}=tv();async function i(a){try{await zt(`/api/jobs/${a}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:br.jobs})}catch(l){n("Fehler",l.message)}}const s=e.filter(a=>a.state==="running"||a.state==="queued"),o=e.filter(a=>a.state!=="running"&&a.state!=="queued").slice(-3);return s.length===0&&o.length===0?null:g.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[g.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),s.map(a=>g.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[g.jsxs("div",{className:"flex justify-between items-center text-xs",children:[g.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:a.label}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("span",{className:"text-muted-foreground font-mono",children:[a.progress??0,"% • ",VT(a.done_bytes),"/",VT(a.total_bytes),a.eta_s?` • ETA ${M7(a.eta_s)}`:""]}),g.jsx("button",{onClick:()=>i(a.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),g.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:g.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${a.progress??0}%`}})})]},a.id)),o.map(a=>g.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[g.jsx("span",{className:"truncate",children:a.label}),g.jsx("span",{className:rt("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",a.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:a.state})]},a.id)),r]})}function Af({children:t,tone:e="muted"}){const n={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return g.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${n[e]}`,children:t})}function L3({caps:t}){return t?g.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&g.jsx(Af,{children:"💻 Code"}),t.vision&&g.jsx(Af,{children:"👁 Bild"}),t.reasoning&&g.jsx(Af,{children:"🧠 Reason"}),t.moe&&g.jsxs(Af,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&g.jsx(Af,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&g.jsx(Af,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&g.jsx(Af,{children:"🔢 Embed"})]}):null}function Lfe({model:t,onClose:e,onChanged:n}){var S,_;const{data:r,isLoading:i}=w7(t.gguf_path),[s,o]=R.useState(null),[a,l]=R.useState(""),c=r==null?void 0:r.target_vocab,d=(r==null?void 0:r.drafts)??[],f=d.filter(w=>w.compatible===!0),m=t.spec_draft_model;async function y(w){o(w??"__clear__"),l("");try{await zt(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:w})}),n(),e()}catch(E){l(String((E==null?void 0:E.message)||E)),o(null)}}const x=w=>{var E;return w?`${w.pre??"?"} · ${((E=w.n_vocab)==null?void 0:E.toLocaleString())??"?"} Tokens`:"—"};return g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[g.jsx(bh,{className:"h-4 w-4"})," Speculative Draft"]}),g.jsx("button",{onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',g.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),g.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:(S=t.name.split("/").pop())==null?void 0:S.replace(/\.gguf$/i,"")}),g.jsxs("span",{className:"text-foreground",children:["Vocab: ",x(c)]})]}),t.spec_active&&m&&g.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[g.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[g.jsx($o,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",m]}),g.jsx("button",{onClick:()=>y(null),disabled:s!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(r!=null&&r.target_exists)&&g.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[g.jsx(_g,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),g.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?g.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):d.length===0?g.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",g.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):d.map(w=>{var C,O;const E=w.filename===m,T=w.compatible===!0;return g.jsxs("div",{className:rt("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",T?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",E&&"border-primary/40 bg-primary/10"),children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:w.filename}),g.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[Vo(w.size_bytes)," · Vocab: ",x(w.vocab)]})]}),T?E?g.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[g.jsx($o,{className:"h-3.5 w-3.5"})," Aktiv"]}):g.jsx("button",{onClick:()=>y(w.path),disabled:s!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):g.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:w.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(C=w.vocab)==null?void 0:C.pre}/${(O=w.vocab)==null?void 0:O.n_vocab} ≠ Modell ${c==null?void 0:c.pre}/${c==null?void 0:c.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[g.jsx(_g,{className:"h-3.5 w-3.5"})," ",w.compatible===!1?"Vocab ≠":"n/a"]})]},w.path)})}),!i&&(r==null?void 0:r.target_exists)&&d.length>0&&f.length===0&&g.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",g.jsx("span",{className:"font-mono",children:c==null?void 0:c.pre}),", n_vocab=",g.jsx("span",{className:"font-mono",children:(_=c==null?void 0:c.n_vocab)==null?void 0:_.toLocaleString()}),")."]}),a&&g.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:a})]})})}function Dfe(){var mt,Qt,de,qe,le,Ye,Te,Fe,st;const t=Xh(),{data:e,isLoading:n,error:r}=Kh(4e3),{data:i}=y7(4e3),{data:s}=WF(),{data:o}=PP(4e3),{data:a}=b7(),{data:l}=Q1(),{data:c}=v7(),{showAlert:d,showConfirm:f,showPrompt:m,dialogElement:y}=tv(),x=(e==null?void 0:e.models)??[],S=(e==null?void 0:e.running)??[],_=r?String(r):"",w=()=>{t.invalidateQueries({queryKey:br.models}),t.invalidateQueries({queryKey:br.routing})},E=(mt=c==null?void 0:c.groups)==null?void 0:mt.brains,T=(E==null?void 0:E.members)??[],C=te=>T.includes(te),O=T.some(te=>S.includes(te));async function N(te){if(!E){d("Keine brains-Gruppe","Es existiert noch keine Ko-Residenz-Gruppe „brains“ in der Engine-Konfiguration. Lege sie erst über die Gruppen-Verwaltung an.");return}const Je=T.includes(te)?T.filter(At=>At!==te):[...T,te];try{await h7("brains",Je,E.swap??!1,E.persist??!0),t.invalidateQueries({queryKey:br.groups}),w()}catch(At){d("Fehler",`Ko-Residenz konnte nicht geändert werden: ${At.message||At}`)}}const[L,F]=R.useState(null),[G,k]=R.useState(null),[U,H]=R.useState(null),[ne,ee]=R.useState(null),[pe,se]=R.useState(!1),[fe,B]=R.useState(!1),[Q,K]=R.useState(null),[V,q]=R.useState("grid"),[he,ae]=R.useState("all"),ce=x.filter(te=>he==="in_use"?!!te.role||S.includes(te.name):!0),[we,Ee]=R.useState({width:800,height:360}),Xe=R.useRef(null),Se=R.useCallback(te=>{if(Xe.current&&(Xe.current.disconnect(),Xe.current=null),te){const ze=new ResizeObserver(Je=>{if(!Je||Je.length===0)return;const At=Je[0].contentRect;Ee({width:At.width,height:At.height})});ze.observe(te),Xe.current=ze}},[]),je=we.width,$e=we.height,ue=te=>{const ze=je*.1,Je=$e*te,At=je*.5,_t=$e*.5,dn=je*.3,cn=Je,Un=je*.3;return`M ${ze} ${Je} C ${dn} ${cn}, ${Un} ${_t}, ${At} ${_t}`},Z=te=>{const ze=je*.5,Je=$e*.5,At=je*.9,_t=$e*te,dn=je*.7,cn=Je,Un=je*.7;return`M ${ze} ${Je} C ${dn} ${cn}, ${Un} ${_t}, ${At} ${_t}`};async function Ge(te){try{await zt(`/api/models/${encodeURIComponent(te)}/load`,{method:"POST"}),w()}catch(ze){d("Fehler",`Fehler beim Laden des Modells: ${ze.message}`)}}async function Oe(te){if(E&&O&&!C(te)){const ze=T.filter(Je=>S.includes(Je)).map(Je=>Je.split("/").pop()).join(", ");f("Verdrängt das Hirn?",`„${te.split("/").pop()}“ ist nicht in der Ko-Residenz-Gruppe „brains“. Beim Laden wirft es das aktuell warme Hirn (${ze}) raus — Lucy verliert Hirn bzw. Augen. + A`,",",",0,0,",",",",","Z"])),U.x,U.y,s,s,+(d<0),k.x,k.y,r,r,+(te>180),+(d>0),N.x,N.y,s,s,+(d<0),L.x,L.y)}else C+=Ui(_O||(_O=nh(["L",",","Z"])),e,n);return C},WJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},$J=t=>{var e=na(t,WJ),n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,o=e.cornerRadius,a=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,d=e.endAngle,f=e.className;if(s0&&Math.abs(c-d)<360?S=GJ({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:a,cornerIsExternal:l,startAngle:c,endAngle:d}):S=W4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),P.createElement("path",AC({},Qo(e),{className:g,d:S}))};function XJ(t,e,n){if(t==="horizontal")return[{x:e.x,y:n.top},{x:e.x,y:n.top+n.height}];if(t==="vertical")return[{x:n.left,y:e.y},{x:n.left+n.width,y:e.y}];if(A5(e)){if(t==="centric"){var r=e.cx,i=e.cy,s=e.innerRadius,o=e.outerRadius,a=e.angle,l=Hi(r,i,s,a),c=Hi(r,i,o,a);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return G4(e)}}function qJ(t){return z5(t)?NaN:Number(t)}function kE(t){return t?(t=qJ(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function $4(t,e,n){n&&typeof n!="number"&&oC(t,e,n)&&(e=n=void 0),t=kE(t),e===void 0?(e=t,t=0):e=kE(e),n=n===void 0?tt.chartData,e2=Ie([Xa],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),MS=(t,e,n,r)=>r?e2(t):Xa(t),KJ=(t,e,n)=>n?e2(t):Xa(t),YJ=Ie([MS],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});Ie([e2],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var ZJ=Ie([Xa],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function t2(t,e){return tee(t)||eee(t,e)||JJ(t,e)||QJ()}function QJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JJ(t,e){if(t){if(typeof t=="string")return wO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?wO(t,e):void 0}}function wO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.e^s.s<0?1:-1;for(r=s.d.length,i=t.d.length,e=0,n=rt.d[e]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};Nt.decimalPlaces=Nt.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*ur;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Nt.dividedBy=Nt.div=function(t){return Gc(this,new this.constructor(t))};Nt.dividedToIntegerBy=Nt.idiv=function(t){var e=this,n=e.constructor;return Qn(Gc(e,new n(t),0,1),n.precision)};Nt.equals=Nt.eq=function(t){return!this.cmp(t)};Nt.exponent=function(){return $r(this)};Nt.greaterThan=Nt.gt=function(t){return this.cmp(t)>0};Nt.greaterThanOrEqualTo=Nt.gte=function(t){return this.cmp(t)>=0};Nt.isInteger=Nt.isint=function(){return this.e>this.d.length-2};Nt.isNegative=Nt.isneg=function(){return this.s<0};Nt.isPositive=Nt.ispos=function(){return this.s>0};Nt.isZero=function(){return this.s===0};Nt.lessThan=Nt.lt=function(t){return this.cmp(t)<0};Nt.lessThanOrEqualTo=Nt.lte=function(t){return this.cmp(t)<1};Nt.logarithm=Nt.log=function(t){var e,n=this,r=n.constructor,i=r.precision,s=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(_o))throw Error(ea+"NaN");if(n.s<1)throw Error(ea+(n.s?"NaN":"-Infinity"));return n.eq(_o)?new r(0):(pr=!1,e=Gc(vy(n,s),vy(t,s),s),pr=!0,Qn(e,i))};Nt.minus=Nt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?Z4(e,t):K4(e,(t.s=-t.s,t))};Nt.modulo=Nt.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(ea+"NaN");return n.s?(pr=!1,e=Gc(n,t,0,1).times(t),pr=!0,n.minus(e)):Qn(new r(n),i)};Nt.naturalExponential=Nt.exp=function(){return Y4(this)};Nt.naturalLogarithm=Nt.ln=function(){return vy(this)};Nt.negated=Nt.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Nt.plus=Nt.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?K4(e,t):Z4(e,(t.s=-t.s,t))};Nt.precision=Nt.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Sh+t);if(e=$r(i)+1,r=i.d.length-1,n=r*ur+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};Nt.squareRoot=Nt.sqrt=function(){var t,e,n,r,i,s,o,a=this,l=a.constructor;if(a.s<1){if(!a.s)return new l(0);throw Error(ea+"NaN")}for(t=$r(a),pr=!1,i=Math.sqrt(+a),i==0||i==1/0?(e=Sl(a.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=$g((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=o=n+3;;)if(s=r,r=s.plus(Gc(a,s,o+2)).times(.5),Sl(s.d).slice(0,o)===(e=Sl(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(Qn(s,n+1,0),s.times(s).eq(a)){r=s;break}}else if(e!="9999")break;o+=4}return pr=!0,Qn(r,n)};Nt.times=Nt.mul=function(t){var e,n,r,i,s,o,a,l,c,d=this,f=d.constructor,g=d.d,y=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=g.length,c=y.length,l=0;){for(e=0,i=l+r;i>r;)a=s[i]+y[r]*g[i-r-1]+e,s[i--]=a%_i|0,e=a/_i|0;s[i]=(s[i]+e)%_i|0}for(;!s[--o];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,pr?Qn(t,f.precision):t};Nt.toDecimalPlaces=Nt.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Dl(t,0,Wg),e===void 0?e=r.rounding:Dl(e,0,8),Qn(n,t+$r(n)+1,e))};Nt.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Dh(r,!0):(Dl(t,0,Wg),e===void 0?e=i.rounding:Dl(e,0,8),r=Qn(new i(r),t+1,e),n=Dh(r,!0,t+1)),n};Nt.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Dh(i):(Dl(t,0,Wg),e===void 0?e=s.rounding:Dl(e,0,8),r=Qn(new s(i),t+$r(i)+1,e),n=Dh(r.abs(),!1,t+$r(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Nt.toInteger=Nt.toint=function(){var t=this,e=t.constructor;return Qn(new e(t),$r(t)+1,e.rounding)};Nt.toNumber=function(){return+this};Nt.toPower=Nt.pow=function(t){var e,n,r,i,s,o,a=this,l=a.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(_o);if(a=new l(a),!a.s){if(t.s<1)throw Error(ea+"Infinity");return a}if(a.eq(_o))return a;if(r=l.precision,t.eq(_o))return Qn(a,r);if(e=t.e,n=t.d.length-1,o=e>=n,s=a.s,o){if((n=d<0?-d:d)<=q4){for(i=new l(_o),e=Math.ceil(r/ur+4),pr=!1;n%2&&(i=i.times(a),EO(i.d,e)),n=$g(n/2),n!==0;)a=a.times(a),EO(a.d,e);return pr=!0,t.s<0?new l(_o).div(i):Qn(i,r)}}else if(s<0)throw Error(ea+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,a.s=1,pr=!1,i=t.times(vy(a,r+c)),pr=!0,i=Y4(i),i.s=s,i};Nt.toPrecision=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?(n=$r(i),r=Dh(i,n<=s.toExpNeg||n>=s.toExpPos)):(Dl(t,1,Wg),e===void 0?e=s.rounding:Dl(e,0,8),i=Qn(new s(i),t,e),n=$r(i),r=Dh(i,t<=n||n<=s.toExpNeg,t)),r};Nt.toSignificantDigits=Nt.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Dl(t,1,Wg),e===void 0?e=r.rounding:Dl(e,0,8)),Qn(new r(n),t,e)};Nt.toString=Nt.valueOf=Nt.val=Nt.toJSON=Nt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=$r(t),n=t.constructor;return Dh(t,e<=n.toExpNeg||e>=n.toExpPos)};function K4(t,e){var n,r,i,s,o,a,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),pr?Qn(e,f):e;if(l=t.d,c=e.d,o=t.e,i=e.e,l=l.slice(),s=o-i,s){for(s<0?(r=l,s=-s,a=c.length):(r=c,i=o,a=l.length),o=Math.ceil(f/ur),a=o>a?o+1:a+1,s>a&&(s=a,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(a=l.length,s=c.length,a-s<0&&(s=a,r=c,c=l,l=r),n=0;s;)n=(l[--s]=l[s]+c[s]+n)/_i|0,l[s]%=_i;for(n&&(l.unshift(n),++i),a=l.length;l[--a]==0;)l.pop();return e.d=l,e.e=i,pr?Qn(e,f):e}function Dl(t,e,n){if(t!==~~t||tn)throw Error(Sh+t)}function Sl(t){var e,n,r,i=t.length-1,s="",o=t[0];if(i>0){for(s+=o,e=1;eo?1:-1;else for(a=l=0;ai[a]?1:-1;break}return l}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var a,l,c,d,f,g,y,x,S,w,b,M,T,C,O,N,L,F,G=r.constructor,k=r.s==i.s?1:-1,U=r.d,H=i.d;if(!r.s)return new G(r);if(!i.s)throw Error(ea+"Division by zero");for(l=r.e-i.e,L=H.length,O=U.length,y=new G(k),x=y.d=[],c=0;H[c]==(U[c]||0);)++c;if(H[c]>(U[c]||0)&&--l,s==null?M=s=G.precision:o?M=s+($r(r)-$r(i))+1:M=s,M<0)return new G(0);if(M=M/ur+2|0,c=0,L==1)for(d=0,H=H[0],M++;(c1&&(H=t(H,d),U=t(U,d),L=H.length,O=U.length),C=L,S=U.slice(0,L),w=S.length;w=_i/2&&++N;do d=0,a=e(H,S,L,w),a<0?(b=S[0],L!=w&&(b=b*_i+(S[1]||0)),d=b/N|0,d>1?(d>=_i&&(d=_i-1),f=t(H,d),g=f.length,w=S.length,a=e(f,S,g,w),a==1&&(d--,n(f,L16)throw Error(n2+$r(t));if(!t.s)return new d(_o);for(pr=!1,a=f,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),c+=5;for(r=Math.log(Xf(2,c))/Math.LN10*2+5|0,a+=r,n=i=s=new d(_o),d.precision=a;;){if(i=Qn(i.times(t),a),n=n.times(++l),o=s.plus(Gc(i,n,a)),Sl(o.d).slice(0,a)===Sl(s.d).slice(0,a)){for(;c--;)s=Qn(s.times(s),a);return d.precision=f,e==null?(pr=!0,Qn(s,f)):s}s=o}}function $r(t){for(var e=t.e*ur,n=t.d[0];n>=10;n/=10)e++;return e}function OE(t,e,n){if(e>t.LN10.sd())throw pr=!0,n&&(t.precision=n),Error(ea+"LN10 precision limit exceeded");return Qn(new t(t.LN10),e)}function ad(t){for(var e="";t--;)e+="0";return e}function vy(t,e){var n,r,i,s,o,a,l,c,d,f=1,g=10,y=t,x=y.d,S=y.constructor,w=S.precision;if(y.s<1)throw Error(ea+(y.s?"NaN":"-Infinity"));if(y.eq(_o))return new S(0);if(e==null?(pr=!1,c=w):c=e,y.eq(10))return e==null&&(pr=!0),OE(S,c);if(c+=g,S.precision=c,n=Sl(x),r=n.charAt(0),s=$r(y),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)y=y.times(t),n=Sl(y.d),r=n.charAt(0),f++;s=$r(y),r>1?(y=new S("0."+n),s++):y=new S(r+"."+n.slice(1))}else return l=OE(S,c+2,w).times(s+""),y=vy(new S(r+"."+n.slice(1)),c-g).plus(l),S.precision=w,e==null?(pr=!0,Qn(y,w)):y;for(a=o=y=Gc(y.minus(_o),y.plus(_o),c),d=Qn(y.times(y),c),i=3;;){if(o=Qn(o.times(d),c),l=a.plus(Gc(o,new S(i),c)),Sl(l.d).slice(0,c)===Sl(a.d).slice(0,c))return a=a.times(2),s!==0&&(a=a.plus(OE(S,c+2,w).times(s+""))),a=Gc(a,new S(f),c),S.precision=w,e==null?(pr=!0,Qn(a,w)):a;a=l,i+=2}}function MO(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=$g(n/ur),t.d=[],r=(n+1)%ur,n<0&&(r+=ur),rPw||t.e<-Pw))throw Error(n2+n)}else t.s=0,t.e=0,t.d=[0];return t}function Qn(t,e,n){var r,i,s,o,a,l,c,d,f=t.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=e-o,r<0)r+=ur,i=e,c=f[d=0];else{if(d=Math.ceil((r+1)/ur),s=f.length,d>=s)return t;for(c=s=f[d],o=1;s>=10;s/=10)o++;r%=ur,i=r-ur+o}if(n!==void 0&&(s=Xf(10,o-i-1),a=c/s%10|0,l=e<0||f[d+1]!==void 0||c%s,l=n<4?(a||l)&&(n==0||n==(t.s<0?3:2)):a>5||a==5&&(n==4||l||n==6&&(r>0?i>0?c/Xf(10,o-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=$r(t),f.length=1,e=e-s-1,f[0]=Xf(10,(ur-e%ur)%ur),t.e=$g(-e/ur)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=Xf(10,ur-r),f[d]=i>0?(c/Xf(10,o-i)%Xf(10,i)|0)*s:0),l)for(;;)if(d==0){(f[0]+=s)==_i&&(f[0]=1,++t.e);break}else{if(f[d]+=s,f[d]!=_i)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(pr&&(t.e>Pw||t.e<-Pw))throw Error(n2+$r(t));return t}function Z4(t,e){var n,r,i,s,o,a,l,c,d,f,g=t.constructor,y=g.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new g(t),pr?Qn(e,y):e;if(l=t.d,f=e.d,r=e.e,c=t.e,l=l.slice(),o=c-r,o){for(d=o<0,d?(n=l,o=-o,a=f.length):(n=f,r=c,a=l.length),i=Math.max(Math.ceil(y/ur),a)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=l.length,a=f.length,d=i0;--i)l[a++]=0;for(i=f.length;i>o;){if(l[--i]0?s=s.charAt(0)+"."+s.slice(1)+ad(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ad(-i-1)+s,n&&(r=n-o)>0&&(s+=ad(r))):i>=o?(s+=ad(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ad(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ad(r))),t.s<0?"-"+s:s}function EO(t,e){if(t.length>e)return t.length=e,!0}function Q4(t){var e,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(Sh+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return MO(o,s.toString())}else if(typeof s!="string")throw Error(Sh+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,iee.test(s))MO(o,s);else throw Error(Sh+s)}if(i.prototype=Nt,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=Q4,i.config=i.set=see,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(Sh+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Sh+n+": "+r);return this}var r2=Q4(ree);_o=new r2(1);const Nn=r2;function J4(t){var e;return t===0?e=1:e=Math.floor(new Nn(t).abs().log(10).toNumber())+1,e}function ez(t,e,n){for(var r=new Nn(t),i=0,s=[];r.lt(e)&&i<1e5;)s.push(r.toNumber()),r=r.add(n),i++;return s}function yy(t,e){return cee(t)||lee(t,e)||aee(t,e)||oee()}function oee(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aee(t,e){if(t){if(typeof t=="string")return AO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?AO(t,e):void 0}}function AO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=yy(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]},i2=(t,e,n)=>{if(t.lte(0))return new Nn(0);var r=J4(t.toNumber()),i=new Nn(10).pow(r),s=t.div(i),o=r!==1?.05:.1,a=new Nn(Math.ceil(s.div(o).toNumber())).add(n).mul(o),l=a.mul(i);return e?new Nn(l.toNumber()):new Nn(Math.ceil(l.toNumber()))},nz=(t,e,n)=>{var r;if(t.lte(0))return new Nn(0);var i=[1,2,2.5,5],s=t.toNumber(),o=Math.floor(new Nn(s).abs().log(10).toNumber()),a=new Nn(10).pow(o),l=t.div(a).toNumber(),c=i.findIndex(y=>y>=l-1e-10);if(c===-1&&(a=a.mul(10),c=0),c+=n,c>=i.length){var d=Math.floor(c/i.length);c%=i.length,a=a.mul(new Nn(10).pow(d))}var f=(r=i[c])!==null&&r!==void 0?r:1,g=new Nn(f).mul(a);return e?g:new Nn(Math.ceil(g.toNumber()))},uee=(t,e,n)=>{var r=new Nn(1),i=new Nn(t);if(!i.isint()&&n){var s=Math.abs(t);s<1?(r=new Nn(10).pow(J4(t)-1),i=new Nn(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Nn(Math.floor(t)))}else t===0?i=new Nn(Math.floor((e-1)/2)):n||(i=new Nn(Math.floor(t)));for(var o=Math.floor((e-1)/2),a=[],l=0;l4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:i2;if(!Number.isFinite((n-e)/(r-1)))return{step:new Nn(0),tickMin:new Nn(0),tickMax:new Nn(0)};var a=o(new Nn(n).sub(e).div(r-1),i,s),l;e<=0&&n>=0?l=new Nn(0):(l=new Nn(e).add(n).div(2),l=l.sub(new Nn(l).mod(a)));var c=Math.ceil(l.sub(e).div(a).toNumber()),d=Math.ceil(new Nn(n).sub(l).div(a).toNumber()),f=c+d+1;return f>r?rz(e,n,r,i,s+1,o):(f0?d+(r-f):d,c=n>0?c:c+(r-f)),{step:a,tickMin:l.sub(new Nn(c).mul(a)),tickMax:l.add(new Nn(d).mul(a))})},TO=function(e){var n=yy(e,2),r=n[0],i=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),c=tz([r,i]),d=yy(c,2),f=d[0],g=d[1];if(f===-1/0||g===1/0){var y=g===1/0?[f,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),g];return r>i?y.reverse():y}if(f===g)return uee(f,s,o);var x=a==="snap125"?nz:i2,S=rz(f,g,l,o,0,x),w=S.step,b=S.tickMin,M=S.tickMax,T=ez(b,M.add(new Nn(.1).mul(w)),w);return r>i?T.reverse():T},CO=function(e,n){var r=yy(e,2),i=r[0],s=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=tz([i,s]),c=yy(l,2),d=c[0],f=c[1];if(d===-1/0||f===1/0)return[i,s];if(d===f)return[d];var g=a==="snap125"?nz:i2,y=Math.max(n,2),x=g(new Nn(f).sub(d).div(y-1),o,0),S=[...ez(new Nn(d),new Nn(f),x),f];return o===!1&&(S=S.map(w=>Math.round(w))),i>s?S.reverse():S},dee=t=>t.rootProps.barCategoryGap,ES=t=>t.rootProps.stackOffset,iz=t=>t.rootProps.reverseStackOrder,s2=t=>t.options.chartName,o2=t=>t.rootProps.syncId,sz=t=>t.rootProps.syncMethod,a2=t=>t.options.eventEmitter,fee=t=>t.rootProps.baseValue,As={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Sf={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},hl={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},AS=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function TS(t,e,n){if(n!=="auto")return n;if(t!=null)return Bl(t,e)?"category":"number"}function PO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Rw(t){for(var e=1;e{if(e!=null)return t.polarAxis.angleAxis[e]},l2=Ie([gee,P4],(t,e)=>{var n;if(t!=null)return t;var r=(n=TS(e,"angleAxis",RO.type))!==null&&n!==void 0?n:"category";return Rw(Rw({},RO),{},{type:r})}),vee=(t,e)=>t.polarAxis.radiusAxis[e],c2=Ie([vee,P4],(t,e)=>{var n;if(t!=null)return t;var r=(n=TS(e,"radiusAxis",NO.type))!==null&&n!==void 0?n:"category";return Rw(Rw({},NO),{},{type:r})}),CS=t=>t.polarOptions,u2=Ie([tu,nu,$i],jJ),oz=Ie([CS,u2],(t,e)=>{if(t!=null)return Ad(t.innerRadius,e,0)}),az=Ie([CS,u2],(t,e)=>{if(t!=null)return Ad(t.outerRadius,e,e*.8)}),yee=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},lz=Ie([CS],yee);Ie([l2,lz],AS);var cz=Ie([u2,oz,az],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});Ie([c2,cz],AS);var uz=Ie([gr,CS,oz,az,tu,nu],(t,e,n,r,i,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var o=e.cx,a=e.cy,l=e.startAngle,c=e.endAngle;return{cx:Ad(o,i,i/2),cy:Ad(a,s,s/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),Mi=(t,e)=>e,PS=(t,e,n)=>n;function d2(t){return t==null?void 0:t.id}function dz(t,e,n){var r=e.chartData,i=r===void 0?[]:r,s=n.allowDuplicatedCategory,o=n.dataKey,a=new Map;return t.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:i;if(!(d==null||d.length===0)){var f=d2(l);d.forEach((g,y)=>{var x=o==null||s?y:String(wi(g,o,null)),S=wi(g,l.dataKey,0),w;a.has(x)?w=a.get(x):w={},Object.assign(w,{[f]:S}),a.set(x,w)})}}),Array.from(a.values())}function f2(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var RS=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function NS(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function xee(t,e){if(t.length===e.length){for(var n=0;n{var e=gr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Xg=t=>t.tooltip.settings.axisId;function h2(t){if(t!=null){var e=t.ticks,n=t.bandwidth,r=t.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>t.domain(),range:(function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],a=i[1];return o<=a?s>=o&&s<=a:s>=a&&s<=o},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,o)=>{var a=t(s);if(a!=null){if(t.bandwidth&&o!==null&&o!==void 0&&o.position){var l=t.bandwidth();switch(o.position){case"middle":a+=l/2;break;case"end":a+=l;break}}return a}}}}}var bee=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!Tl(e)){for(var n,r,i=0;ir)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return e}default:return e}};function wd(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function _ee(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function p2(t){let e,n,r;t.length!==2?(e=wd,n=(a,l)=>wd(t(a),l),r=(a,l)=>t(a)-l):(e=t===wd||t===_ee?t:wee,n=t,r=t);function i(a,l,c=0,d=a.length){if(c>>1;n(a[f],l)<0?c=f+1:d=f}while(c>>1;n(a[f],l)<=0?c=f+1:d=f}while(cc&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function wee(){return 0}function fz(t){return t===null?NaN:+t}function*See(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const Mee=p2(wd),Jy=Mee.right;p2(fz).center;class IO extends Map{constructor(e,n=Tee){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(kO(this,e))}has(e){return super.has(kO(this,e))}set(e,n){return super.set(Eee(this,e),n)}delete(e){return super.delete(Aee(this,e))}}function kO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function Eee({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function Aee({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function Tee(t){return t!==null&&typeof t=="object"?t.valueOf():t}function Cee(t=wd){if(t===wd)return hz;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function hz(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const Pee=Math.sqrt(50),Ree=Math.sqrt(10),Nee=Math.sqrt(2);function Nw(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=Pee?10:s>=Ree?5:s>=Nee?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/o,a=Math.round(t*c),l=Math.round(e*c),a/ce&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(t/c),l=Math.round(e/c),a*ce&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let c=0;c=r)&&(n=r);return n}function LO(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function pz(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?hz:Cee(i);r>n;){if(r-n>600){const l=r-n+1,c=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),g=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),y=Math.max(n,Math.floor(e-c*f/l+g)),x=Math.min(r,Math.floor(e+(l-c)*f/l+g));pz(t,e,y,x,i)}const s=t[e];let o=n,a=r;for(u0(t,n,e),i(t[r],s)>0&&u0(t,n,r);o0;)--a}i(t[n],s)===0?u0(t,n,a):(++a,u0(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function u0(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Iee(t,e,n){if(t=Float64Array.from(See(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return LO(t);if(e>=1)return OO(t);var r,i=(r-1)*e,s=Math.floor(i),o=OO(pz(t,s).subarray(0,s+1)),a=LO(t.subarray(s+1));return o+(a-o)*(i-s)}}function kee(t,e,n=fz){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,s=Math.floor(i),o=+n(t[s],s,t),a=+n(t[s+1],s+1,t);return o+(a-o)*(i-s)}}function Oee(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,s=new Array(i);++r>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Rb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Rb(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=jee.exec(t))?new Js(e[1],e[2],e[3],1):(e=Uee.exec(t))?new Js(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Fee.exec(t))?Rb(e[1],e[2],e[3],e[4]):(e=zee.exec(t))?Rb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Bee.exec(t))?HO(e[1],e[2]/100,e[3]/100,1):(e=Hee.exec(t))?HO(e[1],e[2]/100,e[3]/100,e[4]):DO.hasOwnProperty(t)?FO(DO[t]):t==="transparent"?new Js(NaN,NaN,NaN,0):null}function FO(t){return new Js(t>>16&255,t>>8&255,t&255,1)}function Rb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Js(t,e,n,r)}function Wee(t){return t instanceof ex||(t=_y(t)),t?(t=t.rgb(),new Js(t.r,t.g,t.b,t.opacity)):new Js}function NC(t,e,n,r){return arguments.length===1?Wee(t):new Js(t,e,n,r??1)}function Js(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}v2(Js,NC,gz(ex,{brighter(t){return t=t==null?Iw:Math.pow(Iw,t),new Js(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?xy:Math.pow(xy,t),new Js(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Js(Mh(this.r),Mh(this.g),Mh(this.b),kw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:zO,formatHex:zO,formatHex8:$ee,formatRgb:BO,toString:BO}));function zO(){return`#${rh(this.r)}${rh(this.g)}${rh(this.b)}`}function $ee(){return`#${rh(this.r)}${rh(this.g)}${rh(this.b)}${rh((isNaN(this.opacity)?1:this.opacity)*255)}`}function BO(){const t=kw(this.opacity);return`${t===1?"rgb(":"rgba("}${Mh(this.r)}, ${Mh(this.g)}, ${Mh(this.b)}${t===1?")":`, ${t})`}`}function kw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Mh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function rh(t){return t=Mh(t),(t<16?"0":"")+t.toString(16)}function HO(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new za(t,e,n,r)}function vz(t){if(t instanceof za)return new za(t.h,t.s,t.l,t.opacity);if(t instanceof ex||(t=_y(t)),!t)return new za;if(t instanceof za)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n0&&l<1?0:o,new za(o,a,l,t.opacity)}function Xee(t,e,n,r){return arguments.length===1?vz(t):new za(t,e,n,r??1)}function za(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}v2(za,Xee,gz(ex,{brighter(t){return t=t==null?Iw:Math.pow(Iw,t),new za(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?xy:Math.pow(xy,t),new za(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Js(LE(t>=240?t-240:t+120,i,r),LE(t,i,r),LE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new za(VO(this.h),Nb(this.s),Nb(this.l),kw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=kw(this.opacity);return`${t===1?"hsl(":"hsla("}${VO(this.h)}, ${Nb(this.s)*100}%, ${Nb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function VO(t){return t=(t||0)%360,t<0?t+360:t}function Nb(t){return Math.max(0,Math.min(1,t||0))}function LE(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const y2=t=>()=>t;function qee(t,e){return function(n){return t+n*e}}function Kee(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Yee(t){return(t=+t)==1?yz:function(e,n){return n-e?Kee(e,n,t):y2(isNaN(e)?n:e)}}function yz(t,e){var n=e-t;return n?qee(t,n):y2(isNaN(t)?e:t)}const GO=(function t(e){var n=Yee(e);function r(i,s){var o=n((i=NC(i)).r,(s=NC(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=yz(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=a(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=t,r})(1);function Zee(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;in&&(s=e.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:Ow(r,i)})),n=DE.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function lte(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i2?cte:lte,l=c=null,f}function f(g){return g==null||isNaN(g=+g)?s:(l||(l=a(t.map(r),e,n)))(r(o(g)))}return f.invert=function(g){return o(i((c||(c=a(e,t.map(r),Ow)))(g)))},f.domain=function(g){return arguments.length?(t=Array.from(g,Lw),d()):t.slice()},f.range=function(g){return arguments.length?(e=Array.from(g),d()):e.slice()},f.rangeRound=function(g){return e=Array.from(g),n=x2,d()},f.clamp=function(g){return arguments.length?(o=g?!0:Ts,d()):o!==Ts},f.interpolate=function(g){return arguments.length?(n=g,d()):n},f.unknown=function(g){return arguments.length?(s=g,f):s},function(g,y){return r=g,i=y,d()}}function b2(){return IS()(Ts,Ts)}function ute(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Dw(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Tg(t){return t=Dw(Math.abs(t)),t?t[1]:NaN}function dte(t,e){return function(n,r){for(var i=n.length,s=[],o=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=t[o=(o+1)%t.length];return s.reverse().join(e)}}function fte(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var hte=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wy(t){if(!(e=hte.exec(t)))throw new Error("invalid format: "+t);var e;return new _2({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}wy.prototype=_2.prototype;function _2(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}_2.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function pte(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var jw;function mte(t,e){var n=Dw(t,e);if(!n)return jw=void 0,t.toPrecision(e);var r=n[0],i=n[1],s=i-(jw=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Dw(t,Math.max(0,e+s-1))[0]}function $O(t,e){var n=Dw(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const XO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:ute,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>$O(t*100,e),r:$O,s:mte,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function qO(t){return t}var KO=Array.prototype.map,YO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function gte(t){var e=t.grouping===void 0||t.thousands===void 0?qO:dte(KO.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?qO:fte(KO.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f,g){f=wy(f);var y=f.fill,x=f.align,S=f.sign,w=f.symbol,b=f.zero,M=f.width,T=f.comma,C=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):XO[N]||(C===void 0&&(C=12),O=!0,N="g"),(b||y==="0"&&x==="=")&&(b=!0,y="0",x="=");var L=(g&&g.prefix!==void 0?g.prefix:"")+(w==="$"?n:w==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),F=(w==="$"?r:/[%p]/.test(N)?o:"")+(g&&g.suffix!==void 0?g.suffix:""),G=XO[N],k=/[defgprs%]/.test(N);C=C===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function U(H){var te=L,ee=F,pe,ie,fe;if(N==="c")ee=G(H)+ee,H="";else{H=+H;var B=H<0||1/H<0;if(H=isNaN(H)?l:G(Math.abs(H),C),O&&(H=pte(H)),B&&+H==0&&S!=="+"&&(B=!1),te=(B?S==="("?S:a:S==="-"||S==="("?"":S)+te,ee=(N==="s"&&!isNaN(H)&&jw!==void 0?YO[8+jw/3]:"")+ee+(B&&S==="("?")":""),k){for(pe=-1,ie=H.length;++pefe||fe>57){ee=(fe===46?i+H.slice(pe+1):H.slice(pe))+ee,H=H.slice(0,pe);break}}}T&&!b&&(H=e(H,1/0));var Q=te.length+H.length+ee.length,K=Q>1)+te+H+ee+K.slice(Q);break;default:H=K+te+H+ee;break}return s(H)}return U.toString=function(){return f+""},U}function d(f,g){var y=Math.max(-8,Math.min(8,Math.floor(Tg(g)/3)))*3,x=Math.pow(10,-y),S=c((f=wy(f),f.type="f",f),{suffix:YO[8+y/3]});return function(w){return S(x*w)}}return{format:c,formatPrefix:d}}var Ib,w2,xz;vte({thousands:",",grouping:[3],currency:["$",""]});function vte(t){return Ib=gte(t),w2=Ib.format,xz=Ib.formatPrefix,Ib}function yte(t){return Math.max(0,-Tg(Math.abs(t)))}function xte(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Tg(e)/3)))*3-Tg(Math.abs(t)))}function bte(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Tg(e)-Tg(t))+1}function bz(t,e,n,r){var i=PC(t,e,n),s;switch(r=wy(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=xte(i,o))&&(r.precision=s),xz(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=bte(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=yte(i))&&(r.precision=s-(r.type==="%")*2);break}}return w2(r)}function Nd(t){var e=t.domain;return t.ticks=function(n){var r=e();return TC(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return bz(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,s=r.length-1,o=r[i],a=r[s],l,c,d=10;for(a0;){if(c=CC(o,a,n),c===l)return r[i]=o,r[s]=a,e(r);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return t},t}function _z(){var t=b2();return t.copy=function(){return tx(t,_z())},ra.apply(t,arguments),Nd(t)}function wz(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Lw),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return wz(t).unknown(e)},t=arguments.length?Array.from(t,Lw):[0,1],Nd(n)}function Sz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return sMath.pow(t,e)}function Ete(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function JO(t){return(e,n)=>-t(-e,n)}function S2(t){const e=t(ZO,QO),n=e.domain;let r=10,i,s;function o(){return i=Ete(r),s=Mte(r),n()[0]<0?(i=JO(i),s=JO(s),t(_te,wte)):t(ZO,QO),e}return e.base=function(a){return arguments.length?(r=+a,o()):r},e.domain=function(a){return arguments.length?(n(a),o()):n()},e.ticks=a=>{const l=n();let c=l[0],d=l[l.length-1];const f=d0){for(;g<=y;++g)for(x=1;xd)break;b.push(S)}}else for(;g<=y;++g)for(x=r-1;x>=1;--x)if(S=g>0?x/s(-g):x*s(g),!(Sd)break;b.push(S)}b.length*2{if(a==null&&(a=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=wy(l)).precision==null&&(l.trim=!0),l=w2(l)),a===1/0)return l;const c=Math.max(1,r*a/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(Sz(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),e}function Mz(){const t=S2(IS()).domain([1,10]);return t.copy=()=>tx(t,Mz()).base(t.base()),ra.apply(t,arguments),t}function eL(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function tL(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function M2(t){var e=1,n=t(eL(e),tL(e));return n.constant=function(r){return arguments.length?t(eL(e=+r),tL(e)):e},Nd(n)}function Ez(){var t=M2(IS());return t.copy=function(){return tx(t,Ez()).constant(t.constant())},ra.apply(t,arguments)}function nL(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Ate(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Tte(t){return t<0?-t*t:t*t}function E2(t){var e=t(Ts,Ts),n=1;function r(){return n===1?t(Ts,Ts):n===.5?t(Ate,Tte):t(nL(n),nL(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Nd(e)}function A2(){var t=E2(IS());return t.copy=function(){return tx(t,A2()).exponent(t.exponent())},ra.apply(t,arguments),t}function Cte(){return A2.apply(null,arguments).exponent(.5)}function rL(t){return Math.sign(t)*t*t}function Pte(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function Az(){var t=b2(),e=[0,1],n=!1,r;function i(s){var o=Pte(t(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return t.invert(rL(s))},i.domain=function(s){return arguments.length?(t.domain(s),i):t.domain()},i.range=function(s){return arguments.length?(t.range((e=Array.from(s,Lw)).map(rL)),i):e.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(t.clamp(s),i):t.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return Az(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},ra.apply(i,arguments),Nd(i)}function Tz(){var t=[],e=[],n=[],r;function i(){var o=0,a=Math.max(1,e.length);for(n=new Array(a-1);++o0?n[a-1]:t[0],a=n?[r[n-1],e]:[r[c-1],r[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Cz().domain([t,e]).range(i).unknown(s)},ra.apply(Nd(o),arguments)}function Pz(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[Jy(t,s,0,r)]:n}return i.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var o=e.indexOf(s);return[t[o-1],t[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return Pz().domain(t).range(e).unknown(n)},ra.apply(i,arguments)}const jE=new Date,UE=new Date;function ui(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const o=i(s),a=i.ceil(s);return s-o(e(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,a)=>{const l=[];if(s=i.ceil(s),a=a==null?1:Math.floor(a),!(s0))return l;let c;do l.push(c=new Date(+s)),e(s,a),t(s);while(cui(o=>{if(o>=o)for(;t(o),!s(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;e(o,-1),!s(o););else for(;--a>=0;)for(;e(o,1),!s(o););}),n&&(i.count=(s,o)=>(jE.setTime(+s),UE.setTime(+o),t(jE),t(UE),Math.floor(n(jE,UE))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Uw=ui(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Uw.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?ui(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Uw);Uw.range;const zc=1e3,Yo=zc*60,Bc=Yo*60,Yc=Bc*24,T2=Yc*7,iL=Yc*30,FE=Yc*365,ih=ui(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*zc)},(t,e)=>(e-t)/zc,t=>t.getUTCSeconds());ih.range;const C2=ui(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zc)},(t,e)=>{t.setTime(+t+e*Yo)},(t,e)=>(e-t)/Yo,t=>t.getMinutes());C2.range;const P2=ui(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Yo)},(t,e)=>(e-t)/Yo,t=>t.getUTCMinutes());P2.range;const R2=ui(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zc-t.getMinutes()*Yo)},(t,e)=>{t.setTime(+t+e*Bc)},(t,e)=>(e-t)/Bc,t=>t.getHours());R2.range;const N2=ui(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Bc)},(t,e)=>(e-t)/Bc,t=>t.getUTCHours());N2.range;const nx=ui(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Yo)/Yc,t=>t.getDate()-1);nx.range;const kS=ui(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>t.getUTCDate()-1);kS.range;const Rz=ui(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>Math.floor(t/Yc));Rz.range;function Zh(t){return ui(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Yo)/T2)}const OS=Zh(0),Fw=Zh(1),Rte=Zh(2),Nte=Zh(3),Cg=Zh(4),Ite=Zh(5),kte=Zh(6);OS.range;Fw.range;Rte.range;Nte.range;Cg.range;Ite.range;kte.range;function Qh(t){return ui(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/T2)}const LS=Qh(0),zw=Qh(1),Ote=Qh(2),Lte=Qh(3),Pg=Qh(4),Dte=Qh(5),jte=Qh(6);LS.range;zw.range;Ote.range;Lte.range;Pg.range;Dte.range;jte.range;const I2=ui(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());I2.range;const k2=ui(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());k2.range;const Zc=ui(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Zc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ui(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Zc.range;const Qc=ui(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Qc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ui(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Qc.range;function Nz(t,e,n,r,i,s){const o=[[ih,1,zc],[ih,5,5*zc],[ih,15,15*zc],[ih,30,30*zc],[s,1,Yo],[s,5,5*Yo],[s,15,15*Yo],[s,30,30*Yo],[i,1,Bc],[i,3,3*Bc],[i,6,6*Bc],[i,12,12*Bc],[r,1,Yc],[r,2,2*Yc],[n,1,T2],[e,1,iL],[e,3,3*iL],[t,1,FE]];function a(c,d,f){const g=dw).right(o,g);if(y===o.length)return t.every(PC(c/FE,d/FE,f));if(y===0)return Uw.every(Math.max(PC(c,d,f),1));const[x,S]=o[g/o[y-1][2]53)return null;"w"in ue||(ue.w=1),"Z"in ue?(Ve=BE(d0(ue.y,0,1)),Oe=Ve.getUTCDay(),Ve=Oe>4||Oe===0?zw.ceil(Ve):zw(Ve),Ve=kS.offset(Ve,(ue.V-1)*7),ue.y=Ve.getUTCFullYear(),ue.m=Ve.getUTCMonth(),ue.d=Ve.getUTCDate()+(ue.w+6)%7):(Ve=zE(d0(ue.y,0,1)),Oe=Ve.getDay(),Ve=Oe>4||Oe===0?Fw.ceil(Ve):Fw(Ve),Ve=nx.offset(Ve,(ue.V-1)*7),ue.y=Ve.getFullYear(),ue.m=Ve.getMonth(),ue.d=Ve.getDate()+(ue.w+6)%7)}else("W"in ue||"U"in ue)&&("w"in ue||(ue.w="u"in ue?ue.u%7:"W"in ue?1:0),Oe="Z"in ue?BE(d0(ue.y,0,1)).getUTCDay():zE(d0(ue.y,0,1)).getDay(),ue.m=0,ue.d="W"in ue?(ue.w+6)%7+ue.W*7-(Oe+5)%7:ue.w+ue.U*7-(Oe+6)%7);return"Z"in ue?(ue.H+=ue.Z/100|0,ue.M+=ue.Z%100,BE(ue)):zE(ue)}}function F(Se,je,$e,ue){for(var Z=0,Ve=je.length,Oe=$e.length,Ge,et;Z=Oe)return-1;if(Ge=je.charCodeAt(Z++),Ge===37){if(Ge=je.charAt(Z++),et=O[Ge in sL?je.charAt(Z++):Ge],!et||(ue=et(Se,$e,ue))<0)return-1}else if(Ge!=$e.charCodeAt(ue++))return-1}return ue}function G(Se,je,$e){var ue=c.exec(je.slice($e));return ue?(Se.p=d.get(ue[0].toLowerCase()),$e+ue[0].length):-1}function k(Se,je,$e){var ue=y.exec(je.slice($e));return ue?(Se.w=x.get(ue[0].toLowerCase()),$e+ue[0].length):-1}function U(Se,je,$e){var ue=f.exec(je.slice($e));return ue?(Se.w=g.get(ue[0].toLowerCase()),$e+ue[0].length):-1}function H(Se,je,$e){var ue=b.exec(je.slice($e));return ue?(Se.m=M.get(ue[0].toLowerCase()),$e+ue[0].length):-1}function te(Se,je,$e){var ue=S.exec(je.slice($e));return ue?(Se.m=w.get(ue[0].toLowerCase()),$e+ue[0].length):-1}function ee(Se,je,$e){return F(Se,e,je,$e)}function pe(Se,je,$e){return F(Se,n,je,$e)}function ie(Se,je,$e){return F(Se,r,je,$e)}function fe(Se){return o[Se.getDay()]}function B(Se){return s[Se.getDay()]}function Q(Se){return l[Se.getMonth()]}function K(Se){return a[Se.getMonth()]}function V(Se){return i[+(Se.getHours()>=12)]}function q(Se){return 1+~~(Se.getMonth()/3)}function he(Se){return o[Se.getUTCDay()]}function ae(Se){return s[Se.getUTCDay()]}function ce(Se){return l[Se.getUTCMonth()]}function we(Se){return a[Se.getUTCMonth()]}function Ee(Se){return i[+(Se.getUTCHours()>=12)]}function Xe(Se){return 1+~~(Se.getUTCMonth()/3)}return{format:function(Se){var je=N(Se+="",T);return je.toString=function(){return Se},je},parse:function(Se){var je=L(Se+="",!1);return je.toString=function(){return Se},je},utcFormat:function(Se){var je=N(Se+="",C);return je.toString=function(){return Se},je},utcParse:function(Se){var je=L(Se+="",!0);return je.toString=function(){return Se},je}}}var sL={"-":"",_:" ",0:"0"},Ai=/^\s*\d+/,Vte=/^%/,Gte=/[\\^$*+?|[\]().{}]/g;function Bn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function $te(t,e,n){var r=Ai.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Xte(t,e,n){var r=Ai.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function qte(t,e,n){var r=Ai.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Kte(t,e,n){var r=Ai.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Yte(t,e,n){var r=Ai.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function oL(t,e,n){var r=Ai.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function aL(t,e,n){var r=Ai.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Zte(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Qte(t,e,n){var r=Ai.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Jte(t,e,n){var r=Ai.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function lL(t,e,n){var r=Ai.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ene(t,e,n){var r=Ai.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function cL(t,e,n){var r=Ai.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function tne(t,e,n){var r=Ai.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function nne(t,e,n){var r=Ai.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function rne(t,e,n){var r=Ai.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function ine(t,e,n){var r=Ai.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function sne(t,e,n){var r=Vte.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function one(t,e,n){var r=Ai.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function ane(t,e,n){var r=Ai.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function uL(t,e){return Bn(t.getDate(),e,2)}function lne(t,e){return Bn(t.getHours(),e,2)}function cne(t,e){return Bn(t.getHours()%12||12,e,2)}function une(t,e){return Bn(1+nx.count(Zc(t),t),e,3)}function Iz(t,e){return Bn(t.getMilliseconds(),e,3)}function dne(t,e){return Iz(t,e)+"000"}function fne(t,e){return Bn(t.getMonth()+1,e,2)}function hne(t,e){return Bn(t.getMinutes(),e,2)}function pne(t,e){return Bn(t.getSeconds(),e,2)}function mne(t){var e=t.getDay();return e===0?7:e}function gne(t,e){return Bn(OS.count(Zc(t)-1,t),e,2)}function kz(t){var e=t.getDay();return e>=4||e===0?Cg(t):Cg.ceil(t)}function vne(t,e){return t=kz(t),Bn(Cg.count(Zc(t),t)+(Zc(t).getDay()===4),e,2)}function yne(t){return t.getDay()}function xne(t,e){return Bn(Fw.count(Zc(t)-1,t),e,2)}function bne(t,e){return Bn(t.getFullYear()%100,e,2)}function _ne(t,e){return t=kz(t),Bn(t.getFullYear()%100,e,2)}function wne(t,e){return Bn(t.getFullYear()%1e4,e,4)}function Sne(t,e){var n=t.getDay();return t=n>=4||n===0?Cg(t):Cg.ceil(t),Bn(t.getFullYear()%1e4,e,4)}function Mne(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Bn(e/60|0,"0",2)+Bn(e%60,"0",2)}function dL(t,e){return Bn(t.getUTCDate(),e,2)}function Ene(t,e){return Bn(t.getUTCHours(),e,2)}function Ane(t,e){return Bn(t.getUTCHours()%12||12,e,2)}function Tne(t,e){return Bn(1+kS.count(Qc(t),t),e,3)}function Oz(t,e){return Bn(t.getUTCMilliseconds(),e,3)}function Cne(t,e){return Oz(t,e)+"000"}function Pne(t,e){return Bn(t.getUTCMonth()+1,e,2)}function Rne(t,e){return Bn(t.getUTCMinutes(),e,2)}function Nne(t,e){return Bn(t.getUTCSeconds(),e,2)}function Ine(t){var e=t.getUTCDay();return e===0?7:e}function kne(t,e){return Bn(LS.count(Qc(t)-1,t),e,2)}function Lz(t){var e=t.getUTCDay();return e>=4||e===0?Pg(t):Pg.ceil(t)}function One(t,e){return t=Lz(t),Bn(Pg.count(Qc(t),t)+(Qc(t).getUTCDay()===4),e,2)}function Lne(t){return t.getUTCDay()}function Dne(t,e){return Bn(zw.count(Qc(t)-1,t),e,2)}function jne(t,e){return Bn(t.getUTCFullYear()%100,e,2)}function Une(t,e){return t=Lz(t),Bn(t.getUTCFullYear()%100,e,2)}function Fne(t,e){return Bn(t.getUTCFullYear()%1e4,e,4)}function zne(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Pg(t):Pg.ceil(t),Bn(t.getUTCFullYear()%1e4,e,4)}function Bne(){return"+0000"}function fL(){return"%"}function hL(t){return+t}function pL(t){return Math.floor(+t/1e3)}var cm,Dz,jz;Hne({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Hne(t){return cm=Hte(t),Dz=cm.format,cm.parse,jz=cm.utcFormat,cm.utcParse,cm}function Vne(t){return new Date(t)}function Gne(t){return t instanceof Date?+t:+new Date(+t)}function O2(t,e,n,r,i,s,o,a,l,c){var d=b2(),f=d.invert,g=d.domain,y=c(".%L"),x=c(":%S"),S=c("%I:%M"),w=c("%I %p"),b=c("%a %d"),M=c("%b %d"),T=c("%B"),C=c("%Y");function O(N){return(l(N)e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>Iee(t,s/r))},n.copy=function(){return Bz(e).domain(t)},ru.apply(n,arguments)}function jS(){var t=0,e=.5,n=1,r=1,i,s,o,a,l,c=Ts,d,f=!1,g;function y(S){return isNaN(S=+S)?g:(S=.5+((S=+d(S))-s)*(r*S{if(t!=null){var r=t.scale,i=t.type;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!e)?"point":i==="category"?"band":"linear";if(typeof r=="string")return Zne(r)?r:"point"}};function Qne(t,e){for(var n=0,r=t.length,i=t[0]e)?n=s+1:r=s}return n}function Xz(t,e){if(t){var n=e??t.domain(),r=n.map(s=>{var o;return(o=t(s))!==null&&o!==void 0?o:0}),i=t.range();if(!(n.length===0||i.length<2))return s=>{var o,a,l=Qne(r,s);if(l<=0)return n[0];if(l>=n.length)return n[n.length-1];var c=(o=r[l-1])!==null&&o!==void 0?o:0,d=(a=r[l])!==null&&a!==void 0?a:0;return Math.abs(s-c)<=Math.abs(s-d)?n[l-1]:n[l]}}}function Jne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Xz(t,void 0)}function gL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Bw(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);nt.cartesianAxis.xAxis[e],iu=(t,e)=>{var n=Kz(t,e);return n??ii},si={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:OC,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:qy},Yz=(t,e)=>t.cartesianAxis.yAxis[e],su=(t,e)=>{var n=Yz(t,e);return n??si},are={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},U2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??are},Ns=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"zAxis":return U2(t,n);case"angleAxis":return l2(t,n);case"radiusAxis":return c2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},lre=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},rx=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"angleAxis":return l2(t,n);case"radiusAxis":return c2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Zz=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function Qz(t,e){return n=>{switch(t){case"xAxis":return"xAxisId"in n&&n.xAxisId===e;case"yAxis":return"yAxisId"in n&&n.yAxisId===e;case"zAxis":return"zAxisId"in n&&n.zAxisId===e;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===e;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===e;default:return!1}}}var Jz=t=>t.graphicalItems.cartesianItems,cre=Ie([Mi,PS],Qz),eB=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),Kg=Ie([Jz,Ns,cre],eB,{memoizeOptions:{resultEqualityCheck:NS}}),tB=Ie([Kg],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(f2)),nB=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),ure=Ie([Kg],nB),rB=t=>t.map(e=>e.data).filter(Boolean).flat(1),dre=Ie([Kg],t=>t.some(e=>!e.data)),iB=Ie([Kg],rB,{memoizeOptions:{resultEqualityCheck:NS}}),sB=(t,e)=>{var n=e.chartData,r=n===void 0?[]:n,i=e.dataStartIndex,s=e.dataEndIndex;return t.length>0?t:r.slice(i,s+1)},F2=Ie([iB,MS],sB),fre=(t,e,n)=>(e==null?void 0:e.dataKey)!=null?t.map(r=>({value:wi(r,e.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>t.map(i=>({value:wi(i,r)}))):t.map(r=>({value:r})),oB=(t,e,n,r,i,s)=>{var o=r.chartData,a=o===void 0?[]:o,l=r.dataStartIndex,c=r.dataEndIndex,d=fre(t,e,n);if(i&&(e==null?void 0:e.dataKey)!=null&&s.length>0){var f=a.slice(l,c+1),g=f.map(y=>({value:wi(y,e.dataKey)})).filter(y=>y.value!=null);return[...g,...d]}return d},ix=Ie([F2,Ns,Kg,MS,dre,iB],oB);function ng(t){if(Ol(t)||t instanceof Date){var e=Number(t);if(An(e))return e}}function yL(t){if(Array.isArray(t)){var e=[ng(t[0]),ng(t[1])];return Tl(e)?e:void 0}var n=ng(t);if(n!=null)return[n,n]}function jl(t){return t.map(ng).filter(Qs)}function hre(t,e){var n=ng(t),r=ng(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var pre=Ie([ix],t=>t==null?void 0:t.map(e=>e.value).sort(hre));function aB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function mre(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!kl(e))r=e;else if(Array.isArray(e)){var i=jl(e);i.length>0&&(r=Math.max(...i))}return r==null?[]:jl(n.flatMap(s=>{var o=wi(t,s.dataKey),a,l;if(Array.isArray(o)){var c=qz(o,2);a=c[0],l=c[1]}else a=l=o;if(!(!An(a)||!An(l)))return[r-a,r+l]}))}var di=t=>{var e=Ei(t),n=Xg(t);return rx(t,e,n)},Rg=Ie([di],t=>t==null?void 0:t.dataKey),gre=Ie([tB,MS,di],dz),lB=(t,e,n,r)=>{var i={},s=e.reduce((o,a)=>{if(a.stackId==null)return o;var l=o[a.stackId];return l==null&&(l=[]),l.push(a),o[a.stackId]=l,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var a=qz(o,2),l=a[0],c=a[1],d=r?[...c].reverse():c,f=d.map(d2);return[l,{stackedData:OY(t,f,n),graphicalItems:d}]}))},cB=Ie([gre,tB,ES,iz],lB),uB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return UY(t,i,s)},vre=Ie([Ns],t=>t.allowDataOverflow),z2=t=>{var e;if(t==null||!("domain"in t))return OC;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=jl(t.ticks);return[Math.min(...n),Math.max(...n)]}if(t.type==="category")return t.ticks.map(String)}return(e=t==null?void 0:t.domain)!==null&&e!==void 0?e:OC},dB=Ie([Ns],z2),fB=Ie([dB,vre],X4),yre=Ie([cB,Xa,Mi,fB],uB,{memoizeOptions:{resultEqualityCheck:RS}}),B2=t=>t.errorBars,xre=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>aB(n,r)),Hw=function(){for(var e=arguments.length,n=new Array(e),r=0;r5&&arguments[5]!==void 0?arguments[5]:[],a,l;if(r.length>0&&r.forEach(c=>{var d,f=c.data!=null?[...c.data]:o,g=(d=i[c.id])===null||d===void 0?void 0:d.filter(y=>aB(s,y));f.forEach(y=>{var x,S=wi(y,(x=n.dataKey)!==null&&x!==void 0?x:c.dataKey),w=mre(y,S,g);if(w.length>=2){var b=Math.min(...w),M=Math.max(...w);(a==null||bl)&&(l=M)}var T=yL(S);T!=null&&(a=a==null?T[0]:Math.min(a,T[0]),l=l==null?T[1]:Math.max(l,T[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&e.forEach(c=>{var d=yL(wi(c,n.dataKey));d!=null&&(a=a==null?d[0]:Math.min(a,d[0]),l=l==null?d[1]:Math.max(l,d[1]))}),An(a)&&An(l))return[a,l]},bre=Ie([F2,Ns,ure,B2,Mi,YJ],hB,{memoizeOptions:{resultEqualityCheck:RS}});function _re(t){var e=t.value;if(Ol(e)||e instanceof Date)return e}var wre=(t,e,n)=>{var r=t.map(_re).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&M5(r))?$4(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},pB=t=>t.referenceElements.dots,Yg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),Sre=Ie([pB,Mi,PS],Yg),mB=t=>t.referenceElements.areas,Mre=Ie([mB,Mi,PS],Yg),gB=t=>t.referenceElements.lines,Ere=Ie([gB,Mi,PS],Yg),vB=(t,e)=>{if(t!=null){var n=jl(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Are=Ie(Sre,Mi,vB),yB=(t,e)=>{if(t!=null){var n=jl(t.flatMap(r=>[e==="xAxis"?r.x1:r.y1,e==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Tre=Ie([Mre,Mi],yB);function Cre(t){var e;if(t.x!=null)return jl([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:jl(n)}function Pre(t){var e;if(t.y!=null)return jl([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:jl(n)}var xB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?Cre(r):Pre(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Rre=Ie([Ere,Mi],xB),Nre=Ie(Are,Rre,Tre,(t,e,n)=>Hw(t,n,e)),bB=(t,e,n,r,i,s,o,a)=>{if(n!=null)return n;var l=o==="vertical"&&a==="xAxis"||o==="horizontal"&&a==="yAxis",c=l?Hw(r,s,i):Hw(s,i);return nee(e,c,t.allowDataOverflow)},Ire=Ie([Ns,dB,fB,yre,bre,Nre,gr,Mi],bB,{memoizeOptions:{resultEqualityCheck:RS}}),kre=[0,1],_B=(t,e,n,r,i,s,o)=>{if(!((t==null||n==null||n.length===0)&&o===void 0)){var a=t.dataKey,l=t.type,c=Bl(e,s);if(c&&a==null){var d;return $4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?wre(r,t,c):i==="expand"&&!c?kre:o}},H2=Ie([Ns,gr,F2,ix,ES,Mi,Ire],_B),Zg=Ie([Ns,Zz,s2],$z),wB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=z2(e),s=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&Tl(t)){if(s)return TO(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return CO(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&Tl(t))return TO(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&Tl(t))return CO(t,e.tickCount,e.allowDecimals,"adaptive")}}},V2=Ie([H2,rx,Zg],wB),SB=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&Tl(e)&&Array.isArray(n)&&n.length>0){var i,s,o=e[0],a=(i=n[0])!==null&&i!==void 0?i:0,l=e[1],c=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,a),Math.max(l,c)]}return e},Ore=Ie([Ns,H2,V2,Mi],SB),Lre=Ie(ix,Ns,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(jl(t.map(f=>f.value))).sort((f,g)=>f-g),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var a=0;ai,(t,e,n,r,i)=>{if(!An(t))return 0;var s=e==="vertical"?r.height:r.width;if(i==="gap")return t*s/2;if(i==="no-gap"){var o=Ad(n,t*s),a=t*s/2;return a-o-(a-o)/s*o}return 0}),Dre=(t,e,n)=>{var r=iu(t,e);return r==null||typeof r.padding!="string"?0:MB(t,"xAxis",e,n,r.padding)},jre=(t,e,n)=>{var r=su(t,e);return r==null||typeof r.padding!="string"?0:MB(t,"yAxis",e,n,r.padding)},Ure=Ie(iu,Dre,(t,e)=>{var n,r;if(t==null)return{left:0,right:0};var i=t.padding;return typeof i=="string"?{left:e,right:e}:{left:((n=i.left)!==null&&n!==void 0?n:0)+e,right:((r=i.right)!==null&&r!==void 0?r:0)+e}}),Fre=Ie(su,jre,(t,e)=>{var n,r;if(t==null)return{top:0,bottom:0};var i=t.padding;return typeof i=="string"?{top:e,bottom:e}:{top:((n=i.top)!==null&&n!==void 0?n:0)+e,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+e}}),EB=Ie([$i,Ure,yS,vS,(t,e,n)=>n],(t,e,n,r,i)=>{var s=r.padding;return i?[s.left,n.width-s.right]:[t.left+e.left,t.left+t.width-e.right]}),AB=Ie([$i,gr,Fre,yS,vS,(t,e,n)=>n],(t,e,n,r,i,s)=>{var o=i.padding;return s?[r.height-o.bottom,o.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),sx=(t,e,n,r)=>{var i;switch(e){case"xAxis":return EB(t,n,r);case"yAxis":return AB(t,n,r);case"zAxis":return(i=U2(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return lz(t);case"radiusAxis":return cz(t,n);default:return}},TB=Ie([Ns,sx],AS),zre=Ie([Zg,Ore],bee),G2=Ie([Ns,Zg,zre,TB],j2),CB=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var i=n.type,s=n.scale,o=Bl(t,r);if(o&&(i==="number"||s!=="auto"))return e.map(a=>a.value)}},W2=Ie([gr,ix,rx,Mi],CB),US=Ie([G2],h2);Ie([G2],Jne);Ie([G2,pre],Xz);Ie([Kg,B2,Mi],xre);function PB(t,e){return t.ide.id?1:0}var FS=(t,e)=>e,zS=(t,e,n)=>n,Bre=Ie(mS,FS,zS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(PB)),Hre=Ie(gS,FS,zS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(PB)),RB=(t,e)=>({width:t.width,height:e.height}),Vre=(t,e)=>{var n=typeof e.width=="number"?e.width:qy;return{width:n,height:t.height}},Gre=Ie($i,iu,RB),Wre=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},$re=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},Xre=Ie(nu,$i,Bre,FS,zS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=RB(e,a);o==null&&(o=Wre(e,r,t));var c=r==="top"&&!i||r==="bottom"&&i;s[a.id]=o-Number(c)*l.height,o+=(c?-1:1)*l.height}),s}),qre=Ie(tu,$i,Hre,FS,zS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=Vre(e,a);o==null&&(o=$re(e,r,t));var c=r==="left"&&!i||r==="right"&&i;s[a.id]=o-Number(c)*l.width,o+=(c?-1:1)*l.width}),s}),Kre=(t,e)=>{var n=iu(t,e);if(n!=null)return Xre(t,n.orientation,n.mirror)},Yre=Ie([$i,iu,Kre,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n==null?void 0:n[r];return i==null?{x:t.left,y:0}:{x:t.left,y:i}}}),Zre=(t,e)=>{var n=su(t,e);if(n!=null)return qre(t,n.orientation,n.mirror)},Qre=Ie([$i,su,Zre,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:t.top}:{x:i,y:t.top}}}),Jre=Ie($i,su,(t,e)=>{var n=typeof e.width=="number"?e.width:qy;return{width:n,height:t.height}}),NB=(t,e,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,s=n.type,o=n.dataKey,a=Bl(t,r),l=e.map(d=>d.value),c=l.filter(d=>d!=null);if(o&&a&&s==="category"&&i&&M5(c))return l}},$2=Ie([gr,ix,Ns,Mi],NB),xL=Ie([gr,lre,Zg,US,$2,W2,sx,V2,Mi],(t,e,n,r,i,s,o,a,l)=>{if(e!=null){var c=Bl(t,l);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:l,categoricalDomain:s,duplicateDomain:i,isCategorical:c,niceTicks:a,range:o,realScaleType:n,scale:r}}}),eie=(t,e,n,r,i,s,o,a,l)=>{if(!(e==null||r==null)){var c=Bl(t,l),d=e.type,f=e.ticks,g=e.tickCount,y=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/y:0;x=l==="angleAxis"&&s!=null&&s.length>=2?qo(s[0]-s[1])*2*x:x;var S=f||i;return S?S.map((w,b)=>{var M=o?o.indexOf(w):w,T=r.map(M);return An(T)?{index:b,coordinate:T+x,value:w,offset:x}:null}).filter(Qs):c&&a?a.map((w,b)=>{var M=r.map(w);return An(M)?{coordinate:M+x,value:w,index:b,offset:x}:null}).filter(Qs):r.ticks?r.ticks(g).map((w,b)=>{var M=r.map(w);return An(M)?{coordinate:M+x,value:w,index:b,offset:x}:null}).filter(Qs):r.domain().map((w,b)=>{var M=r.map(w);return An(M)?{coordinate:M+x,value:o?o[w]:w,index:b,offset:x}:null}).filter(Qs)}},IB=Ie([gr,rx,Zg,US,V2,sx,$2,W2,Mi],eie),tie=(t,e,n,r,i,s,o)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var a=Bl(t,o),l=e.tickCount,c=0;return c=o==="angleAxis"&&(r==null?void 0:r.length)>=2?qo(r[0]-r[1])*2*c:c,a&&s?s.map((d,f)=>{var g=n.map(d);return An(g)?{coordinate:g+c,value:d,index:f,offset:c}:null}).filter(Qs):n.ticks?n.ticks(l).map((d,f)=>{var g=n.map(d);return An(g)?{coordinate:g+c,value:d,index:f,offset:c}:null}).filter(Qs):n.domain().map((d,f)=>{var g=n.map(d);return An(g)?{coordinate:g+c,value:i?i[d]:d,index:f,offset:c}:null}).filter(Qs)}},kB=Ie([gr,rx,US,sx,$2,W2,Mi],tie),OB=Ie(Ns,US,(t,e)=>{if(!(t==null||e==null))return Bw(Bw({},t),{},{scale:e})}),nie=Ie([Ns,Zg,H2,TB],j2),rie=Ie([nie],h2);Ie((t,e,n)=>U2(t,n),rie,(t,e)=>{if(!(t==null||e==null))return Bw(Bw({},t),{},{scale:e})});var iie=Ie([gr,mS,gS],(t,e,n)=>{switch(t){case"horizontal":return e.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),sie=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};Ie([sie],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,i=t[0];for(var s of t){var o=Math.abs(s.coordinate-e);ot.options.defaultTooltipEventType,DB=t=>t.options.validateTooltipEventTypes;function jB(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function ox(t,e){var n=LB(t),r=DB(t);return jB(e,n,r)}function oie(t){return Gt(e=>ox(e,t))}var UB=(t,e)=>{var n,r=Number(e);if(!(kl(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},aie=t=>t.tooltip.settings,cd={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},lie={itemInteraction:{click:cd,hover:cd},axisInteraction:{click:cd,hover:cd},keyboardInteraction:cd,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},FB=ds({name:"tooltip",initialState:lie,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:cr()},replaceTooltipEntrySettings:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=Ko(t).tooltipItemPayloads.indexOf(r);s>-1&&(t.tooltipItemPayloads[s]=i)},prepare:cr()},removeTooltipEntrySettings:{reducer(t,e){var n=Ko(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:cr()},setTooltipSettingsState(t,e){t.settings=e.payload},setActiveMouseOverItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.itemInteraction.hover.active=!0,t.itemInteraction.hover.index=e.payload.activeIndex,t.itemInteraction.hover.dataKey=e.payload.activeDataKey,t.itemInteraction.hover.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.hover.coordinate=e.payload.activeCoordinate},mouseLeaveChart(t){t.itemInteraction.hover.active=!1,t.axisInteraction.hover.active=!1},mouseLeaveItem(t){t.itemInteraction.hover.active=!1},setActiveClickItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.itemInteraction.click.active=!0,t.keyboardInteraction.active=!1,t.itemInteraction.click.index=e.payload.activeIndex,t.itemInteraction.click.dataKey=e.payload.activeDataKey,t.itemInteraction.click.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.click.coordinate=e.payload.activeCoordinate},setMouseOverAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.axisInteraction.hover.active=!0,t.keyboardInteraction.active=!1,t.axisInteraction.hover.index=e.payload.activeIndex,t.axisInteraction.hover.dataKey=e.payload.activeDataKey,t.axisInteraction.hover.coordinate=e.payload.activeCoordinate},setMouseClickAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.axisInteraction.click.active=!0,t.axisInteraction.click.index=e.payload.activeIndex,t.axisInteraction.click.dataKey=e.payload.activeDataKey,t.axisInteraction.click.coordinate=e.payload.activeCoordinate},setSyncInteraction(t,e){t.syncInteraction=e.payload},setKeyboardInteraction(t,e){t.keyboardInteraction.active=e.payload.active,t.keyboardInteraction.index=e.payload.activeIndex,t.keyboardInteraction.coordinate=e.payload.activeCoordinate}}}),ia=FB.actions,cie=ia.addTooltipEntrySettings,uie=ia.replaceTooltipEntrySettings,die=ia.removeTooltipEntrySettings,fie=ia.setTooltipSettingsState,hie=ia.setActiveMouseOverItemIndex;ia.mouseLeaveItem;var zB=ia.mouseLeaveChart;ia.setActiveClickItemIndex;var BB=ia.setMouseOverAxisIndex,pie=ia.setMouseClickAxisIndex,B0=ia.setSyncInteraction,Vw=ia.setKeyboardInteraction,mie=FB.reducer;function bL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function kb(t){for(var e=1;e{if(e==null)return cd;var i=xie(t,e,n);if(i==null)return cd;if(i.active)return i;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&t.syncInteraction.index!=null)return t.syncInteraction;var s=t.settings.active===!0;if(bie(i)){if(s)return kb(kb({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return kb(kb({},cd),{},{coordinate:i.coordinate})};function _ie(t){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(t instanceof Date){var e=t.valueOf();return Number.isFinite(e)?e:void 0}var n=Number(t);return Number.isFinite(n)?n:void 0}function wie(t,e){var n=_ie(t),r=e[0],i=e[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function Sie(t,e,n){if(n==null||e==null)return!0;var r=wi(t,e);return r==null||!Tl(n)?!0:wie(r,n)}var $0=(t,e,n,r)=>{var i=t==null?void 0:t.index;if(i==null)return null;var s=Number(i);if(!An(s))return i;var o=0,a=1/0;e.length>0&&(a=e.length-1);var l=Math.max(o,Math.min(s,a)),c=e[l];return c==null||Sie(c,n,r)?String(l):null},VB=(t,e,n,r,i,s,o)=>{if(s!=null){var a=o[0],l=a==null?void 0:a.getPosition(s);if(l!=null)return l;var c=i==null?void 0:i[Number(s)];if(c)switch(n){case"horizontal":return{x:c.coordinate,y:(r.top+e)/2};default:return{x:(r.left+t)/2,y:c.coordinate}}}},GB=(t,e,n,r)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=t.itemInteraction.hover.graphicalItemId:i=t.itemInteraction.click.graphicalItemId,t.syncInteraction.active&&i==null)return t.tooltipItemPayloads;if(i==null&&(r!=null||t.keyboardInteraction.active)){var s=t.tooltipItemPayloads[0];return s!=null?[s]:[]}return t.tooltipItemPayloads.filter(o=>{var a;return((a=o.settings)===null||a===void 0?void 0:a.graphicalItemId)===i})},WB=t=>t.options.tooltipPayloadSearcher,Qg=t=>t.tooltip;function _L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wL(t){for(var e=1;et(e)}function SL(t){if(typeof t=="string")return t}function Rie(t){if(!(t==null||typeof t!="object")){var e="name"in t?Tie(t.name):void 0,n="unit"in t?Cie(t.unit):void 0,r="dataKey"in t?Pie(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?SL(t.color):void 0,o="fill"in t?SL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:o}}}function Nie(t,e){return t??e}var $B=(t,e,n,r,i,s,o)=>{if(!(e==null||s==null)){var a=n.chartData,l=n.computedData,c=n.dataStartIndex,d=n.dataEndIndex,f=[];return t.reduce((g,y)=>{var x,S=y.dataDefinedOnItem,w=y.settings,b=Nie(S,a),M=Array.isArray(b)?v4(b,c,d):b,T=(x=w==null?void 0:w.dataKey)!==null&&x!==void 0?x:r,C=w==null?void 0:w.nameKey,O;if(r&&Array.isArray(M)&&!Array.isArray(M[0])&&o==="axis"?O=E5(M,r,i):O=s(M,e,l,C),Array.isArray(O))O.forEach(L=>{var F,G,k=Rie(L),U=k==null?void 0:k.name,H=k==null?void 0:k.dataKey,te=k==null?void 0:k.payload,ee=wL(wL({},w),{},{name:U,unit:k==null?void 0:k.unit,color:(F=k==null?void 0:k.color)!==null&&F!==void 0?F:w==null?void 0:w.color,fill:(G=k==null?void 0:k.fill)!==null&&G!==void 0?G:w==null?void 0:w.fill});g.push(vk({tooltipEntrySettings:ee,dataKey:H,payload:te,value:wi(te,H),name:U==null?void 0:String(U)}))});else{var N;g.push(vk({tooltipEntrySettings:w,dataKey:T,payload:O,value:wi(O,T),name:(N=wi(O,C))!==null&&N!==void 0?N:w==null?void 0:w.name}))}return g},f)}},X2=Ie([di,Zz,s2],$z),Iie=Ie([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),kie=Ie([Ei,Xg],Qz),Jh=Ie([Iie,di,kie],eB,{memoizeOptions:{resultEqualityCheck:NS}}),Oie=Ie([Jh],t=>t.filter(f2)),XB=Ie([Jh],rB,{memoizeOptions:{resultEqualityCheck:NS}}),Lie=Ie([Jh],t=>t.some(e=>!e.data)),jh=Ie([XB,Xa],sB),Die=Ie([Oie,Xa,di],dz),q2=Ie([jh,di,Jh,Xa,Lie,XB],oB),qB=Ie([di],z2),jie=Ie([di],t=>t.allowDataOverflow),KB=Ie([qB,jie],X4),Uie=Ie([Jh],t=>t.filter(f2)),Fie=Ie([Die,Uie,ES,iz],lB),zie=Ie([Fie,Xa,Ei,KB],uB),Bie=Ie([Jh],nB),Hie=Ie([jh,di,Bie,B2,Ei,ZJ],hB,{memoizeOptions:{resultEqualityCheck:RS}}),Vie=Ie([pB,Ei,Xg],Yg),Gie=Ie([Vie,Ei],vB),Wie=Ie([mB,Ei,Xg],Yg),$ie=Ie([Wie,Ei],yB),Xie=Ie([gB,Ei,Xg],Yg),qie=Ie([Xie,Ei],xB),Kie=Ie([Gie,qie,$ie],Hw),Yie=Ie([di,qB,KB,zie,Hie,Kie,gr,Ei],bB),Ng=Ie([di,gr,jh,q2,ES,Ei,Yie],_B),Zie=Ie([Ng,di,X2],wB),Qie=Ie([di,Ng,Zie,Ei],SB),YB=t=>{var e=Ei(t),n=Xg(t),r=!1;return sx(t,e,n,r)},ZB=Ie([di,YB],AS),Jie=Ie([di,X2,Qie,ZB],j2),QB=Ie([Jie],h2),ese=Ie([gr,q2,di,Ei],NB),tse=Ie([gr,q2,di,Ei],CB),nse=(t,e,n,r,i,s,o,a)=>{if(e){var l=e.type,c=Bl(t,a);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=l==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=a==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?qo(i[0]-i[1])*2*f:f,c&&o?o.map((g,y)=>{var x=r.map(g);return An(x)?{coordinate:x+f,value:g,index:y,offset:f}:null}).filter(Qs):r.domain().map((g,y)=>{var x=r.map(g);return An(x)?{coordinate:x+f,value:s?s[g]:g,index:y,offset:f}:null}).filter(Qs)}}},ou=Ie([gr,di,X2,QB,YB,ese,tse,Ei],nse),K2=Ie([LB,DB,aie],(t,e,n)=>jB(n.shared,t,e)),JB=t=>t.tooltip.settings.trigger,Y2=t=>t.tooltip.settings.defaultIndex,ax=Ie([Qg,K2,JB,Y2],HB),Sy=Ie([ax,jh,Rg,Ng],$0),eH=Ie([ou,Sy],UB),rse=Ie([ax],t=>{if(t)return t.dataKey}),ise=Ie([ax],t=>{if(t)return t.graphicalItemId}),tH=Ie([Qg,K2,JB,Y2],GB),sse=Ie([tu,nu,gr,$i,ou,Y2,tH],VB),ose=Ie([ax,sse],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),ase=Ie([ax],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),lse=Ie([tH,Sy,Xa,Rg,eH,WB,K2],$B),cse=Ie([lse],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function ML(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function EL(t){for(var e=1;eGt(di),pse=()=>{var t=hse(),e=Gt(ou),n=Gt(QB);return xw(!t||!n?void 0:EL(EL({},t),{},{scale:n}),e)};function AL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function um(t){for(var e=1;e{var i=e.find(s=>s&&s.index===n);if(i){if(t==="horizontal")return{x:i.coordinate,y:r.relativeY};if(t==="vertical")return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},xse=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="centric"){var s=i.coordinate,o=r.radius;return um(um(um({},r),Hi(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var a=i.coordinate,l=r.angle;return um(um(um({},r),Hi(r.cx,r.cy,a,l)),{},{angle:l,radius:a})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function bse(t,e){var n=t.relativeX,r=t.relativeY;return n>=e.left&&n<=e.left+e.width&&r>=e.top&&r<=e.top+e.height}var nH=(t,e,n,r,i)=>{var s,o=(s=e==null?void 0:e.length)!==null&&s!==void 0?s:0;if(o<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var a=0;a0?(l=n[a-1])===null||l===void 0?void 0:l.coordinate:(c=n[o-1])===null||c===void 0?void 0:c.coordinate,x=(d=n[a])===null||d===void 0?void 0:d.coordinate,S=a>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(g=n[a+1])===null||g===void 0?void 0:g.coordinate,w=void 0;if(!(y==null||x==null||S==null))if(qo(x-y)!==qo(S-x)){var b=[];if(qo(S-x)===qo(i[1]-i[0])){w=S;var M=x+i[1]-i[0];b[0]=Math.min(M,(M+y)/2),b[1]=Math.max(M,(M+y)/2)}else{w=y;var T=S+i[1]-i[0];b[0]=Math.min(x,(T+x)/2),b[1]=Math.max(x,(T+x)/2)}var C=[Math.min(x,(w+x)/2),Math.max(x,(w+x)/2)];if(t>C[0]&&t<=C[1]||t>=b[0]&&t<=b[1]){var O;return(O=n[a])===null||O===void 0?void 0:O.index}}else{var N=Math.min(y,S),L=Math.max(y,S);if(t>(N+x)/2&&t<=(L+x)/2){var F;return(F=n[a])===null||F===void 0?void 0:F.index}}}else if(e)for(var G=0;G(k.coordinate+H.coordinate)/2||G>0&&G(k.coordinate+H.coordinate)/2&&t<=(k.coordinate+U.coordinate)/2)return k.index}}return-1},rH=()=>Gt(s2),Z2=(t,e)=>e,iH=(t,e,n)=>n,Q2=(t,e,n,r)=>r,_se=Ie(ou,t=>iS(t,e=>e.coordinate)),J2=Ie([Qg,Z2,iH,Q2],HB),eR=Ie([J2,jh,Rg,Ng],$0),wse=(t,e,n)=>{if(e!=null){var r=Qg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},sH=Ie([Qg,Z2,iH,Q2],GB),Gw=Ie([tu,nu,gr,$i,ou,Q2,sH],VB),Sse=Ie([J2,Gw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),oH=Ie([ou,eR],UB),Mse=Ie([sH,eR,Xa,Rg,oH,WB,Z2],$B),Ese=Ie([J2,eR],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),Ase=(t,e,n,r,i,s,o)=>{if(!(!t||!n||!r||!i)&&bse(t,o)){var a=FY(t,e),l=nH(a,s,i,n,r),c=yse(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},Tse=(t,e,n,r,i,s,o)=>{if(!(!t||!r||!i||!s||!n)){var a=HJ(t,n);if(a){var l=zY(a,e),c=nH(l,o,s,r,i),d=xse(e,s,c,a);return{activeIndex:String(c),activeCoordinate:d}}}},Cse=(t,e,n,r,i,s,o,a)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?Ase(t,e,r,i,s,o,a):Tse(t,e,n,r,i,s,o)},Pse=Ie(t=>t.zIndex.zIndexMap,(t,e)=>e,(t,e,n)=>n,(t,e,n)=>{if(e!=null){var r=t[e];if(r!=null)return n?r.panoramaElement:r.element}}),Rse=Ie(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(r=>parseInt(r,10)).concat(Object.values(As)),n=Array.from(new Set(e));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:xee}});function TL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function CL(t){for(var e=1;eCL(CL({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),Ose)},Dse=new Set(Object.values(As));function jse(t){return Dse.has(t)}var aH=ds({name:"zIndex",initialState:Lse,reducers:{registerZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]?t.zIndexMap[n].consumers+=1:t.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:cr()},unregisterZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!jse(n)&&delete t.zIndexMap[n])},prepare:cr()},registerZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload,r=n.zIndex,i=n.element,s=n.isPanorama;t.zIndexMap[r]?s?t.zIndexMap[r].panoramaElement=i:t.zIndexMap[r].element=i:t.zIndexMap[r]={consumers:0,element:s?void 0:i,panoramaElement:s?i:void 0}},prepare:cr()},unregisterZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(e.payload.isPanorama?t.zIndexMap[n].panoramaElement=void 0:t.zIndexMap[n].element=void 0)},prepare:cr()}}}),BS=aH.actions,Use=BS.registerZIndexPortal,HE=BS.unregisterZIndexPortal,Fse=BS.registerZIndexPortalElement,zse=BS.unregisterZIndexPortalElement,Bse=aH.reducer;function au(t){var e=t.zIndex,n=t.children,r=MZ(),i=r&&e!==void 0&&e!==0,s=to(),o=P.useRef(void 0),a=P.useRef(new Set),l=qr(),c=Gt(f=>Pse(f,e,s));if(P.useLayoutEffect(()=>{if(!i){var f=a.current;f.forEach(y=>{l(HE({zIndex:y}))}),f.clear(),o.current=void 0;return}if(a.current.has(e)||(l(Use({zIndex:e})),a.current.add(e)),c){o.current=c;var g=a.current;g.forEach(y=>{y!==e&&(l(HE({zIndex:y})),g.delete(y))})}},[l,e,i,c]),P.useLayoutEffect(()=>{var f=a.current;return()=>{f.forEach(g=>{l(HE({zIndex:g}))}),f.clear()}},[l]),!i)return n;var d=c??o.current;return d?K1.createPortal(n,d):null}function LC(){return LC=Object.assign?Object.assign.bind():function(t){for(var e=1;eP.useContext(lH),VE={exports:{}},RL;function Kse(){return RL||(RL=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function s(l,c,d,f,g){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new i(d,f||l,g),x=n?n+c:c;return l._events[x]?l._events[x].fn?l._events[x]=[l._events[x],y]:l._events[x].push(y):(l._events[x]=y,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],d,f;if(this._eventsCount===0)return c;for(f in d=this._events)e.call(d,f)&&c.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},a.prototype.listeners=function(c){var d=n?n+c:c,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var g=0,y=f.length,x=new Array(y);g{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!kl(n))return t[n]}},Jse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},cH=ds({name:"options",initialState:Jse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),eoe=cH.reducer,toe=cH.actions.createEventEmitter;function noe(t){return t.tooltip.syncInteraction}var roe={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},uH=ds({name:"chartData",initialState:roe,reducers:{setChartData(t,e){if(t.chartData=e.payload,e.payload==null){t.dataStartIndex=0,t.dataEndIndex=0;return}e.payload.length>0&&t.dataEndIndex!==e.payload.length-1&&(t.dataEndIndex=e.payload.length-1)},setComputedData(t,e){t.computedData=e.payload},setDataStartEndIndexes(t,e){var n=e.payload,r=n.startIndex,i=n.endIndex;r!=null&&(t.dataStartIndex=r),i!=null&&(t.dataEndIndex=i)}}}),tR=uH.actions,IL=tR.setChartData,ioe=tR.setDataStartEndIndexes;tR.setComputedData;var soe=uH.reducer,ooe=["x","y"];function kL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function dm(t){for(var e=1;el.rootProps.className);P.useEffect(()=>{if(t==null)return Vg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var g;if(o&&d!==null&&d!==void 0&&(g=d.payload)!==null&&g!==void 0&&g.coordinate&&d.payload.sourceViewBox){var y=d.payload.coordinate,x=y.x,S=y.y,w=uoe(y,ooe),b=d.payload.sourceViewBox,M=b.x,T=b.y,C=b.width,O=b.height,N=dm(dm({},w),{},{x:o.x+(C?(x-M)/C:0)*o.width,y:o.y+(O?(S-T)/O:0)*o.height});n(dm(dm({},d),{},{payload:dm(dm({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var L;if(typeof r=="function"){var F={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},G=r(i,F);L=i[G]}else r==="value"&&(L=i.find(fe=>String(fe.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||o==null){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(L==null){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var U=k.x,H=k.y,te=Math.min(U,o.x+o.width),ee=Math.min(H,o.y+o.height),pe={x:s==="horizontal"?L.coordinate:te,y:s==="horizontal"?ee:L.coordinate},ie=B0({active:d.payload.active,coordinate:pe,dataKey:d.payload.dataKey,index:String(L.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(ie)}}};return My.on(DC,l),()=>{My.off(DC,l)}},[a,n,e,t,r,i,s,o])}function hoe(){var t=Gt(o2),e=Gt(a2),n=qr();P.useEffect(()=>{if(t==null)return Vg;var r=(i,s,o)=>{e!==o&&t===i&&n(ioe(s))};return My.on(NL,r),()=>{My.off(NL,r)}},[n,e,t])}function poe(){var t=qr();P.useEffect(()=>{t(toe())},[t]),foe(),hoe()}function moe(t,e,n,r,i,s){var o=Gt(x=>wse(x,t,e)),a=Gt(ise),l=Gt(a2),c=Gt(o2),d=Gt(sz),f=Gt(noe),g=(f==null?void 0:f.sourceViewBox)!=null,y=xS();P.useEffect(()=>{if(!g&&c!=null&&l!=null){var x=B0({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:a});My.emit(DC,c,x,l)}},[g,n,o,a,i,r,l,c,d,s,y])}function OL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function LL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{L(fie({shared:M,trigger:T,axisId:N,active:i,defaultIndex:F}))},[L,M,T,N,i,F]);var G=xS(),k=U4(),U=oie(M),H=(e=Gt($e=>Ese($e,U,T,F)))!==null&&e!==void 0?e:{},te=H.activeIndex,ee=H.isActive,pe=Gt($e=>Mse($e,U,T,F)),ie=Gt($e=>oH($e,U,T,F)),fe=Gt($e=>Sse($e,U,T,F)),B=pe,Q=qse(),K=(n=i??ee)!==null&&n!==void 0?n:!1,V=EK([B,K]),q=xoe(V,2),he=q[0],ae=q[1],ce=U==="axis"?ie:void 0;moe(U,T,fe,ce,te,K);var we=O??Q;if(we==null||G==null||U==null)return null;var Ee=B??jL;K||(Ee=jL),c&&Ee.length&&(Ee=qq(Ee.filter($e=>$e.value!=null&&($e.hide!==!0||r.includeHidden)),g,Moe));var Xe=Ee.length>0,Se=LL(LL({},r),{},{payload:Ee,label:ce,active:K,activeIndex:te,coordinate:fe,accessibilityLayer:k}),je=P.createElement(DQ,{allowEscapeViewBox:s,animationDuration:o,animationEasing:a,isAnimationActive:d,active:K,coordinate:fe,hasPayload:Xe,offset:f,position:y,reverseDirection:x,useTranslate3d:S,viewBox:G,wrapperStyle:w,lastBoundingBox:he,innerRef:ae,hasPortalFromProps:!!O},Eoe(l,Se));return P.createElement(P.Fragment,null,K1.createPortal(je,we),K&&P.createElement(Xse,{cursor:b,tooltipEventType:U,coordinate:fe,payload:Ee,index:te}))}function Coe(t,e,n){return(e=Poe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Poe(t){var e=Roe(t,"string");return typeof e=="symbol"?e:e+""}function Roe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Noe{constructor(e){Coe(this,"cache",new Map),this.maxSize=e}get(e){var n=this.cache.get(e);return n!==void 0&&(this.cache.delete(e),this.cache.set(e,n)),n}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(e,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function UL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ioe(t){for(var e=1;e{try{var n=document.getElementById(zL);n||(n=document.createElement("span"),n.setAttribute("id",zL),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,joe,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},X0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Qy.isSsr)return{width:0,height:0};if(!dH.enableCache)return BL(e,n);var r=Uoe(e,n),i=FL.get(r);if(i)return i;var s=BL(e,n);return FL.set(r,s),s},fH;function Ww(t,e){return Hoe(t)||Boe(t,e)||zoe(t,e)||Foe()}function Foe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zoe(t,e){if(t){if(typeof t=="string")return HL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?HL(t,e):void 0}}function HL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=t.breakAll,r=t.style;try{var i=[];Gi(e)||(n?i=e.toString().split(""):i=e.toString().split(pH));var s=i.map(a=>({word:a,width:X0(a,r).width})),o=n?0:X0(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function gH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function lae(t){return Gi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var vH=(t,e,n,r)=>t.reduce((i,s)=>{var o=s.word,a=s.width,l=i[i.length-1];if(l&&a!=null&&(e==null||r||l.width+a+nt.reduce((e,n)=>e.width>n.width?e:n),cae="…",KL=(t,e,n,r,i,s,o,a)=>{var l=t.slice(0,e),c=mH({breakAll:n,style:r,children:l+cae});if(!c)return[!1,[]];var d=vH(c.wordsWithComputedWidth,s,o,a),f=d.length>i||yH(d).width>Number(s);return[f,d]},uae=(t,e,n,r,i)=>{var s=t.maxLines,o=t.children,a=t.style,l=t.breakAll,c=jt(s),d=String(o),f=vH(e,r,n,i);if(!c||i)return f;var g=f.length>s||yH(f).width>Number(r);if(!g)return f;for(var y=0,x=d.length-1,S=0,w;y<=x&&S<=d.length-1;){var b=Math.floor((y+x)/2),M=b-1,T=KL(d,M,l,a,s,r,n,i),C=XL(T,2),O=C[0],N=C[1],L=KL(d,b,l,a,s,r,n,i),F=XL(L,1),G=F[0];if(!O&&!G&&(y=b+1),O&&G&&(x=b-1),!O&&G){w=N;break}S++}return w||f},YL=t=>{var e=Gi(t)?[]:t.toString().split(pH);return[{words:e,width:void 0}]},dae=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,o=t.maxLines;if((e||n)&&!Qy.isSsr){var a,l,c=mH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;a=d,l=f}else return YL(r);return uae({breakAll:s,children:r,maxLines:o,style:i},a,l,e,!!n)}return YL(r)},xH="#808080",fae={angle:0,breakAll:!1,capHeight:"0.71em",fill:xH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},nR=P.forwardRef((t,e)=>{var n=na(t,fae),r=n.x,i=n.y,s=n.lineHeight,o=n.capHeight,a=n.fill,l=n.scaleToFit,c=n.textAnchor,d=n.verticalAnchor,f=$L(n,tae),g=P.useMemo(()=>dae({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),y=f.dx,x=f.dy,S=f.angle,w=f.className,b=f.breakAll,M=$L(f,nae);if(!Ol(r)||!Ol(i)||g.length===0)return null;var T=Number(r)+(jt(y)?y:0),C=Number(i)+(jt(x)?x:0);if(!An(T)||!An(C))return null;var O;switch(d){case"start":O=GE("calc(".concat(o,")"));break;case"middle":O=GE("calc(".concat((g.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:O=GE("calc(".concat(g.length-1," * -").concat(s,")"));break}var N=[],L=g[0];if(l&&L!=null){var F=L.width,G=f.width;N.push("scale(".concat(jt(G)&&jt(F)?G/F:1,")"))}return S&&N.push("rotate(".concat(S,", ").concat(T,", ").concat(C,")")),N.length&&(M.transform=N.join(" ")),P.createElement("text",jC({},Qo(M),{ref:e,x:T,y:C,className:ir("recharts-text",w),textAnchor:c,fill:a.includes("url")?xH:a}),g.map((k,U)=>{var H=k.words.join(b?"":" ");return P.createElement("tspan",{x:T,dy:U===0?O:s,key:"".concat(H,"-").concat(U)},H)}))});nR.displayName="Text";function ZL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pl(t){for(var e=1;e{var e=t.viewBox,n=t.position,r=t.offset,i=r===void 0?0:r,s=t.parentViewBox,o=YP(e),a=o.x,l=o.y,c=o.height,d=o.upperWidth,f=o.lowerWidth,g=a,y=a+(d-f)/2,x=(g+y)/2,S=(d+f)/2,w=g+d/2,b=c>=0?1:-1,M=b*i,T=b>0?"end":"start",C=b>0?"start":"end",O=d>=0?1:-1,N=O*i,L=O>0?"end":"start",F=O>0?"start":"end",G=s;if(n==="top"){var k={x:g+d/2,y:l-M,horizontalAnchor:"middle",verticalAnchor:T};return G&&(k.height=Math.max(l-G.y,0),k.width=d),k}if(n==="bottom"){var U={x:y+f/2,y:l+c+M,horizontalAnchor:"middle",verticalAnchor:C};return G&&(U.height=Math.max(G.y+G.height-(l+c),0),U.width=f),U}if(n==="left"){var H={x:x-N,y:l+c/2,horizontalAnchor:L,verticalAnchor:"middle"};return G&&(H.width=Math.max(H.x-G.x,0),H.height=c),H}if(n==="right"){var te={x:x+S+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"};return G&&(te.width=Math.max(G.x+G.width-te.x,0),te.height=c),te}var ee=G?{width:S,height:c}:{};return n==="insideLeft"?pl({x:x+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"},ee):n==="insideRight"?pl({x:x+S-N,y:l+c/2,horizontalAnchor:L,verticalAnchor:"middle"},ee):n==="insideTop"?pl({x:g+d/2,y:l+M,horizontalAnchor:"middle",verticalAnchor:C},ee):n==="insideBottom"?pl({x:y+f/2,y:l+c-M,horizontalAnchor:"middle",verticalAnchor:T},ee):n==="insideTopLeft"?pl({x:g+N,y:l+M,horizontalAnchor:F,verticalAnchor:C},ee):n==="insideTopRight"?pl({x:g+d-N,y:l+M,horizontalAnchor:L,verticalAnchor:C},ee):n==="insideBottomLeft"?pl({x:y+N,y:l+c-M,horizontalAnchor:F,verticalAnchor:T},ee):n==="insideBottomRight"?pl({x:y+f-N,y:l+c-M,horizontalAnchor:L,verticalAnchor:T},ee):n&&typeof n=="object"&&(jt(n.x)||Ih(n.x))&&(jt(n.y)||Ih(n.y))?pl({x:a+Ad(n.x,S),y:l+Ad(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},ee):pl({x:w,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},ee)},vae=["labelRef"],yae=["content"];function QL(t,e){if(t==null)return{};var n,r,i=xae(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var e=t.x,n=t.y,r=t.upperWidth,i=t.lowerWidth,s=t.width,o=t.height,a=t.children,l=P.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:i,width:s,height:o}),[e,n,r,i,s,o]);return P.createElement(bH.Provider,{value:l},a)},_H=()=>{var t=P.useContext(bH),e=xS();return t||(e?YP(e):void 0)},Mae=P.createContext(null),Eae=()=>{var t=P.useContext(Mae),e=Gt(uz);return t||e},Aae=t=>{var e=t.value,n=t.formatter,r=Gi(t.children)?e:t.children;return typeof n=="function"?n(r):r},rR=t=>t!=null&&typeof t=="function",Tae=(t,e)=>{var n=qo(e-t),r=Math.min(Math.abs(e-t),360);return n*r},Cae=(t,e,n,r,i)=>{var s=t.offset,o=t.className,a=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,g=i.endAngle,y=i.clockWise,x=(c+d)/2,S=Tae(f,g),w=S>=0?1:-1,b,M;switch(e){case"insideStart":b=f+w*s,M=y;break;case"insideEnd":b=g-w*s,M=!y;break;case"end":b=g+w*s,M=y;break;default:throw new Error("Unsupported position ".concat(e))}M=S<=0?M:!M;var T=Hi(a,l,x,b),C=Hi(a,l,x,b+(M?1:-1)*359),O="M".concat(T.x,",").concat(T.y,` + A`).concat(x,",").concat(x,",0,1,").concat(M?0:1,`, + `).concat(C.x,",").concat(C.y),N=Gi(t.id)?uy("recharts-radial-line-"):t.id;return P.createElement("text",Dc({},r,{dominantBaseline:"central",className:ir("recharts-radial-bar-label",o)}),P.createElement("defs",null,P.createElement("path",{id:N,d:O})),P.createElement("textPath",{xlinkHref:"#".concat(N)},n))},Pae=(t,e,n)=>{var r=t.cx,i=t.cy,s=t.innerRadius,o=t.outerRadius,a=t.startAngle,l=t.endAngle,c=(a+l)/2;if(n==="outside"){var d=Hi(r,i,o+e,c),f=d.x,g=d.y;return{x:f,y:g,textAnchor:f>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var y=(s+o)/2,x=Hi(r,i,y,c),S=x.x,w=x.y;return{x:S,y:w,textAnchor:"middle",verticalAnchor:"middle"}},W_=t=>t!=null&&"cx"in t&&jt(t.cx),Rae={angle:0,offset:5,zIndex:As.label,position:"middle",textBreakAll:!1};function Nae(t){if(!W_(t))return t;var e=t.cx,n=t.cy,r=t.outerRadius,i=r*2;return{x:e-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function ld(t){var e=na(t,Rae),n=e.viewBox,r=e.parentViewBox,i=e.position,s=e.value,o=e.children,a=e.content,l=e.className,c=l===void 0?"":l,d=e.textBreakAll,f=e.labelRef,g=Eae(),y=_H(),x=i==="center"?y:g??y,S,w,b;n==null?S=x:W_(n)?S=n:S=YP(n);var M=Nae(S);if(!S||Gi(s)&&Gi(o)&&!P.isValidElement(a)&&typeof a!="function")return null;var T=H0(H0({},e),{},{viewBox:S});if(P.isValidElement(a)){T.labelRef;var C=QL(T,vae);return P.cloneElement(a,C)}if(typeof a=="function"){T.content;var O=QL(T,yae);if(w=P.createElement(a,O),P.isValidElement(w))return w}else w=Aae(e);var N=Qo(e);if(W_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return Cae(e,i,w,N,S);b=Pae(S,e.offset,e.position)}else{if(!M)return null;var L=gae({viewBox:M,position:i,offset:e.offset,parentViewBox:W_(r)?void 0:r});b=H0(H0({x:L.x,y:L.y,textAnchor:L.horizontalAnchor,verticalAnchor:L.verticalAnchor},L.width!==void 0?{width:L.width}:{}),L.height!==void 0?{height:L.height}:{})}return P.createElement(au,{zIndex:e.zIndex},P.createElement(nR,Dc({ref:f,className:ir("recharts-label",c)},N,b,{textAnchor:gH(N.textAnchor)?N.textAnchor:b.textAnchor,breakAll:d}),w))}ld.displayName="Label";var Iae=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?P.createElement(ld,Dc({key:"label-implicit"},r)):Ol(t)?P.createElement(ld,Dc({key:"label-implicit",value:t},r)):P.isValidElement(t)?t.type===ld?P.cloneElement(t,H0({key:"label-implicit"},r)):P.createElement(ld,Dc({key:"label-implicit",content:t},r)):rR(t)?P.createElement(ld,Dc({key:"label-implicit",content:t},r)):t&&typeof t=="object"?P.createElement(ld,Dc({},t,{key:"label-implicit"},r)):null};function kae(t){var e=t.label,n=t.labelRef,r=_H();return Iae(e,r,n)||null}var Oae=["valueAccessor"],Lae=["dataKey","clockWise","id","textBreakAll","zIndex"];function $w(){return $w=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e=Array.isArray(t.value)?t.value[t.value.length-1]:t.value;if(lae(e))return e},wH=P.createContext(void 0),Uae=wH.Provider,SH=P.createContext(void 0);SH.Provider;function Fae(){return P.useContext(wH)}function zae(){return P.useContext(SH)}function $_(t){var e=t.valueAccessor,n=e===void 0?jae:e,r=e3(t,Oae),i=r.dataKey;r.clockWise;var s=r.id,o=r.textBreakAll,a=r.zIndex,l=e3(r,Lae),c=Fae(),d=zae(),f=c||d;return!f||!f.length?null:P.createElement(au,{zIndex:a??As.label},P.createElement(Jo,{className:"recharts-label-list"},f.map((g,y)=>{var x,S=Gi(i)?n(g,y):wi(g.payload,i),w=Gi(s)?{}:{id:"".concat(s,"-").concat(y)};return P.createElement(ld,$w({key:"label-".concat(y)},Qo(g),l,w,{fill:(x=r.fill)!==null&&x!==void 0?x:g.fill,parentViewBox:g.parentViewBox,value:S,textBreakAll:o,viewBox:g.viewBox,index:y,zIndex:0}))})))}$_.displayName="LabelList";function Bae(t){var e=t.label;return e?e===!0?P.createElement($_,{key:"labelList-implicit"}):P.isValidElement(e)||rR(e)?P.createElement($_,{key:"labelList-implicit",content:e}):typeof e=="object"?P.createElement($_,$w({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function UC(){return UC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e=t.cx,n=t.cy,r=t.r,i=t.className,s=ir("recharts-dot",i);return jt(e)&&jt(n)&&jt(r)?P.createElement("circle",UC({},Ba(t),zP(t),{className:s,cx:e,cy:n,r})):null},Hae={radiusAxis:{},angleAxis:{}},EH=ds({name:"polarAxis",initialState:Hae,reducers:{addRadiusAxis(t,e){t.radiusAxis[e.payload.id]=e.payload},removeRadiusAxis(t,e){delete t.radiusAxis[e.payload.id]},addAngleAxis(t,e){t.angleAxis[e.payload.id]=e.payload},removeAngleAxis(t,e){delete t.angleAxis[e.payload.id]}}}),HS=EH.actions;HS.addRadiusAxis;HS.removeRadiusAxis;HS.addAngleAxis;HS.removeAngleAxis;var Vae=EH.reducer;function Gae(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var AH=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;function t3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function n3(t){for(var e=1;e{r||(i.current===null?n(cie(e)):i.current!==e&&n(uie({prev:i.current,next:e})),i.current=e)},[e,n,r]),P.useLayoutEffect(()=>()=>{i.current&&(n(die(i.current)),i.current=null)},[n]),null}function ele(t){var e=t.legendPayload,n=qr(),r=to(),i=P.useRef(null);return P.useLayoutEffect(()=>{r||(i.current===null?n(jZ(e)):i.current!==e&&n(UZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),P.useLayoutEffect(()=>()=>{i.current&&(n(FZ(i.current)),i.current=null)},[n]),null}function tle(t,e){return sle(t)||ile(t,e)||rle(t,e)||nle()}function nle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rle(t,e){if(t){if(typeof t=="string")return r3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r3(t,e):void 0}}function r3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var i of n)r.push({status:"removed",prev:i});for(var s=0;st[Math.floor(s*n)]);return sR(r,e)}function lle(t,e){var n=e.map((r,i)=>t[i]);return sR(n,e)}function cle(t,e){for(var n=new Map,r=0;r{var y=n(f,g);if(y!=null){var x=r.get(y);if(x!==void 0)return i.add(y),x}}),o=[];for(var a of r){var l=tle(a,2),c=l[0],d=l[1];i.has(c)||o.push(d)}return sR(s,e,o)}function FC(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===iR?ale(t,e):n===ole?lle(t,e):ule(t,e,n)}function CH(t,e){var n=P.useRef(t),r=P.useRef(e.current),i=P.useRef(!0);n.current!==t&&(n.current=t,r.current=e.current,i.current=!1);var s=P.useCallback(function(o,a){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(a===0){i.current=!0;return}a===1&&(r.current=o),a>0&&i.current&&l&&(e.current=o)},[e]);return{startValue:r.current,syncStepValue:s}}function dle(t,e){return mle(t)||ple(t,e)||hle(t,e)||fle()}function fle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hle(t,e){if(t){if(typeof t=="string")return i3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i3(t,e):void 0}}function i3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{typeof t=="function"&&t(),s(!0)},[t]),a=P.useCallback(()=>{typeof e=="function"&&e(),s(!1)},[e]);return{isAnimating:i,handleAnimationStart:o,handleAnimationEnd:a}}function vle(t){var e,n=t.animationInput,r=t.animationIdPrefix,i=t.items,s=t.previousItemsRef,o=t.isAnimationActive,a=t.animationBegin,l=t.animationDuration,c=t.animationEasing,d=t.onAnimationStart,f=t.onAnimationEnd,g=t.animationInterpolateFn,y=t.animationMatchBy,x=t.shouldUpdatePreviousRef,S=t.children,w=t.layout,b=V4(n,r),M=CH(b,s),T=(e=M.startValue)!==null&&e!==void 0?e:null,C=FC(T,i,y??iR);return P.createElement(H4,{animationId:b,begin:a,duration:l,isActive:o,easing:c,onAnimationEnd:f,onAnimationStart:d,key:b},O=>{var N=T==null,L=i==null?i:g(C,O,w),F=x?x(O):O>0;return M.syncStepValue(L,O,F),L==null?null:S(L,O,N)})}var WE;function yle(t,e){return wle(t)||_le(t,e)||ble(t,e)||xle()}function xle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ble(t,e){if(t){if(typeof t=="string")return s3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s3(t,e):void 0}}function s3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var t=P.useState(()=>uy("uid-")),e=yle(t,1),n=e[0];return n},PH=(WE=W1.useId)!==null&&WE!==void 0?WE:Sle;function Mle(t,e){var n=PH();return e||(t?"".concat(t,"-").concat(n):n)}var Ele=P.createContext(void 0),Ale=t=>{var e=t.id,n=t.type,r=t.children,i=Mle("recharts-".concat(n),e);return P.createElement(Ele.Provider,{value:i},r(i))},Tle={cartesianItems:[],polarItems:[]},RH=ds({name:"graphicalItems",initialState:Tle,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:cr()},replaceCartesianGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=Ko(t).cartesianItems.indexOf(r);s>-1&&(t.cartesianItems[s]=i)},prepare:cr()},removeCartesianGraphicalItem:{reducer(t,e){var n=Ko(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:cr()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:cr()},removePolarGraphicalItem:{reducer(t,e){var n=Ko(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:cr()},replacePolarGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=Ko(t).polarItems.indexOf(r);s>-1&&(t.polarItems[s]=i)},prepare:cr()}}}),Jg=RH.actions,Cle=Jg.addCartesianGraphicalItem,Ple=Jg.replaceCartesianGraphicalItem,Rle=Jg.removeCartesianGraphicalItem;Jg.addPolarGraphicalItem;Jg.removePolarGraphicalItem;Jg.replacePolarGraphicalItem;var Nle=RH.reducer,Ile=t=>{var e=qr(),n=P.useRef(null);return P.useLayoutEffect(()=>{n.current===null?e(Cle(t)):n.current!==t&&e(Ple({prev:n.current,next:t})),n.current=t},[e,t]),P.useLayoutEffect(()=>()=>{n.current&&(e(Rle(n.current)),n.current=null)},[e]),null},kle=P.memo(Ile),Ole=["points"];function o3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function $E(t){for(var e=1;e{var b,M,T=$E($E($E({r:3},o),g),{},{index:w,cx:(b=S.x)!==null&&b!==void 0?b:void 0,cy:(M=S.y)!==null&&M!==void 0?M:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return P.createElement(zle,{key:"dot-".concat(w),option:n,dotProps:T,className:i})}),x={};return a&&l!=null&&(x.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(l,")")),P.createElement(au,{zIndex:d},P.createElement(Jo,Xw({className:r},x),y))}function a3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function l3(t){for(var e=1;e({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),nce=Ie([tce,tu,nu],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),oR=()=>Gt(nce),rce=()=>Gt(cse);function c3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function XE(t){for(var e=1;e{var e=t.point,n=t.childIndex,r=t.mainColor,i=t.activeDot,s=t.dataKey,o=t.clipPath;if(i===!1||e.x==null||e.y==null)return null;var a={index:n,dataKey:s,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},l=XE(XE(XE({},a),tS(i)),zP(i)),c;return P.isValidElement(i)?c=P.cloneElement(i,l):typeof i=="function"?c=i(l):c=P.createElement(MH,l),P.createElement(Jo,{className:"recharts-active-dot",clipPath:o},c)};function u3(t){var e=t.points,n=t.mainColor,r=t.activeDot,i=t.itemDataKey,s=t.clipPath,o=t.zIndex,a=o===void 0?As.activeDot:o,l=Gt(Sy),c=rce();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return Gi(d)?null:P.createElement(au,{zIndex:a},P.createElement(ace,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var lce=t=>{var e=t.chartData,n=qr(),r=to();return P.useEffect(()=>r?()=>{}:(n(IL(e)),()=>{n(IL(void 0))}),[e,n,r]),null},d3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},kH=ds({name:"brush",initialState:d3,reducers:{setBrushSettings(t,e){return e.payload==null?d3:e.payload}}});kH.actions.setBrushSettings;var cce=kH.reducer;function uce(t){return(t%180+180)%180}var dce=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=uce(i),o=s*Math.PI/180,a=Math.atan(r/n),l=o>a&&o{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=Ko(t).dots.findIndex(r=>r===e.payload);n!==-1&&t.dots.splice(n,1)},addArea:(t,e)=>{t.areas.push(e.payload)},removeArea:(t,e)=>{var n=Ko(t).areas.findIndex(r=>r===e.payload);n!==-1&&t.areas.splice(n,1)},addLine:(t,e)=>{t.lines.push(e.payload)},removeLine:(t,e)=>{var n=Ko(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),ev=OH.actions;ev.addDot;ev.removeDot;ev.addArea;ev.removeArea;ev.addLine;ev.removeLine;var hce=OH.reducer;function pce(t,e){return yce(t)||vce(t,e)||gce(t,e)||mce()}function mce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gce(t,e){if(t){if(typeof t=="string")return f3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f3(t,e):void 0}}function f3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=P.useState("".concat(uy("recharts"),"-clip")),r=pce(n,1),i=r[0],s=oR();if(s==null)return null;var o=s.x,a=s.y,l=s.width,c=s.height;return P.createElement(xce.Provider,{value:i},P.createElement("defs",null,P.createElement("clipPath",{id:i},P.createElement("rect",{x:o,y:a,height:c,width:l}))),e)};function LH(t,e){if(e<1)return[];if(e===1)return t;for(var n=[],r=0;rt*i)return!1;var s=n();return t*(e-t*s/2-r)>=0&&t*(e+t*s/2-i)<=0}function Sce(t,e){return LH(t,e+1)}function Mce(t,e,n,r,i){for(var s=(r||[]).slice(),o=e.start,a=e.end,l=0,c=1,d=o,f=function(){var x=r==null?void 0:r[l];if(x===void 0)return{v:LH(r,c)};var S=l,w,b=()=>(w===void 0&&(w=n(x,S)),w),M=x.coordinate,T=l===0||Ey(t,M,b,d,a);T||(l=0,d=o,c+=1),T&&(d=M+t*(b()/2+i),l+=c)},g;c<=s.length;)if(g=f(),g)return g.v;return[]}function Ece(t,e,n,r,i){var s=(r||[]).slice(),o=s.length;if(o===0)return[];for(var a=e.start,l=e.end,c=1;c<=o;c++){for(var d=(o-1)%c,f=a,g=!0,y=function(){var C=r[S];if(C==null)return 0;var O=S,N,L=()=>(N===void 0&&(N=n(C,O)),N),F=C.coordinate,G=S===d||Ey(t,F,L,f,l);if(!G)return g=!1,1;G&&(f=F+t*(L()/2+i))},x,S=d;S(S===void 0&&(S=n(y,g)),S);if(g===o-1){var b=t*(x.coordinate+t*w()/2-l);s[g]=x=ss(ss({},x),{},{tickCoord:b>0?x.coordinate-b*t:x.coordinate})}else s[g]=x=ss(ss({},x),{},{tickCoord:x.coordinate});if(x.tickCoord!=null){var M=Ey(t,x.tickCoord,w,a,l);M&&(l=x.tickCoord-t*(w()/2+i),s[g]=ss(ss({},x),{},{isShow:!0}))}},d=o-1;d>=0;d--)c(d);return s}function Rce(t,e,n,r,i,s){var o=(r||[]).slice(),a=o.length,l=e.start,c=e.end;if(s){var d=r[a-1];if(d!=null){var f=n(d,a-1),g=t*(d.coordinate+t*f/2-c);if(o[a-1]=d=ss(ss({},d),{},{tickCoord:g>0?d.coordinate-g*t:d.coordinate}),d.tickCoord!=null){var y=Ey(t,d.tickCoord,()=>f,l,c);y&&(c=d.tickCoord-t*(f/2+i),o[a-1]=ss(ss({},d),{},{isShow:!0}))}}}for(var x=s?a-1:a,S=function(M){var T=o[M];if(T==null)return 1;var C=T,O,N=()=>(O===void 0&&(O=n(T,M)),O);if(M===0){var L=t*(C.coordinate-t*N()/2-l);o[M]=C=ss(ss({},C),{},{tickCoord:L<0?C.coordinate-L*t:C.coordinate})}else o[M]=C=ss(ss({},C),{},{tickCoord:C.coordinate});if(C.tickCoord!=null){var F=Ey(t,C.tickCoord,N,l,c);F&&(l=C.tickCoord+t*(N()/2+i),o[M]=ss(ss({},C),{},{isShow:!0}))}},w=0;w{var L=typeof c=="function"?c(O.value,N):O.value;return x==="width"?_ce(X0(L,{fontSize:e,letterSpacing:n}),S,f):X0(L,{fontSize:e,letterSpacing:n})[x]},b=i[0],M=i[1],T=i.length>=2&&b!=null&&M!=null?qo(M.coordinate-b.coordinate):1,C=wce(s,T,x);return l==="equidistantPreserveStart"?Mce(T,C,w,i,o):l==="equidistantPreserveEnd"?Ece(T,C,w,i,o):(l==="preserveStart"||l==="preserveStartEnd"?y=Rce(T,C,w,i,o,l==="preserveStartEnd"):y=Pce(T,C,w,i,o),y.filter(O=>O.isShow))}var Nce=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,i=r,s=t.tickSize,o=s===void 0?0:s,a=t.tickMargin,l=a===void 0?0:a,c=0;if(e){Array.from(e).forEach(y=>{if(y){var x=y.getBoundingClientRect();x.width>c&&(c=x.width)}});var d=n?n.getBoundingClientRect().width:0,f=o+l,g=c+f+d+(n?i:0);return Math.round(g)}return 0},Ice={xAxis:{},yAxis:{}},DH=ds({name:"renderedTicks",initialState:Ice,reducers:{setRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,i=n.axisId,s=n.ticks;t[r][i]=s},removeRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,i=n.axisId;delete t[r][i]}}}),jH=DH.actions,kce=jH.setRenderedTicks,Oce=jH.removeRenderedTicks,Lce=DH.reducer,Dce=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function p3(t,e){return zce(t)||Fce(t,e)||Uce(t,e)||jce()}function jce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uce(t,e){if(t){if(typeof t=="string")return m3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?m3(t,e):void 0}}function m3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r==null||n==null)return Vg;var s=e.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return i(kce({ticks:s,axisId:r,axisType:n})),()=>{i(Oce({axisId:r,axisType:n}))}},[i,e,r,n]),null}var Qce=P.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,i=t.tick,s=t.tickLine,o=t.stroke,a=t.tickFormatter,l=t.unit,c=t.padding,d=t.tickTextProps,f=t.orientation,g=t.mirror,y=t.x,x=t.y,S=t.width,w=t.height,b=t.tickSize,M=t.tickMargin,T=t.fontSize,C=t.letterSpacing,O=t.getTicksConfig,N=t.events,L=t.axisType,F=t.axisId,G=aR(Pr(Pr({},O),{},{ticks:r}),T,C),k=Ba(O),U=tS(i),H=gH(k.textAnchor)?k.textAnchor:qce(f,g),te=Kce(f,g),ee={};typeof s=="object"&&(ee=s);var pe=Pr(Pr({},k),{},{fill:"none"},ee),ie=G.map(Q=>Pr({entry:Q},Xce(Q,y,x,S,w,f,b,g,M))),fe=ie.map(Q=>{var K=Q.entry,V=Q.line;return P.createElement(Jo,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(K.value,"-").concat(K.coordinate,"-").concat(K.tickCoord)},s&&P.createElement("line",Uh({},pe,V,{className:ir("recharts-cartesian-axis-tick-line",Yh(s,"className"))})))}),B=ie.map((Q,K)=>{var V,q,he=Q.entry,ae=Q.tick,ce=Pr(Pr(Pr(Pr({verticalAnchor:te},k),{},{textAnchor:H,stroke:"none",fill:o},ae),{},{index:K,payload:he,visibleTicksCount:G.length,tickFormatter:a,padding:c},d),{},{angle:(V=(q=d==null?void 0:d.angle)!==null&&q!==void 0?q:k.angle)!==null&&V!==void 0?V:0}),we=Pr(Pr({},ce),U);return P.createElement(Jo,Uh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(he.value,"-").concat(he.coordinate,"-").concat(he.tickCoord)},nq(N,he,K)),i&&P.createElement(Yce,{option:i,tickProps:we,value:"".concat(typeof a=="function"?a(he.value,K):he.value).concat(l||"")}))});return P.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(L,"-ticks")},P.createElement(Zce,{ticks:G,axisId:F,axisType:L}),B.length>0&&P.createElement(au,{zIndex:As.label},P.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(L,"-tick-labels"),ref:e},B)),fe.length>0&&P.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(L,"-tick-lines")},fe))}),Jce=P.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,i=t.height,s=t.className,o=t.hide,a=t.ticks,l=t.axisType,c=t.axisId,d=Bce(t,Dce),f=P.useState(""),g=p3(f,2),y=g[0],x=g[1],S=P.useState(""),w=p3(S,2),b=w[0],M=w[1],T=P.useRef(null);P.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return Nce({ticks:T.current,label:(O=t.labelRef)===null||O===void 0?void 0:O.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var C=P.useCallback(O=>{if(O){var N=O.getElementsByClassName("recharts-cartesian-axis-tick-value");T.current=N;var L=N[0];if(L){var F=window.getComputedStyle(L),G=F.fontSize,k=F.letterSpacing;(G!==y||k!==b)&&(x(G),M(k))}}},[y,b]);return o||r!=null&&r<=0||i!=null&&i<=0?null:P.createElement(au,{zIndex:t.zIndex},P.createElement(Jo,{className:ir("recharts-cartesian-axis",s)},P.createElement($ce,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:Ba(t)}),P.createElement(Qce,{ref:C,axisType:l,events:d,fontSize:y,getTicksConfig:t,height:t.height,letterSpacing:b,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:a,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),P.createElement(Sae,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},P.createElement(kae,{label:t.label,labelRef:t.labelRef}),t.children)))}),lR=P.forwardRef((t,e)=>{var n=na(t,Wc);return P.createElement(Jce,Uh({},n,{ref:e}))});lR.displayName="CartesianAxis";var eue=["x1","y1","x2","y2","key"],tue=["offset"],nue=["xAxisId","yAxisId"],rue=["xAxisId","yAxisId"];function v3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function os(t){for(var e=1;e{var e=t.fill;if(!e||e==="none")return null;var n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.ry;return P.createElement("rect",{x:r,y:i,ry:a,width:s,height:o,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function UH(t){var e=t.option,n=t.lineItemProps,r;if(P.isValidElement(e))r=P.cloneElement(e,n);else if(typeof e=="function")r=e(n);else{var i,s=n.x1,o=n.y1,a=n.x2,l=n.y2,c=n.key,d=qw(n,eue),f=(i=Ba(d))!==null&&i!==void 0?i:{};f.offset;var g=qw(f,tue);r=P.createElement("line",sh({},g,{x1:s,y1:o,x2:a,y2:l,fill:"none",key:c}))}return r}function cue(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,s=t.horizontalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=qw(t,nue),a=s.map((l,c)=>{var d=os(os({},o),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return P.createElement(UH,{key:"line-".concat(c),option:i,lineItemProps:d})});return P.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function uue(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,s=t.verticalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=qw(t,rue),a=s.map((l,c)=>{var d=os(os({},o),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return P.createElement(UH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return P.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function due(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.horizontalPoints,l=t.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length||a==null)return null;var d=a.map(g=>Math.round(g+i-i)).sort((g,y)=>g-y);i!==d[0]&&d.unshift(0);var f=d.map((g,y)=>{var x=d[y+1],S=x==null,w=S?i+o-g:x-g;if(w<=0)return null;var b=y%e.length;return P.createElement("rect",{key:"react-".concat(y),y:g,x:r,height:w,width:s,stroke:"none",fill:e[b],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return P.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function fue(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,o=t.y,a=t.width,l=t.height,c=t.verticalPoints;if(!n||!r||!r.length)return null;var d=c.map(g=>Math.round(g+s-s)).sort((g,y)=>g-y);s!==d[0]&&d.unshift(0);var f=d.map((g,y)=>{var x=d[y+1],S=x==null,w=S?s+a-g:x-g;if(w<=0)return null;var b=y%r.length;return P.createElement("rect",{key:"react-".concat(y),x:g,y:o,width:w,height:l,stroke:"none",fill:r[b],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return P.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var hue=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return y4(aR(os(os(os({},Wc),n),{},{ticks:x4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},pue=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return y4(aR(os(os(os({},Wc),n),{},{ticks:x4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},mue={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:As.grid};function FH(t){var e=T4(),n=C4(),r=A4(),i=os(os({},na(t,mue)),{},{x:jt(t.x)?t.x:r.left,y:jt(t.y)?t.y:r.top,width:jt(t.width)?t.width:r.width,height:jt(t.height)?t.height:r.height}),s=i.xAxisId,o=i.yAxisId,a=i.x,l=i.y,c=i.width,d=i.height,f=i.syncWithTicks,g=i.horizontalValues,y=i.verticalValues,x=to(),S=Gt(G=>xL(G,"xAxis",s,x)),w=Gt(G=>xL(G,"yAxis",o,x));if(!Ll(c)||!Ll(d)||!jt(a)||!jt(l))return null;var b=i.verticalCoordinatesGenerator||hue,M=i.horizontalCoordinatesGenerator||pue,T=i.horizontalPoints,C=i.verticalPoints;if((!T||!T.length)&&typeof M=="function"){var O=g&&g.length,N=M({yAxis:w?os(os({},w),{},{ticks:O?g:w.ticks}):void 0,width:e??c,height:n??d,offset:r},O?!0:f);bw(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(T=N)}if((!C||!C.length)&&typeof b=="function"){var L=y&&y.length,F=b({xAxis:S?os(os({},S),{},{ticks:L?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},L?!0:f);bw(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof F,"]")),Array.isArray(F)&&(C=F)}return P.createElement(au,{zIndex:i.zIndex},P.createElement("g",{className:"recharts-cartesian-grid"},P.createElement(lue,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),P.createElement(due,sh({},i,{horizontalPoints:T})),P.createElement(fue,sh({},i,{verticalPoints:C})),P.createElement(cue,sh({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:w})),P.createElement(uue,sh({},i,{offset:r,verticalPoints:C,xAxis:S,yAxis:w}))))}FH.displayName="CartesianGrid";var gue={},zH=ds({name:"errorBars",initialState:gue,reducers:{addErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]||(t[r]=[]),t[r].push(i)},replaceErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.prev,s=n.next;t[r]&&(t[r]=t[r].map(o=>o.dataKey===i.dataKey&&o.direction===i.direction?s:o))},removeErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]&&(t[r]=t[r].filter(s=>s.dataKey!==i.dataKey||s.direction!==i.direction))}}}),cR=zH.actions;cR.addErrorBar;cR.replaceErrorBar;cR.removeErrorBar;var vue=zH.reducer;function BH(t,e){var n,r,i=Gt(c=>iu(c,t)),s=Gt(c=>su(c,e)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:ii.allowDataOverflow,a=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:si.allowDataOverflow,l=o||a;return{needClip:l,needClipX:o,needClipY:a}}function yue(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=oR(),s=BH(e,n),o=s.needClipX,a=s.needClipY,l=s.needClip,c=Gt(T=>EB(T,e,!1)),d=Gt(T=>AB(T,n,!1));if(!l||!i)return null;var f=i.x,g=i.y,y=i.width,x=i.height,S=o&&c?Math.min(c[0],c[1]):f-y/2,w=a&&d?Math.min(d[0],d[1]):g-x/2,b=o&&c?Math.abs(c[1]-c[0]):y*2,M=a&&d?Math.abs(d[1]-d[0]):x*2;return P.createElement("clipPath",{id:"clipPath-".concat(r)},P.createElement("rect",{x:S,y:w,width:b,height:M}))}function xue(t){var e=tS(t),n=3,r=2;if(e!=null){var i=e.r,s=e.strokeWidth,o=Number(i),a=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(a)||a<0)&&(a=r),{r:o,strokeWidth:a}}return{r:n,strokeWidth:r}}function uR(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:NH}function dR(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:NH}var HH=(t,e,n)=>OB(t,"xAxis",uR(t,e),n),VH=(t,e,n)=>kB(t,"xAxis",uR(t,e),n),GH=(t,e,n)=>OB(t,"yAxis",dR(t,e),n),WH=(t,e,n)=>kB(t,"yAxis",dR(t,e),n),bue=Ie([gr,HH,GH,VH,WH],(t,e,n,r,i)=>Bl(t,"xAxis")?xw(e,r,!1):xw(n,i,!1)),_ue=(t,e)=>e,$H=Ie([Jz,_ue],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),XH=t=>{var e=gr(t),n=Bl(e,"xAxis");return n?"yAxis":"xAxis"},wue=(t,e)=>{var n=XH(t);return n==="yAxis"?dR(t,e):uR(t,e)},Sue=(t,e,n)=>cB(t,XH(t),wue(t,e),n),Mue=Ie([$H,Sue],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=d2(t);if(!(r==null||i==null)){var s=(n=e[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(a=>a.key===i);if(o!=null)return o.map(a=>[a[0],a[1]])}}}),Eue=Ie([gr,HH,GH,VH,WH,Mue,KJ,bue,$H,fee],(t,e,n,r,i,s,o,a,l,c)=>{var d=o.chartData,f=o.dataStartIndex,g=o.dataEndIndex;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||a==null)){var y=l.data,x;if(y&&y.length>0?x=y:x=d==null?void 0:d.slice(f,g+1),x!=null)return Zue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:x,chartBaseValue:c,bandSize:a})}}),Aue=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],Tue=["id","baseLine"];function q0(){return q0=Object.assign?Object.assign.bind():function(t){for(var e=1;ef.y||0));return jt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),jt(d)?P.createElement("rect",{x:af.x||0));return jt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),jt(d)?P.createElement("rect",{x:0,y:at==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Ig(Ig({},n.next),{},{x:Fc(n.prev.x,n.next.x,e),y:Fc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),KH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:iR,animationInterpolateFn:Fue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:Iue,xAxisId:0,yAxisId:0,zIndex:As.area};function Yw(t,e){return t&&t!=="none"?t:e}var zue=t=>{var e=t.dataKey,n=t.name,r=t.stroke,i=t.fill,s=t.legendType,o=t.hide;return[{inactive:o,dataKey:e,type:s,color:Yw(r,i),value:b4(n,e),payload:t}]},Bue=P.memo(t=>{var e=t.dataKey,n=t.data,r=t.stroke,i=t.strokeWidth,s=t.fill,o=t.name,a=t.hide,l=t.unit,c=t.tooltipType,d=t.id,f={dataDefinedOnItem:n,getPosition:Vg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:b4(o,e),hide:a,type:c,color:Yw(r,s),unit:l,graphicalItemId:d}};return P.createElement(Jae,{tooltipEntrySettings:f})});function Hue(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,o=r.dataKey,a=Ba(r);return P.createElement(Hle,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function Vue(t){var e=t.showLabels,n=t.children,r=t.points,i=r.map(s=>{var o,a,l={x:(o=s.x)!==null&&o!==void 0?o:0,y:(a=s.y)!==null&&a!==void 0?a:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Ig(Ig({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return P.createElement(Uae,{value:e?i:void 0},n)}function Gue(t){var e=t.points,n=t.baseLine,r=t.needClip,i=t.clipPathId,s=t.props,o=t.animationElapsedTime,a=t.isAnimating,l=t.isEntrance,c=s.layout,d=s.type,f=s.stroke,g=s.connectNulls,y=s.isRange,x=s.shape,S=s.id,w=qH(s,kue),b=Qo(w),M=Ig(Ig({},b),{},{id:S,points:e,connectNulls:g,type:d,baseLine:n,layout:c,stroke:f,isRange:y,animationElapsedTime:o,isAnimating:a,isEntrance:l});return P.createElement(P.Fragment,null,(e==null?void 0:e.length)>1&&P.createElement(Jo,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},P.createElement(Qae,{option:x,DefaultShape:KH.shape,shapeProps:M})),P.createElement(Hue,{points:e,props:w,clipPathId:i}))}function Wue(t,e,n){if(jt(t)){var r=jt(e)?e:void 0;return Fc(r,t,n)}if(Gi(t)||kl(t)){var i=jt(e)?e:void 0;return Fc(i,0,n)}return t}function $ue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=t.previousPointsRef,s=t.previousBaselineRef,o=r.points,a=r.baseLine,l=r.isAnimationActive,c=r.animationBegin,d=r.animationDuration,f=r.animationEasing,g=r.animationMatchBy,y=r.animationInterpolateFn,x=P.useMemo(()=>({points:o,baseLine:a}),[o,a]),S=CH(x,s),w=ZP(),b=gle(r.onAnimationStart,r.onAnimationEnd),M=b.isAnimating,T=b.handleAnimationStart,C=b.handleAnimationEnd,O=S.startValue;if(w==null)return null;var N;return Array.isArray(a)&&Array.isArray(O)?N=FC(O,a,g):Array.isArray(a)?N=FC(null,a,g):N=null,P.createElement(vle,{animationInput:x,animationIdPrefix:"recharts-area-",items:o,previousItemsRef:i,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:T,onAnimationEnd:C,animationInterpolateFn:y,animationMatchBy:g,layout:w},(L,F,G)=>{var k;return F===1?k=a:Array.isArray(a)?k=y(N,F,w):k=G?a:Wue(a,O,F),S.syncStepValue(k,F),P.createElement(Vue,{showLabels:!M,points:o},r.children,P.createElement(Gue,{points:L,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:F,isAnimating:M||F<1,isEntrance:G}),P.createElement(Bae,{label:r.label}))})}function Xue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=P.useRef(null),s=P.useRef();return P.createElement($ue,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class que extends P.PureComponent{render(){var e=this.props,n=e.hide,r=e.dot,i=e.points,s=e.className,o=e.top,a=e.left,l=e.needClip,c=e.xAxisId,d=e.yAxisId,f=e.width,g=e.height,y=e.id,x=e.baseLine,S=e.zIndex;if(n)return null;var w=ir("recharts-area",s),b=y,M=xue(r),T=M.r,C=M.strokeWidth,O=AH(r),N=T*2+C,L=l?"url(#clipPath-".concat(O?"":"dots-").concat(b,")"):void 0;return P.createElement(au,{zIndex:S},P.createElement(Jo,{className:w},l&&P.createElement("defs",null,P.createElement(yue,{clipPathId:b,xAxisId:c,yAxisId:d}),!O&&P.createElement("clipPath",{id:"clipPath-dots-".concat(b)},P.createElement("rect",{x:a-N/2,y:o-N/2,width:f+N,height:g+N}))),P.createElement(Xue,{needClip:l,clipPathId:b,props:this.props})),P.createElement(u3,{points:i,mainColor:Yw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:L}),this.props.isRange&&Array.isArray(x)&&P.createElement(u3,{points:x,mainColor:Yw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:L}))}}function Kue(t){var e,n=t.activeDot,r=t.animationBegin,i=t.animationDuration,s=t.animationEasing,o=t.connectNulls,a=t.dot,l=t.fill,c=t.fillOpacity,d=t.hide,f=t.isAnimationActive,g=t.legendType,y=t.stroke,x=t.xAxisId,S=t.yAxisId,w=qH(t,Oue),b=Gg(),M=rH(),T=BH(x,S),C=T.needClip,O=to(),N=(e=Gt(pe=>Eue(pe,t.id,O)))!==null&&e!==void 0?e:{},L=N.points,F=N.isRange,G=N.baseLine,k=oR();if(b!=="horizontal"&&b!=="vertical"||k==null||M!=="AreaChart"&&M!=="ComposedChart")return null;var U=k.height,H=k.width,te=k.x,ee=k.y;return!L||!L.length?null:P.createElement(que,Kw({},w,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:G,connectNulls:o,dot:a,fill:l,fillOpacity:c,height:U,hide:d,layout:b,isAnimationActive:f,isRange:F,legendType:g,needClip:C,points:L,stroke:y,width:H,left:te,top:ee,xAxisId:x,yAxisId:S}))}var Yue=(t,e,n,r,i)=>{var s=n??e;if(jt(s))return s;var o=t==="horizontal"?i:r,a=o.scale.domain();if(o.type==="number"){var l=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]);return s==="dataMin"?c:s==="dataMax"||l<0?l:Math.max(Math.min(a[0],a[1]),0)}return s==="dataMin"?a[0]:s==="dataMax"?a[1]:a[0]};function Zue(t){var e=t.areaSettings,n=e.connectNulls,r=e.baseValue,i=e.dataKey,s=t.stackedData,o=t.layout,a=t.chartBaseValue,l=t.xAxis,c=t.yAxis,d=t.displayedData,f=t.dataStartIndex,g=t.xAxisTicks,y=t.yAxisTicks,x=t.bandSize,S=s&&s.length,w=Yue(o,a,r,l,c),b=o==="horizontal",M=!1,T=d.map((O,N)=>{var L,F,G,k;if(S)k=s[f+N];else{var U=wi(O,i);Array.isArray(U)?(k=U,M=!0):k=[w,U]}var H=(L=(F=k)===null||F===void 0?void 0:F[1])!==null&&L!==void 0?L:null,te=H==null||S&&!n&&wi(O,i)==null;if(b){var ee;return{x:pk({axis:l,ticks:g,bandSize:x,entry:O,index:N}),y:te?null:(ee=c.scale.map(H))!==null&&ee!==void 0?ee:null,value:k,payload:O}}return{x:te?null:(G=l.scale.map(H))!==null&&G!==void 0?G:null,y:pk({axis:c,ticks:y,bandSize:x,entry:O,index:N}),value:k,payload:O}}),C;return S||M?C=T.map(O=>{var N,L=Array.isArray(O.value)?O.value[0]:null;if(b){var F;return{x:O.x,y:L!=null&&O.y!=null&&(F=c.scale.map(L))!==null&&F!==void 0?F:null,payload:O.payload}}return{x:L!=null&&(N=l.scale.map(L))!==null&&N!==void 0?N:null,y:O.y,payload:O.payload}}):C=b?c.scale.map(w):l.scale.map(w),{points:T,baseLine:C??0,isRange:M}}function Que(t){var e=na(t,KH),n=to();return P.createElement(Ale,{id:e.id,type:"area"},r=>P.createElement(P.Fragment,null,P.createElement(ele,{legendPayload:zue(e)}),P.createElement(Bue,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:r}),P.createElement(kle,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:LY(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),P.createElement(Kue,Kw({},e,{id:r}))))}var YH=P.memo(Que,SS);YH.displayName="Area";var Jue=["domain","range"],ede=["domain","range"];function b3(t,e){if(t==null)return{};var n,r,i=tde(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{if(o!=null)return S3(S3({},s),{},{type:o})},[s,o]);return P.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Xle(a)):n.current!==a&&e(qle({prev:n.current,next:a})),n.current=a)},[a,e]),P.useLayoutEffect(()=>()=>{n.current&&(e(Kle(n.current)),n.current=null)},[e]),null}var ude=t=>{var e=t.xAxisId,n=t.className,r=Gt(w4),i=to(),s="xAxis",o=Gt(g=>IB(g,s,e,i)),a=Gt(g=>Gre(g,e)),l=Gt(g=>Yre(g,e)),c=Gt(g=>Kz(g,e));if(a==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=BC(t,rde);c.id,c.scale;var f=BC(c,ide);return P.createElement(lR,zC({},d,f,{x:l.x,y:l.y,width:a.width,height:a.height,className:ir("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:o,axisType:s,axisId:e}))},dde={allowDataOverflow:ii.allowDataOverflow,allowDecimals:ii.allowDecimals,allowDuplicatedCategory:ii.allowDuplicatedCategory,angle:ii.angle,axisLine:Wc.axisLine,height:ii.height,hide:!1,includeHidden:ii.includeHidden,interval:ii.interval,label:!1,minTickGap:ii.minTickGap,mirror:ii.mirror,orientation:ii.orientation,padding:ii.padding,reversed:ii.reversed,scale:ii.scale,tick:ii.tick,tickCount:ii.tickCount,tickLine:Wc.tickLine,tickSize:Wc.tickSize,type:ii.type,niceTicks:ii.niceTicks,xAxisId:0},fde=t=>{var e=na(t,dde);return P.createElement(P.Fragment,null,P.createElement(cde,{allowDataOverflow:e.allowDataOverflow,allowDecimals:e.allowDecimals,allowDuplicatedCategory:e.allowDuplicatedCategory,angle:e.angle,dataKey:e.dataKey,domain:e.domain,height:e.height,hide:e.hide,id:e.xAxisId,includeHidden:e.includeHidden,interval:e.interval,minTickGap:e.minTickGap,mirror:e.mirror,name:e.name,orientation:e.orientation,padding:e.padding,reversed:e.reversed,scale:e.scale,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,niceTicks:e.niceTicks}),P.createElement(ude,e))},QH=P.memo(fde,ZH);QH.displayName="XAxis";var hde=["type"],pde=["dangerouslySetInnerHTML","ticks","scale"],mde=["id","scale"];function HC(){return HC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(o!=null)return E3(E3({},s),{},{type:o})},[o,s]);return P.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Yle(a)):n.current!==a&&e(Zle({prev:n.current,next:a})),n.current=a)},[a,e]),P.useLayoutEffect(()=>()=>{n.current&&(e(Qle(n.current)),n.current=null)},[e]),null}function _de(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=P.useRef(null),o=P.useRef(null),a=Gt(w4),l=to(),c=qr(),d="yAxis",f=Gt(b=>Jre(b,e)),g=Gt(b=>Qre(b,e)),y=Gt(b=>IB(b,d,e,l)),x=Gt(b=>Yz(b,e));if(P.useLayoutEffect(()=>{if(!(r!=="auto"||!f||rR(i)||P.isValidElement(i)||x==null)){var b=s.current;if(b){var M=b.getCalculatedWidth();Math.round(f.width)!==Math.round(M)&&c(Jle({id:e,width:M}))}}},[y,f,c,i,e,r,x]),f==null||g==null||x==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=VC(t,pde);x.id,x.scale;var w=VC(x,mde);return P.createElement(lR,HC({},S,w,{ref:s,labelRef:o,x:g.x,y:g.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:f.width,height:f.height,className:ir("recharts-".concat(d," ").concat(d),n),viewBox:a,ticks:y,axisType:d,axisId:e}))}var wde={allowDataOverflow:si.allowDataOverflow,allowDecimals:si.allowDecimals,allowDuplicatedCategory:si.allowDuplicatedCategory,angle:si.angle,axisLine:Wc.axisLine,hide:!1,includeHidden:si.includeHidden,interval:si.interval,label:!1,minTickGap:si.minTickGap,mirror:si.mirror,orientation:si.orientation,padding:si.padding,reversed:si.reversed,scale:si.scale,tick:si.tick,tickCount:si.tickCount,tickLine:Wc.tickLine,tickSize:Wc.tickSize,type:si.type,niceTicks:si.niceTicks,width:si.width,yAxisId:0},Sde=t=>{var e=na(t,wde);return P.createElement(P.Fragment,null,P.createElement(bde,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter,niceTicks:e.niceTicks}),P.createElement(_de,e))},JH=P.memo(Sde,ZH);JH.displayName="YAxis";var Mde=(t,e)=>e,fR=Ie([Mde,gr,uz,Ei,ZB,ou,_se,$i],Cse);function Ede(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function hR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(Ede(t)){var i=t.currentTarget.getBBox();n=i.width>0?e.width/i.width:1,r=i.height>0?e.height/i.height:1}else{var s=t.currentTarget;n=s.offsetWidth>0?e.width/s.offsetWidth:1,r=s.offsetHeight>0?e.height/s.offsetHeight:1}var o=(a,l)=>({relativeX:Math.round((a-e.left)/n),relativeY:Math.round((l-e.top)/r)});return"touches"in t?Array.from(t.touches).map(a=>o(a.clientX,a.clientY)):o(t.clientX,t.clientY)}var eV=Co("mouseClick"),tV=Xy();tV.startListening({actionCreator:eV,effect:(t,e)=>{var n=t.payload,r=fR(e.getState(),hR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(pie({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var GC=Co("mouseMove"),nV=Xy(),fm=null,Mf=null,qE=null;nV.startListening({actionCreator:GC,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||(o==null?void 0:o.includes("mousemove"));fm!==null&&(cancelAnimationFrame(fm),fm=null),Mf!==null&&(typeof s!="number"||!a)&&(clearTimeout(Mf),Mf=null),qE=hR(n);var l=()=>{var c=e.getState(),d=ox(c,c.tooltip.settings.shared);if(!qE){fm=null,Mf=null;return}if(d==="axis"){var f=fR(c,qE);(f==null?void 0:f.activeIndex)!=null?e.dispatch(BB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(zB())}fm=null,Mf=null};if(!a){l();return}s==="raf"?fm=requestAnimationFrame(l):typeof s=="number"&&Mf===null&&(Mf=setTimeout(l,s))}});function Ade(t,e){return e instanceof HTMLElement?"HTMLElement <".concat(e.tagName,' class="').concat(e.className,'">'):e===window?"global.window":t==="children"&&typeof e=="object"&&e!==null?"<>":e}var A3={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},rV=ds({name:"rootProps",initialState:A3,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:A3.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className,t.baseValue=e.payload.baseValue,t.reverseStackOrder=e.payload.reverseStackOrder}}}),Tde=rV.reducer,Cde=rV.actions.updateOptions,Pde=null,Rde={updatePolarOptions:(t,e)=>t===null?e.payload:(t.startAngle=e.payload.startAngle,t.endAngle=e.payload.endAngle,t.cx=e.payload.cx,t.cy=e.payload.cy,t.innerRadius=e.payload.innerRadius,t.outerRadius=e.payload.outerRadius,t)},iV=ds({name:"polarOptions",initialState:Pde,reducers:Rde});iV.actions.updatePolarOptions;var Nde=iV.reducer,sV=Co("keyDown"),oV=Co("focus"),aV=Co("blur"),VS=Xy(),hm=null,Ef=null,Lb=null;VS.startListening({actionCreator:sV,effect:(t,e)=>{Lb=t.payload,hm!==null&&(cancelAnimationFrame(hm),hm=null);var n=e.getState(),r=n.eventSettings,i=r.throttleDelay,s=r.throttledEvents,o=s==="all"||s.includes("keydown");Ef!==null&&(typeof i!="number"||!o)&&(clearTimeout(Ef),Ef=null);var a=()=>{try{var l=e.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var d=l.tooltip.keyboardInteraction,f=Lb;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var g=$0(d,jh(l),Rg(l),Ng(l)),y=g==null?-1:Number(g),x=!Number.isFinite(y)||y<0,S=ou(l),w=jh(l),b=ox(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var M=Gw(l,b,"hover",String(d.index));e.dispatch(Vw({active:!d.active,activeIndex:d.index,activeCoordinate:M}));return}var T=iie(l),C=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(x){var L=Rg(l),F=Ng(l),G=O*C,k=pe=>({active:!1,index:String(pe),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(N=-1,G>0){for(var U=0;U=0;H--)if($0(k(H),w,L,F)!=null){N=H;break}if(N<0)return}else{N=y+O*C;var te=(S==null?void 0:S.length)||w.length;if(te===0||N>=te||N<0)return}var ee=Gw(l,b,"hover",String(N));e.dispatch(Vw({active:!0,activeIndex:N.toString(),activeCoordinate:ee}))}finally{hm=null,Ef=null}};if(!o){a();return}i==="raf"?hm=requestAnimationFrame(a):typeof i=="number"&&Ef===null&&(a(),Lb=null,Ef=setTimeout(()=>{Lb?a():(Ef=null,hm=null)},i))}});VS.startListening({actionCreator:oV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;if(!i.active&&i.index==null){var s="0",o=ox(n,n.tooltip.settings.shared),a=Gw(n,o,"hover",String(s));e.dispatch(Vw({active:!0,activeIndex:s,activeCoordinate:a}))}}}});VS.startListening({actionCreator:aV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;i.active&&e.dispatch(Vw({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function lV(t){t.persist();var e=t.currentTarget;return new Proxy(t,{get:(n,r)=>{if(r==="currentTarget")return e;var i=Reflect.get(n,r);return typeof i=="function"?i.bind(n):i}})}var Go=Co("externalEvent"),cV=Xy(),Db=new Map,p0=new Map,KE=new Map;cV.startListening({actionCreator:Go,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,o=lV(i);KE.set(s,{handler:r,reactEvent:o});var a=Db.get(s);a!==void 0&&(cancelAnimationFrame(a),Db.delete(s));var l=e.getState(),c=l.eventSettings,d=c.throttleDelay,f=c.throttledEvents,g=f,y=g==="all"||(g==null?void 0:g.includes(s)),x=p0.get(s);x!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(x),p0.delete(s));var S=()=>{var M=KE.get(s);try{if(!M)return;var T=M.handler,C=M.reactEvent,O=e.getState(),N={activeCoordinate:ose(O),activeDataKey:rse(O),activeIndex:Sy(O),activeLabel:eH(O),activeTooltipIndex:Sy(O),isTooltipActive:ase(O)};T&&T(N,C)}finally{Db.delete(s),p0.delete(s),KE.delete(s)}};if(!y){S();return}if(d==="raf"){var w=requestAnimationFrame(S);Db.set(s,w)}else if(typeof d=="number"){if(!p0.has(s)){S();var b=setTimeout(S,d);p0.set(s,b)}}else S()}}});var Ide=Ie([Qg],t=>t.tooltipItemPayloads),kde=Ie([Ide,(t,e)=>e,(t,e,n)=>n],(t,e,n)=>{if(e!=null){var r=t.find(s=>s.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(e)}}}),uV=Co("touchMove"),dV=Xy(),Af=null,$u=null,T3=null,m0=null;dV.startListening({actionCreator:uV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){m0=lV(n);var r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||o.includes("touchmove");Af!==null&&(cancelAnimationFrame(Af),Af=null),$u!==null&&(typeof s!="number"||!a)&&(clearTimeout($u),$u=null),T3=Array.from(n.touches).map(c=>hR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(m0!=null){var c=e.getState(),d=ox(c,c.tooltip.settings.shared);if(d==="axis"){var f,g=(f=T3)===null||f===void 0?void 0:f[0];if(g==null){Af=null,$u=null;return}var y=fR(c,g);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(BB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var x,S=m0.touches[0];if(document.elementFromPoint==null||S==null)return;var w=document.elementFromPoint(S.clientX,S.clientY);if(!w||!w.getAttribute)return;var b=w.getAttribute(HY),M=(x=w.getAttribute(VY))!==null&&x!==void 0?x:void 0,T=Jh(c).find(N=>N.id===M);if(b==null||T==null||M==null)return;var C=T.dataKey,O=kde(c,b,M);e.dispatch(hie({activeDataKey:C,activeIndex:b,activeCoordinate:O,activeGraphicalItemId:M}))}Af=null,$u=null}};if(!a){l();return}s==="raf"?Af=requestAnimationFrame(l):typeof s=="number"&&$u===null&&(l(),m0=null,$u=setTimeout(()=>{m0?l():($u=null,Af=null)},s))}}});var fV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},hV=ds({name:"eventSettings",initialState:fV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),Ode=hV.actions.setEventSettings,Lde=hV.reducer,Dde=V5({brush:cce,cartesianAxis:ece,chartData:soe,errorBars:vue,eventSettings:Lde,graphicalItems:Nle,layout:AY,legend:zZ,options:eoe,polarAxis:Vae,polarOptions:Nde,referenceElements:hce,renderedTicks:Lce,rootProps:Tde,tooltip:mie,zIndex:Bse}),jde=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return ZK({reducer:Dde,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([tV.middleware,nV.middleware,VS.middleware,cV.middleware,dV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(i4({type:"raf"}))},devTools:{serialize:{replacer:Ade},name:"recharts-".concat(n)}})};function Ude(t){var e=t.preloadedState,n=t.children,r=t.reduxStoreName,i=to(),s=P.useRef(null);if(i)return n;s.current==null&&(s.current=jde(e,r));var o=HP;return P.createElement(nQ,{context:o,store:s.current},n)}function Fde(t){var e=t.layout,n=t.margin,r=qr(),i=to();return P.useEffect(()=>{i||(r(SY(e)),r(wY(n)))},[r,i,e,n]),null}var zde=P.memo(Fde,SS);function Bde(t){var e=qr();return P.useEffect(()=>{e(Cde(t))},[e,t]),null}var Hde=t=>{var e=qr();return P.useEffect(()=>{e(Ode(t))},[e,t]),null},Vde=P.memo(Hde,SS);function C3(t){var e=t.zIndex,n=t.isPanorama,r=P.useRef(null),i=qr();return P.useLayoutEffect(()=>(r.current&&i(Fse({zIndex:e,element:r.current,isPanorama:n})),()=>{i(zse({zIndex:e,isPanorama:n}))}),[i,e,n]),P.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function P3(t){var e=t.children,n=t.isPanorama,r=Gt(Rse);if(!r||r.length===0)return e;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return P.createElement(P.Fragment,null,i.map(o=>P.createElement(C3,{key:o,zIndex:o,isPanorama:n})),e,s.map(o=>P.createElement(C3,{key:o,zIndex:o,isPanorama:n})))}var Gde=["children"];function Wde(t,e){if(t==null)return{};var n,r,i=$de(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=T4(),r=C4(),i=U4();if(!Ll(n)||!Ll(r))return null;var s=t.children,o=t.otherAttributes,a=t.title,l=t.desc,c,d;return o!=null&&(typeof o.tabIndex=="number"?c=o.tabIndex:c=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),P.createElement(a5,Zw({},o,{title:a,desc:l,role:d,tabIndex:c,width:n,height:r,style:Xde,ref:e}),s)}),Kde=t=>{var e=t.children,n=Gt(yS);if(!n)return null;var r=n.width,i=n.height,s=n.y,o=n.x;return P.createElement(a5,{width:r,height:i,x:o,y:s},e)},R3=P.forwardRef((t,e)=>{var n=t.children,r=Wde(t,Gde),i=to();return i?P.createElement(Kde,null,P.createElement(P3,{isPanorama:!0},n)):P.createElement(qde,Zw({ref:e},r),P.createElement(P3,{isPanorama:!1},n))});function Yde(t,e){return efe(t)||Jde(t,e)||Qde(t,e)||Zde()}function Zde(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qde(t,e){if(t){if(typeof t=="string")return N3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?N3(t,e):void 0}}function N3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r!=null){var o=r.getBoundingClientRect(),a=o.width/r.offsetWidth;An(a)&&a!==s&&t(EY(a))}},[r,t,s]),i}function I3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function nfe(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n(poe(),null);function Jw(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var dfe=P.forwardRef((t,e)=>{var n,r,i=P.useRef(null),s=P.useState({containerWidth:Jw((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:Jw((r=t.style)===null||r===void 0?void 0:r.height)}),o=Qw(s,2),a=o[0],l=o[1],c=P.useCallback((f,g)=>{l(y=>{var x=Math.round(f),S=Math.round(g);return y.containerWidth===x&&y.containerHeight===S?y:{containerWidth:x,containerHeight:S}})},[]),d=P.useCallback(f=>{if(typeof e=="function"&&e(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var g=f.getBoundingClientRect(),y=g.width,x=g.height;c(y,x);var S=b=>{var M=b[0];if(M!=null){var T=M.contentRect,C=T.width,O=T.height;c(C,O)}},w=new ResizeObserver(S);w.observe(f),i.current=w}},[e,c]);return P.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),P.createElement(P.Fragment,null,P.createElement(Ky,{width:a.containerWidth,height:a.containerHeight}),P.createElement("div",Sd({ref:d},t)))}),ffe=P.forwardRef((t,e)=>{var n=t.width,r=t.height,i=P.useState({containerWidth:Jw(n),containerHeight:Jw(r)}),s=Qw(i,2),o=s[0],a=s[1],l=P.useCallback((d,f)=>{a(g=>{var y=Math.round(d),x=Math.round(f);return g.containerWidth===y&&g.containerHeight===x?g:{containerWidth:y,containerHeight:x}})},[]),c=P.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var f=d.getBoundingClientRect(),g=f.width,y=f.height;l(g,y)}},[e,l]);return P.createElement(P.Fragment,null,P.createElement(Ky,{width:o.containerWidth,height:o.containerHeight}),P.createElement("div",Sd({ref:c},t)))}),hfe=P.forwardRef((t,e)=>{var n=t.width,r=t.height;return P.createElement(P.Fragment,null,P.createElement(Ky,{width:n,height:r}),P.createElement("div",Sd({ref:e},t)))}),pfe=P.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?P.createElement(ffe,Sd({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?P.createElement(hfe,Sd({},t,{width:n,height:r,ref:e})):P.createElement(P.Fragment,null,P.createElement(Ky,{width:n,height:r}),P.createElement("div",Sd({ref:e},t)))});function mfe(t){return t?dfe:pfe}var gfe=P.forwardRef((t,e)=>{var n=t.children,r=t.className,i=t.height,s=t.onClick,o=t.onContextMenu,a=t.onDoubleClick,l=t.onMouseDown,c=t.onMouseEnter,d=t.onMouseLeave,f=t.onMouseMove,g=t.onMouseUp,y=t.onTouchEnd,x=t.onTouchMove,S=t.onTouchStart,w=t.style,b=t.width,M=t.responsive,T=t.dispatchTouchEvents,C=T===void 0?!0:T,O=P.useRef(null),N=qr(),L=P.useState(null),F=Qw(L,2),G=F[0],k=F[1],U=P.useState(null),H=Qw(U,2),te=H[0],ee=H[1],pe=tfe(),ie=KP(),fe=(ie==null?void 0:ie.width)>0?ie.width:b,B=(ie==null?void 0:ie.height)>0?ie.height:i,Q=P.useCallback(Oe=>{pe(Oe),typeof e=="function"&&e(Oe),k(Oe),ee(Oe),Oe!=null&&(O.current=Oe)},[pe,e,k,ee]),K=P.useCallback(Oe=>{N(eV(Oe)),N(Go({handler:s,reactEvent:Oe}))},[N,s]),V=P.useCallback(Oe=>{N(GC(Oe)),N(Go({handler:c,reactEvent:Oe}))},[N,c]),q=P.useCallback(Oe=>{N(zB()),N(Go({handler:d,reactEvent:Oe}))},[N,d]),he=P.useCallback(Oe=>{N(GC(Oe)),N(Go({handler:f,reactEvent:Oe}))},[N,f]),ae=P.useCallback(()=>{N(oV())},[N]),ce=P.useCallback(()=>{N(aV())},[N]),we=P.useCallback(Oe=>{N(sV(Oe.key))},[N]),Ee=P.useCallback(Oe=>{N(Go({handler:o,reactEvent:Oe}))},[N,o]),Xe=P.useCallback(Oe=>{N(Go({handler:a,reactEvent:Oe}))},[N,a]),Se=P.useCallback(Oe=>{N(Go({handler:l,reactEvent:Oe}))},[N,l]),je=P.useCallback(Oe=>{N(Go({handler:g,reactEvent:Oe}))},[N,g]),$e=P.useCallback(Oe=>{N(Go({handler:S,reactEvent:Oe}))},[N,S]),ue=P.useCallback(Oe=>{C&&N(uV(Oe)),N(Go({handler:x,reactEvent:Oe}))},[N,C,x]),Z=P.useCallback(Oe=>{N(Go({handler:y,reactEvent:Oe}))},[N,y]),Ve=mfe(M);return P.createElement(lH.Provider,{value:G},P.createElement(RX.Provider,{value:te},P.createElement(Ve,{width:fe??(w==null?void 0:w.width),height:B??(w==null?void 0:w.height),className:ir("recharts-wrapper",r),style:nfe({position:"relative",cursor:"default",width:fe,height:B},w),onClick:K,onContextMenu:Ee,onDoubleClick:Xe,onFocus:ae,onBlur:ce,onKeyDown:we,onMouseDown:Se,onMouseEnter:V,onMouseLeave:q,onMouseMove:he,onMouseUp:je,onTouchEnd:Z,onTouchMove:ue,onTouchStart:$e,ref:Q},P.createElement(ufe,null),n)))}),vfe=["width","height","responsive","children","className","style","compact","title","desc"];function yfe(t,e){if(t==null)return{};var n,r,i=xfe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=t.width,r=t.height,i=t.responsive,s=t.children,o=t.className,a=t.style,l=t.compact,c=t.title,d=t.desc,f=yfe(t,vfe),g=Ba(f);return l?P.createElement(P.Fragment,null,P.createElement(Ky,{width:n,height:r}),P.createElement(R3,{otherAttributes:g,title:c,desc:d},s)):P.createElement(gfe,{className:o,style:a,width:n,height:r,responsive:i??!1,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},P.createElement(R3,{otherAttributes:g,title:c,desc:d,ref:e},P.createElement(bce,null,s)))});function WC(){return WC=Object.assign?Object.assign.bind():function(t){for(var e=1;eP.createElement(Tfe,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Cfe,tooltipPayloadSearcher:Qse,categoricalChartProps:t,ref:e}));const Rfe="rgba(130,130,150,0.14)",L3="rgba(130,130,150,0.85)";function Nfe(t){if(t<=0)return 10;const e=Math.pow(10,Math.floor(Math.log10(t))),n=t/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function pV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function Ife({active:t,payload:e,unit:n}){return!t||!(e!=null&&e.length)?null:p.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:p.jsx("div",{className:"space-y-1",children:e.map(r=>p.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[p.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:r.color}}),p.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:r.name}),p.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:pV(r.value,n)})]},r.dataKey))})})}function mV({data:t,series:e,unit:n="%",yMode:r="percent",height:i=176}){const s=t.reduce((a,l)=>e.reduce((c,d)=>Math.max(c,Number(l[d.key])||0),a),0),o=r==="percent"?Math.min(100,Math.max(25,Math.ceil(s*1.2/25)*25)):Math.max(Nfe(s*1.15),10);return p.jsx("div",{style:{height:i},className:"w-full",children:p.jsx(wZ,{width:"100%",height:"100%",children:p.jsxs(Pfe,{data:t,margin:{top:8,right:6,bottom:0,left:-12},children:[p.jsx("defs",{children:e.map(a=>p.jsxs("linearGradient",{id:`grad-${a.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[p.jsx("stop",{offset:"0%",stopColor:a.color,stopOpacity:.22}),p.jsx("stop",{offset:"100%",stopColor:a.color,stopOpacity:0})]},a.key))}),p.jsx(FH,{vertical:!1,stroke:Rfe}),p.jsx(QH,{dataKey:"t",hide:!0}),p.jsx(JH,{domain:[0,o],ticks:[0,o/2,o],tickFormatter:a=>pV(a,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:L3}}),p.jsx(Toe,{content:p.jsx(Ife,{unit:n}),cursor:{stroke:L3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(a=>p.jsx(YH,{type:"monotone",dataKey:a.key,name:a.label,stroke:a.color,strokeWidth:2,fill:`url(#grad-${a.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},a.key))]})})})}const kfe=[{key:"cpu",label:"CPU",color:"#2dd4bf"},{key:"ram",label:"RAM",color:"#38bdf8"},{key:"gpu",label:"GPU",color:"#a78bfa"},{key:"disk",label:"Disk",color:"#fbbf24"}];function Ofe(){var o,a,l,c;const{sys:t,hist:e}=xX(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=kfe.filter(d=>d.key!=="gpu"||n),i={cpu:(o=t==null?void 0:t.cpu)==null?void 0:o.percent,ram:(a=t==null?void 0:t.ram)==null?void 0:a.percent,gpu:n?t.gpu.busy_percent:null,disk:(l=t==null?void 0:t.disk)==null?void 0:l.percent},s={cpu:(c=t==null?void 0:t.cpu)!=null&&c.cores?`${t.cpu.cores} Cores`:"",ram:t?`${om(t.ram.used)}/${om(t.ram.total)} GB`:"",gpu:n?`${om(t.gpu.gtt_used)}/${om(t.gpu.gtt_total)} GB`:"",disk:t!=null&&t.disk?`${om(t.disk.used)}/${om(t.disk.total)} GB`:""};return p.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[p.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),p.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t?p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:r.map(d=>p.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[p.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:d.color}}),p.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:d.label}),p.jsxs("span",{className:"shrink-0 font-mono text-xs font-bold tabular-nums text-foreground",children:[Math.round(i[d.key]??0),"%"]}),s[d.key]&&p.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:s[d.key]})]},d.key))}),p.jsx(mV,{data:e,series:r,unit:"%",yMode:"percent",height:176})]}):p.jsx("div",{className:"flex h-44 items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(t==null?void 0:t.temp)&&(t.temp.cpu||t.temp.gpu)&&p.jsxs("div",{className:"mt-3 flex gap-4 border-t border-border/30 pt-3 font-mono text-xs text-muted-foreground/80",children:[t.temp.cpu!=null&&p.jsxs("span",{children:["CPU Temp: ",t.temp.cpu," °C"]}),t.temp.gpu!=null&&p.jsxs("span",{children:["GPU Temp: ",t.temp.gpu," °C"]})]})]})}function g0({label:t,value:e,tone:n}){return p.jsxs("div",{className:tt("flex items-center justify-between rounded-lg border px-3 py-1.5 text-xs",n==="alert"?"border-amber-500/30 bg-amber-500/5 font-semibold text-amber-400":n==="accent"?"border-primary/30 bg-primary/5 font-semibold text-primary":"border-border/30 bg-background/25 text-muted-foreground"),children:[p.jsx("span",{className:"flex items-center gap-1.5",children:t}),p.jsx("span",{className:"font-mono text-[10px]",children:e})]})}function Lfe(){var n;const{data:t}=IP(3e3),e=()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}}));return p.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/20 pb-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(o9,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Updates & Pflege"})]}),(t==null?void 0:t.last_check)&&p.jsxs("span",{className:"font-mono text-[9px] text-muted-foreground/80",children:["Zuletzt gesucht: ",new Date(t.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),t?p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(g0,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),p.jsx(g0,{label:"Inferenz-Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),p.jsx(g0,{label:"Router (llama-swap)",tone:t.swap>0?"alert":"muted",value:t.swap>0?"Update verfügbar":"aktuell"}),p.jsx(g0,{label:"Modell-Upgrades",tone:t.models>0?"accent":"muted",value:t.models>0?`${t.models} verfügbar`:"aktuell"}),(n=t.components)==null?void 0:n.map(r=>p.jsx(g0,{tone:r.update===!0?"alert":"muted",label:p.jsxs(p.Fragment,{children:[r.name,r.reachable===!1&&p.jsx("span",{className:"text-[8px] font-bold uppercase text-red-400/80",children:"offline"})]}),value:r.update===!0?`Update: ${r.latest}`:r.update===!1?"aktuell":r.latest?`neueste: ${r.latest}`:"—"},r.key))]}):p.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."})]}),p.jsxs("button",{onClick:e,className:"mt-4 flex h-9 w-full items-center justify-center gap-1.5 rounded-lg bg-primary text-xs font-semibold text-primary-foreground shadow-md shadow-primary/10 transition-all hover:opacity-90 cursor-pointer",children:["Updates verwalten & Pflege ",p.jsx(lF,{className:"h-3.5 w-3.5"})]})]})}function gV({type:t,title:e,message:n,defaultValue:r,autoValue:i,autoLabel:s,onConfirm:o,onCancel:a}){const l=P.useRef(null);return p.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:p.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[p.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:e}),p.jsx("button",{onClick:a||(()=>o()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:p.jsx(Al,{className:"h-4 w-4"})})]}),p.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:n}),t==="prompt"&&p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{ref:l,type:"text",defaultValue:r,className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:c=>{var d;c.key==="Enter"&&o((d=l.current)==null?void 0:d.value)}}),i!==void 0&&p.jsx("button",{type:"button",onClick:()=>{l.current&&(l.current.value=i)},title:"Setup-bewussten Optimalwert eintragen",className:"h-9 px-3 shrink-0 text-xs font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg transition-colors cursor-pointer",children:s||"Auto"})]}),p.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(t==="confirm"||t==="prompt")&&p.jsx("button",{onClick:a,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),p.jsx("button",{onClick:()=>{var d;const c=t==="prompt"?(d=l.current)==null?void 0:d.value:void 0;o(c)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:t==="confirm"?"Ja, fortfahren":t==="prompt"?"Übernehmen":"OK"})]})]})})}function tv(){const[t,e]=P.useState(null),n=P.useCallback(()=>e(null),[]),r=P.useCallback((a,l,c)=>{e({type:"alert",title:a,message:l,onConfirm:()=>{e(null),c==null||c()}})},[]),i=P.useCallback((a,l,c,d)=>{e({type:"confirm",title:a,message:l,onConfirm:()=>{e(null),c()},onCancel:()=>{e(null),d==null||d()}})},[]),s=P.useCallback((a,l,c,d,f,g)=>{e({type:"prompt",title:a,message:l,defaultValue:c,autoValue:g==null?void 0:g.autoValue,autoLabel:g==null?void 0:g.autoLabel,onConfirm:y=>{e(null),d(y)},onCancel:()=>{e(null),f==null||f()}})},[]),o=t?p.jsx(gV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:o}}function Dfe(){const t=Rd(),{data:e}=NP(3e3),{data:n}=Kh(),{showAlert:r,dialogElement:i}=tv(),[s,o]=P.useState(!1),a=(n==null?void 0:n.models)??[];async function l(c){try{await Lt("/api/agent/brain",{method:"POST",body:JSON.stringify({model:c})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${c}' geändert. Der Gateway-Dienst wurde neu gestartet.`),t.invalidateQueries({queryKey:Jn.agentStatus}),o(!1)}catch(d){r("Fehler",`Fehler beim Wechseln des Gehirns: ${d.message}`)}}return p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center justify-between mb-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Il,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(e==null?void 0:e.terminal_url)&&p.jsxs("a",{href:Mg(e.terminal_url),target:"_blank",rel:"noopener",className:tt("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",e.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[p.jsx(bg,{className:"h-3 w-3"})," Terminal öffnen"]})]}),e?p.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[p.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),p.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[p.jsx("span",{className:tt("h-2 w-2 rounded-full",e.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),p.jsx("span",{className:"text-xs font-medium",children:e.gateway_reachable?"Online":"Offline"})]})]}),p.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[p.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Terminal"}),p.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[p.jsx("span",{className:tt("h-2 w-2 rounded-full",e.terminal_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),p.jsx("span",{className:"text-xs font-medium",children:e.terminal_reachable?"Online":"Offline"})]})]}),p.jsxs("div",{onClick:()=>o(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),p.jsx(El,{className:"h-3 w-3 text-primary"})]}),p.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[p.jsx(X1,{className:"h-3 w-3 shrink-0"}),e.brain_model||"auto"]})]}),p.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),p.jsx(iw,{className:"h-3 w-3 text-primary"})]}),p.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[p.jsxs("div",{children:["Config: ",e.has_config?p.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),p.jsxs("div",{children:["Skills: ",e.has_skills?p.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),p.jsxs("div",{children:["Memory: ",e.has_memories?p.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):p.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),e&&p.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[p.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[p.jsx("span",{children:"Telegram"}),p.jsx("span",{className:tt("font-semibold",e.telegram_enabled?"text-emerald-400":""),children:e.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),p.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[p.jsx("span",{children:"MCP-Server"}),p.jsxs("span",{className:"font-semibold text-foreground",children:[e.mcp_server_count??0," verbunden"]})]}),p.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[p.jsx("span",{children:"PC Executor"}),p.jsx("span",{className:tt("font-semibold",e.pc_executor_reachable?"text-emerald-400":""),children:e.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),e&&s&&p.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:p.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[p.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[p.jsx(El,{className:"h-4 w-4"}),p.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),p.jsx("button",{onClick:()=>o(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:p.jsx(Al,{className:"h-4 w-4"})})]}),p.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',p.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",p.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",p.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),p.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...a.map(c=>{var d;return((d=c.name.split("/").pop())==null?void 0:d.replace(".gguf",""))||c.name})].map(c=>{const d=["auto","fast","heavy"].includes(c);return p.jsxs("button",{onClick:()=>l(c),className:tt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",e.brain_model===c||!e.brain_model&&c==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[p.jsxs("div",{className:"flex flex-col text-left",children:[p.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:c}),p.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:d?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(e.brain_model===c||!e.brain_model&&c==="auto")&&p.jsx(So,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function jfe(){const{data:t}=Kh(3e3),e=(t==null?void 0:t.models)??[],n=(t==null?void 0:t.running)??[];return p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[p.jsx(X1,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),p.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:n5.map(r=>{var o;const i=e.find(a=>a.role===r),s=i?n.includes(i.name):!1;return p.jsxs("div",{className:tt("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",s?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":i?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[p.jsx("div",{className:"min-w-0 flex-1 mr-2",children:p.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[p.jsx("span",{className:tt("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",OP(r)),children:r}),p.jsxs("div",{className:"flex flex-col min-w-0",children:[p.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:i?(o=i.name.split("/").pop())==null?void 0:o.replace(/\.gguf$/i,""):"nicht zugewiesen"}),i&&p.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[i.prompt_cache&&p.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),i.spec_active&&p.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${i.spec_draft_model})`,children:"SPEC"}),i.parallel_slots>1&&p.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${i.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",i.parallel_slots]}),i.incomplete&&p.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),p.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:i?s?p.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):p.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):p.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},r)})})]}),p.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]})}function Ufe(){const t=Rd(),{data:e=[]}=$T({limit:3}),[n,r]=P.useState(""),[i,s]=P.useState("stable"),[o,a]=P.useState(!1);async function l(){if(!(!n.trim()||o)){a(!0);try{await Lt("/api/memory",{method:"POST",body:JSON.stringify({content:n,category:i,source:"dashboard"})}),r(""),t.invalidateQueries({queryKey:["memory"]})}catch(c){console.error(c)}finally{a(!1)}}}return p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[p.jsx($1,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsx("textarea",{value:n,onChange:c=>r(c.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),p.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[p.jsxs("select",{value:i,onChange:c=>s(c.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[p.jsx("option",{value:"stable",children:"🔵 Fakt"}),p.jsx("option",{value:"instruction",children:"📋 Regel"}),p.jsx("option",{value:"user",children:"👤 User"}),p.jsx("option",{value:"versioned",children:"🟡 Version"})]}),p.jsxs("button",{onClick:l,disabled:!n.trim()||o,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[p.jsx(UT,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),p.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[p.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),p.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:e.length===0?p.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):e.map(c=>p.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[p.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:c.category}),p.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:c.content,children:c.content})]},c.id))})]})]}),p.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}const D3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Ffe(){const{data:t}=RP(3e3),e=vX(),n=e[e.length-1],r=n?Math.round(n.prompt+n.completion):0;return p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[p.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(ay,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),p.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t&&p.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[p.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:r.toLocaleString("de-DE")}),p.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),t&&p.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[p.jsxs("div",{children:[t.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",p.jsxs("span",{className:"text-emerald-400/90",children:[t.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),p.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",t.prompt_tokens.toLocaleString("de-DE")," · Output ",t.completion_tokens.toLocaleString("de-DE")]})]})]}),p.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:D3.map(i=>p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),p.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),p.jsx("span",{className:"font-mono text-xs font-bold tabular-nums text-foreground",children:Math.round((n==null?void 0:n[i.key])??0)})]},i.key))})]}),t?p.jsx(mV,{data:e,series:D3,unit:" tok/s",yMode:"auto",height:150}):p.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),p.jsx("div",{className:"mt-2 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:"Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf."})]})}function zfe(){const{data:t}=w7(3e3),{showAlert:e,dialogElement:n}=tv(),[r,i]=P.useState({});async function s(o){i(a=>({...a,[o]:!0}));try{const a=await Lt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:o})});a.ok||e("Fehler",`Neustart fehlgeschlagen: ${a.err||"Unbekannt"}`)}catch(a){e("Fehler",`Fehler: ${a.message}`)}finally{i(a=>({...a,[o]:!1}))}}return p.jsxs("div",{className:"flex flex-col rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[p.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(rw,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Dienste"})]}),p.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground transition-colors hover:text-primary cursor-pointer",children:"Logs / Pflege"})]}),t?p.jsxs("div",{className:"flex flex-1 flex-col",children:[p.jsx("div",{className:"space-y-1.5",children:t.services.map(o=>p.jsxs("div",{className:"group flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[p.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[p.jsx("span",{className:tt("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",o.ok?"bg-emerald-500":"bg-amber-500")}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"truncate text-xs font-bold text-foreground",children:o.name}),p.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:o.url})]})]}),p.jsx("button",{onClick:()=>s(o.name),disabled:r[o.name],className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground opacity-0 transition-all hover:bg-primary/5 hover:text-primary group-hover:opacity-100",title:"Dienst neu starten",children:p.jsx(Qf,{className:tt("h-3.5 w-3.5",r[o.name]&&"animate-spin")})})]},o.name))}),p.jsxs("div",{className:"mt-auto flex flex-wrap gap-3 border-t border-border/20 pt-2.5 text-[10px] font-semibold text-muted-foreground",children:[p.jsxs("a",{href:Mg(t.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[p.jsx(bg,{className:"h-3 w-3"})," Engine"]}),p.jsxs("a",{href:Mg(t.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[p.jsx(bg,{className:"h-3 w-3"})," Gateway"]})]})]}):p.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Dienste…"}),n]})}const YE=[{key:"stt",label:"STT",hint:"Sprache → Text"},{key:"vision",label:"Bildschirm-Sicht",hint:"Vision-Beschreibung"},{key:"chat_ttfb",label:"Chat-TTFB",hint:"Zeit bis 1. Token"},{key:"tts",label:"TTS",hint:"Text → Sprache"}];function jb(t){return t==null?"—":t>=1e3?`${(t/1e3).toFixed(2)} s`:`${Math.round(t)} ms`}function Bfe({stat:t,label:e,hint:n,maxP95:r}){const i=!!t&&t.count>0,s=i&&t.p95_ms&&r>0?Math.max(4,Math.min(100,t.p95_ms/r*100)):0;return p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[p.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[p.jsx("span",{className:"text-xs font-semibold text-foreground",children:e}),p.jsx("span",{className:"truncate text-[10px] text-muted-foreground/60",children:n})]}),i?p.jsx("span",{className:"shrink-0 font-mono text-sm font-bold tabular-nums text-foreground",children:jb(t.p50_ms)}):p.jsx("span",{className:"shrink-0 text-[10px] italic text-muted-foreground/50",children:"noch keine Messungen"})]}),p.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-background/50 border border-border/30",children:p.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-teal-500 to-indigo-500 transition-all duration-500",style:{width:`${s}%`}})}),i&&p.jsxs("div",{className:"flex items-center gap-3 font-mono text-[10px] text-muted-foreground/65",children:[p.jsxs("span",{children:["p50 ",jb(t.p50_ms)]}),p.jsxs("span",{children:["p95 ",jb(t.p95_ms)]}),p.jsxs("span",{children:["zuletzt ",jb(t.last_ms)]}),p.jsxs("span",{className:"text-muted-foreground/45",children:["· n=",t.count]})]})]})}function Hfe(){const{data:t}=E7(5e3),e=Math.max(1,...YE.map(r=>{var i;return((i=t==null?void 0:t[r.key])==null?void 0:i.p95_ms)??0})),n=YE.some(r=>{var i;return(((i=t==null?void 0:t[r.key])==null?void 0:i.count)??0)>0});return p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[p.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[p.jsx(uF,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Sprach-Latenz"}),p.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),p.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:YE.map(r=>p.jsx(Bfe,{stat:t==null?void 0:t[r.key],label:r.label,hint:r.hint,maxP95:e},r.key))}),p.jsx("div",{className:"mt-4 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:n?"Server-seitige Dauer je Pipeline-Stufe (p50 prominent). Rollender Schnitt über die letzten Turns; Reset bei Neustart.":"Noch keine Voice-Turns gemessen — sprich einmal über den „Sprechen“-Tab, dann erscheinen hier STT/Vision/Chat/TTS."})]})}function ZE({children:t}){return p.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t})}function Vfe(){return p.jsxs("div",{className:"space-y-7",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),p.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),p.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[p.jsx(Ofe,{}),p.jsx(Ffe,{}),p.jsx(hX,{})]}),p.jsxs("section",{children:[p.jsx(ZE,{children:"Stack-Status"}),p.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[p.jsx(jfe,{}),p.jsx(zfe,{})]})]}),p.jsxs("section",{children:[p.jsx(ZE,{children:"Sprach-Latenz"}),p.jsx(Hfe,{})]}),p.jsxs("section",{children:[p.jsx(ZE,{children:"Betrieb & Wissen"}),p.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[p.jsx(Lfe,{}),p.jsx(Dfe,{}),p.jsx(Ufe,{})]})]})]})}function Gfe(){const t=Rd(),{data:e=[]}=T7(2e3),{showAlert:n,dialogElement:r}=tv();async function i(a){try{await Lt(`/api/jobs/${a}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:Jn.jobs})}catch(l){n("Fehler",l.message)}}const s=e.filter(a=>a.state==="running"||a.state==="queued"),o=e.filter(a=>a.state!=="running"&&a.state!=="queued").slice(-3);return s.length===0&&o.length===0?null:p.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[p.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),s.map(a=>p.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[p.jsxs("div",{className:"flex justify-between items-center text-xs",children:[p.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:a.label}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("span",{className:"text-muted-foreground font-mono",children:[a.progress??0,"% • ",XT(a.done_bytes),"/",XT(a.total_bytes),a.eta_s?` • ETA ${I7(a.eta_s)}`:""]}),p.jsx("button",{onClick:()=>i(a.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),p.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:p.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${a.progress??0}%`}})})]},a.id)),o.map(a=>p.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[p.jsx("span",{className:"truncate",children:a.label}),p.jsx("span",{className:tt("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",a.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:a.state})]},a.id)),r]})}function Tf({children:t,tone:e="muted"}){const n={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return p.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${n[e]}`,children:t})}function j3({caps:t}){return t?p.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&p.jsx(Tf,{children:"💻 Code"}),t.vision&&p.jsx(Tf,{children:"👁 Bild"}),t.reasoning&&p.jsx(Tf,{children:"🧠 Reason"}),t.moe&&p.jsxs(Tf,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&p.jsx(Tf,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&p.jsx(Tf,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&p.jsx(Tf,{children:"🔢 Embed"})]}):null}function Wfe({model:t,onClose:e,onChanged:n}){var S,w;const{data:r,isLoading:i}=R7(t.gguf_path),[s,o]=P.useState(null),[a,l]=P.useState(""),c=r==null?void 0:r.target_vocab,d=(r==null?void 0:r.drafts)??[],f=d.filter(b=>b.compatible===!0),g=t.spec_draft_model;async function y(b){o(b??"__clear__"),l("");try{await Lt(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:b})}),n(),e()}catch(M){l(String((M==null?void 0:M.message)||M)),o(null)}}const x=b=>{var M;return b?`${b.pre??"?"} · ${((M=b.n_vocab)==null?void 0:M.toLocaleString())??"?"} Tokens`:"—"};return p.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:p.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[p.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[p.jsx(_h,{className:"h-4 w-4"})," Speculative Draft"]}),p.jsx("button",{onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:p.jsx(Al,{className:"h-4 w-4"})})]}),p.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',p.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),p.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[p.jsx("span",{className:"text-muted-foreground",children:(S=t.name.split("/").pop())==null?void 0:S.replace(/\.gguf$/i,"")}),p.jsxs("span",{className:"text-foreground",children:["Vocab: ",x(c)]})]}),t.spec_active&&g&&p.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[p.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[p.jsx(So,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",g]}),p.jsx("button",{onClick:()=>y(null),disabled:s!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(r!=null&&r.target_exists)&&p.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[p.jsx(_g,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),p.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?p.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):d.length===0?p.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",p.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):d.map(b=>{var C,O;const M=b.filename===g,T=b.compatible===!0;return p.jsxs("div",{className:tt("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",T?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",M&&"border-primary/40 bg-primary/10"),children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:b.filename}),p.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[Wo(b.size_bytes)," · Vocab: ",x(b.vocab)]})]}),T?M?p.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[p.jsx(So,{className:"h-3.5 w-3.5"})," Aktiv"]}):p.jsx("button",{onClick:()=>y(b.path),disabled:s!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):p.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:b.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(C=b.vocab)==null?void 0:C.pre}/${(O=b.vocab)==null?void 0:O.n_vocab} ≠ Modell ${c==null?void 0:c.pre}/${c==null?void 0:c.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[p.jsx(_g,{className:"h-3.5 w-3.5"})," ",b.compatible===!1?"Vocab ≠":"n/a"]})]},b.path)})}),!i&&(r==null?void 0:r.target_exists)&&d.length>0&&f.length===0&&p.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",p.jsx("span",{className:"font-mono",children:c==null?void 0:c.pre}),", n_vocab=",p.jsx("span",{className:"font-mono",children:(w=c==null?void 0:c.n_vocab)==null?void 0:w.toLocaleString()}),")."]}),a&&p.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:a})]})})}const $fe=["fast","heavy","heavy_chars"],Xfe=["coder_lite","coder","coding_escalate_chars"];function qfe(){const t=Rd(),{data:e,isLoading:n}=A7(),[r,i]=P.useState(null),[s,o]=P.useState(!1),[a,l]=P.useState(""),[c,d]=P.useState(0);if(P.useEffect(()=>{e!=null&&e.policy&&!r&&i({...e.policy})},[e,r]),n||!e||!r)return p.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 text-xs text-muted-foreground",children:"Lade Routing-Policy…"});const f=b=>e.fields.find(M=>M.key===b),g=Object.keys(r).some(b=>r[b]!==e.policy[b]),y=(b,M)=>{i(T=>T&&{...T,[b]:M}),l("")},x=b=>y(b,e.defaults[b]);async function S(){if(!r)return;const b={};for(const M of Object.keys(r))r[M]!==e.policy[M]&&(b[M]=r[M]);if(Object.keys(b).length!==0){o(!0),l("");try{const{policy:M}=await x7(b);i({...M}),t.invalidateQueries({queryKey:Jn.routingPolicy}),t.invalidateQueries({queryKey:Jn.routing}),d(Date.now()),setTimeout(()=>d(0),2e3)}catch(M){l(M.message||String(M))}finally{o(!1)}}}function w({k:b}){const M=f(b),T=r[b],C=r[b]===e.defaults[b];return p.jsxs("div",{className:"space-y-1",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("label",{className:"text-[10px] font-semibold text-muted-foreground",children:M.label}),!C&&p.jsxs("button",{onClick:()=>x(b),className:"flex items-center gap-0.5 text-[9px] text-muted-foreground/60 hover:text-foreground transition-colors cursor-pointer",title:`Auf Default zurücksetzen (${String(e.defaults[b])||"leer"})`,children:[p.jsx(fF,{className:"h-2.5 w-2.5"})," Default"]})]}),M.type==="bool"?p.jsxs("button",{onClick:()=>y(b,!T),className:tt("flex h-8 w-full items-center justify-between rounded-lg border px-3 text-[11px] font-semibold transition-all cursor-pointer",T?"border-emerald-500/40 bg-emerald-500/10 text-emerald-300":"border-border/40 bg-background/40 text-muted-foreground"),children:[p.jsx("span",{children:T?"An":"Aus"}),p.jsx("span",{className:tt("h-3.5 w-3.5 rounded-full transition-colors",T?"bg-emerald-400":"bg-muted-foreground/40")})]}):M.type==="int"?p.jsx("input",{type:"number",value:T,min:M.min,max:M.max,onChange:O=>y(b,Number(O.target.value)),className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50"}):p.jsx("input",{type:"text",value:T,placeholder:b==="coder_lite"?"(leer = aus)":"",onChange:O=>y(b,O.target.value),className:"h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50"})]})}return p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-4",children:[p.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(a9,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lane-Routing & Policy"}),p.jsx("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-emerald-500/10 text-emerald-300 border border-emerald-500/20",children:"hot-reload"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[a&&p.jsx("span",{className:"text-[10px] text-red-400 max-w-[280px] truncate",title:a,children:a}),c>0&&p.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-emerald-400",children:[p.jsx(So,{className:"h-3.5 w-3.5"})," gespeichert"]}),p.jsxs("button",{onClick:S,disabled:!g||s,className:tt("h-8 px-4 rounded-lg text-[10px] font-bold uppercase tracking-wide transition-all flex items-center gap-1.5",g&&!s?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer shadow-md shadow-primary/10":"bg-background/40 text-muted-foreground/50 border border-border/40 cursor-not-allowed"),children:[s?p.jsx(q1,{className:"h-3.5 w-3.5 animate-spin"}):null,"Speichern"]})]})]}),p.jsxs("p",{className:"text-[10px] text-muted-foreground/70 leading-relaxed -mt-1",children:["Welches echte Modell hinter den virtuellen Lanes ",p.jsx("code",{className:"text-cyan-300",children:"chat"})," und"," ",p.jsx("code",{className:"text-cyan-300",children:"coding"})," steckt. Änderungen greifen sofort (kein Neustart). Die Keyword-Heuristiken bleiben im Code."]}),p.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[p.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[p.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[p.jsx(q8,{className:"h-4 w-4 text-teal-400"}),p.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"chat"}),p.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(= auto)"})]}),$fe.map(b=>p.jsx(w,{k:b},b))]}),p.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[p.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[p.jsx(k8,{className:"h-4 w-4 text-indigo-400"}),p.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"coding"}),p.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(agentisch → immer Coder)"})]}),Xfe.map(b=>p.jsx(w,{k:b},b))]})]}),p.jsx("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4",children:p.jsx("div",{className:"max-w-xs",children:p.jsx(w,{k:"fast_no_think"})})})]})}function Kfe(){var yt,Jt,de,qe,le,Ye,Te,Fe,st,mt;const t=Rd(),{data:e,isLoading:n,error:r}=Kh(4e3),{data:i}=M7(4e3),{data:s}=KF(),{data:o}=IP(4e3),{data:a}=C7(),{data:l}=eS(),{data:c}=S7(),{showAlert:d,showConfirm:f,showPrompt:g,dialogElement:y}=tv(),x=(e==null?void 0:e.models)??[],S=(e==null?void 0:e.running)??[],w=r?String(r):"",b=()=>{t.invalidateQueries({queryKey:Jn.models}),t.invalidateQueries({queryKey:Jn.routing})},M=(yt=c==null?void 0:c.groups)==null?void 0:yt.brains,T=(M==null?void 0:M.members)??[],C=se=>T.includes(se),O=T.some(se=>S.includes(se));async function N(se){if(!M){d("Keine brains-Gruppe","Es existiert noch keine Ko-Residenz-Gruppe „brains“ in der Engine-Konfiguration. Lege sie erst über die Gruppen-Verwaltung an.");return}const it=T.includes(se)?T.filter(dt=>dt!==se):[...T,se];try{await y7("brains",it,M.swap??!1,M.persist??!0),t.invalidateQueries({queryKey:Jn.groups}),b()}catch(dt){d("Fehler",`Ko-Residenz konnte nicht geändert werden: ${dt.message||dt}`)}}const[L,F]=P.useState(null),[G,k]=P.useState(null),[U,H]=P.useState(null),[te,ee]=P.useState(null),[pe,ie]=P.useState(!1),[fe,B]=P.useState(!1),[Q,K]=P.useState(null),[V,q]=P.useState("grid"),[he,ae]=P.useState("all"),ce=x.filter(se=>he==="in_use"?!!se.role||S.includes(se.name):!0),[we,Ee]=P.useState({width:800,height:360}),Xe=P.useRef(null),Se=P.useCallback(se=>{if(Xe.current&&(Xe.current.disconnect(),Xe.current=null),se){const We=new ResizeObserver(it=>{if(!it||it.length===0)return;const dt=it[0].contentRect;Ee({width:dt.width,height:dt.height})});We.observe(se),Xe.current=We}},[]),je=we.width,$e=we.height,ue=se=>{const We=je*.1,it=$e*se,dt=je*.5,Ht=$e*.5,_n=je*.3,xn=it,er=je*.3;return`M ${We} ${it} C ${_n} ${xn}, ${er} ${Ht}, ${dt} ${Ht}`},Z=se=>{const We=je*.5,it=$e*.5,dt=je*.9,Ht=$e*se,_n=je*.7,xn=it,er=je*.7;return`M ${We} ${it} C ${_n} ${xn}, ${er} ${Ht}, ${dt} ${Ht}`};async function Ve(se){try{await Lt(`/api/models/${encodeURIComponent(se)}/load`,{method:"POST"}),b()}catch(We){d("Fehler",`Fehler beim Laden des Modells: ${We.message}`)}}async function Oe(se){if(M&&O&&!C(se)){const We=T.filter(it=>S.includes(it)).map(it=>it.split("/").pop()).join(", ");f("Verdrängt das Hirn?",`„${se.split("/").pop()}“ ist nicht in der Ko-Residenz-Gruppe „brains“. Beim Laden wirft es das aktuell warme Hirn (${We}) raus — Lucy verliert Hirn bzw. Augen. -Trotzdem exklusiv laden? Tipp: Mit dem 🧠-Schalter machst du das Modell dauerhaft ko-resident, dann bleiben beide warm.`,()=>Ge(te));return}Ge(te)}async function We(te){try{await zt(`/api/models/${encodeURIComponent(te)}/unload`,{method:"POST"}),w()}catch(ze){d("Fehler",`Fehler beim Entladen des Modells: ${ze.message}`)}}async function tt(){try{await zt("/api/models/unload",{method:"POST"}),w()}catch(te){d("Fehler",`Fehler beim Entladen aller Modelle: ${te.message}`)}}async function wt(te,ze){try{await zt(`/api/models/${encodeURIComponent(ze)}/role`,{method:"POST",body:JSON.stringify({role:te||null})}),w()}catch(Je){d("Fehler",`Fehler beim Zuweisen der Rolle: ${Je.message||Je}`)}}function dt(te){k(te),H(null),zt(`/api/roles/${encodeURIComponent(te)}/recommend`).then(ze=>H(ze)).catch(()=>{})}async function J(te,ze){let Je=null;try{Je=await zt(`/api/models/${encodeURIComponent(te)}/ctx/auto`)}catch{}const At=Je?`Optimal für dein Setup: ${(Je.ctx/1024).toFixed(0)}k (${Je.ctx}) — GTT ${Je.gtt_gb} GB − reserviert ${Je.reserved_gb} GB (${Je.mode}) → ${Je.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";m("Kontextlänge anpassen",At,String(ze||32768),async _t=>{if(_t)try{await zt(`/api/models/${encodeURIComponent(te)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(_t,10)})}),w()}catch(dn){d("Fehler",`Fehler beim Setzen des Kontexts: ${dn.message||dn}`)}},void 0,Je?{autoValue:String(Je.ctx),autoLabel:`Auto (${(Je.ctx/1024).toFixed(0)}k)`}:void 0)}async function $(te){f("Modell löschen?",`Modell '${te}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await zt(`/api/models/${encodeURIComponent(te)}`,{method:"DELETE"}),w()}catch(ze){d("Fehler",`Fehler beim Löschen: ${ze.message||ze}`)}})}async function Me(te,ze,Je,At){try{await zt("/api/models/install",{method:"POST",body:JSON.stringify({repo:te,role:ze,quant:Je,jinja:At})}),d("Herunterladen gestartet",`Download für '${te}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(_t){d("Fehler",`Fehler beim Starten des Upgrades: ${_t.message||_t}`)}}async function Ue(te){const ze=a==null?void 0:a.budget,Je=ze&&!ze.fits?` +Trotzdem exklusiv laden? Tipp: Mit dem 🧠-Schalter machst du das Modell dauerhaft ko-resident, dann bleiben beide warm.`,()=>Ve(se));return}Ve(se)}async function Ge(se){try{await Lt(`/api/models/${encodeURIComponent(se)}/unload`,{method:"POST"}),b()}catch(We){d("Fehler",`Fehler beim Entladen des Modells: ${We.message}`)}}async function et(){try{await Lt("/api/models/unload",{method:"POST"}),b()}catch(se){d("Fehler",`Fehler beim Entladen aller Modelle: ${se.message}`)}}async function St(se,We){try{await Lt(`/api/models/${encodeURIComponent(We)}/role`,{method:"POST",body:JSON.stringify({role:se||null})}),b()}catch(it){d("Fehler",`Fehler beim Zuweisen der Rolle: ${it.message||it}`)}}function ft(se){k(se),H(null),Lt(`/api/roles/${encodeURIComponent(se)}/recommend`).then(We=>H(We)).catch(()=>{})}async function J(se,We){let it=null;try{it=await Lt(`/api/models/${encodeURIComponent(se)}/ctx/auto`)}catch{}const dt=it?`Optimal für dein Setup: ${(it.ctx/1024).toFixed(0)}k (${it.ctx}) — GTT ${it.gtt_gb} GB − reserviert ${it.reserved_gb} GB (${it.mode}) → ${it.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";g("Kontextlänge anpassen",dt,String(We||32768),async Ht=>{if(Ht)try{await Lt(`/api/models/${encodeURIComponent(se)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Ht,10)})}),b()}catch(_n){d("Fehler",`Fehler beim Setzen des Kontexts: ${_n.message||_n}`)}},void 0,it?{autoValue:String(it.ctx),autoLabel:`Auto (${(it.ctx/1024).toFixed(0)}k)`}:void 0)}async function $(se){f("Modell löschen?",`Modell '${se}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await Lt(`/api/models/${encodeURIComponent(se)}`,{method:"DELETE"}),b()}catch(We){d("Fehler",`Fehler beim Löschen: ${We.message||We}`)}})}async function Me(se,We,it,dt){try{await Lt("/api/models/install",{method:"POST",body:JSON.stringify({repo:se,role:We,quant:it,jinja:dt})}),d("Herunterladen gestartet",`Download für '${se}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Ht){d("Fehler",`Fehler beim Starten des Upgrades: ${Ht.message||Ht}`)}}async function Ue(se){const We=a==null?void 0:a.budget,it=We&&!We.fits?` -⚠ Speicher-Warnung: Dieses Brain (~${ze.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${ze.largest_ondemand_gb} GB) sprengt das das Budget (${ze.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";f("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${te.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${Je}`,async()=>{try{await zt("/api/models/install",{method:"POST",body:JSON.stringify({repo:te,role:"hermes",quant:"Q4_K_M",jinja:!0})}),d("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),w()}catch(At){d("Fehler",`Update fehlgeschlagen: ${At.message||At}`)}})}async function He(te){f("Agent-Hirn wechseln?",`'${te.split("/").pop()}' als Agent-Hirn (Alias hermes) setzen? Es wird warm gehalten (brains-Gruppe); Hermes nutzt es nach einem kurzen Gateway-Restart.`,async()=>{try{await zt("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:te})}),d("Erledigt","Agent-Hirn gewechselt. Gateway wurde neugestartet."),se(!1),w()}catch(ze){d("Fehler",`Wechsel fehlgeschlagen: ${ze.message||ze}`)}})}async function Be(te){te&&(await navigator.clipboard.writeText(te),B(!0),setTimeout(()=>B(!1),1500))}if(n)return g.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(_)return g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",_,")."]});const bt=x.filter(te=>S.includes(te.name)),it=bt.reduce((te,ze)=>te+(ze.size_bytes||0),0),ht=((Qt=l==null?void 0:l.gpu)==null?void 0:Qt.gtt_total)||((de=l==null?void 0:l.gpu)==null?void 0:de.vram_total)||0,Gt=((qe=l==null?void 0:l.gpu)==null?void 0:qe.gtt_used)||0,Ke=16*1024**3,re=ht>2*1024**3?ht:it>Ke?it*1.2:Ke,Qe=te=>x.find(ze=>ze.role===te),St=te=>{const ze=Qe(te);return ze?S.includes(ze.name):!1};return g.jsxs("div",{className:"space-y-8",children:[g.jsx("style",{children:` +⚠ Speicher-Warnung: Dieses Brain (~${We.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${We.largest_ondemand_gb} GB) sprengt das das Budget (${We.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";f("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${se.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${it}`,async()=>{try{await Lt("/api/models/install",{method:"POST",body:JSON.stringify({repo:se,role:"hermes",quant:"Q4_K_M",jinja:!0})}),d("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),b()}catch(dt){d("Fehler",`Update fehlgeschlagen: ${dt.message||dt}`)}})}async function Be(se){f("Agent-Hirn wechseln?",`'${se.split("/").pop()}' als Agent-Hirn (Alias hermes) setzen? Es wird warm gehalten (brains-Gruppe); Hermes nutzt es nach einem kurzen Gateway-Restart.`,async()=>{try{await Lt("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:se})}),d("Erledigt","Agent-Hirn gewechselt. Gateway wurde neugestartet."),ie(!1),b()}catch(We){d("Fehler",`Wechsel fehlgeschlagen: ${We.message||We}`)}})}async function ze(se){se&&(await navigator.clipboard.writeText(se),B(!0),setTimeout(()=>B(!1),1500))}if(n)return p.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(w)return p.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",w,")."]});const wt=x.filter(se=>S.includes(se.name)),rt=wt.reduce((se,We)=>se+(We.size_bytes||0),0),pt=((Jt=l==null?void 0:l.gpu)==null?void 0:Jt.gtt_total)||((de=l==null?void 0:l.gpu)==null?void 0:de.vram_total)||0,Wt=((qe=l==null?void 0:l.gpu)==null?void 0:qe.gtt_used)||0,Ke=16*1024**3,ne=pt>2*1024**3?pt:rt>Ke?rt*1.2:Ke,Qe=se=>x.find(We=>We.role===se),Mt=se=>{const We=Qe(se);return We?S.includes(We.name):!1};return p.jsxs("div",{className:"space-y-8",children:[p.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -572,13 +587,13 @@ Trotzdem exklusiv laden? Tipp: Mit dem 🧠-Schalter machst du das Modell dauerh stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(iE,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",Vo(it)," Gewichte",Gt>0?` · ${Vo(Gt)} real belegt (inkl. KV)`:""," / ",Vo(re)]}),S.length>0&&g.jsx("button",{onClick:tt,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),g.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:bt.length===0?g.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):bt.map((te,ze)=>{var _t;const Je=(te.size_bytes||0)/re*100,At=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][ze%4];return g.jsxs("div",{style:{width:`${Je}%`},className:rt("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",At),title:`${te.name} (${Vo(te.size_bytes)})`,children:[g.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[te.role?`[${te.role}] `:"",(_t=te.name.split("/").pop())==null?void 0:_t.replace(".gguf","")]}),g.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Vo(te.size_bytes)})]},te.name)})})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[g.jsxs("div",{children:[g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),g.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),g.jsxs("div",{ref:Se,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[g.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[g.jsxs("defs",{children:[g.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),g.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),g.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),g.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),g.jsx("path",{d:ue(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Q==="roocode"||L==="roocode")&&g.jsx("path",{d:ue(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:ue(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Q==="cursor"||L==="cursor")&&g.jsx("path",{d:ue(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:ue(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Q==="opencode"||L==="opencode")&&g.jsx("path",{d:ue(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:ue(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Q==="zed"||L==="zed")&&g.jsx("path",{d:ue(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:ue(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Q==="continue"||L==="continue")&&g.jsx("path",{d:ue(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Z(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),St("fast")&&g.jsx("path",{d:Z(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Z(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),St("heavy")&&g.jsx("path",{d:Z(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Z(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),St("coder")&&g.jsx("path",{d:Z(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Z(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),St("vision")&&g.jsx("path",{d:Z(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Z(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),St("scout")&&g.jsx("path",{d:Z(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>K("roocode"),onMouseLeave:()=>K(null),onClick:()=>F(te=>te==="roocode"?null:"roocode"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Roo Code"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>K("cursor"),onMouseLeave:()=>K(null),onClick:()=>F(te=>te==="cursor"?null:"cursor"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Cursor IDE"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>K("opencode"),onMouseLeave:()=>K(null),onClick:()=>F(te=>te==="opencode"?null:"opencode"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"OpenCode"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>K("zed"),onMouseLeave:()=>K(null),onClick:()=>F(te=>te==="zed"?null:"zed"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Zed"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>K("continue"),onMouseLeave:()=>K(null),onClick:()=>F(te=>te==="continue"?null:"continue"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Continue"})]}),g.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[g.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),g.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",i!=null&&i.heavy_threshold_chars?i.heavy_threshold_chars/1e3:"4","k Zeichen"]}),g.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),QF.map(te=>{var dn;const ze=["12%","31%","50%","69%","88%"],Je=Qe(te),At=Je?S.includes(Je.name):!1;if(te==="agent")return null;const _t={fast:0,heavy:1,coder:2,vision:3,scout:4}[te];return g.jsxs("div",{className:rt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",At?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":Je?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:ze[_t]},onClick:()=>dt(te),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:te}),At&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:Je?(dn=Je.name.split("/").pop())==null?void 0:dn.replace(".gguf",""):"Keine Zuweisung"})]},te)}),L&&s&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[L==="roocode"&&"Roo Code Setup",L==="cursor"&&"Cursor Setup",L==="opencode"&&"OpenCode Setup",L==="zed"&&"Zed Setup",L==="continue"&&"Continue Setup"]}),g.jsx("button",{onClick:()=>F(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[L==="roocode"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",g.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),g.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",g.jsx("strong",{children:"OpenAI Compatible"}),"."]}),g.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",g.jsx("code",{children:"settings.json"})," ein."]})]}),L==="cursor"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Öffne Cursor Settings ➔ ",g.jsx("strong",{children:"Models"}),"."]}),g.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",g.jsx("strong",{children:"OpenAI API"})," auf."]}),g.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",g.jsx("strong",{children:"auto"}),"."]})]}),L==="opencode"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Öffne die ",g.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),g.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",g.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),L==="zed"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Öffne die Zed Settings (",g.jsx("code",{children:"ctrl+,"}),")."]}),g.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",g.jsx("code",{children:"language_models"})," ein."]})]}),L==="continue"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),g.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",g.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),s.tools&&g.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[g.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[g.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),g.jsxs("button",{onClick:()=>{var te,ze,Je,At,_t;return Be(L==="roocode"?(te=s.tools.cline)==null?void 0:te.snippet:L==="cursor"?(ze=s.tools.cursor)==null?void 0:ze.snippet:L==="opencode"?(Je=s.tools.opencode)==null?void 0:Je.snippet:L==="zed"?(At=s.tools.zed)==null?void 0:At.snippet:(_t=s.tools.continue)==null?void 0:_t.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[fe?g.jsx($o,{className:"h-3.5 w-3.5 text-emerald-400"}):g.jsx(tw,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:fe?"Kopiert":"Kopieren"})]})]}),g.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:g.jsxs("code",{children:[L==="roocode"&&((le=s.tools.cline)==null?void 0:le.snippet),L==="cursor"&&((Ye=s.tools.cursor)==null?void 0:Ye.snippet),L==="opencode"&&((Te=s.tools.opencode)==null?void 0:Te.snippet),L==="zed"&&((Fe=s.tools.zed)==null?void 0:Fe.snippet),L==="continue"&&((st=s.tools.continue)==null?void 0:st.snippet)]})})]}),g.jsx("button",{onClick:()=>F(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),g.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),g.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),g.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),g.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[g.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),g.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(te=>{var At;const ze=x.find(_t=>_t.role===te),Je=ze?S.includes(ze.name):!1;return g.jsxs("div",{onClick:()=>dt(te),className:rt("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",Je?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":ze?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:rt("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",NP(te)),children:te}),Je&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:ze==null?void 0:ze.name,children:ze?(At=ze.name.split("/").pop())==null?void 0:At.replace(/\.gguf$/i,""):"nicht zugewiesen"}),g.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},te)})})]}),(a==null?void 0:a.current)&&g.jsxs("div",{className:"rounded-2xl border border-indigo-500/30 bg-indigo-500/5 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[g.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Il,{className:"h-4.5 w-4.5 text-indigo-400"}),g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),a.current.version!=null&&g.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-indigo-500/15 text-indigo-300 border border-indigo-500/25",children:["v",a.current.version]})]}),g.jsx("button",{onClick:()=>se(!0),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",children:"Hirn wechseln"})]}),g.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl bg-background/30 border border-border/30 p-3.5",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:a.current.name,children:a.current.name.split("/").pop()}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[g.jsx("span",{children:a.current.params_b?`${a.current.params_b}B`:"—"}),g.jsx("span",{children:"•"}),g.jsx("span",{children:a.current.quant||"GGUF"}),g.jsx("span",{children:"•"}),g.jsx("span",{children:Vo(a.current.size_bytes||0)})]})]}),a.update_available&&a.recommended?g.jsxs("button",{onClick:()=>Ue(a.recommended.repo),className:rt("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",a.budget&&!a.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[g.jsx(xg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):g.jsxs("span",{className:"h-8 px-3 shrink-0 flex items-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/15 rounded-lg select-none",children:[g.jsx($o,{className:"h-4 w-4"})," Neueste Generation"]})]}),a.update_available&&a.recommended&&g.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",g.jsx("span",{className:"font-mono font-bold",children:a.recommended.name.replace(/-GGUF$/i,"")}),"(v",a.recommended.version,", ",a.recommended.params_b,"B) — von NousResearch."]}),a.budget&&g.jsxs("div",{className:rt("text-[10px] flex items-start gap-1.5 leading-relaxed",a.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[g.jsx(iE,{className:"h-3 w-3 shrink-0 mt-0.5"}),g.jsxs("span",{children:["Always-On-Brain ~",a.budget.brain_gb," GB + größtes on-demand (~",a.budget.largest_ondemand_gb," GB) = ",(a.budget.brain_gb+a.budget.largest_ondemand_gb).toFixed(1)," / ",a.budget.gtt_gb," GB",a.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[g.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",ce.length," von ",x.length,")"]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[g.jsx("button",{onClick:()=>ae("all"),className:rt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",he==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),g.jsx("button",{onClick:()=>ae("in_use"),className:rt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",he==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),g.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[g.jsx("button",{onClick:()=>q("grid"),className:rt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",V==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),g.jsx("button",{onClick:()=>q("list"),className:rt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",V==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),V==="grid"?g.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:ce.length===0?g.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:he==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):ce.map(te=>{const ze=S.includes(te.name),Je=o==null?void 0:o.model_list.find(_t=>_t.role===te.role),At=NI(te.name);return g.jsxs("div",{className:rt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",ze?"border-primary/45 shadow-primary/5":te.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[g.jsxs("div",{className:"space-y-3",children:[g.jsx("div",{className:"flex items-start justify-between gap-3",children:g.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[g.jsx("div",{className:rt("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",At.color),title:At.name,children:At.initial}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:te.name,children:te.name.split("/").pop()}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[g.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:te.quant||"GGUF"}),ze&&g.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[g.jsx(ay,{className:"h-3 w-3 animate-pulse"})," Warm"]}),te.role&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:te.role}),C(te.name)&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-fuchsia-500/10 border border-fuchsia-500/30 text-[9px] font-mono text-fuchsia-300 font-bold uppercase",title:"Ko-resident in der brains-Gruppe — bleibt mit dem Hirn gemeinsam warm, verdrängt es nicht.",children:"🧠 Ko-resident"}),te.prompt_cache&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),te.spec_active?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${te.spec_draft_model})`,children:"SPEC"}):te.spec_draft_model?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${te.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,te.parallel_slots>1&&g.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${te.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",te.parallel_slots]}),te.incomplete&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),g.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:g.jsx(L3,{caps:te.capabilities})})]}),g.jsxs("div",{className:"space-y-3 pt-1",children:[g.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[g.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[g.jsx(iE,{className:"h-3.5 w-3.5 text-primary/80"}),g.jsxs("div",{children:[g.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),g.jsx("div",{className:"text-foreground font-semibold",children:Vo(te.size_bytes)})]})]}),g.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[g.jsx(K8,{className:"h-3.5 w-3.5 text-primary/80"}),g.jsxs("div",{children:[g.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),g.jsx("div",{className:"text-foreground font-semibold",children:CI(te.ctx)})]})]})]}),Je&&g.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[g.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),g.jsxs("span",{children:["Upgrade verfügbar: ",Je.repo.split("/").pop()]})]}),g.jsxs("button",{onClick:()=>Me(Je.repo,te.role,te.quant||"Q4_K_M",te.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[g.jsx(xg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),g.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[g.jsx("button",{onClick:()=>ze?We(te.name):Oe(te.name),disabled:te.incomplete&&!ze,className:rt("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",te.incomplete&&!ze?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":ze?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:ze?"Entladen":"Laden"}),g.jsx("button",{onClick:()=>J(te.name,te.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),E&&g.jsx("button",{onClick:()=>N(te.name),className:rt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",C(te.name)?"border-fuchsia-500/40 bg-fuchsia-500/10 text-fuchsia-300 hover:bg-fuchsia-500/20":"border-border/40 text-muted-foreground hover:bg-accent"),title:C(te.name)?"Ko-resident (brains): bleibt mit dem Hirn gemeinsam warm. Klick = aus der Gruppe nehmen.":"Zur brains-Gruppe hinzufügen — lädt dann ko-resident neben dem Hirn, statt es zu verdrängen.",children:"🧠"}),g.jsxs("button",{onClick:()=>ee(te),className:rt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",te.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":te.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[g.jsx(bh,{className:"h-3 w-3"})," Spec"]}),g.jsx("button",{onClick:()=>$(te.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:g.jsx(LT,{className:"h-3.5 w-3.5"})})]})]})]},te.name)})}):g.jsx("div",{className:"space-y-2",children:ce.length===0?g.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:he==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):ce.map(te=>{const ze=S.includes(te.name),Je=NI(te.name);return g.jsxs("div",{className:rt("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",ze?"border-primary/45":te.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[g.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g.jsx("div",{className:rt("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Je.color),title:Je.name,children:Je.initial}),g.jsxs("div",{className:"min-w-0 text-left",children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:te.name,children:te.name.split("/").pop()}),te.role&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:te.role}),C(te.name)&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-fuchsia-500/10 border border-fuchsia-500/30 text-[8px] font-mono text-fuchsia-300 font-bold uppercase shrink-0",title:"Ko-resident in der brains-Gruppe — bleibt mit dem Hirn gemeinsam warm.",children:"🧠 Ko-resident"}),te.prompt_cache&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),te.spec_active?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${te.spec_draft_model})`,children:"SPEC"}):te.spec_draft_model?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${te.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,te.parallel_slots>1&&g.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${te.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",te.parallel_slots]}),te.incomplete&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),ze&&g.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[g.jsxs("span",{children:["Größe: ",Vo(te.size_bytes)]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Kontext: ",CI(te.ctx)]}),g.jsx("span",{children:"•"}),g.jsx("span",{className:"font-mono text-[9px]",children:te.quant||"GGUF"})]})]})]}),g.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[g.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:g.jsx(L3,{caps:te.capabilities})}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:()=>ze?We(te.name):Oe(te.name),disabled:te.incomplete&&!ze,className:rt("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",te.incomplete&&!ze?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":ze?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:ze?"Entladen":"Laden"}),g.jsx("button",{onClick:()=>J(te.name,te.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),E&&g.jsx("button",{onClick:()=>N(te.name),className:rt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",C(te.name)?"border-fuchsia-500/40 bg-fuchsia-500/10 text-fuchsia-300 hover:bg-fuchsia-500/20":"border-border/40 text-muted-foreground hover:bg-accent"),title:C(te.name)?"Ko-resident (brains): bleibt mit dem Hirn gemeinsam warm. Klick = aus der Gruppe nehmen.":"Zur brains-Gruppe hinzufügen — lädt dann ko-resident neben dem Hirn, statt es zu verdrängen.",children:"🧠"}),g.jsxs("button",{onClick:()=>ee(te),className:rt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",te.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":te.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[g.jsx(bh,{className:"h-3 w-3"})," Spec"]}),g.jsx("button",{onClick:()=>$(te.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:g.jsx(LT,{className:"h-3.5 w-3.5"})})]})]})]},te.name)})})]}),G&&(()=>{var _t,dn;const te=U&&U.role===G?U:null,ze={};te==null||te.models.forEach(cn=>{ze[cn.name]=cn});const Je=te?te.models.map(cn=>x.find(Un=>Un.name===cn.name)).filter(Boolean):x,At=cn=>{wt(G,cn),k(null)};return g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",G,"' konfigurieren"]}),g.jsx("button",{onClick:()=>k(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",g.jsx("strong",{className:"text-foreground",children:G}),":"]}),(te==null?void 0:te.recommended)&&g.jsxs("button",{onClick:()=>At(te.recommended),title:(_t=ze[te.recommended])==null?void 0:_t.reason,className:"shrink-0 h-7 px-3 text-[11px] font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg cursor-pointer flex items-center gap-1",children:[g.jsx(bh,{className:"h-3 w-3"})," Auto: ",(dn=te.recommended.split("/").pop())==null?void 0:dn.replace(/\.gguf$/i,"")]})]}),g.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[g.jsx("button",{onClick:()=>At(""),className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:g.jsx("span",{children:"Zuweisung entfernen"})}),Je.map(cn=>{var Ei;const Un=ze[cn.name],Xi=cn.role===G,jr=!!(Un!=null&&Un.recommended),To=!!Un&&!Un.suitable;return g.jsxs("button",{onClick:()=>At(cn.name),className:rt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border",jr?"border-primary/50 bg-primary/10":Xi?"text-primary font-bold bg-primary/5 border-primary/30":To?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[g.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[g.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(Ei=cn.name.split("/").pop())==null?void 0:Ei.replace(/\.gguf$/i,""),jr&&g.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),g.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Un?`${Un.params_b}B · ${cn.quant} · ${Un.reason}`:`${Vo(cn.size_bytes)} · ${cn.quant}`})]}),Xi&&g.jsx($o,{className:"h-4 w-4 shrink-0 text-primary"})]},cn.name)})]})]})})})(),ne&&g.jsx(Lfe,{model:ne,onClose:()=>ee(null),onChanged:w}),pe&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[g.jsx(Il,{className:"h-4 w-4"})," Agent-Hirn wechseln"]}),g.jsx("button",{onClick:()=>se(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Wähle ein ",g.jsx("strong",{className:"text-foreground",children:"installiertes"})," Modell als Agent-Hirn. Es bekommt den",g.jsx("code",{className:"text-primary",children:" hermes"}),'-Alias, wird warm gehalten (brains-Gruppe), und Hermes nutzt es nach einem kurzen Gateway-Restart. Neues Modell (z.B. Hermes-4.3 oder Gemma-4)? Erst über „Modelle finden" laden.']}),g.jsx("div",{className:"space-y-1.5 max-h-72 overflow-y-auto pr-1",children:x.map(te=>{var Je;const ze=te.role==="hermes";return g.jsxs("button",{onClick:()=>!ze&&He(te.name),disabled:ze||te.incomplete,className:rt("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",ze?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":te.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[g.jsxs("div",{className:"flex flex-col min-w-0",children:[g.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(Je=te.name.split("/").pop())==null?void 0:Je.replace(/\.gguf$/i,"")}),g.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[te.capabilities.params_b?`${te.capabilities.params_b}B`:"?"," · ",Vo(te.size_bytes),te.role&&` · Rolle: ${te.role}`,te.capabilities.tools!=="no"?" · Tools ✓":" · ohne Tools"]})]}),ze?g.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[g.jsx($o,{className:"h-3.5 w-3.5"})," Aktiv"]}):g.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Als Hirn setzen →"})]},te.name)})}),g.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[g.jsx("span",{children:"💡"}),g.jsxs("span",{children:["Für einen ",g.jsx("strong",{children:"Agenten"})," sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl als allgemeine Modelle."]})]})]})}),y]})}function jfe(){const[t,e]=R.useState(""),[n,r]=R.useState([]),[i,s]=R.useState("Q4_K_M"),[o,a]=R.useState(""),[l,c]=R.useState(""),[d,f]=R.useState(""),[m,y]=R.useState([]),[x,S]=R.useState(null),[_,w]=R.useState(!1),E=["fast","heavy","coder","vision","scout"],{data:T}=Kh(),C=l?T==null?void 0:T.models.find(H=>(H.role||"").toLowerCase()===l):void 0;async function O(H,ne,ee){if(w(!1),!H.trim()){S(null);return}try{const pe=await zt(`/api/fit?params_b=0&quant=${encodeURIComponent(ne)}&ctx=8192&name=${encodeURIComponent(H)}&role=${encodeURIComponent(ee)}`);S(pe)}catch{S(null)}}async function N(H){const ne=H??t;if(ne.trim()){a("Analysiere HuggingFace Repository..."),S(null);try{const ee=await zt(`/api/hf/quants?repo=${encodeURIComponent(ne)}`);e(ee.repo),r(ee.quants);const pe=ee.quants.length?ee.quants.includes("Q4_K_M")?"Q4_K_M":ee.quants[0]:i;ee.quants.length&&s(pe),a(ee.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden."),ee.quants.length&&O(ee.repo,pe,l)}catch(ee){a(`Fehler: ${ee}`)}}}function L(H){s(H),O(t,H,l)}function F(H){c(H),n.length&&O(t,i,H)}async function G(){if(d.trim()){a("Durchsuche HuggingFace...");try{const H=await zt(`/api/hf/search?q=${encodeURIComponent(d)}`);y(H.results),a(H.results.length?"":"Keine Ergebnisse gefunden.")}catch(H){a(`Suche fehlgeschlagen: ${H}`)}}}async function k(){if(t.trim()){if((x==null?void 0:x.fit.level)==="too_tight"&&!_){w(!0);return}a("Download-Job wird initiiert...");try{await zt("/api/models/install",{method:"POST",body:JSON.stringify({repo:t,quant:i,role:l||void 0,jinja:!0})}),w(!1),a(`Download gestartet: ${t} (${i})${l?`, Rolle: ${l}`:""}. Fortschritt oben.`+(C?` „${l}" wurde von ${C.name} übernommen.`:"")+(l==="fast"||l==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(H){a(`Download-Fehler: ${H}`)}}}const U=(x==null?void 0:x.fit.level)==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":(x==null?void 0:x.fit.level)==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return g.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[g.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),g.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[g.jsx("input",{value:t,onChange:H=>{e(H.target.value),S(null),w(!1)},placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("button",{onClick:()=>N(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),n.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("select",{value:i,onChange:H=>L(H.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:n.map(H=>g.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))}),g.jsxs("select",{value:l,onChange:H=>F(H.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[g.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),E.map(H=>g.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))]}),g.jsx("button",{onClick:k,className:`h-9 px-4 rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5 ${_?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"}`,children:_?g.jsxs(g.Fragment,{children:[g.jsx(_g,{className:"h-3.5 w-3.5"})," OOM-Risiko — trotzdem laden"]}):g.jsxs(g.Fragment,{children:[g.jsx(xg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]})]})]}),x&&g.jsxs("div",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium ${U}`,children:[g.jsx("span",{className:"font-bold uppercase tracking-wide",children:x.fit.text}),g.jsxs("span",{className:"font-mono opacity-90",children:["~",x.params_b,"B · ~",x.fit.req_gb," GB / ",x.sys_ram_gb," GB RAM · ~",x.fit.tps," t/s"]}),x.fit.level!=="too_tight"&&g.jsxs("span",{className:"font-mono opacity-80",title:`Setup-bewusst: GTT ${x.budget.gtt_gb} GB − reserviert ${x.budget.reserved_gb} GB (${x.budget.mode}) → ${x.budget.budget_gb} GB frei`,children:["ctx → ",(x.assigned_ctx/1024).toFixed(0),"k"]}),x.fit.level==="too_tight"&&g.jsx("span",{className:"opacity-90",children:"— passt nicht in den Speicher, würde beim Laden abstürzen (OOM)."})]}),C&&g.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] font-medium text-amber-400",children:[g.jsx(_g,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),g.jsxs("span",{children:["Rolle ",g.jsxs("strong",{children:["„",l,'"']})," ist aktuell ",g.jsx("strong",{children:C.name})," zugewiesen. Beim Download übernimmt das neue Modell diese Rolle — ",C.name," bleibt installiert, verliert sie aber."]})]}),g.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[g.jsxs("div",{className:"relative flex-1",children:[g.jsx("input",{value:d,onChange:H=>f(H.target.value),onKeyDown:H=>H.key==="Enter"&&G(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),g.jsx(wP,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),g.jsx("button",{onClick:G,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),m.length>0&&g.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:m.map(H=>g.jsxs("button",{onClick:()=>{e(H.repo),y([]),f(""),N(H.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[g.jsx("span",{className:"font-semibold truncate",children:H.repo}),g.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[g.jsx(xg,{className:"h-3 w-3"})," ",H.downloads.toLocaleString()]})]},H.repo))}),o&&g.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:o})]})}const Ufe={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:bh},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:W1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:aF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:IT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:NT}};function Ffe(){const{data:t,isLoading:e,error:n}=_7(),{data:r}=Kh(),{data:i}=PP(),s=(r==null?void 0:r.models)??[],o=n?String(n):"",[a,l]=R.useState({}),[c,d]=R.useState({}),[f,m]=R.useState(!1);async function y(x,S,_,w){l(E=>({...E,[x]:"Starte..."}));try{await zt("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:_,jinja:w})}),l(E=>({...E,[x]:"Download läuft"}))}catch{l(T=>({...T,[x]:"Fehler"}))}}return e?g.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):o||!t?g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",o,")."]}):g.jsxs("div",{className:"space-y-8",children:[g.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[g.jsxs("div",{children:["Modell-Registry geladen für ",g.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(r9,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),g.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),g.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(x=>{const S=Ufe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:$1},_=S.icon,w=s.find(L=>L.role===x.role),E=i==null?void 0:i.model_list.find(L=>L.role===x.role),T=x.models.find(L=>L.repo===x.recommended)||x.models[0];if(!T)return null;const C=a[T.repo],O=x.models.filter(L=>L.repo!==x.recommended),N=!!c[x.role];return g.jsxs("div",{className:rt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",w?"border-border/60":"border-primary/20 shadow-primary/5"),children:[g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:g.jsx(_,{className:"h-5.5 w-5.5"})}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),g.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",x.role]})]})]}),w?g.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):g.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),g.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),g.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:w?g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),g.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:w.name,children:w.name.split("/").pop()}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[g.jsxs("span",{children:["Größe: ",VT(w.size_bytes||0)]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Quant: ",w.quant||"GGUF"]})]})]}):g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),g.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[g.jsxs("span",{children:["Ersteller: ",T.author]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Quant: ",T.quant]})]}),g.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:g.jsx(iX,{fit:T.fit})})]})}),g.jsx("div",{className:"pt-1",children:w?E?g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),g.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),g.jsxs("button",{onClick:()=>y(E.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[E.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[g.jsx(xg,{className:"h-3.5 w-3.5"}),a[E.repo]||"Auf neue Version aktualisieren"]})]}):g.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[g.jsx($o,{className:"h-4 w-4"})," Auf neuestem Stand"]}):g.jsxs("button",{onClick:()=>y(T.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!C,className:rt("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",C?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[g.jsx(xg,{className:"h-3.5 w-3.5"}),C||"Optimales Modell einsetzen"]})})]}),O.length>0&&g.jsxs("div",{className:"border-t border-border/20 pt-3",children:[g.jsxs("button",{onClick:()=>d(L=>({...L,[x.role]:!N})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[N?g.jsx(M8,{className:"h-3 w-3"}):g.jsx(w8,{className:"h-3 w-3"}),g.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&g.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(L=>g.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:L.name,children:L.name}),g.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[g.jsxs("span",{children:["Quant: ",L.quant]}),g.jsx("span",{children:"•"}),g.jsx("span",{children:L.fit.text})]})]}),g.jsx("button",{onClick:()=>y(L.repo,x.role,L.quant||"Q4_K_M",L.caps.tools!=="no"),disabled:!!a[L.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:a[L.repo]||"Installieren"})]},L.repo))})]})]},x.role)})}),g.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[g.jsxs("button",{onClick:()=>m(!f),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(wP,{className:"h-4 w-4 text-primary"}),g.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),g.jsx("span",{className:"text-[10px] text-primary hover:underline",children:f?"Ausblenden ▲":"Anzeigen ▼"})]}),f&&g.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:g.jsx(jfe,{})})]})]})}function zfe(){const[t,e]=R.useState("cockpit");return g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),g.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),g.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(n=>g.jsx("button",{onClick:()=>e(n),className:rt("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===n?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:n==="cockpit"?"Cockpit":"Modelle finden"},n))})]}),g.jsx(Ofe,{}),g.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?g.jsx(Dfe,{}):g.jsx(Ffe,{})})]})}const Bfe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function D3({line:t,loading:e}){return e||!t?g.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[g.jsx(_P,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?g.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[g.jsx(E8,{className:"h-3 w-3"})," ",t.detail]}):g.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[g.jsx(T8,{className:"h-3 w-3"})," ",t.detail]})}function j3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return g.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[g.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),g.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),g.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),g.jsx("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:g.jsx("span",{children:e})}),g.jsxs("button",{onClick:i,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[r?g.jsx($o,{className:"h-3.5 w-3.5 text-emerald-400"}):g.jsx(tw,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),g.jsx("pre",{className:rt("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",n==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:g.jsx("code",{children:t.snippet})})]})}function Hfe(){const[t,e]=R.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[n,r]=R.useState(localStorage.getItem("mc_mcp_path")||""),[i,s]=R.useState("cline"),[o,a]=R.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=WF(l.toString()),{data:f,isLoading:m}=S7(),y=d?String(d):"";function x(E){e(E),E&&localStorage.setItem("mc_host",E)}function S(E){r(E),localStorage.setItem("mc_mcp_path",E)}const _=c==null?void 0:c.tools[i];async function w(E,T){T&&(await navigator.clipboard.writeText(T),a(E),setTimeout(()=>a(null),1500))}return g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",g.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),g.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[g.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[g.jsx(U8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),g.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),g.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),g.jsxs("div",{className:"flex flex-col gap-2.5",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(ew,{className:"h-4 w-4 text-muted-foreground shrink-0"}),g.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[g.jsx(El,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),g.jsx(D3,{line:f==null?void 0:f.gateway,loading:m})]}),g.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · model auto"})]})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(ew,{className:"h-4 w-4 text-muted-foreground shrink-0"}),g.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[g.jsx(W1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),g.jsx(D3,{line:f==null?void 0:f.memory,loading:m})]}),g.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),g.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",g.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",g.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),g.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[g.jsx(D8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),g.jsx("input",{value:t,onChange:E=>x(E.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[g.jsx(k8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",g.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),g.jsx("input",{value:n,onChange:E=>S(E.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),y&&g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",y]}),c&&g.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[g.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[g.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),g.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),g.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([E,T])=>g.jsx("button",{onClick:()=>s(E),className:rt("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===E?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},E))}),_&&g.jsxs(g.Fragment,{children:[_.note&&g.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[g.jsx(lI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),g.jsx("span",{children:_.note})]}),g.jsx(j3,{tool:_,fileName:Bfe[i]||"config.json",accent:"teal",copied:o==="model",onCopy:()=>w("model",_.snippet)})]})]}),g.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[g.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",g.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),g.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",g.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),g.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[g.jsx(lI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),g.jsx("span",{children:c.memory.note})]}),g.jsx(j3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>w("memory",c.memory.snippet)})]})]})]})}const Vfe="modulepreload",Gfe=function(t){return"/"+t},U3={},Wfe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=Gfe(c),c in U3)return;U3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Vfe,d||(m.as="script"),m.crossOrigin="",m.href=c,l&&m.setAttribute("nonce",l),document.head.appendChild(m),d)return new Promise((y,x)=>{m.addEventListener("load",y),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};class $fe extends R.Component{constructor(){super(...arguments);Ws(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?g.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[g.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),g.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const Xfe=R.lazy(()=>Wfe(()=>import("./GraphView-BtEGVbX5.js"),[]).then(t=>({default:t.GraphView}))),jb=["identity","knowledge","rules","events"],F3=new Set(["auto","agent","hermes"]),qE={identity:{label:"Identität",icon:i9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:Zm,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:J8,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:C8,bg:"bg-amber-500/10",text:"text-amber-400"}},z3={label:"Gedächtnis",icon:PT,text:"text-muted-foreground"},qfe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},B3=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: + `}),p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[p.jsxs("div",{className:"flex justify-between items-center",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(oE,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",Wo(rt)," Gewichte",Wt>0?` · ${Wo(Wt)} real belegt (inkl. KV)`:""," / ",Wo(ne)]}),S.length>0&&p.jsx("button",{onClick:et,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),p.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:wt.length===0?p.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):wt.map((se,We)=>{var Ht;const it=(se.size_bytes||0)/ne*100,dt=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][We%4];return p.jsxs("div",{style:{width:`${it}%`},className:tt("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",dt),title:`${se.name} (${Wo(se.size_bytes)})`,children:[p.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[se.role?`[${se.role}] `:"",(Ht=se.name.split("/").pop())==null?void 0:Ht.replace(".gguf","")]}),p.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Wo(se.size_bytes)})]},se.name)})})]}),p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[p.jsxs("div",{children:[p.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),p.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),p.jsxs("div",{ref:Se,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[p.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[p.jsxs("defs",{children:[p.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[p.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),p.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),p.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[p.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),p.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),p.jsx("path",{d:ue(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Q==="roocode"||L==="roocode")&&p.jsx("path",{d:ue(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:ue(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Q==="cursor"||L==="cursor")&&p.jsx("path",{d:ue(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:ue(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Q==="opencode"||L==="opencode")&&p.jsx("path",{d:ue(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:ue(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Q==="zed"||L==="zed")&&p.jsx("path",{d:ue(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:ue(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(Q==="continue"||L==="continue")&&p.jsx("path",{d:ue(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:Z(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Mt("fast")&&p.jsx("path",{d:Z(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:Z(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Mt("heavy")&&p.jsx("path",{d:Z(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:Z(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Mt("coder")&&p.jsx("path",{d:Z(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:Z(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Mt("vision")&&p.jsx("path",{d:Z(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:Z(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),Mt("scout")&&p.jsx("path",{d:Z(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),p.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>K("roocode"),onMouseLeave:()=>K(null),onClick:()=>F(se=>se==="roocode"?null:"roocode"),children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),p.jsx("span",{children:"Roo Code"})]}),p.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>K("cursor"),onMouseLeave:()=>K(null),onClick:()=>F(se=>se==="cursor"?null:"cursor"),children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),p.jsx("span",{children:"Cursor IDE"})]}),p.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>K("opencode"),onMouseLeave:()=>K(null),onClick:()=>F(se=>se==="opencode"?null:"opencode"),children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),p.jsx("span",{children:"OpenCode"})]}),p.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>K("zed"),onMouseLeave:()=>K(null),onClick:()=>F(se=>se==="zed"?null:"zed"),children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),p.jsx("span",{children:"Zed"})]}),p.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>K("continue"),onMouseLeave:()=>K(null),onClick:()=>F(se=>se==="continue"?null:"continue"),children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),p.jsx("span",{children:"Continue"})]}),p.jsxs("div",{className:"absolute select-none z-10 w-40 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[p.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway · Lanes"}),p.jsx("div",{className:"mt-1 flex flex-col gap-0.5 text-[9px] font-mono text-muted-foreground",children:(le=i==null?void 0:i.lanes)!=null&&le.length?i.lanes.map(se=>p.jsxs("span",{children:[p.jsx("span",{className:"text-foreground font-semibold",children:se.name}),se.threshold_chars?` ›${(se.threshold_chars/1e3).toFixed(0)}k`:se.escalate_chars?` ⇧${(se.escalate_chars/1e3).toFixed(0)}k`:""]},se.name)):p.jsx("span",{children:"chat · coding"})}),p.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Router"})]}),n5.map(se=>{var _n;const We=["12%","31%","50%","69%","88%"],it=Qe(se),dt=it?S.includes(it.name):!1;if(se==="agent")return null;const Ht={fast:0,heavy:1,coder:2,vision:3,scout:4}[se];return p.jsxs("div",{className:tt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",dt?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":it?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:We[Ht]},onClick:()=>ft(se),children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:se}),dt&&p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),p.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:it?(_n=it.name.split("/").pop())==null?void 0:_n.replace(".gguf",""):"Keine Zuweisung"})]},se)}),L&&s&&p.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:p.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[p.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[L==="roocode"&&"Roo Code Setup",L==="cursor"&&"Cursor Setup",L==="opencode"&&"OpenCode Setup",L==="zed"&&"Zed Setup",L==="continue"&&"Continue Setup"]}),p.jsx("button",{onClick:()=>F(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:p.jsx(Al,{className:"h-4 w-4"})})]}),p.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[L==="roocode"&&p.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[p.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",p.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),p.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",p.jsx("strong",{children:"OpenAI Compatible"}),"."]}),p.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",p.jsx("code",{children:"settings.json"})," ein."]})]}),L==="cursor"&&p.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[p.jsxs("li",{children:["Öffne Cursor Settings ➔ ",p.jsx("strong",{children:"Models"}),"."]}),p.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",p.jsx("strong",{children:"OpenAI API"})," auf."]}),p.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",p.jsx("strong",{children:"auto"}),"."]})]}),L==="opencode"&&p.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[p.jsxs("li",{children:["Öffne die ",p.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),p.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",p.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),L==="zed"&&p.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[p.jsxs("li",{children:["Öffne die Zed Settings (",p.jsx("code",{children:"ctrl+,"}),")."]}),p.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",p.jsx("code",{children:"language_models"})," ein."]})]}),L==="continue"&&p.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[p.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),p.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",p.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),s.tools&&p.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[p.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[p.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),p.jsxs("button",{onClick:()=>{var se,We,it,dt,Ht;return ze(L==="roocode"?(se=s.tools.cline)==null?void 0:se.snippet:L==="cursor"?(We=s.tools.cursor)==null?void 0:We.snippet:L==="opencode"?(it=s.tools.opencode)==null?void 0:it.snippet:L==="zed"?(dt=s.tools.zed)==null?void 0:dt.snippet:(Ht=s.tools.continue)==null?void 0:Ht.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[fe?p.jsx(So,{className:"h-3.5 w-3.5 text-emerald-400"}):p.jsx(nw,{className:"h-3.5 w-3.5"}),p.jsx("span",{children:fe?"Kopiert":"Kopieren"})]})]}),p.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:p.jsxs("code",{children:[L==="roocode"&&((Ye=s.tools.cline)==null?void 0:Ye.snippet),L==="cursor"&&((Te=s.tools.cursor)==null?void 0:Te.snippet),L==="opencode"&&((Fe=s.tools.opencode)==null?void 0:Fe.snippet),L==="zed"&&((st=s.tools.zed)==null?void 0:st.snippet),L==="continue"&&((mt=s.tools.continue)==null?void 0:mt.snippet)]})})]}),p.jsx("button",{onClick:()=>F(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),p.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),p.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),p.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),p.jsx(qfe,{}),p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[p.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),p.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(se=>{var dt;const We=x.find(Ht=>Ht.role===se),it=We?S.includes(We.name):!1;return p.jsxs("div",{onClick:()=>ft(se),className:tt("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",it?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":We?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:tt("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",OP(se)),children:se}),it&&p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),p.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:We==null?void 0:We.name,children:We?(dt=We.name.split("/").pop())==null?void 0:dt.replace(/\.gguf$/i,""):"nicht zugewiesen"}),p.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},se)})})]}),(a==null?void 0:a.current)&&p.jsxs("div",{className:"rounded-2xl border border-indigo-500/30 bg-indigo-500/5 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[p.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Il,{className:"h-4.5 w-4.5 text-indigo-400"}),p.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),a.current.version!=null&&p.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-indigo-500/15 text-indigo-300 border border-indigo-500/25",children:["v",a.current.version]})]}),p.jsx("button",{onClick:()=>ie(!0),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",children:"Hirn wechseln"})]}),p.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl bg-background/30 border border-border/30 p-3.5",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:a.current.name,children:a.current.name.split("/").pop()}),p.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[p.jsx("span",{children:a.current.params_b?`${a.current.params_b}B`:"—"}),p.jsx("span",{children:"•"}),p.jsx("span",{children:a.current.quant||"GGUF"}),p.jsx("span",{children:"•"}),p.jsx("span",{children:Wo(a.current.size_bytes||0)})]})]}),a.update_available&&a.recommended?p.jsxs("button",{onClick:()=>Ue(a.recommended.repo),className:tt("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",a.budget&&!a.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[p.jsx(xg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):p.jsxs("span",{className:"h-8 px-3 shrink-0 flex items-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/15 rounded-lg select-none",children:[p.jsx(So,{className:"h-4 w-4"})," Neueste Generation"]})]}),a.update_available&&a.recommended&&p.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",p.jsx("span",{className:"font-mono font-bold",children:a.recommended.name.replace(/-GGUF$/i,"")}),"(v",a.recommended.version,", ",a.recommended.params_b,"B) — von NousResearch."]}),a.budget&&p.jsxs("div",{className:tt("text-[10px] flex items-start gap-1.5 leading-relaxed",a.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[p.jsx(oE,{className:"h-3 w-3 shrink-0 mt-0.5"}),p.jsxs("span",{children:["Always-On-Brain ~",a.budget.brain_gb," GB + größtes on-demand (~",a.budget.largest_ondemand_gb," GB) = ",(a.budget.brain_gb+a.budget.largest_ondemand_gb).toFixed(1)," / ",a.budget.gtt_gb," GB",a.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[p.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",ce.length," von ",x.length,")"]}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[p.jsx("button",{onClick:()=>ae("all"),className:tt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",he==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),p.jsx("button",{onClick:()=>ae("in_use"),className:tt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",he==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),p.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[p.jsx("button",{onClick:()=>q("grid"),className:tt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",V==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),p.jsx("button",{onClick:()=>q("list"),className:tt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",V==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),V==="grid"?p.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:ce.length===0?p.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:he==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):ce.map(se=>{const We=S.includes(se.name),it=o==null?void 0:o.model_list.find(Ht=>Ht.role===se.role),dt=OI(se.name);return p.jsxs("div",{className:tt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",We?"border-primary/45 shadow-primary/5":se.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[p.jsxs("div",{className:"space-y-3",children:[p.jsx("div",{className:"flex items-start justify-between gap-3",children:p.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[p.jsx("div",{className:tt("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",dt.color),title:dt.name,children:dt.initial}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:se.name,children:se.name.split("/").pop()}),p.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[p.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:se.quant||"GGUF"}),We&&p.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[p.jsx(ay,{className:"h-3 w-3 animate-pulse"})," Warm"]}),se.role&&p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:se.role}),C(se.name)&&p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-fuchsia-500/10 border border-fuchsia-500/30 text-[9px] font-mono text-fuchsia-300 font-bold uppercase",title:"Ko-resident in der brains-Gruppe — bleibt mit dem Hirn gemeinsam warm, verdrängt es nicht.",children:"🧠 Ko-resident"}),se.prompt_cache&&p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),se.spec_active?p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${se.spec_draft_model})`,children:"SPEC"}):se.spec_draft_model?p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${se.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,se.parallel_slots>1&&p.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${se.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",se.parallel_slots]}),se.incomplete&&p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),p.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:p.jsx(j3,{caps:se.capabilities})})]}),p.jsxs("div",{className:"space-y-3 pt-1",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[p.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[p.jsx(oE,{className:"h-3.5 w-3.5 text-primary/80"}),p.jsxs("div",{children:[p.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),p.jsx("div",{className:"text-foreground font-semibold",children:Wo(se.size_bytes)})]})]}),p.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[p.jsx(e9,{className:"h-3.5 w-3.5 text-primary/80"}),p.jsxs("div",{children:[p.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),p.jsx("div",{className:"text-foreground font-semibold",children:NI(se.ctx)})]})]})]}),it&&p.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[p.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),p.jsxs("span",{children:["Upgrade verfügbar: ",it.repo.split("/").pop()]})]}),p.jsxs("button",{onClick:()=>Me(it.repo,se.role,se.quant||"Q4_K_M",se.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[p.jsx(xg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),p.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[p.jsx("button",{onClick:()=>We?Ge(se.name):Oe(se.name),disabled:se.incomplete&&!We,className:tt("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",se.incomplete&&!We?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":We?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:We?"Entladen":"Laden"}),p.jsx("button",{onClick:()=>J(se.name,se.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),M&&p.jsx("button",{onClick:()=>N(se.name),className:tt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",C(se.name)?"border-fuchsia-500/40 bg-fuchsia-500/10 text-fuchsia-300 hover:bg-fuchsia-500/20":"border-border/40 text-muted-foreground hover:bg-accent"),title:C(se.name)?"Ko-resident (brains): bleibt mit dem Hirn gemeinsam warm. Klick = aus der Gruppe nehmen.":"Zur brains-Gruppe hinzufügen — lädt dann ko-resident neben dem Hirn, statt es zu verdrängen.",children:"🧠"}),p.jsxs("button",{onClick:()=>ee(se),className:tt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",se.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":se.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[p.jsx(_h,{className:"h-3 w-3"})," Spec"]}),p.jsx("button",{onClick:()=>$(se.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:p.jsx(FT,{className:"h-3.5 w-3.5"})})]})]})]},se.name)})}):p.jsx("div",{className:"space-y-2",children:ce.length===0?p.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:he==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):ce.map(se=>{const We=S.includes(se.name),it=OI(se.name);return p.jsxs("div",{className:tt("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",We?"border-primary/45":se.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[p.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[p.jsx("div",{className:tt("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",it.color),title:it.name,children:it.initial}),p.jsxs("div",{className:"min-w-0 text-left",children:[p.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[p.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:se.name,children:se.name.split("/").pop()}),se.role&&p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:se.role}),C(se.name)&&p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-fuchsia-500/10 border border-fuchsia-500/30 text-[8px] font-mono text-fuchsia-300 font-bold uppercase shrink-0",title:"Ko-resident in der brains-Gruppe — bleibt mit dem Hirn gemeinsam warm.",children:"🧠 Ko-resident"}),se.prompt_cache&&p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),se.spec_active?p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${se.spec_draft_model})`,children:"SPEC"}):se.spec_draft_model?p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${se.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,se.parallel_slots>1&&p.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${se.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",se.parallel_slots]}),se.incomplete&&p.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),We&&p.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),p.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[p.jsxs("span",{children:["Größe: ",Wo(se.size_bytes)]}),p.jsx("span",{children:"•"}),p.jsxs("span",{children:["Kontext: ",NI(se.ctx)]}),p.jsx("span",{children:"•"}),p.jsx("span",{className:"font-mono text-[9px]",children:se.quant||"GGUF"})]})]})]}),p.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[p.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:p.jsx(j3,{caps:se.capabilities})}),p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("button",{onClick:()=>We?Ge(se.name):Oe(se.name),disabled:se.incomplete&&!We,className:tt("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",se.incomplete&&!We?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":We?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:We?"Entladen":"Laden"}),p.jsx("button",{onClick:()=>J(se.name,se.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),M&&p.jsx("button",{onClick:()=>N(se.name),className:tt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",C(se.name)?"border-fuchsia-500/40 bg-fuchsia-500/10 text-fuchsia-300 hover:bg-fuchsia-500/20":"border-border/40 text-muted-foreground hover:bg-accent"),title:C(se.name)?"Ko-resident (brains): bleibt mit dem Hirn gemeinsam warm. Klick = aus der Gruppe nehmen.":"Zur brains-Gruppe hinzufügen — lädt dann ko-resident neben dem Hirn, statt es zu verdrängen.",children:"🧠"}),p.jsxs("button",{onClick:()=>ee(se),className:tt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",se.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":se.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[p.jsx(_h,{className:"h-3 w-3"})," Spec"]}),p.jsx("button",{onClick:()=>$(se.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:p.jsx(FT,{className:"h-3.5 w-3.5"})})]})]})]},se.name)})})]}),G&&(()=>{var Ht,_n;const se=U&&U.role===G?U:null,We={};se==null||se.models.forEach(xn=>{We[xn.name]=xn});const it=se?se.models.map(xn=>x.find(er=>er.name===xn.name)).filter(Boolean):x,dt=xn=>{St(G,xn),k(null)};return p.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:p.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[p.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",G,"' konfigurieren"]}),p.jsx("button",{onClick:()=>k(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:p.jsx(Al,{className:"h-4 w-4"})})]}),p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",p.jsx("strong",{className:"text-foreground",children:G}),":"]}),(se==null?void 0:se.recommended)&&p.jsxs("button",{onClick:()=>dt(se.recommended),title:(Ht=We[se.recommended])==null?void 0:Ht.reason,className:"shrink-0 h-7 px-3 text-[11px] font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg cursor-pointer flex items-center gap-1",children:[p.jsx(_h,{className:"h-3 w-3"})," Auto: ",(_n=se.recommended.split("/").pop())==null?void 0:_n.replace(/\.gguf$/i,"")]})]}),p.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[p.jsx("button",{onClick:()=>dt(""),className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:p.jsx("span",{children:"Zuweisung entfernen"})}),it.map(xn=>{var ks;const er=We[xn.name],wr=xn.role===G,ro=!!(er!=null&&er.recommended),Xi=!!er&&!er.suitable;return p.jsxs("button",{onClick:()=>dt(xn.name),className:tt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border",ro?"border-primary/50 bg-primary/10":wr?"text-primary font-bold bg-primary/5 border-primary/30":Xi?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[p.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[p.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(ks=xn.name.split("/").pop())==null?void 0:ks.replace(/\.gguf$/i,""),ro&&p.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),p.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:er?`${er.params_b}B · ${xn.quant} · ${er.reason}`:`${Wo(xn.size_bytes)} · ${xn.quant}`})]}),wr&&p.jsx(So,{className:"h-4 w-4 shrink-0 text-primary"})]},xn.name)})]})]})})})(),te&&p.jsx(Wfe,{model:te,onClose:()=>ee(null),onChanged:b}),pe&&p.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:p.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[p.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[p.jsx(Il,{className:"h-4 w-4"})," Agent-Hirn wechseln"]}),p.jsx("button",{onClick:()=>ie(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:p.jsx(Al,{className:"h-4 w-4"})})]}),p.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Wähle ein ",p.jsx("strong",{className:"text-foreground",children:"installiertes"})," Modell als Agent-Hirn. Es bekommt den",p.jsx("code",{className:"text-primary",children:" hermes"}),'-Alias, wird warm gehalten (brains-Gruppe), und Hermes nutzt es nach einem kurzen Gateway-Restart. Neues Modell (z.B. Hermes-4.3 oder Gemma-4)? Erst über „Modelle finden" laden.']}),p.jsx("div",{className:"space-y-1.5 max-h-72 overflow-y-auto pr-1",children:x.map(se=>{var it;const We=se.role==="hermes";return p.jsxs("button",{onClick:()=>!We&&Be(se.name),disabled:We||se.incomplete,className:tt("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",We?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":se.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[p.jsxs("div",{className:"flex flex-col min-w-0",children:[p.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(it=se.name.split("/").pop())==null?void 0:it.replace(/\.gguf$/i,"")}),p.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[se.capabilities.params_b?`${se.capabilities.params_b}B`:"?"," · ",Wo(se.size_bytes),se.role&&` · Rolle: ${se.role}`,se.capabilities.tools!=="no"?" · Tools ✓":" · ohne Tools"]})]}),We?p.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[p.jsx(So,{className:"h-3.5 w-3.5"})," Aktiv"]}):p.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Als Hirn setzen →"})]},se.name)})}),p.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[p.jsx("span",{children:"💡"}),p.jsxs("span",{children:["Für einen ",p.jsx("strong",{children:"Agenten"})," sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl als allgemeine Modelle."]})]})]})}),y]})}function Yfe(){const[t,e]=P.useState(""),[n,r]=P.useState([]),[i,s]=P.useState("Q4_K_M"),[o,a]=P.useState(""),[l,c]=P.useState(""),[d,f]=P.useState(""),[g,y]=P.useState([]),[x,S]=P.useState(null),[w,b]=P.useState(!1),M=["fast","heavy","coder","vision","scout"],{data:T}=Kh(),C=l?T==null?void 0:T.models.find(H=>(H.role||"").toLowerCase()===l):void 0;async function O(H,te,ee){if(b(!1),!H.trim()){S(null);return}try{const pe=await Lt(`/api/fit?params_b=0&quant=${encodeURIComponent(te)}&ctx=8192&name=${encodeURIComponent(H)}&role=${encodeURIComponent(ee)}`);S(pe)}catch{S(null)}}async function N(H){const te=H??t;if(te.trim()){a("Analysiere HuggingFace Repository..."),S(null);try{const ee=await Lt(`/api/hf/quants?repo=${encodeURIComponent(te)}`);e(ee.repo),r(ee.quants);const pe=ee.quants.length?ee.quants.includes("Q4_K_M")?"Q4_K_M":ee.quants[0]:i;ee.quants.length&&s(pe),a(ee.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden."),ee.quants.length&&O(ee.repo,pe,l)}catch(ee){a(`Fehler: ${ee}`)}}}function L(H){s(H),O(t,H,l)}function F(H){c(H),n.length&&O(t,i,H)}async function G(){if(d.trim()){a("Durchsuche HuggingFace...");try{const H=await Lt(`/api/hf/search?q=${encodeURIComponent(d)}`);y(H.results),a(H.results.length?"":"Keine Ergebnisse gefunden.")}catch(H){a(`Suche fehlgeschlagen: ${H}`)}}}async function k(){if(t.trim()){if((x==null?void 0:x.fit.level)==="too_tight"&&!w){b(!0);return}a("Download-Job wird initiiert...");try{await Lt("/api/models/install",{method:"POST",body:JSON.stringify({repo:t,quant:i,role:l||void 0,jinja:!0})}),b(!1),a(`Download gestartet: ${t} (${i})${l?`, Rolle: ${l}`:""}. Fortschritt oben.`+(C?` „${l}" wurde von ${C.name} übernommen.`:"")+(l==="fast"||l==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(H){a(`Download-Fehler: ${H}`)}}}const U=(x==null?void 0:x.fit.level)==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":(x==null?void 0:x.fit.level)==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return p.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[p.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),p.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[p.jsx("input",{value:t,onChange:H=>{e(H.target.value),S(null),b(!1)},placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("button",{onClick:()=>N(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),n.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("select",{value:i,onChange:H=>L(H.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:n.map(H=>p.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))}),p.jsxs("select",{value:l,onChange:H=>F(H.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[p.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),M.map(H=>p.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))]}),p.jsx("button",{onClick:k,className:`h-9 px-4 rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5 ${w?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"}`,children:w?p.jsxs(p.Fragment,{children:[p.jsx(_g,{className:"h-3.5 w-3.5"})," OOM-Risiko — trotzdem laden"]}):p.jsxs(p.Fragment,{children:[p.jsx(xg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]})]})]}),x&&p.jsxs("div",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium ${U}`,children:[p.jsx("span",{className:"font-bold uppercase tracking-wide",children:x.fit.text}),p.jsxs("span",{className:"font-mono opacity-90",children:["~",x.params_b,"B · ~",x.fit.req_gb," GB / ",x.sys_ram_gb," GB RAM · ~",x.fit.tps," t/s"]}),x.fit.level!=="too_tight"&&p.jsxs("span",{className:"font-mono opacity-80",title:`Setup-bewusst: GTT ${x.budget.gtt_gb} GB − reserviert ${x.budget.reserved_gb} GB (${x.budget.mode}) → ${x.budget.budget_gb} GB frei`,children:["ctx → ",(x.assigned_ctx/1024).toFixed(0),"k"]}),x.fit.level==="too_tight"&&p.jsx("span",{className:"opacity-90",children:"— passt nicht in den Speicher, würde beim Laden abstürzen (OOM)."})]}),C&&p.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] font-medium text-amber-400",children:[p.jsx(_g,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),p.jsxs("span",{children:["Rolle ",p.jsxs("strong",{children:["„",l,'"']})," ist aktuell ",p.jsx("strong",{children:C.name})," zugewiesen. Beim Download übernimmt das neue Modell diese Rolle — ",C.name," bleibt installiert, verliert sie aber."]})]}),p.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[p.jsxs("div",{className:"relative flex-1",children:[p.jsx("input",{value:d,onChange:H=>f(H.target.value),onKeyDown:H=>H.key==="Enter"&&G(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),p.jsx(EP,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),p.jsx("button",{onClick:G,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),g.length>0&&p.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:g.map(H=>p.jsxs("button",{onClick:()=>{e(H.repo),y([]),f(""),N(H.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[p.jsx("span",{className:"font-semibold truncate",children:H.repo}),p.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[p.jsx(xg,{className:"h-3 w-3"})," ",H.downloads.toLocaleString()]})]},H.repo))}),o&&p.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:o})]})}const Zfe={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:_h},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:$1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:cF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:DT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:LT}};function Qfe(){const{data:t,isLoading:e,error:n}=P7(),{data:r}=Kh(),{data:i}=IP(),s=(r==null?void 0:r.models)??[],o=n?String(n):"",[a,l]=P.useState({}),[c,d]=P.useState({}),[f,g]=P.useState(!1);async function y(x,S,w,b){l(M=>({...M,[x]:"Starte..."}));try{await Lt("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:w,jinja:b})}),l(M=>({...M,[x]:"Download läuft"}))}catch{l(T=>({...T,[x]:"Fehler"}))}}return e?p.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):o||!t?p.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",o,")."]}):p.jsxs("div",{className:"space-y-8",children:[p.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[p.jsxs("div",{children:["Modell-Registry geladen für ",p.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx(l9,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),p.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),p.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(x=>{const S=Zfe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:X1},w=S.icon,b=s.find(L=>L.role===x.role),M=i==null?void 0:i.model_list.find(L=>L.role===x.role),T=x.models.find(L=>L.repo===x.recommended)||x.models[0];if(!T)return null;const C=a[T.repo],O=x.models.filter(L=>L.repo!==x.recommended),N=!!c[x.role];return p.jsxs("div",{className:tt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",b?"border-border/60":"border-primary/20 shadow-primary/5"),children:[p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:p.jsx(w,{className:"h-5.5 w-5.5"})}),p.jsxs("div",{children:[p.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),p.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",x.role]})]})]}),b?p.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):p.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),p.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),p.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:b?p.jsxs("div",{className:"space-y-1.5",children:[p.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),p.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:b.name,children:b.name.split("/").pop()}),p.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[p.jsxs("span",{children:["Größe: ",XT(b.size_bytes||0)]}),p.jsx("span",{children:"•"}),p.jsxs("span",{children:["Quant: ",b.quant||"GGUF"]})]})]}):p.jsxs("div",{className:"space-y-1.5",children:[p.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),p.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),p.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[p.jsxs("span",{children:["Ersteller: ",T.author]}),p.jsx("span",{children:"•"}),p.jsxs("span",{children:["Quant: ",T.quant]})]}),p.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:p.jsx(fX,{fit:T.fit})})]})}),p.jsx("div",{className:"pt-1",children:b?M?p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[p.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),p.jsxs("span",{children:["Bessere Version in der Registry: ",M.repo.split("/").pop()]})]}),p.jsxs("button",{onClick:()=>y(M.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[M.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[p.jsx(xg,{className:"h-3.5 w-3.5"}),a[M.repo]||"Auf neue Version aktualisieren"]})]}):p.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[p.jsx(So,{className:"h-4 w-4"})," Auf neuestem Stand"]}):p.jsxs("button",{onClick:()=>y(T.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!C,className:tt("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",C?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[p.jsx(xg,{className:"h-3.5 w-3.5"}),C||"Optimales Modell einsetzen"]})})]}),O.length>0&&p.jsxs("div",{className:"border-t border-border/20 pt-3",children:[p.jsxs("button",{onClick:()=>d(L=>({...L,[x.role]:!N})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[N?p.jsx(C8,{className:"h-3 w-3"}):p.jsx(A8,{className:"h-3 w-3"}),p.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&p.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(L=>p.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:L.name,children:L.name}),p.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[p.jsxs("span",{children:["Quant: ",L.quant]}),p.jsx("span",{children:"•"}),p.jsx("span",{children:L.fit.text})]})]}),p.jsx("button",{onClick:()=>y(L.repo,x.role,L.quant||"Q4_K_M",L.caps.tools!=="no"),disabled:!!a[L.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:a[L.repo]||"Installieren"})]},L.repo))})]})]},x.role)})}),p.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[p.jsxs("button",{onClick:()=>g(!f),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(EP,{className:"h-4 w-4 text-primary"}),p.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),p.jsx("span",{className:"text-[10px] text-primary hover:underline",children:f?"Ausblenden ▲":"Anzeigen ▼"})]}),f&&p.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:p.jsx(Yfe,{})})]})]})}function Jfe(){const[t,e]=P.useState("cockpit");return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),p.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),p.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(n=>p.jsx("button",{onClick:()=>e(n),className:tt("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===n?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:n==="cockpit"?"Cockpit":"Modelle finden"},n))})]}),p.jsx(Gfe,{}),p.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?p.jsx(Kfe,{}):p.jsx(Qfe,{})})]})}const ehe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function U3({line:t,loading:e}){return e||!t?p.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[p.jsx(q1,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?p.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[p.jsx(P8,{className:"h-3 w-3"})," ",t.detail]}):p.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[p.jsx(N8,{className:"h-3 w-3"})," ",t.detail]})}function F3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return p.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[p.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),p.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),p.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),p.jsx("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:p.jsx("span",{children:e})}),p.jsxs("button",{onClick:i,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[r?p.jsx(So,{className:"h-3.5 w-3.5 text-emerald-400"}):p.jsx(nw,{className:"h-3.5 w-3.5"}),p.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),p.jsx("pre",{className:tt("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",n==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:p.jsx("code",{children:t.snippet})})]})}function the(){const[t,e]=P.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[n,r]=P.useState(localStorage.getItem("mc_mcp_path")||""),[i,s]=P.useState("cline"),[o,a]=P.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=KF(l.toString()),{data:f,isLoading:g}=N7(),y=d?String(d):"";function x(M){e(M),M&&localStorage.setItem("mc_host",M)}function S(M){r(M),localStorage.setItem("mc_mcp_path",M)}const w=c==null?void 0:c.tools[i];async function b(M,T){T&&(await navigator.clipboard.writeText(T),a(M),setTimeout(()=>a(null),1500))}return p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",p.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),p.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[p.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[p.jsx(H8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),p.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),p.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),p.jsxs("div",{className:"flex flex-col gap-2.5",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(tw,{className:"h-4 w-4 text-muted-foreground shrink-0"}),p.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[p.jsx(El,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),p.jsx(U3,{line:f==null?void 0:f.gateway,loading:g})]}),p.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · model auto"})]})]}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx(tw,{className:"h-4 w-4 text-muted-foreground shrink-0"}),p.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[p.jsx($1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),p.jsx(U3,{line:f==null?void 0:f.memory,loading:g})]}),p.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),p.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",p.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",p.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),p.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[p.jsx(z8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),p.jsx("input",{value:t,onChange:M=>x(M.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[p.jsx(U8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",p.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),p.jsx("input",{value:n,onChange:M=>S(M.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),y&&p.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",y]}),c&&p.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[p.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[p.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),p.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),p.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([M,T])=>p.jsx("button",{onClick:()=>s(M),className:tt("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===M?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},M))}),w&&p.jsxs(p.Fragment,{children:[w.note&&p.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[p.jsx(dI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),p.jsx("span",{children:w.note})]}),p.jsx(F3,{tool:w,fileName:ehe[i]||"config.json",accent:"teal",copied:o==="model",onCopy:()=>b("model",w.snippet)})]})]}),p.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[p.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",p.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),p.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",p.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),p.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[p.jsx(dI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),p.jsx("span",{children:c.memory.note})]}),p.jsx(F3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>b("memory",c.memory.snippet)})]})]})]})}const nhe="modulepreload",rhe=function(t){return"/"+t},z3={},ihe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=rhe(c),c in z3)return;z3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const g=document.createElement("link");if(g.rel=d?"stylesheet":nhe,d||(g.as="script"),g.crossOrigin="",g.href=c,l&&g.setAttribute("nonce",l),document.head.appendChild(g),d)return new Promise((y,x)=>{g.addEventListener("load",y),g.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};class she extends P.Component{constructor(){super(...arguments);$s(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?p.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[p.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),p.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const ohe=P.lazy(()=>ihe(()=>import("./GraphView-CDHhai9o.js"),[]).then(t=>({default:t.GraphView}))),Ub=["identity","knowledge","rules","events"],B3=new Set(["auto","agent","hermes"]),QE={identity:{label:"Identität",icon:c9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:Zm,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:r9,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:I8,bg:"bg-amber-500/10",text:"text-amber-400"}},H3={label:"Gedächtnis",icon:kT,text:"text-muted-foreground"},ahe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},V3=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: 1) wer ich bin und woran ich gerade arbeite, 2) wie ich angesprochen werden möchte, 3) meine bevorzugten Tools, Sprachen und Arbeitsweise, 4) wichtige Regeln/Konventionen, die du beachten sollst, 5) meine Infrastruktur (Server, Dienste – ohne Geheimnisse). -Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemerkt hast.`;function Kfe(){const[t,e]=R.useState(""),[n,r]=R.useState(""),[i,s]=R.useState(""),[o,a]=R.useState("knowledge"),[l,c]=R.useState(!1),[d,f]=R.useState(!1),[m,y]=R.useState("liste"),[x,S]=R.useState(!1),_=Xh(),{showAlert:w,showConfirm:E,dialogElement:T}=tv(),{data:C=[]}=HT({}),{data:O=[],error:N}=HT({q:n,category:t}),{data:L}=p7(m==="graph"),F=N?String(N):"",G=()=>{_.invalidateQueries({queryKey:["memory"]}),_.invalidateQueries({queryKey:["memory-graph"]})},k=R.useMemo(()=>{const V=C.length,q=C.filter(he=>F3.has(he.source)).length;return{total:V,auto:q,manual:V-q,cats:new Set(C.map(he=>he.category)).size}},[C]),U=C.length===0,H=R.useMemo(()=>{const V=L??{nodes:[],edges:[]};if(!n.trim())return V;const q=n.toLowerCase(),he=V.nodes.filter(ce=>ce.content.toLowerCase().includes(q)),ae=new Set(he.map(ce=>ce.id));return{nodes:he,edges:V.edges.filter(ce=>ae.has(ce.source)&&ae.has(ce.target))}},[L,n]),ne=R.useMemo(()=>{const V={};return O.forEach(q=>{var he;(V[he=q.category]??(V[he]=[])).push(q)}),V},[O]),ee=R.useMemo(()=>O.filter(V=>!jb.includes(V.category)),[O]);async function pe(){i.trim()&&(await zt("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:o,source:"ui"})}),s(""),S(!1),G())}async function se(V){await zt(`/api/memory/${V}`,{method:"DELETE"}),G()}async function fe(){try{await navigator.clipboard.writeText(B3),f(!0),setTimeout(()=>f(!1),1800)}catch{w("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function B(){fe(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function Q(){c(!0);try{const V=await zt("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(V.duplicate_count===0){w("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}E("Deduplizierung bestätigen",`${V.duplicate_count} Dublette(n) in ${V.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await zt("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),G()}catch(q){w("Fehler",`Fehler beim Löschen: ${q.message}`)}})}catch(V){w("Fehler",`Fehler bei der Deduplizierung: ${V.message}`)}finally{c(!1)}}const K=({value:V,label:q,accent:he})=>g.jsxs("span",{className:rt("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",he==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[he==="auto"&&g.jsx(Gm,{className:"h-3 w-3"}),g.jsx("b",{className:rt("font-semibold",he==="auto"?"":"text-foreground"),children:V})," ",q]});return g.jsxs("div",{className:"space-y-5",children:[g.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool"}),g.jsx("p",{className:"text-sm text-muted-foreground",children:"Geteilte Konstitution — Hermes, IDEs & Gateway lesen und lernen hier per MCP."})]}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsxs("div",{className:"relative",children:[g.jsx("input",{value:n,onChange:V=>r(V.target.value),placeholder:"Semantisch suchen…",className:"w-52 h-9 pl-8 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),g.jsx(wP,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),g.jsxs("button",{onClick:()=>S(V=>!V),className:"h-9 px-3 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[g.jsx(OT,{className:"h-4 w-4"})," Eintrag"]}),g.jsx("div",{className:"flex items-center gap-1 p-1 bg-card/30 border border-border/40 rounded-lg",children:[["liste",H8,"Liste"],["graph",t9,"Graph"]].map(([V,q,he])=>g.jsxs("button",{onClick:()=>y(V),className:rt("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",m===V?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[g.jsx(q,{className:"h-3.5 w-3.5"})," ",he]},V))}),g.jsx("button",{onClick:Q,disabled:l,className:"flex h-9 w-9 items-center justify-center rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50",title:"Deduplizieren",children:g.jsx(Gm,{className:"h-4 w-4 text-primary"})})]})]}),!U&&g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.jsx(K,{value:k.total,label:"Fakten"}),g.jsx(K,{value:k.auto,label:"auto gelernt",accent:"auto"}),g.jsx(K,{value:k.manual,label:"manuell"}),g.jsx(K,{value:k.cats,label:"Kategorien"}),g.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[g.jsx(Gm,{className:"h-3 w-3 text-emerald-400"})," lernt automatisch aus Hermes-Gesprächen"]})]}),x&&g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 space-y-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),g.jsx("button",{onClick:()=>S(!1),className:"text-muted-foreground hover:text-foreground",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsx("textarea",{value:i,onChange:V=>s(V.target.value),rows:2,placeholder:"Eine Regel, Vorliebe oder einen stabilen Fakt über dich oder das Projekt…",className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),g.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[g.jsx("select",{value:o,onChange:V=>a(V.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 text-xs outline-none font-semibold text-foreground cursor-pointer",children:jb.map(V=>{var q;return g.jsx("option",{value:V,className:"bg-popover text-foreground",children:((q=qE[V])==null?void 0:q.label)||V},V)})}),g.jsxs("button",{onClick:pe,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[g.jsx(OT,{className:"h-4 w-4"})," Speichern"]})]})]}),F&&g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler: ",F]}),U?g.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 sm:p-10 flex flex-col items-center text-center gap-5",children:[g.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:g.jsx(G8,{className:"h-7 w-7 text-primary"})}),g.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[g.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),g.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Statt Fakten einzutippen: führ ein kurzes Onboarding-Gespräch mit Hermes. Was ihr besprecht, merkt sich das Gedächtnis automatisch — du musst nichts manuell pflegen."})]}),g.jsxs("div",{className:"w-full max-w-lg text-left",children:[g.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),g.jsx("button",{onClick:fe,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:d?g.jsxs(g.Fragment,{children:[g.jsx($o,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):g.jsxs(g.Fragment,{children:[g.jsx(tw,{className:"h-3 w-3"})," Kopieren"]})})]}),g.jsx("pre",{className:"w-full rounded-xl border border-border/60 bg-background/40 p-3.5 text-[11px] leading-relaxed text-foreground/90 whitespace-pre-wrap font-mono",children:B3})]}),g.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[g.jsxs("button",{onClick:B,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[g.jsx(uF,{className:"h-4 w-4"})," Im Terminal starten"]}),g.jsxs("button",{onClick:fe,className:"h-9 px-4 rounded-lg border border-border/60 bg-card text-xs font-semibold hover:border-primary/50 transition-all flex items-center gap-1.5 cursor-pointer",children:[d?g.jsx($o,{className:"h-4 w-4 text-emerald-400"}):g.jsx(tw,{className:"h-4 w-4"})," Prompt kopieren"]})]}),g.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[g.jsx(e9,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",g.jsx("button",{onClick:()=>S(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):m==="graph"?g.jsx($fe,{children:g.jsx(R.Suspense,{fallback:g.jsx("div",{className:"h-[480px] rounded-2xl border border-border/60 bg-card/30 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:g.jsx(Xfe,{data:H,onDelete:se})})}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl w-fit",children:[g.jsx("button",{onClick:()=>e(""),className:rt("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer",t?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),jb.map(V=>{const q=qE[V]||z3,he=q.icon;return g.jsxs("button",{onClick:()=>e(V),className:rt("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",t===V?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[g.jsx(he,{className:"h-3 w-3"})," ",q.label]},V)})]}),O.length===0?g.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):g.jsx("div",{className:"space-y-5",children:[...jb,"__other"].map(V=>{const q=V==="__other"?ee:ne[V]||[];if(!q.length)return null;const he=qE[V]||z3,ae=he.icon;return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-2 px-1",children:[g.jsx(ae,{className:rt("h-3.5 w-3.5",he.text)}),g.jsx("span",{className:rt("text-[11px] font-bold uppercase tracking-wider",he.text),children:he.label}),g.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 bg-card/50 rounded px-1.5 py-0.5",children:q.length}),g.jsx("div",{className:"ml-1 h-px flex-1 bg-border/30"})]}),g.jsx("div",{className:"space-y-2",children:q.map(ce=>{const we=F3.has(ce.source);return g.jsxs("div",{className:rt("flex items-start justify-between gap-4 p-3.5 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 hover:border-primary/20 transition-all group",qfe[ce.category]||"border-l-muted"),children:[g.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1 min-w-0",children:ce.content}),g.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[typeof ce.score=="number"&&g.jsxs("span",{className:"text-[9px] font-mono text-primary bg-primary/10 px-1.5 py-0.5 rounded",title:"Relevanz der semantischen Suche",children:[Math.round(ce.score*100),"%"]}),g.jsxs("span",{className:rt("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded",we?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:we?"Automatisch gelernt":"Manuell angelegt",children:[we&&g.jsx(Gm,{className:"h-2.5 w-2.5"}),ce.source]}),g.jsx("button",{onClick:()=>se(ce.id),title:"Eintrag löschen",className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:g.jsx(LT,{className:"h-3.5 w-3.5"})})]})]},ce.id)})})]},V)})})]}),T]})}function Ub({label:t,ok:e,detail:n,icon:r,onClick:i}){return g.jsxs("div",{onClick:i,className:rt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",e?"border-border/60":"border-amber-500/30",i&&"cursor-pointer hover:bg-card/70"),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:t}),g.jsx(r,{className:rt("h-4.5 w-4.5",e?"text-primary":"text-amber-500")})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:rt("h-2 w-2 rounded-full ring-2 ring-black/40",e?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-semibold text-foreground",children:e?"Bereit / Online":"Offline / Inaktiv"})]}),n&&g.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:n,children:n})]}),i&&g.jsxs("button",{onClick:s=>{s.stopPropagation(),i()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[g.jsx(El,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:"Gehirn wechseln"})]})]})}function Yfe(){const{data:t,error:e}=CP(5e3),{data:n}=Kh(),{showAlert:r,dialogElement:i}=tv(),s=Xh(),o=e?String(e):"",a=R.useMemo(()=>["auto","fast","heavy",...((n==null?void 0:n.models)??[]).map(O=>{var N;return((N=O.name.split("/").pop())==null?void 0:N.replace(".gguf",""))||O.name})],[n]),[l,c]=R.useState(null),[d,f]=R.useState(!1),[m,y]=R.useState({width:800,height:360}),x=R.useRef(null),S=R.useCallback(C=>{if(x.current&&(x.current.disconnect(),x.current=null),C){const O=new ResizeObserver(N=>{if(!N||N.length===0)return;const L=N[0].contentRect;y({width:L.width,height:L.height})});O.observe(C),x.current=O}},[]),_=m.width,w=m.height,E=(C,O,N,L)=>{const F=(C+N)/2;return`M ${C} ${O} C ${F} ${O}, ${F} ${L}, ${N} ${L}`};async function T(C){try{await zt("/api/agent/brain",{method:"POST",body:JSON.stringify({model:C})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${C}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:br.agentStatus}),f(!1)}catch(O){r("Fehler",`Fehler beim Wechseln des Gehirns: ${O.message}`)}}return g.jsxs("div",{className:"space-y-6",children:[g.jsx("style",{children:` +Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemerkt hast.`;function lhe(){const[t,e]=P.useState(""),[n,r]=P.useState(""),[i,s]=P.useState(""),[o,a]=P.useState("knowledge"),[l,c]=P.useState(!1),[d,f]=P.useState(!1),[g,y]=P.useState("liste"),[x,S]=P.useState(!1),w=Rd(),{showAlert:b,showConfirm:M,dialogElement:T}=tv(),{data:C=[]}=$T({}),{data:O=[],error:N}=$T({q:n,category:t}),{data:L}=b7(g==="graph"),F=N?String(N):"",G=()=>{w.invalidateQueries({queryKey:["memory"]}),w.invalidateQueries({queryKey:["memory-graph"]})},k=P.useMemo(()=>{const V=C.length,q=C.filter(he=>B3.has(he.source)).length;return{total:V,auto:q,manual:V-q,cats:new Set(C.map(he=>he.category)).size}},[C]),U=C.length===0,H=P.useMemo(()=>{const V=L??{nodes:[],edges:[]};if(!n.trim())return V;const q=n.toLowerCase(),he=V.nodes.filter(ce=>ce.content.toLowerCase().includes(q)),ae=new Set(he.map(ce=>ce.id));return{nodes:he,edges:V.edges.filter(ce=>ae.has(ce.source)&&ae.has(ce.target))}},[L,n]),te=P.useMemo(()=>{const V={};return O.forEach(q=>{var he;(V[he=q.category]??(V[he]=[])).push(q)}),V},[O]),ee=P.useMemo(()=>O.filter(V=>!Ub.includes(V.category)),[O]);async function pe(){i.trim()&&(await Lt("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:o,source:"ui"})}),s(""),S(!1),G())}async function ie(V){await Lt(`/api/memory/${V}`,{method:"DELETE"}),G()}async function fe(){try{await navigator.clipboard.writeText(V3),f(!0),setTimeout(()=>f(!1),1800)}catch{b("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function B(){fe(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function Q(){c(!0);try{const V=await Lt("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(V.duplicate_count===0){b("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}M("Deduplizierung bestätigen",`${V.duplicate_count} Dublette(n) in ${V.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await Lt("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),G()}catch(q){b("Fehler",`Fehler beim Löschen: ${q.message}`)}})}catch(V){b("Fehler",`Fehler bei der Deduplizierung: ${V.message}`)}finally{c(!1)}}const K=({value:V,label:q,accent:he})=>p.jsxs("span",{className:tt("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",he==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[he==="auto"&&p.jsx(Gm,{className:"h-3 w-3"}),p.jsx("b",{className:tt("font-semibold",he==="auto"?"":"text-foreground"),children:V})," ",q]});return p.jsxs("div",{className:"space-y-5",children:[p.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool"}),p.jsx("p",{className:"text-sm text-muted-foreground",children:"Geteilte Konstitution — Hermes, IDEs & Gateway lesen und lernen hier per MCP."})]}),p.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[p.jsxs("div",{className:"relative",children:[p.jsx("input",{value:n,onChange:V=>r(V.target.value),placeholder:"Semantisch suchen…",className:"w-52 h-9 pl-8 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),p.jsx(EP,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),p.jsxs("button",{onClick:()=>S(V=>!V),className:"h-9 px-3 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[p.jsx(UT,{className:"h-4 w-4"})," Eintrag"]}),p.jsx("div",{className:"flex items-center gap-1 p-1 bg-card/30 border border-border/40 rounded-lg",children:[["liste",$8,"Liste"],["graph",s9,"Graph"]].map(([V,q,he])=>p.jsxs("button",{onClick:()=>y(V),className:tt("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",g===V?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[p.jsx(q,{className:"h-3.5 w-3.5"})," ",he]},V))}),p.jsx("button",{onClick:Q,disabled:l,className:"flex h-9 w-9 items-center justify-center rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50",title:"Deduplizieren",children:p.jsx(Gm,{className:"h-4 w-4 text-primary"})})]})]}),!U&&p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx(K,{value:k.total,label:"Fakten"}),p.jsx(K,{value:k.auto,label:"auto gelernt",accent:"auto"}),p.jsx(K,{value:k.manual,label:"manuell"}),p.jsx(K,{value:k.cats,label:"Kategorien"}),p.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[p.jsx(Gm,{className:"h-3 w-3 text-emerald-400"})," lernt automatisch aus Hermes-Gesprächen"]})]}),x&&p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),p.jsx("button",{onClick:()=>S(!1),className:"text-muted-foreground hover:text-foreground",children:p.jsx(Al,{className:"h-4 w-4"})})]}),p.jsx("textarea",{value:i,onChange:V=>s(V.target.value),rows:2,placeholder:"Eine Regel, Vorliebe oder einen stabilen Fakt über dich oder das Projekt…",className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[p.jsx("select",{value:o,onChange:V=>a(V.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 text-xs outline-none font-semibold text-foreground cursor-pointer",children:Ub.map(V=>{var q;return p.jsx("option",{value:V,className:"bg-popover text-foreground",children:((q=QE[V])==null?void 0:q.label)||V},V)})}),p.jsxs("button",{onClick:pe,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[p.jsx(UT,{className:"h-4 w-4"})," Speichern"]})]})]}),F&&p.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler: ",F]}),U?p.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 sm:p-10 flex flex-col items-center text-center gap-5",children:[p.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:p.jsx(K8,{className:"h-7 w-7 text-primary"})}),p.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[p.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),p.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Statt Fakten einzutippen: führ ein kurzes Onboarding-Gespräch mit Hermes. Was ihr besprecht, merkt sich das Gedächtnis automatisch — du musst nichts manuell pflegen."})]}),p.jsxs("div",{className:"w-full max-w-lg text-left",children:[p.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[p.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),p.jsx("button",{onClick:fe,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:d?p.jsxs(p.Fragment,{children:[p.jsx(So,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):p.jsxs(p.Fragment,{children:[p.jsx(nw,{className:"h-3 w-3"})," Kopieren"]})})]}),p.jsx("pre",{className:"w-full rounded-xl border border-border/60 bg-background/40 p-3.5 text-[11px] leading-relaxed text-foreground/90 whitespace-pre-wrap font-mono",children:V3})]}),p.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[p.jsxs("button",{onClick:B,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[p.jsx(pF,{className:"h-4 w-4"})," Im Terminal starten"]}),p.jsxs("button",{onClick:fe,className:"h-9 px-4 rounded-lg border border-border/60 bg-card text-xs font-semibold hover:border-primary/50 transition-all flex items-center gap-1.5 cursor-pointer",children:[d?p.jsx(So,{className:"h-4 w-4 text-emerald-400"}):p.jsx(nw,{className:"h-4 w-4"})," Prompt kopieren"]})]}),p.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[p.jsx(i9,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",p.jsx("button",{onClick:()=>S(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):g==="graph"?p.jsx(she,{children:p.jsx(P.Suspense,{fallback:p.jsx("div",{className:"h-[480px] rounded-2xl border border-border/60 bg-card/30 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:p.jsx(ohe,{data:H,onDelete:ie})})}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl w-fit",children:[p.jsx("button",{onClick:()=>e(""),className:tt("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer",t?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),Ub.map(V=>{const q=QE[V]||H3,he=q.icon;return p.jsxs("button",{onClick:()=>e(V),className:tt("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",t===V?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[p.jsx(he,{className:"h-3 w-3"})," ",q.label]},V)})]}),O.length===0?p.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):p.jsx("div",{className:"space-y-5",children:[...Ub,"__other"].map(V=>{const q=V==="__other"?ee:te[V]||[];if(!q.length)return null;const he=QE[V]||H3,ae=he.icon;return p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2 mb-2 px-1",children:[p.jsx(ae,{className:tt("h-3.5 w-3.5",he.text)}),p.jsx("span",{className:tt("text-[11px] font-bold uppercase tracking-wider",he.text),children:he.label}),p.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 bg-card/50 rounded px-1.5 py-0.5",children:q.length}),p.jsx("div",{className:"ml-1 h-px flex-1 bg-border/30"})]}),p.jsx("div",{className:"space-y-2",children:q.map(ce=>{const we=B3.has(ce.source);return p.jsxs("div",{className:tt("flex items-start justify-between gap-4 p-3.5 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 hover:border-primary/20 transition-all group",ahe[ce.category]||"border-l-muted"),children:[p.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1 min-w-0",children:ce.content}),p.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[typeof ce.score=="number"&&p.jsxs("span",{className:"text-[9px] font-mono text-primary bg-primary/10 px-1.5 py-0.5 rounded",title:"Relevanz der semantischen Suche",children:[Math.round(ce.score*100),"%"]}),p.jsxs("span",{className:tt("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded",we?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:we?"Automatisch gelernt":"Manuell angelegt",children:[we&&p.jsx(Gm,{className:"h-2.5 w-2.5"}),ce.source]}),p.jsx("button",{onClick:()=>ie(ce.id),title:"Eintrag löschen",className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:p.jsx(FT,{className:"h-3.5 w-3.5"})})]})]},ce.id)})})]},V)})})]}),T]})}function Fb({label:t,ok:e,detail:n,icon:r,onClick:i}){return p.jsxs("div",{onClick:i,className:tt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",e?"border-border/60":"border-amber-500/30",i&&"cursor-pointer hover:bg-card/70"),children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:t}),p.jsx(r,{className:tt("h-4.5 w-4.5",e?"text-primary":"text-amber-500")})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:tt("h-2 w-2 rounded-full ring-2 ring-black/40",e?"bg-emerald-500 animate-pulse":"bg-amber-500")}),p.jsx("span",{className:"text-xs font-semibold text-foreground",children:e?"Bereit / Online":"Offline / Inaktiv"})]}),n&&p.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:n,children:n})]}),i&&p.jsxs("button",{onClick:s=>{s.stopPropagation(),i()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[p.jsx(El,{className:"h-3.5 w-3.5"}),p.jsx("span",{children:"Gehirn wechseln"})]})]})}function che(){const{data:t,error:e}=NP(5e3),{data:n}=Kh(),{showAlert:r,dialogElement:i}=tv(),s=Rd(),o=e?String(e):"",a=P.useMemo(()=>["auto","fast","heavy",...((n==null?void 0:n.models)??[]).map(O=>{var N;return((N=O.name.split("/").pop())==null?void 0:N.replace(".gguf",""))||O.name})],[n]),[l,c]=P.useState(null),[d,f]=P.useState(!1),[g,y]=P.useState({width:800,height:360}),x=P.useRef(null),S=P.useCallback(C=>{if(x.current&&(x.current.disconnect(),x.current=null),C){const O=new ResizeObserver(N=>{if(!N||N.length===0)return;const L=N[0].contentRect;y({width:L.width,height:L.height})});O.observe(C),x.current=O}},[]),w=g.width,b=g.height,M=(C,O,N,L)=>{const F=(C+N)/2;return`M ${C} ${O} C ${F} ${O}, ${F} ${L}, ${N} ${L}`};async function T(C){try{await Lt("/api/agent/brain",{method:"POST",body:JSON.stringify({model:C})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${C}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:Jn.agentStatus}),f(!1)}catch(O){r("Fehler",`Fehler beim Wechseln des Gehirns: ${O.message}`)}}return p.jsxs("div",{className:"space-y-6",children:[p.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -588,15 +603,15 @@ Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemer stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),g.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",g.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(t==null?void 0:t.terminal_url)&&g.jsxs("a",{href:Mg(t.terminal_url),target:"_blank",rel:"noopener",className:rt("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",t.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[g.jsx(bg,{className:"h-4 w-4"}),g.jsx("span",{children:"Terminal öffnen"})]})]}),o&&g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",o,")."]}),t&&g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[g.jsx(Ub,{label:"Agent Gateway",ok:t.gateway_reachable,detail:"Port :8642 (REST API)",icon:Il}),g.jsx(Ub,{label:"Terminal",ok:t.terminal_reachable,detail:"Web-Terminal (hermes chat)",icon:ay}),g.jsx(Ub,{label:"Aktives Gehirn",ok:t.gateway_reachable,detail:t.brain_model?`Model: ${t.brain_model}`:"Model: auto",icon:El,onClick:()=>f(!0)}),g.jsx(Ub,{label:"Verdrahtung",ok:t.has_config,detail:`Config: ${t.has_config?"✓":"—"} · Skills: ${t.has_skills?"✓":"—"} · Memory: ${t.has_memories?"✓":"—"}`,icon:rw})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[g.jsxs("div",{children:[g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),g.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),g.jsxs("div",{ref:S,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[g.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[g.jsxs("defs",{children:[g.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),g.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),g.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),g.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),g.jsx("path",{d:E(_*.15,w*.5,_*.5,w*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="terminal"||t.terminal_reachable)&&g.jsx("path",{d:E(_*.15,w*.5,_*.5,w*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:E(_*.5,w*.5,_*.85,w*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="brain"||t.gateway_reachable)&&g.jsx("path",{d:E(_*.5,w*.5,_*.85,w*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:E(_*.5,w*.5,_*.85,w*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="wiring"||t.gateway_reachable)&&g.jsx("path",{d:E(_*.5,w*.5,_*.85,w*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>c("terminal"),onMouseLeave:()=>c(null),onClick:()=>t.terminal_reachable&&window.open(Mg(t.terminal_url),"_blank"),title:t.terminal_reachable?"Klicken um das Hermes-Terminal zu öffnen":"Terminal offline",children:[g.jsx(ay,{className:rt("h-3.5 w-3.5",t.terminal_reachable?"text-emerald-400":"text-amber-500")}),g.jsx("span",{children:"Terminal"}),g.jsx("span",{className:rt("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",t.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),g.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>c("gateway"),onMouseLeave:()=>c(null),children:[g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Il,{className:"h-3.5 w-3.5 text-primary"}),g.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),g.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),g.jsx("div",{className:rt("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",t.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:t.gateway_reachable?"Online":"Offline"})]}),g.jsxs("div",{className:rt("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",t.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>c("brain"),onMouseLeave:()=>c(null),onClick:()=>f(!0),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[g.jsx(El,{className:"h-3 w-3 text-primary"}),g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),t.gateway_reachable&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:t.brain_model,children:t.brain_model||"auto"})]}),g.jsxs("div",{className:rt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",t.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>c("wiring"),onMouseLeave:()=>c(null),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[g.jsx(rw,{className:"h-3 w-3 text-primary"}),g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),t.has_config&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[g.jsxs("span",{children:["Config: ",t.has_config?"✓":"—"]}),g.jsxs("span",{children:["Skills: ",t.has_skills?"✓":"—"]}),g.jsxs("span",{children:["Memory: ",t.has_memories?"✓":"—"]})]})]})]}),g.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),g.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),g.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(W8,{className:"h-5 w-5 text-primary"}),g.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:rt("h-2 w-2 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[g.jsxs("div",{className:"space-y-3",children:[g.jsxs("p",{children:["Der ",g.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",g.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"192.168.178.98:7777"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),g.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",g.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),g.jsx("div",{className:"space-y-3",children:t.pc_executor_reachable?g.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[g.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),g.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",g.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",g.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",g.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):g.jsxs("div",{className:"space-y-2",children:[g.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),g.jsxs("p",{children:["Starte ",g.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",g.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),g.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!t.gateway_reachable&&g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Zm,{className:"h-5 w-5 text-amber-500"}),g.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),g.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[g.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),g.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",g.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),g.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[g.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),g.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),g.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-terminal"})]}),g.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",g.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),t&&d&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[g.jsx(El,{className:"h-4 w-4"}),g.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),g.jsx("button",{onClick:()=>f(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',g.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),g.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:a.map(C=>{const O=["auto","fast","heavy"].includes(C);return g.jsxs("button",{onClick:()=>T(C),className:rt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",t.brain_model===C||!t.brain_model&&C==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[g.jsxs("div",{className:"flex flex-col text-left",children:[g.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:C}),g.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:O?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(t.brain_model===C||!t.brain_model&&C==="auto")&&g.jsx($o,{className:"h-4 w-4 shrink-0 text-primary"})]},C)})})]})}),i]})}function Zfe(){const{data:t}=CP(5e3),e=t!=null&&t.terminal_url?Mg(t.terminal_url):void 0,n=t==null?void 0:t.terminal_reachable;return g.jsxs("div",{className:"flex h-full flex-col gap-4",children:[g.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Hermes Terminal"}),g.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Interaktiver Agent (",g.jsx("code",{className:"rounded bg-background/40 px-1 font-mono text-[11px] text-primary",children:"hermes chat"}),') mit Tools & PC-Steuerung — „mehr als Chatten".']})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[g.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),n?"online":"offline"]}),e&&g.jsxs("a",{href:e,target:"_blank",rel:"noopener",className:"flex h-8 items-center gap-1.5 rounded-lg border border-border/60 bg-background/20 px-3 text-xs font-semibold text-muted-foreground transition-all hover:border-primary/50 hover:text-foreground",children:[g.jsx(bg,{className:"h-3.5 w-3.5"})," In neuem Tab"]})]})]}),e?g.jsxs("div",{className:"relative min-h-[68vh] flex-1 overflow-hidden rounded-2xl border border-border/60 bg-black/50 shadow-lg shadow-black/25",children:[n===!1&&g.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/70 text-center",children:[g.jsx(_g,{className:"h-8 w-8 text-amber-400"}),g.jsx("div",{className:"text-sm font-semibold text-amber-300",children:"Terminal nicht erreichbar"}),g.jsxs("p",{className:"max-w-sm text-[11px] leading-normal text-muted-foreground",children:["Der ",g.jsx("code",{className:"font-mono text-primary",children:"hermes-terminal"}),"-Dienst (ttyd) läuft nicht. Auf der Box: ",g.jsx("code",{className:"font-mono",children:"systemctl --user restart hermes-terminal"}),"."]})]}),g.jsx("iframe",{src:e,title:"Hermes Terminal",className:"h-full w-full border-0",style:{minHeight:"68vh"}})]}):g.jsxs("div",{className:"flex min-h-[68vh] flex-1 items-center justify-center rounded-2xl border border-border/60 bg-background/20 text-xs text-muted-foreground",children:[g.jsx(cF,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}/** + `}),p.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),p.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",p.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(t==null?void 0:t.terminal_url)&&p.jsxs("a",{href:Mg(t.terminal_url),target:"_blank",rel:"noopener",className:tt("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",t.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[p.jsx(bg,{className:"h-4 w-4"}),p.jsx("span",{children:"Terminal öffnen"})]})]}),o&&p.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",o,")."]}),t&&p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[p.jsx(Fb,{label:"Agent Gateway",ok:t.gateway_reachable,detail:"Port :8642 (REST API)",icon:Il}),p.jsx(Fb,{label:"Terminal",ok:t.terminal_reachable,detail:"Web-Terminal (hermes chat)",icon:ay}),p.jsx(Fb,{label:"Aktives Gehirn",ok:t.gateway_reachable,detail:t.brain_model?`Model: ${t.brain_model}`:"Model: auto",icon:El,onClick:()=>f(!0)}),p.jsx(Fb,{label:"Verdrahtung",ok:t.has_config,detail:`Config: ${t.has_config?"✓":"—"} · Skills: ${t.has_skills?"✓":"—"} · Memory: ${t.has_memories?"✓":"—"}`,icon:iw})]}),p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[p.jsxs("div",{children:[p.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),p.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),p.jsxs("div",{ref:S,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[p.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[p.jsxs("defs",{children:[p.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[p.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),p.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),p.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[p.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),p.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),p.jsx("path",{d:M(w*.15,b*.5,w*.5,b*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="terminal"||t.terminal_reachable)&&p.jsx("path",{d:M(w*.15,b*.5,w*.5,b*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:M(w*.5,b*.5,w*.85,b*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="brain"||t.gateway_reachable)&&p.jsx("path",{d:M(w*.5,b*.5,w*.85,b*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),p.jsx("path",{d:M(w*.5,b*.5,w*.85,b*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="wiring"||t.gateway_reachable)&&p.jsx("path",{d:M(w*.5,b*.5,w*.85,b*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),p.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>c("terminal"),onMouseLeave:()=>c(null),onClick:()=>t.terminal_reachable&&window.open(Mg(t.terminal_url),"_blank"),title:t.terminal_reachable?"Klicken um das Hermes-Terminal zu öffnen":"Terminal offline",children:[p.jsx(ay,{className:tt("h-3.5 w-3.5",t.terminal_reachable?"text-emerald-400":"text-amber-500")}),p.jsx("span",{children:"Terminal"}),p.jsx("span",{className:tt("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",t.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),p.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>c("gateway"),onMouseLeave:()=>c(null),children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(Il,{className:"h-3.5 w-3.5 text-primary"}),p.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),p.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),p.jsx("div",{className:tt("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",t.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:t.gateway_reachable?"Online":"Offline"})]}),p.jsxs("div",{className:tt("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",t.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>c("brain"),onMouseLeave:()=>c(null),onClick:()=>f(!0),children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[p.jsx(El,{className:"h-3 w-3 text-primary"}),p.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),t.gateway_reachable&&p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),p.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:t.brain_model,children:t.brain_model||"auto"})]}),p.jsxs("div",{className:tt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",t.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>c("wiring"),onMouseLeave:()=>c(null),children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[p.jsx(iw,{className:"h-3 w-3 text-primary"}),p.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),t.has_config&&p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),p.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[p.jsxs("span",{children:["Config: ",t.has_config?"✓":"—"]}),p.jsxs("span",{children:["Skills: ",t.has_skills?"✓":"—"]}),p.jsxs("span",{children:["Memory: ",t.has_memories?"✓":"—"]})]})]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),p.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),p.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Y8,{className:"h-5 w-5 text-primary"}),p.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:tt("h-2 w-2 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),p.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),p.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[p.jsxs("div",{className:"space-y-3",children:[p.jsxs("p",{children:["Der ",p.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",p.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"192.168.178.98:7777"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),p.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",p.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),p.jsx("div",{className:"space-y-3",children:t.pc_executor_reachable?p.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[p.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),p.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",p.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",p.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",p.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),p.jsxs("p",{children:["Starte ",p.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",p.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),p.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!t.gateway_reachable&&p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Zm,{className:"h-5 w-5 text-amber-500"}),p.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),p.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[p.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),p.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",p.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),p.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[p.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),p.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),p.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-terminal"})]}),p.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",p.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),t&&d&&p.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:p.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[p.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[p.jsx(El,{className:"h-4 w-4"}),p.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),p.jsx("button",{onClick:()=>f(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:p.jsx(Al,{className:"h-4 w-4"})})]}),p.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',p.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",p.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",p.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),p.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:a.map(C=>{const O=["auto","fast","heavy"].includes(C);return p.jsxs("button",{onClick:()=>T(C),className:tt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",t.brain_model===C||!t.brain_model&&C==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[p.jsxs("div",{className:"flex flex-col text-left",children:[p.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:C}),p.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:O?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(t.brain_model===C||!t.brain_model&&C==="auto")&&p.jsx(So,{className:"h-4 w-4 shrink-0 text-primary"})]},C)})})]})}),i]})}function uhe(){const{data:t}=NP(5e3),e=t!=null&&t.terminal_url?Mg(t.terminal_url):void 0,n=t==null?void 0:t.terminal_reachable;return p.jsxs("div",{className:"flex h-full flex-col gap-4",children:[p.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Hermes Terminal"}),p.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Interaktiver Agent (",p.jsx("code",{className:"rounded bg-background/40 px-1 font-mono text-[11px] text-primary",children:"hermes chat"}),') mit Tools & PC-Steuerung — „mehr als Chatten".']})]}),p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[p.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),n?"online":"offline"]}),e&&p.jsxs("a",{href:e,target:"_blank",rel:"noopener",className:"flex h-8 items-center gap-1.5 rounded-lg border border-border/60 bg-background/20 px-3 text-xs font-semibold text-muted-foreground transition-all hover:border-primary/50 hover:text-foreground",children:[p.jsx(bg,{className:"h-3.5 w-3.5"})," In neuem Tab"]})]})]}),e?p.jsxs("div",{className:"relative min-h-[68vh] flex-1 overflow-hidden rounded-2xl border border-border/60 bg-black/50 shadow-lg shadow-black/25",children:[n===!1&&p.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/70 text-center",children:[p.jsx(_g,{className:"h-8 w-8 text-amber-400"}),p.jsx("div",{className:"text-sm font-semibold text-amber-300",children:"Terminal nicht erreichbar"}),p.jsxs("p",{className:"max-w-sm text-[11px] leading-normal text-muted-foreground",children:["Der ",p.jsx("code",{className:"font-mono text-primary",children:"hermes-terminal"}),"-Dienst (ttyd) läuft nicht. Auf der Box: ",p.jsx("code",{className:"font-mono",children:"systemctl --user restart hermes-terminal"}),"."]})]}),p.jsx("iframe",{src:e,title:"Hermes Terminal",className:"h-full w-full border-0",style:{minHeight:"68vh"}})]}):p.jsxs("div",{className:"flex min-h-[68vh] flex-1 items-center justify-center rounded-2xl border border-border/60 bg-background/20 text-xs text-muted-foreground",children:[p.jsx(hF,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}/** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */const Td="169",Xf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},qf={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},hV=0,HC=1,pV=2,Qfe=3,mV=0,HS=1,K0=2,La=3,Ul=0,ls=1,bo=2,$c=0,Mh=1,VC=2,GC=3,WC=4,gV=5,ud=100,vV=101,yV=102,xV=103,bV=104,_V=200,wV=201,SV=202,MV=203,Jw=204,e1=205,EV=206,AV=207,TV=208,CV=209,PV=210,RV=211,NV=212,IV=213,kV=214,t1=0,n1=1,r1=2,Uh=3,i1=4,s1=5,o1=6,a1=7,lx=0,OV=1,LV=2,Pl=0,DV=1,jV=2,UV=3,dR=4,FV=5,zV=6,BV=7,$C="attached",HV="detached",VS=300,Jc=301,Cd=302,Ay=303,Ty=304,nv=306,Pd=1e3,wo=1001,kg=1002,si=1003,GS=1004,Jfe=1004,sh=1005,ehe=1005,Rr=1006,rg=1007,the=1007,Yo=1008,nhe=1008,Va=1009,fR=1010,hR=1011,Og=1012,WS=1013,eu=1014,Js=1015,rv=1016,$S=1017,XS=1018,Fh=1020,pR=35902,mR=1021,gR=1022,as=1023,vR=1024,yR=1025,Eh=1026,zh=1027,qS=1028,cx=1029,xR=1030,KS=1031,rhe=1032,YS=1033,Y0=33776,Z0=33777,Q0=33778,J0=33779,l1=35840,c1=35841,u1=35842,d1=35843,f1=36196,h1=37492,p1=37496,m1=37808,g1=37809,v1=37810,y1=37811,x1=37812,b1=37813,_1=37814,w1=37815,S1=37816,M1=37817,E1=37818,A1=37819,T1=37820,C1=37821,ey=36492,P1=36494,R1=36495,bR=36283,N1=36284,I1=36285,k1=36286,VV=2200,GV=2201,WV=2202,Lg=2300,Dg=2301,$_=2302,oh=2400,ah=2401,Cy=2402,ZS=2500,_R=2501,$V=0,wR=1,O1=2,XV=3200,qV=3201,ihe=3202,she=3203,lu=0,KV=1,jc="",Fi="srgb",_i="srgb-linear",QS="display-p3",ux="display-p3-linear",Py="linear",tr="srgb",Ry="rec709",Ny="p3",ohe=0,Kf=7680,ahe=7681,lhe=7682,che=7683,uhe=34055,dhe=34056,fhe=5386,hhe=512,phe=513,mhe=514,ghe=515,vhe=516,yhe=517,xhe=518,XC=519,YV=512,ZV=513,QV=514,SR=515,JV=516,e6=517,t6=518,n6=519,Iy=35044,r6=35048,bhe=35040,_he=35045,whe=35049,She=35041,Mhe=35046,Ehe=35050,Ahe=35042,The="100",qC="300 es",Ml=2e3,ky=2001;let Vl=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s>8&255]+ts[t>>16&255]+ts[t>>24&255]+"-"+ts[e&255]+ts[e>>8&255]+"-"+ts[e>>16&15|64]+ts[e>>24&255]+"-"+ts[n&63|128]+ts[n>>8&255]+"-"+ts[n>>16&255]+ts[n>>24&255]+ts[r&255]+ts[r>>8&255]+ts[r>>16&255]+ts[r>>24&255]).toLowerCase()}function Cr(t,e,n){return Math.max(e,Math.min(n,t))}function MR(t,e){return(t%e+e)%e}function Che(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function Phe(t,e,n){return t!==e?(n-t)/(e-t):0}function ty(t,e,n){return(1-n)*t+n*e}function Rhe(t,e,n,r){return ty(t,e,1-Math.exp(-n*r))}function Nhe(t,e=1){return e-Math.abs(MR(t,e*2)-e)}function Ihe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function khe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Ohe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Lhe(t,e){return t+Math.random()*(e-t)}function Dhe(t){return t*(.5-Math.random())}function jhe(t){t!==void 0&&(H3=t);let e=H3+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Uhe(t){return t*Ah}function Fhe(t){return t*jg}function zhe(t){return(t&t-1)===0&&t!==0}function Bhe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Hhe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Vhe(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),d=o((e+r)/2),f=s((e-r)/2),m=o((e-r)/2),y=s((r-e)/2),x=o((r-e)/2);switch(i){case"XYX":t.set(a*d,l*f,l*m,a*c);break;case"YZY":t.set(l*m,a*d,l*f,a*c);break;case"ZXZ":t.set(l*f,l*m,a*d,a*c);break;case"XZX":t.set(a*d,l*x,l*y,a*c);break;case"YXY":t.set(l*y,a*d,l*x,a*c);break;case"ZYZ":t.set(l*x,l*y,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Es(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function hn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const vr={DEG2RAD:Ah,RAD2DEG:jg,generateUUID:Mo,clamp:Cr,euclideanModulo:MR,mapLinear:Che,inverseLerp:Phe,lerp:ty,damp:Rhe,pingpong:Nhe,smoothstep:Ihe,smootherstep:khe,randInt:Ohe,randFloat:Lhe,randFloatSpread:Dhe,seededRandom:jhe,degToRad:Uhe,radToDeg:Fhe,isPowerOfTwo:zhe,ceilPowerOfTwo:Bhe,floorPowerOfTwo:Hhe,setQuaternionFromProperEuler:Vhe,normalize:hn,denormalize:Es};class Ve{constructor(e=0,n=0){Ve.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Cr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Zt{constructor(e,n,r,i,s,o,a,l,c){Zt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c)}set(e,n,r,i,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],d=r[4],f=r[7],m=r[2],y=r[5],x=r[8],S=i[0],_=i[3],w=i[6],E=i[1],T=i[4],C=i[7],O=i[2],N=i[5],L=i[8];return s[0]=o*S+a*E+l*O,s[3]=o*_+a*T+l*N,s[6]=o*w+a*C+l*L,s[1]=c*S+d*E+f*O,s[4]=c*_+d*T+f*N,s[7]=c*w+d*C+f*L,s[2]=m*S+y*E+x*O,s[5]=m*_+y*T+x*N,s[8]=m*w+y*C+x*L,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return n*o*d-n*a*c-r*s*d+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=d*o-a*c,m=a*l-d*s,y=c*s-o*l,x=n*f+r*m+i*y;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=f*S,e[1]=(i*c-d*r)*S,e[2]=(a*r-i*o)*S,e[3]=m*S,e[4]=(d*n-i*l)*S,e[5]=(i*s-a*n)*S,e[6]=y*S,e[7]=(r*l-c*n)*S,e[8]=(o*n-r*s)*S,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(KE.makeScale(e,n)),this}rotate(e){return this.premultiply(KE.makeRotation(-e)),this}translate(e,n){return this.premultiply(KE.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const KE=new Zt;function i6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Ghe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Xm(t,e){return new Ghe[t](e)}function Oy(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function s6(){const t=Oy("canvas");return t.style.display="block",t}const V3={};function X_(t){t in V3||(V3[t]=!0,console.warn(t))}function Whe(t,e,n){return new Promise(function(r,i){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}}setTimeout(s,n)})}function $he(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Xhe(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const G3=new Zt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),W3=new Zt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),v0={[_i]:{transfer:Py,primaries:Ry,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Fi]:{transfer:tr,primaries:Ry,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[ux]:{transfer:Py,primaries:Ny,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(W3),fromReference:t=>t.applyMatrix3(G3)},[QS]:{transfer:tr,primaries:Ny,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(W3),fromReference:t=>t.applyMatrix3(G3).convertLinearToSRGB()}},qhe=new Set([_i,ux]),On={enabled:!0,_workingColorSpace:_i,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!qhe.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const r=v0[e].toReference,i=v0[n].fromReference;return i(r(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return v0[t].primaries},getTransfer:function(t){return t===jc?Py:v0[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(v0[e].luminanceCoefficients)}};function ig(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function YE(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let pm;class o6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{pm===void 0&&(pm=Oy("canvas")),pm.width=e.width,pm.height=e.height;const r=pm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=pm}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Oy("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==VS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Pd:e.x=e.x-Math.floor(e.x);break;case wo:e.x=e.x<0?0:1;break;case kg:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Pd:e.y=e.y-Math.floor(e.y);break;case wo:e.y=e.y<0?0:1;break;case kg:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}hr.DEFAULT_IMAGE=null;hr.DEFAULT_MAPPING=VS;hr.DEFAULT_ANISOTROPY=1;class jn{constructor(e=0,n=0,r=0,i=1){jn.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],d=l[4],f=l[8],m=l[1],y=l[5],x=l[9],S=l[2],_=l[6],w=l[10];if(Math.abs(d-m)<.01&&Math.abs(f-S)<.01&&Math.abs(x-_)<.01){if(Math.abs(d+m)<.1&&Math.abs(f+S)<.1&&Math.abs(x+_)<.1&&Math.abs(c+y+w-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const T=(c+1)/2,C=(y+1)/2,O=(w+1)/2,N=(d+m)/4,L=(f+S)/4,F=(x+_)/4;return T>C&&T>O?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=N/r,s=L/r):C>O?C<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(C),r=N/i,s=F/i):O<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(O),r=L/s,i=F/s),this.set(r,i,s,n),this}let E=Math.sqrt((_-x)*(_-x)+(f-S)*(f-S)+(m-d)*(m-d));return Math.abs(E)<.001&&(E=1),this.x=(_-x)/E,this.y=(f-S)/E,this.z=(m-d)/E,this.w=Math.acos((c+y+w-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class a6 extends Vl{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new jn(0,0,e,n),this.scissorTest=!1,this.viewport=new jn(0,0,e,n);const i={width:e,height:n,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Rr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new hr(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a=0?1:-1,T=1-w*w;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,w*E);_=Math.sin(_*N)/O,a=Math.sin(a*N)/O}const C=a*E;if(l=l*_+m*C,c=c*_+y*C,d=d*_+x*C,f=f*_+S*C,_===1-a){const O=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=O,c*=O,d*=O,f*=O}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],d=r[i+3],f=s[o],m=s[o+1],y=s[o+2],x=s[o+3];return e[n]=a*x+d*f+l*y-c*m,e[n+1]=l*x+d*m+c*f-a*y,e[n+2]=c*x+d*y+a*m-l*f,e[n+3]=d*x-a*f-l*m-c*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),d=a(i/2),f=a(s/2),m=l(r/2),y=l(i/2),x=l(s/2);switch(o){case"XYZ":this._x=m*d*f+c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f-m*y*x;break;case"YXZ":this._x=m*d*f+c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f+m*y*x;break;case"ZXY":this._x=m*d*f-c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f-m*y*x;break;case"ZYX":this._x=m*d*f-c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f+m*y*x;break;case"YZX":this._x=m*d*f+c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f-m*y*x;break;case"XZY":this._x=m*d*f-c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f+m*y*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],o=n[1],a=n[5],l=n[9],c=n[2],d=n[6],f=n[10],m=r+a+f;if(m>0){const y=.5/Math.sqrt(m+1);this._w=.25/y,this._x=(d-l)*y,this._y=(s-c)*y,this._z=(o-i)*y}else if(r>a&&r>f){const y=2*Math.sqrt(1+r-a-f);this._w=(d-l)/y,this._x=.25*y,this._y=(i+o)/y,this._z=(s+c)/y}else if(a>f){const y=2*Math.sqrt(1+a-r-f);this._w=(s-c)/y,this._x=(i+o)/y,this._y=.25*y,this._z=(l+d)/y}else{const y=2*Math.sqrt(1+f-r-a);this._w=(o-i)/y,this._x=(s+c)/y,this._y=(l+d)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Cr(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,s=e._z,o=e._w,a=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+o*a+i*c-s*l,this._y=i*d+o*l+s*a-r*c,this._z=s*d+o*c+r*l-i*a,this._w=o*d-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const y=1-n;return this._w=y*o+n*this._w,this._x=y*r+n*this._x,this._y=y*i+n*this._y,this._z=y*s+n*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),f=Math.sin((1-n)*d)/c,m=Math.sin(n*d)/c;return this._w=o*f+this._w*m,this._x=r*f+this._x*m,this._y=i*f+this._y*m,this._z=s*f+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class X{constructor(e=0,n=0,r=0){X.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion($3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion($3.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),d=2*(a*n-s*i),f=2*(s*r-o*n);return this.x=n+l*c+o*f-a*d,this.y=r+l*d+a*c-s*f,this.z=i+l*f+s*d-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,o=n.x,a=n.y,l=n.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return QE.copy(this).projectOnVector(e),this.sub(QE)}reflect(e){return this.sub(QE.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Cr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const QE=new X,$3=new Jt;class cs{constructor(e=new X(1/0,1/0,1/0),n=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Ra),Ra.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(y0),zb.subVectors(this.max,y0),mm.subVectors(e.a,y0),gm.subVectors(e.b,y0),vm.subVectors(e.c,y0),Xu.subVectors(gm,mm),qu.subVectors(vm,gm),Tf.subVectors(mm,vm);let n=[0,-Xu.z,Xu.y,0,-qu.z,qu.y,0,-Tf.z,Tf.y,Xu.z,0,-Xu.x,qu.z,0,-qu.x,Tf.z,0,-Tf.x,-Xu.y,Xu.x,0,-qu.y,qu.x,0,-Tf.y,Tf.x,0];return!JE(n,mm,gm,vm,zb)||(n=[1,0,0,0,1,0,0,0,1],!JE(n,mm,gm,vm,zb))?!1:(Bb.crossVectors(Xu,qu),n=[Bb.x,Bb.y,Bb.z],JE(n,mm,gm,vm,zb))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ra).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ra).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Mc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Mc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Mc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Mc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Mc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Mc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Mc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Mc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Mc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Mc=[new X,new X,new X,new X,new X,new X,new X,new X],Ra=new X,Fb=new cs,mm=new X,gm=new X,vm=new X,Xu=new X,qu=new X,Tf=new X,y0=new X,zb=new X,Bb=new X,Cf=new X;function JE(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){Cf.fromArray(t,s);const a=i.x*Math.abs(Cf.x)+i.y*Math.abs(Cf.y)+i.z*Math.abs(Cf.z),l=e.dot(Cf),c=n.dot(Cf),d=r.dot(Cf);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const Jhe=new cs,x0=new X,eA=new X;class Hi{constructor(e=new X,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):Jhe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;x0.subVectors(e,this.center);const n=x0.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(x0,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(eA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(x0.copy(e.center).add(eA)),this.expandByPoint(x0.copy(e.center).sub(eA))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ec=new X,tA=new X,Hb=new X,Ku=new X,nA=new X,Vb=new X,rA=new X;class ep{constructor(e=new X,n=new X(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ec)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Ec.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Ec.copy(this.origin).addScaledVector(this.direction,n),Ec.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){tA.copy(e).add(n).multiplyScalar(.5),Hb.copy(n).sub(e).normalize(),Ku.copy(this.origin).sub(tA);const s=e.distanceTo(n)*.5,o=-this.direction.dot(Hb),a=Ku.dot(this.direction),l=-Ku.dot(Hb),c=Ku.lengthSq(),d=Math.abs(1-o*o);let f,m,y,x;if(d>0)if(f=o*l-a,m=o*a-l,x=s*d,f>=0)if(m>=-x)if(m<=x){const S=1/d;f*=S,m*=S,y=f*(f+o*m+2*a)+m*(o*f+m+2*l)+c}else m=s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;else m=-s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;else m<=-x?(f=Math.max(0,-(-o*s+a)),m=f>0?-s:Math.min(Math.max(-s,-l),s),y=-f*f+m*(m+2*l)+c):m<=x?(f=0,m=Math.min(Math.max(-s,-l),s),y=m*(m+2*l)+c):(f=Math.max(0,-(o*s+a)),m=f>0?s:Math.min(Math.max(-s,-l),s),y=-f*f+m*(m+2*l)+c);else m=o>0?-s:s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(tA).addScaledVector(Hb,m),y}intersectSphere(e,n){Ec.subVectors(e.center,this.origin);const r=Ec.dot(this.direction),i=Ec.dot(Ec)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,m=this.origin;return c>=0?(r=(e.min.x-m.x)*c,i=(e.max.x-m.x)*c):(r=(e.max.x-m.x)*c,i=(e.min.x-m.x)*c),d>=0?(s=(e.min.y-m.y)*d,o=(e.max.y-m.y)*d):(s=(e.max.y-m.y)*d,o=(e.min.y-m.y)*d),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-m.z)*f,l=(e.max.z-m.z)*f):(a=(e.max.z-m.z)*f,l=(e.min.z-m.z)*f),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Ec)!==null}intersectTriangle(e,n,r,i,s){nA.subVectors(n,e),Vb.subVectors(r,e),rA.crossVectors(nA,Vb);let o=this.direction.dot(rA),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ku.subVectors(this.origin,e);const l=a*this.direction.dot(Vb.crossVectors(Ku,Vb));if(l<0)return null;const c=a*this.direction.dot(nA.cross(Ku));if(c<0||l+c>o)return null;const d=-a*Ku.dot(rA);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class kt{constructor(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,_){kt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,_)}set(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,_){const w=this.elements;return w[0]=e,w[4]=n,w[8]=r,w[12]=i,w[1]=s,w[5]=o,w[9]=a,w[13]=l,w[2]=c,w[6]=d,w[10]=f,w[14]=m,w[3]=y,w[7]=x,w[11]=S,w[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new kt().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,i=1/ym.setFromMatrixColumn(e,0).length(),s=1/ym.setFromMatrixColumn(e,1).length(),o=1/ym.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const m=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=y+x*c,n[5]=m-S*c,n[9]=-a*l,n[2]=S-m*c,n[6]=x+y*c,n[10]=o*l}else if(e.order==="YXZ"){const m=l*d,y=l*f,x=c*d,S=c*f;n[0]=m+S*a,n[4]=x*a-y,n[8]=o*c,n[1]=o*f,n[5]=o*d,n[9]=-a,n[2]=y*a-x,n[6]=S+m*a,n[10]=o*l}else if(e.order==="ZXY"){const m=l*d,y=l*f,x=c*d,S=c*f;n[0]=m-S*a,n[4]=-o*f,n[8]=x+y*a,n[1]=y+x*a,n[5]=o*d,n[9]=S-m*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const m=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=x*c-y,n[8]=m*c+S,n[1]=l*f,n[5]=S*c+m,n[9]=y*c-x,n[2]=-c,n[6]=a*l,n[10]=o*l}else if(e.order==="YZX"){const m=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=S-m*f,n[8]=x*f+y,n[1]=f,n[5]=o*d,n[9]=-a*d,n[2]=-c*d,n[6]=y*f+x,n[10]=m-S*f}else if(e.order==="XZY"){const m=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=m*f+S,n[5]=o*d,n[9]=y*f-x,n[2]=x*f-y,n[6]=a*d,n[10]=S*f+m}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(epe,e,tpe)}lookAt(e,n,r){const i=this.elements;return po.subVectors(e,n),po.lengthSq()===0&&(po.z=1),po.normalize(),Yu.crossVectors(r,po),Yu.lengthSq()===0&&(Math.abs(r.z)===1?po.x+=1e-4:po.z+=1e-4,po.normalize(),Yu.crossVectors(r,po)),Yu.normalize(),Gb.crossVectors(po,Yu),i[0]=Yu.x,i[4]=Gb.x,i[8]=po.x,i[1]=Yu.y,i[5]=Gb.y,i[9]=po.y,i[2]=Yu.z,i[6]=Gb.z,i[10]=po.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],d=r[1],f=r[5],m=r[9],y=r[13],x=r[2],S=r[6],_=r[10],w=r[14],E=r[3],T=r[7],C=r[11],O=r[15],N=i[0],L=i[4],F=i[8],G=i[12],k=i[1],U=i[5],H=i[9],ne=i[13],ee=i[2],pe=i[6],se=i[10],fe=i[14],B=i[3],Q=i[7],K=i[11],V=i[15];return s[0]=o*N+a*k+l*ee+c*B,s[4]=o*L+a*U+l*pe+c*Q,s[8]=o*F+a*H+l*se+c*K,s[12]=o*G+a*ne+l*fe+c*V,s[1]=d*N+f*k+m*ee+y*B,s[5]=d*L+f*U+m*pe+y*Q,s[9]=d*F+f*H+m*se+y*K,s[13]=d*G+f*ne+m*fe+y*V,s[2]=x*N+S*k+_*ee+w*B,s[6]=x*L+S*U+_*pe+w*Q,s[10]=x*F+S*H+_*se+w*K,s[14]=x*G+S*ne+_*fe+w*V,s[3]=E*N+T*k+C*ee+O*B,s[7]=E*L+T*U+C*pe+O*Q,s[11]=E*F+T*H+C*se+O*K,s[15]=E*G+T*ne+C*fe+O*V,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],f=e[6],m=e[10],y=e[14],x=e[3],S=e[7],_=e[11],w=e[15];return x*(+s*l*f-i*c*f-s*a*m+r*c*m+i*a*y-r*l*y)+S*(+n*l*y-n*c*m+s*o*m-i*o*y+i*c*d-s*l*d)+_*(+n*c*f-n*a*y-s*o*f+r*o*y+s*a*d-r*c*d)+w*(-i*a*d-n*l*f+n*a*m+i*o*f-r*o*m+r*l*d)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=e[9],m=e[10],y=e[11],x=e[12],S=e[13],_=e[14],w=e[15],E=f*_*c-S*m*c+S*l*y-a*_*y-f*l*w+a*m*w,T=x*m*c-d*_*c-x*l*y+o*_*y+d*l*w-o*m*w,C=d*S*c-x*f*c+x*a*y-o*S*y-d*a*w+o*f*w,O=x*f*l-d*S*l-x*a*m+o*S*m+d*a*_-o*f*_,N=n*E+r*T+i*C+s*O;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/N;return e[0]=E*L,e[1]=(S*m*s-f*_*s-S*i*y+r*_*y+f*i*w-r*m*w)*L,e[2]=(a*_*s-S*l*s+S*i*c-r*_*c-a*i*w+r*l*w)*L,e[3]=(f*l*s-a*m*s-f*i*c+r*m*c+a*i*y-r*l*y)*L,e[4]=T*L,e[5]=(d*_*s-x*m*s+x*i*y-n*_*y-d*i*w+n*m*w)*L,e[6]=(x*l*s-o*_*s-x*i*c+n*_*c+o*i*w-n*l*w)*L,e[7]=(o*m*s-d*l*s+d*i*c-n*m*c-o*i*y+n*l*y)*L,e[8]=C*L,e[9]=(x*f*s-d*S*s-x*r*y+n*S*y+d*r*w-n*f*w)*L,e[10]=(o*S*s-x*a*s+x*r*c-n*S*c-o*r*w+n*a*w)*L,e[11]=(d*a*s-o*f*s-d*r*c+n*f*c+o*r*y-n*a*y)*L,e[12]=O*L,e[13]=(d*S*i-x*f*i+x*r*m-n*S*m-d*r*_+n*f*_)*L,e[14]=(x*a*i-o*S*i-x*r*l+n*S*l+o*r*_-n*a*_)*L,e[15]=(o*f*i-d*a*i+d*r*l-n*f*l-o*r*m+n*a*m)*L,this}scale(e){const n=this.elements,r=e.x,i=e.y,s=e.z;return n[0]*=r,n[4]*=i,n[8]*=s,n[1]*=r,n[5]*=i,n[9]*=s,n[2]*=r,n[6]*=i,n[10]*=s,n[3]*=r,n[7]*=i,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,d*a+r,d*l-i*o,0,c*l-i*a,d*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,d=o+o,f=a+a,m=s*c,y=s*d,x=s*f,S=o*d,_=o*f,w=a*f,E=l*c,T=l*d,C=l*f,O=r.x,N=r.y,L=r.z;return i[0]=(1-(S+w))*O,i[1]=(y+C)*O,i[2]=(x-T)*O,i[3]=0,i[4]=(y-C)*N,i[5]=(1-(m+w))*N,i[6]=(_+E)*N,i[7]=0,i[8]=(x+T)*L,i[9]=(_-E)*L,i[10]=(1-(m+S))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;let s=ym.set(i[0],i[1],i[2]).length();const o=ym.set(i[4],i[5],i[6]).length(),a=ym.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Na.copy(this);const c=1/s,d=1/o,f=1/a;return Na.elements[0]*=c,Na.elements[1]*=c,Na.elements[2]*=c,Na.elements[4]*=d,Na.elements[5]*=d,Na.elements[6]*=d,Na.elements[8]*=f,Na.elements[9]*=f,Na.elements[10]*=f,n.setFromRotationMatrix(Na),r.x=s,r.y=o,r.z=a,this}makePerspective(e,n,r,i,s,o,a=Ml){const l=this.elements,c=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),m=(r+i)/(r-i);let y,x;if(a===Ml)y=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===ky)y=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=m,l[13]=0,l[2]=0,l[6]=0,l[10]=y,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,s,o,a=Ml){const l=this.elements,c=1/(n-e),d=1/(r-i),f=1/(o-s),m=(n+e)*c,y=(r+i)*d;let x,S;if(a===Ml)x=(o+s)*f,S=-2*f;else if(a===ky)x=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-m,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-y,l[2]=0,l[6]=0,l[10]=S,l[14]=-x,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const ym=new X,Na=new kt,epe=new X(0,0,0),tpe=new X(1,1,1),Yu=new X,Gb=new X,po=new X,X3=new kt,q3=new Jt;class us{constructor(e=0,n=0,r=0,i=us.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],d=i[9],f=i[2],m=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Cr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Cr(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,y),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Cr(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-f,y),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Cr(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(m,y),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Cr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,y));break;case"XZY":this._z=Math.asin(-Cr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,y),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return X3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(X3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return q3.setFromEuler(this),this.setFromQuaternion(q3,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}us.DEFAULT_ORDER="XYZ";class Th{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let r=0;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),m.length>0&&(r.skeletons=m),y.length>0&&(r.animations=y),x.length>0&&(r.nodes=x)}return r.object=i,r;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){Ia.subVectors(i,n),Tc.subVectors(r,n),sA.subVectors(e,n);const o=Ia.dot(Ia),a=Ia.dot(Tc),l=Ia.dot(sA),c=Tc.dot(Tc),d=Tc.dot(sA),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const m=1/f,y=(c*l-a*d)*m,x=(o*d-a*l)*m;return s.set(1-y-x,x,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Cc)===null?!1:Cc.x>=0&&Cc.y>=0&&Cc.x+Cc.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,Cc)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Cc.x),l.addScaledVector(o,Cc.y),l.addScaledVector(a,Cc.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return cA.setScalar(0),uA.setScalar(0),dA.setScalar(0),cA.fromBufferAttribute(e,n),uA.fromBufferAttribute(e,r),dA.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(cA,s.x),o.addScaledVector(uA,s.y),o.addScaledVector(dA,s.z),o}static isFrontFacing(e,n,r,i){return Ia.subVectors(r,n),Tc.subVectors(e,n),Ia.cross(Tc).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ia.subVectors(this.c,this.b),Tc.subVectors(this.a,this.b),Ia.cross(Tc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ys.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Ys.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Ys.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Ys.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ys.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let o,a;_m.subVectors(i,r),wm.subVectors(s,r),oA.subVectors(e,r);const l=_m.dot(oA),c=wm.dot(oA);if(l<=0&&c<=0)return n.copy(r);aA.subVectors(e,i);const d=_m.dot(aA),f=wm.dot(aA);if(d>=0&&f<=d)return n.copy(i);const m=l*f-d*c;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),n.copy(r).addScaledVector(_m,o);lA.subVectors(e,s);const y=_m.dot(lA),x=wm.dot(lA);if(x>=0&&y<=x)return n.copy(s);const S=y*c-l*x;if(S<=0&&c>=0&&x<=0)return a=c/(c-x),n.copy(r).addScaledVector(wm,a);const _=d*x-y*f;if(_<=0&&f-d>=0&&y-x>=0)return eD.subVectors(s,i),a=(f-d)/(f-d+(y-x)),n.copy(i).addScaledVector(eD,a);const w=1/(_+S+m);return o=S*w,a=m*w,n.copy(r).addScaledVector(_m,o).addScaledVector(wm,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const l6={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Zu={h:0,s:0,l:0},$b={h:0,s:0,l:0};function fA(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class ut{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Fi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,On.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=On.workingColorSpace){return this.r=e,this.g=n,this.b=r,On.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=On.workingColorSpace){if(e=MR(e,1),n=Cr(n,0,1),r=Cr(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=fA(o,s,e+1/3),this.g=fA(o,s,e),this.b=fA(o,s,e-1/3)}return On.toWorkingColorSpace(this,i),this}setStyle(e,n=Fi){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Fi){const r=l6[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ig(e.r),this.g=ig(e.g),this.b=ig(e.b),this}copyLinearToSRGB(e){return this.r=YE(e.r),this.g=YE(e.g),this.b=YE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Fi){return On.fromWorkingColorSpace(ns.copy(this),e),Math.round(Cr(ns.r*255,0,255))*65536+Math.round(Cr(ns.g*255,0,255))*256+Math.round(Cr(ns.b*255,0,255))}getHexString(e=Fi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=On.workingColorSpace){On.fromWorkingColorSpace(ns.copy(this),n);const r=ns.r,i=ns.g,s=ns.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=d<=.5?f/(o+a):f/(2-o-a),o){case r:l=(i-s)/f+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Mh&&(r.blending=this.blending),this.side!==Ul&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==Jw&&(r.blendSrc=this.blendSrc),this.blendDst!==e1&&(r.blendDst=this.blendDst),this.blendEquation!==ud&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Uh&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==XC&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Kf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Kf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Kf&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(n){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Cs extends $r{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new us,this.combine=lx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Uc=ape();function ape(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function Xs(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Cr(t,-65504,65504),Uc.floatView[0]=t;const e=Uc.uint32View[0],n=e>>23&511;return Uc.baseTable[n]+((e&8388607)>>Uc.shiftTable[n])}function V0(t){const e=t>>10;return Uc.uint32View[0]=Uc.mantissaTable[Uc.offsetTable[e]+(t&1023)]+Uc.exponentTable[e],Uc.floatView[0]}const lpe={toHalfFloat:Xs,fromHalfFloat:V0},Gr=new X,Xb=new Ve;class nn{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=Iy,this.updateRanges=[],this.gpuType=Js,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,m=c.length;f0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let m=0,y=f.length;m0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(tD.copy(s).invert(),Pf.copy(e.ray).applyMatrix4(tD),!(r.boundingBox!==null&&Pf.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Pf)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,m=s.groups,y=s.drawRange;if(a!==null)if(Array.isArray(o))for(let x=0,S=m.length;xn.far?null:{distance:c,point:Jb.clone(),object:t}}function e_(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,Kb),t.getVertexPosition(l,Yb),t.getVertexPosition(c,Zb);const d=gpe(t,e,n,r,Kb,Yb,Zb,rD);if(d){const f=new X;Ys.getBarycoord(rD,Kb,Yb,Zb,f),i&&(d.uv=Ys.getInterpolatedAttribute(i,a,l,c,f,new Ve)),s&&(d.uv1=Ys.getInterpolatedAttribute(s,a,l,c,f,new Ve)),o&&(d.normal=Ys.getInterpolatedAttribute(o,a,l,c,f,new X),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const m={a,b:l,c,normal:new X,materialIndex:0};Ys.getNormal(Kb,Yb,Zb,m.normal),d.face=m,d.barycoord=f}return d}class tp extends tn{constructor(e=1,n=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],f=[];let m=0,y=0;x("z","y","x",-1,-1,r,n,e,o,s,0),x("z","y","x",1,-1,r,n,-e,o,s,1),x("x","z","y",1,1,e,r,n,i,o,2),x("x","z","y",1,-1,e,r,-n,i,o,3),x("x","y","z",1,-1,e,n,r,i,s,4),x("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new Ut(c,3)),this.setAttribute("normal",new Ut(d,3)),this.setAttribute("uv",new Ut(f,2));function x(S,_,w,E,T,C,O,N,L,F,G){const k=C/L,U=O/F,H=C/2,ne=O/2,ee=N/2,pe=L+1,se=F+1;let fe=0,B=0;const Q=new X;for(let K=0;K0?1:-1,d.push(Q.x,Q.y,Q.z),f.push(q/L),f.push(1-K/F),fe+=1}}for(let K=0;K>8&255]+ts[t>>16&255]+ts[t>>24&255]+"-"+ts[e&255]+ts[e>>8&255]+"-"+ts[e>>16&15|64]+ts[e>>24&255]+"-"+ts[n&63|128]+ts[n>>8&255]+"-"+ts[n>>16&255]+ts[n>>24&255]+ts[r&255]+ts[r>>8&255]+ts[r>>16&255]+ts[r>>24&255]).toLowerCase()}function Rr(t,e,n){return Math.max(e,Math.min(n,t))}function TR(t,e){return(t%e+e)%e}function Bhe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function Hhe(t,e,n){return t!==e?(n-t)/(e-t):0}function ty(t,e,n){return(1-n)*t+n*e}function Vhe(t,e,n,r){return ty(t,e,1-Math.exp(-n*r))}function Ghe(t,e=1){return e-Math.abs(TR(t,e*2)-e)}function Whe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function $he(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Xhe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function qhe(t,e){return t+Math.random()*(e-t)}function Khe(t){return t*(.5-Math.random())}function Yhe(t){t!==void 0&&(G3=t);let e=G3+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Zhe(t){return t*Th}function Qhe(t){return t*jg}function Jhe(t){return(t&t-1)===0&&t!==0}function epe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function tpe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function npe(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),d=o((e+r)/2),f=s((e-r)/2),g=o((e-r)/2),y=s((r-e)/2),x=o((r-e)/2);switch(i){case"XYX":t.set(a*d,l*f,l*g,a*c);break;case"YZY":t.set(l*g,a*d,l*f,a*c);break;case"ZXZ":t.set(l*f,l*g,a*d,a*c);break;case"XZX":t.set(a*d,l*x,l*y,a*c);break;case"YXY":t.set(l*y,a*d,l*x,a*c);break;case"ZYZ":t.set(l*x,l*y,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Es(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function fn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const xr={DEG2RAD:Th,RAD2DEG:jg,generateUUID:To,clamp:Rr,euclideanModulo:TR,mapLinear:Bhe,inverseLerp:Hhe,lerp:ty,damp:Vhe,pingpong:Ghe,smoothstep:Whe,smootherstep:$he,randInt:Xhe,randFloat:qhe,randFloatSpread:Khe,seededRandom:Yhe,degToRad:Zhe,radToDeg:Qhe,isPowerOfTwo:Jhe,ceilPowerOfTwo:epe,floorPowerOfTwo:tpe,setQuaternionFromProperEuler:npe,normalize:fn,denormalize:Es};class He{constructor(e=0,n=0){He.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Rr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Qt{constructor(e,n,r,i,s,o,a,l,c){Qt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c)}set(e,n,r,i,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],d=r[4],f=r[7],g=r[2],y=r[5],x=r[8],S=i[0],w=i[3],b=i[6],M=i[1],T=i[4],C=i[7],O=i[2],N=i[5],L=i[8];return s[0]=o*S+a*M+l*O,s[3]=o*w+a*T+l*N,s[6]=o*b+a*C+l*L,s[1]=c*S+d*M+f*O,s[4]=c*w+d*T+f*N,s[7]=c*b+d*C+f*L,s[2]=g*S+y*M+x*O,s[5]=g*w+y*T+x*N,s[8]=g*b+y*C+x*L,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return n*o*d-n*a*c-r*s*d+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=d*o-a*c,g=a*l-d*s,y=c*s-o*l,x=n*f+r*g+i*y;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=f*S,e[1]=(i*c-d*r)*S,e[2]=(a*r-i*o)*S,e[3]=g*S,e[4]=(d*n-i*l)*S,e[5]=(i*s-a*n)*S,e[6]=y*S,e[7]=(r*l-c*n)*S,e[8]=(o*n-r*s)*S,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(JE.makeScale(e,n)),this}rotate(e){return this.premultiply(JE.makeRotation(-e)),this}translate(e,n){return this.premultiply(JE.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const JE=new Qt;function l6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const rpe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Xm(t,e){return new rpe[t](e)}function Oy(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function c6(){const t=Oy("canvas");return t.style.display="block",t}const W3={};function q_(t){t in W3||(W3[t]=!0,console.warn(t))}function ipe(t,e,n){return new Promise(function(r,i){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}}setTimeout(s,n)})}function spe(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function ope(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const $3=new Qt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),X3=new Qt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),v0={[Si]:{transfer:Py,primaries:Ry,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[zi]:{transfer:rr,primaries:Ry,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[ux]:{transfer:Py,primaries:Ny,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(X3),fromReference:t=>t.applyMatrix3($3)},[eM]:{transfer:rr,primaries:Ny,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(X3),fromReference:t=>t.applyMatrix3($3).convertLinearToSRGB()}},ape=new Set([Si,ux]),Ln={enabled:!0,_workingColorSpace:Si,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!ape.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const r=v0[e].toReference,i=v0[n].fromReference;return i(r(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return v0[t].primaries},getTransfer:function(t){return t===jc?Py:v0[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(v0[e].luminanceCoefficients)}};function ig(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function eA(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let pm;class u6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{pm===void 0&&(pm=Oy("canvas")),pm.width=e.width,pm.height=e.height;const r=pm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=pm}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Oy("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==WS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Pd:e.x=e.x-Math.floor(e.x);break;case Eo:e.x=e.x<0?0:1;break;case kg:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Pd:e.y=e.y-Math.floor(e.y);break;case Eo:e.y=e.y<0?0:1;break;case kg:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}mr.DEFAULT_IMAGE=null;mr.DEFAULT_MAPPING=WS;mr.DEFAULT_ANISOTROPY=1;class Un{constructor(e=0,n=0,r=0,i=1){Un.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],d=l[4],f=l[8],g=l[1],y=l[5],x=l[9],S=l[2],w=l[6],b=l[10];if(Math.abs(d-g)<.01&&Math.abs(f-S)<.01&&Math.abs(x-w)<.01){if(Math.abs(d+g)<.1&&Math.abs(f+S)<.1&&Math.abs(x+w)<.1&&Math.abs(c+y+b-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const T=(c+1)/2,C=(y+1)/2,O=(b+1)/2,N=(d+g)/4,L=(f+S)/4,F=(x+w)/4;return T>C&&T>O?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=N/r,s=L/r):C>O?C<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(C),r=N/i,s=F/i):O<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(O),r=L/s,i=F/s),this.set(r,i,s,n),this}let M=Math.sqrt((w-x)*(w-x)+(f-S)*(f-S)+(g-d)*(g-d));return Math.abs(M)<.001&&(M=1),this.x=(w-x)/M,this.y=(f-S)/M,this.z=(g-d)/M,this.w=Math.acos((c+y+b-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class d6 extends Vl{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new Un(0,0,e,n),this.scissorTest=!1,this.viewport=new Un(0,0,e,n);const i={width:e,height:n,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ir,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new mr(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a=0?1:-1,T=1-b*b;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,b*M);w=Math.sin(w*N)/O,a=Math.sin(a*N)/O}const C=a*M;if(l=l*w+g*C,c=c*w+y*C,d=d*w+x*C,f=f*w+S*C,w===1-a){const O=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=O,c*=O,d*=O,f*=O}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],d=r[i+3],f=s[o],g=s[o+1],y=s[o+2],x=s[o+3];return e[n]=a*x+d*f+l*y-c*g,e[n+1]=l*x+d*g+c*f-a*y,e[n+2]=c*x+d*y+a*g-l*f,e[n+3]=d*x-a*f-l*g-c*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),d=a(i/2),f=a(s/2),g=l(r/2),y=l(i/2),x=l(s/2);switch(o){case"XYZ":this._x=g*d*f+c*y*x,this._y=c*y*f-g*d*x,this._z=c*d*x+g*y*f,this._w=c*d*f-g*y*x;break;case"YXZ":this._x=g*d*f+c*y*x,this._y=c*y*f-g*d*x,this._z=c*d*x-g*y*f,this._w=c*d*f+g*y*x;break;case"ZXY":this._x=g*d*f-c*y*x,this._y=c*y*f+g*d*x,this._z=c*d*x+g*y*f,this._w=c*d*f-g*y*x;break;case"ZYX":this._x=g*d*f-c*y*x,this._y=c*y*f+g*d*x,this._z=c*d*x-g*y*f,this._w=c*d*f+g*y*x;break;case"YZX":this._x=g*d*f+c*y*x,this._y=c*y*f+g*d*x,this._z=c*d*x-g*y*f,this._w=c*d*f-g*y*x;break;case"XZY":this._x=g*d*f-c*y*x,this._y=c*y*f-g*d*x,this._z=c*d*x+g*y*f,this._w=c*d*f+g*y*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],o=n[1],a=n[5],l=n[9],c=n[2],d=n[6],f=n[10],g=r+a+f;if(g>0){const y=.5/Math.sqrt(g+1);this._w=.25/y,this._x=(d-l)*y,this._y=(s-c)*y,this._z=(o-i)*y}else if(r>a&&r>f){const y=2*Math.sqrt(1+r-a-f);this._w=(d-l)/y,this._x=.25*y,this._y=(i+o)/y,this._z=(s+c)/y}else if(a>f){const y=2*Math.sqrt(1+a-r-f);this._w=(s-c)/y,this._x=(i+o)/y,this._y=.25*y,this._z=(l+d)/y}else{const y=2*Math.sqrt(1+f-r-a);this._w=(o-i)/y,this._x=(s+c)/y,this._y=(l+d)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Rr(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,s=e._z,o=e._w,a=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+o*a+i*c-s*l,this._y=i*d+o*l+s*a-r*c,this._z=s*d+o*c+r*l-i*a,this._w=o*d-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const y=1-n;return this._w=y*o+n*this._w,this._x=y*r+n*this._x,this._y=y*i+n*this._y,this._z=y*s+n*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),f=Math.sin((1-n)*d)/c,g=Math.sin(n*d)/c;return this._w=o*f+this._w*g,this._x=r*f+this._x*g,this._y=i*f+this._y*g,this._z=s*f+this._z*g,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class X{constructor(e=0,n=0,r=0){X.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(q3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(q3.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),d=2*(a*n-s*i),f=2*(s*r-o*n);return this.x=n+l*c+o*f-a*d,this.y=r+l*d+a*c-s*f,this.z=i+l*f+s*d-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,o=n.x,a=n.y,l=n.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return nA.copy(this).projectOnVector(e),this.sub(nA)}reflect(e){return this.sub(nA.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Rr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const nA=new X,q3=new en;class cs{constructor(e=new X(1/0,1/0,1/0),n=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Ra),Ra.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(y0),Bb.subVectors(this.max,y0),mm.subVectors(e.a,y0),gm.subVectors(e.b,y0),vm.subVectors(e.c,y0),Xu.subVectors(gm,mm),qu.subVectors(vm,gm),Cf.subVectors(mm,vm);let n=[0,-Xu.z,Xu.y,0,-qu.z,qu.y,0,-Cf.z,Cf.y,Xu.z,0,-Xu.x,qu.z,0,-qu.x,Cf.z,0,-Cf.x,-Xu.y,Xu.x,0,-qu.y,qu.x,0,-Cf.y,Cf.x,0];return!rA(n,mm,gm,vm,Bb)||(n=[1,0,0,0,1,0,0,0,1],!rA(n,mm,gm,vm,Bb))?!1:(Hb.crossVectors(Xu,qu),n=[Hb.x,Hb.y,Hb.z],rA(n,mm,gm,vm,Bb))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ra).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ra).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Mc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Mc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Mc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Mc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Mc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Mc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Mc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Mc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Mc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Mc=[new X,new X,new X,new X,new X,new X,new X,new X],Ra=new X,zb=new cs,mm=new X,gm=new X,vm=new X,Xu=new X,qu=new X,Cf=new X,y0=new X,Bb=new X,Hb=new X,Pf=new X;function rA(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){Pf.fromArray(t,s);const a=i.x*Math.abs(Pf.x)+i.y*Math.abs(Pf.y)+i.z*Math.abs(Pf.z),l=e.dot(Pf),c=n.dot(Pf),d=r.dot(Pf);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const fpe=new cs,x0=new X,iA=new X;class Vi{constructor(e=new X,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):fpe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;x0.subVectors(e,this.center);const n=x0.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(x0,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(iA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(x0.copy(e.center).add(iA)),this.expandByPoint(x0.copy(e.center).sub(iA))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ec=new X,sA=new X,Vb=new X,Ku=new X,oA=new X,Gb=new X,aA=new X;class ep{constructor(e=new X,n=new X(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ec)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Ec.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Ec.copy(this.origin).addScaledVector(this.direction,n),Ec.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){sA.copy(e).add(n).multiplyScalar(.5),Vb.copy(n).sub(e).normalize(),Ku.copy(this.origin).sub(sA);const s=e.distanceTo(n)*.5,o=-this.direction.dot(Vb),a=Ku.dot(this.direction),l=-Ku.dot(Vb),c=Ku.lengthSq(),d=Math.abs(1-o*o);let f,g,y,x;if(d>0)if(f=o*l-a,g=o*a-l,x=s*d,f>=0)if(g>=-x)if(g<=x){const S=1/d;f*=S,g*=S,y=f*(f+o*g+2*a)+g*(o*f+g+2*l)+c}else g=s,f=Math.max(0,-(o*g+a)),y=-f*f+g*(g+2*l)+c;else g=-s,f=Math.max(0,-(o*g+a)),y=-f*f+g*(g+2*l)+c;else g<=-x?(f=Math.max(0,-(-o*s+a)),g=f>0?-s:Math.min(Math.max(-s,-l),s),y=-f*f+g*(g+2*l)+c):g<=x?(f=0,g=Math.min(Math.max(-s,-l),s),y=g*(g+2*l)+c):(f=Math.max(0,-(o*s+a)),g=f>0?s:Math.min(Math.max(-s,-l),s),y=-f*f+g*(g+2*l)+c);else g=o>0?-s:s,f=Math.max(0,-(o*g+a)),y=-f*f+g*(g+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(sA).addScaledVector(Vb,g),y}intersectSphere(e,n){Ec.subVectors(e.center,this.origin);const r=Ec.dot(this.direction),i=Ec.dot(Ec)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,g=this.origin;return c>=0?(r=(e.min.x-g.x)*c,i=(e.max.x-g.x)*c):(r=(e.max.x-g.x)*c,i=(e.min.x-g.x)*c),d>=0?(s=(e.min.y-g.y)*d,o=(e.max.y-g.y)*d):(s=(e.max.y-g.y)*d,o=(e.min.y-g.y)*d),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-g.z)*f,l=(e.max.z-g.z)*f):(a=(e.max.z-g.z)*f,l=(e.min.z-g.z)*f),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Ec)!==null}intersectTriangle(e,n,r,i,s){oA.subVectors(n,e),Gb.subVectors(r,e),aA.crossVectors(oA,Gb);let o=this.direction.dot(aA),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ku.subVectors(this.origin,e);const l=a*this.direction.dot(Gb.crossVectors(Ku,Gb));if(l<0)return null;const c=a*this.direction.dot(oA.cross(Ku));if(c<0||l+c>o)return null;const d=-a*Ku.dot(aA);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class kt{constructor(e,n,r,i,s,o,a,l,c,d,f,g,y,x,S,w){kt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c,d,f,g,y,x,S,w)}set(e,n,r,i,s,o,a,l,c,d,f,g,y,x,S,w){const b=this.elements;return b[0]=e,b[4]=n,b[8]=r,b[12]=i,b[1]=s,b[5]=o,b[9]=a,b[13]=l,b[2]=c,b[6]=d,b[10]=f,b[14]=g,b[3]=y,b[7]=x,b[11]=S,b[15]=w,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new kt().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,i=1/ym.setFromMatrixColumn(e,0).length(),s=1/ym.setFromMatrixColumn(e,1).length(),o=1/ym.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const g=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=y+x*c,n[5]=g-S*c,n[9]=-a*l,n[2]=S-g*c,n[6]=x+y*c,n[10]=o*l}else if(e.order==="YXZ"){const g=l*d,y=l*f,x=c*d,S=c*f;n[0]=g+S*a,n[4]=x*a-y,n[8]=o*c,n[1]=o*f,n[5]=o*d,n[9]=-a,n[2]=y*a-x,n[6]=S+g*a,n[10]=o*l}else if(e.order==="ZXY"){const g=l*d,y=l*f,x=c*d,S=c*f;n[0]=g-S*a,n[4]=-o*f,n[8]=x+y*a,n[1]=y+x*a,n[5]=o*d,n[9]=S-g*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const g=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=x*c-y,n[8]=g*c+S,n[1]=l*f,n[5]=S*c+g,n[9]=y*c-x,n[2]=-c,n[6]=a*l,n[10]=o*l}else if(e.order==="YZX"){const g=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=S-g*f,n[8]=x*f+y,n[1]=f,n[5]=o*d,n[9]=-a*d,n[2]=-c*d,n[6]=y*f+x,n[10]=g-S*f}else if(e.order==="XZY"){const g=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=g*f+S,n[5]=o*d,n[9]=y*f-x,n[2]=x*f-y,n[6]=a*d,n[10]=S*f+g}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(hpe,e,ppe)}lookAt(e,n,r){const i=this.elements;return go.subVectors(e,n),go.lengthSq()===0&&(go.z=1),go.normalize(),Yu.crossVectors(r,go),Yu.lengthSq()===0&&(Math.abs(r.z)===1?go.x+=1e-4:go.z+=1e-4,go.normalize(),Yu.crossVectors(r,go)),Yu.normalize(),Wb.crossVectors(go,Yu),i[0]=Yu.x,i[4]=Wb.x,i[8]=go.x,i[1]=Yu.y,i[5]=Wb.y,i[9]=go.y,i[2]=Yu.z,i[6]=Wb.z,i[10]=go.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],d=r[1],f=r[5],g=r[9],y=r[13],x=r[2],S=r[6],w=r[10],b=r[14],M=r[3],T=r[7],C=r[11],O=r[15],N=i[0],L=i[4],F=i[8],G=i[12],k=i[1],U=i[5],H=i[9],te=i[13],ee=i[2],pe=i[6],ie=i[10],fe=i[14],B=i[3],Q=i[7],K=i[11],V=i[15];return s[0]=o*N+a*k+l*ee+c*B,s[4]=o*L+a*U+l*pe+c*Q,s[8]=o*F+a*H+l*ie+c*K,s[12]=o*G+a*te+l*fe+c*V,s[1]=d*N+f*k+g*ee+y*B,s[5]=d*L+f*U+g*pe+y*Q,s[9]=d*F+f*H+g*ie+y*K,s[13]=d*G+f*te+g*fe+y*V,s[2]=x*N+S*k+w*ee+b*B,s[6]=x*L+S*U+w*pe+b*Q,s[10]=x*F+S*H+w*ie+b*K,s[14]=x*G+S*te+w*fe+b*V,s[3]=M*N+T*k+C*ee+O*B,s[7]=M*L+T*U+C*pe+O*Q,s[11]=M*F+T*H+C*ie+O*K,s[15]=M*G+T*te+C*fe+O*V,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],f=e[6],g=e[10],y=e[14],x=e[3],S=e[7],w=e[11],b=e[15];return x*(+s*l*f-i*c*f-s*a*g+r*c*g+i*a*y-r*l*y)+S*(+n*l*y-n*c*g+s*o*g-i*o*y+i*c*d-s*l*d)+w*(+n*c*f-n*a*y-s*o*f+r*o*y+s*a*d-r*c*d)+b*(-i*a*d-n*l*f+n*a*g+i*o*f-r*o*g+r*l*d)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=e[9],g=e[10],y=e[11],x=e[12],S=e[13],w=e[14],b=e[15],M=f*w*c-S*g*c+S*l*y-a*w*y-f*l*b+a*g*b,T=x*g*c-d*w*c-x*l*y+o*w*y+d*l*b-o*g*b,C=d*S*c-x*f*c+x*a*y-o*S*y-d*a*b+o*f*b,O=x*f*l-d*S*l-x*a*g+o*S*g+d*a*w-o*f*w,N=n*M+r*T+i*C+s*O;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/N;return e[0]=M*L,e[1]=(S*g*s-f*w*s-S*i*y+r*w*y+f*i*b-r*g*b)*L,e[2]=(a*w*s-S*l*s+S*i*c-r*w*c-a*i*b+r*l*b)*L,e[3]=(f*l*s-a*g*s-f*i*c+r*g*c+a*i*y-r*l*y)*L,e[4]=T*L,e[5]=(d*w*s-x*g*s+x*i*y-n*w*y-d*i*b+n*g*b)*L,e[6]=(x*l*s-o*w*s-x*i*c+n*w*c+o*i*b-n*l*b)*L,e[7]=(o*g*s-d*l*s+d*i*c-n*g*c-o*i*y+n*l*y)*L,e[8]=C*L,e[9]=(x*f*s-d*S*s-x*r*y+n*S*y+d*r*b-n*f*b)*L,e[10]=(o*S*s-x*a*s+x*r*c-n*S*c-o*r*b+n*a*b)*L,e[11]=(d*a*s-o*f*s-d*r*c+n*f*c+o*r*y-n*a*y)*L,e[12]=O*L,e[13]=(d*S*i-x*f*i+x*r*g-n*S*g-d*r*w+n*f*w)*L,e[14]=(x*a*i-o*S*i-x*r*l+n*S*l+o*r*w-n*a*w)*L,e[15]=(o*f*i-d*a*i+d*r*l-n*f*l-o*r*g+n*a*g)*L,this}scale(e){const n=this.elements,r=e.x,i=e.y,s=e.z;return n[0]*=r,n[4]*=i,n[8]*=s,n[1]*=r,n[5]*=i,n[9]*=s,n[2]*=r,n[6]*=i,n[10]*=s,n[3]*=r,n[7]*=i,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,d*a+r,d*l-i*o,0,c*l-i*a,d*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,d=o+o,f=a+a,g=s*c,y=s*d,x=s*f,S=o*d,w=o*f,b=a*f,M=l*c,T=l*d,C=l*f,O=r.x,N=r.y,L=r.z;return i[0]=(1-(S+b))*O,i[1]=(y+C)*O,i[2]=(x-T)*O,i[3]=0,i[4]=(y-C)*N,i[5]=(1-(g+b))*N,i[6]=(w+M)*N,i[7]=0,i[8]=(x+T)*L,i[9]=(w-M)*L,i[10]=(1-(g+S))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;let s=ym.set(i[0],i[1],i[2]).length();const o=ym.set(i[4],i[5],i[6]).length(),a=ym.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Na.copy(this);const c=1/s,d=1/o,f=1/a;return Na.elements[0]*=c,Na.elements[1]*=c,Na.elements[2]*=c,Na.elements[4]*=d,Na.elements[5]*=d,Na.elements[6]*=d,Na.elements[8]*=f,Na.elements[9]*=f,Na.elements[10]*=f,n.setFromRotationMatrix(Na),r.x=s,r.y=o,r.z=a,this}makePerspective(e,n,r,i,s,o,a=Ml){const l=this.elements,c=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),g=(r+i)/(r-i);let y,x;if(a===Ml)y=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===ky)y=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=g,l[13]=0,l[2]=0,l[6]=0,l[10]=y,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,s,o,a=Ml){const l=this.elements,c=1/(n-e),d=1/(r-i),f=1/(o-s),g=(n+e)*c,y=(r+i)*d;let x,S;if(a===Ml)x=(o+s)*f,S=-2*f;else if(a===ky)x=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-g,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-y,l[2]=0,l[6]=0,l[10]=S,l[14]=-x,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const ym=new X,Na=new kt,hpe=new X(0,0,0),ppe=new X(1,1,1),Yu=new X,Wb=new X,go=new X,K3=new kt,Y3=new en;class us{constructor(e=0,n=0,r=0,i=us.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],d=i[9],f=i[2],g=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Rr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(g,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Rr(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,y),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Rr(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(-f,y),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Rr(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(g,y),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Rr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,y));break;case"XZY":this._z=Math.asin(-Rr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(g,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,y),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return K3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(K3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return Y3.setFromEuler(this),this.setFromQuaternion(Y3,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}us.DEFAULT_ORDER="XYZ";class Ch{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let r=0;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),g.length>0&&(r.skeletons=g),y.length>0&&(r.animations=y),x.length>0&&(r.nodes=x)}return r.object=i,r;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){Ia.subVectors(i,n),Tc.subVectors(r,n),cA.subVectors(e,n);const o=Ia.dot(Ia),a=Ia.dot(Tc),l=Ia.dot(cA),c=Tc.dot(Tc),d=Tc.dot(cA),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const g=1/f,y=(c*l-a*d)*g,x=(o*d-a*l)*g;return s.set(1-y-x,x,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Cc)===null?!1:Cc.x>=0&&Cc.y>=0&&Cc.x+Cc.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,Cc)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Cc.x),l.addScaledVector(o,Cc.y),l.addScaledVector(a,Cc.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return hA.setScalar(0),pA.setScalar(0),mA.setScalar(0),hA.fromBufferAttribute(e,n),pA.fromBufferAttribute(e,r),mA.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(hA,s.x),o.addScaledVector(pA,s.y),o.addScaledVector(mA,s.z),o}static isFrontFacing(e,n,r,i){return Ia.subVectors(r,n),Tc.subVectors(e,n),Ia.cross(Tc).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ia.subVectors(this.c,this.b),Tc.subVectors(this.a,this.b),Ia.cross(Tc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Zs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Zs.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Zs.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Zs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Zs.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let o,a;_m.subVectors(i,r),wm.subVectors(s,r),uA.subVectors(e,r);const l=_m.dot(uA),c=wm.dot(uA);if(l<=0&&c<=0)return n.copy(r);dA.subVectors(e,i);const d=_m.dot(dA),f=wm.dot(dA);if(d>=0&&f<=d)return n.copy(i);const g=l*f-d*c;if(g<=0&&l>=0&&d<=0)return o=l/(l-d),n.copy(r).addScaledVector(_m,o);fA.subVectors(e,s);const y=_m.dot(fA),x=wm.dot(fA);if(x>=0&&y<=x)return n.copy(s);const S=y*c-l*x;if(S<=0&&c>=0&&x<=0)return a=c/(c-x),n.copy(r).addScaledVector(wm,a);const w=d*x-y*f;if(w<=0&&f-d>=0&&y-x>=0)return nD.subVectors(s,i),a=(f-d)/(f-d+(y-x)),n.copy(i).addScaledVector(nD,a);const b=1/(w+S+g);return o=S*b,a=g*b,n.copy(r).addScaledVector(_m,o).addScaledVector(wm,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const f6={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Zu={h:0,s:0,l:0},Xb={h:0,s:0,l:0};function gA(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class ut{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=zi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ln.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=Ln.workingColorSpace){return this.r=e,this.g=n,this.b=r,Ln.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=Ln.workingColorSpace){if(e=TR(e,1),n=Rr(n,0,1),r=Rr(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=gA(o,s,e+1/3),this.g=gA(o,s,e),this.b=gA(o,s,e-1/3)}return Ln.toWorkingColorSpace(this,i),this}setStyle(e,n=zi){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=zi){const r=f6[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ig(e.r),this.g=ig(e.g),this.b=ig(e.b),this}copyLinearToSRGB(e){return this.r=eA(e.r),this.g=eA(e.g),this.b=eA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=zi){return Ln.fromWorkingColorSpace(ns.copy(this),e),Math.round(Rr(ns.r*255,0,255))*65536+Math.round(Rr(ns.g*255,0,255))*256+Math.round(Rr(ns.b*255,0,255))}getHexString(e=zi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Ln.workingColorSpace){Ln.fromWorkingColorSpace(ns.copy(this),n);const r=ns.r,i=ns.g,s=ns.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=d<=.5?f/(o+a):f/(2-o-a),o){case r:l=(i-s)/f+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Eh&&(r.blending=this.blending),this.side!==Ul&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==e1&&(r.blendSrc=this.blendSrc),this.blendDst!==t1&&(r.blendDst=this.blendDst),this.blendEquation!==ud&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Fh&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ZC&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Yf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Yf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Yf&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(n){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Cs extends Xr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new us,this.combine=lx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Uc=bpe();function bpe(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function qs(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Rr(t,-65504,65504),Uc.floatView[0]=t;const e=Uc.uint32View[0],n=e>>23&511;return Uc.baseTable[n]+((e&8388607)>>Uc.shiftTable[n])}function V0(t){const e=t>>10;return Uc.uint32View[0]=Uc.mantissaTable[Uc.offsetTable[e]+(t&1023)]+Uc.exponentTable[e],Uc.floatView[0]}const _pe={toHalfFloat:qs,fromHalfFloat:V0},Wr=new X,qb=new He;class rn{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=Iy,this.updateRanges=[],this.gpuType=eo,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,g=c.length;f0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let g=0,y=f.length;g0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(rD.copy(s).invert(),Rf.copy(e.ray).applyMatrix4(rD),!(r.boundingBox!==null&&Rf.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Rf)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,g=s.groups,y=s.drawRange;if(a!==null)if(Array.isArray(o))for(let x=0,S=g.length;xn.far?null:{distance:c,point:e_.clone(),object:t}}function t_(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,Yb),t.getVertexPosition(l,Zb),t.getVertexPosition(c,Qb);const d=Ppe(t,e,n,r,Yb,Zb,Qb,sD);if(d){const f=new X;Zs.getBarycoord(sD,Yb,Zb,Qb,f),i&&(d.uv=Zs.getInterpolatedAttribute(i,a,l,c,f,new He)),s&&(d.uv1=Zs.getInterpolatedAttribute(s,a,l,c,f,new He)),o&&(d.normal=Zs.getInterpolatedAttribute(o,a,l,c,f,new X),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const g={a,b:l,c,normal:new X,materialIndex:0};Zs.getNormal(Yb,Zb,Qb,g.normal),d.face=g,d.barycoord=f}return d}class tp extends nn{constructor(e=1,n=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],f=[];let g=0,y=0;x("z","y","x",-1,-1,r,n,e,o,s,0),x("z","y","x",1,-1,r,n,-e,o,s,1),x("x","z","y",1,1,e,r,n,i,o,2),x("x","z","y",1,-1,e,r,-n,i,o,3),x("x","y","z",1,-1,e,n,r,i,s,4),x("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new Ft(c,3)),this.setAttribute("normal",new Ft(d,3)),this.setAttribute("uv",new Ft(f,2));function x(S,w,b,M,T,C,O,N,L,F,G){const k=C/L,U=O/F,H=C/2,te=O/2,ee=N/2,pe=L+1,ie=F+1;let fe=0,B=0;const Q=new X;for(let K=0;K0?1:-1,d.push(Q.x,Q.y,Q.z),f.push(q/L),f.push(1-K/F),fe+=1}}for(let K=0;K0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class dx extends yn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new kt,this.projectionMatrix=new kt,this.projectionMatrixInverse=new kt,this.coordinateSystem=Ml}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Qu=new X,iD=new Ve,sD=new Ve;class Pr extends dx{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=jg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ah*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return jg*2*Math.atan(Math.tan(Ah*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){Qu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z),Qu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z)}getViewSize(e,n){return this.getViewBounds(e,iD,sD),n.subVectors(sD,iD)}setViewOffset(e,n,r,i,s,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Ah*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,n-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Mm=-90,Em=1;class u6 extends yn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Pr(Mm,Em,e,n);i.layers=this.layers,this.add(i);const s=new Pr(Mm,Em,e,n);s.layers=this.layers,this.add(s);const o=new Pr(Mm,Em,e,n);o.layers=this.layers,this.add(o);const a=new Pr(Mm,Em,e,n);a.layers=this.layers,this.add(a);const l=new Pr(Mm,Em,e,n);l.layers=this.layers,this.add(l);const c=new Pr(Mm,Em,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===Ml)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===ky)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,d]=this.children,f=e.getRenderTarget(),m=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const S=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(n,s),e.setRenderTarget(r,1,i),e.render(n,o),e.setRenderTarget(r,2,i),e.render(n,a),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,c),r.texture.generateMipmaps=S,e.setRenderTarget(r,5,i),e.render(n,d),e.setRenderTarget(f,m,y),e.xr.enabled=x,r.texture.needsPMREMUpdate=!0}}class fx extends hr{constructor(e,n,r,i,s,o,a,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Jc,super(e,n,r,i,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class d6 extends Ga{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new fx(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Rr}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class ta extends Xr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Npe,this.fragmentShader=Ipe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Ug(e.uniforms),this.uniformsGroups=Rpe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?n.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[i]={type:"m4",value:o.toArray()}:n.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class dx extends vn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new kt,this.projectionMatrix=new kt,this.projectionMatrixInverse=new kt,this.coordinateSystem=Ml}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Qu=new X,oD=new He,aD=new He;class Nr extends dx{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=jg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Th*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return jg*2*Math.atan(Math.tan(Th*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){Qu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z),Qu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z)}getViewSize(e,n){return this.getViewBounds(e,oD,aD),n.subVectors(aD,oD)}setViewOffset(e,n,r,i,s,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Th*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,n-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Mm=-90,Em=1;class p6 extends vn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Nr(Mm,Em,e,n);i.layers=this.layers,this.add(i);const s=new Nr(Mm,Em,e,n);s.layers=this.layers,this.add(s);const o=new Nr(Mm,Em,e,n);o.layers=this.layers,this.add(o);const a=new Nr(Mm,Em,e,n);a.layers=this.layers,this.add(a);const l=new Nr(Mm,Em,e,n);l.layers=this.layers,this.add(l);const c=new Nr(Mm,Em,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===Ml)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===ky)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,d]=this.children,f=e.getRenderTarget(),g=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const S=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(n,s),e.setRenderTarget(r,1,i),e.render(n,o),e.setRenderTarget(r,2,i),e.render(n,a),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,c),r.texture.generateMipmaps=S,e.setRenderTarget(r,5,i),e.render(n,d),e.setRenderTarget(f,g,y),e.xr.enabled=x,r.texture.needsPMREMUpdate=!0}}class fx extends mr{constructor(e,n,r,i,s,o,a,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Jc,super(e,n,r,i,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class m6 extends Ga{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new fx(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Ir}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -631,9 +646,9 @@ Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemer gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},i=new tp(5,5,5),s=new ea({name:"CubemapFromEquirect",uniforms:Ug(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:ls,blending:$c});s.uniforms.tEquirect.value=n;const o=new xr(i,s),a=n.minFilter;return n.minFilter===Yo&&(n.minFilter=Rr),new u6(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,r,i);e.setRenderTarget(s)}}const mA=new X,bpe=new X,_pe=new Zt;class kc{constructor(e=new X(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=mA.subVectors(r,n).cross(bpe.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(mA),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const r=n||_pe.getNormalMatrix(e),i=this.coplanarPoint(mA).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Rf=new Hi,t_=new X;class hx{constructor(e=new kc,n=new kc,r=new kc,i=new kc,s=new kc,o=new kc){this.planes=[e,n,r,i,s,o]}set(e,n,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Ml){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],d=i[5],f=i[6],m=i[7],y=i[8],x=i[9],S=i[10],_=i[11],w=i[12],E=i[13],T=i[14],C=i[15];if(r[0].setComponents(l-s,m-c,_-y,C-w).normalize(),r[1].setComponents(l+s,m+c,_+y,C+w).normalize(),r[2].setComponents(l+o,m+d,_+x,C+E).normalize(),r[3].setComponents(l-o,m-d,_-x,C-E).normalize(),r[4].setComponents(l-a,m-f,_-S,C-T).normalize(),n===Ml)r[5].setComponents(l+a,m+f,_+S,C+T).normalize();else if(n===ky)r[5].setComponents(a,f,S,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Rf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Rf.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Rf)}intersectsSprite(e){return Rf.center.set(0,0,0),Rf.radius=.7071067811865476,Rf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Rf)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)0?e.max.x:e.min.x,t_.y=i.normal.y>0?e.max.y:e.min.y,t_.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(t_)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function f6(){let t=null,e=!1,n=null,r=null;function i(s,o){n(s,o),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function wpe(t){const e=new WeakMap;function n(a,l){const c=a.array,d=a.usage,f=c.byteLength,m=t.createBuffer();t.bindBuffer(l,m),t.bufferData(l,c,d),a.onUploadCallback();let y;if(c instanceof Float32Array)y=t.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?y=t.HALF_FLOAT:y=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)y=t.SHORT;else if(c instanceof Uint32Array)y=t.UNSIGNED_INT;else if(c instanceof Int32Array)y=t.INT;else if(c instanceof Int8Array)y=t.BYTE;else if(c instanceof Uint8Array)y=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)y=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:m,type:y,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function r(a,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,a),f.length===0)t.bufferSubData(c,0,d);else{f.sort((y,x)=>y.start-x.start);let m=0;for(let y=1;y1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const r=n||Ope.getNormalMatrix(e),i=this.coplanarPoint(xA).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Nf=new Vi,n_=new X;class hx{constructor(e=new kc,n=new kc,r=new kc,i=new kc,s=new kc,o=new kc){this.planes=[e,n,r,i,s,o]}set(e,n,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Ml){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],d=i[5],f=i[6],g=i[7],y=i[8],x=i[9],S=i[10],w=i[11],b=i[12],M=i[13],T=i[14],C=i[15];if(r[0].setComponents(l-s,g-c,w-y,C-b).normalize(),r[1].setComponents(l+s,g+c,w+y,C+b).normalize(),r[2].setComponents(l+o,g+d,w+x,C+M).normalize(),r[3].setComponents(l-o,g-d,w-x,C-M).normalize(),r[4].setComponents(l-a,g-f,w-S,C-T).normalize(),n===Ml)r[5].setComponents(l+a,g+f,w+S,C+T).normalize();else if(n===ky)r[5].setComponents(a,f,S,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Nf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Nf.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Nf)}intersectsSprite(e){return Nf.center.set(0,0,0),Nf.radius=.7071067811865476,Nf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Nf)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)0?e.max.x:e.min.x,n_.y=i.normal.y>0?e.max.y:e.min.y,n_.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(n_)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function g6(){let t=null,e=!1,n=null,r=null;function i(s,o){n(s,o),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function Lpe(t){const e=new WeakMap;function n(a,l){const c=a.array,d=a.usage,f=c.byteLength,g=t.createBuffer();t.bindBuffer(l,g),t.bufferData(l,c,d),a.onUploadCallback();let y;if(c instanceof Float32Array)y=t.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?y=t.HALF_FLOAT:y=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)y=t.SHORT;else if(c instanceof Uint32Array)y=t.UNSIGNED_INT;else if(c instanceof Int32Array)y=t.INT;else if(c instanceof Int8Array)y=t.BYTE;else if(c instanceof Uint8Array)y=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)y=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:g,type:y,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function r(a,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,a),f.length===0)t.bufferSubData(c,0,d);else{f.sort((y,x)=>y.start-x.start);let g=0;for(let y=1;y 0 +#endif`,Zpe=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; @@ -883,26 +898,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve if ( clipped ) discard; #endif #endif -#endif`,Fpe=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Qpe=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,zpe=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Jpe=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,Bpe=`#if NUM_CLIPPING_PLANES > 0 +#endif`,eme=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,Hpe=`#if defined( USE_COLOR_ALPHA ) +#endif`,tme=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,Vpe=`#if defined( USE_COLOR_ALPHA ) +#endif`,nme=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,Gpe=`#if defined( USE_COLOR_ALPHA ) +#endif`,rme=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; -#endif`,Wpe=`#if defined( USE_COLOR_ALPHA ) +#endif`,ime=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec3( 1.0 ); @@ -916,7 +931,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #ifdef USE_BATCHING_COLOR vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); vColor.xyz *= batchingColor.xyz; -#endif`,$pe=`#define PI 3.141592653589793 +#endif`,sme=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -990,7 +1005,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,Xpe=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,ome=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -1083,7 +1098,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,qpe=`vec3 transformedNormal = objectNormal; +#endif`,ame=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -1112,18 +1127,18 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,Kpe=`#ifdef USE_DISPLACEMENTMAP +#endif`,lme=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,Ype=`#ifdef USE_DISPLACEMENTMAP +#endif`,cme=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,Zpe=`#ifdef USE_EMISSIVEMAP +#endif`,ume=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,Qpe=`#ifdef USE_EMISSIVEMAP +#endif`,dme=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,Jpe="gl_FragColor = linearToOutputTexel( gl_FragColor );",eme=` +#endif`,fme="gl_FragColor = linearToOutputTexel( gl_FragColor );",hme=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), @@ -1145,7 +1160,7 @@ vec4 LinearTransferOETF( in vec4 value ) { } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,tme=`#ifdef USE_ENVMAP +}`,pme=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -1174,7 +1189,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,nme=`#ifdef USE_ENVMAP +#endif`,mme=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; @@ -1184,7 +1199,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,rme=`#ifdef USE_ENVMAP +#endif`,gme=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -1195,7 +1210,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,ime=`#ifdef USE_ENVMAP +#endif`,vme=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -1206,7 +1221,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,sme=`#ifdef USE_ENVMAP +#endif`,yme=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -1223,18 +1238,18 @@ vec4 sRGBTransferOETF( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,ome=`#ifdef USE_FOG +#endif`,xme=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,ame=`#ifdef USE_FOG +#endif`,bme=`#ifdef USE_FOG varying float vFogDepth; -#endif`,lme=`#ifdef USE_FOG +#endif`,_me=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,cme=`#ifdef USE_FOG +#endif`,wme=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -1243,7 +1258,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,ume=`#ifdef USE_GRADIENTMAP +#endif`,Sme=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -1255,12 +1270,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,dme=`#ifdef USE_LIGHTMAP +}`,Mme=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,fme=`LambertMaterial material; +#endif`,Eme=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,hme=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Ame=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -1274,7 +1289,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,pme=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Tme=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -1390,7 +1405,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,mme=`#ifdef USE_ENVMAP +#endif`,Cme=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -1423,8 +1438,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,gme=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,vme=`varying vec3 vViewPosition; +#endif`,Pme=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,Rme=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -1436,11 +1451,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,yme=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Nme=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,xme=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Ime=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -1457,7 +1472,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,bme=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,kme=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -1543,7 +1558,7 @@ material.roughness = min( material.roughness, 1.0 ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,_me=`struct PhysicalMaterial { +#endif`,Ome=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1844,7 +1859,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,wme=` +}`,Lme=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1959,7 +1974,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,Sme=`#if defined( RE_IndirectDiffuse ) +#endif`,Dme=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1978,33 +1993,33 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,Mme=`#if defined( RE_IndirectDiffuse ) +#endif`,jme=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,Eme=`#if defined( USE_LOGDEPTHBUF ) +#endif`,Ume=`#if defined( USE_LOGDEPTHBUF ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,Ame=`#if defined( USE_LOGDEPTHBUF ) +#endif`,Fme=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,Tme=`#ifdef USE_LOGDEPTHBUF +#endif`,zme=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; -#endif`,Cme=`#ifdef USE_LOGDEPTHBUF +#endif`,Bme=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,Pme=`#ifdef USE_MAP +#endif`,Hme=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,Rme=`#ifdef USE_MAP +#endif`,Vme=`#ifdef USE_MAP uniform sampler2D map; -#endif`,Nme=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,Gme=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -2016,7 +2031,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,Ime=`#if defined( USE_POINTS_UV ) +#endif`,Wme=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -2028,19 +2043,19 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,kme=`float metalnessFactor = metalness; +#endif`,$me=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,Ome=`#ifdef USE_METALNESSMAP +#endif`,Xme=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,Lme=`#ifdef USE_INSTANCING_MORPH +#endif`,qme=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } -#endif`,Dme=`#if defined( USE_MORPHCOLORS ) +#endif`,Kme=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -2049,12 +2064,12 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,jme=`#ifdef USE_MORPHNORMALS +#endif`,Yme=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } -#endif`,Ume=`#ifdef USE_MORPHTARGETS +#endif`,Zme=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -2068,12 +2083,12 @@ IncidentLight directLight; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } -#endif`,Fme=`#ifdef USE_MORPHTARGETS +#endif`,Qme=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } -#endif`,zme=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,Jme=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -2114,7 +2129,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,Bme=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,ege=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -2129,25 +2144,25 @@ vec3 nonPerturbedNormal = normal;`,Bme=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,Hme=`#ifndef FLAT_SHADED +#endif`,tge=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Vme=`#ifndef FLAT_SHADED +#endif`,nge=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Gme=`#ifndef FLAT_SHADED +#endif`,rge=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,Wme=`#ifdef USE_NORMALMAP +#endif`,ige=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -2169,13 +2184,13 @@ vec3 nonPerturbedNormal = normal;`,Bme=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,$me=`#ifdef USE_CLEARCOAT +#endif`,sge=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,Xme=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,oge=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,qme=`#ifdef USE_CLEARCOATMAP +#endif`,age=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -2184,18 +2199,18 @@ vec3 nonPerturbedNormal = normal;`,Bme=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,Kme=`#ifdef USE_IRIDESCENCEMAP +#endif`,lge=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,Yme=`#ifdef OPAQUE +#endif`,cge=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Zme=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,uge=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -2264,9 +2279,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,Qme=`#ifdef PREMULTIPLIED_ALPHA +}`,dge=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,Jme=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,fge=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -2274,22 +2289,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,ege=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,hge=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,tge=`#ifdef DITHERING +#endif`,pge=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,nge=`float roughnessFactor = roughness; +#endif`,mge=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,rge=`#ifdef USE_ROUGHNESSMAP +#endif`,gge=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,ige=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,vge=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -2475,7 +2490,7 @@ gl_Position = projectionMatrix * mvPosition;`,ege=`#ifdef DITHERING } return mix( 1.0, shadow, shadowIntensity ); } -#endif`,sge=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,yge=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -2516,7 +2531,7 @@ gl_Position = projectionMatrix * mvPosition;`,ege=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,oge=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,xge=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -2548,7 +2563,7 @@ gl_Position = projectionMatrix * mvPosition;`,ege=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,age=`float getShadowMask() { +#endif`,bge=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -2580,12 +2595,12 @@ gl_Position = projectionMatrix * mvPosition;`,ege=`#ifdef DITHERING #endif #endif return shadow; -}`,lge=`#ifdef USE_SKINNING +}`,_ge=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,cge=`#ifdef USE_SKINNING +#endif`,wge=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2600,7 +2615,7 @@ gl_Position = projectionMatrix * mvPosition;`,ege=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,uge=`#ifdef USE_SKINNING +#endif`,Sge=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2608,7 +2623,7 @@ gl_Position = projectionMatrix * mvPosition;`,ege=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,dge=`#ifdef USE_SKINNING +#endif`,Mge=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2619,17 +2634,17 @@ gl_Position = projectionMatrix * mvPosition;`,ege=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,fge=`float specularStrength; +#endif`,Ege=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,hge=`#ifdef USE_SPECULARMAP +#endif`,Age=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,pge=`#if defined( TONE_MAPPING ) +#endif`,Tge=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,mge=`#ifndef saturate +#endif`,Cge=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2726,7 +2741,7 @@ vec3 NeutralToneMapping( vec3 color ) { float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,gge=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,Pge=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2747,7 +2762,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gge=`#ifdef USE_TRANSMIS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,vge=`#ifdef USE_TRANSMISSION +#endif`,Rge=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2878,7 +2893,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gge=`#ifdef USE_TRANSMIS float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } -#endif`,yge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Nge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2948,7 +2963,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gge=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,xge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Ige=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -3042,7 +3057,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gge=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,bge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,kge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -3113,7 +3128,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gge=`#ifdef USE_TRANSMIS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,_ge=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Oge=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -3122,12 +3137,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,gge=`#ifdef USE_TRANSMIS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const wge=`varying vec2 vUv; +#endif`;const Lge=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,Sge=`uniform sampler2D t2D; +}`,Dge=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -3139,14 +3154,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,Mge=`varying vec3 vWorldDirection; +}`,jge=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Ege=`#ifdef ENVMAP_TYPE_CUBE +}`,Uge=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -3169,14 +3184,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,Age=`varying vec3 vWorldDirection; +}`,Fge=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Tge=`uniform samplerCube tCube; +}`,zge=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -3186,7 +3201,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,Cge=`#include +}`,Bge=`#include #include #include #include @@ -3213,7 +3228,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,Pge=`#if DEPTH_PACKING == 3200 +}`,Hge=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -3247,7 +3262,7 @@ void main() { #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif -}`,Rge=`#define DISTANCE +}`,Vge=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -3274,7 +3289,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,Nge=`#define DISTANCE +}`,Gge=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -3298,13 +3313,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,Ige=`varying vec3 vWorldDirection; +}`,Wge=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,kge=`uniform sampler2D tEquirect; +}`,$ge=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -3313,7 +3328,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,Oge=`uniform float scale; +}`,Xge=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -3335,7 +3350,7 @@ void main() { #include #include #include -}`,Lge=`uniform vec3 diffuse; +}`,qge=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -3363,7 +3378,7 @@ void main() { #include #include #include -}`,Dge=`#include +}`,Kge=`#include #include #include #include @@ -3395,7 +3410,7 @@ void main() { #include #include #include -}`,jge=`uniform vec3 diffuse; +}`,Yge=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -3443,7 +3458,7 @@ void main() { #include #include #include -}`,Uge=`#define LAMBERT +}`,Zge=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -3482,7 +3497,7 @@ void main() { #include #include #include -}`,Fge=`#define LAMBERT +}`,Qge=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3539,7 +3554,7 @@ void main() { #include #include #include -}`,zge=`#define MATCAP +}`,Jge=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3573,7 +3588,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,Bge=`#define MATCAP +}`,eve=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3619,7 +3634,7 @@ void main() { #include #include #include -}`,Hge=`#define NORMAL +}`,tve=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3652,7 +3667,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,Vge=`#define NORMAL +}`,nve=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3674,7 +3689,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,Gge=`#define PHONG +}`,rve=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3713,7 +3728,7 @@ void main() { #include #include #include -}`,Wge=`#define PHONG +}`,ive=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3772,7 +3787,7 @@ void main() { #include #include #include -}`,$ge=`#define STANDARD +}`,sve=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3815,7 +3830,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,Xge=`#define STANDARD +}`,ove=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3940,7 +3955,7 @@ void main() { #include #include #include -}`,qge=`#define TOON +}`,ave=`#define TOON varying vec3 vViewPosition; #include #include @@ -3977,7 +3992,7 @@ void main() { #include #include #include -}`,Kge=`#define TOON +}`,lve=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -4030,7 +4045,7 @@ void main() { #include #include #include -}`,Yge=`uniform float size; +}`,cve=`uniform float size; uniform float scale; #include #include @@ -4061,7 +4076,7 @@ void main() { #include #include #include -}`,Zge=`uniform vec3 diffuse; +}`,uve=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -4086,7 +4101,7 @@ void main() { #include #include #include -}`,Qge=`#include +}`,dve=`#include #include #include #include @@ -4109,7 +4124,7 @@ void main() { #include #include #include -}`,Jge=`uniform vec3 color; +}`,fve=`uniform vec3 color; uniform float opacity; #include #include @@ -4125,7 +4140,7 @@ void main() { #include #include #include -}`,eve=`uniform float rotation; +}`,hve=`uniform float rotation; uniform vec2 center; #include #include @@ -4149,7 +4164,7 @@ void main() { #include #include #include -}`,tve=`uniform vec3 diffuse; +}`,pve=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -4174,7 +4189,7 @@ void main() { #include #include #include -}`,gn={alphahash_fragment:Spe,alphahash_pars_fragment:Mpe,alphamap_fragment:Epe,alphamap_pars_fragment:Ape,alphatest_fragment:Tpe,alphatest_pars_fragment:Cpe,aomap_fragment:Ppe,aomap_pars_fragment:Rpe,batching_pars_vertex:Npe,batching_vertex:Ipe,begin_vertex:kpe,beginnormal_vertex:Ope,bsdfs:Lpe,iridescence_fragment:Dpe,bumpmap_pars_fragment:jpe,clipping_planes_fragment:Upe,clipping_planes_pars_fragment:Fpe,clipping_planes_pars_vertex:zpe,clipping_planes_vertex:Bpe,color_fragment:Hpe,color_pars_fragment:Vpe,color_pars_vertex:Gpe,color_vertex:Wpe,common:$pe,cube_uv_reflection_fragment:Xpe,defaultnormal_vertex:qpe,displacementmap_pars_vertex:Kpe,displacementmap_vertex:Ype,emissivemap_fragment:Zpe,emissivemap_pars_fragment:Qpe,colorspace_fragment:Jpe,colorspace_pars_fragment:eme,envmap_fragment:tme,envmap_common_pars_fragment:nme,envmap_pars_fragment:rme,envmap_pars_vertex:ime,envmap_physical_pars_fragment:mme,envmap_vertex:sme,fog_vertex:ome,fog_pars_vertex:ame,fog_fragment:lme,fog_pars_fragment:cme,gradientmap_pars_fragment:ume,lightmap_pars_fragment:dme,lights_lambert_fragment:fme,lights_lambert_pars_fragment:hme,lights_pars_begin:pme,lights_toon_fragment:gme,lights_toon_pars_fragment:vme,lights_phong_fragment:yme,lights_phong_pars_fragment:xme,lights_physical_fragment:bme,lights_physical_pars_fragment:_me,lights_fragment_begin:wme,lights_fragment_maps:Sme,lights_fragment_end:Mme,logdepthbuf_fragment:Eme,logdepthbuf_pars_fragment:Ame,logdepthbuf_pars_vertex:Tme,logdepthbuf_vertex:Cme,map_fragment:Pme,map_pars_fragment:Rme,map_particle_fragment:Nme,map_particle_pars_fragment:Ime,metalnessmap_fragment:kme,metalnessmap_pars_fragment:Ome,morphinstance_vertex:Lme,morphcolor_vertex:Dme,morphnormal_vertex:jme,morphtarget_pars_vertex:Ume,morphtarget_vertex:Fme,normal_fragment_begin:zme,normal_fragment_maps:Bme,normal_pars_fragment:Hme,normal_pars_vertex:Vme,normal_vertex:Gme,normalmap_pars_fragment:Wme,clearcoat_normal_fragment_begin:$me,clearcoat_normal_fragment_maps:Xme,clearcoat_pars_fragment:qme,iridescence_pars_fragment:Kme,opaque_fragment:Yme,packing:Zme,premultiplied_alpha_fragment:Qme,project_vertex:Jme,dithering_fragment:ege,dithering_pars_fragment:tge,roughnessmap_fragment:nge,roughnessmap_pars_fragment:rge,shadowmap_pars_fragment:ige,shadowmap_pars_vertex:sge,shadowmap_vertex:oge,shadowmask_pars_fragment:age,skinbase_vertex:lge,skinning_pars_vertex:cge,skinning_vertex:uge,skinnormal_vertex:dge,specularmap_fragment:fge,specularmap_pars_fragment:hge,tonemapping_fragment:pge,tonemapping_pars_fragment:mge,transmission_fragment:gge,transmission_pars_fragment:vge,uv_pars_fragment:yge,uv_pars_vertex:xge,uv_vertex:bge,worldpos_vertex:_ge,background_vert:wge,background_frag:Sge,backgroundCube_vert:Mge,backgroundCube_frag:Ege,cube_vert:Age,cube_frag:Tge,depth_vert:Cge,depth_frag:Pge,distanceRGBA_vert:Rge,distanceRGBA_frag:Nge,equirect_vert:Ige,equirect_frag:kge,linedashed_vert:Oge,linedashed_frag:Lge,meshbasic_vert:Dge,meshbasic_frag:jge,meshlambert_vert:Uge,meshlambert_frag:Fge,meshmatcap_vert:zge,meshmatcap_frag:Bge,meshnormal_vert:Hge,meshnormal_frag:Vge,meshphong_vert:Gge,meshphong_frag:Wge,meshphysical_vert:$ge,meshphysical_frag:Xge,meshtoon_vert:qge,meshtoon_frag:Kge,points_vert:Yge,points_frag:Zge,shadow_vert:Qge,shadow_frag:Jge,sprite_vert:eve,sprite_frag:tve},pt={common:{diffuse:{value:new ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Zt},alphaMap:{value:null},alphaMapTransform:{value:new Zt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Zt}},envmap:{envMap:{value:null},envMapRotation:{value:new Zt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Zt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Zt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Zt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Zt},normalScale:{value:new Ve(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Zt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Zt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Zt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Zt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ut(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Zt},alphaTest:{value:0},uvTransform:{value:new Zt}},sprite:{diffuse:{value:new ut(16777215)},opacity:{value:1},center:{value:new Ve(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Zt},alphaMap:{value:null},alphaMapTransform:{value:new Zt},alphaTest:{value:0}}},ja={basic:{uniforms:Ss([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.fog]),vertexShader:gn.meshbasic_vert,fragmentShader:gn.meshbasic_frag},lambert:{uniforms:Ss([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new ut(0)}}]),vertexShader:gn.meshlambert_vert,fragmentShader:gn.meshlambert_frag},phong:{uniforms:Ss([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new ut(0)},specular:{value:new ut(1118481)},shininess:{value:30}}]),vertexShader:gn.meshphong_vert,fragmentShader:gn.meshphong_frag},standard:{uniforms:Ss([pt.common,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.roughnessmap,pt.metalnessmap,pt.fog,pt.lights,{emissive:{value:new ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:gn.meshphysical_vert,fragmentShader:gn.meshphysical_frag},toon:{uniforms:Ss([pt.common,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.gradientmap,pt.fog,pt.lights,{emissive:{value:new ut(0)}}]),vertexShader:gn.meshtoon_vert,fragmentShader:gn.meshtoon_frag},matcap:{uniforms:Ss([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,{matcap:{value:null}}]),vertexShader:gn.meshmatcap_vert,fragmentShader:gn.meshmatcap_frag},points:{uniforms:Ss([pt.points,pt.fog]),vertexShader:gn.points_vert,fragmentShader:gn.points_frag},dashed:{uniforms:Ss([pt.common,pt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gn.linedashed_vert,fragmentShader:gn.linedashed_frag},depth:{uniforms:Ss([pt.common,pt.displacementmap]),vertexShader:gn.depth_vert,fragmentShader:gn.depth_frag},normal:{uniforms:Ss([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,{opacity:{value:1}}]),vertexShader:gn.meshnormal_vert,fragmentShader:gn.meshnormal_frag},sprite:{uniforms:Ss([pt.sprite,pt.fog]),vertexShader:gn.sprite_vert,fragmentShader:gn.sprite_frag},background:{uniforms:{uvTransform:{value:new Zt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:gn.background_vert,fragmentShader:gn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Zt}},vertexShader:gn.backgroundCube_vert,fragmentShader:gn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:gn.cube_vert,fragmentShader:gn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gn.equirect_vert,fragmentShader:gn.equirect_frag},distanceRGBA:{uniforms:Ss([pt.common,pt.displacementmap,{referencePosition:{value:new X},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gn.distanceRGBA_vert,fragmentShader:gn.distanceRGBA_frag},shadow:{uniforms:Ss([pt.lights,pt.fog,{color:{value:new ut(0)},opacity:{value:1}}]),vertexShader:gn.shadow_vert,fragmentShader:gn.shadow_frag}};ja.physical={uniforms:Ss([ja.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Zt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Zt},clearcoatNormalScale:{value:new Ve(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Zt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Zt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Zt},sheen:{value:0},sheenColor:{value:new ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Zt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Zt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Zt},transmissionSamplerSize:{value:new Ve},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Zt},attenuationDistance:{value:0},attenuationColor:{value:new ut(0)},specularColor:{value:new ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Zt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Zt},anisotropyVector:{value:new Ve},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Zt}}]),vertexShader:gn.meshphysical_vert,fragmentShader:gn.meshphysical_frag};const n_={r:0,b:0,g:0},Nf=new us,nve=new kt;function rve(t,e,n,r,i,s,o){const a=new ut(0);let l=s===!0?0:1,c,d,f=null,m=0,y=null;function x(E){let T=E.isScene===!0?E.background:null;return T&&T.isTexture&&(T=(E.backgroundBlurriness>0?n:e).get(T)),T}function S(E){let T=!1;const C=x(E);C===null?w(a,l):C&&C.isColor&&(w(C,1),T=!0);const O=t.xr.getEnvironmentBlendMode();O==="additive"?r.buffers.color.setClear(0,0,0,1,o):O==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(t.autoClear||T)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function _(E,T){const C=x(T);C&&(C.isCubeTexture||C.mapping===nv)?(d===void 0&&(d=new xr(new tp(1,1,1),new ea({name:"BackgroundCubeMaterial",uniforms:Ug(ja.backgroundCube.uniforms),vertexShader:ja.backgroundCube.vertexShader,fragmentShader:ja.backgroundCube.fragmentShader,side:ls,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(O,N,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),Nf.copy(T.backgroundRotation),Nf.x*=-1,Nf.y*=-1,Nf.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(Nf.y*=-1,Nf.z*=-1),d.material.uniforms.envMap.value=C,d.material.uniforms.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(nve.makeRotationFromEuler(Nf)),d.material.toneMapped=On.getTransfer(C.colorSpace)!==tr,(f!==C||m!==C.version||y!==t.toneMapping)&&(d.material.needsUpdate=!0,f=C,m=C.version,y=t.toneMapping),d.layers.enableAll(),E.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(c===void 0&&(c=new xr(new iv(2,2),new ea({name:"BackgroundMaterial",uniforms:Ug(ja.background.uniforms),vertexShader:ja.background.vertexShader,fragmentShader:ja.background.fragmentShader,side:Ul,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=C,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=On.getTransfer(C.colorSpace)!==tr,C.matrixAutoUpdate===!0&&C.updateMatrix(),c.material.uniforms.uvTransform.value.copy(C.matrix),(f!==C||m!==C.version||y!==t.toneMapping)&&(c.material.needsUpdate=!0,f=C,m=C.version,y=t.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function w(E,T){E.getRGB(n_,c6(t)),r.buffers.color.setClear(n_.r,n_.g,n_.b,T,o)}return{getClearColor:function(){return a},setClearColor:function(E,T=1){a.set(E),l=T,w(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,w(a,l)},render:S,addToRenderList:_}}function ive(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(k,U,H,ne,ee){let pe=!1;const se=f(ne,H,U);s!==se&&(s=se,c(s.object)),pe=y(k,ne,H,ee),pe&&x(k,ne,H,ee),ee!==null&&e.update(ee,t.ELEMENT_ARRAY_BUFFER),(pe||o)&&(o=!1,C(k,U,H,ne),ee!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(ee).buffer))}function l(){return t.createVertexArray()}function c(k){return t.bindVertexArray(k)}function d(k){return t.deleteVertexArray(k)}function f(k,U,H){const ne=H.wireframe===!0;let ee=r[k.id];ee===void 0&&(ee={},r[k.id]=ee);let pe=ee[U.id];pe===void 0&&(pe={},ee[U.id]=pe);let se=pe[ne];return se===void 0&&(se=m(l()),pe[ne]=se),se}function m(k){const U=[],H=[],ne=[];for(let ee=0;ee=0){const K=ee[B];let V=pe[B];if(V===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(V=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(V=k.instanceColor)),K===void 0||K.attribute!==V||V&&K.data!==V.data)return!0;se++}return s.attributesNum!==se||s.index!==ne}function x(k,U,H,ne){const ee={},pe=U.attributes;let se=0;const fe=H.getAttributes();for(const B in fe)if(fe[B].location>=0){let K=pe[B];K===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(K=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(K=k.instanceColor));const V={};V.attribute=K,K&&K.data&&(V.data=K.data),ee[B]=V,se++}s.attributes=ee,s.attributesNum=se,s.index=ne}function S(){const k=s.newAttributes;for(let U=0,H=k.length;U=0){let Q=ee[fe];if(Q===void 0&&(fe==="instanceMatrix"&&k.instanceMatrix&&(Q=k.instanceMatrix),fe==="instanceColor"&&k.instanceColor&&(Q=k.instanceColor)),Q!==void 0){const K=Q.normalized,V=Q.itemSize,q=e.get(Q);if(q===void 0)continue;const he=q.buffer,ae=q.type,ce=q.bytesPerElement,we=ae===t.INT||ae===t.UNSIGNED_INT||Q.gpuType===WS;if(Q.isInterleavedBufferAttribute){const Ee=Q.data,Xe=Ee.stride,Se=Q.offset;if(Ee.isInstancedInterleavedBuffer){for(let je=0;je0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const d=l(c);d!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const f=n.logarithmicDepthBuffer===!0,m=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(m===!0){const L=e.get("EXT_clip_control");L.clipControlEXT(L.LOWER_LEFT_EXT,L.ZERO_TO_ONE_EXT)}const y=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),x=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=t.getParameter(t.MAX_TEXTURE_SIZE),_=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),w=t.getParameter(t.MAX_VERTEX_ATTRIBS),E=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),T=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),O=x>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:m,maxTextures:y,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:_,maxAttributes:w,maxVertexUniforms:E,maxVaryings:T,maxFragmentUniforms:C,vertexTextures:O,maxSamples:N}}function ave(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new kc,a=new Zt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,m){const y=f.length!==0||m||r!==0||i;return i=m,r=f.length,y},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,m){n=d(f,m,0)},this.setState=function(f,m,y){const x=f.clippingPlanes,S=f.clipIntersection,_=f.clipShadows,w=t.get(f);if(!i||x===null||x.length===0||s&&!_)s?d(null):c();else{const E=s?0:r,T=E*4;let C=w.clippingState||null;l.value=C,C=d(x,m,T,y);for(let O=0;O!==T;++O)C[O]=n[O];w.clippingState=C,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(f,m,y,x){const S=f!==null?f.length:0;let _=null;if(S!==0){if(_=l.value,x!==!0||_===null){const w=y+S*4,E=m.matrixWorldInverse;a.getNormalMatrix(E),(_===null||_.length0){const c=new d6(l.height);return c.fromEquirectangularTexture(t,o),e.set(o,c),o.addEventListener("dispose",i),n(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Xc extends dx{constructor(e=-1,n=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const qm=4,oD=[.125,.215,.35,.446,.526,.582],Qf=20,gA=new Xc,aD=new ut;let vA=null,yA=0,xA=0,bA=!1;const Yf=(1+Math.sqrt(5))/2,Am=1/Yf,lD=[new X(-Yf,Am,0),new X(Yf,Am,0),new X(-Am,0,Yf),new X(Am,0,Yf),new X(0,Yf,-Am),new X(0,Yf,Am),new X(-1,1,-1),new X(1,1,-1),new X(-1,1,1),new X(1,1,1)];class KC{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,r=.1,i=100){vA=this._renderer.getRenderTarget(),yA=this._renderer.getActiveCubeFace(),xA=this._renderer.getActiveMipmapLevel(),bA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=uD(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?T:0,T,T),d.setRenderTarget(i),S&&d.render(x,a),d.render(e,a)}x.geometry.dispose(),x.material.dispose(),d.toneMapping=m,d.autoClear=f,e.background=_}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===Jc||e.mapping===Cd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=uD());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new xr(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;r_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,gA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;sQf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${Qf}`);const w=[];let E=0;for(let L=0;LT-qm?i-T+qm:0),N=4*(this._cubeSize-C);r_(n,O,N,3*C,2*C),l.setRenderTarget(n),l.render(f,gA)}}function cve(t){const e=[],n=[],r=[];let i=t;const s=t-qm+1+oD.length;for(let o=0;ot-qm?l=oD[o-t+qm-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),d=-c,f=1+c,m=[d,d,f,d,f,f,d,d,f,f,d,f],y=6,x=6,S=3,_=2,w=1,E=new Float32Array(S*x*y),T=new Float32Array(_*x*y),C=new Float32Array(w*x*y);for(let N=0;N2?0:-1,G=[L,F,0,L+2/3,F,0,L+2/3,F+1,0,L,F,0,L+2/3,F+1,0,L,F+1,0];E.set(G,S*x*N),T.set(m,_*x*N);const k=[N,N,N,N,N,N];C.set(k,w*x*N)}const O=new tn;O.setAttribute("position",new nn(E,S)),O.setAttribute("uv",new nn(T,_)),O.setAttribute("faceIndex",new nn(C,w)),e.push(O),i>qm&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function cD(t,e,n){const r=new Ga(t,e,n);return r.texture.mapping=nv,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function r_(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function uve(t,e,n){const r=new Float32Array(Qf),i=new X(0,1,0);return new ea({name:"SphericalGaussianBlur",defines:{n:Qf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:PR(),fragmentShader:` +}`,mn={alphahash_fragment:Dpe,alphahash_pars_fragment:jpe,alphamap_fragment:Upe,alphamap_pars_fragment:Fpe,alphatest_fragment:zpe,alphatest_pars_fragment:Bpe,aomap_fragment:Hpe,aomap_pars_fragment:Vpe,batching_pars_vertex:Gpe,batching_vertex:Wpe,begin_vertex:$pe,beginnormal_vertex:Xpe,bsdfs:qpe,iridescence_fragment:Kpe,bumpmap_pars_fragment:Ype,clipping_planes_fragment:Zpe,clipping_planes_pars_fragment:Qpe,clipping_planes_pars_vertex:Jpe,clipping_planes_vertex:eme,color_fragment:tme,color_pars_fragment:nme,color_pars_vertex:rme,color_vertex:ime,common:sme,cube_uv_reflection_fragment:ome,defaultnormal_vertex:ame,displacementmap_pars_vertex:lme,displacementmap_vertex:cme,emissivemap_fragment:ume,emissivemap_pars_fragment:dme,colorspace_fragment:fme,colorspace_pars_fragment:hme,envmap_fragment:pme,envmap_common_pars_fragment:mme,envmap_pars_fragment:gme,envmap_pars_vertex:vme,envmap_physical_pars_fragment:Cme,envmap_vertex:yme,fog_vertex:xme,fog_pars_vertex:bme,fog_fragment:_me,fog_pars_fragment:wme,gradientmap_pars_fragment:Sme,lightmap_pars_fragment:Mme,lights_lambert_fragment:Eme,lights_lambert_pars_fragment:Ame,lights_pars_begin:Tme,lights_toon_fragment:Pme,lights_toon_pars_fragment:Rme,lights_phong_fragment:Nme,lights_phong_pars_fragment:Ime,lights_physical_fragment:kme,lights_physical_pars_fragment:Ome,lights_fragment_begin:Lme,lights_fragment_maps:Dme,lights_fragment_end:jme,logdepthbuf_fragment:Ume,logdepthbuf_pars_fragment:Fme,logdepthbuf_pars_vertex:zme,logdepthbuf_vertex:Bme,map_fragment:Hme,map_pars_fragment:Vme,map_particle_fragment:Gme,map_particle_pars_fragment:Wme,metalnessmap_fragment:$me,metalnessmap_pars_fragment:Xme,morphinstance_vertex:qme,morphcolor_vertex:Kme,morphnormal_vertex:Yme,morphtarget_pars_vertex:Zme,morphtarget_vertex:Qme,normal_fragment_begin:Jme,normal_fragment_maps:ege,normal_pars_fragment:tge,normal_pars_vertex:nge,normal_vertex:rge,normalmap_pars_fragment:ige,clearcoat_normal_fragment_begin:sge,clearcoat_normal_fragment_maps:oge,clearcoat_pars_fragment:age,iridescence_pars_fragment:lge,opaque_fragment:cge,packing:uge,premultiplied_alpha_fragment:dge,project_vertex:fge,dithering_fragment:hge,dithering_pars_fragment:pge,roughnessmap_fragment:mge,roughnessmap_pars_fragment:gge,shadowmap_pars_fragment:vge,shadowmap_pars_vertex:yge,shadowmap_vertex:xge,shadowmask_pars_fragment:bge,skinbase_vertex:_ge,skinning_pars_vertex:wge,skinning_vertex:Sge,skinnormal_vertex:Mge,specularmap_fragment:Ege,specularmap_pars_fragment:Age,tonemapping_fragment:Tge,tonemapping_pars_fragment:Cge,transmission_fragment:Pge,transmission_pars_fragment:Rge,uv_pars_fragment:Nge,uv_pars_vertex:Ige,uv_vertex:kge,worldpos_vertex:Oge,background_vert:Lge,background_frag:Dge,backgroundCube_vert:jge,backgroundCube_frag:Uge,cube_vert:Fge,cube_frag:zge,depth_vert:Bge,depth_frag:Hge,distanceRGBA_vert:Vge,distanceRGBA_frag:Gge,equirect_vert:Wge,equirect_frag:$ge,linedashed_vert:Xge,linedashed_frag:qge,meshbasic_vert:Kge,meshbasic_frag:Yge,meshlambert_vert:Zge,meshlambert_frag:Qge,meshmatcap_vert:Jge,meshmatcap_frag:eve,meshnormal_vert:tve,meshnormal_frag:nve,meshphong_vert:rve,meshphong_frag:ive,meshphysical_vert:sve,meshphysical_frag:ove,meshtoon_vert:ave,meshtoon_frag:lve,points_vert:cve,points_frag:uve,shadow_vert:dve,shadow_frag:fve,sprite_vert:hve,sprite_frag:pve},gt={common:{diffuse:{value:new ut(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Qt},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Qt}},envmap:{envMap:{value:null},envMapRotation:{value:new Qt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Qt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Qt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Qt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Qt},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Qt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Qt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Qt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Qt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ut(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ut(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0},uvTransform:{value:new Qt}},sprite:{diffuse:{value:new ut(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Qt},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0}}},ja={basic:{uniforms:Ss([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.fog]),vertexShader:mn.meshbasic_vert,fragmentShader:mn.meshbasic_frag},lambert:{uniforms:Ss([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,gt.lights,{emissive:{value:new ut(0)}}]),vertexShader:mn.meshlambert_vert,fragmentShader:mn.meshlambert_frag},phong:{uniforms:Ss([gt.common,gt.specularmap,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,gt.lights,{emissive:{value:new ut(0)},specular:{value:new ut(1118481)},shininess:{value:30}}]),vertexShader:mn.meshphong_vert,fragmentShader:mn.meshphong_frag},standard:{uniforms:Ss([gt.common,gt.envmap,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.roughnessmap,gt.metalnessmap,gt.fog,gt.lights,{emissive:{value:new ut(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:mn.meshphysical_vert,fragmentShader:mn.meshphysical_frag},toon:{uniforms:Ss([gt.common,gt.aomap,gt.lightmap,gt.emissivemap,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.gradientmap,gt.fog,gt.lights,{emissive:{value:new ut(0)}}]),vertexShader:mn.meshtoon_vert,fragmentShader:mn.meshtoon_frag},matcap:{uniforms:Ss([gt.common,gt.bumpmap,gt.normalmap,gt.displacementmap,gt.fog,{matcap:{value:null}}]),vertexShader:mn.meshmatcap_vert,fragmentShader:mn.meshmatcap_frag},points:{uniforms:Ss([gt.points,gt.fog]),vertexShader:mn.points_vert,fragmentShader:mn.points_frag},dashed:{uniforms:Ss([gt.common,gt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:mn.linedashed_vert,fragmentShader:mn.linedashed_frag},depth:{uniforms:Ss([gt.common,gt.displacementmap]),vertexShader:mn.depth_vert,fragmentShader:mn.depth_frag},normal:{uniforms:Ss([gt.common,gt.bumpmap,gt.normalmap,gt.displacementmap,{opacity:{value:1}}]),vertexShader:mn.meshnormal_vert,fragmentShader:mn.meshnormal_frag},sprite:{uniforms:Ss([gt.sprite,gt.fog]),vertexShader:mn.sprite_vert,fragmentShader:mn.sprite_frag},background:{uniforms:{uvTransform:{value:new Qt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:mn.background_vert,fragmentShader:mn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Qt}},vertexShader:mn.backgroundCube_vert,fragmentShader:mn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:mn.cube_vert,fragmentShader:mn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:mn.equirect_vert,fragmentShader:mn.equirect_frag},distanceRGBA:{uniforms:Ss([gt.common,gt.displacementmap,{referencePosition:{value:new X},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:mn.distanceRGBA_vert,fragmentShader:mn.distanceRGBA_frag},shadow:{uniforms:Ss([gt.lights,gt.fog,{color:{value:new ut(0)},opacity:{value:1}}]),vertexShader:mn.shadow_vert,fragmentShader:mn.shadow_frag}};ja.physical={uniforms:Ss([ja.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Qt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Qt},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Qt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Qt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Qt},sheen:{value:0},sheenColor:{value:new ut(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Qt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Qt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Qt},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Qt},attenuationDistance:{value:0},attenuationColor:{value:new ut(0)},specularColor:{value:new ut(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Qt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Qt},anisotropyVector:{value:new He},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Qt}}]),vertexShader:mn.meshphysical_vert,fragmentShader:mn.meshphysical_frag};const r_={r:0,b:0,g:0},If=new us,mve=new kt;function gve(t,e,n,r,i,s,o){const a=new ut(0);let l=s===!0?0:1,c,d,f=null,g=0,y=null;function x(M){let T=M.isScene===!0?M.background:null;return T&&T.isTexture&&(T=(M.backgroundBlurriness>0?n:e).get(T)),T}function S(M){let T=!1;const C=x(M);C===null?b(a,l):C&&C.isColor&&(b(C,1),T=!0);const O=t.xr.getEnvironmentBlendMode();O==="additive"?r.buffers.color.setClear(0,0,0,1,o):O==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(t.autoClear||T)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function w(M,T){const C=x(T);C&&(C.isCubeTexture||C.mapping===nv)?(d===void 0&&(d=new _r(new tp(1,1,1),new ta({name:"BackgroundCubeMaterial",uniforms:Ug(ja.backgroundCube.uniforms),vertexShader:ja.backgroundCube.vertexShader,fragmentShader:ja.backgroundCube.fragmentShader,side:ls,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(O,N,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),If.copy(T.backgroundRotation),If.x*=-1,If.y*=-1,If.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(If.y*=-1,If.z*=-1),d.material.uniforms.envMap.value=C,d.material.uniforms.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(mve.makeRotationFromEuler(If)),d.material.toneMapped=Ln.getTransfer(C.colorSpace)!==rr,(f!==C||g!==C.version||y!==t.toneMapping)&&(d.material.needsUpdate=!0,f=C,g=C.version,y=t.toneMapping),d.layers.enableAll(),M.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(c===void 0&&(c=new _r(new iv(2,2),new ta({name:"BackgroundMaterial",uniforms:Ug(ja.background.uniforms),vertexShader:ja.background.vertexShader,fragmentShader:ja.background.fragmentShader,side:Ul,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=C,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=Ln.getTransfer(C.colorSpace)!==rr,C.matrixAutoUpdate===!0&&C.updateMatrix(),c.material.uniforms.uvTransform.value.copy(C.matrix),(f!==C||g!==C.version||y!==t.toneMapping)&&(c.material.needsUpdate=!0,f=C,g=C.version,y=t.toneMapping),c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null))}function b(M,T){M.getRGB(r_,h6(t)),r.buffers.color.setClear(r_.r,r_.g,r_.b,T,o)}return{getClearColor:function(){return a},setClearColor:function(M,T=1){a.set(M),l=T,b(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(M){l=M,b(a,l)},render:S,addToRenderList:w}}function vve(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=g(null);let s=i,o=!1;function a(k,U,H,te,ee){let pe=!1;const ie=f(te,H,U);s!==ie&&(s=ie,c(s.object)),pe=y(k,te,H,ee),pe&&x(k,te,H,ee),ee!==null&&e.update(ee,t.ELEMENT_ARRAY_BUFFER),(pe||o)&&(o=!1,C(k,U,H,te),ee!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(ee).buffer))}function l(){return t.createVertexArray()}function c(k){return t.bindVertexArray(k)}function d(k){return t.deleteVertexArray(k)}function f(k,U,H){const te=H.wireframe===!0;let ee=r[k.id];ee===void 0&&(ee={},r[k.id]=ee);let pe=ee[U.id];pe===void 0&&(pe={},ee[U.id]=pe);let ie=pe[te];return ie===void 0&&(ie=g(l()),pe[te]=ie),ie}function g(k){const U=[],H=[],te=[];for(let ee=0;ee=0){const K=ee[B];let V=pe[B];if(V===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(V=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(V=k.instanceColor)),K===void 0||K.attribute!==V||V&&K.data!==V.data)return!0;ie++}return s.attributesNum!==ie||s.index!==te}function x(k,U,H,te){const ee={},pe=U.attributes;let ie=0;const fe=H.getAttributes();for(const B in fe)if(fe[B].location>=0){let K=pe[B];K===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(K=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(K=k.instanceColor));const V={};V.attribute=K,K&&K.data&&(V.data=K.data),ee[B]=V,ie++}s.attributes=ee,s.attributesNum=ie,s.index=te}function S(){const k=s.newAttributes;for(let U=0,H=k.length;U=0){let Q=ee[fe];if(Q===void 0&&(fe==="instanceMatrix"&&k.instanceMatrix&&(Q=k.instanceMatrix),fe==="instanceColor"&&k.instanceColor&&(Q=k.instanceColor)),Q!==void 0){const K=Q.normalized,V=Q.itemSize,q=e.get(Q);if(q===void 0)continue;const he=q.buffer,ae=q.type,ce=q.bytesPerElement,we=ae===t.INT||ae===t.UNSIGNED_INT||Q.gpuType===XS;if(Q.isInterleavedBufferAttribute){const Ee=Q.data,Xe=Ee.stride,Se=Q.offset;if(Ee.isInstancedInterleavedBuffer){for(let je=0;je0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const d=l(c);d!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const f=n.logarithmicDepthBuffer===!0,g=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(g===!0){const L=e.get("EXT_clip_control");L.clipControlEXT(L.LOWER_LEFT_EXT,L.ZERO_TO_ONE_EXT)}const y=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),x=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=t.getParameter(t.MAX_TEXTURE_SIZE),w=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),b=t.getParameter(t.MAX_VERTEX_ATTRIBS),M=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),T=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),O=x>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:g,maxTextures:y,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:w,maxAttributes:b,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:C,vertexTextures:O,maxSamples:N}}function bve(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new kc,a=new Qt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,g){const y=f.length!==0||g||r!==0||i;return i=g,r=f.length,y},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,g){n=d(f,g,0)},this.setState=function(f,g,y){const x=f.clippingPlanes,S=f.clipIntersection,w=f.clipShadows,b=t.get(f);if(!i||x===null||x.length===0||s&&!w)s?d(null):c();else{const M=s?0:r,T=M*4;let C=b.clippingState||null;l.value=C,C=d(x,g,T,y);for(let O=0;O!==T;++O)C[O]=n[O];b.clippingState=C,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=M}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(f,g,y,x){const S=f!==null?f.length:0;let w=null;if(S!==0){if(w=l.value,x!==!0||w===null){const b=y+S*4,M=g.matrixWorldInverse;a.getNormalMatrix(M),(w===null||w.length0){const c=new m6(l.height);return c.fromEquirectangularTexture(t,o),e.set(o,c),o.addEventListener("dispose",i),n(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Xc extends dx{constructor(e=-1,n=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const qm=4,lD=[.125,.215,.35,.446,.526,.582],Jf=20,bA=new Xc,cD=new ut;let _A=null,wA=0,SA=0,MA=!1;const Zf=(1+Math.sqrt(5))/2,Am=1/Zf,uD=[new X(-Zf,Am,0),new X(Zf,Am,0),new X(-Am,0,Zf),new X(Am,0,Zf),new X(0,Zf,-Am),new X(0,Zf,Am),new X(-1,1,-1),new X(1,1,-1),new X(-1,1,1),new X(1,1,1)];class JC{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,r=.1,i=100){_A=this._renderer.getRenderTarget(),wA=this._renderer.getActiveCubeFace(),SA=this._renderer.getActiveMipmapLevel(),MA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=hD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fD(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?T:0,T,T),d.setRenderTarget(i),S&&d.render(x,a),d.render(e,a)}x.geometry.dispose(),x.material.dispose(),d.toneMapping=g,d.autoClear=f,e.background=w}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===Jc||e.mapping===Cd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=hD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fD());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new _r(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;i_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,bA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;sJf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${Jf}`);const b=[];let M=0;for(let L=0;LT-qm?i-T+qm:0),N=4*(this._cubeSize-C);i_(n,O,N,3*C,2*C),l.setRenderTarget(n),l.render(f,bA)}}function wve(t){const e=[],n=[],r=[];let i=t;const s=t-qm+1+lD.length;for(let o=0;ot-qm?l=lD[o-t+qm-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),d=-c,f=1+c,g=[d,d,f,d,f,f,d,d,f,f,d,f],y=6,x=6,S=3,w=2,b=1,M=new Float32Array(S*x*y),T=new Float32Array(w*x*y),C=new Float32Array(b*x*y);for(let N=0;N2?0:-1,G=[L,F,0,L+2/3,F,0,L+2/3,F+1,0,L,F,0,L+2/3,F+1,0,L,F+1,0];M.set(G,S*x*N),T.set(g,w*x*N);const k=[N,N,N,N,N,N];C.set(k,b*x*N)}const O=new nn;O.setAttribute("position",new rn(M,S)),O.setAttribute("uv",new rn(T,w)),O.setAttribute("faceIndex",new rn(C,b)),e.push(O),i>qm&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function dD(t,e,n){const r=new Ga(t,e,n);return r.texture.mapping=nv,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function i_(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function Sve(t,e,n){const r=new Float32Array(Jf),i=new X(0,1,0);return new ta({name:"SphericalGaussianBlur",defines:{n:Jf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:IR(),fragmentShader:` precision mediump float; precision mediump int; @@ -4234,7 +4249,7 @@ void main() { } } - `,blending:$c,depthTest:!1,depthWrite:!1})}function uD(){return new ea({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:PR(),fragmentShader:` + `,blending:$c,depthTest:!1,depthWrite:!1})}function fD(){return new ta({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:IR(),fragmentShader:` precision mediump float; precision mediump int; @@ -4253,7 +4268,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:$c,depthTest:!1,depthWrite:!1})}function dD(){return new ea({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:PR(),fragmentShader:` + `,blending:$c,depthTest:!1,depthWrite:!1})}function hD(){return new ta({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:IR(),fragmentShader:` precision mediump float; precision mediump int; @@ -4269,7 +4284,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:$c,depthTest:!1,depthWrite:!1})}function PR(){return` + `,blending:$c,depthTest:!1,depthWrite:!1})}function IR(){return` precision mediump float; precision mediump int; @@ -4324,16 +4339,16 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function dve(t){let e=new WeakMap,n=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===Ay||l===Ty,d=l===Jc||l===Cd;if(c||d){let f=e.get(a);const m=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==m)return n===null&&(n=new KC(t)),f=c?n.fromEquirectangular(a,f):n.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const y=a.image;return c&&y&&y.height>0||d&&y&&i(y)?(n===null&&(n=new KC(t)),f=c?n.fromEquirectangular(a):n.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function i(a){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(O=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const N=new Float32Array(C*O*4*f),L=new JS(N,C,O,f);L.type=Js,L.needsUpdate=!0;const F=T*4;for(let k=0;k0)return t;const i=e*n;let s=hD[i];if(s===void 0&&(s=new Float32Array(i),hD[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function oi(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n0||d&&y&&i(y)?(n===null&&(n=new JC(t)),f=c?n.fromEquirectangular(a):n.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function i(a){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(O=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const N=new Float32Array(C*O*4*f),L=new tM(N,C,O,f);L.type=eo,L.needsUpdate=!0;const F=T*4;for(let k=0;k0)return t;const i=e*n;let s=mD[i];if(s===void 0&&(s=new Float32Array(i),mD[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function ai(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n":" "} ${a}: ${n[o]}`)}return r.join(` -`)}function d0e(t){const e=On.getPrimaries(On.workingColorSpace),n=On.getPrimaries(t);let r;switch(e===n?r="":e===Ny&&n===Ry?r="LinearDisplayP3ToLinearSRGB":e===Ry&&n===Ny&&(r="LinearSRGBToLinearDisplayP3"),t){case _i:case ux:return[r,"LinearTransferOETF"];case Fi:case QS:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function bD(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return n.toUpperCase()+` +`)}function M0e(t){const e=Ln.getPrimaries(Ln.workingColorSpace),n=Ln.getPrimaries(t);let r;switch(e===n?r="":e===Ny&&n===Ry?r="LinearDisplayP3ToLinearSRGB":e===Ry&&n===Ny&&(r="LinearSRGBToLinearDisplayP3"),t){case Si:case ux:return[r,"LinearTransferOETF"];case zi:case eM:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function wD(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return n.toUpperCase()+` `+i+` -`+u0e(t.getShaderSource(e),o)}else return i}function f0e(t,e){const n=d0e(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function h0e(t,e){let n;switch(e){case DV:n="Linear";break;case jV:n="Reinhard";break;case UV:n="Cineon";break;case dR:n="ACESFilmic";break;case zV:n="AgX";break;case BV:n="Neutral";break;case FV:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const i_=new X;function p0e(){On.getLuminanceCoefficients(i_);const t=i_.x.toFixed(4),e=i_.y.toFixed(4),n=i_.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(` -`)}function m0e(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(G0).join(` -`)}function g0e(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(` -`)}function v0e(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function YC(t){return t.replace(y0e,b0e)}const x0e=new Map;function b0e(t,e){let n=gn[e];if(n===void 0){const r=x0e.get(e);if(r!==void 0)n=gn[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return YC(n)}const _0e=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function SD(t){return t.replace(_0e,w0e)}function w0e(t,e,n,r){let i="";for(let s=parseInt(e);s/gm;function eP(t){return t.replace(N0e,k0e)}const I0e=new Map;function k0e(t,e){let n=mn[e];if(n===void 0){const r=I0e.get(e);if(r!==void 0)n=mn[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return eP(n)}const O0e=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function ED(t){return t.replace(O0e,L0e)}function L0e(t,e,n,r){let i="";for(let s=parseInt(e);s0&&(_+=` -`),w=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(G0).join(` +#define LOW_PRECISION`),e}function D0e(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===GS?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===K0?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===La&&(e="SHADOWMAP_TYPE_VSM"),e}function j0e(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Jc:case Cd:e="ENVMAP_TYPE_CUBE";break;case nv:e="ENVMAP_TYPE_CUBE_UV";break}return e}function U0e(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Cd:e="ENVMAP_MODE_REFRACTION";break}return e}function F0e(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case lx:e="ENVMAP_BLENDING_MULTIPLY";break;case UV:e="ENVMAP_BLENDING_MIX";break;case FV:e="ENVMAP_BLENDING_ADD";break}return e}function z0e(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:r,maxMip:n}}function B0e(t,e,n,r){const i=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=D0e(n),c=j0e(n),d=U0e(n),f=F0e(n),g=z0e(n),y=C0e(n),x=P0e(s),S=i.createProgram();let w,b,M=n.glslVersion?"#version "+n.glslVersion+` +`:"";n.isRawShaderMaterial?(w=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(G0).join(` `),w.length>0&&(w+=` -`)):(_=[MD(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`),b=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(G0).join(` +`),b.length>0&&(b+=` +`)):(w=[AD(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(G0).join(` -`),w=[MD(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Pl?"#define TONE_MAPPING":"",n.toneMapping!==Pl?gn.tonemapping_pars_fragment:"",n.toneMapping!==Pl?h0e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",gn.colorspace_pars_fragment,f0e("linearToOutputTexel",n.outputColorSpace),p0e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` +`),b=[AD(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",g?"#define CUBEUV_TEXEL_WIDTH "+g.texelWidth:"",g?"#define CUBEUV_TEXEL_HEIGHT "+g.texelHeight:"",g?"#define CUBEUV_MAX_MIP "+g.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Pl?"#define TONE_MAPPING":"",n.toneMapping!==Pl?mn.tonemapping_pars_fragment:"",n.toneMapping!==Pl?A0e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",mn.colorspace_pars_fragment,E0e("linearToOutputTexel",n.outputColorSpace),T0e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` `].filter(G0).join(` -`)),o=YC(o),o=_D(o,n),o=wD(o,n),a=YC(a),a=_D(a,n),a=wD(a,n),o=SD(o),a=SD(a),n.isRawShaderMaterial!==!0&&(E=`#version 300 es -`,_=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)),o=eP(o),o=SD(o,n),o=MD(o,n),a=eP(a),a=SD(a,n),a=MD(a,n),o=ED(o),a=ED(a),n.isRawShaderMaterial!==!0&&(M=`#version 300 es +`,w=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+_,w=["#define varying in",n.glslVersion===qC?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===qC?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`+w,b=["#define varying in",n.glslVersion===QC?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===QC?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` -`+w);const T=E+_+o,C=E+w+a,O=xD(i,i.VERTEX_SHADER,T),N=xD(i,i.FRAGMENT_SHADER,C);i.attachShader(S,O),i.attachShader(S,N),n.index0AttributeName!==void 0?i.bindAttribLocation(S,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(S,0,"position"),i.linkProgram(S);function L(U){if(t.debug.checkShaderErrors){const H=i.getProgramInfoLog(S).trim(),ne=i.getShaderInfoLog(O).trim(),ee=i.getShaderInfoLog(N).trim();let pe=!0,se=!0;if(i.getProgramParameter(S,i.LINK_STATUS)===!1)if(pe=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,S,O,N);else{const fe=bD(i,O,"vertex"),B=bD(i,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(S,i.VALIDATE_STATUS)+` +`+b);const T=M+w+o,C=M+b+a,O=_D(i,i.VERTEX_SHADER,T),N=_D(i,i.FRAGMENT_SHADER,C);i.attachShader(S,O),i.attachShader(S,N),n.index0AttributeName!==void 0?i.bindAttribLocation(S,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(S,0,"position"),i.linkProgram(S);function L(U){if(t.debug.checkShaderErrors){const H=i.getProgramInfoLog(S).trim(),te=i.getShaderInfoLog(O).trim(),ee=i.getShaderInfoLog(N).trim();let pe=!0,ie=!0;if(i.getProgramParameter(S,i.LINK_STATUS)===!1)if(pe=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,S,O,N);else{const fe=wD(i,O,"vertex"),B=wD(i,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(S,i.VALIDATE_STATUS)+` Material Name: `+U.name+` Material Type: `+U.type+` Program Info Log: `+H+` `+fe+` -`+B)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(ne===""||ee==="")&&(se=!1);se&&(U.diagnostics={runnable:pe,programLog:H,vertexShader:{log:ne,prefix:_},fragmentShader:{log:ee,prefix:w}})}i.deleteShader(O),i.deleteShader(N),F=new q_(i,S),G=v0e(i,S)}let F;this.getUniforms=function(){return F===void 0&&L(this),F};let G;this.getAttributes=function(){return G===void 0&&L(this),G};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(S,l0e)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=c0e++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=O,this.fragmentShader=N,this}let P0e=0;class R0e{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new N0e(e),n.set(e,r)),r}}class N0e{constructor(e){this.id=P0e++,this.code=e,this.usedTimes=0}}function I0e(t,e,n,r,i,s,o){const a=new Th,l=new R0e,c=new Set,d=[],f=i.logarithmicDepthBuffer,m=i.reverseDepthBuffer,y=i.vertexTextures;let x=i.precision;const S={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(k){return c.add(k),k===0?"uv":`uv${k}`}function w(k,U,H,ne,ee){const pe=ne.fog,se=ee.geometry,fe=k.isMeshStandardMaterial?ne.environment:null,B=(k.isMeshStandardMaterial?n:e).get(k.envMap||fe),Q=B&&B.mapping===nv?B.image.height:null,K=S[k.type];k.precision!==null&&(x=i.getMaxPrecision(k.precision),x!==k.precision&&console.warn("THREE.WebGLProgram.getParameters:",k.precision,"not supported, using",x,"instead."));const V=se.morphAttributes.position||se.morphAttributes.normal||se.morphAttributes.color,q=V!==void 0?V.length:0;let he=0;se.morphAttributes.position!==void 0&&(he=1),se.morphAttributes.normal!==void 0&&(he=2),se.morphAttributes.color!==void 0&&(he=3);let ae,ce,we,Ee;if(K){const dn=ja[K];ae=dn.vertexShader,ce=dn.fragmentShader}else ae=k.vertexShader,ce=k.fragmentShader,l.update(k),we=l.getVertexShaderID(k),Ee=l.getFragmentShaderID(k);const Xe=t.getRenderTarget(),Se=ee.isInstancedMesh===!0,je=ee.isBatchedMesh===!0,$e=!!k.map,ue=!!k.matcap,Z=!!B,Ge=!!k.aoMap,Oe=!!k.lightMap,We=!!k.bumpMap,tt=!!k.normalMap,wt=!!k.displacementMap,dt=!!k.emissiveMap,J=!!k.metalnessMap,$=!!k.roughnessMap,Me=k.anisotropy>0,Ue=k.clearcoat>0,He=k.dispersion>0,Be=k.iridescence>0,bt=k.sheen>0,it=k.transmission>0,ht=Me&&!!k.anisotropyMap,Gt=Ue&&!!k.clearcoatMap,Ke=Ue&&!!k.clearcoatNormalMap,re=Ue&&!!k.clearcoatRoughnessMap,Qe=Be&&!!k.iridescenceMap,St=Be&&!!k.iridescenceThicknessMap,mt=bt&&!!k.sheenColorMap,Qt=bt&&!!k.sheenRoughnessMap,de=!!k.specularMap,qe=!!k.specularColorMap,le=!!k.specularIntensityMap,Ye=it&&!!k.transmissionMap,Te=it&&!!k.thicknessMap,Fe=!!k.gradientMap,st=!!k.alphaMap,te=k.alphaTest>0,ze=!!k.alphaHash,Je=!!k.extensions;let At=Pl;k.toneMapped&&(Xe===null||Xe.isXRRenderTarget===!0)&&(At=t.toneMapping);const _t={shaderID:K,shaderType:k.type,shaderName:k.name,vertexShader:ae,fragmentShader:ce,defines:k.defines,customVertexShaderID:we,customFragmentShaderID:Ee,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:x,batching:je,batchingColor:je&&ee._colorsTexture!==null,instancing:Se,instancingColor:Se&&ee.instanceColor!==null,instancingMorph:Se&&ee.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:Xe===null?t.outputColorSpace:Xe.isXRRenderTarget===!0?Xe.texture.colorSpace:_i,alphaToCoverage:!!k.alphaToCoverage,map:$e,matcap:ue,envMap:Z,envMapMode:Z&&B.mapping,envMapCubeUVHeight:Q,aoMap:Ge,lightMap:Oe,bumpMap:We,normalMap:tt,displacementMap:y&&wt,emissiveMap:dt,normalMapObjectSpace:tt&&k.normalMapType===KV,normalMapTangentSpace:tt&&k.normalMapType===lu,metalnessMap:J,roughnessMap:$,anisotropy:Me,anisotropyMap:ht,clearcoat:Ue,clearcoatMap:Gt,clearcoatNormalMap:Ke,clearcoatRoughnessMap:re,dispersion:He,iridescence:Be,iridescenceMap:Qe,iridescenceThicknessMap:St,sheen:bt,sheenColorMap:mt,sheenRoughnessMap:Qt,specularMap:de,specularColorMap:qe,specularIntensityMap:le,transmission:it,transmissionMap:Ye,thicknessMap:Te,gradientMap:Fe,opaque:k.transparent===!1&&k.blending===Mh&&k.alphaToCoverage===!1,alphaMap:st,alphaTest:te,alphaHash:ze,combine:k.combine,mapUv:$e&&_(k.map.channel),aoMapUv:Ge&&_(k.aoMap.channel),lightMapUv:Oe&&_(k.lightMap.channel),bumpMapUv:We&&_(k.bumpMap.channel),normalMapUv:tt&&_(k.normalMap.channel),displacementMapUv:wt&&_(k.displacementMap.channel),emissiveMapUv:dt&&_(k.emissiveMap.channel),metalnessMapUv:J&&_(k.metalnessMap.channel),roughnessMapUv:$&&_(k.roughnessMap.channel),anisotropyMapUv:ht&&_(k.anisotropyMap.channel),clearcoatMapUv:Gt&&_(k.clearcoatMap.channel),clearcoatNormalMapUv:Ke&&_(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:re&&_(k.clearcoatRoughnessMap.channel),iridescenceMapUv:Qe&&_(k.iridescenceMap.channel),iridescenceThicknessMapUv:St&&_(k.iridescenceThicknessMap.channel),sheenColorMapUv:mt&&_(k.sheenColorMap.channel),sheenRoughnessMapUv:Qt&&_(k.sheenRoughnessMap.channel),specularMapUv:de&&_(k.specularMap.channel),specularColorMapUv:qe&&_(k.specularColorMap.channel),specularIntensityMapUv:le&&_(k.specularIntensityMap.channel),transmissionMapUv:Ye&&_(k.transmissionMap.channel),thicknessMapUv:Te&&_(k.thicknessMap.channel),alphaMapUv:st&&_(k.alphaMap.channel),vertexTangents:!!se.attributes.tangent&&(tt||Me),vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!se.attributes.color&&se.attributes.color.itemSize===4,pointsUvs:ee.isPoints===!0&&!!se.attributes.uv&&($e||st),fog:!!pe,useFog:k.fog===!0,fogExp2:!!pe&&pe.isFogExp2,flatShading:k.flatShading===!0,sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:m,skinning:ee.isSkinnedMesh===!0,morphTargets:se.morphAttributes.position!==void 0,morphNormals:se.morphAttributes.normal!==void 0,morphColors:se.morphAttributes.color!==void 0,morphTargetsCount:q,morphTextureStride:he,numDirLights:U.directional.length,numPointLights:U.point.length,numSpotLights:U.spot.length,numSpotLightMaps:U.spotLightMap.length,numRectAreaLights:U.rectArea.length,numHemiLights:U.hemi.length,numDirLightShadows:U.directionalShadowMap.length,numPointLightShadows:U.pointShadowMap.length,numSpotLightShadows:U.spotShadowMap.length,numSpotLightShadowsWithMaps:U.numSpotLightShadowsWithMaps,numLightProbes:U.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:k.dithering,shadowMapEnabled:t.shadowMap.enabled&&H.length>0,shadowMapType:t.shadowMap.type,toneMapping:At,decodeVideoTexture:$e&&k.map.isVideoTexture===!0&&On.getTransfer(k.map.colorSpace)===tr,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===bo,flipSided:k.side===ls,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:Je&&k.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Je&&k.extensions.multiDraw===!0||je)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:k.customProgramCacheKey()};return _t.vertexUv1s=c.has(1),_t.vertexUv2s=c.has(2),_t.vertexUv3s=c.has(3),c.clear(),_t}function E(k){const U=[];if(k.shaderID?U.push(k.shaderID):(U.push(k.customVertexShaderID),U.push(k.customFragmentShaderID)),k.defines!==void 0)for(const H in k.defines)U.push(H),U.push(k.defines[H]);return k.isRawShaderMaterial===!1&&(T(U,k),C(U,k),U.push(t.outputColorSpace)),U.push(k.customProgramCacheKey),U.join()}function T(k,U){k.push(U.precision),k.push(U.outputColorSpace),k.push(U.envMapMode),k.push(U.envMapCubeUVHeight),k.push(U.mapUv),k.push(U.alphaMapUv),k.push(U.lightMapUv),k.push(U.aoMapUv),k.push(U.bumpMapUv),k.push(U.normalMapUv),k.push(U.displacementMapUv),k.push(U.emissiveMapUv),k.push(U.metalnessMapUv),k.push(U.roughnessMapUv),k.push(U.anisotropyMapUv),k.push(U.clearcoatMapUv),k.push(U.clearcoatNormalMapUv),k.push(U.clearcoatRoughnessMapUv),k.push(U.iridescenceMapUv),k.push(U.iridescenceThicknessMapUv),k.push(U.sheenColorMapUv),k.push(U.sheenRoughnessMapUv),k.push(U.specularMapUv),k.push(U.specularColorMapUv),k.push(U.specularIntensityMapUv),k.push(U.transmissionMapUv),k.push(U.thicknessMapUv),k.push(U.combine),k.push(U.fogExp2),k.push(U.sizeAttenuation),k.push(U.morphTargetsCount),k.push(U.morphAttributeCount),k.push(U.numDirLights),k.push(U.numPointLights),k.push(U.numSpotLights),k.push(U.numSpotLightMaps),k.push(U.numHemiLights),k.push(U.numRectAreaLights),k.push(U.numDirLightShadows),k.push(U.numPointLightShadows),k.push(U.numSpotLightShadows),k.push(U.numSpotLightShadowsWithMaps),k.push(U.numLightProbes),k.push(U.shadowMapType),k.push(U.toneMapping),k.push(U.numClippingPlanes),k.push(U.numClipIntersection),k.push(U.depthPacking)}function C(k,U){a.disableAll(),U.supportsVertexTextures&&a.enable(0),U.instancing&&a.enable(1),U.instancingColor&&a.enable(2),U.instancingMorph&&a.enable(3),U.matcap&&a.enable(4),U.envMap&&a.enable(5),U.normalMapObjectSpace&&a.enable(6),U.normalMapTangentSpace&&a.enable(7),U.clearcoat&&a.enable(8),U.iridescence&&a.enable(9),U.alphaTest&&a.enable(10),U.vertexColors&&a.enable(11),U.vertexAlphas&&a.enable(12),U.vertexUv1s&&a.enable(13),U.vertexUv2s&&a.enable(14),U.vertexUv3s&&a.enable(15),U.vertexTangents&&a.enable(16),U.anisotropy&&a.enable(17),U.alphaHash&&a.enable(18),U.batching&&a.enable(19),U.dispersion&&a.enable(20),U.batchingColor&&a.enable(21),k.push(a.mask),a.disableAll(),U.fog&&a.enable(0),U.useFog&&a.enable(1),U.flatShading&&a.enable(2),U.logarithmicDepthBuffer&&a.enable(3),U.reverseDepthBuffer&&a.enable(4),U.skinning&&a.enable(5),U.morphTargets&&a.enable(6),U.morphNormals&&a.enable(7),U.morphColors&&a.enable(8),U.premultipliedAlpha&&a.enable(9),U.shadowMapEnabled&&a.enable(10),U.doubleSided&&a.enable(11),U.flipSided&&a.enable(12),U.useDepthPacking&&a.enable(13),U.dithering&&a.enable(14),U.transmission&&a.enable(15),U.sheen&&a.enable(16),U.opaque&&a.enable(17),U.pointsUvs&&a.enable(18),U.decodeVideoTexture&&a.enable(19),U.alphaToCoverage&&a.enable(20),k.push(a.mask)}function O(k){const U=S[k.type];let H;if(U){const ne=ja[U];H=CR.clone(ne.uniforms)}else H=k.uniforms;return H}function N(k,U){let H;for(let ne=0,ee=d.length;ne0?r.push(w):y.transparent===!0?i.push(w):n.push(w)}function l(f,m,y,x,S,_){const w=o(f,m,y,x,S,_);y.transmission>0?r.unshift(w):y.transparent===!0?i.unshift(w):n.unshift(w)}function c(f,m){n.length>1&&n.sort(f||O0e),r.length>1&&r.sort(m||ED),i.length>1&&i.sort(m||ED)}function d(){for(let f=e,m=t.length;f=s.length?(o=new AD,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function D0e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new X,color:new ut};break;case"SpotLight":n={position:new X,direction:new X,color:new ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new X,color:new ut,distance:0,decay:0};break;case"HemisphereLight":n={direction:new X,skyColor:new ut,groundColor:new ut};break;case"RectAreaLight":n={color:new ut,position:new X,halfWidth:new X,halfHeight:new X};break}return t[e.id]=n,n}}}function j0e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let U0e=0;function F0e(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function z0e(t){const e=new D0e,n=j0e(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new X);const i=new X,s=new kt,o=new kt;function a(c){let d=0,f=0,m=0;for(let G=0;G<9;G++)r.probe[G].set(0,0,0);let y=0,x=0,S=0,_=0,w=0,E=0,T=0,C=0,O=0,N=0,L=0;c.sort(F0e);for(let G=0,k=c.length;G0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=pt.LTC_FLOAT_1,r.rectAreaLTC2=pt.LTC_FLOAT_2):(r.rectAreaLTC1=pt.LTC_HALF_1,r.rectAreaLTC2=pt.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=m;const F=r.hash;(F.directionalLength!==y||F.pointLength!==x||F.spotLength!==S||F.rectAreaLength!==_||F.hemiLength!==w||F.numDirectionalShadows!==E||F.numPointShadows!==T||F.numSpotShadows!==C||F.numSpotMaps!==O||F.numLightProbes!==L)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=_,r.point.length=x,r.hemi.length=w,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=L,F.directionalLength=y,F.pointLength=x,F.spotLength=S,F.rectAreaLength=_,F.hemiLength=w,F.numDirectionalShadows=E,F.numPointShadows=T,F.numSpotShadows=C,F.numSpotMaps=O,F.numLightProbes=L,r.version=U0e++)}function l(c,d){let f=0,m=0,y=0,x=0,S=0;const _=d.matrixWorldInverse;for(let w=0,E=c.length;w=o.length?(a=new TD(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}class NR extends $r{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=XV,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class IR extends $r{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const H0e=`void main() { +`+B)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(te===""||ee==="")&&(ie=!1);ie&&(U.diagnostics={runnable:pe,programLog:H,vertexShader:{log:te,prefix:w},fragmentShader:{log:ee,prefix:b}})}i.deleteShader(O),i.deleteShader(N),F=new K_(i,S),G=R0e(i,S)}let F;this.getUniforms=function(){return F===void 0&&L(this),F};let G;this.getAttributes=function(){return G===void 0&&L(this),G};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(S,_0e)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=w0e++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=O,this.fragmentShader=N,this}let H0e=0;class V0e{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new G0e(e),n.set(e,r)),r}}class G0e{constructor(e){this.id=H0e++,this.code=e,this.usedTimes=0}}function W0e(t,e,n,r,i,s,o){const a=new Ch,l=new V0e,c=new Set,d=[],f=i.logarithmicDepthBuffer,g=i.reverseDepthBuffer,y=i.vertexTextures;let x=i.precision;const S={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function w(k){return c.add(k),k===0?"uv":`uv${k}`}function b(k,U,H,te,ee){const pe=te.fog,ie=ee.geometry,fe=k.isMeshStandardMaterial?te.environment:null,B=(k.isMeshStandardMaterial?n:e).get(k.envMap||fe),Q=B&&B.mapping===nv?B.image.height:null,K=S[k.type];k.precision!==null&&(x=i.getMaxPrecision(k.precision),x!==k.precision&&console.warn("THREE.WebGLProgram.getParameters:",k.precision,"not supported, using",x,"instead."));const V=ie.morphAttributes.position||ie.morphAttributes.normal||ie.morphAttributes.color,q=V!==void 0?V.length:0;let he=0;ie.morphAttributes.position!==void 0&&(he=1),ie.morphAttributes.normal!==void 0&&(he=2),ie.morphAttributes.color!==void 0&&(he=3);let ae,ce,we,Ee;if(K){const Ht=ja[K];ae=Ht.vertexShader,ce=Ht.fragmentShader}else ae=k.vertexShader,ce=k.fragmentShader,l.update(k),we=l.getVertexShaderID(k),Ee=l.getFragmentShaderID(k);const Xe=t.getRenderTarget(),Se=ee.isInstancedMesh===!0,je=ee.isBatchedMesh===!0,$e=!!k.map,ue=!!k.matcap,Z=!!B,Ve=!!k.aoMap,Oe=!!k.lightMap,Ge=!!k.bumpMap,et=!!k.normalMap,St=!!k.displacementMap,ft=!!k.emissiveMap,J=!!k.metalnessMap,$=!!k.roughnessMap,Me=k.anisotropy>0,Ue=k.clearcoat>0,Be=k.dispersion>0,ze=k.iridescence>0,wt=k.sheen>0,rt=k.transmission>0,pt=Me&&!!k.anisotropyMap,Wt=Ue&&!!k.clearcoatMap,Ke=Ue&&!!k.clearcoatNormalMap,ne=Ue&&!!k.clearcoatRoughnessMap,Qe=ze&&!!k.iridescenceMap,Mt=ze&&!!k.iridescenceThicknessMap,yt=wt&&!!k.sheenColorMap,Jt=wt&&!!k.sheenRoughnessMap,de=!!k.specularMap,qe=!!k.specularColorMap,le=!!k.specularIntensityMap,Ye=rt&&!!k.transmissionMap,Te=rt&&!!k.thicknessMap,Fe=!!k.gradientMap,st=!!k.alphaMap,mt=k.alphaTest>0,se=!!k.alphaHash,We=!!k.extensions;let it=Pl;k.toneMapped&&(Xe===null||Xe.isXRRenderTarget===!0)&&(it=t.toneMapping);const dt={shaderID:K,shaderType:k.type,shaderName:k.name,vertexShader:ae,fragmentShader:ce,defines:k.defines,customVertexShaderID:we,customFragmentShaderID:Ee,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:x,batching:je,batchingColor:je&&ee._colorsTexture!==null,instancing:Se,instancingColor:Se&&ee.instanceColor!==null,instancingMorph:Se&&ee.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:Xe===null?t.outputColorSpace:Xe.isXRRenderTarget===!0?Xe.texture.colorSpace:Si,alphaToCoverage:!!k.alphaToCoverage,map:$e,matcap:ue,envMap:Z,envMapMode:Z&&B.mapping,envMapCubeUVHeight:Q,aoMap:Ve,lightMap:Oe,bumpMap:Ge,normalMap:et,displacementMap:y&&St,emissiveMap:ft,normalMapObjectSpace:et&&k.normalMapType===JV,normalMapTangentSpace:et&&k.normalMapType===lu,metalnessMap:J,roughnessMap:$,anisotropy:Me,anisotropyMap:pt,clearcoat:Ue,clearcoatMap:Wt,clearcoatNormalMap:Ke,clearcoatRoughnessMap:ne,dispersion:Be,iridescence:ze,iridescenceMap:Qe,iridescenceThicknessMap:Mt,sheen:wt,sheenColorMap:yt,sheenRoughnessMap:Jt,specularMap:de,specularColorMap:qe,specularIntensityMap:le,transmission:rt,transmissionMap:Ye,thicknessMap:Te,gradientMap:Fe,opaque:k.transparent===!1&&k.blending===Eh&&k.alphaToCoverage===!1,alphaMap:st,alphaTest:mt,alphaHash:se,combine:k.combine,mapUv:$e&&w(k.map.channel),aoMapUv:Ve&&w(k.aoMap.channel),lightMapUv:Oe&&w(k.lightMap.channel),bumpMapUv:Ge&&w(k.bumpMap.channel),normalMapUv:et&&w(k.normalMap.channel),displacementMapUv:St&&w(k.displacementMap.channel),emissiveMapUv:ft&&w(k.emissiveMap.channel),metalnessMapUv:J&&w(k.metalnessMap.channel),roughnessMapUv:$&&w(k.roughnessMap.channel),anisotropyMapUv:pt&&w(k.anisotropyMap.channel),clearcoatMapUv:Wt&&w(k.clearcoatMap.channel),clearcoatNormalMapUv:Ke&&w(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ne&&w(k.clearcoatRoughnessMap.channel),iridescenceMapUv:Qe&&w(k.iridescenceMap.channel),iridescenceThicknessMapUv:Mt&&w(k.iridescenceThicknessMap.channel),sheenColorMapUv:yt&&w(k.sheenColorMap.channel),sheenRoughnessMapUv:Jt&&w(k.sheenRoughnessMap.channel),specularMapUv:de&&w(k.specularMap.channel),specularColorMapUv:qe&&w(k.specularColorMap.channel),specularIntensityMapUv:le&&w(k.specularIntensityMap.channel),transmissionMapUv:Ye&&w(k.transmissionMap.channel),thicknessMapUv:Te&&w(k.thicknessMap.channel),alphaMapUv:st&&w(k.alphaMap.channel),vertexTangents:!!ie.attributes.tangent&&(et||Me),vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!ie.attributes.color&&ie.attributes.color.itemSize===4,pointsUvs:ee.isPoints===!0&&!!ie.attributes.uv&&($e||st),fog:!!pe,useFog:k.fog===!0,fogExp2:!!pe&&pe.isFogExp2,flatShading:k.flatShading===!0,sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:g,skinning:ee.isSkinnedMesh===!0,morphTargets:ie.morphAttributes.position!==void 0,morphNormals:ie.morphAttributes.normal!==void 0,morphColors:ie.morphAttributes.color!==void 0,morphTargetsCount:q,morphTextureStride:he,numDirLights:U.directional.length,numPointLights:U.point.length,numSpotLights:U.spot.length,numSpotLightMaps:U.spotLightMap.length,numRectAreaLights:U.rectArea.length,numHemiLights:U.hemi.length,numDirLightShadows:U.directionalShadowMap.length,numPointLightShadows:U.pointShadowMap.length,numSpotLightShadows:U.spotShadowMap.length,numSpotLightShadowsWithMaps:U.numSpotLightShadowsWithMaps,numLightProbes:U.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:k.dithering,shadowMapEnabled:t.shadowMap.enabled&&H.length>0,shadowMapType:t.shadowMap.type,toneMapping:it,decodeVideoTexture:$e&&k.map.isVideoTexture===!0&&Ln.getTransfer(k.map.colorSpace)===rr,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===wo,flipSided:k.side===ls,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:We&&k.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(We&&k.extensions.multiDraw===!0||je)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:k.customProgramCacheKey()};return dt.vertexUv1s=c.has(1),dt.vertexUv2s=c.has(2),dt.vertexUv3s=c.has(3),c.clear(),dt}function M(k){const U=[];if(k.shaderID?U.push(k.shaderID):(U.push(k.customVertexShaderID),U.push(k.customFragmentShaderID)),k.defines!==void 0)for(const H in k.defines)U.push(H),U.push(k.defines[H]);return k.isRawShaderMaterial===!1&&(T(U,k),C(U,k),U.push(t.outputColorSpace)),U.push(k.customProgramCacheKey),U.join()}function T(k,U){k.push(U.precision),k.push(U.outputColorSpace),k.push(U.envMapMode),k.push(U.envMapCubeUVHeight),k.push(U.mapUv),k.push(U.alphaMapUv),k.push(U.lightMapUv),k.push(U.aoMapUv),k.push(U.bumpMapUv),k.push(U.normalMapUv),k.push(U.displacementMapUv),k.push(U.emissiveMapUv),k.push(U.metalnessMapUv),k.push(U.roughnessMapUv),k.push(U.anisotropyMapUv),k.push(U.clearcoatMapUv),k.push(U.clearcoatNormalMapUv),k.push(U.clearcoatRoughnessMapUv),k.push(U.iridescenceMapUv),k.push(U.iridescenceThicknessMapUv),k.push(U.sheenColorMapUv),k.push(U.sheenRoughnessMapUv),k.push(U.specularMapUv),k.push(U.specularColorMapUv),k.push(U.specularIntensityMapUv),k.push(U.transmissionMapUv),k.push(U.thicknessMapUv),k.push(U.combine),k.push(U.fogExp2),k.push(U.sizeAttenuation),k.push(U.morphTargetsCount),k.push(U.morphAttributeCount),k.push(U.numDirLights),k.push(U.numPointLights),k.push(U.numSpotLights),k.push(U.numSpotLightMaps),k.push(U.numHemiLights),k.push(U.numRectAreaLights),k.push(U.numDirLightShadows),k.push(U.numPointLightShadows),k.push(U.numSpotLightShadows),k.push(U.numSpotLightShadowsWithMaps),k.push(U.numLightProbes),k.push(U.shadowMapType),k.push(U.toneMapping),k.push(U.numClippingPlanes),k.push(U.numClipIntersection),k.push(U.depthPacking)}function C(k,U){a.disableAll(),U.supportsVertexTextures&&a.enable(0),U.instancing&&a.enable(1),U.instancingColor&&a.enable(2),U.instancingMorph&&a.enable(3),U.matcap&&a.enable(4),U.envMap&&a.enable(5),U.normalMapObjectSpace&&a.enable(6),U.normalMapTangentSpace&&a.enable(7),U.clearcoat&&a.enable(8),U.iridescence&&a.enable(9),U.alphaTest&&a.enable(10),U.vertexColors&&a.enable(11),U.vertexAlphas&&a.enable(12),U.vertexUv1s&&a.enable(13),U.vertexUv2s&&a.enable(14),U.vertexUv3s&&a.enable(15),U.vertexTangents&&a.enable(16),U.anisotropy&&a.enable(17),U.alphaHash&&a.enable(18),U.batching&&a.enable(19),U.dispersion&&a.enable(20),U.batchingColor&&a.enable(21),k.push(a.mask),a.disableAll(),U.fog&&a.enable(0),U.useFog&&a.enable(1),U.flatShading&&a.enable(2),U.logarithmicDepthBuffer&&a.enable(3),U.reverseDepthBuffer&&a.enable(4),U.skinning&&a.enable(5),U.morphTargets&&a.enable(6),U.morphNormals&&a.enable(7),U.morphColors&&a.enable(8),U.premultipliedAlpha&&a.enable(9),U.shadowMapEnabled&&a.enable(10),U.doubleSided&&a.enable(11),U.flipSided&&a.enable(12),U.useDepthPacking&&a.enable(13),U.dithering&&a.enable(14),U.transmission&&a.enable(15),U.sheen&&a.enable(16),U.opaque&&a.enable(17),U.pointsUvs&&a.enable(18),U.decodeVideoTexture&&a.enable(19),U.alphaToCoverage&&a.enable(20),k.push(a.mask)}function O(k){const U=S[k.type];let H;if(U){const te=ja[U];H=NR.clone(te.uniforms)}else H=k.uniforms;return H}function N(k,U){let H;for(let te=0,ee=d.length;te0?r.push(b):y.transparent===!0?i.push(b):n.push(b)}function l(f,g,y,x,S,w){const b=o(f,g,y,x,S,w);y.transmission>0?r.unshift(b):y.transparent===!0?i.unshift(b):n.unshift(b)}function c(f,g){n.length>1&&n.sort(f||X0e),r.length>1&&r.sort(g||TD),i.length>1&&i.sort(g||TD)}function d(){for(let f=e,g=t.length;f=s.length?(o=new CD,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function K0e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new X,color:new ut};break;case"SpotLight":n={position:new X,direction:new X,color:new ut,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new X,color:new ut,distance:0,decay:0};break;case"HemisphereLight":n={direction:new X,skyColor:new ut,groundColor:new ut};break;case"RectAreaLight":n={color:new ut,position:new X,halfWidth:new X,halfHeight:new X};break}return t[e.id]=n,n}}}function Y0e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let Z0e=0;function Q0e(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function J0e(t){const e=new K0e,n=Y0e(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new X);const i=new X,s=new kt,o=new kt;function a(c){let d=0,f=0,g=0;for(let G=0;G<9;G++)r.probe[G].set(0,0,0);let y=0,x=0,S=0,w=0,b=0,M=0,T=0,C=0,O=0,N=0,L=0;c.sort(Q0e);for(let G=0,k=c.length;G0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=gt.LTC_FLOAT_1,r.rectAreaLTC2=gt.LTC_FLOAT_2):(r.rectAreaLTC1=gt.LTC_HALF_1,r.rectAreaLTC2=gt.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=g;const F=r.hash;(F.directionalLength!==y||F.pointLength!==x||F.spotLength!==S||F.rectAreaLength!==w||F.hemiLength!==b||F.numDirectionalShadows!==M||F.numPointShadows!==T||F.numSpotShadows!==C||F.numSpotMaps!==O||F.numLightProbes!==L)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=w,r.point.length=x,r.hemi.length=b,r.directionalShadow.length=M,r.directionalShadowMap.length=M,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=M,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=L,F.directionalLength=y,F.pointLength=x,F.spotLength=S,F.rectAreaLength=w,F.hemiLength=b,F.numDirectionalShadows=M,F.numPointShadows=T,F.numSpotShadows=C,F.numSpotMaps=O,F.numLightProbes=L,r.version=Z0e++)}function l(c,d){let f=0,g=0,y=0,x=0,S=0;const w=d.matrixWorldInverse;for(let b=0,M=c.length;b=o.length?(a=new PD(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}class OR extends Xr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=ZV,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class LR extends Xr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const tye=`void main() { gl_Position = vec4( position, 1.0 ); -}`,V0e=`uniform sampler2D shadow_pass; +}`,nye=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -4402,12 +4417,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function G0e(t,e,n){let r=new hx;const i=new Ve,s=new Ve,o=new jn,a=new NR({depthPacking:qV}),l=new IR,c={},d=n.maxTextureSize,f={[Ul]:ls,[ls]:Ul,[bo]:bo},m=new ea({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ve},radius:{value:4}},vertexShader:H0e,fragmentShader:V0e}),y=m.clone();y.defines.HORIZONTAL_PASS=1;const x=new tn;x.setAttribute("position",new nn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new xr(x,m),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=HS;let w=this.type;this.render=function(N,L,F){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||N.length===0)return;const G=t.getRenderTarget(),k=t.getActiveCubeFace(),U=t.getActiveMipmapLevel(),H=t.state;H.setBlending($c),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);const ne=w!==La&&this.type===La,ee=w===La&&this.type!==La;for(let pe=0,se=N.length;ped||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/Q.x),i.x=s.x*Q.x,B.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/Q.y),i.y=s.y*Q.y,B.mapSize.y=s.y)),B.map===null||ne===!0||ee===!0){const V=this.type!==La?{minFilter:si,magFilter:si}:{};B.map!==null&&B.map.dispose(),B.map=new Ga(i.x,i.y,V),B.map.texture.name=fe.name+".shadowMap",B.camera.updateProjectionMatrix()}t.setRenderTarget(B.map),t.clear();const K=B.getViewportCount();for(let V=0;V0||L.map&&L.alphaTest>0){const H=k.uuid,ne=L.uuid;let ee=c[H];ee===void 0&&(ee={},c[H]=ee);let pe=ee[ne];pe===void 0&&(pe=k.clone(),ee[ne]=pe,L.addEventListener("dispose",O)),k=pe}if(k.visible=L.visible,k.wireframe=L.wireframe,G===La?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,F.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const H=t.properties.get(k);H.light=F}return k}function C(N,L,F,G,k){if(N.visible===!1)return;if(N.layers.test(L.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&k===La)&&(!N.frustumCulled||r.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,N.matrixWorld);const ne=e.update(N),ee=N.material;if(Array.isArray(ee)){const pe=ne.groups;for(let se=0,fe=pe.length;se=1):fe.indexOf("OpenGL ES")!==-1&&(se=parseFloat(/^OpenGL ES (\d)/.exec(fe)[1]),pe=se>=2);let B=null,Q={};const K=t.getParameter(t.SCISSOR_BOX),V=t.getParameter(t.VIEWPORT),q=new jn().fromArray(K),he=new jn().fromArray(V);function ae(le,Ye,Te,Fe){const st=new Uint8Array(4),te=t.createTexture();t.bindTexture(le,te),t.texParameteri(le,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(le,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let ze=0;zee?(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}function q0e(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}function K0e(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function ZC(t,e,n,r){const i=Y0e(r);switch(n){case mR:return t*e;case vR:return t*e;case yR:return t*e*2;case qS:return t*e/i.components*i.byteLength;case cx:return t*e/i.components*i.byteLength;case xR:return t*e*2/i.components*i.byteLength;case KS:return t*e*2/i.components*i.byteLength;case gR:return t*e*3/i.components*i.byteLength;case as:return t*e*4/i.components*i.byteLength;case YS:return t*e*4/i.components*i.byteLength;case Y0:case Z0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Q0:case J0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case c1:case d1:return Math.max(t,16)*Math.max(e,8)/4;case l1:case u1:return Math.max(t,8)*Math.max(e,8)/2;case f1:case h1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case p1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case m1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case g1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case v1:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case y1:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case x1:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case b1:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case _1:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case w1:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case S1:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case M1:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case E1:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case A1:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case T1:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case C1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case ey:case P1:case R1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case bR:case N1:return Math.ceil(t/4)*Math.ceil(e/4)*8;case I1:case k1:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function Y0e(t){switch(t){case Va:case fR:return{byteLength:1,components:1};case Og:case hR:case rv:return{byteLength:2,components:1};case $S:case XS:return{byteLength:2,components:4};case eu:case WS:case Js:return{byteLength:4,components:1};case pR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const Z0e={contain:X0e,cover:q0e,fill:K0e,getByteLength:ZC};function Q0e(t,e,n,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ve,d=new WeakMap;let f;const m=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(J,$){return y?new OffscreenCanvas(J,$):Oy("canvas")}function S(J,$,Me){let Ue=1;const He=dt(J);if((He.width>Me||He.height>Me)&&(Ue=Me/Math.max(He.width,He.height)),Ue<1)if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap||typeof VideoFrame<"u"&&J instanceof VideoFrame){const Be=Math.floor(Ue*He.width),bt=Math.floor(Ue*He.height);f===void 0&&(f=x(Be,bt));const it=$?x(Be,bt):f;return it.width=Be,it.height=bt,it.getContext("2d").drawImage(J,0,0,Be,bt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+He.width+"x"+He.height+") to ("+Be+"x"+bt+")."),it}else return"data"in J&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+He.width+"x"+He.height+")."),J;return J}function _(J){return J.generateMipmaps&&J.minFilter!==si&&J.minFilter!==Rr}function w(J){t.generateMipmap(J)}function E(J,$,Me,Ue,He=!1){if(J!==null){if(t[J]!==void 0)return t[J];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+J+"'")}let Be=$;if($===t.RED&&(Me===t.FLOAT&&(Be=t.R32F),Me===t.HALF_FLOAT&&(Be=t.R16F),Me===t.UNSIGNED_BYTE&&(Be=t.R8)),$===t.RED_INTEGER&&(Me===t.UNSIGNED_BYTE&&(Be=t.R8UI),Me===t.UNSIGNED_SHORT&&(Be=t.R16UI),Me===t.UNSIGNED_INT&&(Be=t.R32UI),Me===t.BYTE&&(Be=t.R8I),Me===t.SHORT&&(Be=t.R16I),Me===t.INT&&(Be=t.R32I)),$===t.RG&&(Me===t.FLOAT&&(Be=t.RG32F),Me===t.HALF_FLOAT&&(Be=t.RG16F),Me===t.UNSIGNED_BYTE&&(Be=t.RG8)),$===t.RG_INTEGER&&(Me===t.UNSIGNED_BYTE&&(Be=t.RG8UI),Me===t.UNSIGNED_SHORT&&(Be=t.RG16UI),Me===t.UNSIGNED_INT&&(Be=t.RG32UI),Me===t.BYTE&&(Be=t.RG8I),Me===t.SHORT&&(Be=t.RG16I),Me===t.INT&&(Be=t.RG32I)),$===t.RGB_INTEGER&&(Me===t.UNSIGNED_BYTE&&(Be=t.RGB8UI),Me===t.UNSIGNED_SHORT&&(Be=t.RGB16UI),Me===t.UNSIGNED_INT&&(Be=t.RGB32UI),Me===t.BYTE&&(Be=t.RGB8I),Me===t.SHORT&&(Be=t.RGB16I),Me===t.INT&&(Be=t.RGB32I)),$===t.RGBA_INTEGER&&(Me===t.UNSIGNED_BYTE&&(Be=t.RGBA8UI),Me===t.UNSIGNED_SHORT&&(Be=t.RGBA16UI),Me===t.UNSIGNED_INT&&(Be=t.RGBA32UI),Me===t.BYTE&&(Be=t.RGBA8I),Me===t.SHORT&&(Be=t.RGBA16I),Me===t.INT&&(Be=t.RGBA32I)),$===t.RGB&&Me===t.UNSIGNED_INT_5_9_9_9_REV&&(Be=t.RGB9_E5),$===t.RGBA){const bt=He?Py:On.getTransfer(Ue);Me===t.FLOAT&&(Be=t.RGBA32F),Me===t.HALF_FLOAT&&(Be=t.RGBA16F),Me===t.UNSIGNED_BYTE&&(Be=bt===tr?t.SRGB8_ALPHA8:t.RGBA8),Me===t.UNSIGNED_SHORT_4_4_4_4&&(Be=t.RGBA4),Me===t.UNSIGNED_SHORT_5_5_5_1&&(Be=t.RGB5_A1)}return(Be===t.R16F||Be===t.R32F||Be===t.RG16F||Be===t.RG32F||Be===t.RGBA16F||Be===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Be}function T(J,$){let Me;return J?$===null||$===eu||$===Fh?Me=t.DEPTH24_STENCIL8:$===Js?Me=t.DEPTH32F_STENCIL8:$===Og&&(Me=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):$===null||$===eu||$===Fh?Me=t.DEPTH_COMPONENT24:$===Js?Me=t.DEPTH_COMPONENT32F:$===Og&&(Me=t.DEPTH_COMPONENT16),Me}function C(J,$){return _(J)===!0||J.isFramebufferTexture&&J.minFilter!==si&&J.minFilter!==Rr?Math.log2(Math.max($.width,$.height))+1:J.mipmaps!==void 0&&J.mipmaps.length>0?J.mipmaps.length:J.isCompressedTexture&&Array.isArray(J.image)?$.mipmaps.length:1}function O(J){const $=J.target;$.removeEventListener("dispose",O),L($),$.isVideoTexture&&d.delete($)}function N(J){const $=J.target;$.removeEventListener("dispose",N),G($)}function L(J){const $=r.get(J);if($.__webglInit===void 0)return;const Me=J.source,Ue=m.get(Me);if(Ue){const He=Ue[$.__cacheKey];He.usedTimes--,He.usedTimes===0&&F(J),Object.keys(Ue).length===0&&m.delete(Me)}r.remove(J)}function F(J){const $=r.get(J);t.deleteTexture($.__webglTexture);const Me=J.source,Ue=m.get(Me);delete Ue[$.__cacheKey],o.memory.textures--}function G(J){const $=r.get(J);if(J.depthTexture&&J.depthTexture.dispose(),J.isWebGLCubeRenderTarget)for(let Ue=0;Ue<6;Ue++){if(Array.isArray($.__webglFramebuffer[Ue]))for(let He=0;He<$.__webglFramebuffer[Ue].length;He++)t.deleteFramebuffer($.__webglFramebuffer[Ue][He]);else t.deleteFramebuffer($.__webglFramebuffer[Ue]);$.__webglDepthbuffer&&t.deleteRenderbuffer($.__webglDepthbuffer[Ue])}else{if(Array.isArray($.__webglFramebuffer))for(let Ue=0;Ue<$.__webglFramebuffer.length;Ue++)t.deleteFramebuffer($.__webglFramebuffer[Ue]);else t.deleteFramebuffer($.__webglFramebuffer);if($.__webglDepthbuffer&&t.deleteRenderbuffer($.__webglDepthbuffer),$.__webglMultisampledFramebuffer&&t.deleteFramebuffer($.__webglMultisampledFramebuffer),$.__webglColorRenderbuffer)for(let Ue=0;Ue<$.__webglColorRenderbuffer.length;Ue++)$.__webglColorRenderbuffer[Ue]&&t.deleteRenderbuffer($.__webglColorRenderbuffer[Ue]);$.__webglDepthRenderbuffer&&t.deleteRenderbuffer($.__webglDepthRenderbuffer)}const Me=J.textures;for(let Ue=0,He=Me.length;Ue=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+J+" texture units while this GPU supports only "+i.maxTextures),k+=1,J}function ne(J){const $=[];return $.push(J.wrapS),$.push(J.wrapT),$.push(J.wrapR||0),$.push(J.magFilter),$.push(J.minFilter),$.push(J.anisotropy),$.push(J.internalFormat),$.push(J.format),$.push(J.type),$.push(J.generateMipmaps),$.push(J.premultiplyAlpha),$.push(J.flipY),$.push(J.unpackAlignment),$.push(J.colorSpace),$.join()}function ee(J,$){const Me=r.get(J);if(J.isVideoTexture&&tt(J),J.isRenderTargetTexture===!1&&J.version>0&&Me.__version!==J.version){const Ue=J.image;if(Ue===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ue.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{he(Me,J,$);return}}n.bindTexture(t.TEXTURE_2D,Me.__webglTexture,t.TEXTURE0+$)}function pe(J,$){const Me=r.get(J);if(J.version>0&&Me.__version!==J.version){he(Me,J,$);return}n.bindTexture(t.TEXTURE_2D_ARRAY,Me.__webglTexture,t.TEXTURE0+$)}function se(J,$){const Me=r.get(J);if(J.version>0&&Me.__version!==J.version){he(Me,J,$);return}n.bindTexture(t.TEXTURE_3D,Me.__webglTexture,t.TEXTURE0+$)}function fe(J,$){const Me=r.get(J);if(J.version>0&&Me.__version!==J.version){ae(Me,J,$);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Me.__webglTexture,t.TEXTURE0+$)}const B={[Pd]:t.REPEAT,[wo]:t.CLAMP_TO_EDGE,[kg]:t.MIRRORED_REPEAT},Q={[si]:t.NEAREST,[GS]:t.NEAREST_MIPMAP_NEAREST,[sh]:t.NEAREST_MIPMAP_LINEAR,[Rr]:t.LINEAR,[rg]:t.LINEAR_MIPMAP_NEAREST,[Yo]:t.LINEAR_MIPMAP_LINEAR},K={[YV]:t.NEVER,[n6]:t.ALWAYS,[ZV]:t.LESS,[SR]:t.LEQUAL,[QV]:t.EQUAL,[t6]:t.GEQUAL,[JV]:t.GREATER,[e6]:t.NOTEQUAL};function V(J,$){if($.type===Js&&e.has("OES_texture_float_linear")===!1&&($.magFilter===Rr||$.magFilter===rg||$.magFilter===sh||$.magFilter===Yo||$.minFilter===Rr||$.minFilter===rg||$.minFilter===sh||$.minFilter===Yo)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(J,t.TEXTURE_WRAP_S,B[$.wrapS]),t.texParameteri(J,t.TEXTURE_WRAP_T,B[$.wrapT]),(J===t.TEXTURE_3D||J===t.TEXTURE_2D_ARRAY)&&t.texParameteri(J,t.TEXTURE_WRAP_R,B[$.wrapR]),t.texParameteri(J,t.TEXTURE_MAG_FILTER,Q[$.magFilter]),t.texParameteri(J,t.TEXTURE_MIN_FILTER,Q[$.minFilter]),$.compareFunction&&(t.texParameteri(J,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(J,t.TEXTURE_COMPARE_FUNC,K[$.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if($.magFilter===si||$.minFilter!==sh&&$.minFilter!==Yo||$.type===Js&&e.has("OES_texture_float_linear")===!1)return;if($.anisotropy>1||r.get($).__currentAnisotropy){const Me=e.get("EXT_texture_filter_anisotropic");t.texParameterf(J,Me.TEXTURE_MAX_ANISOTROPY_EXT,Math.min($.anisotropy,i.getMaxAnisotropy())),r.get($).__currentAnisotropy=$.anisotropy}}}function q(J,$){let Me=!1;J.__webglInit===void 0&&(J.__webglInit=!0,$.addEventListener("dispose",O));const Ue=$.source;let He=m.get(Ue);He===void 0&&(He={},m.set(Ue,He));const Be=ne($);if(Be!==J.__cacheKey){He[Be]===void 0&&(He[Be]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,Me=!0),He[Be].usedTimes++;const bt=He[J.__cacheKey];bt!==void 0&&(He[J.__cacheKey].usedTimes--,bt.usedTimes===0&&F($)),J.__cacheKey=Be,J.__webglTexture=He[Be].texture}return Me}function he(J,$,Me){let Ue=t.TEXTURE_2D;($.isDataArrayTexture||$.isCompressedArrayTexture)&&(Ue=t.TEXTURE_2D_ARRAY),$.isData3DTexture&&(Ue=t.TEXTURE_3D);const He=q(J,$),Be=$.source;n.bindTexture(Ue,J.__webglTexture,t.TEXTURE0+Me);const bt=r.get(Be);if(Be.version!==bt.__version||He===!0){n.activeTexture(t.TEXTURE0+Me);const it=On.getPrimaries(On.workingColorSpace),ht=$.colorSpace===jc?null:On.getPrimaries($.colorSpace),Gt=$.colorSpace===jc||it===ht?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,$.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,$.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,$.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Gt);let Ke=S($.image,!1,i.maxTextureSize);Ke=wt($,Ke);const re=s.convert($.format,$.colorSpace),Qe=s.convert($.type);let St=E($.internalFormat,re,Qe,$.colorSpace,$.isVideoTexture);V(Ue,$);let mt;const Qt=$.mipmaps,de=$.isVideoTexture!==!0,qe=bt.__version===void 0||He===!0,le=Be.dataReady,Ye=C($,Ke);if($.isDepthTexture)St=T($.format===zh,$.type),qe&&(de?n.texStorage2D(t.TEXTURE_2D,1,St,Ke.width,Ke.height):n.texImage2D(t.TEXTURE_2D,0,St,Ke.width,Ke.height,0,re,Qe,null));else if($.isDataTexture)if(Qt.length>0){de&&qe&&n.texStorage2D(t.TEXTURE_2D,Ye,St,Qt[0].width,Qt[0].height);for(let Te=0,Fe=Qt.length;Te0){const st=ZC(mt.width,mt.height,$.format,$.type);for(const te of $.layerUpdates){const ze=mt.data.subarray(te*st/mt.data.BYTES_PER_ELEMENT,(te+1)*st/mt.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,te,mt.width,mt.height,1,re,ze,0,0)}$.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,mt.width,mt.height,Ke.depth,re,mt.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Te,St,mt.width,mt.height,Ke.depth,0,mt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else de?le&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,mt.width,mt.height,Ke.depth,re,Qe,mt.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Te,St,mt.width,mt.height,Ke.depth,0,re,Qe,mt.data)}else{de&&qe&&n.texStorage2D(t.TEXTURE_2D,Ye,St,Qt[0].width,Qt[0].height);for(let Te=0,Fe=Qt.length;Te0){const Te=ZC(Ke.width,Ke.height,$.format,$.type);for(const Fe of $.layerUpdates){const st=Ke.data.subarray(Fe*Te/Ke.data.BYTES_PER_ELEMENT,(Fe+1)*Te/Ke.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Fe,Ke.width,Ke.height,1,re,Qe,st)}$.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ke.width,Ke.height,Ke.depth,re,Qe,Ke.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,St,Ke.width,Ke.height,Ke.depth,0,re,Qe,Ke.data);else if($.isData3DTexture)de?(qe&&n.texStorage3D(t.TEXTURE_3D,Ye,St,Ke.width,Ke.height,Ke.depth),le&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ke.width,Ke.height,Ke.depth,re,Qe,Ke.data)):n.texImage3D(t.TEXTURE_3D,0,St,Ke.width,Ke.height,Ke.depth,0,re,Qe,Ke.data);else if($.isFramebufferTexture){if(qe)if(de)n.texStorage2D(t.TEXTURE_2D,Ye,St,Ke.width,Ke.height);else{let Te=Ke.width,Fe=Ke.height;for(let st=0;st>=1,Fe>>=1}}else if(Qt.length>0){if(de&&qe){const Te=dt(Qt[0]);n.texStorage2D(t.TEXTURE_2D,Ye,St,Te.width,Te.height)}for(let Te=0,Fe=Qt.length;Te0&&Ye++;const Fe=dt(re[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Ye,Qt,Fe.width,Fe.height)}for(let Fe=0;Fe<6;Fe++)if(Ke){de?le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Fe,0,0,0,re[Fe].width,re[Fe].height,St,mt,re[Fe].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Fe,0,Qt,re[Fe].width,re[Fe].height,0,St,mt,re[Fe].data);for(let st=0;st>Be),re=Math.max(1,$.height>>Be);He===t.TEXTURE_3D||He===t.TEXTURE_2D_ARRAY?n.texImage3D(He,Be,ht,Ke,re,$.depth,0,bt,it,null):n.texImage2D(He,Be,ht,Ke,re,0,bt,it,null)}n.bindFramebuffer(t.FRAMEBUFFER,J),We($)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Ue,He,r.get(Me).__webglTexture,0,Oe($)):(He===t.TEXTURE_2D||He>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&He<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Ue,He,r.get(Me).__webglTexture,Be),n.bindFramebuffer(t.FRAMEBUFFER,null)}function we(J,$,Me){if(t.bindRenderbuffer(t.RENDERBUFFER,J),$.depthBuffer){const Ue=$.depthTexture,He=Ue&&Ue.isDepthTexture?Ue.type:null,Be=T($.stencilBuffer,He),bt=$.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,it=Oe($);We($)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,it,Be,$.width,$.height):Me?t.renderbufferStorageMultisample(t.RENDERBUFFER,it,Be,$.width,$.height):t.renderbufferStorage(t.RENDERBUFFER,Be,$.width,$.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,bt,t.RENDERBUFFER,J)}else{const Ue=$.textures;for(let He=0;He{delete $.__boundDepthTexture,delete $.__depthDisposeCallback,Ue.removeEventListener("dispose",He)};Ue.addEventListener("dispose",He),$.__depthDisposeCallback=He}$.__boundDepthTexture=Ue}if(J.depthTexture&&!$.__autoAllocateDepthBuffer){if(Me)throw new Error("target.depthTexture not supported in Cube render targets");Ee($.__webglFramebuffer,J)}else if(Me){$.__webglDepthbuffer=[];for(let Ue=0;Ue<6;Ue++)if(n.bindFramebuffer(t.FRAMEBUFFER,$.__webglFramebuffer[Ue]),$.__webglDepthbuffer[Ue]===void 0)$.__webglDepthbuffer[Ue]=t.createRenderbuffer(),we($.__webglDepthbuffer[Ue],J,!1);else{const He=J.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Be=$.__webglDepthbuffer[Ue];t.bindRenderbuffer(t.RENDERBUFFER,Be),t.framebufferRenderbuffer(t.FRAMEBUFFER,He,t.RENDERBUFFER,Be)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,$.__webglFramebuffer),$.__webglDepthbuffer===void 0)$.__webglDepthbuffer=t.createRenderbuffer(),we($.__webglDepthbuffer,J,!1);else{const Ue=J.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,He=$.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,He),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ue,t.RENDERBUFFER,He)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Se(J,$,Me){const Ue=r.get(J);$!==void 0&&ce(Ue.__webglFramebuffer,J,J.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Me!==void 0&&Xe(J)}function je(J){const $=J.texture,Me=r.get(J),Ue=r.get($);J.addEventListener("dispose",N);const He=J.textures,Be=J.isWebGLCubeRenderTarget===!0,bt=He.length>1;if(bt||(Ue.__webglTexture===void 0&&(Ue.__webglTexture=t.createTexture()),Ue.__version=$.version,o.memory.textures++),Be){Me.__webglFramebuffer=[];for(let it=0;it<6;it++)if($.mipmaps&&$.mipmaps.length>0){Me.__webglFramebuffer[it]=[];for(let ht=0;ht<$.mipmaps.length;ht++)Me.__webglFramebuffer[it][ht]=t.createFramebuffer()}else Me.__webglFramebuffer[it]=t.createFramebuffer()}else{if($.mipmaps&&$.mipmaps.length>0){Me.__webglFramebuffer=[];for(let it=0;it<$.mipmaps.length;it++)Me.__webglFramebuffer[it]=t.createFramebuffer()}else Me.__webglFramebuffer=t.createFramebuffer();if(bt)for(let it=0,ht=He.length;it0&&We(J)===!1){Me.__webglMultisampledFramebuffer=t.createFramebuffer(),Me.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Me.__webglMultisampledFramebuffer);for(let it=0;it0)for(let ht=0;ht<$.mipmaps.length;ht++)ce(Me.__webglFramebuffer[it][ht],J,$,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+it,ht);else ce(Me.__webglFramebuffer[it],J,$,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+it,0);_($)&&w(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(bt){for(let it=0,ht=He.length;it0)for(let ht=0;ht<$.mipmaps.length;ht++)ce(Me.__webglFramebuffer[ht],J,$,t.COLOR_ATTACHMENT0,it,ht);else ce(Me.__webglFramebuffer,J,$,t.COLOR_ATTACHMENT0,it,0);_($)&&w(it),n.unbindTexture()}J.depthBuffer&&Xe(J)}function $e(J){const $=J.textures;for(let Me=0,Ue=$.length;Me0){if(We(J)===!1){const $=J.textures,Me=J.width,Ue=J.height;let He=t.COLOR_BUFFER_BIT;const Be=J.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,bt=r.get(J),it=$.length>1;if(it)for(let ht=0;ht<$.length;ht++)n.bindFramebuffer(t.FRAMEBUFFER,bt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ht,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,bt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+ht,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,bt.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,bt.__webglFramebuffer);for(let ht=0;ht<$.length;ht++){if(J.resolveDepthBuffer&&(J.depthBuffer&&(He|=t.DEPTH_BUFFER_BIT),J.stencilBuffer&&J.resolveStencilBuffer&&(He|=t.STENCIL_BUFFER_BIT)),it){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,bt.__webglColorRenderbuffer[ht]);const Gt=r.get($[ht]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Gt,0)}t.blitFramebuffer(0,0,Me,Ue,0,0,Me,Ue,He,t.NEAREST),l===!0&&(ue.length=0,Z.length=0,ue.push(t.COLOR_ATTACHMENT0+ht),J.depthBuffer&&J.resolveDepthBuffer===!1&&(ue.push(Be),Z.push(Be),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Z)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,ue))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),it)for(let ht=0;ht<$.length;ht++){n.bindFramebuffer(t.FRAMEBUFFER,bt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+ht,t.RENDERBUFFER,bt.__webglColorRenderbuffer[ht]);const Gt=r.get($[ht]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,bt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+ht,t.TEXTURE_2D,Gt,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,bt.__webglMultisampledFramebuffer)}else if(J.depthBuffer&&J.resolveDepthBuffer===!1&&l){const $=J.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[$])}}}function Oe(J){return Math.min(i.maxSamples,J.samples)}function We(J){const $=r.get(J);return J.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&$.__useRenderToTexture!==!1}function tt(J){const $=o.render.frame;d.get(J)!==$&&(d.set(J,$),J.update())}function wt(J,$){const Me=J.colorSpace,Ue=J.format,He=J.type;return J.isCompressedTexture===!0||J.isVideoTexture===!0||Me!==_i&&Me!==jc&&(On.getTransfer(Me)===tr?(Ue!==as||He!==Va)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Me)),$}function dt(J){return typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement?(c.width=J.naturalWidth||J.width,c.height=J.naturalHeight||J.height):typeof VideoFrame<"u"&&J instanceof VideoFrame?(c.width=J.displayWidth,c.height=J.displayHeight):(c.width=J.width,c.height=J.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=U,this.setTexture2D=ee,this.setTexture2DArray=pe,this.setTexture3D=se,this.setTextureCube=fe,this.rebindTextures=Se,this.setupRenderTarget=je,this.updateRenderTargetMipmap=$e,this.updateMultisampleRenderTarget=Ge,this.setupDepthRenderbuffer=Xe,this.setupFrameBufferTexture=ce,this.useMultisampledRTT=We}function v6(t,e){function n(r,i=jc){let s;const o=On.getTransfer(i);if(r===Va)return t.UNSIGNED_BYTE;if(r===$S)return t.UNSIGNED_SHORT_4_4_4_4;if(r===XS)return t.UNSIGNED_SHORT_5_5_5_1;if(r===pR)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===fR)return t.BYTE;if(r===hR)return t.SHORT;if(r===Og)return t.UNSIGNED_SHORT;if(r===WS)return t.INT;if(r===eu)return t.UNSIGNED_INT;if(r===Js)return t.FLOAT;if(r===rv)return t.HALF_FLOAT;if(r===mR)return t.ALPHA;if(r===gR)return t.RGB;if(r===as)return t.RGBA;if(r===vR)return t.LUMINANCE;if(r===yR)return t.LUMINANCE_ALPHA;if(r===Eh)return t.DEPTH_COMPONENT;if(r===zh)return t.DEPTH_STENCIL;if(r===qS)return t.RED;if(r===cx)return t.RED_INTEGER;if(r===xR)return t.RG;if(r===KS)return t.RG_INTEGER;if(r===YS)return t.RGBA_INTEGER;if(r===Y0||r===Z0||r===Q0||r===J0)if(o===tr)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Y0)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Z0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===J0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Y0)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Z0)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===J0)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===l1||r===c1||r===u1||r===d1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===l1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===c1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===u1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===d1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===f1||r===h1||r===p1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===f1||r===h1)return o===tr?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===p1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===m1||r===g1||r===v1||r===y1||r===x1||r===b1||r===_1||r===w1||r===S1||r===M1||r===E1||r===A1||r===T1||r===C1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===m1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===g1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===v1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===y1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===x1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===b1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===_1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===w1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===S1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===M1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===E1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===A1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===T1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===C1)return o===tr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===ey||r===P1||r===R1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===ey)return o===tr?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===P1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===R1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===bR||r===N1||r===I1||r===k1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===ey)return s.COMPRESSED_RED_RGTC1_EXT;if(r===N1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===I1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===k1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Fh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class y6 extends Pr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ps extends yn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const J0e={type:"move"};class wA{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ps,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ps,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ps,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const S of e.hand.values()){const _=n.getJointPose(S,r),w=this._getHandJoint(c,S);_!==null&&(w.matrix.fromArray(_.transform.matrix),w.matrix.decompose(w.position,w.rotation,w.scale),w.matrixWorldNeedsUpdate=!0,w.jointRadius=_.radius),w.visible=_!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],m=d.position.distanceTo(f.position),y=.02,x=.005;c.inputState.pinching&&m>y+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&m<=y-x&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(J0e)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Ps;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const eye=` +}`;function rye(t,e,n){let r=new hx;const i=new He,s=new He,o=new Un,a=new OR({depthPacking:QV}),l=new LR,c={},d=n.maxTextureSize,f={[Ul]:ls,[ls]:Ul,[wo]:wo},g=new ta({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new He},radius:{value:4}},vertexShader:tye,fragmentShader:nye}),y=g.clone();y.defines.HORIZONTAL_PASS=1;const x=new nn;x.setAttribute("position",new rn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new _r(x,g),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=GS;let b=this.type;this.render=function(N,L,F){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||N.length===0)return;const G=t.getRenderTarget(),k=t.getActiveCubeFace(),U=t.getActiveMipmapLevel(),H=t.state;H.setBlending($c),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);const te=b!==La&&this.type===La,ee=b===La&&this.type!==La;for(let pe=0,ie=N.length;ped||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/Q.x),i.x=s.x*Q.x,B.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/Q.y),i.y=s.y*Q.y,B.mapSize.y=s.y)),B.map===null||te===!0||ee===!0){const V=this.type!==La?{minFilter:oi,magFilter:oi}:{};B.map!==null&&B.map.dispose(),B.map=new Ga(i.x,i.y,V),B.map.texture.name=fe.name+".shadowMap",B.camera.updateProjectionMatrix()}t.setRenderTarget(B.map),t.clear();const K=B.getViewportCount();for(let V=0;V0||L.map&&L.alphaTest>0){const H=k.uuid,te=L.uuid;let ee=c[H];ee===void 0&&(ee={},c[H]=ee);let pe=ee[te];pe===void 0&&(pe=k.clone(),ee[te]=pe,L.addEventListener("dispose",O)),k=pe}if(k.visible=L.visible,k.wireframe=L.wireframe,G===La?k.side=L.shadowSide!==null?L.shadowSide:L.side:k.side=L.shadowSide!==null?L.shadowSide:f[L.side],k.alphaMap=L.alphaMap,k.alphaTest=L.alphaTest,k.map=L.map,k.clipShadows=L.clipShadows,k.clippingPlanes=L.clippingPlanes,k.clipIntersection=L.clipIntersection,k.displacementMap=L.displacementMap,k.displacementScale=L.displacementScale,k.displacementBias=L.displacementBias,k.wireframeLinewidth=L.wireframeLinewidth,k.linewidth=L.linewidth,F.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const H=t.properties.get(k);H.light=F}return k}function C(N,L,F,G,k){if(N.visible===!1)return;if(N.layers.test(L.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&k===La)&&(!N.frustumCulled||r.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,N.matrixWorld);const te=e.update(N),ee=N.material;if(Array.isArray(ee)){const pe=te.groups;for(let ie=0,fe=pe.length;ie=1):fe.indexOf("OpenGL ES")!==-1&&(ie=parseFloat(/^OpenGL ES (\d)/.exec(fe)[1]),pe=ie>=2);let B=null,Q={};const K=t.getParameter(t.SCISSOR_BOX),V=t.getParameter(t.VIEWPORT),q=new Un().fromArray(K),he=new Un().fromArray(V);function ae(le,Ye,Te,Fe){const st=new Uint8Array(4),mt=t.createTexture();t.bindTexture(le,mt),t.texParameteri(le,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(le,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let se=0;see?(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}function aye(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}function lye(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function tP(t,e,n,r){const i=cye(r);switch(n){case yR:return t*e;case bR:return t*e;case _R:return t*e*2;case YS:return t*e/i.components*i.byteLength;case cx:return t*e/i.components*i.byteLength;case wR:return t*e*2/i.components*i.byteLength;case ZS:return t*e*2/i.components*i.byteLength;case xR:return t*e*3/i.components*i.byteLength;case as:return t*e*4/i.components*i.byteLength;case QS:return t*e*4/i.components*i.byteLength;case Y0:case Z0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Q0:case J0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case u1:case f1:return Math.max(t,16)*Math.max(e,8)/4;case c1:case d1:return Math.max(t,8)*Math.max(e,8)/2;case h1:case p1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case m1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case g1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case v1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case y1:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case x1:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case b1:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case _1:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case w1:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case S1:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case M1:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case E1:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case A1:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case T1:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case C1:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case P1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case ey:case R1:case N1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case SR:case I1:return Math.ceil(t/4)*Math.ceil(e/4)*8;case k1:case O1:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function cye(t){switch(t){case Va:case mR:return{byteLength:1,components:1};case Og:case gR:case rv:return{byteLength:2,components:1};case qS:case KS:return{byteLength:2,components:4};case eu:case XS:case eo:return{byteLength:4,components:1};case vR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const uye={contain:oye,cover:aye,fill:lye,getByteLength:tP};function dye(t,e,n,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new He,d=new WeakMap;let f;const g=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(J,$){return y?new OffscreenCanvas(J,$):Oy("canvas")}function S(J,$,Me){let Ue=1;const Be=ft(J);if((Be.width>Me||Be.height>Me)&&(Ue=Me/Math.max(Be.width,Be.height)),Ue<1)if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap||typeof VideoFrame<"u"&&J instanceof VideoFrame){const ze=Math.floor(Ue*Be.width),wt=Math.floor(Ue*Be.height);f===void 0&&(f=x(ze,wt));const rt=$?x(ze,wt):f;return rt.width=ze,rt.height=wt,rt.getContext("2d").drawImage(J,0,0,ze,wt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Be.width+"x"+Be.height+") to ("+ze+"x"+wt+")."),rt}else return"data"in J&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Be.width+"x"+Be.height+")."),J;return J}function w(J){return J.generateMipmaps&&J.minFilter!==oi&&J.minFilter!==Ir}function b(J){t.generateMipmap(J)}function M(J,$,Me,Ue,Be=!1){if(J!==null){if(t[J]!==void 0)return t[J];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+J+"'")}let ze=$;if($===t.RED&&(Me===t.FLOAT&&(ze=t.R32F),Me===t.HALF_FLOAT&&(ze=t.R16F),Me===t.UNSIGNED_BYTE&&(ze=t.R8)),$===t.RED_INTEGER&&(Me===t.UNSIGNED_BYTE&&(ze=t.R8UI),Me===t.UNSIGNED_SHORT&&(ze=t.R16UI),Me===t.UNSIGNED_INT&&(ze=t.R32UI),Me===t.BYTE&&(ze=t.R8I),Me===t.SHORT&&(ze=t.R16I),Me===t.INT&&(ze=t.R32I)),$===t.RG&&(Me===t.FLOAT&&(ze=t.RG32F),Me===t.HALF_FLOAT&&(ze=t.RG16F),Me===t.UNSIGNED_BYTE&&(ze=t.RG8)),$===t.RG_INTEGER&&(Me===t.UNSIGNED_BYTE&&(ze=t.RG8UI),Me===t.UNSIGNED_SHORT&&(ze=t.RG16UI),Me===t.UNSIGNED_INT&&(ze=t.RG32UI),Me===t.BYTE&&(ze=t.RG8I),Me===t.SHORT&&(ze=t.RG16I),Me===t.INT&&(ze=t.RG32I)),$===t.RGB_INTEGER&&(Me===t.UNSIGNED_BYTE&&(ze=t.RGB8UI),Me===t.UNSIGNED_SHORT&&(ze=t.RGB16UI),Me===t.UNSIGNED_INT&&(ze=t.RGB32UI),Me===t.BYTE&&(ze=t.RGB8I),Me===t.SHORT&&(ze=t.RGB16I),Me===t.INT&&(ze=t.RGB32I)),$===t.RGBA_INTEGER&&(Me===t.UNSIGNED_BYTE&&(ze=t.RGBA8UI),Me===t.UNSIGNED_SHORT&&(ze=t.RGBA16UI),Me===t.UNSIGNED_INT&&(ze=t.RGBA32UI),Me===t.BYTE&&(ze=t.RGBA8I),Me===t.SHORT&&(ze=t.RGBA16I),Me===t.INT&&(ze=t.RGBA32I)),$===t.RGB&&Me===t.UNSIGNED_INT_5_9_9_9_REV&&(ze=t.RGB9_E5),$===t.RGBA){const wt=Be?Py:Ln.getTransfer(Ue);Me===t.FLOAT&&(ze=t.RGBA32F),Me===t.HALF_FLOAT&&(ze=t.RGBA16F),Me===t.UNSIGNED_BYTE&&(ze=wt===rr?t.SRGB8_ALPHA8:t.RGBA8),Me===t.UNSIGNED_SHORT_4_4_4_4&&(ze=t.RGBA4),Me===t.UNSIGNED_SHORT_5_5_5_1&&(ze=t.RGB5_A1)}return(ze===t.R16F||ze===t.R32F||ze===t.RG16F||ze===t.RG32F||ze===t.RGBA16F||ze===t.RGBA32F)&&e.get("EXT_color_buffer_float"),ze}function T(J,$){let Me;return J?$===null||$===eu||$===zh?Me=t.DEPTH24_STENCIL8:$===eo?Me=t.DEPTH32F_STENCIL8:$===Og&&(Me=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):$===null||$===eu||$===zh?Me=t.DEPTH_COMPONENT24:$===eo?Me=t.DEPTH_COMPONENT32F:$===Og&&(Me=t.DEPTH_COMPONENT16),Me}function C(J,$){return w(J)===!0||J.isFramebufferTexture&&J.minFilter!==oi&&J.minFilter!==Ir?Math.log2(Math.max($.width,$.height))+1:J.mipmaps!==void 0&&J.mipmaps.length>0?J.mipmaps.length:J.isCompressedTexture&&Array.isArray(J.image)?$.mipmaps.length:1}function O(J){const $=J.target;$.removeEventListener("dispose",O),L($),$.isVideoTexture&&d.delete($)}function N(J){const $=J.target;$.removeEventListener("dispose",N),G($)}function L(J){const $=r.get(J);if($.__webglInit===void 0)return;const Me=J.source,Ue=g.get(Me);if(Ue){const Be=Ue[$.__cacheKey];Be.usedTimes--,Be.usedTimes===0&&F(J),Object.keys(Ue).length===0&&g.delete(Me)}r.remove(J)}function F(J){const $=r.get(J);t.deleteTexture($.__webglTexture);const Me=J.source,Ue=g.get(Me);delete Ue[$.__cacheKey],o.memory.textures--}function G(J){const $=r.get(J);if(J.depthTexture&&J.depthTexture.dispose(),J.isWebGLCubeRenderTarget)for(let Ue=0;Ue<6;Ue++){if(Array.isArray($.__webglFramebuffer[Ue]))for(let Be=0;Be<$.__webglFramebuffer[Ue].length;Be++)t.deleteFramebuffer($.__webglFramebuffer[Ue][Be]);else t.deleteFramebuffer($.__webglFramebuffer[Ue]);$.__webglDepthbuffer&&t.deleteRenderbuffer($.__webglDepthbuffer[Ue])}else{if(Array.isArray($.__webglFramebuffer))for(let Ue=0;Ue<$.__webglFramebuffer.length;Ue++)t.deleteFramebuffer($.__webglFramebuffer[Ue]);else t.deleteFramebuffer($.__webglFramebuffer);if($.__webglDepthbuffer&&t.deleteRenderbuffer($.__webglDepthbuffer),$.__webglMultisampledFramebuffer&&t.deleteFramebuffer($.__webglMultisampledFramebuffer),$.__webglColorRenderbuffer)for(let Ue=0;Ue<$.__webglColorRenderbuffer.length;Ue++)$.__webglColorRenderbuffer[Ue]&&t.deleteRenderbuffer($.__webglColorRenderbuffer[Ue]);$.__webglDepthRenderbuffer&&t.deleteRenderbuffer($.__webglDepthRenderbuffer)}const Me=J.textures;for(let Ue=0,Be=Me.length;Ue=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+J+" texture units while this GPU supports only "+i.maxTextures),k+=1,J}function te(J){const $=[];return $.push(J.wrapS),$.push(J.wrapT),$.push(J.wrapR||0),$.push(J.magFilter),$.push(J.minFilter),$.push(J.anisotropy),$.push(J.internalFormat),$.push(J.format),$.push(J.type),$.push(J.generateMipmaps),$.push(J.premultiplyAlpha),$.push(J.flipY),$.push(J.unpackAlignment),$.push(J.colorSpace),$.join()}function ee(J,$){const Me=r.get(J);if(J.isVideoTexture&&et(J),J.isRenderTargetTexture===!1&&J.version>0&&Me.__version!==J.version){const Ue=J.image;if(Ue===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ue.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{he(Me,J,$);return}}n.bindTexture(t.TEXTURE_2D,Me.__webglTexture,t.TEXTURE0+$)}function pe(J,$){const Me=r.get(J);if(J.version>0&&Me.__version!==J.version){he(Me,J,$);return}n.bindTexture(t.TEXTURE_2D_ARRAY,Me.__webglTexture,t.TEXTURE0+$)}function ie(J,$){const Me=r.get(J);if(J.version>0&&Me.__version!==J.version){he(Me,J,$);return}n.bindTexture(t.TEXTURE_3D,Me.__webglTexture,t.TEXTURE0+$)}function fe(J,$){const Me=r.get(J);if(J.version>0&&Me.__version!==J.version){ae(Me,J,$);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Me.__webglTexture,t.TEXTURE0+$)}const B={[Pd]:t.REPEAT,[Eo]:t.CLAMP_TO_EDGE,[kg]:t.MIRRORED_REPEAT},Q={[oi]:t.NEAREST,[$S]:t.NEAREST_MIPMAP_NEAREST,[oh]:t.NEAREST_MIPMAP_LINEAR,[Ir]:t.LINEAR,[rg]:t.LINEAR_MIPMAP_NEAREST,[Zo]:t.LINEAR_MIPMAP_LINEAR},K={[e6]:t.NEVER,[o6]:t.ALWAYS,[t6]:t.LESS,[AR]:t.LEQUAL,[n6]:t.EQUAL,[s6]:t.GEQUAL,[r6]:t.GREATER,[i6]:t.NOTEQUAL};function V(J,$){if($.type===eo&&e.has("OES_texture_float_linear")===!1&&($.magFilter===Ir||$.magFilter===rg||$.magFilter===oh||$.magFilter===Zo||$.minFilter===Ir||$.minFilter===rg||$.minFilter===oh||$.minFilter===Zo)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(J,t.TEXTURE_WRAP_S,B[$.wrapS]),t.texParameteri(J,t.TEXTURE_WRAP_T,B[$.wrapT]),(J===t.TEXTURE_3D||J===t.TEXTURE_2D_ARRAY)&&t.texParameteri(J,t.TEXTURE_WRAP_R,B[$.wrapR]),t.texParameteri(J,t.TEXTURE_MAG_FILTER,Q[$.magFilter]),t.texParameteri(J,t.TEXTURE_MIN_FILTER,Q[$.minFilter]),$.compareFunction&&(t.texParameteri(J,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(J,t.TEXTURE_COMPARE_FUNC,K[$.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if($.magFilter===oi||$.minFilter!==oh&&$.minFilter!==Zo||$.type===eo&&e.has("OES_texture_float_linear")===!1)return;if($.anisotropy>1||r.get($).__currentAnisotropy){const Me=e.get("EXT_texture_filter_anisotropic");t.texParameterf(J,Me.TEXTURE_MAX_ANISOTROPY_EXT,Math.min($.anisotropy,i.getMaxAnisotropy())),r.get($).__currentAnisotropy=$.anisotropy}}}function q(J,$){let Me=!1;J.__webglInit===void 0&&(J.__webglInit=!0,$.addEventListener("dispose",O));const Ue=$.source;let Be=g.get(Ue);Be===void 0&&(Be={},g.set(Ue,Be));const ze=te($);if(ze!==J.__cacheKey){Be[ze]===void 0&&(Be[ze]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,Me=!0),Be[ze].usedTimes++;const wt=Be[J.__cacheKey];wt!==void 0&&(Be[J.__cacheKey].usedTimes--,wt.usedTimes===0&&F($)),J.__cacheKey=ze,J.__webglTexture=Be[ze].texture}return Me}function he(J,$,Me){let Ue=t.TEXTURE_2D;($.isDataArrayTexture||$.isCompressedArrayTexture)&&(Ue=t.TEXTURE_2D_ARRAY),$.isData3DTexture&&(Ue=t.TEXTURE_3D);const Be=q(J,$),ze=$.source;n.bindTexture(Ue,J.__webglTexture,t.TEXTURE0+Me);const wt=r.get(ze);if(ze.version!==wt.__version||Be===!0){n.activeTexture(t.TEXTURE0+Me);const rt=Ln.getPrimaries(Ln.workingColorSpace),pt=$.colorSpace===jc?null:Ln.getPrimaries($.colorSpace),Wt=$.colorSpace===jc||rt===pt?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,$.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,$.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,$.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Wt);let Ke=S($.image,!1,i.maxTextureSize);Ke=St($,Ke);const ne=s.convert($.format,$.colorSpace),Qe=s.convert($.type);let Mt=M($.internalFormat,ne,Qe,$.colorSpace,$.isVideoTexture);V(Ue,$);let yt;const Jt=$.mipmaps,de=$.isVideoTexture!==!0,qe=wt.__version===void 0||Be===!0,le=ze.dataReady,Ye=C($,Ke);if($.isDepthTexture)Mt=T($.format===Bh,$.type),qe&&(de?n.texStorage2D(t.TEXTURE_2D,1,Mt,Ke.width,Ke.height):n.texImage2D(t.TEXTURE_2D,0,Mt,Ke.width,Ke.height,0,ne,Qe,null));else if($.isDataTexture)if(Jt.length>0){de&&qe&&n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Jt[0].width,Jt[0].height);for(let Te=0,Fe=Jt.length;Te0){const st=tP(yt.width,yt.height,$.format,$.type);for(const mt of $.layerUpdates){const se=yt.data.subarray(mt*st/yt.data.BYTES_PER_ELEMENT,(mt+1)*st/yt.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,mt,yt.width,yt.height,1,ne,se,0,0)}$.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,yt.width,yt.height,Ke.depth,ne,yt.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Te,Mt,yt.width,yt.height,Ke.depth,0,yt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else de?le&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,yt.width,yt.height,Ke.depth,ne,Qe,yt.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Te,Mt,yt.width,yt.height,Ke.depth,0,ne,Qe,yt.data)}else{de&&qe&&n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Jt[0].width,Jt[0].height);for(let Te=0,Fe=Jt.length;Te0){const Te=tP(Ke.width,Ke.height,$.format,$.type);for(const Fe of $.layerUpdates){const st=Ke.data.subarray(Fe*Te/Ke.data.BYTES_PER_ELEMENT,(Fe+1)*Te/Ke.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Fe,Ke.width,Ke.height,1,ne,Qe,st)}$.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ke.width,Ke.height,Ke.depth,ne,Qe,Ke.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Mt,Ke.width,Ke.height,Ke.depth,0,ne,Qe,Ke.data);else if($.isData3DTexture)de?(qe&&n.texStorage3D(t.TEXTURE_3D,Ye,Mt,Ke.width,Ke.height,Ke.depth),le&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ke.width,Ke.height,Ke.depth,ne,Qe,Ke.data)):n.texImage3D(t.TEXTURE_3D,0,Mt,Ke.width,Ke.height,Ke.depth,0,ne,Qe,Ke.data);else if($.isFramebufferTexture){if(qe)if(de)n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Ke.width,Ke.height);else{let Te=Ke.width,Fe=Ke.height;for(let st=0;st>=1,Fe>>=1}}else if(Jt.length>0){if(de&&qe){const Te=ft(Jt[0]);n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Te.width,Te.height)}for(let Te=0,Fe=Jt.length;Te0&&Ye++;const Fe=ft(ne[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Ye,Jt,Fe.width,Fe.height)}for(let Fe=0;Fe<6;Fe++)if(Ke){de?le&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Fe,0,0,0,ne[Fe].width,ne[Fe].height,Mt,yt,ne[Fe].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Fe,0,Jt,ne[Fe].width,ne[Fe].height,0,Mt,yt,ne[Fe].data);for(let st=0;st>ze),ne=Math.max(1,$.height>>ze);Be===t.TEXTURE_3D||Be===t.TEXTURE_2D_ARRAY?n.texImage3D(Be,ze,pt,Ke,ne,$.depth,0,wt,rt,null):n.texImage2D(Be,ze,pt,Ke,ne,0,wt,rt,null)}n.bindFramebuffer(t.FRAMEBUFFER,J),Ge($)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Ue,Be,r.get(Me).__webglTexture,0,Oe($)):(Be===t.TEXTURE_2D||Be>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Be<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Ue,Be,r.get(Me).__webglTexture,ze),n.bindFramebuffer(t.FRAMEBUFFER,null)}function we(J,$,Me){if(t.bindRenderbuffer(t.RENDERBUFFER,J),$.depthBuffer){const Ue=$.depthTexture,Be=Ue&&Ue.isDepthTexture?Ue.type:null,ze=T($.stencilBuffer,Be),wt=$.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,rt=Oe($);Ge($)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,ze,$.width,$.height):Me?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,ze,$.width,$.height):t.renderbufferStorage(t.RENDERBUFFER,ze,$.width,$.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,wt,t.RENDERBUFFER,J)}else{const Ue=$.textures;for(let Be=0;Be{delete $.__boundDepthTexture,delete $.__depthDisposeCallback,Ue.removeEventListener("dispose",Be)};Ue.addEventListener("dispose",Be),$.__depthDisposeCallback=Be}$.__boundDepthTexture=Ue}if(J.depthTexture&&!$.__autoAllocateDepthBuffer){if(Me)throw new Error("target.depthTexture not supported in Cube render targets");Ee($.__webglFramebuffer,J)}else if(Me){$.__webglDepthbuffer=[];for(let Ue=0;Ue<6;Ue++)if(n.bindFramebuffer(t.FRAMEBUFFER,$.__webglFramebuffer[Ue]),$.__webglDepthbuffer[Ue]===void 0)$.__webglDepthbuffer[Ue]=t.createRenderbuffer(),we($.__webglDepthbuffer[Ue],J,!1);else{const Be=J.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ze=$.__webglDepthbuffer[Ue];t.bindRenderbuffer(t.RENDERBUFFER,ze),t.framebufferRenderbuffer(t.FRAMEBUFFER,Be,t.RENDERBUFFER,ze)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,$.__webglFramebuffer),$.__webglDepthbuffer===void 0)$.__webglDepthbuffer=t.createRenderbuffer(),we($.__webglDepthbuffer,J,!1);else{const Ue=J.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Be=$.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,Be),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ue,t.RENDERBUFFER,Be)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Se(J,$,Me){const Ue=r.get(J);$!==void 0&&ce(Ue.__webglFramebuffer,J,J.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Me!==void 0&&Xe(J)}function je(J){const $=J.texture,Me=r.get(J),Ue=r.get($);J.addEventListener("dispose",N);const Be=J.textures,ze=J.isWebGLCubeRenderTarget===!0,wt=Be.length>1;if(wt||(Ue.__webglTexture===void 0&&(Ue.__webglTexture=t.createTexture()),Ue.__version=$.version,o.memory.textures++),ze){Me.__webglFramebuffer=[];for(let rt=0;rt<6;rt++)if($.mipmaps&&$.mipmaps.length>0){Me.__webglFramebuffer[rt]=[];for(let pt=0;pt<$.mipmaps.length;pt++)Me.__webglFramebuffer[rt][pt]=t.createFramebuffer()}else Me.__webglFramebuffer[rt]=t.createFramebuffer()}else{if($.mipmaps&&$.mipmaps.length>0){Me.__webglFramebuffer=[];for(let rt=0;rt<$.mipmaps.length;rt++)Me.__webglFramebuffer[rt]=t.createFramebuffer()}else Me.__webglFramebuffer=t.createFramebuffer();if(wt)for(let rt=0,pt=Be.length;rt0&&Ge(J)===!1){Me.__webglMultisampledFramebuffer=t.createFramebuffer(),Me.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Me.__webglMultisampledFramebuffer);for(let rt=0;rt0)for(let pt=0;pt<$.mipmaps.length;pt++)ce(Me.__webglFramebuffer[rt][pt],J,$,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+rt,pt);else ce(Me.__webglFramebuffer[rt],J,$,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+rt,0);w($)&&b(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(wt){for(let rt=0,pt=Be.length;rt0)for(let pt=0;pt<$.mipmaps.length;pt++)ce(Me.__webglFramebuffer[pt],J,$,t.COLOR_ATTACHMENT0,rt,pt);else ce(Me.__webglFramebuffer,J,$,t.COLOR_ATTACHMENT0,rt,0);w($)&&b(rt),n.unbindTexture()}J.depthBuffer&&Xe(J)}function $e(J){const $=J.textures;for(let Me=0,Ue=$.length;Me0){if(Ge(J)===!1){const $=J.textures,Me=J.width,Ue=J.height;let Be=t.COLOR_BUFFER_BIT;const ze=J.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,wt=r.get(J),rt=$.length>1;if(rt)for(let pt=0;pt<$.length;pt++)n.bindFramebuffer(t.FRAMEBUFFER,wt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+pt,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,wt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+pt,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,wt.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,wt.__webglFramebuffer);for(let pt=0;pt<$.length;pt++){if(J.resolveDepthBuffer&&(J.depthBuffer&&(Be|=t.DEPTH_BUFFER_BIT),J.stencilBuffer&&J.resolveStencilBuffer&&(Be|=t.STENCIL_BUFFER_BIT)),rt){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,wt.__webglColorRenderbuffer[pt]);const Wt=r.get($[pt]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,Wt,0)}t.blitFramebuffer(0,0,Me,Ue,0,0,Me,Ue,Be,t.NEAREST),l===!0&&(ue.length=0,Z.length=0,ue.push(t.COLOR_ATTACHMENT0+pt),J.depthBuffer&&J.resolveDepthBuffer===!1&&(ue.push(ze),Z.push(ze),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Z)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,ue))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),rt)for(let pt=0;pt<$.length;pt++){n.bindFramebuffer(t.FRAMEBUFFER,wt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+pt,t.RENDERBUFFER,wt.__webglColorRenderbuffer[pt]);const Wt=r.get($[pt]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,wt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+pt,t.TEXTURE_2D,Wt,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,wt.__webglMultisampledFramebuffer)}else if(J.depthBuffer&&J.resolveDepthBuffer===!1&&l){const $=J.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[$])}}}function Oe(J){return Math.min(i.maxSamples,J.samples)}function Ge(J){const $=r.get(J);return J.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&$.__useRenderToTexture!==!1}function et(J){const $=o.render.frame;d.get(J)!==$&&(d.set(J,$),J.update())}function St(J,$){const Me=J.colorSpace,Ue=J.format,Be=J.type;return J.isCompressedTexture===!0||J.isVideoTexture===!0||Me!==Si&&Me!==jc&&(Ln.getTransfer(Me)===rr?(Ue!==as||Be!==Va)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Me)),$}function ft(J){return typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement?(c.width=J.naturalWidth||J.width,c.height=J.naturalHeight||J.height):typeof VideoFrame<"u"&&J instanceof VideoFrame?(c.width=J.displayWidth,c.height=J.displayHeight):(c.width=J.width,c.height=J.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=U,this.setTexture2D=ee,this.setTexture2DArray=pe,this.setTexture3D=ie,this.setTextureCube=fe,this.rebindTextures=Se,this.setupRenderTarget=je,this.updateRenderTargetMipmap=$e,this.updateMultisampleRenderTarget=Ve,this.setupDepthRenderbuffer=Xe,this.setupFrameBufferTexture=ce,this.useMultisampledRTT=Ge}function _6(t,e){function n(r,i=jc){let s;const o=Ln.getTransfer(i);if(r===Va)return t.UNSIGNED_BYTE;if(r===qS)return t.UNSIGNED_SHORT_4_4_4_4;if(r===KS)return t.UNSIGNED_SHORT_5_5_5_1;if(r===vR)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===mR)return t.BYTE;if(r===gR)return t.SHORT;if(r===Og)return t.UNSIGNED_SHORT;if(r===XS)return t.INT;if(r===eu)return t.UNSIGNED_INT;if(r===eo)return t.FLOAT;if(r===rv)return t.HALF_FLOAT;if(r===yR)return t.ALPHA;if(r===xR)return t.RGB;if(r===as)return t.RGBA;if(r===bR)return t.LUMINANCE;if(r===_R)return t.LUMINANCE_ALPHA;if(r===Ah)return t.DEPTH_COMPONENT;if(r===Bh)return t.DEPTH_STENCIL;if(r===YS)return t.RED;if(r===cx)return t.RED_INTEGER;if(r===wR)return t.RG;if(r===ZS)return t.RG_INTEGER;if(r===QS)return t.RGBA_INTEGER;if(r===Y0||r===Z0||r===Q0||r===J0)if(o===rr)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Y0)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Z0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===J0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Y0)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Z0)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===J0)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===c1||r===u1||r===d1||r===f1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===c1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===u1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===d1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===f1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===h1||r===p1||r===m1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===h1||r===p1)return o===rr?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===m1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===g1||r===v1||r===y1||r===x1||r===b1||r===_1||r===w1||r===S1||r===M1||r===E1||r===A1||r===T1||r===C1||r===P1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===g1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===v1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===y1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===x1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===b1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===_1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===w1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===S1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===M1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===E1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===A1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===T1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===C1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===P1)return o===rr?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===ey||r===R1||r===N1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===ey)return o===rr?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===R1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===N1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===SR||r===I1||r===k1||r===O1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===ey)return s.COMPRESSED_RED_RGTC1_EXT;if(r===I1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===k1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===O1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===zh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class w6 extends Nr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ps extends vn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const fye={type:"move"};class AA{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ps,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Ps,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ps,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const S of e.hand.values()){const w=n.getJointPose(S,r),b=this._getHandJoint(c,S);w!==null&&(b.matrix.fromArray(w.transform.matrix),b.matrix.decompose(b.position,b.rotation,b.scale),b.matrixWorldNeedsUpdate=!0,b.jointRadius=w.radius),b.visible=w!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],g=d.position.distanceTo(f.position),y=.02,x=.005;c.inputState.pinching&&g>y+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&g<=y-x&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(fye)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Ps;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const hye=` void main() { gl_Position = vec4( position, 1.0 ); -}`,tye=` +}`,pye=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -4426,7 +4441,7 @@ void main() { } -}`;class nye{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,r){if(this.texture===null){const i=new hr,s=e.properties.get(i);s.__webglTexture=n.texture,(n.depthNear!=r.depthNear||n.depthFar!=r.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new ea({vertexShader:eye,fragmentShader:tye,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new xr(new iv(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class rye extends Vl{constructor(e,n){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,f=null,m=null,y=null,x=null;const S=new nye,_=n.getContextAttributes();let w=null,E=null;const T=[],C=[],O=new Ve;let N=null;const L=new Pr;L.layers.enable(1),L.viewport=new jn;const F=new Pr;F.layers.enable(2),F.viewport=new jn;const G=[L,F],k=new y6;k.layers.enable(1),k.layers.enable(2);let U=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ae){let ce=T[ae];return ce===void 0&&(ce=new wA,T[ae]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(ae){let ce=T[ae];return ce===void 0&&(ce=new wA,T[ae]=ce),ce.getGripSpace()},this.getHand=function(ae){let ce=T[ae];return ce===void 0&&(ce=new wA,T[ae]=ce),ce.getHandSpace()};function ne(ae){const ce=C.indexOf(ae.inputSource);if(ce===-1)return;const we=T[ce];we!==void 0&&(we.update(ae.inputSource,ae.frame,c||o),we.dispatchEvent({type:ae.type,data:ae.inputSource}))}function ee(){i.removeEventListener("select",ne),i.removeEventListener("selectstart",ne),i.removeEventListener("selectend",ne),i.removeEventListener("squeeze",ne),i.removeEventListener("squeezestart",ne),i.removeEventListener("squeezeend",ne),i.removeEventListener("end",ee),i.removeEventListener("inputsourceschange",pe);for(let ae=0;ae=0&&(C[Ee]=null,T[Ee].disconnect(we))}for(let ce=0;ce=C.length){C.push(we),Ee=Se;break}else if(C[Se]===null){C[Se]=we,Ee=Se;break}if(Ee===-1)break}const Xe=T[Ee];Xe&&Xe.connect(we)}}const se=new X,fe=new X;function B(ae,ce,we){se.setFromMatrixPosition(ce.matrixWorld),fe.setFromMatrixPosition(we.matrixWorld);const Ee=se.distanceTo(fe),Xe=ce.projectionMatrix.elements,Se=we.projectionMatrix.elements,je=Xe[14]/(Xe[10]-1),$e=Xe[14]/(Xe[10]+1),ue=(Xe[9]+1)/Xe[5],Z=(Xe[9]-1)/Xe[5],Ge=(Xe[8]-1)/Xe[0],Oe=(Se[8]+1)/Se[0],We=je*Ge,tt=je*Oe,wt=Ee/(-Ge+Oe),dt=wt*-Ge;if(ce.matrixWorld.decompose(ae.position,ae.quaternion,ae.scale),ae.translateX(dt),ae.translateZ(wt),ae.matrixWorld.compose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldInverse.copy(ae.matrixWorld).invert(),Xe[10]===-1)ae.projectionMatrix.copy(ce.projectionMatrix),ae.projectionMatrixInverse.copy(ce.projectionMatrixInverse);else{const J=je+wt,$=$e+wt,Me=We-dt,Ue=tt+(Ee-dt),He=ue*$e/$*J,Be=Z*$e/$*J;ae.projectionMatrix.makePerspective(Me,Ue,He,Be,J,$),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert()}}function Q(ae,ce){ce===null?ae.matrixWorld.copy(ae.matrix):ae.matrixWorld.multiplyMatrices(ce.matrixWorld,ae.matrix),ae.matrixWorldInverse.copy(ae.matrixWorld).invert()}this.updateCamera=function(ae){if(i===null)return;let ce=ae.near,we=ae.far;S.texture!==null&&(S.depthNear>0&&(ce=S.depthNear),S.depthFar>0&&(we=S.depthFar)),k.near=F.near=L.near=ce,k.far=F.far=L.far=we,(U!==k.near||H!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),U=k.near,H=k.far);const Ee=ae.parent,Xe=k.cameras;Q(k,Ee);for(let Se=0;Se0&&(_.alphaTest.value=w.alphaTest);const E=e.get(w),T=E.envMap,C=E.envMapRotation;T&&(_.envMap.value=T,If.copy(C),If.x*=-1,If.y*=-1,If.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(If.y*=-1,If.z*=-1),_.envMapRotation.value.setFromMatrix4(iye.makeRotationFromEuler(If)),_.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=w.reflectivity,_.ior.value=w.ior,_.refractionRatio.value=w.refractionRatio),w.lightMap&&(_.lightMap.value=w.lightMap,_.lightMapIntensity.value=w.lightMapIntensity,n(w.lightMap,_.lightMapTransform)),w.aoMap&&(_.aoMap.value=w.aoMap,_.aoMapIntensity.value=w.aoMapIntensity,n(w.aoMap,_.aoMapTransform))}function o(_,w){_.diffuse.value.copy(w.color),_.opacity.value=w.opacity,w.map&&(_.map.value=w.map,n(w.map,_.mapTransform))}function a(_,w){_.dashSize.value=w.dashSize,_.totalSize.value=w.dashSize+w.gapSize,_.scale.value=w.scale}function l(_,w,E,T){_.diffuse.value.copy(w.color),_.opacity.value=w.opacity,_.size.value=w.size*E,_.scale.value=T*.5,w.map&&(_.map.value=w.map,n(w.map,_.uvTransform)),w.alphaMap&&(_.alphaMap.value=w.alphaMap,n(w.alphaMap,_.alphaMapTransform)),w.alphaTest>0&&(_.alphaTest.value=w.alphaTest)}function c(_,w){_.diffuse.value.copy(w.color),_.opacity.value=w.opacity,_.rotation.value=w.rotation,w.map&&(_.map.value=w.map,n(w.map,_.mapTransform)),w.alphaMap&&(_.alphaMap.value=w.alphaMap,n(w.alphaMap,_.alphaMapTransform)),w.alphaTest>0&&(_.alphaTest.value=w.alphaTest)}function d(_,w){_.specular.value.copy(w.specular),_.shininess.value=Math.max(w.shininess,1e-4)}function f(_,w){w.gradientMap&&(_.gradientMap.value=w.gradientMap)}function m(_,w){_.metalness.value=w.metalness,w.metalnessMap&&(_.metalnessMap.value=w.metalnessMap,n(w.metalnessMap,_.metalnessMapTransform)),_.roughness.value=w.roughness,w.roughnessMap&&(_.roughnessMap.value=w.roughnessMap,n(w.roughnessMap,_.roughnessMapTransform)),w.envMap&&(_.envMapIntensity.value=w.envMapIntensity)}function y(_,w,E){_.ior.value=w.ior,w.sheen>0&&(_.sheenColor.value.copy(w.sheenColor).multiplyScalar(w.sheen),_.sheenRoughness.value=w.sheenRoughness,w.sheenColorMap&&(_.sheenColorMap.value=w.sheenColorMap,n(w.sheenColorMap,_.sheenColorMapTransform)),w.sheenRoughnessMap&&(_.sheenRoughnessMap.value=w.sheenRoughnessMap,n(w.sheenRoughnessMap,_.sheenRoughnessMapTransform))),w.clearcoat>0&&(_.clearcoat.value=w.clearcoat,_.clearcoatRoughness.value=w.clearcoatRoughness,w.clearcoatMap&&(_.clearcoatMap.value=w.clearcoatMap,n(w.clearcoatMap,_.clearcoatMapTransform)),w.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=w.clearcoatRoughnessMap,n(w.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),w.clearcoatNormalMap&&(_.clearcoatNormalMap.value=w.clearcoatNormalMap,n(w.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(w.clearcoatNormalScale),w.side===ls&&_.clearcoatNormalScale.value.negate())),w.dispersion>0&&(_.dispersion.value=w.dispersion),w.iridescence>0&&(_.iridescence.value=w.iridescence,_.iridescenceIOR.value=w.iridescenceIOR,_.iridescenceThicknessMinimum.value=w.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=w.iridescenceThicknessRange[1],w.iridescenceMap&&(_.iridescenceMap.value=w.iridescenceMap,n(w.iridescenceMap,_.iridescenceMapTransform)),w.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=w.iridescenceThicknessMap,n(w.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),w.transmission>0&&(_.transmission.value=w.transmission,_.transmissionSamplerMap.value=E.texture,_.transmissionSamplerSize.value.set(E.width,E.height),w.transmissionMap&&(_.transmissionMap.value=w.transmissionMap,n(w.transmissionMap,_.transmissionMapTransform)),_.thickness.value=w.thickness,w.thicknessMap&&(_.thicknessMap.value=w.thicknessMap,n(w.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=w.attenuationDistance,_.attenuationColor.value.copy(w.attenuationColor)),w.anisotropy>0&&(_.anisotropyVector.value.set(w.anisotropy*Math.cos(w.anisotropyRotation),w.anisotropy*Math.sin(w.anisotropyRotation)),w.anisotropyMap&&(_.anisotropyMap.value=w.anisotropyMap,n(w.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=w.specularIntensity,_.specularColor.value.copy(w.specularColor),w.specularColorMap&&(_.specularColorMap.value=w.specularColorMap,n(w.specularColorMap,_.specularColorMapTransform)),w.specularIntensityMap&&(_.specularIntensityMap.value=w.specularIntensityMap,n(w.specularIntensityMap,_.specularIntensityMapTransform))}function x(_,w){w.matcap&&(_.matcap.value=w.matcap)}function S(_,w){const E=e.get(w).light;_.referencePosition.value.setFromMatrixPosition(E.matrixWorld),_.nearDistance.value=E.shadow.camera.near,_.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function oye(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,T){const C=T.program;r.uniformBlockBinding(E,C)}function c(E,T){let C=i[E.id];C===void 0&&(x(E),C=d(E),i[E.id]=C,E.addEventListener("dispose",_));const O=T.program;r.updateUBOMapping(E,O);const N=e.render.frame;s[E.id]!==N&&(m(E),s[E.id]=N)}function d(E){const T=f();E.__bindingPointIndex=T;const C=t.createBuffer(),O=E.__size,N=E.usage;return t.bindBuffer(t.UNIFORM_BUFFER,C),t.bufferData(t.UNIFORM_BUFFER,O,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,T,C),C}function f(){for(let E=0;E0&&(C+=O-N),E.__size=C,E.__cache={},this}function S(E){const T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),T}function _(E){const T=E.target;T.removeEventListener("dispose",_);const C=o.indexOf(T.__bindingPointIndex);o.splice(C,1),t.deleteBuffer(i[T.id]),delete i[T.id],delete s[T.id]}function w(){for(const E in i)t.deleteBuffer(i[E]);o=[],i={},s={}}return{bind:l,update:c,dispose:w}}class x6{constructor(e={}){const{canvas:n=s6(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let m;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=r.getContextAttributes().alpha}else m=o;const y=new Uint32Array(4),x=new Int32Array(4);let S=null,_=null;const w=[],E=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Fi,this.toneMapping=Pl,this.toneMappingExposure=1;const T=this;let C=!1,O=0,N=0,L=null,F=-1,G=null;const k=new jn,U=new jn;let H=null;const ne=new ut(0);let ee=0,pe=n.width,se=n.height,fe=1,B=null,Q=null;const K=new jn(0,0,pe,se),V=new jn(0,0,pe,se);let q=!1;const he=new hx;let ae=!1,ce=!1;const we=new kt,Ee=new kt,Xe=new X,Se=new jn,je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let $e=!1;function ue(){return L===null?fe:1}let Z=r;function Ge(Y,xe){return n.getContext(Y,xe)}try{const Y={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Td}`),n.addEventListener("webglcontextlost",Fe,!1),n.addEventListener("webglcontextrestored",st,!1),n.addEventListener("webglcontextcreationerror",te,!1),Z===null){const xe="webgl2";if(Z=Ge(xe,Y),Z===null)throw Ge(xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Y){throw console.error("THREE.WebGLRenderer: "+Y.message),Y}let Oe,We,tt,wt,dt,J,$,Me,Ue,He,Be,bt,it,ht,Gt,Ke,re,Qe,St,mt,Qt,de,qe,le;function Ye(){Oe=new fve(Z),Oe.init(),de=new v6(Z,Oe),We=new ove(Z,Oe,e,de),tt=new $0e(Z),We.reverseDepthBuffer&&tt.buffers.depth.setReversed(!0),wt=new mve(Z),dt=new k0e,J=new Q0e(Z,Oe,tt,dt,We,de,wt),$=new lve(T),Me=new dve(T),Ue=new wpe(Z),qe=new ive(Z,Ue),He=new hve(Z,Ue,wt,qe),Be=new vve(Z,He,Ue,wt),St=new gve(Z,We,J),Ke=new ave(dt),bt=new I0e(T,$,Me,Oe,We,qe,Ke),it=new sye(T,dt),ht=new L0e,Gt=new B0e(Oe),Qe=new rve(T,$,Me,tt,Be,m,l),re=new G0e(T,Be,We),le=new oye(Z,wt,We,tt),mt=new sve(Z,Oe,wt),Qt=new pve(Z,Oe,wt),wt.programs=bt.programs,T.capabilities=We,T.extensions=Oe,T.properties=dt,T.renderLists=ht,T.shadowMap=re,T.state=tt,T.info=wt}Ye();const Te=new rye(T,Z);this.xr=Te,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){const Y=Oe.get("WEBGL_lose_context");Y&&Y.loseContext()},this.forceContextRestore=function(){const Y=Oe.get("WEBGL_lose_context");Y&&Y.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(Y){Y!==void 0&&(fe=Y,this.setSize(pe,se,!1))},this.getSize=function(Y){return Y.set(pe,se)},this.setSize=function(Y,xe,Ce=!0){if(Te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}pe=Y,se=xe,n.width=Math.floor(Y*fe),n.height=Math.floor(xe*fe),Ce===!0&&(n.style.width=Y+"px",n.style.height=xe+"px"),this.setViewport(0,0,Y,xe)},this.getDrawingBufferSize=function(Y){return Y.set(pe*fe,se*fe).floor()},this.setDrawingBufferSize=function(Y,xe,Ce){pe=Y,se=xe,fe=Ce,n.width=Math.floor(Y*Ce),n.height=Math.floor(xe*Ce),this.setViewport(0,0,Y,xe)},this.getCurrentViewport=function(Y){return Y.copy(k)},this.getViewport=function(Y){return Y.copy(K)},this.setViewport=function(Y,xe,Ce,Ne){Y.isVector4?K.set(Y.x,Y.y,Y.z,Y.w):K.set(Y,xe,Ce,Ne),tt.viewport(k.copy(K).multiplyScalar(fe).round())},this.getScissor=function(Y){return Y.copy(V)},this.setScissor=function(Y,xe,Ce,Ne){Y.isVector4?V.set(Y.x,Y.y,Y.z,Y.w):V.set(Y,xe,Ce,Ne),tt.scissor(U.copy(V).multiplyScalar(fe).round())},this.getScissorTest=function(){return q},this.setScissorTest=function(Y){tt.setScissorTest(q=Y)},this.setOpaqueSort=function(Y){B=Y},this.setTransparentSort=function(Y){Q=Y},this.getClearColor=function(Y){return Y.copy(Qe.getClearColor())},this.setClearColor=function(){Qe.setClearColor.apply(Qe,arguments)},this.getClearAlpha=function(){return Qe.getClearAlpha()},this.setClearAlpha=function(){Qe.setClearAlpha.apply(Qe,arguments)},this.clear=function(Y=!0,xe=!0,Ce=!0){let Ne=0;if(Y){let _e=!1;if(L!==null){const ot=L.texture.format;_e=ot===YS||ot===KS||ot===cx}if(_e){const ot=L.texture.type,xt=ot===Va||ot===eu||ot===Og||ot===Fh||ot===$S||ot===XS,ct=Qe.getClearColor(),Pt=Qe.getClearAlpha(),Ht=ct.r,$t=ct.g,Ot=ct.b;xt?(y[0]=Ht,y[1]=$t,y[2]=Ot,y[3]=Pt,Z.clearBufferuiv(Z.COLOR,0,y)):(x[0]=Ht,x[1]=$t,x[2]=Ot,x[3]=Pt,Z.clearBufferiv(Z.COLOR,0,x))}else Ne|=Z.COLOR_BUFFER_BIT}xe&&(Ne|=Z.DEPTH_BUFFER_BIT,Z.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Ce&&(Ne|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(Ne)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Fe,!1),n.removeEventListener("webglcontextrestored",st,!1),n.removeEventListener("webglcontextcreationerror",te,!1),ht.dispose(),Gt.dispose(),dt.dispose(),$.dispose(),Me.dispose(),Be.dispose(),qe.dispose(),le.dispose(),bt.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",Un),Te.removeEventListener("sessionend",Xi),jr.stop()};function Fe(Y){Y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),C=!0}function st(){console.log("THREE.WebGLRenderer: Context Restored."),C=!1;const Y=wt.autoReset,xe=re.enabled,Ce=re.autoUpdate,Ne=re.needsUpdate,_e=re.type;Ye(),wt.autoReset=Y,re.enabled=xe,re.autoUpdate=Ce,re.needsUpdate=Ne,re.type=_e}function te(Y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Y.statusMessage)}function ze(Y){const xe=Y.target;xe.removeEventListener("dispose",ze),Je(xe)}function Je(Y){At(Y),dt.remove(Y)}function At(Y){const xe=dt.get(Y).programs;xe!==void 0&&(xe.forEach(function(Ce){bt.releaseProgram(Ce)}),Y.isShaderMaterial&&bt.releaseShaderCache(Y))}this.renderBufferDirect=function(Y,xe,Ce,Ne,_e,ot){xe===null&&(xe=je);const xt=_e.isMesh&&_e.matrixWorld.determinant()<0,ct=Po(Y,xe,Ce,Ne,_e);tt.setMaterial(Ne,xt);let Pt=Ce.index,Ht=1;if(Ne.wireframe===!0){if(Pt=He.getWireframeAttribute(Ce),Pt===void 0)return;Ht=2}const $t=Ce.drawRange,Ot=Ce.attributes.position;let An=$t.start*Ht,Tn=($t.start+$t.count)*Ht;ot!==null&&(An=Math.max(An,ot.start*Ht),Tn=Math.min(Tn,(ot.start+ot.count)*Ht)),Pt!==null?(An=Math.max(An,0),Tn=Math.min(Tn,Pt.count)):Ot!=null&&(An=Math.max(An,0),Tn=Math.min(Tn,Ot.count));const _n=Tn-An;if(_n<0||_n===1/0)return;qe.setup(_e,Ne,ct,Ce,Pt);let en,Bt=mt;if(Pt!==null&&(en=Ue.get(Pt),Bt=Qt,Bt.setIndex(en)),_e.isMesh)Ne.wireframe===!0?(tt.setLineWidth(Ne.wireframeLinewidth*ue()),Bt.setMode(Z.LINES)):Bt.setMode(Z.TRIANGLES);else if(_e.isLine){let vt=Ne.linewidth;vt===void 0&&(vt=1),tt.setLineWidth(vt*ue()),_e.isLineSegments?Bt.setMode(Z.LINES):_e.isLineLoop?Bt.setMode(Z.LINE_LOOP):Bt.setMode(Z.LINE_STRIP)}else _e.isPoints?Bt.setMode(Z.POINTS):_e.isSprite&&Bt.setMode(Z.TRIANGLES);if(_e.isBatchedMesh)if(_e._multiDrawInstances!==null)Bt.renderMultiDrawInstances(_e._multiDrawStarts,_e._multiDrawCounts,_e._multiDrawCount,_e._multiDrawInstances);else if(Oe.get("WEBGL_multi_draw"))Bt.renderMultiDraw(_e._multiDrawStarts,_e._multiDrawCounts,_e._multiDrawCount);else{const vt=_e._multiDrawStarts,wn=_e._multiDrawCounts,rn=_e._multiDrawCount,Nr=Pt?Ue.get(Pt).bytesPerElement:1,ui=dt.get(Ne).currentProgram.getUniforms();for(let Ln=0;Ln{function ot(){if(Ne.forEach(function(xt){dt.get(xt).currentProgram.isReady()&&Ne.delete(xt)}),Ne.size===0){_e(Y);return}setTimeout(ot,10)}Oe.get("KHR_parallel_shader_compile")!==null?ot():setTimeout(ot,10)})};let dn=null;function cn(Y){dn&&dn(Y)}function Un(){jr.stop()}function Xi(){jr.start()}const jr=new f6;jr.setAnimationLoop(cn),typeof self<"u"&&jr.setContext(self),this.setAnimationLoop=function(Y){dn=Y,Te.setAnimationLoop(Y),Y===null?jr.stop():jr.start()},Te.addEventListener("sessionstart",Un),Te.addEventListener("sessionend",Xi),this.render=function(Y,xe){if(xe!==void 0&&xe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;if(Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),xe.parent===null&&xe.matrixWorldAutoUpdate===!0&&xe.updateMatrixWorld(),Te.enabled===!0&&Te.isPresenting===!0&&(Te.cameraAutoUpdate===!0&&Te.updateCamera(xe),xe=Te.getCamera()),Y.isScene===!0&&Y.onBeforeRender(T,Y,xe,L),_=Gt.get(Y,E.length),_.init(xe),E.push(_),Ee.multiplyMatrices(xe.projectionMatrix,xe.matrixWorldInverse),he.setFromProjectionMatrix(Ee),ce=this.localClippingEnabled,ae=Ke.init(this.clippingPlanes,ce),S=ht.get(Y,w.length),S.init(),w.push(S),Te.enabled===!0&&Te.isPresenting===!0){const ot=T.xr.getDepthSensingMesh();ot!==null&&To(ot,xe,-1/0,T.sortObjects)}To(Y,xe,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(B,Q),$e=Te.enabled===!1||Te.isPresenting===!1||Te.hasDepthSensing()===!1,$e&&Qe.addToRenderList(S,Y),this.info.render.frame++,ae===!0&&Ke.beginShadows();const Ce=_.state.shadowsArray;re.render(Ce,Y,xe),ae===!0&&Ke.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ne=S.opaque,_e=S.transmissive;if(_.setupLights(),xe.isArrayCamera){const ot=xe.cameras;if(_e.length>0)for(let xt=0,ct=ot.length;xt0&&sa(Ne,_e,Y,xe),$e&&Qe.render(Y),Ei(S,Y,xe);L!==null&&(J.updateMultisampleRenderTarget(L),J.updateRenderTargetMipmap(L)),Y.isScene===!0&&Y.onAfterRender(T,Y,xe),qe.resetDefaultState(),F=-1,G=null,E.pop(),E.length>0?(_=E[E.length-1],ae===!0&&Ke.setGlobalState(T.clippingPlanes,_.state.camera)):_=null,w.pop(),w.length>0?S=w[w.length-1]:S=null};function To(Y,xe,Ce,Ne){if(Y.visible===!1)return;if(Y.layers.test(xe.layers)){if(Y.isGroup)Ce=Y.renderOrder;else if(Y.isLOD)Y.autoUpdate===!0&&Y.update(xe);else if(Y.isLight)_.pushLight(Y),Y.castShadow&&_.pushShadow(Y);else if(Y.isSprite){if(!Y.frustumCulled||he.intersectsSprite(Y)){Ne&&Se.setFromMatrixPosition(Y.matrixWorld).applyMatrix4(Ee);const xt=Be.update(Y),ct=Y.material;ct.visible&&S.push(Y,xt,ct,Ce,Se.z,null)}}else if((Y.isMesh||Y.isLine||Y.isPoints)&&(!Y.frustumCulled||he.intersectsObject(Y))){const xt=Be.update(Y),ct=Y.material;if(Ne&&(Y.boundingSphere!==void 0?(Y.boundingSphere===null&&Y.computeBoundingSphere(),Se.copy(Y.boundingSphere.center)):(xt.boundingSphere===null&&xt.computeBoundingSphere(),Se.copy(xt.boundingSphere.center)),Se.applyMatrix4(Y.matrixWorld).applyMatrix4(Ee)),Array.isArray(ct)){const Pt=xt.groups;for(let Ht=0,$t=Pt.length;Ht<$t;Ht++){const Ot=Pt[Ht],An=ct[Ot.materialIndex];An&&An.visible&&S.push(Y,xt,An,Ce,Se.z,Ot)}}else ct.visible&&S.push(Y,xt,ct,Ce,Se.z,null)}}const ot=Y.children;for(let xt=0,ct=ot.length;xt0&&Ai(_e,xe,Ce),ot.length>0&&Ai(ot,xe,Ce),xt.length>0&&Ai(xt,xe,Ce),tt.buffers.depth.setTest(!0),tt.buffers.depth.setMask(!0),tt.buffers.color.setMask(!0),tt.setPolygonOffset(!1)}function sa(Y,xe,Ce,Ne){if((Ce.isScene===!0?Ce.overrideMaterial:null)!==null)return;_.state.transmissionRenderTarget[Ne.id]===void 0&&(_.state.transmissionRenderTarget[Ne.id]=new Ga(1,1,{generateMipmaps:!0,type:Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float")?rv:Va,minFilter:Yo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:On.workingColorSpace}));const ot=_.state.transmissionRenderTarget[Ne.id],xt=Ne.viewport||k;ot.setSize(xt.z,xt.w);const ct=T.getRenderTarget();T.setRenderTarget(ot),T.getClearColor(ne),ee=T.getClearAlpha(),ee<1&&T.setClearColor(16777215,.5),T.clear(),$e&&Qe.render(Ce);const Pt=T.toneMapping;T.toneMapping=Pl;const Ht=Ne.viewport;if(Ne.viewport!==void 0&&(Ne.viewport=void 0),_.setupLightsView(Ne),ae===!0&&Ke.setGlobalState(T.clippingPlanes,Ne),Ai(Y,Ce,Ne),J.updateMultisampleRenderTarget(ot),J.updateRenderTargetMipmap(ot),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let $t=!1;for(let Ot=0,An=xe.length;Ot0),Ot=!!Ce.morphAttributes.position,An=!!Ce.morphAttributes.normal,Tn=!!Ce.morphAttributes.color;let _n=Pl;Ne.toneMapped&&(L===null||L.isXRRenderTarget===!0)&&(_n=T.toneMapping);const en=Ce.morphAttributes.position||Ce.morphAttributes.normal||Ce.morphAttributes.color,Bt=en!==void 0?en.length:0,vt=dt.get(Ne),wn=_.state.lights;if(ae===!0&&(ce===!0||Y!==G)){const Kr=Y===G&&Ne.id===F;Ke.setState(Ne,Y,Kr)}let rn=!1;Ne.version===vt.__version?(vt.needsLights&&vt.lightsStateVersion!==wn.state.version||vt.outputColorSpace!==ct||_e.isBatchedMesh&&vt.batching===!1||!_e.isBatchedMesh&&vt.batching===!0||_e.isBatchedMesh&&vt.batchingColor===!0&&_e.colorTexture===null||_e.isBatchedMesh&&vt.batchingColor===!1&&_e.colorTexture!==null||_e.isInstancedMesh&&vt.instancing===!1||!_e.isInstancedMesh&&vt.instancing===!0||_e.isSkinnedMesh&&vt.skinning===!1||!_e.isSkinnedMesh&&vt.skinning===!0||_e.isInstancedMesh&&vt.instancingColor===!0&&_e.instanceColor===null||_e.isInstancedMesh&&vt.instancingColor===!1&&_e.instanceColor!==null||_e.isInstancedMesh&&vt.instancingMorph===!0&&_e.morphTexture===null||_e.isInstancedMesh&&vt.instancingMorph===!1&&_e.morphTexture!==null||vt.envMap!==Pt||Ne.fog===!0&&vt.fog!==ot||vt.numClippingPlanes!==void 0&&(vt.numClippingPlanes!==Ke.numPlanes||vt.numIntersection!==Ke.numIntersection)||vt.vertexAlphas!==Ht||vt.vertexTangents!==$t||vt.morphTargets!==Ot||vt.morphNormals!==An||vt.morphColors!==Tn||vt.toneMapping!==_n||vt.morphTargetsCount!==Bt)&&(rn=!0):(rn=!0,vt.__version=Ne.version);let Nr=vt.currentProgram;rn===!0&&(Nr=oa(Ne,xe,_e));let ui=!1,Ln=!1,ks=!1;const Wn=Nr.getUniforms(),no=vt.uniforms;if(tt.useProgram(Nr.program)&&(ui=!0,Ln=!0,ks=!0),Ne.id!==F&&(F=Ne.id,Ln=!0),ui||G!==Y){We.reverseDepthBuffer?(we.copy(Y.projectionMatrix),$he(we),Xhe(we),Wn.setValue(Z,"projectionMatrix",we)):Wn.setValue(Z,"projectionMatrix",Y.projectionMatrix),Wn.setValue(Z,"viewMatrix",Y.matrixWorldInverse);const Kr=Wn.map.cameraPosition;Kr!==void 0&&Kr.setValue(Z,Xe.setFromMatrixPosition(Y.matrixWorld)),We.logarithmicDepthBuffer&&Wn.setValue(Z,"logDepthBufFC",2/(Math.log(Y.far+1)/Math.LN2)),(Ne.isMeshPhongMaterial||Ne.isMeshToonMaterial||Ne.isMeshLambertMaterial||Ne.isMeshBasicMaterial||Ne.isMeshStandardMaterial||Ne.isShaderMaterial)&&Wn.setValue(Z,"isOrthographic",Y.isOrthographicCamera===!0),G!==Y&&(G=Y,Ln=!0,ks=!0)}if(_e.isSkinnedMesh){Wn.setOptional(Z,_e,"bindMatrix"),Wn.setOptional(Z,_e,"bindMatrixInverse");const Kr=_e.skeleton;Kr&&(Kr.boneTexture===null&&Kr.computeBoneTexture(),Wn.setValue(Z,"boneTexture",Kr.boneTexture,J))}_e.isBatchedMesh&&(Wn.setOptional(Z,_e,"batchingTexture"),Wn.setValue(Z,"batchingTexture",_e._matricesTexture,J),Wn.setOptional(Z,_e,"batchingIdTexture"),Wn.setValue(Z,"batchingIdTexture",_e._indirectTexture,J),Wn.setOptional(Z,_e,"batchingColorTexture"),_e._colorsTexture!==null&&Wn.setValue(Z,"batchingColorTexture",_e._colorsTexture,J));const Ya=Ce.morphAttributes;if((Ya.position!==void 0||Ya.normal!==void 0||Ya.color!==void 0)&&St.update(_e,Ce,Nr),(Ln||vt.receiveShadow!==_e.receiveShadow)&&(vt.receiveShadow=_e.receiveShadow,Wn.setValue(Z,"receiveShadow",_e.receiveShadow)),Ne.isMeshGouraudMaterial&&Ne.envMap!==null&&(no.envMap.value=Pt,no.flipEnvMap.value=Pt.isCubeTexture&&Pt.isRenderTargetTexture===!1?-1:1),Ne.isMeshStandardMaterial&&Ne.envMap===null&&xe.environment!==null&&(no.envMapIntensity.value=xe.environmentIntensity),Ln&&(Wn.setValue(Z,"toneMappingExposure",T.toneMappingExposure),vt.needsLights&&du(no,ks),ot&&Ne.fog===!0&&it.refreshFogUniforms(no,ot),it.refreshMaterialUniforms(no,Ne,fe,se,_.state.transmissionRenderTarget[Y.id]),q_.upload(Z,cu(vt),no,J)),Ne.isShaderMaterial&&Ne.uniformsNeedUpdate===!0&&(q_.upload(Z,cu(vt),no,J),Ne.uniformsNeedUpdate=!1),Ne.isSpriteMaterial&&Wn.setValue(Z,"center",_e.center),Wn.setValue(Z,"modelViewMatrix",_e.modelViewMatrix),Wn.setValue(Z,"normalMatrix",_e.normalMatrix),Wn.setValue(Z,"modelMatrix",_e.matrixWorld),Ne.isShaderMaterial||Ne.isRawShaderMaterial){const Kr=Ne.uniformsGroups;for(let di=0,Ld=Kr.length;di0&&J.useMultisampledRTT(Y)===!1?_e=dt.get(Y).__webglMultisampledFramebuffer:Array.isArray($t)?_e=$t[Ce]:_e=$t,k.copy(Y.viewport),U.copy(Y.scissor),H=Y.scissorTest}else k.copy(K).multiplyScalar(fe).floor(),U.copy(V).multiplyScalar(fe).floor(),H=q;if(tt.bindFramebuffer(Z.FRAMEBUFFER,_e)&&Ne&&tt.drawBuffers(Y,_e),tt.viewport(k),tt.scissor(U),tt.setScissorTest(H),ot){const Pt=dt.get(Y.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Pt.__webglTexture,Ce)}else if(xt){const Pt=dt.get(Y.texture),Ht=xe||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Pt.__webglTexture,Ce||0,Ht)}F=-1},this.readRenderTargetPixels=function(Y,xe,Ce,Ne,_e,ot,xt){if(!(Y&&Y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ct=dt.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&xt!==void 0&&(ct=ct[xt]),ct){tt.bindFramebuffer(Z.FRAMEBUFFER,ct);try{const Pt=Y.texture,Ht=Pt.format,$t=Pt.type;if(!We.textureFormatReadable(Ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!We.textureTypeReadable($t)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}xe>=0&&xe<=Y.width-Ne&&Ce>=0&&Ce<=Y.height-_e&&Z.readPixels(xe,Ce,Ne,_e,de.convert(Ht),de.convert($t),ot)}finally{const Pt=L!==null?dt.get(L).__webglFramebuffer:null;tt.bindFramebuffer(Z.FRAMEBUFFER,Pt)}}},this.readRenderTargetPixelsAsync=async function(Y,xe,Ce,Ne,_e,ot,xt){if(!(Y&&Y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ct=dt.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&xt!==void 0&&(ct=ct[xt]),ct){const Pt=Y.texture,Ht=Pt.format,$t=Pt.type;if(!We.textureFormatReadable(Ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!We.textureTypeReadable($t))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(xe>=0&&xe<=Y.width-Ne&&Ce>=0&&Ce<=Y.height-_e){tt.bindFramebuffer(Z.FRAMEBUFFER,ct);const Ot=Z.createBuffer();Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Ot),Z.bufferData(Z.PIXEL_PACK_BUFFER,ot.byteLength,Z.STREAM_READ),Z.readPixels(xe,Ce,Ne,_e,de.convert(Ht),de.convert($t),0);const An=L!==null?dt.get(L).__webglFramebuffer:null;tt.bindFramebuffer(Z.FRAMEBUFFER,An);const Tn=Z.fenceSync(Z.SYNC_GPU_COMMANDS_COMPLETE,0);return Z.flush(),await Whe(Z,Tn,4),Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Ot),Z.getBufferSubData(Z.PIXEL_PACK_BUFFER,0,ot),Z.deleteBuffer(Ot),Z.deleteSync(Tn),ot}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(Y,xe=null,Ce=0){Y.isTexture!==!0&&(X_("WebGLRenderer: copyFramebufferToTexture function signature has changed."),xe=arguments[0]||null,Y=arguments[1]);const Ne=Math.pow(2,-Ce),_e=Math.floor(Y.image.width*Ne),ot=Math.floor(Y.image.height*Ne),xt=xe!==null?xe.x:0,ct=xe!==null?xe.y:0;J.setTexture2D(Y,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,Ce,0,0,xt,ct,_e,ot),tt.unbindTexture()},this.copyTextureToTexture=function(Y,xe,Ce=null,Ne=null,_e=0){Y.isTexture!==!0&&(X_("WebGLRenderer: copyTextureToTexture function signature has changed."),Ne=arguments[0]||null,Y=arguments[1],xe=arguments[2],_e=arguments[3]||0,Ce=null);let ot,xt,ct,Pt,Ht,$t;Ce!==null?(ot=Ce.max.x-Ce.min.x,xt=Ce.max.y-Ce.min.y,ct=Ce.min.x,Pt=Ce.min.y):(ot=Y.image.width,xt=Y.image.height,ct=0,Pt=0),Ne!==null?(Ht=Ne.x,$t=Ne.y):(Ht=0,$t=0);const Ot=de.convert(xe.format),An=de.convert(xe.type);J.setTexture2D(xe,0),Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,xe.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,xe.unpackAlignment);const Tn=Z.getParameter(Z.UNPACK_ROW_LENGTH),_n=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),en=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Bt=Z.getParameter(Z.UNPACK_SKIP_ROWS),vt=Z.getParameter(Z.UNPACK_SKIP_IMAGES),wn=Y.isCompressedTexture?Y.mipmaps[_e]:Y.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,wn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,wn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,ct),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Pt),Y.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,_e,Ht,$t,ot,xt,Ot,An,wn.data):Y.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,_e,Ht,$t,wn.width,wn.height,Ot,wn.data):Z.texSubImage2D(Z.TEXTURE_2D,_e,Ht,$t,ot,xt,Ot,An,wn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Tn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,_n),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,en),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Bt),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,vt),_e===0&&xe.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),tt.unbindTexture()},this.copyTextureToTexture3D=function(Y,xe,Ce=null,Ne=null,_e=0){Y.isTexture!==!0&&(X_("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Ce=arguments[0]||null,Ne=arguments[1]||null,Y=arguments[2],xe=arguments[3],_e=arguments[4]||0);let ot,xt,ct,Pt,Ht,$t,Ot,An,Tn;const _n=Y.isCompressedTexture?Y.mipmaps[_e]:Y.image;Ce!==null?(ot=Ce.max.x-Ce.min.x,xt=Ce.max.y-Ce.min.y,ct=Ce.max.z-Ce.min.z,Pt=Ce.min.x,Ht=Ce.min.y,$t=Ce.min.z):(ot=_n.width,xt=_n.height,ct=_n.depth,Pt=0,Ht=0,$t=0),Ne!==null?(Ot=Ne.x,An=Ne.y,Tn=Ne.z):(Ot=0,An=0,Tn=0);const en=de.convert(xe.format),Bt=de.convert(xe.type);let vt;if(xe.isData3DTexture)J.setTexture3D(xe,0),vt=Z.TEXTURE_3D;else if(xe.isDataArrayTexture||xe.isCompressedArrayTexture)J.setTexture2DArray(xe,0),vt=Z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,xe.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,xe.unpackAlignment);const wn=Z.getParameter(Z.UNPACK_ROW_LENGTH),rn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Nr=Z.getParameter(Z.UNPACK_SKIP_PIXELS),ui=Z.getParameter(Z.UNPACK_SKIP_ROWS),Ln=Z.getParameter(Z.UNPACK_SKIP_IMAGES);Z.pixelStorei(Z.UNPACK_ROW_LENGTH,_n.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,_n.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Pt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Ht),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,$t),Y.isDataTexture||Y.isData3DTexture?Z.texSubImage3D(vt,_e,Ot,An,Tn,ot,xt,ct,en,Bt,_n.data):xe.isCompressedArrayTexture?Z.compressedTexSubImage3D(vt,_e,Ot,An,Tn,ot,xt,ct,en,_n.data):Z.texSubImage3D(vt,_e,Ot,An,Tn,ot,xt,ct,en,Bt,_n),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,wn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,rn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Nr),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,ui),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,Ln),_e===0&&xe.generateMipmaps&&Z.generateMipmap(vt),tt.unbindTexture()},this.initRenderTarget=function(Y){dt.get(Y).__webglFramebuffer===void 0&&J.setupRenderTarget(Y)},this.initTexture=function(Y){Y.isCubeTexture?J.setTextureCube(Y,0):Y.isData3DTexture?J.setTexture3D(Y,0):Y.isDataArrayTexture||Y.isCompressedArrayTexture?J.setTexture2DArray(Y,0):J.setTexture2D(Y,0),tt.unbindTexture()},this.resetState=function(){O=0,N=0,L=null,tt.reset(),qe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ml}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===QS?"display-p3":"srgb",n.unpackColorSpace=On.workingColorSpace===ux?"display-p3":"srgb"}}class tM{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ut(e),this.density=n}clone(){return new tM(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class nM{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new ut(e),this.near=n,this.far=r}clone(){return new nM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class kR extends yn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new us,this.environmentIntensity=1,this.environmentRotation=new us,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}class np{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=Iy,this.updateRanges=[],this.version=0,this.uuid=Mo()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,r){e*=this.stride,r*=n.stride;for(let i=0,s=this.stride;ie.far||n.push({distance:l,point:w0.clone(),uv:Ys.getInterpolation(w0,s_,M0,o_,CD,SA,PD,new Ve),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function a_(t,e,n,r,i,s){Rm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(S0.x=s*Rm.x-i*Rm.y,S0.y=i*Rm.x+s*Rm.y):S0.copy(Rm),t.copy(e),t.x+=S0.x,t.y+=S0.y,t.applyMatrix4(b6)}const l_=new X,RD=new X;class w6 extends yn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let r=0,i=n.length;r0){let r,i;for(r=1,i=n.length;r0){l_.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(l_);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){l_.setFromMatrixPosition(e.matrixWorld),RD.setFromMatrixPosition(this.matrixWorld);const r=l_.distanceTo(RD)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i=o)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}}const Ju=new kt,AA=new kt,hye=new kt,pye=new ut(1,1,1),FD=new kt,TA=new hx,d_=new cs,kf=new Hi,T0=new X,zD=new X,mye=new X,CA=new fye,rs=new xr,f_=[];function gye(t,e,n=0){const r=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const i=t.count;for(let s=0;s65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new nn(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const n=this.geometry;if(!!e.getIndex()!=!!n.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in n.attributes){if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=n.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new cs);const e=this.boundingBox,n=this._drawInfo;e.makeEmpty();for(let r=0,i=n.length;r=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=r):(i=this._drawInfo.length,this._drawInfo.push(r));const s=this._matricesTexture,o=s.image.data;hye.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(pye.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,n=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),n===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=n,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),d=c!==null;if(d&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const f=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:d?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new cs,sphereInitialized:!1,sphere:new Hi}),this.setGeometryAt(f,e),f}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=n.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||n.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const y in r.attributes){const x=n.getAttribute(y),S=r.getAttribute(y);gye(x,S,l);const _=x.itemSize;for(let w=x.count,E=c;w=n.length||n[e].active===!1?this:(n[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,n){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,d=l.start+l.count;c=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,d_),d_.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let d=l.start,f=l.start+l.count;d=r.length||r[e].active===!1?this:(n.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,n){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:n.fromArray(i,e*16)}setColorAt(e,n){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(n.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,n){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:n.fromArray(r,e*4)}setVisibleAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===n?this:(r[e].visible=n,this._visibilityChanged=!0,this)}getVisibleAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?!1:n[e].visible}setGeometryIdAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||n<0||n>=this._geometryCount?null:(r[e].geometryIndex=n,this)}getGeometryIdAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?-1:n[e].geometryIndex}getGeometryRangeAt(e,n={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return n.start=r.start,n.count=r.count,n}raycast(e,n){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,o=this.geometry;rs.material=this.material,rs.geometry.index=o.index,rs.geometry.attributes=o.attributes,rs.geometry.boundingBox===null&&(rs.geometry.boundingBox=new cs),rs.geometry.boundingSphere===null&&(rs.geometry.boundingSphere=new Hi);for(let a=0,l=r.length;a({...n})),this._reservedRanges=e._reservedRanges.map(n=>({...n})),this._drawInfo=e._drawInfo.map(n=>({...n})),this._bounds=e._bounds.map(n=>({boxInitialized:n.boxInitialized,box:n.box.clone(),sphereInitialized:n.sphereInitialized,sphere:n.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,n,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,m=this.perObjectFrustumCulled,y=this._indirectTexture,x=y.image.data;m&&(FD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),TA.setFromProjectionMatrix(FD,e.coordinateSystem));let S=0;if(this.sortObjects){AA.copy(this.matrixWorld).invert(),T0.setFromMatrixPosition(r.matrixWorld).applyMatrix4(AA),zD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(AA);for(let E=0,T=l.length;E0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;PA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(PA);if(!(le.far))return{distance:l,point:HD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const VD=new X,GD=new X;class to extends zl{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[];for(let i=0,s=n.count;i0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class vye extends hr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Rr,this.magFilter=s!==void 0?s:Rr,this.generateMipmaps=!1;const d=this;function f(){d.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class yye extends hr{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=si,this.minFilter=si,this.generateMipmaps=!1,this.needsUpdate=!0}}class oM extends hr{constructor(e,n,r,i,s,o,a,l,c,d,f,m){super(null,o,a,l,c,d,i,s,f,m),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class xye extends oM{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=wo,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class bye extends oM{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,Jc),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class _ye extends hr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class qa{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),s=0;n.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const r=this.getLengths();let i=0;const s=r.length;let o;n?o=n:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const d=r[i],m=r[i+1]-d,y=(o-d)/m;return(i+y)/(s-1)}getTangent(e,n){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=n||(o.isVector2?new Ve:new X);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new X,i=[],s=[],o=[],a=new X,l=new kt;for(let y=0;y<=e;y++){const x=y/e;i[y]=this.getTangentAt(x,new X)}s[0]=new X,o[0]=new X;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),m=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),m<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let y=1;y<=e;y++){if(s[y]=s[y-1].clone(),o[y]=o[y-1].clone(),a.crossVectors(i[y-1],i[y]),a.length()>Number.EPSILON){a.normalize();const x=Math.acos(Cr(i[y-1].dot(i[y]),-1,1));s[y].applyMatrix4(l.makeRotationAxis(a,x))}o[y].crossVectors(i[y],s[y])}if(n===!0){let y=Math.acos(Cr(s[0].dot(s[e]),-1,1));y/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(y=-y);for(let x=1;x<=e;x++)s[x].applyMatrix4(l.makeRotationAxis(i[x],y*x)),o[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class aM extends qa{constructor(e=0,n=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n=new Ve){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,d;this.closed||a>0?c=i[(a-1)%s]:(v_.subVectors(i[0],i[1]).add(i[0]),c=v_);const f=i[a%s],m=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(XD(a,l.x,c.x,d.x,f.x),XD(a,l.y,c.y,d.y,f.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;r1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const d=c.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class px extends tn{constructor(e=[new Ve(0,-.5),new Ve(.5,0),new Ve(0,.5)],n=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=Cr(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/n,f=new X,m=new Ve,y=new X,x=new X,S=new X;let _=0,w=0;for(let E=0;E<=e.length-1;E++)switch(E){case 0:_=e[E+1].x-e[E].x,w=e[E+1].y-e[E].y,y.x=w*1,y.y=-_,y.z=w*0,S.copy(y),y.normalize(),l.push(y.x,y.y,y.z);break;case e.length-1:l.push(S.x,S.y,S.z);break;default:_=e[E+1].x-e[E].x,w=e[E+1].y-e[E].y,y.x=w*1,y.y=-_,y.z=w*0,x.copy(y),y.x+=S.x,y.y+=S.y,y.z+=S.z,y.normalize(),l.push(y.x,y.y,y.z),S.copy(x)}for(let E=0;E<=n;E++){const T=r+E*d*i,C=Math.sin(T),O=Math.cos(T);for(let N=0;N<=e.length-1;N++){f.x=e[N].x*C,f.y=e[N].y,f.z=e[N].x*O,o.push(f.x,f.y,f.z),m.x=E/n,m.y=N/(e.length-1),a.push(m.x,m.y);const L=l[3*N+0]*C,F=l[3*N+1],G=l[3*N+0]*O;c.push(L,F,G)}}for(let E=0;E0&&T(!0),n>0&&T(!1)),this.setIndex(d),this.setAttribute("position",new Ut(f,3)),this.setAttribute("normal",new Ut(m,3)),this.setAttribute("uv",new Ut(y,2));function E(){const C=new X,O=new X;let N=0;const L=(n-e)/r;for(let F=0;F<=s;F++){const G=[],k=F/s,U=k*(n-e)+e;for(let H=0;H<=i;H++){const ne=H/i,ee=ne*l+a,pe=Math.sin(ee),se=Math.cos(ee);O.x=U*pe,O.y=-k*r+_,O.z=U*se,f.push(O.x,O.y,O.z),C.set(pe,L,se).normalize(),m.push(C.x,C.y,C.z),y.push(ne,1-k),G.push(x++)}S.push(G)}for(let F=0;F0&&(d.push(k,U,ne),N+=3),n>0&&(d.push(U,H,ne),N+=3)}c.addGroup(w,N,0),w+=N}function T(C){const O=x,N=new Ve,L=new X;let F=0;const G=C===!0?e:n,k=C===!0?1:-1;for(let H=1;H<=i;H++)f.push(0,_*k,0),m.push(0,k,0),y.push(.5,.5),x++;const U=x;for(let H=0;H<=i;H++){const ee=H/i*l+a,pe=Math.cos(ee),se=Math.sin(ee);L.x=G*se,L.y=_*k,L.z=G*pe,f.push(L.x,L.y,L.z),m.push(0,k,0),N.x=pe*.5+.5,N.y=se*.5*k+.5,y.push(N.x,N.y),x++}for(let H=0;H.9&&L<.1&&(T<.2&&(o[E+0]+=1),C<.2&&(o[E+2]+=1),O<.2&&(o[E+4]+=1))}}function m(E){s.push(E.x,E.y,E.z)}function y(E,T){const C=E*3;T.x=e[C+0],T.y=e[C+1],T.z=e[C+2]}function x(){const E=new X,T=new X,C=new X,O=new X,N=new Ve,L=new Ve,F=new Ve;for(let G=0,k=0;G80*n){a=c=t[0],l=d=t[1];for(let x=n;xc&&(c=f),m>d&&(d=m);y=Math.max(c-a,d-l),y=y!==0?32767/y:0}return Dy(s,o,n,a,l,y,0),o}};function R6(t,e,n,r,i){let s,o;if(i===Wye(t,e,n,r)>0)for(s=e;s=e;s-=r)o=qD(s,t[s],t[s+1],o);return o&&fM(o,o.next)&&(Uy(o),o=o.next),o}function Hh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(fM(n,n.next)||yr(n.prev,n,n.next)===0)){if(Uy(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Dy(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Fye(t,r,i,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Nye(t,r,i,s):Rye(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Uy(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=Iye(Hh(t),e,n),Dy(t,e,n,r,i,s,2)):o===2&&kye(t,e,n,r,i,s):Dy(Hh(t),e,n,r,i,s,1);break}}}function Rye(t){const e=t.prev,n=t,r=t.next;if(yr(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,c=r.y,d=is?i>o?i:o:s>o?s:o,y=a>l?a>c?a:c:l>c?l:c;let x=r.next;for(;x!==e;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=y&&Km(i,a,s,l,o,c,x.x,x.y)&&yr(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function Nye(t,e,n,r){const i=t.prev,s=t,o=t.next;if(yr(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,d=i.y,f=s.y,m=o.y,y=al?a>c?a:c:l>c?l:c,_=d>f?d>m?d:m:f>m?f:m,w=JC(y,x,e,n,r),E=JC(S,_,e,n,r);let T=t.prevZ,C=t.nextZ;for(;T&&T.z>=w&&C&&C.z<=E;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=_&&T!==i&&T!==o&&Km(a,d,l,f,c,m,T.x,T.y)&&yr(T.prev,T,T.next)>=0||(T=T.prevZ,C.x>=y&&C.x<=S&&C.y>=x&&C.y<=_&&C!==i&&C!==o&&Km(a,d,l,f,c,m,C.x,C.y)&&yr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;T&&T.z>=w;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=_&&T!==i&&T!==o&&Km(a,d,l,f,c,m,T.x,T.y)&&yr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;C&&C.z<=E;){if(C.x>=y&&C.x<=S&&C.y>=x&&C.y<=_&&C!==i&&C!==o&&Km(a,d,l,f,c,m,C.x,C.y)&&yr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Iye(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!fM(i,s)&&N6(i,r,r.next,s)&&jy(i,s)&&jy(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Uy(r),Uy(r.next),r=t=s),r=r.next}while(r!==t);return Hh(r)}function kye(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Hye(o,a)){let l=I6(o,a);o=Hh(o,o.next),l=Hh(l,l.next),Dy(o,e,n,r,i,s,0),Dy(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function Oye(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const m=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(m<=s&&m>r&&(r=m,i=n.x=n.x&&n.x>=l&&s!==n.x&&Km(oi.x||n.x===i.x&&Uye(i,n)))&&(i=n,d=f)),n=n.next;while(n!==a);return i}function Uye(t,e){return yr(t.prev,t,e.prev)<0&&yr(e.next,t,t.next)<0}function Fye(t,e,n,r){let i=t;do i.z===0&&(i.z=JC(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,zye(i)}function zye(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function JC(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Bye(t){let e=t,n=t;do(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function Hye(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Vye(t,e)&&(jy(t,e)&&jy(e,t)&&Gye(t,e)&&(yr(t.prev,t,e.prev)||yr(t,e.prev,e))||fM(t,e)&&yr(t.prev,t,t.next)>0&&yr(e.prev,e,e.next)>0)}function yr(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function fM(t,e){return t.x===e.x&&t.y===e.y}function N6(t,e,n,r){const i=w_(yr(t,e,n)),s=w_(yr(t,e,r)),o=w_(yr(n,r,t)),a=w_(yr(n,r,e));return!!(i!==s&&o!==a||i===0&&__(t,n,e)||s===0&&__(t,r,e)||o===0&&__(n,t,r)||a===0&&__(n,e,r))}function __(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function w_(t){return t>0?1:t<0?-1:0}function Vye(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&N6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function jy(t,e){return yr(t.prev,t,t.next)<0?yr(t,e,t.next)>=0&&yr(t,t.prev,e)>=0:yr(t,e,t.prev)<0||yr(t,t.next,e)<0}function Gye(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function I6(t,e){const n=new eP(t.i,t.x,t.y),r=new eP(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function qD(t,e,n,r){const i=new eP(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Uy(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function eP(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Wye(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function YD(t,e){for(let n=0;nNumber.EPSILON){const He=Math.sqrt(Me),Be=Math.sqrt(J*J+$*$),bt=Z.x-dt/He,it=Z.y+wt/He,ht=Ge.x-$/Be,Gt=Ge.y+J/Be,Ke=((ht-bt)*$-(Gt-it)*J)/(wt*$-dt*J);Oe=bt+wt*Ke-ue.x,We=it+dt*Ke-ue.y;const re=Oe*Oe+We*We;if(re<=2)return new Ve(Oe,We);tt=Math.sqrt(re/2)}else{let He=!1;wt>Number.EPSILON?J>Number.EPSILON&&(He=!0):wt<-Number.EPSILON?J<-Number.EPSILON&&(He=!0):Math.sign(dt)===Math.sign($)&&(He=!0),He?(Oe=-dt,We=wt,tt=Math.sqrt(Me)):(Oe=wt,We=dt,tt=Math.sqrt(Me/2))}return new Ve(Oe/tt,We/tt)}const Q=[];for(let ue=0,Z=ee.length,Ge=Z-1,Oe=ue+1;ue=0;ue--){const Z=ue/_,Ge=y*Math.cos(Z*Math.PI/2),Oe=x*Math.sin(Z*Math.PI/2)+S;for(let We=0,tt=ee.length;We=0;){const Oe=Ge;let We=Ge-1;We<0&&(We=ue.length-1);for(let tt=0,wt=d+_*2;tt0)&&y.push(T,C,N),(w!==r-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class D6 extends $r{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ut(16777215),this.specular=new ut(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new us,this.combine=lx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class j6 extends $r{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ut(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class U6 extends $r{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class F6 extends $r{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new us,this.combine=lx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class z6 extends $r{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ut(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class B6 extends qr{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function ch(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function H6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function V6(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function tP(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const a=n[s]*e;for(let l=0;l!==e;++l)i[o++]=t[a+l]}return i}function GR(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),n.push.apply(n,o)),s=t[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),n.push(o)),s=t[i++];while(s!==void 0)}function Kye(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l=r)){f.push(c.times[y]);for(let S=0;Ss.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[x]){const w=x*f+d,E=w+f-d;S=a.values.slice(w,E)}else{const w=a.createInterpolant(),E=d,T=f-d;w.evaluate(s),S=w.resultBuffer.slice(E,T)}l==="quaternion"&&new Jt().fromArray(S).normalize().conjugate().toArray(S);const _=c.times.length;for(let w=0;w<_;++w){const E=w*y+m;if(l==="quaternion")Jt.multiplyQuaternionsFlat(c.values,E,S,0,c.values,E);else{const T=y-m*2;for(let C=0;C=s)){const a=n[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;en;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&H6(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===$_,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}Ka.prototype.TimeBufferType=Float32Array;Ka.prototype.ValueBufferType=Float32Array;Ka.prototype.DefaultInterpolation=Dg;class rp extends Ka{constructor(e,n,r){super(e,n,r)}}rp.prototype.ValueTypeName="bool";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=Lg;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class $R extends Ka{}$R.prototype.ValueTypeName="color";class Vh extends Ka{}Vh.prototype.ValueTypeName="number";class $6 extends av{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let c=e*a;for(let d=c+a;c!==d;c+=4)Jt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Gh extends Ka{InterpolantFactoryMethodLinear(e){return new $6(this.times,this.values,this.getValueSize(),e)}}Gh.prototype.ValueTypeName="quaternion";Gh.prototype.InterpolantFactoryMethodSmooth=void 0;class ip extends Ka{constructor(e,n,r){super(e,n,r)}}ip.prototype.ValueTypeName="string";ip.prototype.ValueBufferType=Array;ip.prototype.DefaultInterpolation=Lg;ip.prototype.InterpolantFactoryMethodLinear=void 0;ip.prototype.InterpolantFactoryMethodSmooth=void 0;class Wh extends Ka{}Wh.prototype.ValueTypeName="vector";class Fg{constructor(e="",n=-1,r=[],i=ZS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=Mo(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)n.push(Jye(r[o]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)n.push(Ka.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a1){const f=d[1];let m=i[f];m||(i[f]=m=[]),m.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return o}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(f,m,y,x,S){if(y.length!==0){const _=[],w=[];GR(y,_,w,x),_.length!==0&&S.push(new f(m,_,w))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f{n&&n(s),this.manager.itemEnd(e)},0),s;if(Pc[e]!==void 0){Pc[e].push({onLoad:n,onProgress:r,onError:i});return}Pc[e]=[],Pc[e].push({onLoad:n,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Pc[e],f=c.body.getReader(),m=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),y=m?parseInt(m):0,x=y!==0;let S=0;const _=new ReadableStream({start(w){E();function E(){f.read().then(({done:T,value:C})=>{if(T)w.close();else{S+=C.byteLength;const O=new ProgressEvent("progress",{lengthComputable:x,loaded:S,total:y});for(let N=0,L=d.length;N{w.error(T)})}}});return new Response(_)}else throw new exe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),m=f&&f[1]?f[1].toLowerCase():void 0,y=new TextDecoder(m);return c.arrayBuffer().then(x=>y.decode(x))}}}).then(c=>{Hc.add(e,c);const d=Pc[e];delete Pc[e];for(let f=0,m=d.length;f{const d=Pc[e];if(d===void 0)throw this.manager.itemError(e),c;delete Pc[e];for(let f=0,m=d.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class txe extends Is{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Wa(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new ut().setHex(o.value);break;case"v2":i.uniforms[s].value=new Ve().fromArray(o.value);break;case"v3":i.uniforms[s].value=new X().fromArray(o.value);break;case"v4":i.uniforms[s].value=new jn().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Zt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new kt().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Ve().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Ve().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return _M.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:O6,SpriteMaterial:OR,RawShaderMaterial:L6,ShaderMaterial:ea,PointsMaterial:sM,MeshPhysicalMaterial:ia,MeshStandardMaterial:vx,MeshPhongMaterial:D6,MeshToonMaterial:j6,MeshNormalMaterial:U6,MeshLambertMaterial:F6,MeshDepthMaterial:NR,MeshDistanceMaterial:IR,MeshBasicMaterial:Cs,MeshMatcapMaterial:z6,LineDashedMaterial:B6,LineBasicMaterial:qr,Material:$r};return new n[e]}}class Md{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let r=0,i=e.length;r0){const l=new XR(n);s=new zg(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){i=new zg(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const _=new cs;_.min.fromArray(S.boxMin),_.max.fromArray(S.boxMax);const w=new Hi;return w.radius=S.sphereRadius,w.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:_,sphereInitialized:S.sphereInitialized,sphere:w}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new w6;break;case"Line":o=new zl(a(e.geometry),l(e.material));break;case"LineLoop":o=new DR(a(e.geometry),l(e.material));break;case"LineSegments":o=new to(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new jR(a(e.geometry),l(e.material));break;case"Sprite":o=new _6(l(e.material));break;case"Group":o=new Ps;break;case"Bone":o=new iM;break;default:o=new yn}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let y=0;y"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hc.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Hc.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Hc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Hc.add(e,l),s.manager.itemStart(e)}}let S_;class QR{static getContext(){return S_===void 0&&(S_=new(window.AudioContext||window.webkitAudioContext)),S_}static setContext(e){S_=e}}class uxe extends Is{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Wa(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);QR.getContext().decodeAudioData(c,function(f){n(f)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const ij=new kt,sj=new kt,Of=new kt;class dxe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Pr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Pr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,Of.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(Ah*n.fov*.5)/n.zoom;let a,l;sj.elements[12]=-i,ij.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,Of.elements[0]=2*n.near/(l-a),Of.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Of),a=-o*n.aspect-s,l=o*n.aspect-s,Of.elements[0]=2*n.near/(l-a),Of.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Of)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(sj),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(ij)}}class JR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=oj(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=oj();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function oj(){return performance.now()}const Lf=new X,aj=new Jt,fxe=new X,Df=new X;class hxe extends yn{constructor(){super(),this.type="AudioListener",this.context=QR.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new JR}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Lf,aj,fxe),Df.set(0,0,-1).applyQuaternion(aj),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Lf.x,i),n.positionY.linearRampToValueAtTime(Lf.y,i),n.positionZ.linearRampToValueAtTime(Lf.z,i),n.forwardX.linearRampToValueAtTime(Df.x,i),n.forwardY.linearRampToValueAtTime(Df.y,i),n.forwardZ.linearRampToValueAtTime(Df.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(Lf.x,Lf.y,Lf.z),n.setOrientation(Df.x,Df.y,Df.z,r.x,r.y,r.z)}}let rG=class extends yn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e0&&this._mixBufferRegionAdditive(r,i,this._addIndex*n,1,n);for(let l=n,c=n+n;l!==c;++l)if(r[l]!==r[l+n]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let s=r,o=i;s!==o;++s)n[s]=n[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[n+o]=e[r+o]}_slerp(e,n,r,i){Jt.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;Jt.multiplyQuaternionsFlat(e,o,e,n,e,r),Jt.slerpFlat(e,n,e,n,e,o,i)}_lerp(e,n,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=n+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,n,r,i,s){for(let o=0;o!==s;++o){const a=n+o;e[a]=e[a]+e[r+o]*i}}}const eN="\\[\\]\\.:\\/",vxe=new RegExp("["+eN+"]","g"),tN="[^"+eN+"]",yxe="[^"+eN.replace("\\.","")+"]",xxe=/((?:WC+[\/:])*)/.source.replace("WC",tN),bxe=/(WCOD+)?/.source.replace("WCOD",yxe),_xe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",tN),wxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",tN),Sxe=new RegExp("^"+xxe+bxe+_xe+wxe+"$"),Mxe=["material","materials","bones","map"];class Exe{constructor(e,n,r){const i=r||kn.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,i)}getValue(e,n){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,n)}setValue(e,n){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].unbind()}}class kn{constructor(e,n,r){this.path=n,this.parsedPath=r||kn.parseTrackName(n),this.node=kn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,r){return e&&e.isAnimationObjectGroup?new kn.Composite(e,n,r):new kn(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(vxe,"")}static parseTrackName(e){const n=Sxe.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);Mxe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o=s){const f=s++,m=e[f];n[m.uuid]=d,e[d]=m,n[c]=f,e[f]=l;for(let y=0,x=i;y!==x;++y){const S=r[y],_=S[f],w=S[d];S[d]=_,S[f]=w}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],d=c.uuid,f=n[d];if(f!==void 0)if(delete n[d],f0&&(n[y.uuid]=f),e[f]=y,e.pop();for(let x=0,S=i;x!==S;++x){const _=r[x];_[f]=_[m],_.pop()}}}this.nCachedObjects_=s}subscribe_(e,n){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,f=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(f);for(let m=d,y=l.length;m!==y;++m){const x=l[m];f[m]=new kn(x,e,n)}return f}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];n[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class sG{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,o=s.length,a=new Array(o),l={endingStart:oh,endingEnd:oh};for(let c=0;c!==o;++c){const d=s[c].createInterpolant(null);a[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=GV,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,r){if(e.fadeOut(n),this.fadeIn(n),r){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,r){return e.crossFadeFrom(this,n,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,r){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=n/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?n=0:(this._startTime=null,n=r*l)}n*=this._updateTimeScale(e);const o=this._updateTime(n),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case _R:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case ZS:default:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulate(i,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===WV;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===VV){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=n||i<0){const a=Math.floor(i/n);i-=n*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=ah,i.endingEnd=ah):(e?i.endingStart=this.zeroSlopeAtStart?ah:oh:i.endingStart=Cy,n?i.endingEnd=this.zeroSlopeAtEnd?ah:oh:i.endingEnd=Cy)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=n,a[1]=s+e,l[1]=r,this}}const Txe=new Float32Array(1);class Cxe extends Vl{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let f=0;f!==s;++f){const m=i[f],y=m.name;let x=d[y];if(x!==void 0)++x.referenceCount,o[f]=x;else{if(x=o[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,l,y));continue}const S=n&&n._propertyBindings[f].binding.parsedPath;x=new iG(kn.create(r,y,S),m.ValueTypeName,m.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,l,y),o[f]=x}a[f].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const n=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let n=0;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,dj).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const fj=new X,M_=new X;class Oxe{constructor(e=new X,n=new X){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){fj.subVectors(e,this.start),M_.subVectors(this.end,this.start);const r=M_.dot(M_);let s=M_.dot(fj)/r;return n&&(s=Cr(s,0,1)),s}closestPointToPoint(e,n,r){const i=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const hj=new X;class Lxe extends yn{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new tn,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let f=0;f.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{yj.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(yj,n)}}setLength(e,n=e*.2,r=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(r,n,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class lG extends to{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new tn;i.setAttribute("position",new Ut(n,3)),i.setAttribute("color",new Ut(r,3));const s=new qr({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new ut,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(n),i.toArray(s,6),i.toArray(s,9),i.set(r),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class qxe{constructor(){this.type="ShapePath",this.color=new ut,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new Ly,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,s,o){return this.currentPath.bezierCurveTo(e,n,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(w){const E=[];for(let T=0,C=w.length;TNumber.EPSILON){if(k<0&&(L=E[N],G=-G,F=E[O],k=-k),w.yF.y)continue;if(w.y===L.y){if(w.x===L.x)return!0}else{const U=k*(w.x-L.x)-G*(w.y-L.y);if(U===0)return!0;if(U<0)continue;C=!C}}else{if(w.y!==L.y)continue;if(F.x<=w.x&&w.x<=L.x||L.x<=w.x&&w.x<=F.x)return!0}}return C}const i=Nl.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Ch,l.curves=a.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],m=[];let y=[],x=0,S;m[x]=void 0,y[x]=[];for(let w=0,E=s.length;w1){let w=!1,E=0;for(let T=0,C=m.length;T0&&w===!1&&(y=f)}let _;for(let w=0,E=m.length;w=0&&(C[Ee]=null,T[Ee].disconnect(we))}for(let ce=0;ce=C.length){C.push(we),Ee=Se;break}else if(C[Se]===null){C[Se]=we,Ee=Se;break}if(Ee===-1)break}const Xe=T[Ee];Xe&&Xe.connect(we)}}const ie=new X,fe=new X;function B(ae,ce,we){ie.setFromMatrixPosition(ce.matrixWorld),fe.setFromMatrixPosition(we.matrixWorld);const Ee=ie.distanceTo(fe),Xe=ce.projectionMatrix.elements,Se=we.projectionMatrix.elements,je=Xe[14]/(Xe[10]-1),$e=Xe[14]/(Xe[10]+1),ue=(Xe[9]+1)/Xe[5],Z=(Xe[9]-1)/Xe[5],Ve=(Xe[8]-1)/Xe[0],Oe=(Se[8]+1)/Se[0],Ge=je*Ve,et=je*Oe,St=Ee/(-Ve+Oe),ft=St*-Ve;if(ce.matrixWorld.decompose(ae.position,ae.quaternion,ae.scale),ae.translateX(ft),ae.translateZ(St),ae.matrixWorld.compose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldInverse.copy(ae.matrixWorld).invert(),Xe[10]===-1)ae.projectionMatrix.copy(ce.projectionMatrix),ae.projectionMatrixInverse.copy(ce.projectionMatrixInverse);else{const J=je+St,$=$e+St,Me=Ge-ft,Ue=et+(Ee-ft),Be=ue*$e/$*J,ze=Z*$e/$*J;ae.projectionMatrix.makePerspective(Me,Ue,Be,ze,J,$),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert()}}function Q(ae,ce){ce===null?ae.matrixWorld.copy(ae.matrix):ae.matrixWorld.multiplyMatrices(ce.matrixWorld,ae.matrix),ae.matrixWorldInverse.copy(ae.matrixWorld).invert()}this.updateCamera=function(ae){if(i===null)return;let ce=ae.near,we=ae.far;S.texture!==null&&(S.depthNear>0&&(ce=S.depthNear),S.depthFar>0&&(we=S.depthFar)),k.near=F.near=L.near=ce,k.far=F.far=L.far=we,(U!==k.near||H!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),U=k.near,H=k.far);const Ee=ae.parent,Xe=k.cameras;Q(k,Ee);for(let Se=0;Se0&&(w.alphaTest.value=b.alphaTest);const M=e.get(b),T=M.envMap,C=M.envMapRotation;T&&(w.envMap.value=T,kf.copy(C),kf.x*=-1,kf.y*=-1,kf.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(kf.y*=-1,kf.z*=-1),w.envMapRotation.value.setFromMatrix4(vye.makeRotationFromEuler(kf)),w.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=b.reflectivity,w.ior.value=b.ior,w.refractionRatio.value=b.refractionRatio),b.lightMap&&(w.lightMap.value=b.lightMap,w.lightMapIntensity.value=b.lightMapIntensity,n(b.lightMap,w.lightMapTransform)),b.aoMap&&(w.aoMap.value=b.aoMap,w.aoMapIntensity.value=b.aoMapIntensity,n(b.aoMap,w.aoMapTransform))}function o(w,b){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,b.map&&(w.map.value=b.map,n(b.map,w.mapTransform))}function a(w,b){w.dashSize.value=b.dashSize,w.totalSize.value=b.dashSize+b.gapSize,w.scale.value=b.scale}function l(w,b,M,T){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,w.size.value=b.size*M,w.scale.value=T*.5,b.map&&(w.map.value=b.map,n(b.map,w.uvTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,n(b.alphaMap,w.alphaMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest)}function c(w,b){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,w.rotation.value=b.rotation,b.map&&(w.map.value=b.map,n(b.map,w.mapTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,n(b.alphaMap,w.alphaMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest)}function d(w,b){w.specular.value.copy(b.specular),w.shininess.value=Math.max(b.shininess,1e-4)}function f(w,b){b.gradientMap&&(w.gradientMap.value=b.gradientMap)}function g(w,b){w.metalness.value=b.metalness,b.metalnessMap&&(w.metalnessMap.value=b.metalnessMap,n(b.metalnessMap,w.metalnessMapTransform)),w.roughness.value=b.roughness,b.roughnessMap&&(w.roughnessMap.value=b.roughnessMap,n(b.roughnessMap,w.roughnessMapTransform)),b.envMap&&(w.envMapIntensity.value=b.envMapIntensity)}function y(w,b,M){w.ior.value=b.ior,b.sheen>0&&(w.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),w.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(w.sheenColorMap.value=b.sheenColorMap,n(b.sheenColorMap,w.sheenColorMapTransform)),b.sheenRoughnessMap&&(w.sheenRoughnessMap.value=b.sheenRoughnessMap,n(b.sheenRoughnessMap,w.sheenRoughnessMapTransform))),b.clearcoat>0&&(w.clearcoat.value=b.clearcoat,w.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(w.clearcoatMap.value=b.clearcoatMap,n(b.clearcoatMap,w.clearcoatMapTransform)),b.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap,n(b.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),b.clearcoatNormalMap&&(w.clearcoatNormalMap.value=b.clearcoatNormalMap,n(b.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),b.side===ls&&w.clearcoatNormalScale.value.negate())),b.dispersion>0&&(w.dispersion.value=b.dispersion),b.iridescence>0&&(w.iridescence.value=b.iridescence,w.iridescenceIOR.value=b.iridescenceIOR,w.iridescenceThicknessMinimum.value=b.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=b.iridescenceThicknessRange[1],b.iridescenceMap&&(w.iridescenceMap.value=b.iridescenceMap,n(b.iridescenceMap,w.iridescenceMapTransform)),b.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=b.iridescenceThicknessMap,n(b.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),b.transmission>0&&(w.transmission.value=b.transmission,w.transmissionSamplerMap.value=M.texture,w.transmissionSamplerSize.value.set(M.width,M.height),b.transmissionMap&&(w.transmissionMap.value=b.transmissionMap,n(b.transmissionMap,w.transmissionMapTransform)),w.thickness.value=b.thickness,b.thicknessMap&&(w.thicknessMap.value=b.thicknessMap,n(b.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=b.attenuationDistance,w.attenuationColor.value.copy(b.attenuationColor)),b.anisotropy>0&&(w.anisotropyVector.value.set(b.anisotropy*Math.cos(b.anisotropyRotation),b.anisotropy*Math.sin(b.anisotropyRotation)),b.anisotropyMap&&(w.anisotropyMap.value=b.anisotropyMap,n(b.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=b.specularIntensity,w.specularColor.value.copy(b.specularColor),b.specularColorMap&&(w.specularColorMap.value=b.specularColorMap,n(b.specularColorMap,w.specularColorMapTransform)),b.specularIntensityMap&&(w.specularIntensityMap.value=b.specularIntensityMap,n(b.specularIntensityMap,w.specularIntensityMapTransform))}function x(w,b){b.matcap&&(w.matcap.value=b.matcap)}function S(w,b){const M=e.get(b).light;w.referencePosition.value.setFromMatrixPosition(M.matrixWorld),w.nearDistance.value=M.shadow.camera.near,w.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function xye(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,T){const C=T.program;r.uniformBlockBinding(M,C)}function c(M,T){let C=i[M.id];C===void 0&&(x(M),C=d(M),i[M.id]=C,M.addEventListener("dispose",w));const O=T.program;r.updateUBOMapping(M,O);const N=e.render.frame;s[M.id]!==N&&(g(M),s[M.id]=N)}function d(M){const T=f();M.__bindingPointIndex=T;const C=t.createBuffer(),O=M.__size,N=M.usage;return t.bindBuffer(t.UNIFORM_BUFFER,C),t.bufferData(t.UNIFORM_BUFFER,O,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,T,C),C}function f(){for(let M=0;M0&&(C+=O-N),M.__size=C,M.__cache={},this}function S(M){const T={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(T.boundary=4,T.storage=4):M.isVector2?(T.boundary=8,T.storage=8):M.isVector3||M.isColor?(T.boundary=16,T.storage=12):M.isVector4?(T.boundary=16,T.storage=16):M.isMatrix3?(T.boundary=48,T.storage=48):M.isMatrix4?(T.boundary=64,T.storage=64):M.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",M),T}function w(M){const T=M.target;T.removeEventListener("dispose",w);const C=o.indexOf(T.__bindingPointIndex);o.splice(C,1),t.deleteBuffer(i[T.id]),delete i[T.id],delete s[T.id]}function b(){for(const M in i)t.deleteBuffer(i[M]);o=[],i={},s={}}return{bind:l,update:c,dispose:b}}class S6{constructor(e={}){const{canvas:n=c6(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let g;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");g=r.getContextAttributes().alpha}else g=o;const y=new Uint32Array(4),x=new Int32Array(4);let S=null,w=null;const b=[],M=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=zi,this.toneMapping=Pl,this.toneMappingExposure=1;const T=this;let C=!1,O=0,N=0,L=null,F=-1,G=null;const k=new Un,U=new Un;let H=null;const te=new ut(0);let ee=0,pe=n.width,ie=n.height,fe=1,B=null,Q=null;const K=new Un(0,0,pe,ie),V=new Un(0,0,pe,ie);let q=!1;const he=new hx;let ae=!1,ce=!1;const we=new kt,Ee=new kt,Xe=new X,Se=new Un,je={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let $e=!1;function ue(){return L===null?fe:1}let Z=r;function Ve(Y,xe){return n.getContext(Y,xe)}try{const Y={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Td}`),n.addEventListener("webglcontextlost",Fe,!1),n.addEventListener("webglcontextrestored",st,!1),n.addEventListener("webglcontextcreationerror",mt,!1),Z===null){const xe="webgl2";if(Z=Ve(xe,Y),Z===null)throw Ve(xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Y){throw console.error("THREE.WebGLRenderer: "+Y.message),Y}let Oe,Ge,et,St,ft,J,$,Me,Ue,Be,ze,wt,rt,pt,Wt,Ke,ne,Qe,Mt,yt,Jt,de,qe,le;function Ye(){Oe=new Eve(Z),Oe.init(),de=new _6(Z,Oe),Ge=new xve(Z,Oe,e,de),et=new sye(Z),Ge.reverseDepthBuffer&&et.buffers.depth.setReversed(!0),St=new Cve(Z),ft=new $0e,J=new dye(Z,Oe,et,ft,Ge,de,St),$=new _ve(T),Me=new Mve(T),Ue=new Lpe(Z),qe=new vve(Z,Ue),Be=new Ave(Z,Ue,St,qe),ze=new Rve(Z,Be,Ue,St),Mt=new Pve(Z,Ge,J),Ke=new bve(ft),wt=new W0e(T,$,Me,Oe,Ge,qe,Ke),rt=new yye(T,ft),pt=new q0e,Wt=new eye(Oe),Qe=new gve(T,$,Me,et,ze,g,l),ne=new rye(T,ze,Ge),le=new xye(Z,St,Ge,et),yt=new yve(Z,Oe,St),Jt=new Tve(Z,Oe,St),St.programs=wt.programs,T.capabilities=Ge,T.extensions=Oe,T.properties=ft,T.renderLists=pt,T.shadowMap=ne,T.state=et,T.info=St}Ye();const Te=new gye(T,Z);this.xr=Te,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){const Y=Oe.get("WEBGL_lose_context");Y&&Y.loseContext()},this.forceContextRestore=function(){const Y=Oe.get("WEBGL_lose_context");Y&&Y.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(Y){Y!==void 0&&(fe=Y,this.setSize(pe,ie,!1))},this.getSize=function(Y){return Y.set(pe,ie)},this.setSize=function(Y,xe,Ce=!0){if(Te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}pe=Y,ie=xe,n.width=Math.floor(Y*fe),n.height=Math.floor(xe*fe),Ce===!0&&(n.style.width=Y+"px",n.style.height=xe+"px"),this.setViewport(0,0,Y,xe)},this.getDrawingBufferSize=function(Y){return Y.set(pe*fe,ie*fe).floor()},this.setDrawingBufferSize=function(Y,xe,Ce){pe=Y,ie=xe,fe=Ce,n.width=Math.floor(Y*Ce),n.height=Math.floor(xe*Ce),this.setViewport(0,0,Y,xe)},this.getCurrentViewport=function(Y){return Y.copy(k)},this.getViewport=function(Y){return Y.copy(K)},this.setViewport=function(Y,xe,Ce,Ne){Y.isVector4?K.set(Y.x,Y.y,Y.z,Y.w):K.set(Y,xe,Ce,Ne),et.viewport(k.copy(K).multiplyScalar(fe).round())},this.getScissor=function(Y){return Y.copy(V)},this.setScissor=function(Y,xe,Ce,Ne){Y.isVector4?V.set(Y.x,Y.y,Y.z,Y.w):V.set(Y,xe,Ce,Ne),et.scissor(U.copy(V).multiplyScalar(fe).round())},this.getScissorTest=function(){return q},this.setScissorTest=function(Y){et.setScissorTest(q=Y)},this.setOpaqueSort=function(Y){B=Y},this.setTransparentSort=function(Y){Q=Y},this.getClearColor=function(Y){return Y.copy(Qe.getClearColor())},this.setClearColor=function(){Qe.setClearColor.apply(Qe,arguments)},this.getClearAlpha=function(){return Qe.getClearAlpha()},this.setClearAlpha=function(){Qe.setClearAlpha.apply(Qe,arguments)},this.clear=function(Y=!0,xe=!0,Ce=!0){let Ne=0;if(Y){let _e=!1;if(L!==null){const ot=L.texture.format;_e=ot===QS||ot===ZS||ot===cx}if(_e){const ot=L.texture.type,_t=ot===Va||ot===eu||ot===Og||ot===zh||ot===qS||ot===KS,ct=Qe.getClearColor(),Pt=Qe.getClearAlpha(),Vt=ct.r,Xt=ct.g,Ot=ct.b;_t?(y[0]=Vt,y[1]=Xt,y[2]=Ot,y[3]=Pt,Z.clearBufferuiv(Z.COLOR,0,y)):(x[0]=Vt,x[1]=Xt,x[2]=Ot,x[3]=Pt,Z.clearBufferiv(Z.COLOR,0,x))}else Ne|=Z.COLOR_BUFFER_BIT}xe&&(Ne|=Z.DEPTH_BUFFER_BIT,Z.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Ce&&(Ne|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(Ne)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Fe,!1),n.removeEventListener("webglcontextrestored",st,!1),n.removeEventListener("webglcontextcreationerror",mt,!1),pt.dispose(),Wt.dispose(),ft.dispose(),$.dispose(),Me.dispose(),ze.dispose(),qe.dispose(),le.dispose(),wt.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",xn),Te.removeEventListener("sessionend",er),wr.stop()};function Fe(Y){Y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),C=!0}function st(){console.log("THREE.WebGLRenderer: Context Restored."),C=!1;const Y=St.autoReset,xe=ne.enabled,Ce=ne.autoUpdate,Ne=ne.needsUpdate,_e=ne.type;Ye(),St.autoReset=Y,ne.enabled=xe,ne.autoUpdate=Ce,ne.needsUpdate=Ne,ne.type=_e}function mt(Y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Y.statusMessage)}function se(Y){const xe=Y.target;xe.removeEventListener("dispose",se),We(xe)}function We(Y){it(Y),ft.remove(Y)}function it(Y){const xe=ft.get(Y).programs;xe!==void 0&&(xe.forEach(function(Ce){wt.releaseProgram(Ce)}),Y.isShaderMaterial&&wt.releaseShaderCache(Y))}this.renderBufferDirect=function(Y,xe,Ce,Ne,_e,ot){xe===null&&(xe=je);const _t=_e.isMesh&&_e.matrixWorld.determinant()<0,ct=No(Y,xe,Ce,Ne,_e);et.setMaterial(Ne,_t);let Pt=Ce.index,Vt=1;if(Ne.wireframe===!0){if(Pt=Be.getWireframeAttribute(Ce),Pt===void 0)return;Vt=2}const Xt=Ce.drawRange,Ot=Ce.attributes.position;let Tn=Xt.start*Vt,Cn=(Xt.start+Xt.count)*Vt;ot!==null&&(Tn=Math.max(Tn,ot.start*Vt),Cn=Math.min(Cn,(ot.start+ot.count)*Vt)),Pt!==null?(Tn=Math.max(Tn,0),Cn=Math.min(Cn,Pt.count)):Ot!=null&&(Tn=Math.max(Tn,0),Cn=Math.min(Cn,Ot.count));const wn=Cn-Tn;if(wn<0||wn===1/0)return;qe.setup(_e,Ne,ct,Ce,Pt);let tn,Bt=yt;if(Pt!==null&&(tn=Ue.get(Pt),Bt=Jt,Bt.setIndex(tn)),_e.isMesh)Ne.wireframe===!0?(et.setLineWidth(Ne.wireframeLinewidth*ue()),Bt.setMode(Z.LINES)):Bt.setMode(Z.TRIANGLES);else if(_e.isLine){let xt=Ne.linewidth;xt===void 0&&(xt=1),et.setLineWidth(xt*ue()),_e.isLineSegments?Bt.setMode(Z.LINES):_e.isLineLoop?Bt.setMode(Z.LINE_LOOP):Bt.setMode(Z.LINE_STRIP)}else _e.isPoints?Bt.setMode(Z.POINTS):_e.isSprite&&Bt.setMode(Z.TRIANGLES);if(_e.isBatchedMesh)if(_e._multiDrawInstances!==null)Bt.renderMultiDrawInstances(_e._multiDrawStarts,_e._multiDrawCounts,_e._multiDrawCount,_e._multiDrawInstances);else if(Oe.get("WEBGL_multi_draw"))Bt.renderMultiDraw(_e._multiDrawStarts,_e._multiDrawCounts,_e._multiDrawCount);else{const xt=_e._multiDrawStarts,Sn=_e._multiDrawCounts,sn=_e._multiDrawCount,kr=Pt?Ue.get(Pt).bytesPerElement:1,fi=ft.get(Ne).currentProgram.getUniforms();for(let Dn=0;Dn{function ot(){if(Ne.forEach(function(_t){ft.get(_t).currentProgram.isReady()&&Ne.delete(_t)}),Ne.size===0){_e(Y);return}setTimeout(ot,10)}Oe.get("KHR_parallel_shader_compile")!==null?ot():setTimeout(ot,10)})};let Ht=null;function _n(Y){Ht&&Ht(Y)}function xn(){wr.stop()}function er(){wr.start()}const wr=new g6;wr.setAnimationLoop(_n),typeof self<"u"&&wr.setContext(self),this.setAnimationLoop=function(Y){Ht=Y,Te.setAnimationLoop(Y),Y===null?wr.stop():wr.start()},Te.addEventListener("sessionstart",xn),Te.addEventListener("sessionend",er),this.render=function(Y,xe){if(xe!==void 0&&xe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;if(Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),xe.parent===null&&xe.matrixWorldAutoUpdate===!0&&xe.updateMatrixWorld(),Te.enabled===!0&&Te.isPresenting===!0&&(Te.cameraAutoUpdate===!0&&Te.updateCamera(xe),xe=Te.getCamera()),Y.isScene===!0&&Y.onBeforeRender(T,Y,xe,L),w=Wt.get(Y,M.length),w.init(xe),M.push(w),Ee.multiplyMatrices(xe.projectionMatrix,xe.matrixWorldInverse),he.setFromProjectionMatrix(Ee),ce=this.localClippingEnabled,ae=Ke.init(this.clippingPlanes,ce),S=pt.get(Y,b.length),S.init(),b.push(S),Te.enabled===!0&&Te.isPresenting===!0){const ot=T.xr.getDepthSensingMesh();ot!==null&&ro(ot,xe,-1/0,T.sortObjects)}ro(Y,xe,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(B,Q),$e=Te.enabled===!1||Te.isPresenting===!1||Te.hasDepthSensing()===!1,$e&&Qe.addToRenderList(S,Y),this.info.render.frame++,ae===!0&&Ke.beginShadows();const Ce=w.state.shadowsArray;ne.render(Ce,Y,xe),ae===!0&&Ke.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ne=S.opaque,_e=S.transmissive;if(w.setupLights(),xe.isArrayCamera){const ot=xe.cameras;if(_e.length>0)for(let _t=0,ct=ot.length;_t0&&ks(Ne,_e,Y,xe),$e&&Qe.render(Y),Xi(S,Y,xe);L!==null&&(J.updateMultisampleRenderTarget(L),J.updateRenderTargetMipmap(L)),Y.isScene===!0&&Y.onAfterRender(T,Y,xe),qe.resetDefaultState(),F=-1,G=null,M.pop(),M.length>0?(w=M[M.length-1],ae===!0&&Ke.setGlobalState(T.clippingPlanes,w.state.camera)):w=null,b.pop(),b.length>0?S=b[b.length-1]:S=null};function ro(Y,xe,Ce,Ne){if(Y.visible===!1)return;if(Y.layers.test(xe.layers)){if(Y.isGroup)Ce=Y.renderOrder;else if(Y.isLOD)Y.autoUpdate===!0&&Y.update(xe);else if(Y.isLight)w.pushLight(Y),Y.castShadow&&w.pushShadow(Y);else if(Y.isSprite){if(!Y.frustumCulled||he.intersectsSprite(Y)){Ne&&Se.setFromMatrixPosition(Y.matrixWorld).applyMatrix4(Ee);const _t=ze.update(Y),ct=Y.material;ct.visible&&S.push(Y,_t,ct,Ce,Se.z,null)}}else if((Y.isMesh||Y.isLine||Y.isPoints)&&(!Y.frustumCulled||he.intersectsObject(Y))){const _t=ze.update(Y),ct=Y.material;if(Ne&&(Y.boundingSphere!==void 0?(Y.boundingSphere===null&&Y.computeBoundingSphere(),Se.copy(Y.boundingSphere.center)):(_t.boundingSphere===null&&_t.computeBoundingSphere(),Se.copy(_t.boundingSphere.center)),Se.applyMatrix4(Y.matrixWorld).applyMatrix4(Ee)),Array.isArray(ct)){const Pt=_t.groups;for(let Vt=0,Xt=Pt.length;Vt0&&Ti(_e,xe,Ce),ot.length>0&&Ti(ot,xe,Ce),_t.length>0&&Ti(_t,xe,Ce),et.buffers.depth.setTest(!0),et.buffers.depth.setMask(!0),et.buffers.color.setMask(!0),et.setPolygonOffset(!1)}function ks(Y,xe,Ce,Ne){if((Ce.isScene===!0?Ce.overrideMaterial:null)!==null)return;w.state.transmissionRenderTarget[Ne.id]===void 0&&(w.state.transmissionRenderTarget[Ne.id]=new Ga(1,1,{generateMipmaps:!0,type:Oe.has("EXT_color_buffer_half_float")||Oe.has("EXT_color_buffer_float")?rv:Va,minFilter:Zo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ln.workingColorSpace}));const ot=w.state.transmissionRenderTarget[Ne.id],_t=Ne.viewport||k;ot.setSize(_t.z,_t.w);const ct=T.getRenderTarget();T.setRenderTarget(ot),T.getClearColor(te),ee=T.getClearAlpha(),ee<1&&T.setClearColor(16777215,.5),T.clear(),$e&&Qe.render(Ce);const Pt=T.toneMapping;T.toneMapping=Pl;const Vt=Ne.viewport;if(Ne.viewport!==void 0&&(Ne.viewport=void 0),w.setupLightsView(Ne),ae===!0&&Ke.setGlobalState(T.clippingPlanes,Ne),Ti(Y,Ce,Ne),J.updateMultisampleRenderTarget(ot),J.updateRenderTargetMipmap(ot),Oe.has("WEBGL_multisampled_render_to_texture")===!1){let Xt=!1;for(let Ot=0,Tn=xe.length;Ot0),Ot=!!Ce.morphAttributes.position,Tn=!!Ce.morphAttributes.normal,Cn=!!Ce.morphAttributes.color;let wn=Pl;Ne.toneMapped&&(L===null||L.isXRRenderTarget===!0)&&(wn=T.toneMapping);const tn=Ce.morphAttributes.position||Ce.morphAttributes.normal||Ce.morphAttributes.color,Bt=tn!==void 0?tn.length:0,xt=ft.get(Ne),Sn=w.state.lights;if(ae===!0&&(ce===!0||Y!==G)){const Yr=Y===G&&Ne.id===F;Ke.setState(Ne,Y,Yr)}let sn=!1;Ne.version===xt.__version?(xt.needsLights&&xt.lightsStateVersion!==Sn.state.version||xt.outputColorSpace!==ct||_e.isBatchedMesh&&xt.batching===!1||!_e.isBatchedMesh&&xt.batching===!0||_e.isBatchedMesh&&xt.batchingColor===!0&&_e.colorTexture===null||_e.isBatchedMesh&&xt.batchingColor===!1&&_e.colorTexture!==null||_e.isInstancedMesh&&xt.instancing===!1||!_e.isInstancedMesh&&xt.instancing===!0||_e.isSkinnedMesh&&xt.skinning===!1||!_e.isSkinnedMesh&&xt.skinning===!0||_e.isInstancedMesh&&xt.instancingColor===!0&&_e.instanceColor===null||_e.isInstancedMesh&&xt.instancingColor===!1&&_e.instanceColor!==null||_e.isInstancedMesh&&xt.instancingMorph===!0&&_e.morphTexture===null||_e.isInstancedMesh&&xt.instancingMorph===!1&&_e.morphTexture!==null||xt.envMap!==Pt||Ne.fog===!0&&xt.fog!==ot||xt.numClippingPlanes!==void 0&&(xt.numClippingPlanes!==Ke.numPlanes||xt.numIntersection!==Ke.numIntersection)||xt.vertexAlphas!==Vt||xt.vertexTangents!==Xt||xt.morphTargets!==Ot||xt.morphNormals!==Tn||xt.morphColors!==Cn||xt.toneMapping!==wn||xt.morphTargetsCount!==Bt)&&(sn=!0):(sn=!0,xt.__version=Ne.version);let kr=xt.currentProgram;sn===!0&&(kr=oa(Ne,xe,_e));let fi=!1,Dn=!1,Os=!1;const Wn=kr.getUniforms(),io=xt.uniforms;if(et.useProgram(kr.program)&&(fi=!0,Dn=!0,Os=!0),Ne.id!==F&&(F=Ne.id,Dn=!0),fi||G!==Y){Ge.reverseDepthBuffer?(we.copy(Y.projectionMatrix),spe(we),ope(we),Wn.setValue(Z,"projectionMatrix",we)):Wn.setValue(Z,"projectionMatrix",Y.projectionMatrix),Wn.setValue(Z,"viewMatrix",Y.matrixWorldInverse);const Yr=Wn.map.cameraPosition;Yr!==void 0&&Yr.setValue(Z,Xe.setFromMatrixPosition(Y.matrixWorld)),Ge.logarithmicDepthBuffer&&Wn.setValue(Z,"logDepthBufFC",2/(Math.log(Y.far+1)/Math.LN2)),(Ne.isMeshPhongMaterial||Ne.isMeshToonMaterial||Ne.isMeshLambertMaterial||Ne.isMeshBasicMaterial||Ne.isMeshStandardMaterial||Ne.isShaderMaterial)&&Wn.setValue(Z,"isOrthographic",Y.isOrthographicCamera===!0),G!==Y&&(G=Y,Dn=!0,Os=!0)}if(_e.isSkinnedMesh){Wn.setOptional(Z,_e,"bindMatrix"),Wn.setOptional(Z,_e,"bindMatrixInverse");const Yr=_e.skeleton;Yr&&(Yr.boneTexture===null&&Yr.computeBoneTexture(),Wn.setValue(Z,"boneTexture",Yr.boneTexture,J))}_e.isBatchedMesh&&(Wn.setOptional(Z,_e,"batchingTexture"),Wn.setValue(Z,"batchingTexture",_e._matricesTexture,J),Wn.setOptional(Z,_e,"batchingIdTexture"),Wn.setValue(Z,"batchingIdTexture",_e._indirectTexture,J),Wn.setOptional(Z,_e,"batchingColorTexture"),_e._colorsTexture!==null&&Wn.setValue(Z,"batchingColorTexture",_e._colorsTexture,J));const Ya=Ce.morphAttributes;if((Ya.position!==void 0||Ya.normal!==void 0||Ya.color!==void 0)&&Mt.update(_e,Ce,kr),(Dn||xt.receiveShadow!==_e.receiveShadow)&&(xt.receiveShadow=_e.receiveShadow,Wn.setValue(Z,"receiveShadow",_e.receiveShadow)),Ne.isMeshGouraudMaterial&&Ne.envMap!==null&&(io.envMap.value=Pt,io.flipEnvMap.value=Pt.isCubeTexture&&Pt.isRenderTargetTexture===!1?-1:1),Ne.isMeshStandardMaterial&&Ne.envMap===null&&xe.environment!==null&&(io.envMapIntensity.value=xe.environmentIntensity),Dn&&(Wn.setValue(Z,"toneMappingExposure",T.toneMappingExposure),xt.needsLights&&du(io,Os),ot&&Ne.fog===!0&&rt.refreshFogUniforms(io,ot),rt.refreshMaterialUniforms(io,Ne,fe,ie,w.state.transmissionRenderTarget[Y.id]),K_.upload(Z,cu(xt),io,J)),Ne.isShaderMaterial&&Ne.uniformsNeedUpdate===!0&&(K_.upload(Z,cu(xt),io,J),Ne.uniformsNeedUpdate=!1),Ne.isSpriteMaterial&&Wn.setValue(Z,"center",_e.center),Wn.setValue(Z,"modelViewMatrix",_e.modelViewMatrix),Wn.setValue(Z,"normalMatrix",_e.normalMatrix),Wn.setValue(Z,"modelMatrix",_e.matrixWorld),Ne.isShaderMaterial||Ne.isRawShaderMaterial){const Yr=Ne.uniformsGroups;for(let hi=0,Dd=Yr.length;hi0&&J.useMultisampledRTT(Y)===!1?_e=ft.get(Y).__webglMultisampledFramebuffer:Array.isArray(Xt)?_e=Xt[Ce]:_e=Xt,k.copy(Y.viewport),U.copy(Y.scissor),H=Y.scissorTest}else k.copy(K).multiplyScalar(fe).floor(),U.copy(V).multiplyScalar(fe).floor(),H=q;if(et.bindFramebuffer(Z.FRAMEBUFFER,_e)&&Ne&&et.drawBuffers(Y,_e),et.viewport(k),et.scissor(U),et.setScissorTest(H),ot){const Pt=ft.get(Y.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Pt.__webglTexture,Ce)}else if(_t){const Pt=ft.get(Y.texture),Vt=xe||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Pt.__webglTexture,Ce||0,Vt)}F=-1},this.readRenderTargetPixels=function(Y,xe,Ce,Ne,_e,ot,_t){if(!(Y&&Y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ct=ft.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&_t!==void 0&&(ct=ct[_t]),ct){et.bindFramebuffer(Z.FRAMEBUFFER,ct);try{const Pt=Y.texture,Vt=Pt.format,Xt=Pt.type;if(!Ge.textureFormatReadable(Vt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Ge.textureTypeReadable(Xt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}xe>=0&&xe<=Y.width-Ne&&Ce>=0&&Ce<=Y.height-_e&&Z.readPixels(xe,Ce,Ne,_e,de.convert(Vt),de.convert(Xt),ot)}finally{const Pt=L!==null?ft.get(L).__webglFramebuffer:null;et.bindFramebuffer(Z.FRAMEBUFFER,Pt)}}},this.readRenderTargetPixelsAsync=async function(Y,xe,Ce,Ne,_e,ot,_t){if(!(Y&&Y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ct=ft.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&_t!==void 0&&(ct=ct[_t]),ct){const Pt=Y.texture,Vt=Pt.format,Xt=Pt.type;if(!Ge.textureFormatReadable(Vt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Ge.textureTypeReadable(Xt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(xe>=0&&xe<=Y.width-Ne&&Ce>=0&&Ce<=Y.height-_e){et.bindFramebuffer(Z.FRAMEBUFFER,ct);const Ot=Z.createBuffer();Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Ot),Z.bufferData(Z.PIXEL_PACK_BUFFER,ot.byteLength,Z.STREAM_READ),Z.readPixels(xe,Ce,Ne,_e,de.convert(Vt),de.convert(Xt),0);const Tn=L!==null?ft.get(L).__webglFramebuffer:null;et.bindFramebuffer(Z.FRAMEBUFFER,Tn);const Cn=Z.fenceSync(Z.SYNC_GPU_COMMANDS_COMPLETE,0);return Z.flush(),await ipe(Z,Cn,4),Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Ot),Z.getBufferSubData(Z.PIXEL_PACK_BUFFER,0,ot),Z.deleteBuffer(Ot),Z.deleteSync(Cn),ot}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(Y,xe=null,Ce=0){Y.isTexture!==!0&&(q_("WebGLRenderer: copyFramebufferToTexture function signature has changed."),xe=arguments[0]||null,Y=arguments[1]);const Ne=Math.pow(2,-Ce),_e=Math.floor(Y.image.width*Ne),ot=Math.floor(Y.image.height*Ne),_t=xe!==null?xe.x:0,ct=xe!==null?xe.y:0;J.setTexture2D(Y,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,Ce,0,0,_t,ct,_e,ot),et.unbindTexture()},this.copyTextureToTexture=function(Y,xe,Ce=null,Ne=null,_e=0){Y.isTexture!==!0&&(q_("WebGLRenderer: copyTextureToTexture function signature has changed."),Ne=arguments[0]||null,Y=arguments[1],xe=arguments[2],_e=arguments[3]||0,Ce=null);let ot,_t,ct,Pt,Vt,Xt;Ce!==null?(ot=Ce.max.x-Ce.min.x,_t=Ce.max.y-Ce.min.y,ct=Ce.min.x,Pt=Ce.min.y):(ot=Y.image.width,_t=Y.image.height,ct=0,Pt=0),Ne!==null?(Vt=Ne.x,Xt=Ne.y):(Vt=0,Xt=0);const Ot=de.convert(xe.format),Tn=de.convert(xe.type);J.setTexture2D(xe,0),Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,xe.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,xe.unpackAlignment);const Cn=Z.getParameter(Z.UNPACK_ROW_LENGTH),wn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),tn=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Bt=Z.getParameter(Z.UNPACK_SKIP_ROWS),xt=Z.getParameter(Z.UNPACK_SKIP_IMAGES),Sn=Y.isCompressedTexture?Y.mipmaps[_e]:Y.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Sn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,Sn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,ct),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Pt),Y.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,_e,Vt,Xt,ot,_t,Ot,Tn,Sn.data):Y.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,_e,Vt,Xt,Sn.width,Sn.height,Ot,Sn.data):Z.texSubImage2D(Z.TEXTURE_2D,_e,Vt,Xt,ot,_t,Ot,Tn,Sn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Cn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,wn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,tn),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Bt),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,xt),_e===0&&xe.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),et.unbindTexture()},this.copyTextureToTexture3D=function(Y,xe,Ce=null,Ne=null,_e=0){Y.isTexture!==!0&&(q_("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Ce=arguments[0]||null,Ne=arguments[1]||null,Y=arguments[2],xe=arguments[3],_e=arguments[4]||0);let ot,_t,ct,Pt,Vt,Xt,Ot,Tn,Cn;const wn=Y.isCompressedTexture?Y.mipmaps[_e]:Y.image;Ce!==null?(ot=Ce.max.x-Ce.min.x,_t=Ce.max.y-Ce.min.y,ct=Ce.max.z-Ce.min.z,Pt=Ce.min.x,Vt=Ce.min.y,Xt=Ce.min.z):(ot=wn.width,_t=wn.height,ct=wn.depth,Pt=0,Vt=0,Xt=0),Ne!==null?(Ot=Ne.x,Tn=Ne.y,Cn=Ne.z):(Ot=0,Tn=0,Cn=0);const tn=de.convert(xe.format),Bt=de.convert(xe.type);let xt;if(xe.isData3DTexture)J.setTexture3D(xe,0),xt=Z.TEXTURE_3D;else if(xe.isDataArrayTexture||xe.isCompressedArrayTexture)J.setTexture2DArray(xe,0),xt=Z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,xe.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,xe.unpackAlignment);const Sn=Z.getParameter(Z.UNPACK_ROW_LENGTH),sn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),kr=Z.getParameter(Z.UNPACK_SKIP_PIXELS),fi=Z.getParameter(Z.UNPACK_SKIP_ROWS),Dn=Z.getParameter(Z.UNPACK_SKIP_IMAGES);Z.pixelStorei(Z.UNPACK_ROW_LENGTH,wn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,wn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Pt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Vt),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,Xt),Y.isDataTexture||Y.isData3DTexture?Z.texSubImage3D(xt,_e,Ot,Tn,Cn,ot,_t,ct,tn,Bt,wn.data):xe.isCompressedArrayTexture?Z.compressedTexSubImage3D(xt,_e,Ot,Tn,Cn,ot,_t,ct,tn,wn.data):Z.texSubImage3D(xt,_e,Ot,Tn,Cn,ot,_t,ct,tn,Bt,wn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Sn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,sn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,kr),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,fi),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,Dn),_e===0&&xe.generateMipmaps&&Z.generateMipmap(xt),et.unbindTexture()},this.initRenderTarget=function(Y){ft.get(Y).__webglFramebuffer===void 0&&J.setupRenderTarget(Y)},this.initTexture=function(Y){Y.isCubeTexture?J.setTextureCube(Y,0):Y.isData3DTexture?J.setTexture3D(Y,0):Y.isDataArrayTexture||Y.isCompressedArrayTexture?J.setTexture2DArray(Y,0):J.setTexture2D(Y,0),et.unbindTexture()},this.resetState=function(){O=0,N=0,L=null,et.reset(),qe.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ml}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===eM?"display-p3":"srgb",n.unpackColorSpace=Ln.workingColorSpace===ux?"display-p3":"srgb"}}class rM{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ut(e),this.density=n}clone(){return new rM(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class iM{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new ut(e),this.near=n,this.far=r}clone(){return new iM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class DR extends vn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new us,this.environmentIntensity=1,this.environmentRotation=new us,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}class np{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=Iy,this.updateRanges=[],this.version=0,this.uuid=To()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,r){e*=this.stride,r*=n.stride;for(let i=0,s=this.stride;ie.far||n.push({distance:l,point:w0.clone(),uv:Zs.getInterpolation(w0,o_,M0,a_,RD,TA,ND,new He),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function l_(t,e,n,r,i,s){Rm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(S0.x=s*Rm.x-i*Rm.y,S0.y=i*Rm.x+s*Rm.y):S0.copy(Rm),t.copy(e),t.x+=S0.x,t.y+=S0.y,t.applyMatrix4(M6)}const c_=new X,ID=new X;class A6 extends vn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let r=0,i=n.length;r0){let r,i;for(r=1,i=n.length;r0){c_.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(c_);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){c_.setFromMatrixPosition(e.matrixWorld),ID.setFromMatrixPosition(this.matrixWorld);const r=c_.distanceTo(ID)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i=o)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}}const Ju=new kt,RA=new kt,Aye=new kt,Tye=new ut(1,1,1),BD=new kt,NA=new hx,f_=new cs,Of=new Vi,T0=new X,HD=new X,Cye=new X,IA=new Eye,rs=new _r,h_=[];function Pye(t,e,n=0){const r=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const i=t.count;for(let s=0;s65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new rn(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const n=this.geometry;if(!!e.getIndex()!=!!n.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in n.attributes){if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=n.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new cs);const e=this.boundingBox,n=this._drawInfo;e.makeEmpty();for(let r=0,i=n.length;r=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=r):(i=this._drawInfo.length,this._drawInfo.push(r));const s=this._matricesTexture,o=s.image.data;Aye.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(Tye.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,n=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),n===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=n,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),d=c!==null;if(d&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const f=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:d?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new cs,sphereInitialized:!1,sphere:new Vi}),this.setGeometryAt(f,e),f}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=n.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||n.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const y in r.attributes){const x=n.getAttribute(y),S=r.getAttribute(y);Pye(x,S,l);const w=x.itemSize;for(let b=x.count,M=c;b=n.length||n[e].active===!1?this:(n[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,n){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,d=l.start+l.count;c=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,f_),f_.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let d=l.start,f=l.start+l.count;d=r.length||r[e].active===!1?this:(n.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,n){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:n.fromArray(i,e*16)}setColorAt(e,n){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(n.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,n){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:n.fromArray(r,e*4)}setVisibleAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===n?this:(r[e].visible=n,this._visibilityChanged=!0,this)}getVisibleAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?!1:n[e].visible}setGeometryIdAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||n<0||n>=this._geometryCount?null:(r[e].geometryIndex=n,this)}getGeometryIdAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?-1:n[e].geometryIndex}getGeometryRangeAt(e,n={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return n.start=r.start,n.count=r.count,n}raycast(e,n){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,o=this.geometry;rs.material=this.material,rs.geometry.index=o.index,rs.geometry.attributes=o.attributes,rs.geometry.boundingBox===null&&(rs.geometry.boundingBox=new cs),rs.geometry.boundingSphere===null&&(rs.geometry.boundingSphere=new Vi);for(let a=0,l=r.length;a({...n})),this._reservedRanges=e._reservedRanges.map(n=>({...n})),this._drawInfo=e._drawInfo.map(n=>({...n})),this._bounds=e._bounds.map(n=>({boxInitialized:n.boxInitialized,box:n.box.clone(),sphereInitialized:n.sphereInitialized,sphere:n.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,n,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,g=this.perObjectFrustumCulled,y=this._indirectTexture,x=y.image.data;g&&(BD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),NA.setFromProjectionMatrix(BD,e.coordinateSystem));let S=0;if(this.sortObjects){RA.copy(this.matrixWorld).invert(),T0.setFromMatrixPosition(r.matrixWorld).applyMatrix4(RA),HD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(RA);for(let M=0,T=l.length;M0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;kA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(kA);if(!(le.far))return{distance:l,point:GD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const WD=new X,$D=new X;class no extends zl{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[];for(let i=0,s=n.count;i0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class Rye extends mr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ir,this.magFilter=s!==void 0?s:Ir,this.generateMipmaps=!1;const d=this;function f(){d.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class Nye extends mr{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=oi,this.minFilter=oi,this.generateMipmaps=!1,this.needsUpdate=!0}}class lM extends mr{constructor(e,n,r,i,s,o,a,l,c,d,f,g){super(null,o,a,l,c,d,i,s,f,g),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Iye extends lM{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Eo,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class kye extends lM{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,Jc),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Oye extends mr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class qa{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),s=0;n.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const r=this.getLengths();let i=0;const s=r.length;let o;n?o=n:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const d=r[i],g=r[i+1]-d,y=(o-d)/g;return(i+y)/(s-1)}getTangent(e,n){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=n||(o.isVector2?new He:new X);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new X,i=[],s=[],o=[],a=new X,l=new kt;for(let y=0;y<=e;y++){const x=y/e;i[y]=this.getTangentAt(x,new X)}s[0]=new X,o[0]=new X;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),g=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),g<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let y=1;y<=e;y++){if(s[y]=s[y-1].clone(),o[y]=o[y-1].clone(),a.crossVectors(i[y-1],i[y]),a.length()>Number.EPSILON){a.normalize();const x=Math.acos(Rr(i[y-1].dot(i[y]),-1,1));s[y].applyMatrix4(l.makeRotationAxis(a,x))}o[y].crossVectors(i[y],s[y])}if(n===!0){let y=Math.acos(Rr(s[0].dot(s[e]),-1,1));y/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(y=-y);for(let x=1;x<=e;x++)s[x].applyMatrix4(l.makeRotationAxis(i[x],y*x)),o[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class cM extends qa{constructor(e=0,n=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n=new He){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,d;this.closed||a>0?c=i[(a-1)%s]:(y_.subVectors(i[0],i[1]).add(i[0]),c=y_);const f=i[a%s],g=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(KD(a,l.x,c.x,d.x,f.x),KD(a,l.y,c.y,d.y,f.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;r1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const d=c.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class px extends nn{constructor(e=[new He(0,-.5),new He(.5,0),new He(0,.5)],n=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=Rr(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/n,f=new X,g=new He,y=new X,x=new X,S=new X;let w=0,b=0;for(let M=0;M<=e.length-1;M++)switch(M){case 0:w=e[M+1].x-e[M].x,b=e[M+1].y-e[M].y,y.x=b*1,y.y=-w,y.z=b*0,S.copy(y),y.normalize(),l.push(y.x,y.y,y.z);break;case e.length-1:l.push(S.x,S.y,S.z);break;default:w=e[M+1].x-e[M].x,b=e[M+1].y-e[M].y,y.x=b*1,y.y=-w,y.z=b*0,x.copy(y),y.x+=S.x,y.y+=S.y,y.z+=S.z,y.normalize(),l.push(y.x,y.y,y.z),S.copy(x)}for(let M=0;M<=n;M++){const T=r+M*d*i,C=Math.sin(T),O=Math.cos(T);for(let N=0;N<=e.length-1;N++){f.x=e[N].x*C,f.y=e[N].y,f.z=e[N].x*O,o.push(f.x,f.y,f.z),g.x=M/n,g.y=N/(e.length-1),a.push(g.x,g.y);const L=l[3*N+0]*C,F=l[3*N+1],G=l[3*N+0]*O;c.push(L,F,G)}}for(let M=0;M0&&T(!0),n>0&&T(!1)),this.setIndex(d),this.setAttribute("position",new Ft(f,3)),this.setAttribute("normal",new Ft(g,3)),this.setAttribute("uv",new Ft(y,2));function M(){const C=new X,O=new X;let N=0;const L=(n-e)/r;for(let F=0;F<=s;F++){const G=[],k=F/s,U=k*(n-e)+e;for(let H=0;H<=i;H++){const te=H/i,ee=te*l+a,pe=Math.sin(ee),ie=Math.cos(ee);O.x=U*pe,O.y=-k*r+w,O.z=U*ie,f.push(O.x,O.y,O.z),C.set(pe,L,ie).normalize(),g.push(C.x,C.y,C.z),y.push(te,1-k),G.push(x++)}S.push(G)}for(let F=0;F0&&(d.push(k,U,te),N+=3),n>0&&(d.push(U,H,te),N+=3)}c.addGroup(b,N,0),b+=N}function T(C){const O=x,N=new He,L=new X;let F=0;const G=C===!0?e:n,k=C===!0?1:-1;for(let H=1;H<=i;H++)f.push(0,w*k,0),g.push(0,k,0),y.push(.5,.5),x++;const U=x;for(let H=0;H<=i;H++){const ee=H/i*l+a,pe=Math.cos(ee),ie=Math.sin(ee);L.x=G*ie,L.y=w*k,L.z=G*pe,f.push(L.x,L.y,L.z),g.push(0,k,0),N.x=pe*.5+.5,N.y=ie*.5*k+.5,y.push(N.x,N.y),x++}for(let H=0;H.9&&L<.1&&(T<.2&&(o[M+0]+=1),C<.2&&(o[M+2]+=1),O<.2&&(o[M+4]+=1))}}function g(M){s.push(M.x,M.y,M.z)}function y(M,T){const C=M*3;T.x=e[C+0],T.y=e[C+1],T.z=e[C+2]}function x(){const M=new X,T=new X,C=new X,O=new X,N=new He,L=new He,F=new He;for(let G=0,k=0;G80*n){a=c=t[0],l=d=t[1];for(let x=n;xc&&(c=f),g>d&&(d=g);y=Math.max(c-a,d-l),y=y!==0?32767/y:0}return Dy(s,o,n,a,l,y,0),o}};function O6(t,e,n,r,i){let s,o;if(i===ixe(t,e,n,r)>0)for(s=e;s=e;s-=r)o=YD(s,t[s],t[s+1],o);return o&&pM(o,o.next)&&(Uy(o),o=o.next),o}function Vh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(pM(n,n.next)||br(n.prev,n,n.next)===0)){if(Uy(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Dy(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Qye(t,r,i,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Gye(t,r,i,s):Vye(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Uy(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=Wye(Vh(t),e,n),Dy(t,e,n,r,i,s,2)):o===2&&$ye(t,e,n,r,i,s):Dy(Vh(t),e,n,r,i,s,1);break}}}function Vye(t){const e=t.prev,n=t,r=t.next;if(br(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,c=r.y,d=is?i>o?i:o:s>o?s:o,y=a>l?a>c?a:c:l>c?l:c;let x=r.next;for(;x!==e;){if(x.x>=d&&x.x<=g&&x.y>=f&&x.y<=y&&Km(i,a,s,l,o,c,x.x,x.y)&&br(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function Gye(t,e,n,r){const i=t.prev,s=t,o=t.next;if(br(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,d=i.y,f=s.y,g=o.y,y=al?a>c?a:c:l>c?l:c,w=d>f?d>g?d:g:f>g?f:g,b=rP(y,x,e,n,r),M=rP(S,w,e,n,r);let T=t.prevZ,C=t.nextZ;for(;T&&T.z>=b&&C&&C.z<=M;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==o&&Km(a,d,l,f,c,g,T.x,T.y)&&br(T.prev,T,T.next)>=0||(T=T.prevZ,C.x>=y&&C.x<=S&&C.y>=x&&C.y<=w&&C!==i&&C!==o&&Km(a,d,l,f,c,g,C.x,C.y)&&br(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;T&&T.z>=b;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==o&&Km(a,d,l,f,c,g,T.x,T.y)&&br(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;C&&C.z<=M;){if(C.x>=y&&C.x<=S&&C.y>=x&&C.y<=w&&C!==i&&C!==o&&Km(a,d,l,f,c,g,C.x,C.y)&&br(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Wye(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!pM(i,s)&&L6(i,r,r.next,s)&&jy(i,s)&&jy(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Uy(r),Uy(r.next),r=t=s),r=r.next}while(r!==t);return Vh(r)}function $ye(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&txe(o,a)){let l=D6(o,a);o=Vh(o,o.next),l=Vh(l,l.next),Dy(o,e,n,r,i,s,0),Dy(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function Xye(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const g=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(g<=s&&g>r&&(r=g,i=n.x=n.x&&n.x>=l&&s!==n.x&&Km(oi.x||n.x===i.x&&Zye(i,n)))&&(i=n,d=f)),n=n.next;while(n!==a);return i}function Zye(t,e){return br(t.prev,t,e.prev)<0&&br(e.next,t,t.next)<0}function Qye(t,e,n,r){let i=t;do i.z===0&&(i.z=rP(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Jye(i)}function Jye(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function rP(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function exe(t){let e=t,n=t;do(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function txe(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!nxe(t,e)&&(jy(t,e)&&jy(e,t)&&rxe(t,e)&&(br(t.prev,t,e.prev)||br(t,e.prev,e))||pM(t,e)&&br(t.prev,t,t.next)>0&&br(e.prev,e,e.next)>0)}function br(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function pM(t,e){return t.x===e.x&&t.y===e.y}function L6(t,e,n,r){const i=S_(br(t,e,n)),s=S_(br(t,e,r)),o=S_(br(n,r,t)),a=S_(br(n,r,e));return!!(i!==s&&o!==a||i===0&&w_(t,n,e)||s===0&&w_(t,r,e)||o===0&&w_(n,t,r)||a===0&&w_(n,e,r))}function w_(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function S_(t){return t>0?1:t<0?-1:0}function nxe(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&L6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function jy(t,e){return br(t.prev,t,t.next)<0?br(t,e,t.next)>=0&&br(t,t.prev,e)>=0:br(t,e,t.prev)<0||br(t,t.next,e)<0}function rxe(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function D6(t,e){const n=new iP(t.i,t.x,t.y),r=new iP(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function YD(t,e,n,r){const i=new iP(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Uy(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function iP(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ixe(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function QD(t,e){for(let n=0;nNumber.EPSILON){const Be=Math.sqrt(Me),ze=Math.sqrt(J*J+$*$),wt=Z.x-ft/Be,rt=Z.y+St/Be,pt=Ve.x-$/ze,Wt=Ve.y+J/ze,Ke=((pt-wt)*$-(Wt-rt)*J)/(St*$-ft*J);Oe=wt+St*Ke-ue.x,Ge=rt+ft*Ke-ue.y;const ne=Oe*Oe+Ge*Ge;if(ne<=2)return new He(Oe,Ge);et=Math.sqrt(ne/2)}else{let Be=!1;St>Number.EPSILON?J>Number.EPSILON&&(Be=!0):St<-Number.EPSILON?J<-Number.EPSILON&&(Be=!0):Math.sign(ft)===Math.sign($)&&(Be=!0),Be?(Oe=-ft,Ge=St,et=Math.sqrt(Me)):(Oe=St,Ge=ft,et=Math.sqrt(Me/2))}return new He(Oe/et,Ge/et)}const Q=[];for(let ue=0,Z=ee.length,Ve=Z-1,Oe=ue+1;ue=0;ue--){const Z=ue/w,Ve=y*Math.cos(Z*Math.PI/2),Oe=x*Math.sin(Z*Math.PI/2)+S;for(let Ge=0,et=ee.length;Ge=0;){const Oe=Ve;let Ge=Ve-1;Ge<0&&(Ge=ue.length-1);for(let et=0,St=d+w*2;et0)&&y.push(T,C,N),(b!==r-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class z6 extends Xr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ut(16777215),this.specular=new ut(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new us,this.combine=lx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class B6 extends Xr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ut(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class H6 extends Xr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class V6 extends Xr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ut(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ut(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new us,this.combine=lx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class G6 extends Xr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ut(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class W6 extends Kr{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function uh(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function $6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function X6(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function sP(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const a=n[s]*e;for(let l=0;l!==e;++l)i[o++]=t[a+l]}return i}function XR(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),n.push.apply(n,o)),s=t[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),n.push(o)),s=t[i++];while(s!==void 0)}function lxe(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l=r)){f.push(c.times[y]);for(let S=0;Ss.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[x]){const b=x*f+d,M=b+f-d;S=a.values.slice(b,M)}else{const b=a.createInterpolant(),M=d,T=f-d;b.evaluate(s),S=b.resultBuffer.slice(M,T)}l==="quaternion"&&new en().fromArray(S).normalize().conjugate().toArray(S);const w=c.times.length;for(let b=0;b=s)){const a=n[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;en;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&$6(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===X_,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}Ka.prototype.TimeBufferType=Float32Array;Ka.prototype.ValueBufferType=Float32Array;Ka.prototype.DefaultInterpolation=Dg;class rp extends Ka{constructor(e,n,r){super(e,n,r)}}rp.prototype.ValueTypeName="bool";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=Lg;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class KR extends Ka{}KR.prototype.ValueTypeName="color";class Gh extends Ka{}Gh.prototype.ValueTypeName="number";class Y6 extends av{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let c=e*a;for(let d=c+a;c!==d;c+=4)en.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Wh extends Ka{InterpolantFactoryMethodLinear(e){return new Y6(this.times,this.values,this.getValueSize(),e)}}Wh.prototype.ValueTypeName="quaternion";Wh.prototype.InterpolantFactoryMethodSmooth=void 0;class ip extends Ka{constructor(e,n,r){super(e,n,r)}}ip.prototype.ValueTypeName="string";ip.prototype.ValueBufferType=Array;ip.prototype.DefaultInterpolation=Lg;ip.prototype.InterpolantFactoryMethodLinear=void 0;ip.prototype.InterpolantFactoryMethodSmooth=void 0;class $h extends Ka{}$h.prototype.ValueTypeName="vector";class Fg{constructor(e="",n=-1,r=[],i=JS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=To(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)n.push(fxe(r[o]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)n.push(Ka.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a1){const f=d[1];let g=i[f];g||(i[f]=g=[]),g.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return o}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(f,g,y,x,S){if(y.length!==0){const w=[],b=[];XR(y,w,b,x),w.length!==0&&S.push(new f(g,w,b))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f{n&&n(s),this.manager.itemEnd(e)},0),s;if(Pc[e]!==void 0){Pc[e].push({onLoad:n,onProgress:r,onError:i});return}Pc[e]=[],Pc[e].push({onLoad:n,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Pc[e],f=c.body.getReader(),g=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),y=g?parseInt(g):0,x=y!==0;let S=0;const w=new ReadableStream({start(b){M();function M(){f.read().then(({done:T,value:C})=>{if(T)b.close();else{S+=C.byteLength;const O=new ProgressEvent("progress",{lengthComputable:x,loaded:S,total:y});for(let N=0,L=d.length;N{b.error(T)})}}});return new Response(w)}else throw new hxe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),g=f&&f[1]?f[1].toLowerCase():void 0,y=new TextDecoder(g);return c.arrayBuffer().then(x=>y.decode(x))}}}).then(c=>{Hc.add(e,c);const d=Pc[e];delete Pc[e];for(let f=0,g=d.length;f{const d=Pc[e];if(d===void 0)throw this.manager.itemError(e),c;delete Pc[e];for(let f=0,g=d.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class pxe extends Is{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Wa(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new ut().setHex(o.value);break;case"v2":i.uniforms[s].value=new He().fromArray(o.value);break;case"v3":i.uniforms[s].value=new X().fromArray(o.value);break;case"v4":i.uniforms[s].value=new Un().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Qt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new kt().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new He().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new He().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return SM.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:U6,SpriteMaterial:jR,RawShaderMaterial:F6,ShaderMaterial:ta,PointsMaterial:aM,MeshPhysicalMaterial:sa,MeshStandardMaterial:vx,MeshPhongMaterial:z6,MeshToonMaterial:B6,MeshNormalMaterial:H6,MeshLambertMaterial:V6,MeshDepthMaterial:OR,MeshDistanceMaterial:LR,MeshBasicMaterial:Cs,MeshMatcapMaterial:G6,LineDashedMaterial:W6,LineBasicMaterial:Kr,Material:Xr};return new n[e]}}class Md{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let r=0,i=e.length;r0){const l=new YR(n);s=new zg(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){i=new zg(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const w=new cs;w.min.fromArray(S.boxMin),w.max.fromArray(S.boxMax);const b=new Vi;return b.radius=S.sphereRadius,b.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:w,sphereInitialized:S.sphereInitialized,sphere:b}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new A6;break;case"Line":o=new zl(a(e.geometry),l(e.material));break;case"LineLoop":o=new FR(a(e.geometry),l(e.material));break;case"LineSegments":o=new no(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new zR(a(e.geometry),l(e.material));break;case"Sprite":o=new E6(l(e.material));break;case"Group":o=new Ps;break;case"Bone":o=new oM;break;default:o=new vn}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const g=e.children;for(let y=0;y"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hc.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Hc.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Hc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Hc.add(e,l),s.manager.itemStart(e)}}let M_;class tN{static getContext(){return M_===void 0&&(M_=new(window.AudioContext||window.webkitAudioContext)),M_}static setContext(e){M_=e}}class Sxe extends Is{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Wa(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);tN.getContext().decodeAudioData(c,function(f){n(f)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const oj=new kt,aj=new kt,Lf=new kt;class Mxe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Nr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Nr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,Lf.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(Th*n.fov*.5)/n.zoom;let a,l;aj.elements[12]=-i,oj.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,Lf.elements[0]=2*n.near/(l-a),Lf.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Lf),a=-o*n.aspect-s,l=o*n.aspect-s,Lf.elements[0]=2*n.near/(l-a),Lf.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Lf)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(aj),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(oj)}}class nN{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=lj(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=lj();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function lj(){return performance.now()}const Df=new X,cj=new en,Exe=new X,jf=new X;class Axe extends vn{constructor(){super(),this.type="AudioListener",this.context=tN.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new nN}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Df,cj,Exe),jf.set(0,0,-1).applyQuaternion(cj),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Df.x,i),n.positionY.linearRampToValueAtTime(Df.y,i),n.positionZ.linearRampToValueAtTime(Df.z,i),n.forwardX.linearRampToValueAtTime(jf.x,i),n.forwardY.linearRampToValueAtTime(jf.y,i),n.forwardZ.linearRampToValueAtTime(jf.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(Df.x,Df.y,Df.z),n.setOrientation(jf.x,jf.y,jf.z,r.x,r.y,r.z)}}let aG=class extends vn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e0&&this._mixBufferRegionAdditive(r,i,this._addIndex*n,1,n);for(let l=n,c=n+n;l!==c;++l)if(r[l]!==r[l+n]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let s=r,o=i;s!==o;++s)n[s]=n[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[n+o]=e[r+o]}_slerp(e,n,r,i){en.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;en.multiplyQuaternionsFlat(e,o,e,n,e,r),en.slerpFlat(e,n,e,n,e,o,i)}_lerp(e,n,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=n+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,n,r,i,s){for(let o=0;o!==s;++o){const a=n+o;e[a]=e[a]+e[r+o]*i}}}const rN="\\[\\]\\.:\\/",Rxe=new RegExp("["+rN+"]","g"),iN="[^"+rN+"]",Nxe="[^"+rN.replace("\\.","")+"]",Ixe=/((?:WC+[\/:])*)/.source.replace("WC",iN),kxe=/(WCOD+)?/.source.replace("WCOD",Nxe),Oxe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",iN),Lxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",iN),Dxe=new RegExp("^"+Ixe+kxe+Oxe+Lxe+"$"),jxe=["material","materials","bones","map"];class Uxe{constructor(e,n,r){const i=r||On.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,i)}getValue(e,n){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,n)}setValue(e,n){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].unbind()}}class On{constructor(e,n,r){this.path=n,this.parsedPath=r||On.parseTrackName(n),this.node=On.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,r){return e&&e.isAnimationObjectGroup?new On.Composite(e,n,r):new On(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Rxe,"")}static parseTrackName(e){const n=Dxe.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);jxe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o=s){const f=s++,g=e[f];n[g.uuid]=d,e[d]=g,n[c]=f,e[f]=l;for(let y=0,x=i;y!==x;++y){const S=r[y],w=S[f],b=S[d];S[d]=w,S[f]=b}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],d=c.uuid,f=n[d];if(f!==void 0)if(delete n[d],f0&&(n[y.uuid]=f),e[f]=y,e.pop();for(let x=0,S=i;x!==S;++x){const w=r[x];w[f]=w[g],w.pop()}}}this.nCachedObjects_=s}subscribe_(e,n){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,f=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(f);for(let g=d,y=l.length;g!==y;++g){const x=l[g];f[g]=new On(x,e,n)}return f}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];n[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class cG{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,o=s.length,a=new Array(o),l={endingStart:ah,endingEnd:ah};for(let c=0;c!==o;++c){const d=s[c].createInterpolant(null);a[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=qV,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,r){if(e.fadeOut(n),this.fadeIn(n),r){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,r){return e.crossFadeFrom(this,n,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,r){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=n/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?n=0:(this._startTime=null,n=r*l)}n*=this._updateTimeScale(e);const o=this._updateTime(n),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case MR:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case JS:default:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulate(i,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===KV;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===XV){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=n||i<0){const a=Math.floor(i/n);i-=n*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=lh,i.endingEnd=lh):(e?i.endingStart=this.zeroSlopeAtStart?lh:ah:i.endingStart=Cy,n?i.endingEnd=this.zeroSlopeAtEnd?lh:ah:i.endingEnd=Cy)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=n,a[1]=s+e,l[1]=r,this}}const zxe=new Float32Array(1);class Bxe extends Vl{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let f=0;f!==s;++f){const g=i[f],y=g.name;let x=d[y];if(x!==void 0)++x.referenceCount,o[f]=x;else{if(x=o[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,l,y));continue}const S=n&&n._propertyBindings[f].binding.parsedPath;x=new lG(On.create(r,y,S),g.ValueTypeName,g.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,l,y),o[f]=x}a[f].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const n=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let n=0;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,hj).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const pj=new X,E_=new X;class Xxe{constructor(e=new X,n=new X){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){pj.subVectors(e,this.start),E_.subVectors(this.end,this.start);const r=E_.dot(E_);let s=E_.dot(pj)/r;return n&&(s=Rr(s,0,1)),s}closestPointToPoint(e,n,r){const i=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const mj=new X;class qxe extends vn{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new nn,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let f=0;f.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{bj.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(bj,n)}}setLength(e,n=e*.2,r=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(r,n,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class fG extends no{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new nn;i.setAttribute("position",new Ft(n,3)),i.setAttribute("color",new Ft(r,3));const s=new Kr({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new ut,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(n),i.toArray(s,6),i.toArray(s,9),i.set(r),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class abe{constructor(){this.type="ShapePath",this.color=new ut,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new Ly,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,s,o){return this.currentPath.bezierCurveTo(e,n,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(b){const M=[];for(let T=0,C=b.length;TNumber.EPSILON){if(k<0&&(L=M[N],G=-G,F=M[O],k=-k),b.yF.y)continue;if(b.y===L.y){if(b.x===L.x)return!0}else{const U=k*(b.x-L.x)-G*(b.y-L.y);if(U===0)return!0;if(U<0)continue;C=!C}}else{if(b.y!==L.y)continue;if(F.x<=b.x&&b.x<=L.x||L.x<=b.x&&b.x<=F.x)return!0}}return C}const i=Nl.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Ph,l.curves=a.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],g=[];let y=[],x=0,S;g[x]=void 0,y[x]=[];for(let b=0,M=s.length;b1){let b=!1,M=0;for(let T=0,C=g.length;T0&&b===!1&&(y=f)}let w;for(let b=0,M=g.length;b{const f=typeof c=="function"?c(e):c;if(f!==e){const m=e;e=d?f:Object.assign({},e,f),n.forEach(y=>y(e,m))}},i=()=>e,s=(c,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=d(e);function y(){const x=d(e);if(!f(m,x)){const S=m;c(m=x,S)}}return n.add(y),()=>n.delete(y)},l={setState:r,getState:i,subscribe:(c,d,f)=>d||f?s(c,d,f):(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return e=t(r,i,l),l}const tbe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),_j=tbe?R.useEffect:R.useLayoutEffect;function nbe(t){const e=typeof t=="function"?ebe(t):t,n=(r=e.getState,i=Object.is)=>{const[,s]=R.useReducer(_=>_+1,0),o=e.getState(),a=R.useRef(o),l=R.useRef(r),c=R.useRef(i),d=R.useRef(!1),f=R.useRef();f.current===void 0&&(f.current=r(o));let m,y=!1;(a.current!==o||l.current!==r||c.current!==i||d.current)&&(m=r(o),y=!i(f.current,m)),_j(()=>{y&&(f.current=m),a.current=o,l.current=r,c.current=i,d.current=!1});const x=R.useRef(o);_j(()=>{const _=()=>{try{const E=e.getState(),T=l.current(E);c.current(f.current,T)||(a.current=E,f.current=T,s())}catch{d.current=!0,s()}},w=e.subscribe(_);return e.getState()!==x.current&&_(),w},[]);const S=y?m:f.current;return R.useDebugValue(S),S};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[n,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},n}var FA={exports:{}},zA={exports:{}},BA={};/** + */var _j;function dbe(){return _j||(_j=1,td.ConcurrentRoot=1,td.ContinuousEventPriority=4,td.DefaultEventPriority=16,td.DiscreteEventPriority=1,td.IdleEventPriority=536870912,td.LegacyRoot=0),td}var wj;function fbe(){return wj||(wj=1,HA.exports=dbe()),HA.exports}var Ym=fbe();function hbe(t){let e;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(e):c;if(f!==e){const g=e;e=d?f:Object.assign({},e,f),n.forEach(y=>y(e,g))}},i=()=>e,s=(c,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let g=d(e);function y(){const x=d(e);if(!f(g,x)){const S=g;c(g=x,S)}}return n.add(y),()=>n.delete(y)},l={setState:r,getState:i,subscribe:(c,d,f)=>d||f?s(c,d,f):(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return e=t(r,i,l),l}const pbe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),Sj=pbe?P.useEffect:P.useLayoutEffect;function mbe(t){const e=typeof t=="function"?hbe(t):t,n=(r=e.getState,i=Object.is)=>{const[,s]=P.useReducer(w=>w+1,0),o=e.getState(),a=P.useRef(o),l=P.useRef(r),c=P.useRef(i),d=P.useRef(!1),f=P.useRef();f.current===void 0&&(f.current=r(o));let g,y=!1;(a.current!==o||l.current!==r||c.current!==i||d.current)&&(g=r(o),y=!i(f.current,g)),Sj(()=>{y&&(f.current=g),a.current=o,l.current=r,c.current=i,d.current=!1});const x=P.useRef(o);Sj(()=>{const w=()=>{try{const M=e.getState(),T=l.current(M);c.current(f.current,T)||(a.current=M,f.current=T,s())}catch{d.current=!0,s()}},b=e.subscribe(w);return e.getState()!==x.current&&w(),b},[]);const S=y?g:f.current;return P.useDebugValue(S),S};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[n,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},n}var VA={exports:{}},GA={exports:{}},WA={};/** * @license React * scheduler.production.min.js * @@ -4442,7 +4457,7 @@ void main() { * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var wj;function rbe(){return wj||(wj=1,(function(t){function e(B,Q){var K=B.length;B.push(Q);e:for(;0>>1,q=B[V];if(0>>1;Vi(ce,K))wei(Ee,ce)?(B[V]=Ee,B[we]=K,V=we):(B[V]=ce,B[ae]=K,V=ae);else if(wei(Ee,K))B[V]=Ee,B[we]=K,V=we;else break e}}return Q}function i(B,Q){var K=B.sortIndex-Q.sortIndex;return K!==0?K:B.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var Q=n(c);Q!==null;){if(Q.callback===null)r(c);else if(Q.startTime<=B)r(c),Q.sortIndex=Q.expirationTime,e(l,Q);else break;Q=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,se(O);else{var Q=n(c);Q!==null&&fe(C,Q.startTime-B)}}function O(B,Q){x=!1,S&&(S=!1,w(F),F=-1),y=!0;var K=m;try{for(T(Q),f=n(l);f!==null&&(!(f.expirationTime>Q)||B&&!U());){var V=f.callback;if(typeof V=="function"){f.callback=null,m=f.priorityLevel;var q=V(f.expirationTime<=Q);Q=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(Q)}else r(l);f=n(l)}if(f!==null)var he=!0;else{var ae=n(c);ae!==null&&fe(C,ae.startTime-Q),he=!1}return he}finally{f=null,m=K,y=!1}}var N=!1,L=null,F=-1,G=5,k=-1;function U(){return!(t.unstable_now()-kB||125V?(B.sortIndex=K,e(c,B),n(l)===null&&B===n(c)&&(S?(w(F),F=-1):S=!0,fe(C,K-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,se(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var Q=m;return function(){var K=m;m=Q;try{return B.apply(this,arguments)}finally{m=K}}}})(BA)),BA}var Sj;function ibe(){return Sj||(Sj=1,zA.exports=rbe()),zA.exports}/** + */var Mj;function gbe(){return Mj||(Mj=1,(function(t){function e(B,Q){var K=B.length;B.push(Q);e:for(;0>>1,q=B[V];if(0>>1;Vi(ce,K))wei(Ee,ce)?(B[V]=Ee,B[we]=K,V=we):(B[V]=ce,B[ae]=K,V=ae);else if(wei(Ee,K))B[V]=Ee,B[we]=K,V=we;else break e}}return Q}function i(B,Q){var K=B.sortIndex-Q.sortIndex;return K!==0?K:B.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,g=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var Q=n(c);Q!==null;){if(Q.callback===null)r(c);else if(Q.startTime<=B)r(c),Q.sortIndex=Q.expirationTime,e(l,Q);else break;Q=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,ie(O);else{var Q=n(c);Q!==null&&fe(C,Q.startTime-B)}}function O(B,Q){x=!1,S&&(S=!1,b(F),F=-1),y=!0;var K=g;try{for(T(Q),f=n(l);f!==null&&(!(f.expirationTime>Q)||B&&!U());){var V=f.callback;if(typeof V=="function"){f.callback=null,g=f.priorityLevel;var q=V(f.expirationTime<=Q);Q=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(Q)}else r(l);f=n(l)}if(f!==null)var he=!0;else{var ae=n(c);ae!==null&&fe(C,ae.startTime-Q),he=!1}return he}finally{f=null,g=K,y=!1}}var N=!1,L=null,F=-1,G=5,k=-1;function U(){return!(t.unstable_now()-kB||125V?(B.sortIndex=K,e(c,B),n(l)===null&&B===n(c)&&(S?(b(F),F=-1):S=!0,fe(C,K-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,ie(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var Q=g;return function(){var K=g;g=Q;try{return B.apply(this,arguments)}finally{g=K}}}})(WA)),WA}var Ej;function vbe(){return Ej||(Ej=1,GA.exports=gbe()),GA.exports}/** * @license React * react-reconciler.production.min.js * @@ -4450,17 +4465,17 @@ void main() { * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var HA,Mj;function sbe(){return Mj||(Mj=1,HA=function(e){var n={},r=$h(),i=ibe(),s=Object.assign;function o(p){for(var v="https://reactjs.org/docs/error-decoder.html?invariant="+p,M=1;Mye||D[ie]!==z[ye]){var De=` -`+D[ie].replace(" at new "," at ");return p.displayName&&De.includes("")&&(De=De.replace("",p.displayName)),De}while(1<=ie&&0<=ye);break}}}finally{Ht=!1,Error.prepareStackTrace=M}return(p=p?p.displayName||p.name:"")?Pt(p):""}var Ot=Object.prototype.hasOwnProperty,An=[],Tn=-1;function _n(p){return{current:p}}function en(p){0>Tn||(p.current=An[Tn],An[Tn]=null,Tn--)}function Bt(p,v){Tn++,An[Tn]=p.current,p.current=v}var vt={},wn=_n(vt),rn=_n(!1),Nr=vt;function ui(p,v){var M=p.type.contextTypes;if(!M)return vt;var P=p.stateNode;if(P&&P.__reactInternalMemoizedUnmaskedChildContext===v)return P.__reactInternalMemoizedMaskedChildContext;var D={},z;for(z in M)D[z]=v[z];return P&&(p=p.stateNode,p.__reactInternalMemoizedUnmaskedChildContext=v,p.__reactInternalMemoizedMaskedChildContext=D),D}function Ln(p){return p=p.childContextTypes,p!=null}function ks(){en(rn),en(wn)}function Wn(p,v,M){if(wn.current!==vt)throw Error(o(168));Bt(wn,v),Bt(rn,M)}function no(p,v,M){var P=p.stateNode;if(v=v.childContextTypes,typeof P.getChildContext!="function")return M;P=P.getChildContext();for(var D in P)if(!(D in v))throw Error(o(108,F(p)||"Unknown",D));return s({},M,P)}function Ya(p){return p=(p=p.stateNode)&&p.__reactInternalMemoizedMergedChildContext||vt,Nr=wn.current,Bt(wn,p),Bt(rn,rn.current),!0}function Kr(p,v,M){var P=p.stateNode;if(!P)throw Error(o(169));M?(p=no(p,v,Nr),P.__reactInternalMemoizedMergedChildContext=p,en(rn),en(wn),Bt(wn,p)):en(rn),Bt(rn,M)}var di=Math.clz32?Math.clz32:wM,Ld=Math.log,Za=Math.LN2;function wM(p){return p>>>=0,p===0?32:31-(Ld(p)/Za|0)|0}var fu=64,Nn=4194304;function hu(p){switch(p&-p){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 p&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return p&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return p}}function Dd(p,v){var M=p.pendingLanes;if(M===0)return 0;var P=0,D=p.suspendedLanes,z=p.pingedLanes,ie=M&268435455;if(ie!==0){var ye=ie&~D;ye!==0?P=hu(ye):(z&=ie,z!==0&&(P=hu(z)))}else ie=M&~D,ie!==0?P=hu(ie):z!==0&&(P=hu(z));if(P===0)return 0;if(v!==0&&v!==P&&(v&D)===0&&(D=P&-P,z=v&-v,D>=z||D===16&&(z&4194240)!==0))return v;if((P&4)!==0&&(P|=M&16),v=p.entangledLanes,v!==0)for(p=p.entanglements,v&=P;0M;M++)v.push(p);return v}function Wl(p,v,M){p.pendingLanes|=v,v!==536870912&&(p.suspendedLanes=0,p.pingedLanes=0),p=p.eventTimes,v=31-di(v),p[v]=M}function ap(p,v){var M=p.pendingLanes&~v;p.pendingLanes=v,p.suspendedLanes=0,p.pingedLanes=0,p.expiredLanes&=v,p.mutableReadLanes&=v,p.entangledLanes&=v,v=p.entanglements;var P=p.eventTimes;for(p=p.expirationTimes;0>=ie,D-=ie,ua=1<<32-di(v)+D|M<Cn?(wr=an,an=null):wr=an.sibling;var Sn=Wt(Re,an,Le[Cn],yt);if(Sn===null){an===null&&(an=wr);break}p&&an&&Sn.alternate===null&&v(Re,an),be=z(Sn,be,Cn),ln===null?jt=Sn:ln.sibling=Sn,ln=Sn,an=wr}if(Cn===Le.length)return M(Re,an),Jn&&Ql(Re,Cn),jt;if(an===null){for(;CnCn?(wr=an,an=null):wr=an.sibling;var Aa=Wt(Re,an,Sn.value,yt);if(Aa===null){an===null&&(an=wr);break}p&&an&&Aa.alternate===null&&v(Re,an),be=z(Aa,be,Cn),ln===null?jt=Aa:ln.sibling=Aa,ln=Aa,an=wr}if(Sn.done)return M(Re,an),Jn&&Ql(Re,Cn),jt;if(an===null){for(;!Sn.done;Cn++,Sn=Le.next())Sn=on(Re,Sn.value,yt),Sn!==null&&(be=z(Sn,be,Cn),ln===null?jt=Sn:ln.sibling=Sn,ln=Sn);return Jn&&Ql(Re,Cn),jt}for(an=P(Re,an);!Sn.done;Cn++,Sn=Le.next())Sn=fn(an,Re,Cn,Sn.value,yt),Sn!==null&&(p&&Sn.alternate!==null&&an.delete(Sn.key===null?Cn:Sn.key),be=z(Sn,be,Cn),ln===null?jt=Sn:ln.sibling=Sn,ln=Sn);return p&&an.forEach(function(Kv){return v(Re,Kv)}),Jn&&Ql(Re,Cn),jt}function bs(Re,be,Le,yt){if(typeof Le=="object"&&Le!==null&&Le.type===d&&Le.key===null&&(Le=Le.props.children),typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case l:e:{for(var jt=Le.key,ln=be;ln!==null;){if(ln.key===jt){if(jt=Le.type,jt===d){if(ln.tag===7){M(Re,ln.sibling),be=D(ln,Le.props.children),be.return=Re,Re=be;break e}}else if(ln.elementType===jt||typeof jt=="object"&&jt!==null&&jt.$$typeof===T&&_u(jt)===ln.type){M(Re,ln.sibling),be=D(ln,Le.props),be.ref=bu(Re,ln,Le),be.return=Re,Re=be;break e}M(Re,ln);break}else v(Re,ln);ln=ln.sibling}Le.type===d?(be=bc(Le.props.children,Re.mode,yt,Le.key),be.return=Re,Re=be):(yt=Xp(Le.type,Le.key,Le.props,null,Re.mode,yt),yt.ref=bu(Re,be,Le),yt.return=Re,Re=yt)}return ie(Re);case c:e:{for(ln=Le.key;be!==null;){if(be.key===ln)if(be.tag===4&&be.stateNode.containerInfo===Le.containerInfo&&be.stateNode.implementation===Le.implementation){M(Re,be.sibling),be=D(be,Le.children||[]),be.return=Re,Re=be;break e}else{M(Re,be);break}else v(Re,be);be=be.sibling}be=Kp(Le,Re.mode,yt),be.return=Re,Re=be}return ie(Re);case T:return ln=Le._init,bs(Re,be,ln(Le._payload),yt)}if(pe(Le))return Mt(Re,be,Le,yt);if(N(Le))return ti(Re,be,Le,yt);nl(Re,Le)}return typeof Le=="string"&&Le!==""||typeof Le=="number"?(Le=""+Le,be!==null&&be.tag===6?(M(Re,be.sibling),be=D(be,Le),be.return=Re,Re=be):(M(Re,be),be=qp(Le,Re.mode,yt),be.return=Re,Re=be),ie(Re)):M(Re,be)}return bs}var fa=Tx(!0),Cx=Tx(!1),wu={},Yi=_n(wu),Jl=_n(wu),ec=_n(wu);function io(p){if(p===wu)throw Error(o(174));return p}function wp(p,v){Bt(ec,v),Bt(Jl,p),Bt(Yi,wu),p=fe(v),en(Yi),Bt(Yi,p)}function Su(){en(Yi),en(Jl),en(ec)}function Px(p){var v=io(ec.current),M=io(Yi.current);v=B(M,p.type,v),M!==v&&(Bt(Jl,p),Bt(Yi,v))}function xv(p){Jl.current===p&&(en(Yi),en(Jl))}var rr=_n(0);function Sp(p){for(var v=p;v!==null;){if(v.tag===13){var M=v.memoizedState;if(M!==null&&(M=M.dehydrated,M===null||To(M)||Ei(M)))return v}else if(v.tag===19&&v.memoizedProps.revealOrder!==void 0){if((v.flags&128)!==0)return v}else if(v.child!==null){v.child.return=v,v=v.child;continue}if(v===p)break;for(;v.sibling===null;){if(v.return===null||v.return===p)return null;v=v.return}v.sibling.return=v.return,v=v.sibling}return null}var hs=[];function tc(){for(var p=0;pM?M:4,p(!0);var P=ps.transition;ps.transition={};try{p(!1),v()}finally{pn=M,ps.transition=P}}function ic(){return oo().memoizedState}function Nx(p,v,M){var P=uo(p);M={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null},Ix(p)?Mv(v,M):(Yd(p,v,M),M=In(),p=pi(p,P,M),p!==null&&Zd(p,v,P))}function EM(p,v,M){var P=uo(p),D={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null};if(Ix(p))Mv(v,D);else{Yd(p,v,D);var z=p.alternate;if(p.lanes===0&&(z===null||z.lanes===0)&&(z=v.lastRenderedReducer,z!==null))try{var ie=v.lastRenderedState,ye=z(ie,M);if(D.hasEagerState=!0,D.eagerState=ye,Ti(ye,ie))return}catch{}finally{}M=In(),p=pi(p,P,M),p!==null&&Zd(p,v,P)}}function Ix(p){var v=p.alternate;return p===ir||v!==null&&v===ir}function Mv(p,v){Io=Mp=!0;var M=p.pending;M===null?v.next=v:(v.next=M.next,M.next=v),p.pending=v}function Yd(p,v,M){gr!==null&&(p.mode&1)!==0&&(un&2)===0?(p=v.interleaved,p===null?(M.next=M,Ds===null?Ds=[v]:Ds.push(v)):(M.next=p.next,p.next=M),v.interleaved=M):(p=v.pending,p===null?M.next=M:(M.next=p.next,p.next=M),v.pending=M)}function Zd(p,v,M){if((M&4194240)!==0){var P=v.lanes;P&=p.pendingLanes,M|=P,v.lanes=M,Ro(p,M)}}var Cu={readContext:Ki,useCallback:zr,useContext:zr,useEffect:zr,useImperativeHandle:zr,useInsertionEffect:zr,useLayoutEffect:zr,useMemo:zr,useReducer:zr,useRef:zr,useState:zr,useDebugValue:zr,useDeferredValue:zr,useTransition:zr,useMutableSource:zr,useSyncExternalStore:zr,useId:zr,unstable_isNewReconciler:!1},Ev={readContext:Ki,useCallback:function(p,v){return so().memoizedState=[p,v===void 0?null:v],p},useContext:Ki,useEffect:Cp,useImperativeHandle:function(p,v,M){return M=M!=null?M.concat([p]):null,il(4194308,4,Kd.bind(null,v,p),M)},useLayoutEffect:function(p,v){return il(4194308,4,p,v)},useInsertionEffect:function(p,v){return il(4,2,p,v)},useMemo:function(p,v){var M=so();return v=v===void 0?null:v,p=p(),M.memoizedState=[p,v],p},useReducer:function(p,v,M){var P=so();return v=M!==void 0?M(v):v,P.memoizedState=P.baseState=v,p={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:p,lastRenderedState:v},P.queue=p,p=p.dispatch=Nx.bind(null,ir,p),[P.memoizedState,p]},useRef:function(p){var v=so();return p={current:p},v.memoizedState=p},useState:Xd,useDebugValue:Rp,useDeferredValue:function(p){var v=Xd(p),M=v[0],P=v[1];return Cp(function(){var D=ps.transition;ps.transition={};try{P(p)}finally{ps.transition=D}},[p]),M},useTransition:function(){var p=Xd(!1),v=p[0];return p=Ip.bind(null,p[1]),so().memoizedState=p,[v,p]},useMutableSource:function(){},useSyncExternalStore:function(p,v,M){var P=ir,D=so();if(Jn){if(M===void 0)throw Error(o(407));M=M()}else{if(M=v(),gr===null)throw Error(o(349));(nc&30)!==0||wv(P,v,M)}D.memoizedState=M;var z={value:M,getSnapshot:v};return D.queue=z,Cp(ha.bind(null,P,z,p),[p]),P.flags|=2048,qd(9,Sv.bind(null,P,z,M,v),void 0,null),M},useId:function(){var p=so(),v=gr.identifierPrefix;if(Jn){var M=da,P=ua;M=(P&~(1<<32-di(P)-1)).toString(32)+M,v=":"+v+"R"+M,M=rc++,0ye||D[re]!==z[ye]){var De=` +`+D[re].replace(" at new "," at ");return m.displayName&&De.includes("")&&(De=De.replace("",m.displayName)),De}while(1<=re&&0<=ye);break}}}finally{Vt=!1,Error.prepareStackTrace=E}return(m=m?m.displayName||m.name:"")?Pt(m):""}var Ot=Object.prototype.hasOwnProperty,Tn=[],Cn=-1;function wn(m){return{current:m}}function tn(m){0>Cn||(m.current=Tn[Cn],Tn[Cn]=null,Cn--)}function Bt(m,v){Cn++,Tn[Cn]=m.current,m.current=v}var xt={},Sn=wn(xt),sn=wn(!1),kr=xt;function fi(m,v){var E=m.type.contextTypes;if(!E)return xt;var R=m.stateNode;if(R&&R.__reactInternalMemoizedUnmaskedChildContext===v)return R.__reactInternalMemoizedMaskedChildContext;var D={},z;for(z in E)D[z]=v[z];return R&&(m=m.stateNode,m.__reactInternalMemoizedUnmaskedChildContext=v,m.__reactInternalMemoizedMaskedChildContext=D),D}function Dn(m){return m=m.childContextTypes,m!=null}function Os(){tn(sn),tn(Sn)}function Wn(m,v,E){if(Sn.current!==xt)throw Error(o(168));Bt(Sn,v),Bt(sn,E)}function io(m,v,E){var R=m.stateNode;if(v=v.childContextTypes,typeof R.getChildContext!="function")return E;R=R.getChildContext();for(var D in R)if(!(D in v))throw Error(o(108,F(m)||"Unknown",D));return s({},E,R)}function Ya(m){return m=(m=m.stateNode)&&m.__reactInternalMemoizedMergedChildContext||xt,kr=Sn.current,Bt(Sn,m),Bt(sn,sn.current),!0}function Yr(m,v,E){var R=m.stateNode;if(!R)throw Error(o(169));E?(m=io(m,v,kr),R.__reactInternalMemoizedMergedChildContext=m,tn(sn),tn(Sn),Bt(Sn,m)):tn(sn),Bt(sn,E)}var hi=Math.clz32?Math.clz32:MM,Dd=Math.log,Za=Math.LN2;function MM(m){return m>>>=0,m===0?32:31-(Dd(m)/Za|0)|0}var fu=64,In=4194304;function hu(m){switch(m&-m){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 m&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return m&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return m}}function jd(m,v){var E=m.pendingLanes;if(E===0)return 0;var R=0,D=m.suspendedLanes,z=m.pingedLanes,re=E&268435455;if(re!==0){var ye=re&~D;ye!==0?R=hu(ye):(z&=re,z!==0&&(R=hu(z)))}else re=E&~D,re!==0?R=hu(re):z!==0&&(R=hu(z));if(R===0)return 0;if(v!==0&&v!==R&&(v&D)===0&&(D=R&-R,z=v&-v,D>=z||D===16&&(z&4194240)!==0))return v;if((R&4)!==0&&(R|=E&16),v=m.entangledLanes,v!==0)for(m=m.entanglements,v&=R;0E;E++)v.push(m);return v}function Wl(m,v,E){m.pendingLanes|=v,v!==536870912&&(m.suspendedLanes=0,m.pingedLanes=0),m=m.eventTimes,v=31-hi(v),m[v]=E}function ap(m,v){var E=m.pendingLanes&~v;m.pendingLanes=v,m.suspendedLanes=0,m.pingedLanes=0,m.expiredLanes&=v,m.mutableReadLanes&=v,m.entangledLanes&=v,v=m.entanglements;var R=m.eventTimes;for(m=m.expirationTimes;0>=re,D-=re,ua=1<<32-hi(v)+D|E<Pn?(Mr=ln,ln=null):Mr=ln.sibling;var Mn=$t(Re,ln,Le[Pn],bt);if(Mn===null){ln===null&&(ln=Mr);break}m&&ln&&Mn.alternate===null&&v(Re,ln),be=z(Mn,be,Pn),cn===null?Ut=Mn:cn.sibling=Mn,cn=Mn,ln=Mr}if(Pn===Le.length)return E(Re,ln),tr&&Ql(Re,Pn),Ut;if(ln===null){for(;PnPn?(Mr=ln,ln=null):Mr=ln.sibling;var Aa=$t(Re,ln,Mn.value,bt);if(Aa===null){ln===null&&(ln=Mr);break}m&&ln&&Aa.alternate===null&&v(Re,ln),be=z(Aa,be,Pn),cn===null?Ut=Aa:cn.sibling=Aa,cn=Aa,ln=Mr}if(Mn.done)return E(Re,ln),tr&&Ql(Re,Pn),Ut;if(ln===null){for(;!Mn.done;Pn++,Mn=Le.next())Mn=an(Re,Mn.value,bt),Mn!==null&&(be=z(Mn,be,Pn),cn===null?Ut=Mn:cn.sibling=Mn,cn=Mn);return tr&&Ql(Re,Pn),Ut}for(ln=R(Re,ln);!Mn.done;Pn++,Mn=Le.next())Mn=dn(ln,Re,Pn,Mn.value,bt),Mn!==null&&(m&&Mn.alternate!==null&&ln.delete(Mn.key===null?Pn:Mn.key),be=z(Mn,be,Pn),cn===null?Ut=Mn:cn.sibling=Mn,cn=Mn);return m&&ln.forEach(function(Kv){return v(Re,Kv)}),tr&&Ql(Re,Pn),Ut}function bs(Re,be,Le,bt){if(typeof Le=="object"&&Le!==null&&Le.type===d&&Le.key===null&&(Le=Le.props.children),typeof Le=="object"&&Le!==null){switch(Le.$$typeof){case l:e:{for(var Ut=Le.key,cn=be;cn!==null;){if(cn.key===Ut){if(Ut=Le.type,Ut===d){if(cn.tag===7){E(Re,cn.sibling),be=D(cn,Le.props.children),be.return=Re,Re=be;break e}}else if(cn.elementType===Ut||typeof Ut=="object"&&Ut!==null&&Ut.$$typeof===T&&_u(Ut)===cn.type){E(Re,cn.sibling),be=D(cn,Le.props),be.ref=bu(Re,cn,Le),be.return=Re,Re=be;break e}E(Re,cn);break}else v(Re,cn);cn=cn.sibling}Le.type===d?(be=bc(Le.props.children,Re.mode,bt,Le.key),be.return=Re,Re=be):(bt=Xp(Le.type,Le.key,Le.props,null,Re.mode,bt),bt.ref=bu(Re,be,Le),bt.return=Re,Re=bt)}return re(Re);case c:e:{for(cn=Le.key;be!==null;){if(be.key===cn)if(be.tag===4&&be.stateNode.containerInfo===Le.containerInfo&&be.stateNode.implementation===Le.implementation){E(Re,be.sibling),be=D(be,Le.children||[]),be.return=Re,Re=be;break e}else{E(Re,be);break}else v(Re,be);be=be.sibling}be=Kp(Le,Re.mode,bt),be.return=Re,Re=be}return re(Re);case T:return cn=Le._init,bs(Re,be,cn(Le._payload),bt)}if(pe(Le))return Et(Re,be,Le,bt);if(N(Le))return ni(Re,be,Le,bt);nl(Re,Le)}return typeof Le=="string"&&Le!==""||typeof Le=="number"?(Le=""+Le,be!==null&&be.tag===6?(E(Re,be.sibling),be=D(be,Le),be.return=Re,Re=be):(E(Re,be),be=qp(Le,Re.mode,bt),be.return=Re,Re=be),re(Re)):E(Re,be)}return bs}var fa=Tx(!0),Cx=Tx(!1),wu={},Yi=wn(wu),Jl=wn(wu),ec=wn(wu);function oo(m){if(m===wu)throw Error(o(174));return m}function wp(m,v){Bt(ec,v),Bt(Jl,m),Bt(Yi,wu),m=fe(v),tn(Yi),Bt(Yi,m)}function Su(){tn(Yi),tn(Jl),tn(ec)}function Px(m){var v=oo(ec.current),E=oo(Yi.current);v=B(E,m.type,v),E!==v&&(Bt(Jl,m),Bt(Yi,v))}function xv(m){Jl.current===m&&(tn(Yi),tn(Jl))}var sr=wn(0);function Sp(m){for(var v=m;v!==null;){if(v.tag===13){var E=v.memoizedState;if(E!==null&&(E=E.dehydrated,E===null||ro(E)||Xi(E)))return v}else if(v.tag===19&&v.memoizedProps.revealOrder!==void 0){if((v.flags&128)!==0)return v}else if(v.child!==null){v.child.return=v,v=v.child;continue}if(v===m)break;for(;v.sibling===null;){if(v.return===null||v.return===m)return null;v=v.return}v.sibling.return=v.return,v=v.sibling}return null}var hs=[];function tc(){for(var m=0;mE?E:4,m(!0);var R=ps.transition;ps.transition={};try{m(!1),v()}finally{hn=E,ps.transition=R}}function ic(){return lo().memoizedState}function Nx(m,v,E){var R=ho(m);E={lane:R,action:E,hasEagerState:!1,eagerState:null,next:null},Ix(m)?Mv(v,E):(Zd(m,v,E),E=kn(),m=gi(m,R,E),m!==null&&Qd(m,v,R))}function TM(m,v,E){var R=ho(m),D={lane:R,action:E,hasEagerState:!1,eagerState:null,next:null};if(Ix(m))Mv(v,D);else{Zd(m,v,D);var z=m.alternate;if(m.lanes===0&&(z===null||z.lanes===0)&&(z=v.lastRenderedReducer,z!==null))try{var re=v.lastRenderedState,ye=z(re,E);if(D.hasEagerState=!0,D.eagerState=ye,Ci(ye,re))return}catch{}finally{}E=kn(),m=gi(m,R,E),m!==null&&Qd(m,v,R)}}function Ix(m){var v=m.alternate;return m===or||v!==null&&v===or}function Mv(m,v){Oo=Mp=!0;var E=m.pending;E===null?v.next=v:(v.next=E.next,E.next=v),m.pending=v}function Zd(m,v,E){yr!==null&&(m.mode&1)!==0&&(un&2)===0?(m=v.interleaved,m===null?(E.next=E,js===null?js=[v]:js.push(v)):(E.next=m.next,m.next=E),v.interleaved=E):(m=v.pending,m===null?E.next=E:(E.next=m.next,m.next=E),v.pending=E)}function Qd(m,v,E){if((E&4194240)!==0){var R=v.lanes;R&=m.pendingLanes,E|=R,v.lanes=E,Io(m,E)}}var Cu={readContext:Ki,useCallback:Br,useContext:Br,useEffect:Br,useImperativeHandle:Br,useInsertionEffect:Br,useLayoutEffect:Br,useMemo:Br,useReducer:Br,useRef:Br,useState:Br,useDebugValue:Br,useDeferredValue:Br,useTransition:Br,useMutableSource:Br,useSyncExternalStore:Br,useId:Br,unstable_isNewReconciler:!1},Ev={readContext:Ki,useCallback:function(m,v){return ao().memoizedState=[m,v===void 0?null:v],m},useContext:Ki,useEffect:Cp,useImperativeHandle:function(m,v,E){return E=E!=null?E.concat([m]):null,il(4194308,4,Yd.bind(null,v,m),E)},useLayoutEffect:function(m,v){return il(4194308,4,m,v)},useInsertionEffect:function(m,v){return il(4,2,m,v)},useMemo:function(m,v){var E=ao();return v=v===void 0?null:v,m=m(),E.memoizedState=[m,v],m},useReducer:function(m,v,E){var R=ao();return v=E!==void 0?E(v):v,R.memoizedState=R.baseState=v,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:m,lastRenderedState:v},R.queue=m,m=m.dispatch=Nx.bind(null,or,m),[R.memoizedState,m]},useRef:function(m){var v=ao();return m={current:m},v.memoizedState=m},useState:qd,useDebugValue:Rp,useDeferredValue:function(m){var v=qd(m),E=v[0],R=v[1];return Cp(function(){var D=ps.transition;ps.transition={};try{R(m)}finally{ps.transition=D}},[m]),E},useTransition:function(){var m=qd(!1),v=m[0];return m=Ip.bind(null,m[1]),ao().memoizedState=m,[v,m]},useMutableSource:function(){},useSyncExternalStore:function(m,v,E){var R=or,D=ao();if(tr){if(E===void 0)throw Error(o(407));E=E()}else{if(E=v(),yr===null)throw Error(o(349));(nc&30)!==0||wv(R,v,E)}D.memoizedState=E;var z={value:E,getSnapshot:v};return D.queue=z,Cp(ha.bind(null,R,z,m),[m]),R.flags|=2048,Kd(9,Sv.bind(null,R,z,E,v),void 0,null),E},useId:function(){var m=ao(),v=yr.identifierPrefix;if(tr){var E=da,R=ua;E=(R&~(1<<32-hi(R)-1)).toString(32)+E,v=":"+v+"R"+E,E=rc++,0ll&&(v.flags|=128,P=!0,ma(D,!1),v.lanes=4194304)}else{if(!P)if(p=Sp(z),p!==null){if(v.flags|=128,P=!0,p=p.updateQueue,p!==null&&(v.updateQueue=p,v.flags|=4),ma(D,!0),D.tail===null&&D.tailMode==="hidden"&&!z.alternate&&!Jn)return mr(v),null}else 2*Ir()-D.renderingStartTime>ll&&M!==1073741824&&(v.flags|=128,P=!0,ma(D,!1),v.lanes=4194304);D.isBackwards?(z.sibling=v.child,v.child=z):(p=D.last,p!==null?p.sibling=z:v.child=z,D.last=z)}return D.tail!==null?(v=D.tail,D.rendering=v,D.tail=v.sibling,D.renderingStartTime=Ir(),v.sibling=null,p=rr.current,Bt(rr,P?p&1|2:p&1),v):(mr(v),null);case 22:case 23:return ff(),P=v.memoizedState!==null,p!==null&&p.memoizedState!==null!==P&&(v.flags|=8192),P&&(v.mode&1)!==0?(hi&1073741824)!==0&&(mr(v),$e&&v.subtreeFlags&6&&(v.flags|=8192)):mr(v),null;case 24:return null;case 25:return null}throw Error(o(156,v.tag))}var Rv=a.ReactCurrentOwner,Br=!1;function cr(p,v,M,P){v.child=p===null?Cx(v,null,M,P):fa(v,p.child,M,P)}function qn(p,v,M,P,D){M=M.render;var z=v.ref;return mu(v,D),P=Mu(p,v,M,P,z,D),M=rl(),p!==null&&!Br?(v.updateQueue=p.updateQueue,v.flags&=-2053,p.lanes&=~D,Zi(p,v,D)):(Jn&&M&&mv(v),v.flags|=1,cr(p,v,P,D),v.child)}function $n(p,v,M,P,D){if(p===null){var z=M.type;return typeof z=="function"&&!$p(z)&&z.defaultProps===void 0&&M.compare===null&&M.defaultProps===void 0?(v.tag=15,v.type=z,ga(p,v,z,P,D)):(p=Xp(M.type,null,P,v,v.mode,D),p.ref=v.ref,p.return=v,v.child=p)}if(z=p.child,(p.lanes&D)===0){var ie=z.memoizedProps;if(M=M.compare,M=M!==null?M:ro,M(ie,P)&&p.ref===v.ref)return Zi(p,v,D)}return v.flags|=1,p=Ea(z,P),p.ref=v.ref,p.return=v,v.child=p}function ga(p,v,M,P,D){if(p!==null&&ro(p.memoizedProps,P)&&p.ref===v.ref)if(Br=!1,(p.lanes&D)!==0)(p.flags&131072)!==0&&(Br=!0);else return v.lanes=p.lanes,Zi(p,v,D);return va(p,v,M,P,D)}function Zr(p,v,M){var P=v.pendingProps,D=P.children,z=p!==null?p.memoizedState:null;if(P.mode==="hidden")if((v.mode&1)===0)v.memoizedState={baseLanes:0,cachePool:null},Bt(mc,hi),hi|=M;else if((M&1073741824)!==0)v.memoizedState={baseLanes:0,cachePool:null},P=z!==null?z.baseLanes:M,Bt(mc,hi),hi|=P;else return p=z!==null?z.baseLanes|M:M,v.lanes=v.childLanes=1073741824,v.memoizedState={baseLanes:p,cachePool:null},v.updateQueue=null,Bt(mc,hi),hi|=p,null;else z!==null?(P=z.baseLanes|M,v.memoizedState=null):P=M,Bt(mc,hi),hi|=P;return cr(p,v,D,M),v.child}function Ri(p,v){var M=v.ref;(p===null&&M!==null||p!==null&&p.ref!==M)&&(v.flags|=512,v.flags|=2097152)}function va(p,v,M,P,D){var z=Ln(M)?Nr:wn.current;return z=ui(v,z),mu(v,D),M=Mu(p,v,M,P,z,D),P=rl(),p!==null&&!Br?(v.updateQueue=p.updateQueue,v.flags&=-2053,p.lanes&=~D,Zi(p,v,D)):(Jn&&P&&mv(v),v.flags|=1,cr(p,v,M,D),v.child)}function ac(p,v,M,P,D){if(Ln(M)){var z=!0;Ya(v)}else z=!1;if(mu(v,D),v.stateNode===null)p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),Sx(v,M,P),pv(v,M,P,D),P=!0;else if(p===null){var ie=v.stateNode,ye=v.memoizedProps;ie.props=ye;var De=ie.context,at=M.contextType;typeof at=="object"&&at!==null?at=Ki(at):(at=Ln(M)?Nr:wn.current,at=ui(v,at));var Ct=M.getDerivedStateFromProps,on=typeof Ct=="function"||typeof ie.getSnapshotBeforeUpdate=="function";on||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==P||De!==at)&&Mx(v,ie,P,at),js=!1;var Wt=v.memoizedState;ie.state=Wt,gp(v,P,ie,D),De=v.memoizedState,ye!==P||Wt!==De||rn.current||js?(typeof Ct=="function"&&(fv(v,M,Ct,P),De=v.memoizedState),(ye=js||hv(v,M,ye,P,Wt,De,at))?(on||typeof ie.UNSAFE_componentWillMount!="function"&&typeof ie.componentWillMount!="function"||(typeof ie.componentWillMount=="function"&&ie.componentWillMount(),typeof ie.UNSAFE_componentWillMount=="function"&&ie.UNSAFE_componentWillMount()),typeof ie.componentDidMount=="function"&&(v.flags|=4194308)):(typeof ie.componentDidMount=="function"&&(v.flags|=4194308),v.memoizedProps=P,v.memoizedState=De),ie.props=P,ie.state=De,ie.context=at,P=ye):(typeof ie.componentDidMount=="function"&&(v.flags|=4194308),P=!1)}else{ie=v.stateNode,dv(p,v),ye=v.memoizedProps,at=v.type===v.elementType?ye:qi(v.type,ye),ie.props=at,on=v.pendingProps,Wt=ie.context,De=M.contextType,typeof De=="object"&&De!==null?De=Ki(De):(De=Ln(M)?Nr:wn.current,De=ui(v,De));var fn=M.getDerivedStateFromProps;(Ct=typeof fn=="function"||typeof ie.getSnapshotBeforeUpdate=="function")||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==on||Wt!==De)&&Mx(v,ie,P,De),js=!1,Wt=v.memoizedState,ie.state=Wt,gp(v,P,ie,D);var Mt=v.memoizedState;ye!==on||Wt!==Mt||rn.current||js?(typeof fn=="function"&&(fv(v,M,fn,P),Mt=v.memoizedState),(at=js||hv(v,M,at,P,Wt,Mt,De)||!1)?(Ct||typeof ie.UNSAFE_componentWillUpdate!="function"&&typeof ie.componentWillUpdate!="function"||(typeof ie.componentWillUpdate=="function"&&ie.componentWillUpdate(P,Mt,De),typeof ie.UNSAFE_componentWillUpdate=="function"&&ie.UNSAFE_componentWillUpdate(P,Mt,De)),typeof ie.componentDidUpdate=="function"&&(v.flags|=4),typeof ie.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof ie.componentDidUpdate!="function"||ye===p.memoizedProps&&Wt===p.memoizedState||(v.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===p.memoizedProps&&Wt===p.memoizedState||(v.flags|=1024),v.memoizedProps=P,v.memoizedState=Mt),ie.props=P,ie.state=Mt,ie.context=De,P=at):(typeof ie.componentDidUpdate!="function"||ye===p.memoizedProps&&Wt===p.memoizedState||(v.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===p.memoizedProps&&Wt===p.memoizedState||(v.flags|=1024),P=!1)}return fi(p,v,M,P,z,D)}function fi(p,v,M,P,D,z){Ri(p,v);var ie=(v.flags&128)!==0;if(!P&&!ie)return D&&Kr(v,M,!1),Zi(p,v,z);P=v.stateNode,Rv.current=v;var ye=ie&&typeof M.getDerivedStateFromError!="function"?null:P.render();return v.flags|=1,p!==null&&ie?(v.child=fa(v,p.child,null,z),v.child=fa(v,null,ye,z)):cr(p,v,ye,z),v.memoizedState=P.state,D&&Kr(v,M,!0),v.child}function Qd(p){var v=p.stateNode;v.pendingContext?Wn(p,v.pendingContext,v.pendingContext!==v.context):v.context&&Wn(p,v.context,!1),wp(p,v.containerInfo)}function Nv(p,v,M,P,D){return xu(),_p(D),v.flags|=256,cr(p,v,M,P),v.child}var Jd={dehydrated:null,treeContext:null,retryLane:0};function lc(p){return{baseLanes:p,cachePool:null}}function Iv(p,v,M){var P=v.pendingProps,D=rr.current,z=!1,ie=(v.flags&128)!==0,ye;if((ye=ie)||(ye=p!==null&&p.memoizedState===null?!1:(D&2)!==0),ye?(z=!0,v.flags&=-129):(p===null||p.memoizedState!==null)&&(D|=1),Bt(rr,D&1),p===null)return tl(v),p=v.memoizedState,p!==null&&(p=p.dehydrated,p!==null)?((v.mode&1)===0?v.lanes=1:Ei(p)?v.lanes=8:v.lanes=1073741824,null):(D=P.children,p=P.fallback,z?(P=v.mode,z=v.child,D={mode:"hidden",children:D},(P&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=D):z=mf(D,P,0,null),p=bc(p,P,M,null),z.return=v,p.return=v,z.sibling=p,v.child=z,v.child.memoizedState=lc(M),v.memoizedState=Jd,p):ao(v,D));if(D=p.memoizedState,D!==null){if(ye=D.dehydrated,ye!==null){if(ie)return v.flags&256?(v.flags&=-257,tf(p,v,M,Error(o(422)))):v.memoizedState!==null?(v.child=p.child,v.flags|=128,null):(z=P.fallback,D=v.mode,P=mf({mode:"visible",children:P.children},D,0,null),z=bc(z,D,M,null),z.flags|=2,P.return=v,z.return=v,P.sibling=z,v.child=P,(v.mode&1)!==0&&fa(v,p.child,null,M),v.child.memoizedState=lc(M),v.memoizedState=Jd,z);if((v.mode&1)===0)v=tf(p,v,M,null);else if(Ei(ye))v=tf(p,v,M,Error(o(419)));else if(P=(M&p.childLanes)!==0,Br||P){if(P=gr,P!==null){switch(M&-M){case 4:z=2;break;case 16:z=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:z=32;break;case 536870912:z=268435456;break;default:z=0}P=(z&(P.suspendedLanes|M))!==0?0:z,P!==0&&P!==D.retryLane&&(D.retryLane=P,pi(p,P,-1))}Gp(),v=tf(p,v,M,Error(o(421)))}else To(ye)?(v.flags|=128,v.child=p.child,v=Ux.bind(null,p),sa(ye,v),v=null):(M=D.treeContext,Z&&(Yr=cu(ye),Pi=v,Jn=!0,Fs=null,yu=!1,M!==null&&(Us[fs++]=ua,Us[fs++]=da,Us[fs++]=Zl,ua=M.id,da=M.overflow,Zl=v)),v=ao(v,v.pendingProps.children),v.flags|=4096);return v}return z?(P=Up(p,v,P.children,P.fallback,M),z=v.child,D=p.child.memoizedState,z.memoizedState=D===null?lc(M):{baseLanes:D.baseLanes|M,cachePool:null},z.childLanes=p.childLanes&~M,v.memoizedState=Jd,P):(M=ef(p,v,P.children,M),v.memoizedState=null,M)}return z?(P=Up(p,v,P.children,P.fallback,M),z=v.child,D=p.child.memoizedState,z.memoizedState=D===null?lc(M):{baseLanes:D.baseLanes|M,cachePool:null},z.childLanes=p.childLanes&~M,v.memoizedState=Jd,P):(M=ef(p,v,P.children,M),v.memoizedState=null,M)}function ao(p,v){return v=mf({mode:"visible",children:v},p.mode,0,null),v.return=p,p.child=v}function ef(p,v,M,P){var D=p.child;return p=D.sibling,M=Ea(D,{mode:"visible",children:M}),(v.mode&1)===0&&(M.lanes=P),M.return=v,M.sibling=null,p!==null&&(P=v.deletions,P===null?(v.deletions=[p],v.flags|=16):P.push(p)),v.child=M}function Up(p,v,M,P,D){var z=v.mode;p=p.child;var ie=p.sibling,ye={mode:"hidden",children:M};return(z&1)===0&&v.child!==p?(M=v.child,M.childLanes=0,M.pendingProps=ye,v.deletions=null):(M=Ea(p,ye),M.subtreeFlags=p.subtreeFlags&14680064),ie!==null?P=Ea(ie,P):(P=bc(P,z,D,null),P.flags|=2),P.return=v,M.return=v,M.sibling=P,v.child=M,P}function tf(p,v,M,P){return P!==null&&_p(P),fa(v,p.child,null,M),p=ao(v,v.pendingProps.children),p.flags|=2,v.memoizedState=null,p}function Ox(p,v,M){p.lanes|=v;var P=p.alternate;P!==null&&(P.lanes|=v),Yl(p.return,v,M)}function Oo(p,v,M,P,D){var z=p.memoizedState;z===null?p.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:P,tail:M,tailMode:D}:(z.isBackwards=v,z.rendering=null,z.renderingStartTime=0,z.last=P,z.tail=M,z.tailMode=D)}function cc(p,v,M){var P=v.pendingProps,D=P.revealOrder,z=P.tail;if(cr(p,v,P.children,M),P=rr.current,(P&2)!==0)P=P&1|2,v.flags|=128;else{if(p!==null&&(p.flags&128)!==0)e:for(p=v.child;p!==null;){if(p.tag===13)p.memoizedState!==null&&Ox(p,M,v);else if(p.tag===19)Ox(p,M,v);else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===v)break e;for(;p.sibling===null;){if(p.return===null||p.return===v)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}P&=1}if(Bt(rr,P),(v.mode&1)===0)v.memoizedState=null;else switch(D){case"forwards":for(M=v.child,D=null;M!==null;)p=M.alternate,p!==null&&Sp(p)===null&&(D=M),M=M.sibling;M=D,M===null?(D=v.child,v.child=null):(D=M.sibling,M.sibling=null),Oo(v,!1,D,M,z);break;case"backwards":for(M=null,D=v.child,v.child=null;D!==null;){if(p=D.alternate,p!==null&&Sp(p)===null){v.child=D;break}p=D.sibling,D.sibling=M,M=D,D=p}Oo(v,!0,M,null,z);break;case"together":Oo(v,!1,null,null,void 0);break;default:v.memoizedState=null}return v.child}function Zi(p,v,M){if(p!==null&&(v.dependencies=p.dependencies),Lo|=v.lanes,(M&v.childLanes)===0)return null;if(p!==null&&v.child!==p.child)throw Error(o(153));if(v.child!==null){for(p=v.child,M=Ea(p,p.pendingProps),v.child=M,M.return=v;p.sibling!==null;)p=p.sibling,M=M.sibling=Ea(p,p.pendingProps),M.return=v;M.sibling=null}return v.child}function Fp(p,v,M){switch(v.tag){case 3:Qd(v),xu();break;case 5:Px(v);break;case 1:Ln(v.type)&&Ya(v);break;case 4:wp(v,v.stateNode.containerInfo);break;case 10:Kl(v,v.type._context,v.memoizedProps.value);break;case 13:var P=v.memoizedState;if(P!==null)return P.dehydrated!==null?(Bt(rr,rr.current&1),v.flags|=128,null):(M&v.child.childLanes)!==0?Iv(p,v,M):(Bt(rr,rr.current&1),p=Zi(p,v,M),p!==null?p.sibling:null);Bt(rr,rr.current&1);break;case 19:if(P=(M&v.childLanes)!==0,(p.flags&128)!==0){if(P)return cc(p,v,M);v.flags|=128}var D=v.memoizedState;if(D!==null&&(D.rendering=null,D.tail=null,D.lastEffect=null),Bt(rr,rr.current),P)break;return null;case 22:case 23:return v.lanes=0,Zr(p,v,M)}return Zi(p,v,M)}function zp(p,v){switch(gv(v),v.tag){case 1:return Ln(v.type)&&ks(),p=v.flags,p&65536?(v.flags=p&-65537|128,v):null;case 3:return Su(),en(rn),en(wn),tc(),p=v.flags,(p&65536)!==0&&(p&128)===0?(v.flags=p&-65537|128,v):null;case 5:return xv(v),null;case 13:if(en(rr),p=v.memoizedState,p!==null&&p.dehydrated!==null){if(v.alternate===null)throw Error(o(340));xu()}return p=v.flags,p&65536?(v.flags=p&-65537|128,v):null;case 19:return en(rr),null;case 4:return Su(),null;case 10:return Bd(v.type._context),null;case 22:case 23:return ff(),null;case 24:return null;default:return null}}var Ni=!1,Hr=!1,uc=typeof WeakSet=="function"?WeakSet:Set,ft=null;function zs(p,v){var M=p.ref;if(M!==null)if(typeof M=="function")try{M(null)}catch(P){ki(p,v,P)}else M.current=null}function ya(p,v,M){try{M()}catch(P){ki(p,v,P)}}var kv=!1;function Ov(p,v){for(Q(p.containerInfo),ft=v;ft!==null;)if(p=ft,v=p.child,(p.subtreeFlags&1028)!==0&&v!==null)v.return=p,ft=v;else for(;ft!==null;){p=ft;try{var M=p.alternate;if((p.flags&1024)!==0)switch(p.tag){case 0:case 11:case 15:break;case 1:if(M!==null){var P=M.memoizedProps,D=M.memoizedState,z=p.stateNode,ie=z.getSnapshotBeforeUpdate(p.elementType===p.type?P:qi(p.type,P),D);z.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:$e&&st(p.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ye){ki(p,p.return,ye)}if(v=p.sibling,v!==null){v.return=p.return,ft=v;break}ft=p.return}return M=kv,kv=!1,M}function xa(p,v,M){var P=v.updateQueue;if(P=P!==null?P.lastEffect:null,P!==null){var D=P=P.next;do{if((D.tag&p)===p){var z=D.destroy;D.destroy=void 0,z!==void 0&&ya(v,M,z)}D=D.next}while(D!==P)}}function Qr(p,v){if(v=v.updateQueue,v=v!==null?v.lastEffect:null,v!==null){var M=v=v.next;do{if((M.tag&p)===p){var P=M.create;M.destroy=P()}M=M.next}while(M!==v)}}function Ii(p){var v=p.ref;if(v!==null){var M=p.stateNode;switch(p.tag){case 5:p=se(M);break;default:p=M}typeof v=="function"?v(p):v.current=p}}function Yn(p,v,M){if(No&&typeof No.onCommitFiberUnmount=="function")try{No.onCommitFiberUnmount(jd,v)}catch{}switch(v.tag){case 0:case 11:case 14:case 15:if(p=v.updateQueue,p!==null&&(p=p.lastEffect,p!==null)){var P=p=p.next;do{var D=P,z=D.destroy;D=D.tag,z!==void 0&&((D&2)!==0||(D&4)!==0)&&ya(v,M,z),P=P.next}while(P!==p)}break;case 1:if(zs(v,M),p=v.stateNode,typeof p.componentWillUnmount=="function")try{p.props=v.memoizedProps,p.state=v.memoizedState,p.componentWillUnmount()}catch(ie){ki(v,M,ie)}break;case 5:zs(v,M);break;case 4:$e?jv(p,v,M):ue&&ue&&(v=v.stateNode.containerInfo,M=ze(v),_t(v,M))}}function Bs(p,v,M){for(var P=v;;)if(Yn(p,P,M),P.child===null||$e&&P.tag===4){if(P===v)break;for(;P.sibling===null;){if(P.return===null||P.return===v)return;P=P.return}P.sibling.return=P.return,P=P.sibling}else P.child.return=P,P=P.child}function Lv(p){var v=p.alternate;v!==null&&(p.alternate=null,Lv(v)),p.child=null,p.deletions=null,p.sibling=null,p.tag===5&&(v=p.stateNode,v!==null&&tt(v)),p.stateNode=null,p.return=null,p.dependencies=null,p.memoizedProps=null,p.memoizedState=null,p.pendingProps=null,p.stateNode=null,p.updateQueue=null}function Dv(p){return p.tag===5||p.tag===3||p.tag===4}function Bp(p){e:for(;;){for(;p.sibling===null;){if(p.return===null||Dv(p.return))return null;p=p.return}for(p.sibling.return=p.return,p=p.sibling;p.tag!==5&&p.tag!==6&&p.tag!==18;){if(p.flags&2||p.child===null||p.tag===4)continue e;p.child.return=p,p=p.child}if(!(p.flags&2))return p.stateNode}}function Hp(p){if($e){e:{for(var v=p.return;v!==null;){if(Dv(v))break e;v=v.return}throw Error(o(160))}var M=v;switch(M.tag){case 5:v=M.stateNode,M.flags&32&&(qe(v),M.flags&=-33),M=Bp(p),Ru(p,M,v);break;case 3:case 4:v=M.stateNode.containerInfo,M=Bp(p),Vp(p,M,v);break;default:throw Error(o(161))}}}function Vp(p,v,M){var P=p.tag;if(P===5||P===6)p=p.stateNode,v?mt(M,p,v):Gt(M,p);else if(P!==4&&(p=p.child,p!==null))for(Vp(p,v,M),p=p.sibling;p!==null;)Vp(p,v,M),p=p.sibling}function Ru(p,v,M){var P=p.tag;if(P===5||P===6)p=p.stateNode,v?St(M,p,v):ht(M,p);else if(P!==4&&(p=p.child,p!==null))for(Ru(p,v,M),p=p.sibling;p!==null;)Ru(p,v,M),p=p.sibling}function jv(p,v,M){for(var P=v,D=!1,z,ie;;){if(!D){D=P.return;e:for(;;){if(D===null)throw Error(o(160));switch(z=D.stateNode,D.tag){case 5:ie=!1;break e;case 3:z=z.containerInfo,ie=!0;break e;case 4:z=z.containerInfo,ie=!0;break e}D=D.return}D=!0}if(P.tag===5||P.tag===6)Bs(p,P,M),ie?de(z,P.stateNode):Qt(z,P.stateNode);else if(P.tag===18)ie?Ne(z,P.stateNode):Ce(z,P.stateNode);else if(P.tag===4){if(P.child!==null){z=P.stateNode.containerInfo,ie=!0,P.child.return=P,P=P.child;continue}}else if(Yn(p,P,M),P.child!==null){P.child.return=P,P=P.child;continue}if(P===v)break;for(;P.sibling===null;){if(P.return===null||P.return===v)return;P=P.return,P.tag===4&&(D=!1)}P.sibling.return=P.return,P=P.sibling}}function ol(p,v){if($e){switch(v.tag){case 0:case 11:case 14:case 15:xa(3,v,v.return),Qr(3,v),xa(5,v,v.return);return;case 1:return;case 5:var M=v.stateNode;if(M!=null){var P=v.memoizedProps;p=p!==null?p.memoizedProps:P;var D=v.type,z=v.updateQueue;v.updateQueue=null,z!==null&&Qe(M,z,D,p,P,v)}return;case 6:if(v.stateNode===null)throw Error(o(162));M=v.memoizedProps,Ke(v.stateNode,p!==null?p.memoizedProps:M,M);return;case 3:Z&&p!==null&&p.memoizedState.isDehydrated&&Y(v.stateNode.containerInfo);return;case 12:return;case 13:Nu(v);return;case 19:Nu(v);return;case 17:return}throw Error(o(163))}switch(v.tag){case 0:case 11:case 14:case 15:xa(3,v,v.return),Qr(3,v),xa(5,v,v.return);return;case 12:return;case 13:Nu(v);return;case 19:Nu(v);return;case 3:Z&&p!==null&&p.memoizedState.isDehydrated&&Y(v.stateNode.containerInfo);break;case 22:case 23:return}e:if(ue){switch(v.tag){case 1:case 5:case 6:break e;case 3:case 4:v=v.stateNode,_t(v.containerInfo,v.pendingChildren);break e}throw Error(o(163))}}function Nu(p){var v=p.updateQueue;if(v!==null){p.updateQueue=null;var M=p.stateNode;M===null&&(M=p.stateNode=new uc),v.forEach(function(P){var D=Fx.bind(null,p,P);M.has(P)||(M.add(P),P.then(D,D))})}}function TM(p,v){for(ft=v;ft!==null;){v=ft;var M=v.deletions;if(M!==null)for(var P=0;P";case fc:return":has("+(al(p)||"")+")";case hc:return'[role="'+p.value+'"]';case Iu:return'"'+p.value+'"';case ba:return'[data-testname="'+p.value+'"]';default:throw Error(o(365))}}function gs(p,v){var M=[];p=[p,0];for(var P=0;PD&&(D=ie),P&=~z}if(P=D,P=Ir()-P,P=(120>P?120:480>P?480:1080>P?1080:1920>P?1920:3e3>P?3e3:4320>P?4320:1960*zv(P/1960))-P,10p?16:p,Do===null)var P=!1;else{if(p=Do,Do=null,yc=0,(un&6)!==0)throw Error(o(331));var D=un;for(un|=4,ft=p.current;ft!==null;){var z=ft,ie=z.child;if((ft.flags&16)!==0){var ye=z.deletions;if(ye!==null){for(var De=0;DeIr()-cf?Ma(p,0):gc|=M),Qi(p,v)}function Xv(p,v){v===0&&((p.mode&1)===0?v=1:(v=Nn,Nn<<=1,(Nn&130023424)===0&&(Nn=4194304)));var M=In();p=cl(p,v),p!==null&&(Wl(p,v,M),Qi(p,M))}function Ux(p){var v=p.memoizedState,M=0;v!==null&&(M=v.retryLane),Xv(p,M)}function Fx(p,v){var M=0;switch(p.tag){case 13:var P=p.stateNode,D=p.memoizedState;D!==null&&(M=D.retryLane);break;case 19:P=p.stateNode;break;default:throw Error(o(314))}P!==null&&P.delete(v),Xv(p,M)}var qv;qv=function(p,v,M){if(p!==null)if(p.memoizedProps!==v.pendingProps||rn.current)Br=!0;else{if((p.lanes&M)===0&&(v.flags&128)===0)return Br=!1,Fp(p,v,M);Br=(p.flags&131072)!==0}else Br=!1,Jn&&(v.flags&1048576)!==0&&Ex(v,xp,v.index);switch(v.lanes=0,v.tag){case 2:var P=v.type;p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),p=v.pendingProps;var D=ui(v,wn.current);mu(v,M),D=Mu(null,v,P,p,D,M);var z=rl();return v.flags|=1,typeof D=="object"&&D!==null&&typeof D.render=="function"&&D.$$typeof===void 0?(v.tag=1,v.memoizedState=null,v.updateQueue=null,Ln(P)?(z=!0,Ya(v)):z=!1,v.memoizedState=D.state!==null&&D.state!==void 0?D.state:null,gu(v),D.updater=vp,v.stateNode=D,D._reactInternals=v,pv(v,P,p,M),v=fi(null,v,P,!0,z,M)):(v.tag=0,Jn&&z&&mv(v),cr(null,v,D,M),v=v.child),v;case 16:P=v.elementType;e:{switch(p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),p=v.pendingProps,D=P._init,P=D(P._payload),v.type=P,D=v.tag=CM(P),p=qi(P,p),D){case 0:v=va(null,v,P,p,M);break e;case 1:v=ac(null,v,P,p,M);break e;case 11:v=qn(null,v,P,p,M);break e;case 14:v=$n(null,v,P,qi(P.type,p),M);break e}throw Error(o(306,P,""))}return v;case 0:return P=v.type,D=v.pendingProps,D=v.elementType===P?D:qi(P,D),va(p,v,P,D,M);case 1:return P=v.type,D=v.pendingProps,D=v.elementType===P?D:qi(P,D),ac(p,v,P,D,M);case 3:e:{if(Qd(v),p===null)throw Error(o(387));P=v.pendingProps,z=v.memoizedState,D=z.element,dv(p,v),gp(v,P,null,M);var ie=v.memoizedState;if(P=ie.element,Z&&z.isDehydrated)if(z={element:P,isDehydrated:!1,cache:ie.cache,transitions:ie.transitions},v.updateQueue.baseState=z,v.memoizedState=z,v.flags&256){D=Error(o(423)),v=Nv(p,v,P,M,D);break e}else if(P!==D){D=Error(o(424)),v=Nv(p,v,P,M,D);break e}else for(Z&&(Yr=oa(v.stateNode.containerInfo),Pi=v,Jn=!0,Fs=null,yu=!1),M=Cx(v,null,P,M),v.child=M;M;)M.flags=M.flags&-3|4096,M=M.sibling;else{if(xu(),P===D){v=Zi(p,v,M);break e}cr(p,v,P,M)}v=v.child}return v;case 5:return Px(v),p===null&&tl(v),P=v.type,D=v.pendingProps,z=p!==null?p.memoizedProps:null,ie=D.children,ce(P,D)?ie=null:z!==null&&ce(P,z)&&(v.flags|=32),Ri(p,v),cr(p,v,ie,M),v.child;case 6:return p===null&&tl(v),null;case 13:return Iv(p,v,M);case 4:return wp(v,v.stateNode.containerInfo),P=v.pendingProps,p===null?v.child=fa(v,null,P,M):cr(p,v,P,M),v.child;case 11:return P=v.type,D=v.pendingProps,D=v.elementType===P?D:qi(P,D),qn(p,v,P,D,M);case 7:return cr(p,v,v.pendingProps,M),v.child;case 8:return cr(p,v,v.pendingProps.children,M),v.child;case 12:return cr(p,v,v.pendingProps.children,M),v.child;case 10:e:{if(P=v.type._context,D=v.pendingProps,z=v.memoizedProps,ie=D.value,Kl(v,P,ie),z!==null)if(Ti(z.value,ie)){if(z.children===D.children&&!rn.current){v=Zi(p,v,M);break e}}else for(z=v.child,z!==null&&(z.return=v);z!==null;){var ye=z.dependencies;if(ye!==null){ie=z.child;for(var De=ye.firstContext;De!==null;){if(De.context===P){if(z.tag===1){De=ca(-1,M&-M),De.tag=2;var at=z.updateQueue;if(at!==null){at=at.shared;var Ct=at.pending;Ct===null?De.next=De:(De.next=Ct.next,Ct.next=De),at.pending=De}}z.lanes|=M,De=z.alternate,De!==null&&(De.lanes|=M),Yl(z.return,M,v),ye.lanes|=M;break}De=De.next}}else if(z.tag===10)ie=z.type===v.type?null:z.child;else if(z.tag===18){if(ie=z.return,ie===null)throw Error(o(341));ie.lanes|=M,ye=ie.alternate,ye!==null&&(ye.lanes|=M),Yl(ie,M,v),ie=z.sibling}else ie=z.child;if(ie!==null)ie.return=z;else for(ie=z;ie!==null;){if(ie===v){ie=null;break}if(z=ie.sibling,z!==null){z.return=ie.return,ie=z;break}ie=ie.return}z=ie}cr(p,v,D.children,M),v=v.child}return v;case 9:return D=v.type,P=v.pendingProps.children,mu(v,M),D=Ki(D),P=P(D),v.flags|=1,cr(p,v,P,M),v.child;case 14:return P=v.type,D=qi(P,v.pendingProps),D=qi(P.type,D),$n(p,v,P,D,M);case 15:return ga(p,v,v.type,v.pendingProps,M);case 17:return P=v.type,D=v.pendingProps,D=v.elementType===P?D:qi(P,D),p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),v.tag=1,Ln(P)?(p=!0,Ya(v)):p=!1,mu(v,M),Sx(v,P,D),pv(v,P,D,M),fi(null,v,P,!0,p,M);case 19:return cc(p,v,M);case 22:return Zr(p,v,M)}throw Error(o(156,v.tag))};function Wp(p,v){return $l(p,v)}function zx(p,v,M,P){this.tag=p,this.key=M,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=v,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=P,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xs(p,v,M,P){return new zx(p,v,M,P)}function $p(p){return p=p.prototype,!(!p||!p.isReactComponent)}function CM(p){if(typeof p=="function")return $p(p)?1:0;if(p!=null){if(p=p.$$typeof,p===S)return 11;if(p===E)return 14}return 2}function Ea(p,v){var M=p.alternate;return M===null?(M=xs(p.tag,v,p.key,p.mode),M.elementType=p.elementType,M.type=p.type,M.stateNode=p.stateNode,M.alternate=p,p.alternate=M):(M.pendingProps=v,M.type=p.type,M.flags=0,M.subtreeFlags=0,M.deletions=null),M.flags=p.flags&14680064,M.childLanes=p.childLanes,M.lanes=p.lanes,M.child=p.child,M.memoizedProps=p.memoizedProps,M.memoizedState=p.memoizedState,M.updateQueue=p.updateQueue,v=p.dependencies,M.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext},M.sibling=p.sibling,M.index=p.index,M.ref=p.ref,M}function Xp(p,v,M,P,D,z){var ie=2;if(P=p,typeof p=="function")$p(p)&&(ie=1);else if(typeof p=="string")ie=5;else e:switch(p){case d:return bc(M.children,D,z,v);case f:ie=8,D|=8;break;case m:return p=xs(12,M,v,D|2),p.elementType=m,p.lanes=z,p;case _:return p=xs(13,M,v,D),p.elementType=_,p.lanes=z,p;case w:return p=xs(19,M,v,D),p.elementType=w,p.lanes=z,p;case C:return mf(M,D,z,v);default:if(typeof p=="object"&&p!==null)switch(p.$$typeof){case y:ie=10;break e;case x:ie=9;break e;case S:ie=11;break e;case E:ie=14;break e;case T:ie=16,P=null;break e}throw Error(o(130,p==null?p:typeof p,""))}return v=xs(ie,M,v,D),v.elementType=p,v.type=P,v.lanes=z,v}function bc(p,v,M,P){return p=xs(7,p,P,v),p.lanes=M,p}function mf(p,v,M,P){return p=xs(22,p,P,v),p.elementType=C,p.lanes=M,p.stateNode={},p}function qp(p,v,M){return p=xs(6,p,null,v),p.lanes=M,p}function Kp(p,v,M){return v=xs(4,p.children!==null?p.children:[],p.key,v),v.lanes=M,v.stateNode={containerInfo:p.containerInfo,pendingChildren:null,implementation:p.implementation},v}function Yp(p,v,M,P,D){this.tag=v,this.containerInfo=p,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Se,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=op(0),this.expirationTimes=op(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=op(0),this.identifierPrefix=P,this.onRecoverableError=D,Z&&(this.mutableSourceEagerHydrationData=null)}function Bx(p,v,M,P,D,z,ie,ye,De){return p=new Yp(p,v,M,ye,De),v===1?(v=1,z===!0&&(v|=8)):v=0,z=xs(3,null,null,v),p.current=z,z.stateNode=p,z.memoizedState={element:P,isDehydrated:M,cache:null,transitions:null},gu(z),p}function Hx(p){if(!p)return vt;p=p._reactInternals;e:{if(G(p)!==p||p.tag!==1)throw Error(o(170));var v=p;do{switch(v.tag){case 3:v=v.stateNode.context;break e;case 1:if(Ln(v.type)){v=v.stateNode.__reactInternalMemoizedMergedChildContext;break e}}v=v.return}while(v!==null);throw Error(o(171))}if(p.tag===1){var M=p.type;if(Ln(M))return no(p,M,v)}return v}function Vx(p){var v=p._reactInternals;if(v===void 0)throw typeof p.render=="function"?Error(o(188)):(p=Object.keys(p).join(","),Error(o(268,p)));return p=H(v),p===null?null:p.stateNode}function Hs(p,v){if(p=p.memoizedState,p!==null&&p.dehydrated!==null){var M=p.retryLane;p.retryLane=M!==0&&M=at&&z>=on&&D<=Ct&&ie<=Wt){p.splice(v,1);break}else if(P!==at||M.width!==De.width||Wtie){if(!(z!==on||M.height!==De.height||CtD)){at>P&&(De.width+=at-P,De.x=P),Ctz&&(De.height+=on-z,De.y=z),WtM&&(M=ie)),ie ")+` +`+z.stack}return{value:m,source:v,stack:D}}function kp(m,v){try{console.error(v.value)}catch(E){setTimeout(function(){throw E})}}var CM=typeof WeakMap=="function"?WeakMap:Map;function kx(m,v,E){E=ca(-1,E),E.tag=3,E.payload={element:null};var R=v.value;return E.callback=function(){Ou||(Ou=!0,Zn=R),kp(m,v)},E}function Op(m,v,E){E=ca(-1,E),E.tag=3;var R=m.type.getDerivedStateFromError;if(typeof R=="function"){var D=v.value;E.payload=function(){return R(D)},E.callback=function(){kp(m,v)}}var z=m.stateNode;return z!==null&&typeof z.componentDidCatch=="function"&&(E.callback=function(){kp(m,v),typeof R!="function"&&(fo===null?fo=new Set([this]):fo.add(this));var re=v.stack;this.componentDidCatch(v.value,{componentStack:re!==null?re:""})}),E}function pa(m,v,E){var R=m.pingCache;if(R===null){R=m.pingCache=new CM;var D=new Set;R.set(v,D)}else D=R.get(v),D===void 0&&(D=new Set,R.set(v,D));D.has(E)||(D.add(E),m=$v.bind(null,m,v,E),v.then(m,m))}function Pv(m){do{var v;if((v=m.tag===13)&&(v=m.memoizedState,v=v!==null?v.dehydrated!==null:!0),v)return m;m=m.return}while(m!==null);return null}function sc(m,v,E,R,D){return(m.mode&1)===0?(m===v?m.flags|=65536:(m.flags|=128,E.flags|=131072,E.flags&=-52805,E.tag===1&&(E.alternate===null?E.tag=17:(v=ca(-1,1),v.tag=2,Ja(E,v))),E.lanes|=1),m):(m.flags|=65536,m.lanes=D,m)}function Lr(m){m.flags|=4}function Pu(m,v){if(m!==null&&m.child===v.child)return!0;if((v.flags&16)!==0)return!1;for(m=v.child;m!==null;){if((m.flags&12854)!==0||(m.subtreeFlags&12854)!==0)return!1;m=m.sibling}return!0}var ms,oc,Lp,Dp;if($e)ms=function(m,v){for(var E=v.child;E!==null;){if(E.tag===5||E.tag===6)q(m,E.stateNode);else if(E.tag!==4&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===v)break;for(;E.sibling===null;){if(E.return===null||E.return===v)return;E=E.return}E.sibling.return=E.return,E=E.sibling}},oc=function(){},Lp=function(m,v,E,R,D){if(m=m.memoizedProps,m!==R){var z=v.stateNode,re=oo(Yi.current);E=ae(z,E,m,R,D,re),(v.updateQueue=E)&&Lr(v)}},Dp=function(m,v,E,R){E!==R&&Lr(v)};else if(ue){ms=function(m,v,E,R){for(var D=v.child;D!==null;){if(D.tag===5){var z=D.stateNode;E&&R&&(z=Ht(z,D.type,D.memoizedProps,D)),q(m,z)}else if(D.tag===6)z=D.stateNode,E&&R&&(z=_n(z,D.memoizedProps,D)),q(m,z);else if(D.tag!==4){if(D.tag===22&&D.memoizedState!==null)z=D.child,z!==null&&(z.return=D),ms(m,D,!0,!0);else if(D.child!==null){D.child.return=D,D=D.child;continue}}if(D===v)break;for(;D.sibling===null;){if(D.return===null||D.return===v)return;D=D.return}D.sibling.return=D.return,D=D.sibling}};var sl=function(m,v,E,R){for(var D=v.child;D!==null;){if(D.tag===5){var z=D.stateNode;E&&R&&(z=Ht(z,D.type,D.memoizedProps,D)),We(m,z)}else if(D.tag===6)z=D.stateNode,E&&R&&(z=_n(z,D.memoizedProps,D)),We(m,z);else if(D.tag!==4){if(D.tag===22&&D.memoizedState!==null)z=D.child,z!==null&&(z.return=D),sl(m,D,!0,!0);else if(D.child!==null){D.child.return=D,D=D.child;continue}}if(D===v)break;for(;D.sibling===null;){if(D.return===null||D.return===v)return;D=D.return}D.sibling.return=D.return,D=D.sibling}};oc=function(m,v){var E=v.stateNode;if(!Pu(m,v)){m=E.containerInfo;var R=se(m);sl(R,v,!1,!1),E.pendingChildren=R,Lr(v),it(m,R)}},Lp=function(m,v,E,R,D){var z=m.stateNode,re=m.memoizedProps;if((m=Pu(m,v))&&re===R)v.stateNode=z;else{var ye=v.stateNode,De=oo(Yi.current),at=null;re!==R&&(at=ae(ye,E,re,R,D,De)),m&&at===null?v.stateNode=z:(z=mt(z,at,E,re,R,v,m,ye),he(z,E,R,D,De)&&Lr(v),v.stateNode=z,m?Lr(v):ms(z,v,!1,!1))}},Dp=function(m,v,E,R){E!==R?(m=oo(ec.current),E=oo(Yi.current),v.stateNode=we(R,m,E,v),Lr(v)):v.stateNode=m.stateNode}}else oc=function(){},Lp=function(){},Dp=function(){};function ma(m,v){if(!tr)switch(m.tailMode){case"hidden":v=m.tail;for(var E=null;v!==null;)v.alternate!==null&&(E=v),v=v.sibling;E===null?m.tail=null:E.sibling=null;break;case"collapsed":E=m.tail;for(var R=null;E!==null;)E.alternate!==null&&(R=E),E=E.sibling;R===null?v||m.tail===null?m.tail=null:m.tail.sibling=null:R.sibling=null}}function vr(m){var v=m.alternate!==null&&m.alternate.child===m.child,E=0,R=0;if(v)for(var D=m.child;D!==null;)E|=D.lanes|D.childLanes,R|=D.subtreeFlags&14680064,R|=D.flags&14680064,D.return=m,D=D.sibling;else for(D=m.child;D!==null;)E|=D.lanes|D.childLanes,R|=D.subtreeFlags,R|=D.flags,D.return=m,D=D.sibling;return m.subtreeFlags|=R,m.childLanes=E,v}function jp(m,v,E){var R=v.pendingProps;switch(gv(v),v.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vr(v),null;case 1:return Dn(v.type)&&Os(),vr(v),null;case 3:return R=v.stateNode,Su(),tn(sn),tn(Sn),tc(),R.pendingContext&&(R.context=R.pendingContext,R.pendingContext=null),(m===null||m.child===null)&&(Vd(v)?Lr(v):m===null||m.memoizedState.isDehydrated&&(v.flags&256)===0||(v.flags|=1024,zs!==null&&(ff(zs),zs=null))),oc(m,v),vr(v),null;case 5:xv(v),E=oo(ec.current);var D=v.type;if(m!==null&&v.stateNode!=null)Lp(m,v,D,R,E),m.ref!==v.ref&&(v.flags|=512,v.flags|=2097152);else{if(!R){if(v.stateNode===null)throw Error(o(166));return vr(v),null}if(m=oo(Yi.current),Vd(v)){if(!Z)throw Error(o(175));m=uu(v.stateNode,v.type,v.memoizedProps,E,m,v,!yu),v.updateQueue=m,m!==null&&Lr(v)}else{var z=V(D,R,E,m,v);ms(z,v,!1,!1),v.stateNode=z,he(z,D,R,E,m)&&Lr(v)}v.ref!==null&&(v.flags|=512,v.flags|=2097152)}return vr(v),null;case 6:if(m&&v.stateNode!=null)Dp(m,v,m.memoizedProps,R);else{if(typeof R!="string"&&v.stateNode===null)throw Error(o(166));if(m=oo(ec.current),E=oo(Yi.current),Vd(v)){if(!Z)throw Error(o(176));if(m=v.stateNode,R=v.memoizedProps,(E=No(m,R,v,!yu))&&(D=Ri,D!==null))switch(z=(D.mode&1)!==0,D.tag){case 3:ot(D.stateNode.containerInfo,m,R,z);break;case 5:_t(D.type,D.memoizedProps,D.stateNode,m,R,z)}E&&Lr(v)}else v.stateNode=we(R,m,E,v)}return vr(v),null;case 13:if(tn(sr),R=v.memoizedState,tr&&Zr!==null&&(v.mode&1)!==0&&(v.flags&128)===0){for(m=Zr;m;)m=Ti(m);return xu(),v.flags|=98560,v}if(R!==null&&R.dehydrated!==null){if(R=Vd(v),m===null){if(!R)throw Error(o(318));if(!Z)throw Error(o(344));if(m=v.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(o(317));du(m,v)}else xu(),(v.flags&128)===0&&(v.memoizedState=null),v.flags|=4;return vr(v),null}return zs!==null&&(ff(zs),zs=null),(v.flags&128)!==0?(v.lanes=E,v):(R=R!==null,E=!1,m===null?Vd(v):E=m.memoizedState!==null,R&&!E&&(v.child.flags|=8192,(v.mode&1)!==0&&(m===null||(sr.current&1)!==0?fr===0&&(fr=3):Gp())),v.updateQueue!==null&&(v.flags|=4),vr(v),null);case 4:return Su(),oc(m,v),m===null&&Oe(v.stateNode.containerInfo),vr(v),null;case 10:return Hd(v.type._context),vr(v),null;case 17:return Dn(v.type)&&Os(),vr(v),null;case 19:if(tn(sr),D=v.memoizedState,D===null)return vr(v),null;if(R=(v.flags&128)!==0,z=D.rendering,z===null)if(R)ma(D,!1);else{if(fr!==0||m!==null&&(m.flags&128)!==0)for(m=v.child;m!==null;){if(z=Sp(m),z!==null){for(v.flags|=128,ma(D,!1),m=z.updateQueue,m!==null&&(v.updateQueue=m,v.flags|=4),v.subtreeFlags=0,m=E,R=v.child;R!==null;)E=R,D=m,E.flags&=14680066,z=E.alternate,z===null?(E.childLanes=0,E.lanes=D,E.child=null,E.subtreeFlags=0,E.memoizedProps=null,E.memoizedState=null,E.updateQueue=null,E.dependencies=null,E.stateNode=null):(E.childLanes=z.childLanes,E.lanes=z.lanes,E.child=z.child,E.subtreeFlags=0,E.deletions=null,E.memoizedProps=z.memoizedProps,E.memoizedState=z.memoizedState,E.updateQueue=z.updateQueue,E.type=z.type,D=z.dependencies,E.dependencies=D===null?null:{lanes:D.lanes,firstContext:D.firstContext}),R=R.sibling;return Bt(sr,sr.current&1|2),v.child}m=m.sibling}D.tail!==null&&Or()>ll&&(v.flags|=128,R=!0,ma(D,!1),v.lanes=4194304)}else{if(!R)if(m=Sp(z),m!==null){if(v.flags|=128,R=!0,m=m.updateQueue,m!==null&&(v.updateQueue=m,v.flags|=4),ma(D,!0),D.tail===null&&D.tailMode==="hidden"&&!z.alternate&&!tr)return vr(v),null}else 2*Or()-D.renderingStartTime>ll&&E!==1073741824&&(v.flags|=128,R=!0,ma(D,!1),v.lanes=4194304);D.isBackwards?(z.sibling=v.child,v.child=z):(m=D.last,m!==null?m.sibling=z:v.child=z,D.last=z)}return D.tail!==null?(v=D.tail,D.rendering=v,D.tail=v.sibling,D.renderingStartTime=Or(),v.sibling=null,m=sr.current,Bt(sr,R?m&1|2:m&1),v):(vr(v),null);case 22:case 23:return hf(),R=v.memoizedState!==null,m!==null&&m.memoizedState!==null!==R&&(v.flags|=8192),R&&(v.mode&1)!==0?(mi&1073741824)!==0&&(vr(v),$e&&v.subtreeFlags&6&&(v.flags|=8192)):vr(v),null;case 24:return null;case 25:return null}throw Error(o(156,v.tag))}var Rv=a.ReactCurrentOwner,Hr=!1;function dr(m,v,E,R){v.child=m===null?Cx(v,null,E,R):fa(v,m.child,E,R)}function qn(m,v,E,R,D){E=E.render;var z=v.ref;return mu(v,D),R=Mu(m,v,E,R,z,D),E=rl(),m!==null&&!Hr?(v.updateQueue=m.updateQueue,v.flags&=-2053,m.lanes&=~D,Zi(m,v,D)):(tr&&E&&mv(v),v.flags|=1,dr(m,v,R,D),v.child)}function $n(m,v,E,R,D){if(m===null){var z=E.type;return typeof z=="function"&&!$p(z)&&z.defaultProps===void 0&&E.compare===null&&E.defaultProps===void 0?(v.tag=15,v.type=z,ga(m,v,z,R,D)):(m=Xp(E.type,null,R,v,v.mode,D),m.ref=v.ref,m.return=v,v.child=m)}if(z=m.child,(m.lanes&D)===0){var re=z.memoizedProps;if(E=E.compare,E=E!==null?E:so,E(re,R)&&m.ref===v.ref)return Zi(m,v,D)}return v.flags|=1,m=Ea(z,R),m.ref=v.ref,m.return=v,v.child=m}function ga(m,v,E,R,D){if(m!==null&&so(m.memoizedProps,R)&&m.ref===v.ref)if(Hr=!1,(m.lanes&D)!==0)(m.flags&131072)!==0&&(Hr=!0);else return v.lanes=m.lanes,Zi(m,v,D);return va(m,v,E,R,D)}function Qr(m,v,E){var R=v.pendingProps,D=R.children,z=m!==null?m.memoizedState:null;if(R.mode==="hidden")if((v.mode&1)===0)v.memoizedState={baseLanes:0,cachePool:null},Bt(mc,mi),mi|=E;else if((E&1073741824)!==0)v.memoizedState={baseLanes:0,cachePool:null},R=z!==null?z.baseLanes:E,Bt(mc,mi),mi|=R;else return m=z!==null?z.baseLanes|E:E,v.lanes=v.childLanes=1073741824,v.memoizedState={baseLanes:m,cachePool:null},v.updateQueue=null,Bt(mc,mi),mi|=m,null;else z!==null?(R=z.baseLanes|E,v.memoizedState=null):R=E,Bt(mc,mi),mi|=R;return dr(m,v,D,E),v.child}function Ni(m,v){var E=v.ref;(m===null&&E!==null||m!==null&&m.ref!==E)&&(v.flags|=512,v.flags|=2097152)}function va(m,v,E,R,D){var z=Dn(E)?kr:Sn.current;return z=fi(v,z),mu(v,D),E=Mu(m,v,E,R,z,D),R=rl(),m!==null&&!Hr?(v.updateQueue=m.updateQueue,v.flags&=-2053,m.lanes&=~D,Zi(m,v,D)):(tr&&R&&mv(v),v.flags|=1,dr(m,v,E,D),v.child)}function ac(m,v,E,R,D){if(Dn(E)){var z=!0;Ya(v)}else z=!1;if(mu(v,D),v.stateNode===null)m!==null&&(m.alternate=null,v.alternate=null,v.flags|=2),Sx(v,E,R),pv(v,E,R,D),R=!0;else if(m===null){var re=v.stateNode,ye=v.memoizedProps;re.props=ye;var De=re.context,at=E.contextType;typeof at=="object"&&at!==null?at=Ki(at):(at=Dn(E)?kr:Sn.current,at=fi(v,at));var Ct=E.getDerivedStateFromProps,an=typeof Ct=="function"||typeof re.getSnapshotBeforeUpdate=="function";an||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ye!==R||De!==at)&&Mx(v,re,R,at),Us=!1;var $t=v.memoizedState;re.state=$t,gp(v,R,re,D),De=v.memoizedState,ye!==R||$t!==De||sn.current||Us?(typeof Ct=="function"&&(fv(v,E,Ct,R),De=v.memoizedState),(ye=Us||hv(v,E,ye,R,$t,De,at))?(an||typeof re.UNSAFE_componentWillMount!="function"&&typeof re.componentWillMount!="function"||(typeof re.componentWillMount=="function"&&re.componentWillMount(),typeof re.UNSAFE_componentWillMount=="function"&&re.UNSAFE_componentWillMount()),typeof re.componentDidMount=="function"&&(v.flags|=4194308)):(typeof re.componentDidMount=="function"&&(v.flags|=4194308),v.memoizedProps=R,v.memoizedState=De),re.props=R,re.state=De,re.context=at,R=ye):(typeof re.componentDidMount=="function"&&(v.flags|=4194308),R=!1)}else{re=v.stateNode,dv(m,v),ye=v.memoizedProps,at=v.type===v.elementType?ye:qi(v.type,ye),re.props=at,an=v.pendingProps,$t=re.context,De=E.contextType,typeof De=="object"&&De!==null?De=Ki(De):(De=Dn(E)?kr:Sn.current,De=fi(v,De));var dn=E.getDerivedStateFromProps;(Ct=typeof dn=="function"||typeof re.getSnapshotBeforeUpdate=="function")||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ye!==an||$t!==De)&&Mx(v,re,R,De),Us=!1,$t=v.memoizedState,re.state=$t,gp(v,R,re,D);var Et=v.memoizedState;ye!==an||$t!==Et||sn.current||Us?(typeof dn=="function"&&(fv(v,E,dn,R),Et=v.memoizedState),(at=Us||hv(v,E,at,R,$t,Et,De)||!1)?(Ct||typeof re.UNSAFE_componentWillUpdate!="function"&&typeof re.componentWillUpdate!="function"||(typeof re.componentWillUpdate=="function"&&re.componentWillUpdate(R,Et,De),typeof re.UNSAFE_componentWillUpdate=="function"&&re.UNSAFE_componentWillUpdate(R,Et,De)),typeof re.componentDidUpdate=="function"&&(v.flags|=4),typeof re.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof re.componentDidUpdate!="function"||ye===m.memoizedProps&&$t===m.memoizedState||(v.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||ye===m.memoizedProps&&$t===m.memoizedState||(v.flags|=1024),v.memoizedProps=R,v.memoizedState=Et),re.props=R,re.state=Et,re.context=De,R=at):(typeof re.componentDidUpdate!="function"||ye===m.memoizedProps&&$t===m.memoizedState||(v.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||ye===m.memoizedProps&&$t===m.memoizedState||(v.flags|=1024),R=!1)}return pi(m,v,E,R,z,D)}function pi(m,v,E,R,D,z){Ni(m,v);var re=(v.flags&128)!==0;if(!R&&!re)return D&&Yr(v,E,!1),Zi(m,v,z);R=v.stateNode,Rv.current=v;var ye=re&&typeof E.getDerivedStateFromError!="function"?null:R.render();return v.flags|=1,m!==null&&re?(v.child=fa(v,m.child,null,z),v.child=fa(v,null,ye,z)):dr(m,v,ye,z),v.memoizedState=R.state,D&&Yr(v,E,!0),v.child}function Jd(m){var v=m.stateNode;v.pendingContext?Wn(m,v.pendingContext,v.pendingContext!==v.context):v.context&&Wn(m,v.context,!1),wp(m,v.containerInfo)}function Nv(m,v,E,R,D){return xu(),_p(D),v.flags|=256,dr(m,v,E,R),v.child}var ef={dehydrated:null,treeContext:null,retryLane:0};function lc(m){return{baseLanes:m,cachePool:null}}function Iv(m,v,E){var R=v.pendingProps,D=sr.current,z=!1,re=(v.flags&128)!==0,ye;if((ye=re)||(ye=m!==null&&m.memoizedState===null?!1:(D&2)!==0),ye?(z=!0,v.flags&=-129):(m===null||m.memoizedState!==null)&&(D|=1),Bt(sr,D&1),m===null)return tl(v),m=v.memoizedState,m!==null&&(m=m.dehydrated,m!==null)?((v.mode&1)===0?v.lanes=1:Xi(m)?v.lanes=8:v.lanes=1073741824,null):(D=R.children,m=R.fallback,z?(R=v.mode,z=v.child,D={mode:"hidden",children:D},(R&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=D):z=gf(D,R,0,null),m=bc(m,R,E,null),z.return=v,m.return=v,z.sibling=m,v.child=z,v.child.memoizedState=lc(E),v.memoizedState=ef,m):co(v,D));if(D=m.memoizedState,D!==null){if(ye=D.dehydrated,ye!==null){if(re)return v.flags&256?(v.flags&=-257,nf(m,v,E,Error(o(422)))):v.memoizedState!==null?(v.child=m.child,v.flags|=128,null):(z=R.fallback,D=v.mode,R=gf({mode:"visible",children:R.children},D,0,null),z=bc(z,D,E,null),z.flags|=2,R.return=v,z.return=v,R.sibling=z,v.child=R,(v.mode&1)!==0&&fa(v,m.child,null,E),v.child.memoizedState=lc(E),v.memoizedState=ef,z);if((v.mode&1)===0)v=nf(m,v,E,null);else if(Xi(ye))v=nf(m,v,E,Error(o(419)));else if(R=(E&m.childLanes)!==0,Hr||R){if(R=yr,R!==null){switch(E&-E){case 4:z=2;break;case 16:z=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:z=32;break;case 536870912:z=268435456;break;default:z=0}R=(z&(R.suspendedLanes|E))!==0?0:z,R!==0&&R!==D.retryLane&&(D.retryLane=R,gi(m,R,-1))}Gp(),v=nf(m,v,E,Error(o(421)))}else ro(ye)?(v.flags|=128,v.child=m.child,v=Ux.bind(null,m),ks(ye,v),v=null):(E=D.treeContext,Z&&(Zr=cu(ye),Ri=v,tr=!0,zs=null,yu=!1,E!==null&&(Fs[fs++]=ua,Fs[fs++]=da,Fs[fs++]=Zl,ua=E.id,da=E.overflow,Zl=v)),v=co(v,v.pendingProps.children),v.flags|=4096);return v}return z?(R=Up(m,v,R.children,R.fallback,E),z=v.child,D=m.child.memoizedState,z.memoizedState=D===null?lc(E):{baseLanes:D.baseLanes|E,cachePool:null},z.childLanes=m.childLanes&~E,v.memoizedState=ef,R):(E=tf(m,v,R.children,E),v.memoizedState=null,E)}return z?(R=Up(m,v,R.children,R.fallback,E),z=v.child,D=m.child.memoizedState,z.memoizedState=D===null?lc(E):{baseLanes:D.baseLanes|E,cachePool:null},z.childLanes=m.childLanes&~E,v.memoizedState=ef,R):(E=tf(m,v,R.children,E),v.memoizedState=null,E)}function co(m,v){return v=gf({mode:"visible",children:v},m.mode,0,null),v.return=m,m.child=v}function tf(m,v,E,R){var D=m.child;return m=D.sibling,E=Ea(D,{mode:"visible",children:E}),(v.mode&1)===0&&(E.lanes=R),E.return=v,E.sibling=null,m!==null&&(R=v.deletions,R===null?(v.deletions=[m],v.flags|=16):R.push(m)),v.child=E}function Up(m,v,E,R,D){var z=v.mode;m=m.child;var re=m.sibling,ye={mode:"hidden",children:E};return(z&1)===0&&v.child!==m?(E=v.child,E.childLanes=0,E.pendingProps=ye,v.deletions=null):(E=Ea(m,ye),E.subtreeFlags=m.subtreeFlags&14680064),re!==null?R=Ea(re,R):(R=bc(R,z,D,null),R.flags|=2),R.return=v,E.return=v,E.sibling=R,v.child=E,R}function nf(m,v,E,R){return R!==null&&_p(R),fa(v,m.child,null,E),m=co(v,v.pendingProps.children),m.flags|=2,v.memoizedState=null,m}function Ox(m,v,E){m.lanes|=v;var R=m.alternate;R!==null&&(R.lanes|=v),Yl(m.return,v,E)}function Do(m,v,E,R,D){var z=m.memoizedState;z===null?m.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:R,tail:E,tailMode:D}:(z.isBackwards=v,z.rendering=null,z.renderingStartTime=0,z.last=R,z.tail=E,z.tailMode=D)}function cc(m,v,E){var R=v.pendingProps,D=R.revealOrder,z=R.tail;if(dr(m,v,R.children,E),R=sr.current,(R&2)!==0)R=R&1|2,v.flags|=128;else{if(m!==null&&(m.flags&128)!==0)e:for(m=v.child;m!==null;){if(m.tag===13)m.memoizedState!==null&&Ox(m,E,v);else if(m.tag===19)Ox(m,E,v);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===v)break e;for(;m.sibling===null;){if(m.return===null||m.return===v)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}R&=1}if(Bt(sr,R),(v.mode&1)===0)v.memoizedState=null;else switch(D){case"forwards":for(E=v.child,D=null;E!==null;)m=E.alternate,m!==null&&Sp(m)===null&&(D=E),E=E.sibling;E=D,E===null?(D=v.child,v.child=null):(D=E.sibling,E.sibling=null),Do(v,!1,D,E,z);break;case"backwards":for(E=null,D=v.child,v.child=null;D!==null;){if(m=D.alternate,m!==null&&Sp(m)===null){v.child=D;break}m=D.sibling,D.sibling=E,E=D,D=m}Do(v,!0,E,null,z);break;case"together":Do(v,!1,null,null,void 0);break;default:v.memoizedState=null}return v.child}function Zi(m,v,E){if(m!==null&&(v.dependencies=m.dependencies),jo|=v.lanes,(E&v.childLanes)===0)return null;if(m!==null&&v.child!==m.child)throw Error(o(153));if(v.child!==null){for(m=v.child,E=Ea(m,m.pendingProps),v.child=E,E.return=v;m.sibling!==null;)m=m.sibling,E=E.sibling=Ea(m,m.pendingProps),E.return=v;E.sibling=null}return v.child}function Fp(m,v,E){switch(v.tag){case 3:Jd(v),xu();break;case 5:Px(v);break;case 1:Dn(v.type)&&Ya(v);break;case 4:wp(v,v.stateNode.containerInfo);break;case 10:Kl(v,v.type._context,v.memoizedProps.value);break;case 13:var R=v.memoizedState;if(R!==null)return R.dehydrated!==null?(Bt(sr,sr.current&1),v.flags|=128,null):(E&v.child.childLanes)!==0?Iv(m,v,E):(Bt(sr,sr.current&1),m=Zi(m,v,E),m!==null?m.sibling:null);Bt(sr,sr.current&1);break;case 19:if(R=(E&v.childLanes)!==0,(m.flags&128)!==0){if(R)return cc(m,v,E);v.flags|=128}var D=v.memoizedState;if(D!==null&&(D.rendering=null,D.tail=null,D.lastEffect=null),Bt(sr,sr.current),R)break;return null;case 22:case 23:return v.lanes=0,Qr(m,v,E)}return Zi(m,v,E)}function zp(m,v){switch(gv(v),v.tag){case 1:return Dn(v.type)&&Os(),m=v.flags,m&65536?(v.flags=m&-65537|128,v):null;case 3:return Su(),tn(sn),tn(Sn),tc(),m=v.flags,(m&65536)!==0&&(m&128)===0?(v.flags=m&-65537|128,v):null;case 5:return xv(v),null;case 13:if(tn(sr),m=v.memoizedState,m!==null&&m.dehydrated!==null){if(v.alternate===null)throw Error(o(340));xu()}return m=v.flags,m&65536?(v.flags=m&-65537|128,v):null;case 19:return tn(sr),null;case 4:return Su(),null;case 10:return Hd(v.type._context),null;case 22:case 23:return hf(),null;case 24:return null;default:return null}}var Ii=!1,Vr=!1,uc=typeof WeakSet=="function"?WeakSet:Set,ht=null;function Bs(m,v){var E=m.ref;if(E!==null)if(typeof E=="function")try{E(null)}catch(R){Oi(m,v,R)}else E.current=null}function ya(m,v,E){try{E()}catch(R){Oi(m,v,R)}}var kv=!1;function Ov(m,v){for(Q(m.containerInfo),ht=v;ht!==null;)if(m=ht,v=m.child,(m.subtreeFlags&1028)!==0&&v!==null)v.return=m,ht=v;else for(;ht!==null;){m=ht;try{var E=m.alternate;if((m.flags&1024)!==0)switch(m.tag){case 0:case 11:case 15:break;case 1:if(E!==null){var R=E.memoizedProps,D=E.memoizedState,z=m.stateNode,re=z.getSnapshotBeforeUpdate(m.elementType===m.type?R:qi(m.type,R),D);z.__reactInternalSnapshotBeforeUpdate=re}break;case 3:$e&&st(m.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ye){Oi(m,m.return,ye)}if(v=m.sibling,v!==null){v.return=m.return,ht=v;break}ht=m.return}return E=kv,kv=!1,E}function xa(m,v,E){var R=v.updateQueue;if(R=R!==null?R.lastEffect:null,R!==null){var D=R=R.next;do{if((D.tag&m)===m){var z=D.destroy;D.destroy=void 0,z!==void 0&&ya(v,E,z)}D=D.next}while(D!==R)}}function Jr(m,v){if(v=v.updateQueue,v=v!==null?v.lastEffect:null,v!==null){var E=v=v.next;do{if((E.tag&m)===m){var R=E.create;E.destroy=R()}E=E.next}while(E!==v)}}function ki(m){var v=m.ref;if(v!==null){var E=m.stateNode;switch(m.tag){case 5:m=ie(E);break;default:m=E}typeof v=="function"?v(m):v.current=m}}function Yn(m,v,E){if(ko&&typeof ko.onCommitFiberUnmount=="function")try{ko.onCommitFiberUnmount(Ud,v)}catch{}switch(v.tag){case 0:case 11:case 14:case 15:if(m=v.updateQueue,m!==null&&(m=m.lastEffect,m!==null)){var R=m=m.next;do{var D=R,z=D.destroy;D=D.tag,z!==void 0&&((D&2)!==0||(D&4)!==0)&&ya(v,E,z),R=R.next}while(R!==m)}break;case 1:if(Bs(v,E),m=v.stateNode,typeof m.componentWillUnmount=="function")try{m.props=v.memoizedProps,m.state=v.memoizedState,m.componentWillUnmount()}catch(re){Oi(v,E,re)}break;case 5:Bs(v,E);break;case 4:$e?jv(m,v,E):ue&&ue&&(v=v.stateNode.containerInfo,E=se(v),dt(v,E))}}function Hs(m,v,E){for(var R=v;;)if(Yn(m,R,E),R.child===null||$e&&R.tag===4){if(R===v)break;for(;R.sibling===null;){if(R.return===null||R.return===v)return;R=R.return}R.sibling.return=R.return,R=R.sibling}else R.child.return=R,R=R.child}function Lv(m){var v=m.alternate;v!==null&&(m.alternate=null,Lv(v)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(v=m.stateNode,v!==null&&et(v)),m.stateNode=null,m.return=null,m.dependencies=null,m.memoizedProps=null,m.memoizedState=null,m.pendingProps=null,m.stateNode=null,m.updateQueue=null}function Dv(m){return m.tag===5||m.tag===3||m.tag===4}function Bp(m){e:for(;;){for(;m.sibling===null;){if(m.return===null||Dv(m.return))return null;m=m.return}for(m.sibling.return=m.return,m=m.sibling;m.tag!==5&&m.tag!==6&&m.tag!==18;){if(m.flags&2||m.child===null||m.tag===4)continue e;m.child.return=m,m=m.child}if(!(m.flags&2))return m.stateNode}}function Hp(m){if($e){e:{for(var v=m.return;v!==null;){if(Dv(v))break e;v=v.return}throw Error(o(160))}var E=v;switch(E.tag){case 5:v=E.stateNode,E.flags&32&&(qe(v),E.flags&=-33),E=Bp(m),Ru(m,E,v);break;case 3:case 4:v=E.stateNode.containerInfo,E=Bp(m),Vp(m,E,v);break;default:throw Error(o(161))}}}function Vp(m,v,E){var R=m.tag;if(R===5||R===6)m=m.stateNode,v?yt(E,m,v):Wt(E,m);else if(R!==4&&(m=m.child,m!==null))for(Vp(m,v,E),m=m.sibling;m!==null;)Vp(m,v,E),m=m.sibling}function Ru(m,v,E){var R=m.tag;if(R===5||R===6)m=m.stateNode,v?Mt(E,m,v):pt(E,m);else if(R!==4&&(m=m.child,m!==null))for(Ru(m,v,E),m=m.sibling;m!==null;)Ru(m,v,E),m=m.sibling}function jv(m,v,E){for(var R=v,D=!1,z,re;;){if(!D){D=R.return;e:for(;;){if(D===null)throw Error(o(160));switch(z=D.stateNode,D.tag){case 5:re=!1;break e;case 3:z=z.containerInfo,re=!0;break e;case 4:z=z.containerInfo,re=!0;break e}D=D.return}D=!0}if(R.tag===5||R.tag===6)Hs(m,R,E),re?de(z,R.stateNode):Jt(z,R.stateNode);else if(R.tag===18)re?Ne(z,R.stateNode):Ce(z,R.stateNode);else if(R.tag===4){if(R.child!==null){z=R.stateNode.containerInfo,re=!0,R.child.return=R,R=R.child;continue}}else if(Yn(m,R,E),R.child!==null){R.child.return=R,R=R.child;continue}if(R===v)break;for(;R.sibling===null;){if(R.return===null||R.return===v)return;R=R.return,R.tag===4&&(D=!1)}R.sibling.return=R.return,R=R.sibling}}function ol(m,v){if($e){switch(v.tag){case 0:case 11:case 14:case 15:xa(3,v,v.return),Jr(3,v),xa(5,v,v.return);return;case 1:return;case 5:var E=v.stateNode;if(E!=null){var R=v.memoizedProps;m=m!==null?m.memoizedProps:R;var D=v.type,z=v.updateQueue;v.updateQueue=null,z!==null&&Qe(E,z,D,m,R,v)}return;case 6:if(v.stateNode===null)throw Error(o(162));E=v.memoizedProps,Ke(v.stateNode,m!==null?m.memoizedProps:E,E);return;case 3:Z&&m!==null&&m.memoizedState.isDehydrated&&Y(v.stateNode.containerInfo);return;case 12:return;case 13:Nu(v);return;case 19:Nu(v);return;case 17:return}throw Error(o(163))}switch(v.tag){case 0:case 11:case 14:case 15:xa(3,v,v.return),Jr(3,v),xa(5,v,v.return);return;case 12:return;case 13:Nu(v);return;case 19:Nu(v);return;case 3:Z&&m!==null&&m.memoizedState.isDehydrated&&Y(v.stateNode.containerInfo);break;case 22:case 23:return}e:if(ue){switch(v.tag){case 1:case 5:case 6:break e;case 3:case 4:v=v.stateNode,dt(v.containerInfo,v.pendingChildren);break e}throw Error(o(163))}}function Nu(m){var v=m.updateQueue;if(v!==null){m.updateQueue=null;var E=m.stateNode;E===null&&(E=m.stateNode=new uc),v.forEach(function(R){var D=Fx.bind(null,m,R);E.has(R)||(E.add(R),R.then(D,D))})}}function PM(m,v){for(ht=v;ht!==null;){v=ht;var E=v.deletions;if(E!==null)for(var R=0;R";case fc:return":has("+(al(m)||"")+")";case hc:return'[role="'+m.value+'"]';case Iu:return'"'+m.value+'"';case ba:return'[data-testname="'+m.value+'"]';default:throw Error(o(365))}}function gs(m,v){var E=[];m=[m,0];for(var R=0;RD&&(D=re),R&=~z}if(R=D,R=Or()-R,R=(120>R?120:480>R?480:1080>R?1080:1920>R?1920:3e3>R?3e3:4320>R?4320:1960*zv(R/1960))-R,10m?16:m,Uo===null)var R=!1;else{if(m=Uo,Uo=null,yc=0,(un&6)!==0)throw Error(o(331));var D=un;for(un|=4,ht=m.current;ht!==null;){var z=ht,re=z.child;if((ht.flags&16)!==0){var ye=z.deletions;if(ye!==null){for(var De=0;DeOr()-uf?Ma(m,0):gc|=E),Qi(m,v)}function Xv(m,v){v===0&&((m.mode&1)===0?v=1:(v=In,In<<=1,(In&130023424)===0&&(In=4194304)));var E=kn();m=cl(m,v),m!==null&&(Wl(m,v,E),Qi(m,E))}function Ux(m){var v=m.memoizedState,E=0;v!==null&&(E=v.retryLane),Xv(m,E)}function Fx(m,v){var E=0;switch(m.tag){case 13:var R=m.stateNode,D=m.memoizedState;D!==null&&(E=D.retryLane);break;case 19:R=m.stateNode;break;default:throw Error(o(314))}R!==null&&R.delete(v),Xv(m,E)}var qv;qv=function(m,v,E){if(m!==null)if(m.memoizedProps!==v.pendingProps||sn.current)Hr=!0;else{if((m.lanes&E)===0&&(v.flags&128)===0)return Hr=!1,Fp(m,v,E);Hr=(m.flags&131072)!==0}else Hr=!1,tr&&(v.flags&1048576)!==0&&Ex(v,xp,v.index);switch(v.lanes=0,v.tag){case 2:var R=v.type;m!==null&&(m.alternate=null,v.alternate=null,v.flags|=2),m=v.pendingProps;var D=fi(v,Sn.current);mu(v,E),D=Mu(null,v,R,m,D,E);var z=rl();return v.flags|=1,typeof D=="object"&&D!==null&&typeof D.render=="function"&&D.$$typeof===void 0?(v.tag=1,v.memoizedState=null,v.updateQueue=null,Dn(R)?(z=!0,Ya(v)):z=!1,v.memoizedState=D.state!==null&&D.state!==void 0?D.state:null,gu(v),D.updater=vp,v.stateNode=D,D._reactInternals=v,pv(v,R,m,E),v=pi(null,v,R,!0,z,E)):(v.tag=0,tr&&z&&mv(v),dr(null,v,D,E),v=v.child),v;case 16:R=v.elementType;e:{switch(m!==null&&(m.alternate=null,v.alternate=null,v.flags|=2),m=v.pendingProps,D=R._init,R=D(R._payload),v.type=R,D=v.tag=RM(R),m=qi(R,m),D){case 0:v=va(null,v,R,m,E);break e;case 1:v=ac(null,v,R,m,E);break e;case 11:v=qn(null,v,R,m,E);break e;case 14:v=$n(null,v,R,qi(R.type,m),E);break e}throw Error(o(306,R,""))}return v;case 0:return R=v.type,D=v.pendingProps,D=v.elementType===R?D:qi(R,D),va(m,v,R,D,E);case 1:return R=v.type,D=v.pendingProps,D=v.elementType===R?D:qi(R,D),ac(m,v,R,D,E);case 3:e:{if(Jd(v),m===null)throw Error(o(387));R=v.pendingProps,z=v.memoizedState,D=z.element,dv(m,v),gp(v,R,null,E);var re=v.memoizedState;if(R=re.element,Z&&z.isDehydrated)if(z={element:R,isDehydrated:!1,cache:re.cache,transitions:re.transitions},v.updateQueue.baseState=z,v.memoizedState=z,v.flags&256){D=Error(o(423)),v=Nv(m,v,R,E,D);break e}else if(R!==D){D=Error(o(424)),v=Nv(m,v,R,E,D);break e}else for(Z&&(Zr=oa(v.stateNode.containerInfo),Ri=v,tr=!0,zs=null,yu=!1),E=Cx(v,null,R,E),v.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(xu(),R===D){v=Zi(m,v,E);break e}dr(m,v,R,E)}v=v.child}return v;case 5:return Px(v),m===null&&tl(v),R=v.type,D=v.pendingProps,z=m!==null?m.memoizedProps:null,re=D.children,ce(R,D)?re=null:z!==null&&ce(R,z)&&(v.flags|=32),Ni(m,v),dr(m,v,re,E),v.child;case 6:return m===null&&tl(v),null;case 13:return Iv(m,v,E);case 4:return wp(v,v.stateNode.containerInfo),R=v.pendingProps,m===null?v.child=fa(v,null,R,E):dr(m,v,R,E),v.child;case 11:return R=v.type,D=v.pendingProps,D=v.elementType===R?D:qi(R,D),qn(m,v,R,D,E);case 7:return dr(m,v,v.pendingProps,E),v.child;case 8:return dr(m,v,v.pendingProps.children,E),v.child;case 12:return dr(m,v,v.pendingProps.children,E),v.child;case 10:e:{if(R=v.type._context,D=v.pendingProps,z=v.memoizedProps,re=D.value,Kl(v,R,re),z!==null)if(Ci(z.value,re)){if(z.children===D.children&&!sn.current){v=Zi(m,v,E);break e}}else for(z=v.child,z!==null&&(z.return=v);z!==null;){var ye=z.dependencies;if(ye!==null){re=z.child;for(var De=ye.firstContext;De!==null;){if(De.context===R){if(z.tag===1){De=ca(-1,E&-E),De.tag=2;var at=z.updateQueue;if(at!==null){at=at.shared;var Ct=at.pending;Ct===null?De.next=De:(De.next=Ct.next,Ct.next=De),at.pending=De}}z.lanes|=E,De=z.alternate,De!==null&&(De.lanes|=E),Yl(z.return,E,v),ye.lanes|=E;break}De=De.next}}else if(z.tag===10)re=z.type===v.type?null:z.child;else if(z.tag===18){if(re=z.return,re===null)throw Error(o(341));re.lanes|=E,ye=re.alternate,ye!==null&&(ye.lanes|=E),Yl(re,E,v),re=z.sibling}else re=z.child;if(re!==null)re.return=z;else for(re=z;re!==null;){if(re===v){re=null;break}if(z=re.sibling,z!==null){z.return=re.return,re=z;break}re=re.return}z=re}dr(m,v,D.children,E),v=v.child}return v;case 9:return D=v.type,R=v.pendingProps.children,mu(v,E),D=Ki(D),R=R(D),v.flags|=1,dr(m,v,R,E),v.child;case 14:return R=v.type,D=qi(R,v.pendingProps),D=qi(R.type,D),$n(m,v,R,D,E);case 15:return ga(m,v,v.type,v.pendingProps,E);case 17:return R=v.type,D=v.pendingProps,D=v.elementType===R?D:qi(R,D),m!==null&&(m.alternate=null,v.alternate=null,v.flags|=2),v.tag=1,Dn(R)?(m=!0,Ya(v)):m=!1,mu(v,E),Sx(v,R,D),pv(v,R,D,E),pi(null,v,R,!0,m,E);case 19:return cc(m,v,E);case 22:return Qr(m,v,E)}throw Error(o(156,v.tag))};function Wp(m,v){return $l(m,v)}function zx(m,v,E,R){this.tag=m,this.key=E,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=v,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=R,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xs(m,v,E,R){return new zx(m,v,E,R)}function $p(m){return m=m.prototype,!(!m||!m.isReactComponent)}function RM(m){if(typeof m=="function")return $p(m)?1:0;if(m!=null){if(m=m.$$typeof,m===S)return 11;if(m===M)return 14}return 2}function Ea(m,v){var E=m.alternate;return E===null?(E=xs(m.tag,v,m.key,m.mode),E.elementType=m.elementType,E.type=m.type,E.stateNode=m.stateNode,E.alternate=m,m.alternate=E):(E.pendingProps=v,E.type=m.type,E.flags=0,E.subtreeFlags=0,E.deletions=null),E.flags=m.flags&14680064,E.childLanes=m.childLanes,E.lanes=m.lanes,E.child=m.child,E.memoizedProps=m.memoizedProps,E.memoizedState=m.memoizedState,E.updateQueue=m.updateQueue,v=m.dependencies,E.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext},E.sibling=m.sibling,E.index=m.index,E.ref=m.ref,E}function Xp(m,v,E,R,D,z){var re=2;if(R=m,typeof m=="function")$p(m)&&(re=1);else if(typeof m=="string")re=5;else e:switch(m){case d:return bc(E.children,D,z,v);case f:re=8,D|=8;break;case g:return m=xs(12,E,v,D|2),m.elementType=g,m.lanes=z,m;case w:return m=xs(13,E,v,D),m.elementType=w,m.lanes=z,m;case b:return m=xs(19,E,v,D),m.elementType=b,m.lanes=z,m;case C:return gf(E,D,z,v);default:if(typeof m=="object"&&m!==null)switch(m.$$typeof){case y:re=10;break e;case x:re=9;break e;case S:re=11;break e;case M:re=14;break e;case T:re=16,R=null;break e}throw Error(o(130,m==null?m:typeof m,""))}return v=xs(re,E,v,D),v.elementType=m,v.type=R,v.lanes=z,v}function bc(m,v,E,R){return m=xs(7,m,R,v),m.lanes=E,m}function gf(m,v,E,R){return m=xs(22,m,R,v),m.elementType=C,m.lanes=E,m.stateNode={},m}function qp(m,v,E){return m=xs(6,m,null,v),m.lanes=E,m}function Kp(m,v,E){return v=xs(4,m.children!==null?m.children:[],m.key,v),v.lanes=E,v.stateNode={containerInfo:m.containerInfo,pendingChildren:null,implementation:m.implementation},v}function Yp(m,v,E,R,D){this.tag=v,this.containerInfo=m,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Se,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=op(0),this.expirationTimes=op(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=op(0),this.identifierPrefix=R,this.onRecoverableError=D,Z&&(this.mutableSourceEagerHydrationData=null)}function Bx(m,v,E,R,D,z,re,ye,De){return m=new Yp(m,v,E,ye,De),v===1?(v=1,z===!0&&(v|=8)):v=0,z=xs(3,null,null,v),m.current=z,z.stateNode=m,z.memoizedState={element:R,isDehydrated:E,cache:null,transitions:null},gu(z),m}function Hx(m){if(!m)return xt;m=m._reactInternals;e:{if(G(m)!==m||m.tag!==1)throw Error(o(170));var v=m;do{switch(v.tag){case 3:v=v.stateNode.context;break e;case 1:if(Dn(v.type)){v=v.stateNode.__reactInternalMemoizedMergedChildContext;break e}}v=v.return}while(v!==null);throw Error(o(171))}if(m.tag===1){var E=m.type;if(Dn(E))return io(m,E,v)}return v}function Vx(m){var v=m._reactInternals;if(v===void 0)throw typeof m.render=="function"?Error(o(188)):(m=Object.keys(m).join(","),Error(o(268,m)));return m=H(v),m===null?null:m.stateNode}function Vs(m,v){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var E=m.retryLane;m.retryLane=E!==0&&E=at&&z>=an&&D<=Ct&&re<=$t){m.splice(v,1);break}else if(R!==at||E.width!==De.width||$tre){if(!(z!==an||E.height!==De.height||CtD)){at>R&&(De.width+=at-R,De.x=R),Ctz&&(De.height+=an-z,De.y=z),$tE&&(E=re)),re ")+` No matching component was found for: - `)+p.join(" > ")}return null},n.getPublicRootInstance=function(p){if(p=p.current,!p.child)return null;switch(p.child.tag){case 5:return se(p.child.stateNode);default:return p.child.stateNode}},n.injectIntoDevTools=function(p){if(p={bundleType:p.bundleType,version:p.version,rendererPackageName:p.rendererPackageName,rendererConfig:p.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:Zp,findFiberByHostInstance:p.findFiberByHostInstance||Gx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")p=!1;else{var v=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(v.isDisabled||!v.supportsFiber)p=!0;else{try{jd=v.inject(p),No=v}catch{}p=!!v.checkDCE}}return p},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(p,v,M,P){if(!J)throw Error(o(363));p=_a(p,v);var D=it(p,M,P).disconnect;return{disconnect:function(){D()}}},n.registerMutableSourceForHydration=function(p,v){var M=v._getVersion;M=M(v._source),p.mutableSourceEagerHydrationData==null?p.mutableSourceEagerHydrationData=[v,M]:p.mutableSourceEagerHydrationData.push(v,M)},n.runWithPriority=function(p,v){var M=pn;try{return pn=p,v()}finally{pn=M}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(p,v,M,P){var D=v.current,z=In(),ie=uo(D);return M=Hx(M),v.context===null?v.context=M:v.pendingContext=M,v=ca(z,ie),v.payload={element:p},P=P===void 0?null:P,P!==null&&(v.callback=P),Ja(D,v),p=pi(D,ie,z),p!==null&&pp(p,D,ie),ie},n}),HA}var Ej;function obe(){return Ej||(Ej=1,FA.exports=sbe()),FA.exports}var abe=obe();const lbe=V1(abe);var VA={exports:{}},GA={};/** + `)+m.join(" > ")}return null},n.getPublicRootInstance=function(m){if(m=m.current,!m.child)return null;switch(m.child.tag){case 5:return ie(m.child.stateNode);default:return m.child.stateNode}},n.injectIntoDevTools=function(m){if(m={bundleType:m.bundleType,version:m.version,rendererPackageName:m.rendererPackageName,rendererConfig:m.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:Zp,findFiberByHostInstance:m.findFiberByHostInstance||Gx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")m=!1;else{var v=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(v.isDisabled||!v.supportsFiber)m=!0;else{try{Ud=v.inject(m),ko=v}catch{}m=!!v.checkDCE}}return m},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(m,v,E,R){if(!J)throw Error(o(363));m=_a(m,v);var D=rt(m,E,R).disconnect;return{disconnect:function(){D()}}},n.registerMutableSourceForHydration=function(m,v){var E=v._getVersion;E=E(v._source),m.mutableSourceEagerHydrationData==null?m.mutableSourceEagerHydrationData=[v,E]:m.mutableSourceEagerHydrationData.push(v,E)},n.runWithPriority=function(m,v){var E=hn;try{return hn=m,v()}finally{hn=E}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(m,v,E,R){var D=v.current,z=kn(),re=ho(D);return E=Hx(E),v.context===null?v.context=E:v.pendingContext=E,v=ca(z,re),v.payload={element:m},R=R===void 0?null:R,R!==null&&(v.callback=R),Ja(D,v),m=gi(D,re,z),m!==null&&pp(m,D,re),re},n}),$A}var Tj;function xbe(){return Tj||(Tj=1,VA.exports=ybe()),VA.exports}var bbe=xbe();const _be=G1(bbe);var XA={exports:{}},qA={};/** * @license React * scheduler.production.min.js * @@ -4468,14 +4483,14 @@ No matching component was found for: * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Aj;function cbe(){return Aj||(Aj=1,(function(t){function e(B,Q){var K=B.length;B.push(Q);e:for(;0>>1,q=B[V];if(0>>1;Vi(ce,K))wei(Ee,ce)?(B[V]=Ee,B[we]=K,V=we):(B[V]=ce,B[ae]=K,V=ae);else if(wei(Ee,K))B[V]=Ee,B[we]=K,V=we;else break e}}return Q}function i(B,Q){var K=B.sortIndex-Q.sortIndex;return K!==0?K:B.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,_=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var Q=n(c);Q!==null;){if(Q.callback===null)r(c);else if(Q.startTime<=B)r(c),Q.sortIndex=Q.expirationTime,e(l,Q);else break;Q=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,se(O);else{var Q=n(c);Q!==null&&fe(C,Q.startTime-B)}}function O(B,Q){x=!1,S&&(S=!1,w(F),F=-1),y=!0;var K=m;try{for(T(Q),f=n(l);f!==null&&(!(f.expirationTime>Q)||B&&!U());){var V=f.callback;if(typeof V=="function"){f.callback=null,m=f.priorityLevel;var q=V(f.expirationTime<=Q);Q=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(Q)}else r(l);f=n(l)}if(f!==null)var he=!0;else{var ae=n(c);ae!==null&&fe(C,ae.startTime-Q),he=!1}return he}finally{f=null,m=K,y=!1}}var N=!1,L=null,F=-1,G=5,k=-1;function U(){return!(t.unstable_now()-kB||125V?(B.sortIndex=K,e(c,B),n(l)===null&&B===n(c)&&(S?(w(F),F=-1):S=!0,fe(C,K-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,se(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var Q=m;return function(){var K=m;m=Q;try{return B.apply(this,arguments)}finally{m=K}}}})(GA)),GA}var Tj;function ube(){return Tj||(Tj=1,VA.exports=cbe()),VA.exports}var Cj=ube();const iN={},dbe=t=>void Object.assign(iN,t);function fbe(t,e){function n(d,{args:f=[],attach:m,...y},x){let S=`${d[0].toUpperCase()}${d.slice(1)}`,_;if(d==="primitive"){if(y.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const w=y.object;_=zm(w,{type:d,root:x,attach:m,primitive:!0})}else{const w=iN[S];if(!w)throw new Error(`R3F: ${S} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(f))throw new Error("R3F: The args prop must be an array!");_=zm(new w(...f),{type:d,root:x,attach:m,memoizedProps:{args:f}})}return _.__r3f.attach===void 0&&(_.isBufferGeometry?_.__r3f.attach="geometry":_.isMaterial&&(_.__r3f.attach="material")),S!=="inject"&&XA(_,y),_}function r(d,f){let m=!1;if(f){var y,x;(y=f.__r3f)!=null&&y.attach?$A(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),m=!0),m||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||zm(f,{}),f.__r3f.parent=d,oP(f),Bm(f)}}function i(d,f,m){let y=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)$A(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){f.parent=d,f.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:f});const _=d.children.filter(E=>E!==f),w=_.indexOf(m);d.children=[..._.slice(0,w),f,..._.slice(w)],y=!0}y||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||zm(f,{}),f.__r3f.parent=d,oP(f),Bm(f)}}function s(d,f,m=!1){d&&[...d].forEach(y=>o(f,y,m))}function o(d,f,m){if(f){var y,x,S;if(f.__r3f&&(f.__r3f.parent=null),(y=d.__r3f)!=null&&y.objects&&(d.__r3f.objects=d.__r3f.objects.filter(C=>C!==f)),(x=f.__r3f)!=null&&x.attach)kj(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var _;d.remove(f),(_=f.__r3f)!=null&&_.root&&xbe(K_(f),f)}const E=(S=f.__r3f)==null?void 0:S.primitive,T=!E&&(m===void 0?f.dispose!==null:m);if(!E){var w;s((w=f.__r3f)==null?void 0:w.objects,f,T),s(f.children,f,T)}if(delete f.__r3f,T&&f.dispose&&f.type!=="Scene"){const C=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?Cj.unstable_scheduleCallback(Cj.unstable_IdlePriority,C):C()}Bm(d)}}function a(d,f,m,y){var x;const S=(x=d.__r3f)==null?void 0:x.parent;if(!S)return;const _=n(f,m,d.__r3f.root);if(d.children){for(const w of d.children)w.__r3f&&r(_,w);d.children=d.children.filter(w=>!w.__r3f)}d.__r3f.objects.forEach(w=>r(_,w)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(S,d),_.parent&&(_.__r3f.autoRemovedBeforeAppend=!0),r(S,_),_.raycast&&_.__r3f.eventCount&&K_(_).getState().internal.interaction.push(_),[y,y.alternate].forEach(w=>{w!==null&&(w.stateNode=_,w.ref&&(typeof w.ref=="function"?w.ref(_):w.ref.current=_))})}const l=()=>{};return{reconciler:lbe({createInstance:n,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const m=d.getState().scene;m.__r3f&&(m.__r3f.root=d,r(m,f))},removeChildFromContainer:(d,f)=>{f&&o(d.getState().scene,f)},insertInContainerBefore:(d,f,m)=>{if(!f||!m)return;const y=d.getState().scene;y.__r3f&&i(y,f,m)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,m,y){var x;if(((x=d==null?void 0:d.__r3f)!=null?x:{}).primitive&&y.object&&y.object!==d)return[!0];{const{args:_=[],children:w,...E}=y,{args:T=[],children:C,...O}=m;if(!Array.isArray(_))throw new Error("R3F: the args prop must be an array!");if(_.some((L,F)=>L!==T[F]))return[!0];const N=mG(d,E,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,m],y,x,S,_){f?a(d,y,S,_):XA(d,m)},commitMount(d,f,m,y){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&K_(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>zm(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:m,parent:y}=(f=d.__r3f)!=null?f:{};m&&y&&kj(y,d,m),d.isObject3D&&(d.visible=!1),Bm(d)},unhideInstance(d,f){var m;const{attach:y,parent:x}=(m=d.__r3f)!=null?m:{};y&&x&&$A(x,d,y),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),Bm(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Ym.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&or.fun(performance.now)?performance.now:or.fun(Date.now)?Date.now:()=>0,scheduleTimeout:or.fun(setTimeout)?setTimeout:void 0,cancelTimeout:or.fun(clearTimeout)?clearTimeout:void 0}),applyProps:XA}}var Pj,Rj;const WA=t=>"colorSpace"in t||"outputColorSpace"in t,cG=()=>{var t;return(t=iN.ColorManagement)!=null?t:null},uG=t=>t&&t.isOrthographicCamera,hbe=t=>t&&t.hasOwnProperty("current"),yx=typeof window<"u"&&((Pj=window.document)!=null&&Pj.createElement||((Rj=window.navigator)==null?void 0:Rj.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function dG(t){const e=R.useRef(t);return yx(()=>void(e.current=t),[t]),e}function pbe({set:t}){return yx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class fG extends R.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}fG.getDerivedStateFromError=()=>({error:!0});const hG="__default",Nj=new Map,mbe=t=>t&&!!t.memoized&&!!t.changes;function pG(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const R0=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function K_(t){let e=t.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const or={obj:t=>t===Object(t)&&!or.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:r="reference",strict:i=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(or.str(t)||or.num(t)||or.boo(t))return t===e;const s=or.obj(t);if(s&&r==="reference")return t===e;const o=or.arr(t);if(o&&n==="reference")return t===e;if((o||s)&&t===e)return!0;let a;for(a in t)if(!(a in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(a in i?e:t)if(!or.equ(t[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:t)if(t[a]!==e[a])return!1;if(or.und(a)){if(o&&t.length===0&&e.length===0||s&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function gbe(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function zm(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function sP(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((s,o)=>s[o],t),{target:n,key:i}}else return{target:n,key:e}}const Ij=/-\d+$/;function $A(t,e,n){if(or.str(n)){if(Ij.test(n)){const s=n.replace(Ij,""),{target:o,key:a}=sP(t,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=sP(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function kj(t,e,n){var r,i;if(or.str(n)){const{target:s,key:o}=sP(t,n),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function mG(t,{children:e,key:n,ref:r,...i},{children:s,key:o,ref:a,...l}={},c=!1){const d=t.__r3f,f=Object.entries(i),m=[];if(c){const x=Object.keys(l);for(let S=0;S{var _;if((_=t.__r3f)!=null&&_.primitive&&x==="object"||or.equ(S,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,S,!0,[]]);let w=[];x.includes("-")&&(w=x.split("-")),m.push([x,S,!1,w]);for(const E in i){const T=i[E];E.startsWith(`${x}-`)&&m.push([E,T,!1,E.split("-")])}});const y={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(y.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(y.attach=d.memoizedProps.attach),{memoized:y,changes:m}}function XA(t,e){var n;const r=t.__r3f,i=r==null?void 0:r.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:a}=mbe(e)?e:mG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=o);for(let m=0;mT[C],t),!(E&&E.set))){const[T,...C]=_.reverse();w=C.reverse().reduce((O,N)=>O[N],t),y=T}if(x===hG+"remove")if(w.constructor){let T=Nj.get(w.constructor);T||(T=new w.constructor,Nj.set(w.constructor,T)),x=T[y]}else x=0;if(S&&r)x?r.handlers[y]=x:delete r.handlers[y],r.eventCount=Object.keys(r.handlers).length;else if(E&&E.set&&(E.copy||E instanceof Th)){if(Array.isArray(x))E.fromArray?E.fromArray(x):E.set(...x);else if(E.copy&&x&&x.constructor&&E.constructor===x.constructor)E.copy(x);else if(x!==void 0){var c;const T=(c=E)==null?void 0:c.isColor;!T&&E.setScalar?E.setScalar(x):E instanceof Th&&x instanceof Th?E.mask=x.mask:E.set(x),!cG()&&s&&!s.linear&&T&&E.convertSRGBToLinear()}}else{var d;if(w[y]=x,(d=w[y])!=null&&d.isTexture&&w[y].format===as&&w[y].type===Va&&s){const T=w[y];WA(T)&&WA(s.gl)?T.colorSpace=s.gl.outputColorSpace:T.encoding=s.gl.outputEncoding}}Bm(t)}if(r&&r.parent&&t.raycast&&l!==r.eventCount){const m=K_(t).getState().internal,y=m.interaction.indexOf(t);y>-1&&m.interaction.splice(y,1),r.eventCount&&m.interaction.push(t)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(n=t.__r3f)!=null&&n.parent&&oP(t),t}function Bm(t){var e,n;const r=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();r&&r.internal.frames===0&&r.invalidate()}function oP(t){t.onUpdate==null||t.onUpdate(t)}function vbe(t,e){t.manual||(uG(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function R_(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function ybe(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Ym.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Ym.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Ym.ContinuousEventPriority;default:return Ym.DefaultEventPriority}}function gG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function xbe(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(r=>r!==e),n.initialHits=n.initialHits.filter(r=>r!==e),n.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&n.hovered.delete(i)}),n.capturedMap.forEach((r,i)=>{gG(n.capturedMap,e,r,i)})}function bbe(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],f=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+f*f))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var f;return(f=c.__r3f)==null?void 0:f.handlers["onPointer"+d]}))}function r(l,c){const d=t.getState(),f=new Set,m=[],y=c?c(d.internal.interaction):d.internal.interaction;for(let w=0;w{const T=R0(w.object),C=R0(E.object);return!T||!C?w.distance-E.distance:C.events.priority-T.events.priority||w.distance-E.distance}).filter(w=>{const E=R_(w);return f.has(E)?!1:(f.add(E),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const w of S){let E=w.object;for(;E;){var _;(_=E.__r3f)!=null&&_.eventCount&&m.push({...w,eventObject:E}),E=E.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let w of d.internal.capturedMap.get(l.pointerId).values())f.has(R_(w.intersection))||m.push(w.intersection);return m}function i(l,c,d,f){const m=t.getState();if(l.length){const y={stopped:!1};for(const x of l){const S=R0(x.object)||m,{raycaster:_,pointer:w,camera:E,internal:T}=S,C=new X(w.x,w.y,0).unproject(E),O=k=>{var U,H;return(U=(H=T.capturedMap.get(k))==null?void 0:H.has(x.eventObject))!=null?U:!1},N=k=>{const U={intersection:x,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(x.eventObject,U):T.capturedMap.set(k,new Map([[x.eventObject,U]])),c.target.setPointerCapture(k)},L=k=>{const U=T.capturedMap.get(k);U&&gG(T.capturedMap,x.eventObject,U,k)};let F={};for(let k in c){let U=c[k];typeof U!="function"&&(F[k]=U)}let G={...x,...F,pointer:w,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:C,ray:_.ray,camera:E,stopPropagation(){const k="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!k||k.has(x.eventObject))&&(G.stopped=y.stopped=!0,T.hovered.size&&Array.from(T.hovered.values()).find(U=>U.eventObject===x.eventObject))){const U=l.slice(0,l.indexOf(x));s([...U,x])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:L},currentTarget:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:L},nativeEvent:c};if(f(G),y.stopped===!0)break}}return l}function s(l){const{internal:c}=t.getState();for(const d of c.hovered.values())if(!l.length||!l.find(f=>f.object===d.object&&f.index===d.index&&f.instanceId===d.instanceId)){const m=d.eventObject.__r3f,y=m==null?void 0:m.handlers;if(c.hovered.delete(R_(d)),m!=null&&m.eventCount){const x={...d,intersections:l};y.onPointerOut==null||y.onPointerOut(x),y.onPointerLeave==null||y.onPointerLeave(x)}}}function o(l,c){for(let d=0;ds([]);case"onLostPointerCapture":return c=>{const{internal:d}=t.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:f,internal:m}=t.getState();m.lastEvent.current=d;const y=l==="onPointerMove",x=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",_=r(d,y?n:void 0),w=x?e(d):0;l==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=_.map(T=>T.eventObject)),x&&!_.length&&w<=2&&(o(d,m.interaction),f&&f(d)),y&&s(_);function E(T){const C=T.eventObject,O=C.__r3f,N=O==null?void 0:O.handlers;if(O!=null&&O.eventCount)if(y){if(N.onPointerOver||N.onPointerEnter||N.onPointerOut||N.onPointerLeave){const L=R_(T),F=m.hovered.get(L);F?F.stopped&&T.stopPropagation():(m.hovered.set(L,T),N.onPointerOver==null||N.onPointerOver(T),N.onPointerEnter==null||N.onPointerEnter(T))}N.onPointerMove==null||N.onPointerMove(T)}else{const L=N[l];L?(!x||m.initialHits.includes(C))&&(o(d,m.interaction.filter(F=>!m.initialHits.includes(F))),L(T)):x&&m.initialHits.includes(C)&&o(d,m.interaction.filter(F=>!m.initialHits.includes(F)))}}i(_,d,w,E)}}return{handlePointer:a}}const vG=t=>!!(t!=null&&t.render),yG=R.createContext(null),_be=(t,e)=>{const n=nbe((a,l)=>{const c=new X,d=new X,f=new X;function m(w=l().camera,E=d,T=l().size){const{width:C,height:O,top:N,left:L}=T,F=C/O;E.isVector3?f.copy(E):f.set(...E);const G=w.getWorldPosition(c).distanceTo(f);if(uG(w))return{width:C/w.zoom,height:O/w.zoom,top:N,left:L,factor:1,distance:G,aspect:F};{const k=w.fov*Math.PI/180,U=2*Math.tan(k/2)*G,H=U*(C/O);return{width:H,height:U,top:N,left:L,factor:C/H,distance:G,aspect:F}}}let y;const x=w=>a(E=>({performance:{...E.performance,current:w}})),S=new Ve;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(w=1)=>t(l(),w),advance:(w,E)=>e(w,E,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new JR,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const w=l();y&&clearTimeout(y),w.performance.current!==w.performance.min&&x(w.performance.min),y=setTimeout(()=>x(l().performance.max),w.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:w=>a(E=>({...E,events:{...E.events,...w}})),setSize:(w,E,T,C,O)=>{const N=l().camera,L={width:w,height:E,top:C||0,left:O||0,updateStyle:T};a(F=>({size:L,viewport:{...F.viewport,...m(N,d,L)}}))},setDpr:w=>a(E=>{const T=pG(w);return{viewport:{...E.viewport,dpr:T,initialDpr:E.viewport.initialDpr||T}}}),setFrameloop:(w="always")=>{const E=l().clock;E.stop(),E.elapsedTime=0,w!=="never"&&(E.start(),E.elapsedTime=0),a(()=>({frameloop:w}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:R.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(w,E,T)=>{const C=l().internal;return C.priority=C.priority+(E>0?1:0),C.subscribers.push({ref:w,priority:E,store:T}),C.subscribers=C.subscribers.sort((O,N)=>O.priority-N.priority),()=>{const O=l().internal;O!=null&&O.subscribers&&(O.priority=O.priority-(E>0?1:0),O.subscribers=O.subscribers.filter(N=>N.ref!==w))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return n.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:d,set:f}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){var m;i=l,s=c.dpr,vbe(a,l),d.setPixelRatio(c.dpr);const y=(m=l.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,y)}a!==o&&(o=a,f(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};let N_,wbe=new Set,Sbe=new Set,Mbe=new Set;function qA(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function N0(t,e){switch(t){case"before":return qA(wbe,e);case"after":return qA(Sbe,e);case"tail":return qA(Mbe,e)}}let KA,YA;function ZA(t,e,n){let r=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(r=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),KA=e.internal.subscribers,N_=0;N_0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(r+=ZA(c,s))}if(n=!1,N0("after",c),r===0)return N0("tail",c),e=!1,cancelAnimationFrame(i)}function a(c,d=1){var f;if(!c)return t.forEach(m=>a(m.store.getState(),d));(f=c.gl.xr)!=null&&f.isPresenting||!c.internal.active||c.frameloop==="never"||(d>1?c.internal.frames=Math.min(60,c.internal.frames+d):n?c.internal.frames=2:c.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(c,d=!0,f,m){if(d&&N0("before",c),f)ZA(c,f,m);else for(const y of t.values())ZA(c,y.store.getState());d&&N0("after",c)}return{loop:o,invalidate:a,advance:l}}function xG(){const t=R.useContext(yG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function nd(t=n=>n,e){return xG()(t,e)}function bG(t,e=0){const n=xG(),r=n.getState().internal.subscribe,i=dG(t);return yx(()=>r(i,e,n),[e,r,n]),null}const Bg=new Map,{invalidate:Oj,advance:Lj}=Ebe(Bg),{reconciler:U1,applyProps:Im}=fbe(Bg,ybe),km={objects:"shallow",strict:!1},Abe=(t,e)=>{const n=typeof t=="function"?t(e):t;return vG(n)?n:new x6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Tbe(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:o,updateStyle:a=n}=e;return{width:r,height:i,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:s,left:o}=t.parentElement.getBoundingClientRect();return{width:r,height:i,top:s,left:o,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function Cbe(t){const e=Bg.get(t),n=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||_be(Oj,Lj),o=n||U1.createContainer(s,Ym.ConcurrentRoot,null,!1,null,"",i,null);e||Bg.set(t,{fiber:o,store:s});let a,l=!1,c;return{configure(d={}){let{gl:f,size:m,scene:y,events:x,onCreated:S,shadows:_=!1,linear:w=!1,flat:E=!1,legacy:T=!1,orthographic:C=!1,frameloop:O="always",dpr:N=[1,2],performance:L,raycaster:F,camera:G,onPointerMissed:k}=d,U=s.getState(),H=U.gl;U.gl||U.set({gl:H=Abe(f,t)});let ne=U.raycaster;ne||U.set({raycaster:ne=new oG});const{params:ee,...pe}=F||{};if(or.equ(pe,ne,km)||Im(ne,{...pe}),or.equ(ee,ne.params,km)||Im(ne,{params:{...ne.params,...ee}}),!U.camera||U.camera===c&&!or.equ(c,G,km)){c=G;const K=G instanceof dx,V=K?G:C?new Xc(0,0,0,0,.1,1e3):new Pr(75,0,.1,1e3);K||(V.position.z=5,G&&(Im(V,G),("aspect"in G||"left"in G||"right"in G||"bottom"in G||"top"in G)&&(V.manual=!0,V.updateProjectionMatrix())),!U.camera&&!(G!=null&&G.rotation)&&V.lookAt(0,0,0)),U.set({camera:V}),ne.camera=V}if(!U.scene){let K;y!=null&&y.isScene?K=y:(K=new kR,y&&Im(K,y)),U.set({scene:zm(K)})}if(!U.xr){var se;const K=(he,ae)=>{const ce=s.getState();ce.frameloop!=="never"&&Lj(he,!0,ce,ae)},V=()=>{const he=s.getState();he.gl.xr.enabled=he.gl.xr.isPresenting,he.gl.xr.setAnimationLoop(he.gl.xr.isPresenting?K:null),he.gl.xr.isPresenting||Oj(he)},q={connect(){const he=s.getState().gl;he.xr.addEventListener("sessionstart",V),he.xr.addEventListener("sessionend",V)},disconnect(){const he=s.getState().gl;he.xr.removeEventListener("sessionstart",V),he.xr.removeEventListener("sessionend",V)}};typeof((se=H.xr)==null?void 0:se.addEventListener)=="function"&&q.connect(),U.set({xr:q})}if(H.shadowMap){const K=H.shadowMap.enabled,V=H.shadowMap.type;if(H.shadowMap.enabled=!!_,or.boo(_))H.shadowMap.type=K0;else if(or.str(_)){var fe;const q={basic:mV,percentage:HS,soft:K0,variance:La};H.shadowMap.type=(fe=q[_])!=null?fe:K0}else or.obj(_)&&Object.assign(H.shadowMap,_);(K!==H.shadowMap.enabled||V!==H.shadowMap.type)&&(H.shadowMap.needsUpdate=!0)}const B=cG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Im(H,{outputEncoding:w?3e3:3001,toneMapping:E?Pl:dR}),U.legacy!==T&&U.set(()=>({legacy:T})),U.linear!==w&&U.set(()=>({linear:w})),U.flat!==E&&U.set(()=>({flat:E})),f&&!or.fun(f)&&!vG(f)&&!or.equ(f,H,km)&&Im(H,f),x&&!U.events.handlers&&U.set({events:x(s)});const Q=Tbe(t,m);return or.equ(Q,U.size,km)||U.setSize(Q.width,Q.height,Q.updateStyle,Q.top,Q.left),N&&U.viewport.dpr!==pG(N)&&U.setDpr(N),U.frameloop!==O&&U.setFrameloop(O),U.onPointerMissed||U.set({onPointerMissed:k}),L&&!or.equ(L,U.performance,km)&&U.set(K=>({performance:{...K.performance,...L}})),a=S,l=!0,this},render(d){return l||this.configure(),U1.updateContainer(g.jsx(Pbe,{store:s,children:d,onCreated:a,rootElement:t}),o,null,()=>{}),s},unmount(){_G(t)}}}function Pbe({store:t,children:e,onCreated:n,rootElement:r}){return yx(()=>{const i=t.getState();i.set(s=>({internal:{...s.internal,active:!0}})),n&&n(i),t.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),g.jsx(yG.Provider,{value:t,children:e})}function _G(t,e){const n=Bg.get(t),r=n==null?void 0:n.fiber;if(r){const i=n==null?void 0:n.store.getState();i&&(i.internal.active=!1),U1.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),gbe(i),Bg.delete(t)}catch{}},500)})}}U1.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:R.version});const QA={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Rbe(t){const{handlePointer:e}=bbe(t);return{priority:1,enabled:!0,compute(n,r,i){r.pointer.set(n.offsetX/r.size.width*2-1,-(n.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(QA).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{var r;const{set:i,events:s}=t.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:n}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([o,a])=>{const[l,c]=QA[o];n.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,o])=>{if(r&&r.connected instanceof HTMLElement){const[a]=QA[s];r.connected.removeEventListener(a,o)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function Dj(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function Nbe({debounce:t,scroll:e,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=R.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=R.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=R.useRef(!1);R.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,m,y]=R.useMemo(()=>{const w=()=>{if(!a.current.element)return;const{left:E,top:T,width:C,height:O,bottom:N,right:L,x:F,y:G}=a.current.element.getBoundingClientRect(),k={left:E,top:T,width:C,height:O,bottom:N,right:L,x:F,y:G};a.current.element instanceof HTMLElement&&r&&(k.height=a.current.element.offsetHeight,k.width=a.current.element.offsetWidth),Object.freeze(k),d.current&&!Lbe(a.current.lastBounds,k)&&o(a.current.lastBounds=k)};return[w,c?Dj(w,c):w,l?Dj(w,l):w]},[o,r,l,c]);function x(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(w=>w.removeEventListener("scroll",y,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function S(){a.current.element&&(a.current.resizeObserver=new i(y),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(w=>w.addEventListener("scroll",y,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const _=w=>{!w||w===a.current.element||(x(),a.current.element=w,a.current.scrollContainers=wG(w),S())};return kbe(y,!!e),Ibe(m),R.useEffect(()=>{x(),S()},[e,y,m]),R.useEffect(()=>x,[]),[_,s,f]}function Ibe(t){R.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function kbe(t,e){R.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function wG(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(t);return[n,r,i].some(s=>s==="auto"||s==="scroll")&&e.push(t),[...e,...wG(t.parentElement)]}const Obe=["x","y","top","bottom","left","right","width","height"],Lbe=(t,e)=>Obe.every(n=>t[n]===e[n]);var Dbe=Object.defineProperty,jbe=Object.defineProperties,Ube=Object.getOwnPropertyDescriptors,jj=Object.getOwnPropertySymbols,Fbe=Object.prototype.hasOwnProperty,zbe=Object.prototype.propertyIsEnumerable,Uj=(t,e,n)=>e in t?Dbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Fj=(t,e)=>{for(var n in e||(e={}))Fbe.call(e,n)&&Uj(t,n,e[n]);if(jj)for(var n of jj(e))zbe.call(e,n)&&Uj(t,n,e[n]);return t},Bbe=(t,e)=>jbe(t,Ube(e)),zj,Bj;typeof window<"u"&&((zj=window.document)!=null&&zj.createElement||((Bj=window.navigator)==null?void 0:Bj.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function SG(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=SG(r,e,n);if(i)return i;r=r.sibling}}function MG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const Hj=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=Hj;return}return Hj.apply(this,arguments)};const sN=MG(R.createContext(null));class EG extends R.Component{render(){return R.createElement(sN.Provider,{value:this._reactInternals},this.props.children)}}function Hbe(){const t=R.useContext(sN);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=R.useId();return R.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=SG(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[t,e])}function Vbe(){const t=Hbe(),[e]=R.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==sN&&!e.has(i)&&e.set(i,R.useContext(MG(i)))}n=n.return}return e}function Gbe(){const t=Vbe();return R.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>R.createElement(e,null,R.createElement(n.Provider,Bbe(Fj({},r),{value:t.get(n)}))),e=>R.createElement(EG,Fj({},e))),[t])}const Wbe=R.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:o=Rbe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:_,raycaster:w,camera:E,scene:T,onPointerMissed:C,onCreated:O,...N},L){R.useMemo(()=>dbe(Zxe),[]);const F=Gbe(),[G,k]=Nbe({scroll:!0,debounce:{scroll:50,resize:0},...r}),U=R.useRef(null),H=R.useRef(null);R.useImperativeHandle(L,()=>U.current);const ne=dG(C),[ee,pe]=R.useState(!1),[se,fe]=R.useState(!1);if(ee)throw ee;if(se)throw se;const B=R.useRef(null);yx(()=>{const K=U.current;k.width>0&&k.height>0&&K&&(B.current||(B.current=Cbe(K)),B.current.configure({gl:s,events:o,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:_,raycaster:w,camera:E,scene:T,size:k,onPointerMissed:(...V)=>ne.current==null?void 0:ne.current(...V),onCreated:V=>{V.events.connect==null||V.events.connect(a?hbe(a)?a.current:a:H.current),l&&V.setEvents({compute:(q,he)=>{const ae=q[l+"X"],ce=q[l+"Y"];he.pointer.set(ae/he.size.width*2-1,-(ce/he.size.height)*2+1),he.raycaster.setFromCamera(he.pointer,he.camera)}}),O==null||O(V)}}),B.current.render(g.jsx(F,{children:g.jsx(fG,{set:fe,children:g.jsx(R.Suspense,{fallback:g.jsx(pbe,{set:pe}),children:e??null})})})))}),R.useEffect(()=>{const K=U.current;if(K)return()=>_G(K)},[]);const Q=a?"none":"auto";return g.jsx("div",{ref:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:Q,...i},...N,children:g.jsx("div",{ref:G,style:{width:"100%",height:"100%"},children:g.jsx("canvas",{ref:U,style:{display:"block"},children:n})})})}),$be=R.forwardRef(function(e,n){return g.jsx(EG,{children:g.jsx(Wbe,{...e,ref:n})})});function aP(){return aP=Object.assign?Object.assign.bind():function(t){for(var e=1;ee in t?Xbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kbe=(t,e,n)=>(qbe(t,e+"",n),n);class Ybe{constructor(){Kbe(this,"_listeners")}addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;se in t?Zbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Yt=(t,e,n)=>(Qbe(t,typeof e!="symbol"?e+"":e,n),n);const I_=new ep,Vj=new kc,Jbe=Math.cos(70*(Math.PI/180)),Gj=(t,e)=>(t%e+e)%e;let e_e=class extends Ybe{constructor(e,n){super(),Yt(this,"object"),Yt(this,"domElement"),Yt(this,"enabled",!0),Yt(this,"target",new X),Yt(this,"minDistance",0),Yt(this,"maxDistance",1/0),Yt(this,"minZoom",0),Yt(this,"maxZoom",1/0),Yt(this,"minPolarAngle",0),Yt(this,"maxPolarAngle",Math.PI),Yt(this,"minAzimuthAngle",-1/0),Yt(this,"maxAzimuthAngle",1/0),Yt(this,"enableDamping",!1),Yt(this,"dampingFactor",.05),Yt(this,"enableZoom",!0),Yt(this,"zoomSpeed",1),Yt(this,"enableRotate",!0),Yt(this,"rotateSpeed",1),Yt(this,"enablePan",!0),Yt(this,"panSpeed",1),Yt(this,"screenSpacePanning",!0),Yt(this,"keyPanSpeed",7),Yt(this,"zoomToCursor",!1),Yt(this,"autoRotate",!1),Yt(this,"autoRotateSpeed",2),Yt(this,"reverseOrbit",!1),Yt(this,"reverseHorizontalOrbit",!1),Yt(this,"reverseVerticalOrbit",!1),Yt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Yt(this,"mouseButtons",{LEFT:Xf.ROTATE,MIDDLE:Xf.DOLLY,RIGHT:Xf.PAN}),Yt(this,"touches",{ONE:qf.ROTATE,TWO:qf.DOLLY_PAN}),Yt(this,"target0"),Yt(this,"position0"),Yt(this,"zoom0"),Yt(this,"_domElementKeyEvents",null),Yt(this,"getPolarAngle"),Yt(this,"getAzimuthalAngle"),Yt(this,"setPolarAngle"),Yt(this,"setAzimuthalAngle"),Yt(this,"getDistance"),Yt(this,"getZoomScale"),Yt(this,"listenToKeyEvents"),Yt(this,"stopListenToKeyEvents"),Yt(this,"saveState"),Yt(this,"reset"),Yt(this,"update"),Yt(this,"connect"),Yt(this,"dispose"),Yt(this,"dollyIn"),Yt(this,"dollyOut"),Yt(this,"getScale"),Yt(this,"setScale"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=de=>{let qe=Gj(de,2*Math.PI),le=d.phi;le<0&&(le+=2*Math.PI),qe<0&&(qe+=2*Math.PI);let Ye=Math.abs(qe-le);2*Math.PI-Ye{let qe=Gj(de,2*Math.PI),le=d.theta;le<0&&(le+=2*Math.PI),qe<0&&(qe+=2*Math.PI);let Ye=Math.abs(qe-le);2*Math.PI-Yer.object.position.distanceTo(r.target),this.listenToKeyEvents=de=>{de.addEventListener("keydown",ht),this._domElementKeyEvents=de},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ht),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=a.NONE},this.update=(()=>{const de=new X,qe=new X(0,1,0),le=new Jt().setFromUnitVectors(e.up,qe),Ye=le.clone().invert(),Te=new X,Fe=new Jt,st=2*Math.PI;return function(){const ze=r.object.position;le.setFromUnitVectors(e.up,qe),Ye.copy(le).invert(),de.copy(ze).sub(r.target),de.applyQuaternion(le),d.setFromVector3(de),r.autoRotate&&l===a.NONE&&ee(H()),r.enableDamping?(d.theta+=f.theta*r.dampingFactor,d.phi+=f.phi*r.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let Je=r.minAzimuthAngle,At=r.maxAzimuthAngle;isFinite(Je)&&isFinite(At)&&(Je<-Math.PI?Je+=st:Je>Math.PI&&(Je-=st),At<-Math.PI?At+=st:At>Math.PI&&(At-=st),Je<=At?d.theta=Math.max(Je,Math.min(At,d.theta)):d.theta=d.theta>(Je+At)/2?Math.max(Je,d.theta):Math.min(At,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(y,r.dampingFactor):r.target.add(y),r.zoomToCursor&&G||r.object.isOrthographicCamera?d.radius=he(d.radius):d.radius=he(d.radius*m),de.setFromSpherical(d),de.applyQuaternion(Ye),ze.copy(r.target).add(de),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(f.theta*=1-r.dampingFactor,f.phi*=1-r.dampingFactor,y.multiplyScalar(1-r.dampingFactor)):(f.set(0,0,0),y.set(0,0,0));let _t=!1;if(r.zoomToCursor&&G){let dn=null;if(r.object instanceof Pr&&r.object.isPerspectiveCamera){const cn=de.length();dn=he(cn*m);const Un=cn-dn;r.object.position.addScaledVector(L,Un),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const cn=new X(F.x,F.y,0);cn.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix(),_t=!0;const Un=new X(F.x,F.y,0);Un.unproject(r.object),r.object.position.sub(Un).add(cn),r.object.updateMatrixWorld(),dn=de.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;dn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(dn).add(r.object.position):(I_.origin.copy(r.object.position),I_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(I_.direction))c||8*(1-Fe.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Te.copy(r.object.position),Fe.copy(r.object.quaternion),_t=!1,!0):!1}})(),this.connect=de=>{r.domElement=de,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",re),r.domElement.addEventListener("pointerdown",Me),r.domElement.addEventListener("pointercancel",He),r.domElement.addEventListener("wheel",it)},this.dispose=()=>{var de,qe,le,Ye,Te,Fe;r.domElement&&(r.domElement.style.touchAction="auto"),(de=r.domElement)==null||de.removeEventListener("contextmenu",re),(qe=r.domElement)==null||qe.removeEventListener("pointerdown",Me),(le=r.domElement)==null||le.removeEventListener("pointercancel",He),(Ye=r.domElement)==null||Ye.removeEventListener("wheel",it),(Te=r.domElement)==null||Te.ownerDocument.removeEventListener("pointermove",Ue),(Fe=r.domElement)==null||Fe.ownerDocument.removeEventListener("pointerup",He),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ht)};const r=this,i={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,d=new iP,f=new iP;let m=1;const y=new X,x=new Ve,S=new Ve,_=new Ve,w=new Ve,E=new Ve,T=new Ve,C=new Ve,O=new Ve,N=new Ve,L=new X,F=new Ve;let G=!1;const k=[],U={};function H(){return 2*Math.PI/60/60*r.autoRotateSpeed}function ne(){return Math.pow(.95,r.zoomSpeed)}function ee(de){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=de:f.theta-=de}function pe(de){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=de:f.phi-=de}const se=(()=>{const de=new X;return function(le,Ye){de.setFromMatrixColumn(Ye,0),de.multiplyScalar(-le),y.add(de)}})(),fe=(()=>{const de=new X;return function(le,Ye){r.screenSpacePanning===!0?de.setFromMatrixColumn(Ye,1):(de.setFromMatrixColumn(Ye,0),de.crossVectors(r.object.up,de)),de.multiplyScalar(le),y.add(de)}})(),B=(()=>{const de=new X;return function(le,Ye){const Te=r.domElement;if(Te&&r.object instanceof Pr&&r.object.isPerspectiveCamera){const Fe=r.object.position;de.copy(Fe).sub(r.target);let st=de.length();st*=Math.tan(r.object.fov/2*Math.PI/180),se(2*le*st/Te.clientHeight,r.object.matrix),fe(2*Ye*st/Te.clientHeight,r.object.matrix)}else Te&&r.object instanceof Xc&&r.object.isOrthographicCamera?(se(le*(r.object.right-r.object.left)/r.object.zoom/Te.clientWidth,r.object.matrix),fe(Ye*(r.object.top-r.object.bottom)/r.object.zoom/Te.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function Q(de){r.object instanceof Pr&&r.object.isPerspectiveCamera||r.object instanceof Xc&&r.object.isOrthographicCamera?m=de:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function K(de){Q(m/de)}function V(de){Q(m*de)}function q(de){if(!r.zoomToCursor||!r.domElement)return;G=!0;const qe=r.domElement.getBoundingClientRect(),le=de.clientX-qe.left,Ye=de.clientY-qe.top,Te=qe.width,Fe=qe.height;F.x=le/Te*2-1,F.y=-(Ye/Fe)*2+1,L.set(F.x,F.y,1).unproject(r.object).sub(r.object.position).normalize()}function he(de){return Math.max(r.minDistance,Math.min(r.maxDistance,de))}function ae(de){x.set(de.clientX,de.clientY)}function ce(de){q(de),C.set(de.clientX,de.clientY)}function we(de){w.set(de.clientX,de.clientY)}function Ee(de){S.set(de.clientX,de.clientY),_.subVectors(S,x).multiplyScalar(r.rotateSpeed);const qe=r.domElement;qe&&(ee(2*Math.PI*_.x/qe.clientHeight),pe(2*Math.PI*_.y/qe.clientHeight)),x.copy(S),r.update()}function Xe(de){O.set(de.clientX,de.clientY),N.subVectors(O,C),N.y>0?K(ne()):N.y<0&&V(ne()),C.copy(O),r.update()}function Se(de){E.set(de.clientX,de.clientY),T.subVectors(E,w).multiplyScalar(r.panSpeed),B(T.x,T.y),w.copy(E),r.update()}function je(de){q(de),de.deltaY<0?V(ne()):de.deltaY>0&&K(ne()),r.update()}function $e(de){let qe=!1;switch(de.code){case r.keys.UP:B(0,r.keyPanSpeed),qe=!0;break;case r.keys.BOTTOM:B(0,-r.keyPanSpeed),qe=!0;break;case r.keys.LEFT:B(r.keyPanSpeed,0),qe=!0;break;case r.keys.RIGHT:B(-r.keyPanSpeed,0),qe=!0;break}qe&&(de.preventDefault(),r.update())}function ue(){if(k.length==1)x.set(k[0].pageX,k[0].pageY);else{const de=.5*(k[0].pageX+k[1].pageX),qe=.5*(k[0].pageY+k[1].pageY);x.set(de,qe)}}function Z(){if(k.length==1)w.set(k[0].pageX,k[0].pageY);else{const de=.5*(k[0].pageX+k[1].pageX),qe=.5*(k[0].pageY+k[1].pageY);w.set(de,qe)}}function Ge(){const de=k[0].pageX-k[1].pageX,qe=k[0].pageY-k[1].pageY,le=Math.sqrt(de*de+qe*qe);C.set(0,le)}function Oe(){r.enableZoom&&Ge(),r.enablePan&&Z()}function We(){r.enableZoom&&Ge(),r.enableRotate&&ue()}function tt(de){if(k.length==1)S.set(de.pageX,de.pageY);else{const le=Qt(de),Ye=.5*(de.pageX+le.x),Te=.5*(de.pageY+le.y);S.set(Ye,Te)}_.subVectors(S,x).multiplyScalar(r.rotateSpeed);const qe=r.domElement;qe&&(ee(2*Math.PI*_.x/qe.clientHeight),pe(2*Math.PI*_.y/qe.clientHeight)),x.copy(S)}function wt(de){if(k.length==1)E.set(de.pageX,de.pageY);else{const qe=Qt(de),le=.5*(de.pageX+qe.x),Ye=.5*(de.pageY+qe.y);E.set(le,Ye)}T.subVectors(E,w).multiplyScalar(r.panSpeed),B(T.x,T.y),w.copy(E)}function dt(de){const qe=Qt(de),le=de.pageX-qe.x,Ye=de.pageY-qe.y,Te=Math.sqrt(le*le+Ye*Ye);O.set(0,Te),N.set(0,Math.pow(O.y/C.y,r.zoomSpeed)),K(N.y),C.copy(O)}function J(de){r.enableZoom&&dt(de),r.enablePan&&wt(de)}function $(de){r.enableZoom&&dt(de),r.enableRotate&&tt(de)}function Me(de){var qe,le;r.enabled!==!1&&(k.length===0&&((qe=r.domElement)==null||qe.ownerDocument.addEventListener("pointermove",Ue),(le=r.domElement)==null||le.ownerDocument.addEventListener("pointerup",He)),Qe(de),de.pointerType==="touch"?Gt(de):Be(de))}function Ue(de){r.enabled!==!1&&(de.pointerType==="touch"?Ke(de):bt(de))}function He(de){var qe,le,Ye;St(de),k.length===0&&((qe=r.domElement)==null||qe.releasePointerCapture(de.pointerId),(le=r.domElement)==null||le.ownerDocument.removeEventListener("pointermove",Ue),(Ye=r.domElement)==null||Ye.ownerDocument.removeEventListener("pointerup",He)),r.dispatchEvent(o),l=a.NONE}function Be(de){let qe;switch(de.button){case 0:qe=r.mouseButtons.LEFT;break;case 1:qe=r.mouseButtons.MIDDLE;break;case 2:qe=r.mouseButtons.RIGHT;break;default:qe=-1}switch(qe){case Xf.DOLLY:if(r.enableZoom===!1)return;ce(de),l=a.DOLLY;break;case Xf.ROTATE:if(de.ctrlKey||de.metaKey||de.shiftKey){if(r.enablePan===!1)return;we(de),l=a.PAN}else{if(r.enableRotate===!1)return;ae(de),l=a.ROTATE}break;case Xf.PAN:if(de.ctrlKey||de.metaKey||de.shiftKey){if(r.enableRotate===!1)return;ae(de),l=a.ROTATE}else{if(r.enablePan===!1)return;we(de),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function bt(de){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;Ee(de);break;case a.DOLLY:if(r.enableZoom===!1)return;Xe(de);break;case a.PAN:if(r.enablePan===!1)return;Se(de);break}}function it(de){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(de.preventDefault(),r.dispatchEvent(s),je(de),r.dispatchEvent(o))}function ht(de){r.enabled===!1||r.enablePan===!1||$e(de)}function Gt(de){switch(mt(de),k.length){case 1:switch(r.touches.ONE){case qf.ROTATE:if(r.enableRotate===!1)return;ue(),l=a.TOUCH_ROTATE;break;case qf.PAN:if(r.enablePan===!1)return;Z(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case qf.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Oe(),l=a.TOUCH_DOLLY_PAN;break;case qf.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;We(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Ke(de){switch(mt(de),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;tt(de),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;wt(de),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;J(de),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;$(de),r.update();break;default:l=a.NONE}}function re(de){r.enabled!==!1&&de.preventDefault()}function Qe(de){k.push(de)}function St(de){delete U[de.pointerId];for(let qe=0;qe{V(de),r.update()},this.dollyOut=(de=ne())=>{K(de),r.update()},this.getScale=()=>m,this.setScale=de=>{Q(de),r.update()},this.getZoomScale=()=>ne(),n!==void 0&&this.connect(n),this.update()}};const t_e=R.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},d)=>{const f=nd(N=>N.invalidate),m=nd(N=>N.camera),y=nd(N=>N.gl),x=nd(N=>N.events),S=nd(N=>N.setEvents),_=nd(N=>N.set),w=nd(N=>N.get),E=nd(N=>N.performance),T=e||m,C=r||x.connected||y.domElement,O=R.useMemo(()=>new e_e(T),[T]);return bG(()=>{O.enabled&&O.update()},-1),R.useEffect(()=>(s&&O.connect(s===!0?C:s),O.connect(C),()=>void O.dispose()),[s,C,n,O,f]),R.useEffect(()=>{const N=G=>{f(),n&&E.regress(),o&&o(G)},L=G=>{a&&a(G)},F=G=>{l&&l(G)};return O.addEventListener("change",N),O.addEventListener("start",L),O.addEventListener("end",F),()=>{O.removeEventListener("start",L),O.removeEventListener("end",F),O.removeEventListener("change",N)}},[o,a,l,O,f,S]),R.useEffect(()=>{if(t){const N=w().controls;return _({controls:O}),()=>_({controls:N})}},[t,O]),R.createElement("primitive",aP({ref:d,object:O,enableDamping:i},c))});function Wj(t,e){if(e===$V)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===O1||e===wR){let n=t.getIndex();if(n===null){const o=[],a=t.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const c=new L_e(s,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function r_e(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const bn={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class i_e{constructor(e){this.parser=e,this.name=bn.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,s.source,o)}}class y_e{constructor(e){this.parser=e,this.name=bn.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class x_e{constructor(e){this.parser=e,this.name=bn.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class b_e{constructor(e){this.name=bn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,f=i.byteStride,m=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,f,m,i.mode,i.filter).then(function(y){return y.buffer}):o.ready.then(function(){const y=new ArrayBuffer(d*f);return o.decodeGltfBuffer(new Uint8Array(y),d,f,m,i.mode,i.filter),y})})}else return null}}class __e{constructor(e){this.name=bn.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==Go.TRIANGLES&&c.mode!==Go.TRIANGLE_STRIP&&c.mode!==Go.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(l[c]=d,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),f=d.isGroup?d.children:[d],m=c[0].count,y=[];for(const x of f){const S=new kt,_=new X,w=new Jt,E=new X(1,1,1),T=new LR(x.geometry,x.material,m);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const O_e=new kt;class L_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new r_e,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new q6(this.options.manager):this.textureLoader=new nG(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Wa(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return Ff(s,a,i),Nc(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=n.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,d]of o.children.entries())s(d,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r=2&&_.setY(G,N[L*l+1]),l>=3&&_.setZ(G,N[L*l+2]),l>=4&&_.setW(G,N[L*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}_.normalized=x}return _})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,o=n.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,n,r){const i=this,s=this.json,o=s.textures[e],a=s.images[n],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const m=(s.samplers||{})[o.sampler]||{};return d.magFilter=Xj[m.magFilter]||Rr,d.minFilter=Xj[m.minFilter]||Yo,d.wrapS=qj[m.wrapS]||Pd,d.wrapT=qj[m.wrapT]||Pd,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,n){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(f){c=!0;const m=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(m),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(f){return new Promise(function(m,y){let x=m;n.isImageBitmapLoader===!0&&(x=function(S){const _=new hr(S);_.needsUpdate=!0,m(_)}),n.load(Md.resolveURL(f,s.path),x,void 0,y)})}).then(function(f){return c===!0&&a.revokeObjectURL(l),Nc(f,o),f.userData.mimeType=o.mimeType||k_e(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=d,d}assignTexture(e,n,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[bn.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[bn.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[bn.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[n]=o,o})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,o=n.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new sM,$r.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new qr,$r.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return vx}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[bn.KHR_MATERIALS_UNLIT]){const f=i[bn.KHR_MATERIALS_UNLIT];o=f.getMaterialType(),c.push(f.extendParams(a,s,n))}else{const f=s.pbrMetallicRoughness||{};if(a.color=new ut(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const m=f.baseColorFactor;a.color.setRGB(m[0],m[1],m[2],_i),a.opacity=m[3]}f.baseColorTexture!==void 0&&c.push(n.assignTexture(a,"map",f.baseColorTexture,Fi)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),o=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=bo);const d=s.alphaMode||eT.OPAQUE;if(d===eT.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===eT.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Cs&&(c.push(n.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ve(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;a.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&o!==Cs&&(c.push(n.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Cs){const f=s.emissiveFactor;a.emissive=new ut().setRGB(f[0],f[1],f[2],_i)}return s.emissiveTexture!==void 0&&o!==Cs&&c.push(n.assignTexture(a,"emissiveMap",s.emissiveTexture,Fi)),Promise.all(c).then(function(){const f=new o(a);return s.name&&(f.name=s.name),Nc(f,s),n.associations.set(f,{materials:e}),s.extensions&&Ff(i,f,s),f})}createUniqueName(e){const n=kn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[bn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,n).then(function(l){return Kj(l,a,n)})}const o=[];for(let a=0,l=e.length;a0&&N_e(w,s),w.name=n.createUniqueName(s.name||"mesh_"+e),Nc(w,s),_.extensions&&Ff(i,w,_),n.assignFinalMaterial(w),f.push(w)}for(let y=0,x=f.length;y1?d=new Ps:c.length===1?d=c[0]:d=new yn,d!==c[0])for(let f=0,m=c.length;f{const f=new Map;for(const[m,y]of i.associations)(m instanceof $r||m instanceof hr)&&f.set(m,y);return d.traverse(m=>{const y=i.associations.get(m);y!=null&&f.set(m,y)}),f};return i.associations=c(s),s})}_createAnimationTracks(e,n,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];rd[s.path]===rd.weights?e.traverse(function(m){m.morphTargetInfluences&&l.push(m.name?m.name:m.uuid)}):l.push(a);let c;switch(rd[s.path]){case rd.weights:c=Vh;break;case rd.rotation:c=Gh;break;case rd.position:case rd.scale:c=Wh;break;default:switch(r.itemSize){case 1:c=Vh;break;case 2:case 3:default:c=Wh;break}break}const d=i.interpolation!==void 0?C_e[i.interpolation]:Dg,f=this._getArrayFromAccessor(r);for(let m=0,y=l.length;m>>1,q=B[V];if(0>>1;Vi(ce,K))wei(Ee,ce)?(B[V]=Ee,B[we]=K,V=we):(B[V]=ce,B[ae]=K,V=ae);else if(wei(Ee,K))B[V]=Ee,B[we]=K,V=we;else break e}}return Q}function i(B,Q){var K=B.sortIndex-Q.sortIndex;return K!==0?K:B.id-Q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,g=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var Q=n(c);Q!==null;){if(Q.callback===null)r(c);else if(Q.startTime<=B)r(c),Q.sortIndex=Q.expirationTime,e(l,Q);else break;Q=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,ie(O);else{var Q=n(c);Q!==null&&fe(C,Q.startTime-B)}}function O(B,Q){x=!1,S&&(S=!1,b(F),F=-1),y=!0;var K=g;try{for(T(Q),f=n(l);f!==null&&(!(f.expirationTime>Q)||B&&!U());){var V=f.callback;if(typeof V=="function"){f.callback=null,g=f.priorityLevel;var q=V(f.expirationTime<=Q);Q=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(Q)}else r(l);f=n(l)}if(f!==null)var he=!0;else{var ae=n(c);ae!==null&&fe(C,ae.startTime-Q),he=!1}return he}finally{f=null,g=K,y=!1}}var N=!1,L=null,F=-1,G=5,k=-1;function U(){return!(t.unstable_now()-kB||125V?(B.sortIndex=K,e(c,B),n(l)===null&&B===n(c)&&(S?(b(F),F=-1):S=!0,fe(C,K-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,ie(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var Q=g;return function(){var K=g;g=Q;try{return B.apply(this,arguments)}finally{g=K}}}})(qA)),qA}var Pj;function Sbe(){return Pj||(Pj=1,XA.exports=wbe()),XA.exports}var Rj=Sbe();const aN={},Mbe=t=>void Object.assign(aN,t);function Ebe(t,e){function n(d,{args:f=[],attach:g,...y},x){let S=`${d[0].toUpperCase()}${d.slice(1)}`,w;if(d==="primitive"){if(y.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const b=y.object;w=zm(b,{type:d,root:x,attach:g,primitive:!0})}else{const b=aN[S];if(!b)throw new Error(`R3F: ${S} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(f))throw new Error("R3F: The args prop must be an array!");w=zm(new b(...f),{type:d,root:x,attach:g,memoizedProps:{args:f}})}return w.__r3f.attach===void 0&&(w.isBufferGeometry?w.__r3f.attach="geometry":w.isMaterial&&(w.__r3f.attach="material")),S!=="inject"&&ZA(w,y),w}function r(d,f){let g=!1;if(f){var y,x;(y=f.__r3f)!=null&&y.attach?YA(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),g=!0),g||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||zm(f,{}),f.__r3f.parent=d,uP(f),Bm(f)}}function i(d,f,g){let y=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)YA(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){f.parent=d,f.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:f});const w=d.children.filter(M=>M!==f),b=w.indexOf(g);d.children=[...w.slice(0,b),f,...w.slice(b)],y=!0}y||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||zm(f,{}),f.__r3f.parent=d,uP(f),Bm(f)}}function s(d,f,g=!1){d&&[...d].forEach(y=>o(f,y,g))}function o(d,f,g){if(f){var y,x,S;if(f.__r3f&&(f.__r3f.parent=null),(y=d.__r3f)!=null&&y.objects&&(d.__r3f.objects=d.__r3f.objects.filter(C=>C!==f)),(x=f.__r3f)!=null&&x.attach)Lj(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var w;d.remove(f),(w=f.__r3f)!=null&&w.root&&Ibe(Y_(f),f)}const M=(S=f.__r3f)==null?void 0:S.primitive,T=!M&&(g===void 0?f.dispose!==null:g);if(!M){var b;s((b=f.__r3f)==null?void 0:b.objects,f,T),s(f.children,f,T)}if(delete f.__r3f,T&&f.dispose&&f.type!=="Scene"){const C=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?Rj.unstable_scheduleCallback(Rj.unstable_IdlePriority,C):C()}Bm(d)}}function a(d,f,g,y){var x;const S=(x=d.__r3f)==null?void 0:x.parent;if(!S)return;const w=n(f,g,d.__r3f.root);if(d.children){for(const b of d.children)b.__r3f&&r(w,b);d.children=d.children.filter(b=>!b.__r3f)}d.__r3f.objects.forEach(b=>r(w,b)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(S,d),w.parent&&(w.__r3f.autoRemovedBeforeAppend=!0),r(S,w),w.raycast&&w.__r3f.eventCount&&Y_(w).getState().internal.interaction.push(w),[y,y.alternate].forEach(b=>{b!==null&&(b.stateNode=w,b.ref&&(typeof b.ref=="function"?b.ref(w):b.ref.current=w))})}const l=()=>{};return{reconciler:_be({createInstance:n,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const g=d.getState().scene;g.__r3f&&(g.__r3f.root=d,r(g,f))},removeChildFromContainer:(d,f)=>{f&&o(d.getState().scene,f)},insertInContainerBefore:(d,f,g)=>{if(!f||!g)return;const y=d.getState().scene;y.__r3f&&i(y,f,g)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,g,y){var x;if(((x=d==null?void 0:d.__r3f)!=null?x:{}).primitive&&y.object&&y.object!==d)return[!0];{const{args:w=[],children:b,...M}=y,{args:T=[],children:C,...O}=g;if(!Array.isArray(w))throw new Error("R3F: the args prop must be an array!");if(w.some((L,F)=>L!==T[F]))return[!0];const N=xG(d,M,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,g],y,x,S,w){f?a(d,y,S,w):ZA(d,g)},commitMount(d,f,g,y){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&Y_(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>zm(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:g,parent:y}=(f=d.__r3f)!=null?f:{};g&&y&&Lj(y,d,g),d.isObject3D&&(d.visible=!1),Bm(d)},unhideInstance(d,f){var g;const{attach:y,parent:x}=(g=d.__r3f)!=null?g:{};y&&x&&YA(x,d,y),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),Bm(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Ym.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&lr.fun(performance.now)?performance.now:lr.fun(Date.now)?Date.now:()=>0,scheduleTimeout:lr.fun(setTimeout)?setTimeout:void 0,cancelTimeout:lr.fun(clearTimeout)?clearTimeout:void 0}),applyProps:ZA}}var Nj,Ij;const KA=t=>"colorSpace"in t||"outputColorSpace"in t,hG=()=>{var t;return(t=aN.ColorManagement)!=null?t:null},pG=t=>t&&t.isOrthographicCamera,Abe=t=>t&&t.hasOwnProperty("current"),yx=typeof window<"u"&&((Nj=window.document)!=null&&Nj.createElement||((Ij=window.navigator)==null?void 0:Ij.product)==="ReactNative")?P.useLayoutEffect:P.useEffect;function mG(t){const e=P.useRef(t);return yx(()=>void(e.current=t),[t]),e}function Tbe({set:t}){return yx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class gG extends P.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}gG.getDerivedStateFromError=()=>({error:!0});const vG="__default",kj=new Map,Cbe=t=>t&&!!t.memoized&&!!t.changes;function yG(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const R0=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function Y_(t){let e=t.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const lr={obj:t=>t===Object(t)&&!lr.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:r="reference",strict:i=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(lr.str(t)||lr.num(t)||lr.boo(t))return t===e;const s=lr.obj(t);if(s&&r==="reference")return t===e;const o=lr.arr(t);if(o&&n==="reference")return t===e;if((o||s)&&t===e)return!0;let a;for(a in t)if(!(a in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(a in i?e:t)if(!lr.equ(t[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:t)if(t[a]!==e[a])return!1;if(lr.und(a)){if(o&&t.length===0&&e.length===0||s&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function Pbe(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function zm(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function cP(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((s,o)=>s[o],t),{target:n,key:i}}else return{target:n,key:e}}const Oj=/-\d+$/;function YA(t,e,n){if(lr.str(n)){if(Oj.test(n)){const s=n.replace(Oj,""),{target:o,key:a}=cP(t,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=cP(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function Lj(t,e,n){var r,i;if(lr.str(n)){const{target:s,key:o}=cP(t,n),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function xG(t,{children:e,key:n,ref:r,...i},{children:s,key:o,ref:a,...l}={},c=!1){const d=t.__r3f,f=Object.entries(i),g=[];if(c){const x=Object.keys(l);for(let S=0;S{var w;if((w=t.__r3f)!=null&&w.primitive&&x==="object"||lr.equ(S,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return g.push([x,S,!0,[]]);let b=[];x.includes("-")&&(b=x.split("-")),g.push([x,S,!1,b]);for(const M in i){const T=i[M];M.startsWith(`${x}-`)&&g.push([M,T,!1,M.split("-")])}});const y={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(y.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(y.attach=d.memoizedProps.attach),{memoized:y,changes:g}}function ZA(t,e){var n;const r=t.__r3f,i=r==null?void 0:r.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:a}=Cbe(e)?e:xG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=o);for(let g=0;gT[C],t),!(M&&M.set))){const[T,...C]=w.reverse();b=C.reverse().reduce((O,N)=>O[N],t),y=T}if(x===vG+"remove")if(b.constructor){let T=kj.get(b.constructor);T||(T=new b.constructor,kj.set(b.constructor,T)),x=T[y]}else x=0;if(S&&r)x?r.handlers[y]=x:delete r.handlers[y],r.eventCount=Object.keys(r.handlers).length;else if(M&&M.set&&(M.copy||M instanceof Ch)){if(Array.isArray(x))M.fromArray?M.fromArray(x):M.set(...x);else if(M.copy&&x&&x.constructor&&M.constructor===x.constructor)M.copy(x);else if(x!==void 0){var c;const T=(c=M)==null?void 0:c.isColor;!T&&M.setScalar?M.setScalar(x):M instanceof Ch&&x instanceof Ch?M.mask=x.mask:M.set(x),!hG()&&s&&!s.linear&&T&&M.convertSRGBToLinear()}}else{var d;if(b[y]=x,(d=b[y])!=null&&d.isTexture&&b[y].format===as&&b[y].type===Va&&s){const T=b[y];KA(T)&&KA(s.gl)?T.colorSpace=s.gl.outputColorSpace:T.encoding=s.gl.outputEncoding}}Bm(t)}if(r&&r.parent&&t.raycast&&l!==r.eventCount){const g=Y_(t).getState().internal,y=g.interaction.indexOf(t);y>-1&&g.interaction.splice(y,1),r.eventCount&&g.interaction.push(t)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(n=t.__r3f)!=null&&n.parent&&uP(t),t}function Bm(t){var e,n;const r=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();r&&r.internal.frames===0&&r.invalidate()}function uP(t){t.onUpdate==null||t.onUpdate(t)}function Rbe(t,e){t.manual||(pG(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function N_(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function Nbe(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Ym.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Ym.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Ym.ContinuousEventPriority;default:return Ym.DefaultEventPriority}}function bG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function Ibe(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(r=>r!==e),n.initialHits=n.initialHits.filter(r=>r!==e),n.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&n.hovered.delete(i)}),n.capturedMap.forEach((r,i)=>{bG(n.capturedMap,e,r,i)})}function kbe(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],f=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+f*f))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var f;return(f=c.__r3f)==null?void 0:f.handlers["onPointer"+d]}))}function r(l,c){const d=t.getState(),f=new Set,g=[],y=c?c(d.internal.interaction):d.internal.interaction;for(let b=0;b{const T=R0(b.object),C=R0(M.object);return!T||!C?b.distance-M.distance:C.events.priority-T.events.priority||b.distance-M.distance}).filter(b=>{const M=N_(b);return f.has(M)?!1:(f.add(M),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const b of S){let M=b.object;for(;M;){var w;(w=M.__r3f)!=null&&w.eventCount&&g.push({...b,eventObject:M}),M=M.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let b of d.internal.capturedMap.get(l.pointerId).values())f.has(N_(b.intersection))||g.push(b.intersection);return g}function i(l,c,d,f){const g=t.getState();if(l.length){const y={stopped:!1};for(const x of l){const S=R0(x.object)||g,{raycaster:w,pointer:b,camera:M,internal:T}=S,C=new X(b.x,b.y,0).unproject(M),O=k=>{var U,H;return(U=(H=T.capturedMap.get(k))==null?void 0:H.has(x.eventObject))!=null?U:!1},N=k=>{const U={intersection:x,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(x.eventObject,U):T.capturedMap.set(k,new Map([[x.eventObject,U]])),c.target.setPointerCapture(k)},L=k=>{const U=T.capturedMap.get(k);U&&bG(T.capturedMap,x.eventObject,U,k)};let F={};for(let k in c){let U=c[k];typeof U!="function"&&(F[k]=U)}let G={...x,...F,pointer:b,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:C,ray:w.ray,camera:M,stopPropagation(){const k="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!k||k.has(x.eventObject))&&(G.stopped=y.stopped=!0,T.hovered.size&&Array.from(T.hovered.values()).find(U=>U.eventObject===x.eventObject))){const U=l.slice(0,l.indexOf(x));s([...U,x])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:L},currentTarget:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:L},nativeEvent:c};if(f(G),y.stopped===!0)break}}return l}function s(l){const{internal:c}=t.getState();for(const d of c.hovered.values())if(!l.length||!l.find(f=>f.object===d.object&&f.index===d.index&&f.instanceId===d.instanceId)){const g=d.eventObject.__r3f,y=g==null?void 0:g.handlers;if(c.hovered.delete(N_(d)),g!=null&&g.eventCount){const x={...d,intersections:l};y.onPointerOut==null||y.onPointerOut(x),y.onPointerLeave==null||y.onPointerLeave(x)}}}function o(l,c){for(let d=0;ds([]);case"onLostPointerCapture":return c=>{const{internal:d}=t.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:f,internal:g}=t.getState();g.lastEvent.current=d;const y=l==="onPointerMove",x=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",w=r(d,y?n:void 0),b=x?e(d):0;l==="onPointerDown"&&(g.initialClick=[d.offsetX,d.offsetY],g.initialHits=w.map(T=>T.eventObject)),x&&!w.length&&b<=2&&(o(d,g.interaction),f&&f(d)),y&&s(w);function M(T){const C=T.eventObject,O=C.__r3f,N=O==null?void 0:O.handlers;if(O!=null&&O.eventCount)if(y){if(N.onPointerOver||N.onPointerEnter||N.onPointerOut||N.onPointerLeave){const L=N_(T),F=g.hovered.get(L);F?F.stopped&&T.stopPropagation():(g.hovered.set(L,T),N.onPointerOver==null||N.onPointerOver(T),N.onPointerEnter==null||N.onPointerEnter(T))}N.onPointerMove==null||N.onPointerMove(T)}else{const L=N[l];L?(!x||g.initialHits.includes(C))&&(o(d,g.interaction.filter(F=>!g.initialHits.includes(F))),L(T)):x&&g.initialHits.includes(C)&&o(d,g.interaction.filter(F=>!g.initialHits.includes(F)))}}i(w,d,b,M)}}return{handlePointer:a}}const _G=t=>!!(t!=null&&t.render),wG=P.createContext(null),Obe=(t,e)=>{const n=mbe((a,l)=>{const c=new X,d=new X,f=new X;function g(b=l().camera,M=d,T=l().size){const{width:C,height:O,top:N,left:L}=T,F=C/O;M.isVector3?f.copy(M):f.set(...M);const G=b.getWorldPosition(c).distanceTo(f);if(pG(b))return{width:C/b.zoom,height:O/b.zoom,top:N,left:L,factor:1,distance:G,aspect:F};{const k=b.fov*Math.PI/180,U=2*Math.tan(k/2)*G,H=U*(C/O);return{width:H,height:U,top:N,left:L,factor:C/H,distance:G,aspect:F}}}let y;const x=b=>a(M=>({performance:{...M.performance,current:b}})),S=new He;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(b=1)=>t(l(),b),advance:(b,M)=>e(b,M,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new nN,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const b=l();y&&clearTimeout(y),b.performance.current!==b.performance.min&&x(b.performance.min),y=setTimeout(()=>x(l().performance.max),b.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:g},setEvents:b=>a(M=>({...M,events:{...M.events,...b}})),setSize:(b,M,T,C,O)=>{const N=l().camera,L={width:b,height:M,top:C||0,left:O||0,updateStyle:T};a(F=>({size:L,viewport:{...F.viewport,...g(N,d,L)}}))},setDpr:b=>a(M=>{const T=yG(b);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(b="always")=>{const M=l().clock;M.stop(),M.elapsedTime=0,b!=="never"&&(M.start(),M.elapsedTime=0),a(()=>({frameloop:b}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:P.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(b,M,T)=>{const C=l().internal;return C.priority=C.priority+(M>0?1:0),C.subscribers.push({ref:b,priority:M,store:T}),C.subscribers=C.subscribers.sort((O,N)=>O.priority-N.priority),()=>{const O=l().internal;O!=null&&O.subscribers&&(O.priority=O.priority-(M>0?1:0),O.subscribers=O.subscribers.filter(N=>N.ref!==b))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return n.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:d,set:f}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){var g;i=l,s=c.dpr,Rbe(a,l),d.setPixelRatio(c.dpr);const y=(g=l.updateStyle)!=null?g:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,y)}a!==o&&(o=a,f(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};let I_,Lbe=new Set,Dbe=new Set,jbe=new Set;function QA(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function N0(t,e){switch(t){case"before":return QA(Lbe,e);case"after":return QA(Dbe,e);case"tail":return QA(jbe,e)}}let JA,eT;function tT(t,e,n){let r=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(r=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),JA=e.internal.subscribers,I_=0;I_0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(r+=tT(c,s))}if(n=!1,N0("after",c),r===0)return N0("tail",c),e=!1,cancelAnimationFrame(i)}function a(c,d=1){var f;if(!c)return t.forEach(g=>a(g.store.getState(),d));(f=c.gl.xr)!=null&&f.isPresenting||!c.internal.active||c.frameloop==="never"||(d>1?c.internal.frames=Math.min(60,c.internal.frames+d):n?c.internal.frames=2:c.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(c,d=!0,f,g){if(d&&N0("before",c),f)tT(c,f,g);else for(const y of t.values())tT(c,y.store.getState());d&&N0("after",c)}return{loop:o,invalidate:a,advance:l}}function SG(){const t=P.useContext(wG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function nd(t=n=>n,e){return SG()(t,e)}function MG(t,e=0){const n=SG(),r=n.getState().internal.subscribe,i=mG(t);return yx(()=>r(i,e,n),[e,r,n]),null}const Bg=new Map,{invalidate:Dj,advance:jj}=Ube(Bg),{reconciler:F1,applyProps:Im}=Ebe(Bg,Nbe),km={objects:"shallow",strict:!1},Fbe=(t,e)=>{const n=typeof t=="function"?t(e):t;return _G(n)?n:new S6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function zbe(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:o,updateStyle:a=n}=e;return{width:r,height:i,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:s,left:o}=t.parentElement.getBoundingClientRect();return{width:r,height:i,top:s,left:o,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function Bbe(t){const e=Bg.get(t),n=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||Obe(Dj,jj),o=n||F1.createContainer(s,Ym.ConcurrentRoot,null,!1,null,"",i,null);e||Bg.set(t,{fiber:o,store:s});let a,l=!1,c;return{configure(d={}){let{gl:f,size:g,scene:y,events:x,onCreated:S,shadows:w=!1,linear:b=!1,flat:M=!1,legacy:T=!1,orthographic:C=!1,frameloop:O="always",dpr:N=[1,2],performance:L,raycaster:F,camera:G,onPointerMissed:k}=d,U=s.getState(),H=U.gl;U.gl||U.set({gl:H=Fbe(f,t)});let te=U.raycaster;te||U.set({raycaster:te=new uG});const{params:ee,...pe}=F||{};if(lr.equ(pe,te,km)||Im(te,{...pe}),lr.equ(ee,te.params,km)||Im(te,{params:{...te.params,...ee}}),!U.camera||U.camera===c&&!lr.equ(c,G,km)){c=G;const K=G instanceof dx,V=K?G:C?new Xc(0,0,0,0,.1,1e3):new Nr(75,0,.1,1e3);K||(V.position.z=5,G&&(Im(V,G),("aspect"in G||"left"in G||"right"in G||"bottom"in G||"top"in G)&&(V.manual=!0,V.updateProjectionMatrix())),!U.camera&&!(G!=null&&G.rotation)&&V.lookAt(0,0,0)),U.set({camera:V}),te.camera=V}if(!U.scene){let K;y!=null&&y.isScene?K=y:(K=new DR,y&&Im(K,y)),U.set({scene:zm(K)})}if(!U.xr){var ie;const K=(he,ae)=>{const ce=s.getState();ce.frameloop!=="never"&&jj(he,!0,ce,ae)},V=()=>{const he=s.getState();he.gl.xr.enabled=he.gl.xr.isPresenting,he.gl.xr.setAnimationLoop(he.gl.xr.isPresenting?K:null),he.gl.xr.isPresenting||Dj(he)},q={connect(){const he=s.getState().gl;he.xr.addEventListener("sessionstart",V),he.xr.addEventListener("sessionend",V)},disconnect(){const he=s.getState().gl;he.xr.removeEventListener("sessionstart",V),he.xr.removeEventListener("sessionend",V)}};typeof((ie=H.xr)==null?void 0:ie.addEventListener)=="function"&&q.connect(),U.set({xr:q})}if(H.shadowMap){const K=H.shadowMap.enabled,V=H.shadowMap.type;if(H.shadowMap.enabled=!!w,lr.boo(w))H.shadowMap.type=K0;else if(lr.str(w)){var fe;const q={basic:xV,percentage:GS,soft:K0,variance:La};H.shadowMap.type=(fe=q[w])!=null?fe:K0}else lr.obj(w)&&Object.assign(H.shadowMap,w);(K!==H.shadowMap.enabled||V!==H.shadowMap.type)&&(H.shadowMap.needsUpdate=!0)}const B=hG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Im(H,{outputEncoding:b?3e3:3001,toneMapping:M?Pl:pR}),U.legacy!==T&&U.set(()=>({legacy:T})),U.linear!==b&&U.set(()=>({linear:b})),U.flat!==M&&U.set(()=>({flat:M})),f&&!lr.fun(f)&&!_G(f)&&!lr.equ(f,H,km)&&Im(H,f),x&&!U.events.handlers&&U.set({events:x(s)});const Q=zbe(t,g);return lr.equ(Q,U.size,km)||U.setSize(Q.width,Q.height,Q.updateStyle,Q.top,Q.left),N&&U.viewport.dpr!==yG(N)&&U.setDpr(N),U.frameloop!==O&&U.setFrameloop(O),U.onPointerMissed||U.set({onPointerMissed:k}),L&&!lr.equ(L,U.performance,km)&&U.set(K=>({performance:{...K.performance,...L}})),a=S,l=!0,this},render(d){return l||this.configure(),F1.updateContainer(p.jsx(Hbe,{store:s,children:d,onCreated:a,rootElement:t}),o,null,()=>{}),s},unmount(){EG(t)}}}function Hbe({store:t,children:e,onCreated:n,rootElement:r}){return yx(()=>{const i=t.getState();i.set(s=>({internal:{...s.internal,active:!0}})),n&&n(i),t.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),p.jsx(wG.Provider,{value:t,children:e})}function EG(t,e){const n=Bg.get(t),r=n==null?void 0:n.fiber;if(r){const i=n==null?void 0:n.store.getState();i&&(i.internal.active=!1),F1.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),Pbe(i),Bg.delete(t)}catch{}},500)})}}F1.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:P.version});const nT={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Vbe(t){const{handlePointer:e}=kbe(t);return{priority:1,enabled:!0,compute(n,r,i){r.pointer.set(n.offsetX/r.size.width*2-1,-(n.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(nT).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{var r;const{set:i,events:s}=t.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:n}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([o,a])=>{const[l,c]=nT[o];n.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,o])=>{if(r&&r.connected instanceof HTMLElement){const[a]=nT[s];r.connected.removeEventListener(a,o)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function Uj(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function Gbe({debounce:t,scroll:e,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=P.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=P.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=P.useRef(!1);P.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,g,y]=P.useMemo(()=>{const b=()=>{if(!a.current.element)return;const{left:M,top:T,width:C,height:O,bottom:N,right:L,x:F,y:G}=a.current.element.getBoundingClientRect(),k={left:M,top:T,width:C,height:O,bottom:N,right:L,x:F,y:G};a.current.element instanceof HTMLElement&&r&&(k.height=a.current.element.offsetHeight,k.width=a.current.element.offsetWidth),Object.freeze(k),d.current&&!qbe(a.current.lastBounds,k)&&o(a.current.lastBounds=k)};return[b,c?Uj(b,c):b,l?Uj(b,l):b]},[o,r,l,c]);function x(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(b=>b.removeEventListener("scroll",y,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function S(){a.current.element&&(a.current.resizeObserver=new i(y),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(b=>b.addEventListener("scroll",y,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const w=b=>{!b||b===a.current.element||(x(),a.current.element=b,a.current.scrollContainers=AG(b),S())};return $be(y,!!e),Wbe(g),P.useEffect(()=>{x(),S()},[e,y,g]),P.useEffect(()=>x,[]),[w,s,f]}function Wbe(t){P.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function $be(t,e){P.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function AG(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(t);return[n,r,i].some(s=>s==="auto"||s==="scroll")&&e.push(t),[...e,...AG(t.parentElement)]}const Xbe=["x","y","top","bottom","left","right","width","height"],qbe=(t,e)=>Xbe.every(n=>t[n]===e[n]);var Kbe=Object.defineProperty,Ybe=Object.defineProperties,Zbe=Object.getOwnPropertyDescriptors,Fj=Object.getOwnPropertySymbols,Qbe=Object.prototype.hasOwnProperty,Jbe=Object.prototype.propertyIsEnumerable,zj=(t,e,n)=>e in t?Kbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Bj=(t,e)=>{for(var n in e||(e={}))Qbe.call(e,n)&&zj(t,n,e[n]);if(Fj)for(var n of Fj(e))Jbe.call(e,n)&&zj(t,n,e[n]);return t},e_e=(t,e)=>Ybe(t,Zbe(e)),Hj,Vj;typeof window<"u"&&((Hj=window.document)!=null&&Hj.createElement||((Vj=window.navigator)==null?void 0:Vj.product)==="ReactNative")?P.useLayoutEffect:P.useEffect;function TG(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=TG(r,e,n);if(i)return i;r=r.sibling}}function CG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const Gj=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=Gj;return}return Gj.apply(this,arguments)};const lN=CG(P.createContext(null));class PG extends P.Component{render(){return P.createElement(lN.Provider,{value:this._reactInternals},this.props.children)}}function t_e(){const t=P.useContext(lN);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=P.useId();return P.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=TG(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[t,e])}function n_e(){const t=t_e(),[e]=P.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==lN&&!e.has(i)&&e.set(i,P.useContext(CG(i)))}n=n.return}return e}function r_e(){const t=n_e();return P.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>P.createElement(e,null,P.createElement(n.Provider,e_e(Bj({},r),{value:t.get(n)}))),e=>P.createElement(PG,Bj({},e))),[t])}const i_e=P.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:o=Vbe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:g,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:b,camera:M,scene:T,onPointerMissed:C,onCreated:O,...N},L){P.useMemo(()=>Mbe(ube),[]);const F=r_e(),[G,k]=Gbe({scroll:!0,debounce:{scroll:50,resize:0},...r}),U=P.useRef(null),H=P.useRef(null);P.useImperativeHandle(L,()=>U.current);const te=mG(C),[ee,pe]=P.useState(!1),[ie,fe]=P.useState(!1);if(ee)throw ee;if(ie)throw ie;const B=P.useRef(null);yx(()=>{const K=U.current;k.width>0&&k.height>0&&K&&(B.current||(B.current=Bbe(K)),B.current.configure({gl:s,events:o,shadows:c,linear:d,flat:f,legacy:g,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:b,camera:M,scene:T,size:k,onPointerMissed:(...V)=>te.current==null?void 0:te.current(...V),onCreated:V=>{V.events.connect==null||V.events.connect(a?Abe(a)?a.current:a:H.current),l&&V.setEvents({compute:(q,he)=>{const ae=q[l+"X"],ce=q[l+"Y"];he.pointer.set(ae/he.size.width*2-1,-(ce/he.size.height)*2+1),he.raycaster.setFromCamera(he.pointer,he.camera)}}),O==null||O(V)}}),B.current.render(p.jsx(F,{children:p.jsx(gG,{set:fe,children:p.jsx(P.Suspense,{fallback:p.jsx(Tbe,{set:pe}),children:e??null})})})))}),P.useEffect(()=>{const K=U.current;if(K)return()=>EG(K)},[]);const Q=a?"none":"auto";return p.jsx("div",{ref:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:Q,...i},...N,children:p.jsx("div",{ref:G,style:{width:"100%",height:"100%"},children:p.jsx("canvas",{ref:U,style:{display:"block"},children:n})})})}),s_e=P.forwardRef(function(e,n){return p.jsx(PG,{children:p.jsx(i_e,{...e,ref:n})})});function dP(){return dP=Object.assign?Object.assign.bind():function(t){for(var e=1;ee in t?o_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,l_e=(t,e,n)=>(a_e(t,e+"",n),n);class c_e{constructor(){l_e(this,"_listeners")}addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;se in t?u_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Zt=(t,e,n)=>(d_e(t,typeof e!="symbol"?e+"":e,n),n);const k_=new ep,Wj=new kc,f_e=Math.cos(70*(Math.PI/180)),$j=(t,e)=>(t%e+e)%e;let h_e=class extends c_e{constructor(e,n){super(),Zt(this,"object"),Zt(this,"domElement"),Zt(this,"enabled",!0),Zt(this,"target",new X),Zt(this,"minDistance",0),Zt(this,"maxDistance",1/0),Zt(this,"minZoom",0),Zt(this,"maxZoom",1/0),Zt(this,"minPolarAngle",0),Zt(this,"maxPolarAngle",Math.PI),Zt(this,"minAzimuthAngle",-1/0),Zt(this,"maxAzimuthAngle",1/0),Zt(this,"enableDamping",!1),Zt(this,"dampingFactor",.05),Zt(this,"enableZoom",!0),Zt(this,"zoomSpeed",1),Zt(this,"enableRotate",!0),Zt(this,"rotateSpeed",1),Zt(this,"enablePan",!0),Zt(this,"panSpeed",1),Zt(this,"screenSpacePanning",!0),Zt(this,"keyPanSpeed",7),Zt(this,"zoomToCursor",!1),Zt(this,"autoRotate",!1),Zt(this,"autoRotateSpeed",2),Zt(this,"reverseOrbit",!1),Zt(this,"reverseHorizontalOrbit",!1),Zt(this,"reverseVerticalOrbit",!1),Zt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Zt(this,"mouseButtons",{LEFT:qf.ROTATE,MIDDLE:qf.DOLLY,RIGHT:qf.PAN}),Zt(this,"touches",{ONE:Kf.ROTATE,TWO:Kf.DOLLY_PAN}),Zt(this,"target0"),Zt(this,"position0"),Zt(this,"zoom0"),Zt(this,"_domElementKeyEvents",null),Zt(this,"getPolarAngle"),Zt(this,"getAzimuthalAngle"),Zt(this,"setPolarAngle"),Zt(this,"setAzimuthalAngle"),Zt(this,"getDistance"),Zt(this,"getZoomScale"),Zt(this,"listenToKeyEvents"),Zt(this,"stopListenToKeyEvents"),Zt(this,"saveState"),Zt(this,"reset"),Zt(this,"update"),Zt(this,"connect"),Zt(this,"dispose"),Zt(this,"dollyIn"),Zt(this,"dollyOut"),Zt(this,"getScale"),Zt(this,"setScale"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=de=>{let qe=$j(de,2*Math.PI),le=d.phi;le<0&&(le+=2*Math.PI),qe<0&&(qe+=2*Math.PI);let Ye=Math.abs(qe-le);2*Math.PI-Ye{let qe=$j(de,2*Math.PI),le=d.theta;le<0&&(le+=2*Math.PI),qe<0&&(qe+=2*Math.PI);let Ye=Math.abs(qe-le);2*Math.PI-Yer.object.position.distanceTo(r.target),this.listenToKeyEvents=de=>{de.addEventListener("keydown",pt),this._domElementKeyEvents=de},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",pt),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=a.NONE},this.update=(()=>{const de=new X,qe=new X(0,1,0),le=new en().setFromUnitVectors(e.up,qe),Ye=le.clone().invert(),Te=new X,Fe=new en,st=2*Math.PI;return function(){const se=r.object.position;le.setFromUnitVectors(e.up,qe),Ye.copy(le).invert(),de.copy(se).sub(r.target),de.applyQuaternion(le),d.setFromVector3(de),r.autoRotate&&l===a.NONE&&ee(H()),r.enableDamping?(d.theta+=f.theta*r.dampingFactor,d.phi+=f.phi*r.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let We=r.minAzimuthAngle,it=r.maxAzimuthAngle;isFinite(We)&&isFinite(it)&&(We<-Math.PI?We+=st:We>Math.PI&&(We-=st),it<-Math.PI?it+=st:it>Math.PI&&(it-=st),We<=it?d.theta=Math.max(We,Math.min(it,d.theta)):d.theta=d.theta>(We+it)/2?Math.max(We,d.theta):Math.min(it,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(y,r.dampingFactor):r.target.add(y),r.zoomToCursor&&G||r.object.isOrthographicCamera?d.radius=he(d.radius):d.radius=he(d.radius*g),de.setFromSpherical(d),de.applyQuaternion(Ye),se.copy(r.target).add(de),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(f.theta*=1-r.dampingFactor,f.phi*=1-r.dampingFactor,y.multiplyScalar(1-r.dampingFactor)):(f.set(0,0,0),y.set(0,0,0));let dt=!1;if(r.zoomToCursor&&G){let Ht=null;if(r.object instanceof Nr&&r.object.isPerspectiveCamera){const _n=de.length();Ht=he(_n*g);const xn=_n-Ht;r.object.position.addScaledVector(L,xn),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const _n=new X(F.x,F.y,0);_n.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/g)),r.object.updateProjectionMatrix(),dt=!0;const xn=new X(F.x,F.y,0);xn.unproject(r.object),r.object.position.sub(xn).add(_n),r.object.updateMatrixWorld(),Ht=de.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Ht!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Ht).add(r.object.position):(k_.origin.copy(r.object.position),k_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(k_.direction))c||8*(1-Fe.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Te.copy(r.object.position),Fe.copy(r.object.quaternion),dt=!1,!0):!1}})(),this.connect=de=>{r.domElement=de,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",ne),r.domElement.addEventListener("pointerdown",Me),r.domElement.addEventListener("pointercancel",Be),r.domElement.addEventListener("wheel",rt)},this.dispose=()=>{var de,qe,le,Ye,Te,Fe;r.domElement&&(r.domElement.style.touchAction="auto"),(de=r.domElement)==null||de.removeEventListener("contextmenu",ne),(qe=r.domElement)==null||qe.removeEventListener("pointerdown",Me),(le=r.domElement)==null||le.removeEventListener("pointercancel",Be),(Ye=r.domElement)==null||Ye.removeEventListener("wheel",rt),(Te=r.domElement)==null||Te.ownerDocument.removeEventListener("pointermove",Ue),(Fe=r.domElement)==null||Fe.ownerDocument.removeEventListener("pointerup",Be),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",pt)};const r=this,i={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,d=new lP,f=new lP;let g=1;const y=new X,x=new He,S=new He,w=new He,b=new He,M=new He,T=new He,C=new He,O=new He,N=new He,L=new X,F=new He;let G=!1;const k=[],U={};function H(){return 2*Math.PI/60/60*r.autoRotateSpeed}function te(){return Math.pow(.95,r.zoomSpeed)}function ee(de){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=de:f.theta-=de}function pe(de){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=de:f.phi-=de}const ie=(()=>{const de=new X;return function(le,Ye){de.setFromMatrixColumn(Ye,0),de.multiplyScalar(-le),y.add(de)}})(),fe=(()=>{const de=new X;return function(le,Ye){r.screenSpacePanning===!0?de.setFromMatrixColumn(Ye,1):(de.setFromMatrixColumn(Ye,0),de.crossVectors(r.object.up,de)),de.multiplyScalar(le),y.add(de)}})(),B=(()=>{const de=new X;return function(le,Ye){const Te=r.domElement;if(Te&&r.object instanceof Nr&&r.object.isPerspectiveCamera){const Fe=r.object.position;de.copy(Fe).sub(r.target);let st=de.length();st*=Math.tan(r.object.fov/2*Math.PI/180),ie(2*le*st/Te.clientHeight,r.object.matrix),fe(2*Ye*st/Te.clientHeight,r.object.matrix)}else Te&&r.object instanceof Xc&&r.object.isOrthographicCamera?(ie(le*(r.object.right-r.object.left)/r.object.zoom/Te.clientWidth,r.object.matrix),fe(Ye*(r.object.top-r.object.bottom)/r.object.zoom/Te.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function Q(de){r.object instanceof Nr&&r.object.isPerspectiveCamera||r.object instanceof Xc&&r.object.isOrthographicCamera?g=de:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function K(de){Q(g/de)}function V(de){Q(g*de)}function q(de){if(!r.zoomToCursor||!r.domElement)return;G=!0;const qe=r.domElement.getBoundingClientRect(),le=de.clientX-qe.left,Ye=de.clientY-qe.top,Te=qe.width,Fe=qe.height;F.x=le/Te*2-1,F.y=-(Ye/Fe)*2+1,L.set(F.x,F.y,1).unproject(r.object).sub(r.object.position).normalize()}function he(de){return Math.max(r.minDistance,Math.min(r.maxDistance,de))}function ae(de){x.set(de.clientX,de.clientY)}function ce(de){q(de),C.set(de.clientX,de.clientY)}function we(de){b.set(de.clientX,de.clientY)}function Ee(de){S.set(de.clientX,de.clientY),w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const qe=r.domElement;qe&&(ee(2*Math.PI*w.x/qe.clientHeight),pe(2*Math.PI*w.y/qe.clientHeight)),x.copy(S),r.update()}function Xe(de){O.set(de.clientX,de.clientY),N.subVectors(O,C),N.y>0?K(te()):N.y<0&&V(te()),C.copy(O),r.update()}function Se(de){M.set(de.clientX,de.clientY),T.subVectors(M,b).multiplyScalar(r.panSpeed),B(T.x,T.y),b.copy(M),r.update()}function je(de){q(de),de.deltaY<0?V(te()):de.deltaY>0&&K(te()),r.update()}function $e(de){let qe=!1;switch(de.code){case r.keys.UP:B(0,r.keyPanSpeed),qe=!0;break;case r.keys.BOTTOM:B(0,-r.keyPanSpeed),qe=!0;break;case r.keys.LEFT:B(r.keyPanSpeed,0),qe=!0;break;case r.keys.RIGHT:B(-r.keyPanSpeed,0),qe=!0;break}qe&&(de.preventDefault(),r.update())}function ue(){if(k.length==1)x.set(k[0].pageX,k[0].pageY);else{const de=.5*(k[0].pageX+k[1].pageX),qe=.5*(k[0].pageY+k[1].pageY);x.set(de,qe)}}function Z(){if(k.length==1)b.set(k[0].pageX,k[0].pageY);else{const de=.5*(k[0].pageX+k[1].pageX),qe=.5*(k[0].pageY+k[1].pageY);b.set(de,qe)}}function Ve(){const de=k[0].pageX-k[1].pageX,qe=k[0].pageY-k[1].pageY,le=Math.sqrt(de*de+qe*qe);C.set(0,le)}function Oe(){r.enableZoom&&Ve(),r.enablePan&&Z()}function Ge(){r.enableZoom&&Ve(),r.enableRotate&&ue()}function et(de){if(k.length==1)S.set(de.pageX,de.pageY);else{const le=Jt(de),Ye=.5*(de.pageX+le.x),Te=.5*(de.pageY+le.y);S.set(Ye,Te)}w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const qe=r.domElement;qe&&(ee(2*Math.PI*w.x/qe.clientHeight),pe(2*Math.PI*w.y/qe.clientHeight)),x.copy(S)}function St(de){if(k.length==1)M.set(de.pageX,de.pageY);else{const qe=Jt(de),le=.5*(de.pageX+qe.x),Ye=.5*(de.pageY+qe.y);M.set(le,Ye)}T.subVectors(M,b).multiplyScalar(r.panSpeed),B(T.x,T.y),b.copy(M)}function ft(de){const qe=Jt(de),le=de.pageX-qe.x,Ye=de.pageY-qe.y,Te=Math.sqrt(le*le+Ye*Ye);O.set(0,Te),N.set(0,Math.pow(O.y/C.y,r.zoomSpeed)),K(N.y),C.copy(O)}function J(de){r.enableZoom&&ft(de),r.enablePan&&St(de)}function $(de){r.enableZoom&&ft(de),r.enableRotate&&et(de)}function Me(de){var qe,le;r.enabled!==!1&&(k.length===0&&((qe=r.domElement)==null||qe.ownerDocument.addEventListener("pointermove",Ue),(le=r.domElement)==null||le.ownerDocument.addEventListener("pointerup",Be)),Qe(de),de.pointerType==="touch"?Wt(de):ze(de))}function Ue(de){r.enabled!==!1&&(de.pointerType==="touch"?Ke(de):wt(de))}function Be(de){var qe,le,Ye;Mt(de),k.length===0&&((qe=r.domElement)==null||qe.releasePointerCapture(de.pointerId),(le=r.domElement)==null||le.ownerDocument.removeEventListener("pointermove",Ue),(Ye=r.domElement)==null||Ye.ownerDocument.removeEventListener("pointerup",Be)),r.dispatchEvent(o),l=a.NONE}function ze(de){let qe;switch(de.button){case 0:qe=r.mouseButtons.LEFT;break;case 1:qe=r.mouseButtons.MIDDLE;break;case 2:qe=r.mouseButtons.RIGHT;break;default:qe=-1}switch(qe){case qf.DOLLY:if(r.enableZoom===!1)return;ce(de),l=a.DOLLY;break;case qf.ROTATE:if(de.ctrlKey||de.metaKey||de.shiftKey){if(r.enablePan===!1)return;we(de),l=a.PAN}else{if(r.enableRotate===!1)return;ae(de),l=a.ROTATE}break;case qf.PAN:if(de.ctrlKey||de.metaKey||de.shiftKey){if(r.enableRotate===!1)return;ae(de),l=a.ROTATE}else{if(r.enablePan===!1)return;we(de),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function wt(de){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;Ee(de);break;case a.DOLLY:if(r.enableZoom===!1)return;Xe(de);break;case a.PAN:if(r.enablePan===!1)return;Se(de);break}}function rt(de){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(de.preventDefault(),r.dispatchEvent(s),je(de),r.dispatchEvent(o))}function pt(de){r.enabled===!1||r.enablePan===!1||$e(de)}function Wt(de){switch(yt(de),k.length){case 1:switch(r.touches.ONE){case Kf.ROTATE:if(r.enableRotate===!1)return;ue(),l=a.TOUCH_ROTATE;break;case Kf.PAN:if(r.enablePan===!1)return;Z(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case Kf.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Oe(),l=a.TOUCH_DOLLY_PAN;break;case Kf.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Ge(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Ke(de){switch(yt(de),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;et(de),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;St(de),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;J(de),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;$(de),r.update();break;default:l=a.NONE}}function ne(de){r.enabled!==!1&&de.preventDefault()}function Qe(de){k.push(de)}function Mt(de){delete U[de.pointerId];for(let qe=0;qe{V(de),r.update()},this.dollyOut=(de=te())=>{K(de),r.update()},this.getScale=()=>g,this.setScale=de=>{Q(de),r.update()},this.getZoomScale=()=>te(),n!==void 0&&this.connect(n),this.update()}};const p_e=P.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},d)=>{const f=nd(N=>N.invalidate),g=nd(N=>N.camera),y=nd(N=>N.gl),x=nd(N=>N.events),S=nd(N=>N.setEvents),w=nd(N=>N.set),b=nd(N=>N.get),M=nd(N=>N.performance),T=e||g,C=r||x.connected||y.domElement,O=P.useMemo(()=>new h_e(T),[T]);return MG(()=>{O.enabled&&O.update()},-1),P.useEffect(()=>(s&&O.connect(s===!0?C:s),O.connect(C),()=>void O.dispose()),[s,C,n,O,f]),P.useEffect(()=>{const N=G=>{f(),n&&M.regress(),o&&o(G)},L=G=>{a&&a(G)},F=G=>{l&&l(G)};return O.addEventListener("change",N),O.addEventListener("start",L),O.addEventListener("end",F),()=>{O.removeEventListener("start",L),O.removeEventListener("end",F),O.removeEventListener("change",N)}},[o,a,l,O,f,S]),P.useEffect(()=>{if(t){const N=b().controls;return w({controls:O}),()=>w({controls:N})}},[t,O]),P.createElement("primitive",dP({ref:d,object:O,enableDamping:i},c))});function Xj(t,e){if(e===YV)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===L1||e===ER){let n=t.getIndex();if(n===null){const o=[],a=t.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const c=new q_e(s,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function g_e(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const bn={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class v_e{constructor(e){this.parser=e,this.name=bn.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,s.source,o)}}class N_e{constructor(e){this.parser=e,this.name=bn.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class I_e{constructor(e){this.parser=e,this.name=bn.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class k_e{constructor(e){this.name=bn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,f=i.byteStride,g=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,f,g,i.mode,i.filter).then(function(y){return y.buffer}):o.ready.then(function(){const y=new ArrayBuffer(d*f);return o.decodeGltfBuffer(new Uint8Array(y),d,f,g,i.mode,i.filter),y})})}else return null}}class O_e{constructor(e){this.name=bn.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==$o.TRIANGLES&&c.mode!==$o.TRIANGLE_STRIP&&c.mode!==$o.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(l[c]=d,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),f=d.isGroup?d.children:[d],g=c[0].count,y=[];for(const x of f){const S=new kt,w=new X,b=new en,M=new X(1,1,1),T=new UR(x.geometry,x.material,g);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const X_e=new kt;class q_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new g_e,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new Q6(this.options.manager):this.textureLoader=new oG(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Wa(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return zf(s,a,i),Nc(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=n.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,d]of o.children.entries())s(d,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r=2&&w.setY(G,N[L*l+1]),l>=3&&w.setZ(G,N[L*l+2]),l>=4&&w.setW(G,N[L*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}w.normalized=x}return w})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,o=n.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,n,r){const i=this,s=this.json,o=s.textures[e],a=s.images[n],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const g=(s.samplers||{})[o.sampler]||{};return d.magFilter=Kj[g.magFilter]||Ir,d.minFilter=Kj[g.minFilter]||Zo,d.wrapS=Yj[g.wrapS]||Pd,d.wrapT=Yj[g.wrapT]||Pd,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,n){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(f){c=!0;const g=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(g),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(f){return new Promise(function(g,y){let x=g;n.isImageBitmapLoader===!0&&(x=function(S){const w=new mr(S);w.needsUpdate=!0,g(w)}),n.load(Md.resolveURL(f,s.path),x,void 0,y)})}).then(function(f){return c===!0&&a.revokeObjectURL(l),Nc(f,o),f.userData.mimeType=o.mimeType||$_e(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=d,d}assignTexture(e,n,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[bn.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[bn.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[bn.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[n]=o,o})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,o=n.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new aM,Xr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Kr,Xr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return vx}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[bn.KHR_MATERIALS_UNLIT]){const f=i[bn.KHR_MATERIALS_UNLIT];o=f.getMaterialType(),c.push(f.extendParams(a,s,n))}else{const f=s.pbrMetallicRoughness||{};if(a.color=new ut(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const g=f.baseColorFactor;a.color.setRGB(g[0],g[1],g[2],Si),a.opacity=g[3]}f.baseColorTexture!==void 0&&c.push(n.assignTexture(a,"map",f.baseColorTexture,zi)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),o=this._invokeOne(function(g){return g.getMaterialType&&g.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(g){return g.extendMaterialParams&&g.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=wo);const d=s.alphaMode||iT.OPAQUE;if(d===iT.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===iT.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Cs&&(c.push(n.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new He(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;a.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&o!==Cs&&(c.push(n.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Cs){const f=s.emissiveFactor;a.emissive=new ut().setRGB(f[0],f[1],f[2],Si)}return s.emissiveTexture!==void 0&&o!==Cs&&c.push(n.assignTexture(a,"emissiveMap",s.emissiveTexture,zi)),Promise.all(c).then(function(){const f=new o(a);return s.name&&(f.name=s.name),Nc(f,s),n.associations.set(f,{materials:e}),s.extensions&&zf(i,f,s),f})}createUniqueName(e){const n=On.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[bn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,n).then(function(l){return Zj(l,a,n)})}const o=[];for(let a=0,l=e.length;a0&&G_e(b,s),b.name=n.createUniqueName(s.name||"mesh_"+e),Nc(b,s),w.extensions&&zf(i,b,w),n.assignFinalMaterial(b),f.push(b)}for(let y=0,x=f.length;y1?d=new Ps:c.length===1?d=c[0]:d=new vn,d!==c[0])for(let f=0,g=c.length;f{const f=new Map;for(const[g,y]of i.associations)(g instanceof Xr||g instanceof mr)&&f.set(g,y);return d.traverse(g=>{const y=i.associations.get(g);y!=null&&f.set(g,y)}),f};return i.associations=c(s),s})}_createAnimationTracks(e,n,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];rd[s.path]===rd.weights?e.traverse(function(g){g.morphTargetInfluences&&l.push(g.name?g.name:g.uuid)}):l.push(a);let c;switch(rd[s.path]){case rd.weights:c=Gh;break;case rd.rotation:c=Wh;break;case rd.position:case rd.scale:c=$h;break;default:switch(r.itemSize){case 1:c=Gh;break;case 2:case 3:default:c=$h;break}break}const d=i.interpolation!==void 0?B_e[i.interpolation]:Dg,f=this._getArrayFromAccessor(r);for(let g=0,y=l.length;gnew Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),zn=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),Yj=class extends yn{constructor(t){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${t}`,this.expressionName=t,this.type="VRMExpression",this.visible=!1}get binds(){return this._binds}get overrideBlinkAmount(){return this.overrideBlink==="block"?0.5?1:0:this.weight}addBind(t){this._binds.push(t)}deleteBind(t){const e=this._binds.indexOf(t);e>=0&&this._binds.splice(e,1)}applyWeight(t){var e;let n=this.outputWeight;n*=(e=t==null?void 0:t.multiplier)!=null?e:1,this.isBinary&&n<1&&(n=0),this._binds.forEach(r=>r.applyWeight(n))}clearAppliedWeight(){this._binds.forEach(t=>t.clearAppliedWeight())}};function CG(t,e,n){var r,i;const s=t.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,d=[];return n.traverse(f=>{d.length{const s=CG(t,i,r);s!=null&&n.set(i,s)}),n})}var uP={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function PG(t){return Math.max(Math.min(t,1),0)}var Jj=class RG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},n=new Set(Object.values(uP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(uP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new RG().copy(this)}getExpression(e){var n;return(n=this._expressionMap[e])!=null?n:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const n=this._expressions.indexOf(e);n===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(n,1),delete this._expressionMap[e.expressionName]}getValue(e){var n;const r=this.getExpression(e);return(n=r==null?void 0:r.weight)!=null?n:null}setValue(e,n){const r=this.getExpression(e);r&&(r.weight=PG(n))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const n=this.getExpression(e);return n?`${n.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(n=>{n.clearAppliedWeight()}),this._expressions.forEach(n=>{let r=1;const i=n.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),n.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,n=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,n-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),n=Math.max(0,n),r=Math.max(0,r),{blink:e,lookAt:n,mouth:r}}},k0={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},j_e={_Color:k0.Color,_EmissionColor:k0.EmissionColor,_ShadeColor:k0.ShadeColor,_RimColor:k0.RimColor,_OutlineColor:k0.OutlineColor},U_e=new ut,NG=class IG{constructor({material:e,type:n,targetValue:r,targetAlpha:i}){this.material=e,this.type=n,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:n,alpha:r}=this._state;if(n!=null){const{propertyName:i,deltaValue:s}=n,o=this.material[i];o!=null&&o.add(U_e.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:n}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(n!=null){const{propertyName:r,initialValue:i}=n;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,n,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?n:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const d=i[l].clone(),f=new ut(o.r-d.r,o.g-d.g,o.b-d.b);return{propertyName:l,initialValue:d,deltaValue:f}}_initAlphaBindState(){var e,n,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?n:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],d=o-c;return{propertyName:l,initialValue:c,deltaValue:d}}_getPropertyNameMap(){var e,n;return(n=(e=Object.entries(IG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};NG._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var eU=NG,F1=class{constructor({primitives:t,index:e,weight:n}){this.primitives=t,this.index=e,this.weight=n}applyWeight(t){this.primitives.forEach(e=>{var n;((n=e.morphTargetInfluences)==null?void 0:n[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*t)})}clearAppliedWeight(){this.primitives.forEach(t=>{var e;((e=t.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(t.morphTargetInfluences[this.index]=0)})}},tU=new Ve,kG=class OG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const o=(i=Object.entries(OG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const d=c.offset.clone(),f=c.repeat.clone(),m=r.clone().sub(d),y=n.clone().sub(f);this._properties.push({name:a,initialOffset:d,deltaOffset:m,initialScale:f,deltaScale:y})}))}applyWeight(e){this._properties.forEach(n=>{const r=this.material[n.name];r!==void 0&&(r.offset.add(tU.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(tU.copy(n.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const n=this.material[e.name];n!==void 0&&(n.offset.copy(e.initialOffset),n.repeat.copy(e.initialScale))})}};kG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var nU=kG,F_e=new Set(["1.0","1.0-beta"]),LG=class DG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return zn(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return zn(this,null,function*(){const n=yield this._v1Import(e);if(n)return n;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return zn(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!F_e.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(uP)),d=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([m,y])=>{if(y!=null){if(!c.has(m)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${m}" detected. Ignoring the expression`);return}d.set(m,y)}}),l.custom!=null&&Object.entries(l.custom).forEach(([m,y])=>{if(c.has(m)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${m}". Ignoring the expression`);return}d.set(m,y)});const f=new Jj;return yield Promise.all(Array.from(d.entries()).map(m=>zn(this,[m],function*([y,x]){var S,_,w,E,T,C,O;const N=new Yj(y);if(e.scene.add(N),N.isBinary=(S=x.isBinary)!=null?S:!1,N.overrideBlink=(_=x.overrideBlink)!=null?_:"none",N.overrideLookAt=(w=x.overrideLookAt)!=null?w:"none",N.overrideMouth=(E=x.overrideMouth)!=null?E:"none",(T=x.morphTargetBinds)==null||T.forEach(L=>zn(this,null,function*(){var F;if(L.node===void 0||L.index===void 0)return;const G=yield Zj(e,L.node),k=L.index;if(!G.every(U=>Array.isArray(U.morphTargetInfluences)&&k{const G=F.material;G&&(Array.isArray(G)?L.push(...G):L.push(G))}),(C=x.materialColorBinds)==null||C.forEach(F=>zn(this,null,function*(){L.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{N.addBind(new eU({material:k,type:F.type,targetValue:new ut().fromArray(F.targetValue),targetAlpha:F.targetValue[3]}))})})),(O=x.textureTransformBinds)==null||O.forEach(F=>zn(this,null,function*(){L.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{var U,H;N.addBind(new nU({material:k,offset:new Ve().fromArray((U=F.offset)!=null?U:[0,0]),scale:new Ve().fromArray((H=F.scale)!=null?H:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return zn(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new Jj,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>zn(this,null,function*(){var d;const f=c.presetName,m=f!=null&&DG.v0v1PresetNameMap[f]||null,y=m??c.name;if(y==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(y)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${f} has duplicated entries. Ignoring the expression`);return}l.add(y);const x=new Yj(y);e.scene.add(x),x.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(_=>zn(this,null,function*(){var w;if(_.mesh===void 0||_.index===void 0)return;const E=[];if((w=r.nodes)==null||w.forEach((C,O)=>{C.mesh===_.mesh&&E.push(O)}),E.length===0){console.warn(`VRMExpressionLoaderPlugin: ${c.name} attempts to bind a morph target to the mesh #${_.mesh} but the mesh is not found or not used in the scene. Ignoring the bind.`);return}const T=_.index;yield Promise.all(E.map(C=>zn(this,null,function*(){var O;const N=yield Zj(e,C);if(!N.every(L=>Array.isArray(L.morphTargetInfluences)&&T{if(_.materialName===void 0||_.propertyName===void 0||_.targetValue===void 0)return;const w=[];e.scene.traverse(T=>{if(T.material){const C=T.material;Array.isArray(C)?w.push(...C.filter(O=>(O.name===_.materialName||O.name===_.materialName+" (Outline)")&&w.indexOf(O)===-1)):C.name===_.materialName&&w.indexOf(C)===-1&&w.push(C)}});const E=_.propertyName;w.forEach(T=>{if(E==="_MainTex_ST"){const O=new Ve(_.targetValue[0],_.targetValue[1]),N=new Ve(_.targetValue[2],_.targetValue[3]);N.y=1-N.y-O.y,x.addBind(new nU({material:T,scale:O,offset:N}));return}const C=j_e[E];if(C){x.addBind(new eU({material:T,type:C,targetValue:new ut().fromArray(_.targetValue),targetAlpha:_.targetValue[3]}));return}console.warn(E+" is not supported")})}),o.registerExpression(x)}))),o})}};LG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var z_e=LG,oN=class Hm{constructor(e,n){this._firstPersonOnlyLayer=Hm.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Hm.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=n}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(n=>({meshes:n.meshes.concat(),type:n.type})),this}clone(){return new Hm(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Hm.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:n=Hm.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=n,this.meshAnnotations.forEach(r=>{r.meshes.forEach(i=>{r.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,n,r,i){let s=0;if(n!=null&&n.length>0)for(let o=0;o0&&i.includes(f[0])||d[1]>0&&i.includes(f[1])||d[2]>0&&i.includes(f[2])||d[3]>0&&i.includes(f[3]))continue;const m=n[l],y=r[l];if(m[0]>0&&i.includes(y[0])||m[1]>0&&i.includes(y[1])||m[2]>0&&i.includes(y[2])||m[3]>0&&i.includes(y[3]))continue;const x=n[c],S=r[c];x[0]>0&&i.includes(S[0])||x[1]>0&&i.includes(S[1])||x[2]>0&&i.includes(S[2])||x[3]>0&&i.includes(S[3])||(e[s++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,n){const r=new rM(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),o=s instanceof nP?[]:s.array,a=[];for(let S=0;S{this._isEraseTarget(s)&&r.push(o)}),!r.length){n.layers.enable(this._thirdPersonOnlyLayer),n.layers.enable(this._firstPersonOnlyLayer);return}n.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(n,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer));else{const n=new Ps;n.name=`_headless_${e.name}`,n.layers.set(this._firstPersonOnlyLayer),e.parent.add(n),e.children.filter(r=>r.type==="SkinnedMesh").forEach(r=>{const i=r;this._createHeadlessModelForSkinnedMesh(n,i)})}else if(e.type==="SkinnedMesh"){const n=e;this._createHeadlessModelForSkinnedMesh(e.parent,n)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};oN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;oN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var rU=oN,B_e=new Set(["1.0","1.0-beta"]),H_e=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return zn(this,null,function*(){const e=t.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");t.userData.vrmFirstPerson=yield this._import(t,e)}})}_import(t,e){return zn(this,null,function*(){if(e==null)return null;const n=yield this._v1Import(t,e);if(n)return n;const r=yield this._v0Import(t,e);return r||null})}_v1Import(t,e){return zn(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!B_e.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,c=[],d=yield Qj(t);return Array.from(d.entries()).forEach(([f,m])=>{var y,x;const S=(y=l==null?void 0:l.meshAnnotations)==null?void 0:y.find(_=>_.node===f);c.push({meshes:m,type:(x=S==null?void 0:S.type)!=null?x:"auto"})}),new rU(e,c)})}_v0Import(t,e){return zn(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield Qj(t);return Array.from(a.entries()).forEach(([l,c])=>{const d=r.nodes[l],f=s.meshAnnotations?s.meshAnnotations.find(m=>m.mesh===d.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new rU(e,o)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},iU=new X,sU=new X,V_e=new Jt,oU=class extends Ps{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new lG(1);n.matrixAutoUpdate=!1,n.material.depthTest=!1,n.material.depthWrite=!1,this.add(n),this._boneAxesMap.set(e,n)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(t=>{t.geometry.dispose(),t.material.dispose()})}updateMatrixWorld(t){Array.from(this._boneAxesMap.entries()).forEach(([e,n])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(iU,V_e,sU);const r=iU.set(.1,.1,.1).divide(sU);n.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(t)}},nT=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],G_e={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function jG(t){return t.invert?t.invert():t.inverse(),t}var zf=new X,Bf=new Jt,dP=class{constructor(t){this.humanBones=t,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);r&&(zf.copy(r.position),Bf.copy(r.quaternion),t[n]={position:zf.toArray(),rotation:Bf.toArray()})}),t}getPose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);if(!r)return;zf.set(0,0,0),Bf.identity();const i=this.restPose[n];i!=null&&i.position&&zf.fromArray(i.position).negate(),i!=null&&i.rotation&&jG(Bf.fromArray(i.rotation)),zf.add(r.position),Bf.premultiply(r.quaternion),t[n]={position:zf.toArray(),rotation:Bf.toArray()}}),t}setPose(t){Object.entries(t).forEach(([e,n])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(n!=null&&n.position&&(i.position.fromArray(n.position),s.position&&i.position.add(zf.fromArray(s.position))),n!=null&&n.rotation&&(i.quaternion.fromArray(n.rotation),s.rotation&&i.quaternion.multiply(Bf.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([t,e])=>{const n=this.getBoneNode(t);n&&(e!=null&&e.position&&n.position.fromArray(e.position),e!=null&&e.rotation&&n.quaternion.fromArray(e.rotation))})}getBone(t){var e;return(e=this.humanBones[t])!=null?e:void 0}getBoneNode(t){var e,n;return(n=(e=this.humanBones[t])==null?void 0:e.node)!=null?n:null}},rT=new X,W_e=new Jt,$_e=new X,aU=class UG extends dP{static _setupTransforms(e){const n=new yn;n.name="VRMHumanoidRig";const r={},i={},s={};nT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=new X,f=new Jt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(d,f,rT),r[a]=d,i[a]=c.quaternion.clone();const m=new Jt;(l=c.parent)==null||l.matrixWorld.decompose(rT,m,rT),s[a]=m}});const o={};return nT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=r[a];let f=a,m;for(;m==null&&(f=G_e[f],f!=null);)m=r[f];const y=new yn;y.name="Normalized_"+c.name,(f?(l=o[f])==null?void 0:l.node:n).add(y),y.position.copy(d),m&&y.position.sub(m),o[a]={node:y}}}),{rigBones:o,root:n,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:s}=UG._setupTransforms(e);super(n),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){nT.forEach(e=>{const n=this.original.getBoneNode(e);if(n!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=W_e.copy(i).invert(),o=this._boneRotations[e];if(n.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition($_e);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=a.applyMatrix4(l.invert());n.position.copy(c)}}})}},lU=class FG{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,n){var r;this.autoUpdateHumanBones=(r=n==null?void 0:n.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new dP(e),this._normalizedHumanBones=new aU(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new dP(e.humanBones),this._normalizedHumanBones=new aU(this._rawHumanBones),this}clone(){return new FG(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},X_e={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},q_e=new Set(["1.0","1.0-beta"]),cU={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},K_e=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(t){return zn(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return zn(this,null,function*(){const e=yield this._v1Import(t);if(e)return e;const n=yield this._v0Import(t);return n||null})}_v1Import(t){return zn(this,null,function*(){var e,n;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(n=r.extensions)==null?void 0:n.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!q_e.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(f=>zn(this,[f],function*([m,y]){let x=m;const S=y.node;if(l){const w=cU[x];w!=null&&(x=w)}const _=yield this.parser.getDependency("node",S);if(_==null){console.warn(`A glTF node bound to the humanoid bone ${x} (index = ${S}) does not exist`);return}c[x]={node:_}}))));const d=new lU(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new oU(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return zn(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>zn(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;if(c<0){console.warn(`A glTF node index for the humanoid bone ${l} is negative (${c}), ignoring this bone.`);return}const d=yield this.parser.getDependency("node",c);if(d==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const f=cU[l],m=f??l;if(s[m]!=null){console.warn(`Multiple bone entries for ${m} detected (index = ${c}), ignoring duplicated entries.`);return}s[m]={node:d}}))));const o=new lU(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new oU(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(t){const e=Object.values(X_e).filter(n=>t[n]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return t}},uU=class extends tn{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new nn(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nn(new Uint16Array(189),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,t=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let t=0;t<64;t++){const e=t/63*this._currentTheta;this._attrPos.setXYZ(t+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<63;t++)this._attrIndex.setXYZ(t*3,0,t+1,t+2);this._attrIndex.needsUpdate=!0}},Y_e=class extends tn{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new X,this._currentTail=new X,this._attrPos=new nn(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nn(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},O_=new Jt,dU=new Jt,O0=new X,fU=new X,hU=Math.sqrt(2)/2,Z_e=new Jt(0,0,-hU,hU),Q_e=new X(0,1,0),J_e=class extends Ps{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new uU;e.radius=.5;const n=new Cs({color:65280,transparent:!0,opacity:.5,side:bo,depthTest:!1,depthWrite:!1});this._meshPitch=new xr(e,n),this.add(this._meshPitch)}{const e=new uU;e.radius=.5;const n=new Cs({color:16711680,transparent:!0,opacity:.5,side:bo,depthTest:!1,depthWrite:!1});this._meshYaw=new xr(e,n),this.add(this._meshYaw)}{const e=new Y_e;e.radius=.1;const n=new qr({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new to(e,n),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(t){const e=vr.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const n=vr.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=n,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(O0),this.vrmLookAt.getLookAtWorldQuaternion(O_),O_.multiply(this.vrmLookAt.getFaceFrontQuaternion(dU)),this._meshYaw.position.copy(O0),this._meshYaw.quaternion.copy(O_),this._meshPitch.position.copy(O0),this._meshPitch.quaternion.copy(O_),this._meshPitch.quaternion.multiply(dU.setFromAxisAngle(Q_e,e)),this._meshPitch.quaternion.multiply(Z_e);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(fU).sub(O0),this._lineTarget.geometry.tail.copy(fU),this._lineTarget.geometry.update(),this._lineTarget.position.copy(O0)),super.updateMatrixWorld(t)}},ewe=new X,twe=new X;function fP(t,e){return t.matrixWorld.decompose(ewe,e,twe),e}function Y_(t){return[Math.atan2(-t.z,t.x),Math.atan2(t.y,Math.sqrt(t.x*t.x+t.z*t.z))]}function pU(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var mU=new X(0,0,1),nwe=new X,rwe=new X,iwe=new X,swe=new Jt,iT=new Jt,gU=new Jt,owe=new Jt,sT=new us,zG=class BG{constructor(e,n){this.offsetFromHeadBone=new X,this.autoUpdate=!0,this.faceFront=new X(0,0,1),this.humanoid=e,this.applier=n,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new Jt)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new us)}getEuler(e){return e.set(vr.DEG2RAD*this._pitch,vr.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new BG(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const n=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(n.matrixWorld)}getLookAtWorldQuaternion(e){const n=this.humanoid.getRawBoneNode("head");return fP(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(mU)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=Y_(this.faceFront);return sT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(sT).premultiply(owe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(iT),this.getFaceFrontQuaternion(gU),e.copy(mU).applyQuaternion(iT).applyQuaternion(gU).applyEuler(this.getEuler(sT))}lookAt(e){const n=swe.copy(this._restHeadWorldQuaternion).multiply(jG(this.getLookAtWorldQuaternion(iT))),r=this.getLookAtWorldPosition(rwe),i=iwe.copy(e).sub(r).applyQuaternion(n).normalize(),[s,o]=Y_(this.faceFront),[a,l]=Y_(i),c=pU(a-s),d=pU(o-l);this._yaw=vr.RAD2DEG*c,this._pitch=vr.RAD2DEG*d,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(nwe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};zG.EULER_ORDER="YXZ";var awe=zG,lwe=new X(0,0,1),ml=new Jt,Om=new Jt,Bo=new us(0,0,0,"YXZ"),Z_=class{constructor(t,e,n,r,i){this.humanoid=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new X(0,0,1),this._restQuatLeftEye=new Jt,this._restQuatRightEye=new Jt,this._restLeftEyeParentWorldQuat=new Jt,this._restRightEyeParentWorldQuat=new Jt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),fP(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),fP(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(t,e){const n=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");n&&(e<0?Bo.x=-vr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Bo.x=vr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Bo.y=-vr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):Bo.y=vr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),ml.setFromEuler(Bo),this._getWorldFaceFrontQuat(Om),i.quaternion.copy(Om).multiply(ml).multiply(Om.invert()),ml.copy(this._restLeftEyeParentWorldQuat),n.quaternion.copy(i.quaternion).multiply(ml).premultiply(ml.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?Bo.x=-vr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Bo.x=vr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Bo.y=-vr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):Bo.y=vr.DEG2RAD*this.rangeMapHorizontalInner.map(t),ml.setFromEuler(Bo),this._getWorldFaceFrontQuat(Om),s.quaternion.copy(Om).multiply(ml).multiply(Om.invert()),ml.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(ml).premultiply(ml.invert()).multiply(this._restQuatRightEye))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=vr.RAD2DEG*t.y,n=vr.RAD2DEG*t.x;this.applyYawPitch(e,n)}_getWorldFaceFrontQuat(t){if(this.faceFront.distanceToSquared(lwe)<.01)return t.identity();const[e,n]=Y_(this.faceFront);return Bo.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Bo)}};Z_.type="bone";var hP=class{constructor(t,e,n,r,i){this.expressions=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(t,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),t<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-t))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(t)))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=vr.RAD2DEG*t.y,n=vr.RAD2DEG*t.x;this.applyYawPitch(e,n)}};hP.type="expression";var vU=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*PG(t/this.inputMaxValue)}},cwe=new Set(["1.0","1.0-beta"]),L_=.01,uwe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return zn(this,null,function*(){const e=t.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const n=t.userData.vrmExpressionManager;if(n!==null){if(n===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");t.userData.vrmLookAt=yield this._import(t,e,n)}})}_import(t,e,n){return zn(this,null,function*(){if(e==null||n==null)return null;const r=yield this._v1Import(t,e,n);if(r)return r;const i=yield this._v0Import(t,e,n);return i||null})}_v1Import(t,e,n){return zn(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!cwe.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const d=l.lookAt;if(!d)return null;const f=d.type==="expression"?1:10,m=this._v1ImportRangeMap(d.rangeMapHorizontalInner,f),y=this._v1ImportRangeMap(d.rangeMapHorizontalOuter,f),x=this._v1ImportRangeMap(d.rangeMapVerticalDown,f),S=this._v1ImportRangeMap(d.rangeMapVerticalUp,f);let _;d.type==="expression"?_=new hP(n,m,y,x,S):_=new Z_(e,m,y,x,S);const w=this._importLookAt(e,_);return w.offsetFromHeadBone.fromArray((s=d.offsetFromHeadBone)!=null?s:[0,.06,0]),w})}_v1ImportRangeMap(t,e){var n,r;let i=(n=t==null?void 0:t.inputMaxValue)!=null?n:90;const s=(r=t==null?void 0:t.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},pwe=class{constructor(t){this.scene=t.scene,this.meta=t.meta,this.humanoid=t.humanoid,this.expressionManager=t.expressionManager,this.firstPerson=t.firstPerson,this.lookAt=t.lookAt}update(t){this.humanoid.update(),this.lookAt&&this.lookAt.update(t),this.expressionManager&&this.expressionManager.update()}},mwe=class extends pwe{constructor(t){super(t),this.materials=t.materials,this.springBoneManager=t.springBoneManager,this.nodeConstraintManager=t.nodeConstraintManager}update(t){super.update(t),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(t),this.materials&&this.materials.forEach(e=>{e.update&&e.update(t)})}},gwe=Object.defineProperty,yU=Object.getOwnPropertySymbols,vwe=Object.prototype.hasOwnProperty,ywe=Object.prototype.propertyIsEnumerable,xU=(t,e,n)=>e in t?gwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bU=(t,e)=>{for(var n in e||(e={}))vwe.call(e,n)&&xU(t,n,e[n]);if(yU)for(var n of yU(e))ywe.call(e,n)&&xU(t,n,e[n]);return t},uh=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),xwe={"":3e3,srgb:3001};function bwe(t,e){parseInt(Td,10)>=152?t.colorSpace=e:t.encoding=xwe[e]}var _we=class{get pending(){return Promise.all(this._pendings)}constructor(t,e){this._parser=t,this._materialParams=e,this._pendings=[]}assignPrimitive(t,e){e!=null&&(this._materialParams[t]=e)}assignColor(t,e,n){if(e!=null){const r=new ut().fromArray(e);n&&r.convertSRGBToLinear(),this._materialParams[t]=r}}assignTexture(t,e,n){return uh(this,null,function*(){const r=uh(this,null,function*(){if(e!=null){const i=yield this._parser.assignTexture(this._materialParams,t,e);if(i==null){console.warn("GLTFMToonMaterialParamsAssignHelper: Failed to load texture. The rendering result may be wrong");return}n&&bwe(i,"srgb")}});return this._pendings.push(r),r})}assignTextureByIndex(t,e,n){return uh(this,null,function*(){return this.assignTexture(t,e!=null?{index:e}:void 0,n)})}},wwe=`// #define PHONG + */var O_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),zn=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),Qj=class extends vn{constructor(t){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${t}`,this.expressionName=t,this.type="VRMExpression",this.visible=!1}get binds(){return this._binds}get overrideBlinkAmount(){return this.overrideBlink==="block"?0.5?1:0:this.weight}addBind(t){this._binds.push(t)}deleteBind(t){const e=this._binds.indexOf(t);e>=0&&this._binds.splice(e,1)}applyWeight(t){var e;let n=this.outputWeight;n*=(e=t==null?void 0:t.multiplier)!=null?e:1,this.isBinary&&n<1&&(n=0),this._binds.forEach(r=>r.applyWeight(n))}clearAppliedWeight(){this._binds.forEach(t=>t.clearAppliedWeight())}};function IG(t,e,n){var r,i;const s=t.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,d=[];return n.traverse(f=>{d.length{const s=IG(t,i,r);s!=null&&n.set(i,s)}),n})}var pP={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function kG(t){return Math.max(Math.min(t,1),0)}var tU=class OG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},n=new Set(Object.values(pP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(pP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new OG().copy(this)}getExpression(e){var n;return(n=this._expressionMap[e])!=null?n:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const n=this._expressions.indexOf(e);n===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(n,1),delete this._expressionMap[e.expressionName]}getValue(e){var n;const r=this.getExpression(e);return(n=r==null?void 0:r.weight)!=null?n:null}setValue(e,n){const r=this.getExpression(e);r&&(r.weight=kG(n))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const n=this.getExpression(e);return n?`${n.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(n=>{n.clearAppliedWeight()}),this._expressions.forEach(n=>{let r=1;const i=n.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),n.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,n=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,n-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),n=Math.max(0,n),r=Math.max(0,r),{blink:e,lookAt:n,mouth:r}}},k0={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},Y_e={_Color:k0.Color,_EmissionColor:k0.EmissionColor,_ShadeColor:k0.ShadeColor,_RimColor:k0.RimColor,_OutlineColor:k0.OutlineColor},Z_e=new ut,LG=class DG{constructor({material:e,type:n,targetValue:r,targetAlpha:i}){this.material=e,this.type=n,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:n,alpha:r}=this._state;if(n!=null){const{propertyName:i,deltaValue:s}=n,o=this.material[i];o!=null&&o.add(Z_e.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:n}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(n!=null){const{propertyName:r,initialValue:i}=n;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,n,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?n:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const d=i[l].clone(),f=new ut(o.r-d.r,o.g-d.g,o.b-d.b);return{propertyName:l,initialValue:d,deltaValue:f}}_initAlphaBindState(){var e,n,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?n:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],d=o-c;return{propertyName:l,initialValue:c,deltaValue:d}}_getPropertyNameMap(){var e,n;return(n=(e=Object.entries(DG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};LG._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var nU=LG,z1=class{constructor({primitives:t,index:e,weight:n}){this.primitives=t,this.index=e,this.weight=n}applyWeight(t){this.primitives.forEach(e=>{var n;((n=e.morphTargetInfluences)==null?void 0:n[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*t)})}clearAppliedWeight(){this.primitives.forEach(t=>{var e;((e=t.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(t.morphTargetInfluences[this.index]=0)})}},rU=new He,jG=class UG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const o=(i=Object.entries(UG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const d=c.offset.clone(),f=c.repeat.clone(),g=r.clone().sub(d),y=n.clone().sub(f);this._properties.push({name:a,initialOffset:d,deltaOffset:g,initialScale:f,deltaScale:y})}))}applyWeight(e){this._properties.forEach(n=>{const r=this.material[n.name];r!==void 0&&(r.offset.add(rU.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(rU.copy(n.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const n=this.material[e.name];n!==void 0&&(n.offset.copy(e.initialOffset),n.repeat.copy(e.initialScale))})}};jG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var iU=jG,Q_e=new Set(["1.0","1.0-beta"]),FG=class zG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return zn(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return zn(this,null,function*(){const n=yield this._v1Import(e);if(n)return n;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return zn(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Q_e.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(pP)),d=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([g,y])=>{if(y!=null){if(!c.has(g)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${g}" detected. Ignoring the expression`);return}d.set(g,y)}}),l.custom!=null&&Object.entries(l.custom).forEach(([g,y])=>{if(c.has(g)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${g}". Ignoring the expression`);return}d.set(g,y)});const f=new tU;return yield Promise.all(Array.from(d.entries()).map(g=>zn(this,[g],function*([y,x]){var S,w,b,M,T,C,O;const N=new Qj(y);if(e.scene.add(N),N.isBinary=(S=x.isBinary)!=null?S:!1,N.overrideBlink=(w=x.overrideBlink)!=null?w:"none",N.overrideLookAt=(b=x.overrideLookAt)!=null?b:"none",N.overrideMouth=(M=x.overrideMouth)!=null?M:"none",(T=x.morphTargetBinds)==null||T.forEach(L=>zn(this,null,function*(){var F;if(L.node===void 0||L.index===void 0)return;const G=yield Jj(e,L.node),k=L.index;if(!G.every(U=>Array.isArray(U.morphTargetInfluences)&&k{const G=F.material;G&&(Array.isArray(G)?L.push(...G):L.push(G))}),(C=x.materialColorBinds)==null||C.forEach(F=>zn(this,null,function*(){L.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{N.addBind(new nU({material:k,type:F.type,targetValue:new ut().fromArray(F.targetValue),targetAlpha:F.targetValue[3]}))})})),(O=x.textureTransformBinds)==null||O.forEach(F=>zn(this,null,function*(){L.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{var U,H;N.addBind(new iU({material:k,offset:new He().fromArray((U=F.offset)!=null?U:[0,0]),scale:new He().fromArray((H=F.scale)!=null?H:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return zn(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new tU,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>zn(this,null,function*(){var d;const f=c.presetName,g=f!=null&&zG.v0v1PresetNameMap[f]||null,y=g??c.name;if(y==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(y)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${f} has duplicated entries. Ignoring the expression`);return}l.add(y);const x=new Qj(y);e.scene.add(x),x.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(w=>zn(this,null,function*(){var b;if(w.mesh===void 0||w.index===void 0)return;const M=[];if((b=r.nodes)==null||b.forEach((C,O)=>{C.mesh===w.mesh&&M.push(O)}),M.length===0){console.warn(`VRMExpressionLoaderPlugin: ${c.name} attempts to bind a morph target to the mesh #${w.mesh} but the mesh is not found or not used in the scene. Ignoring the bind.`);return}const T=w.index;yield Promise.all(M.map(C=>zn(this,null,function*(){var O;const N=yield Jj(e,C);if(!N.every(L=>Array.isArray(L.morphTargetInfluences)&&T{if(w.materialName===void 0||w.propertyName===void 0||w.targetValue===void 0)return;const b=[];e.scene.traverse(T=>{if(T.material){const C=T.material;Array.isArray(C)?b.push(...C.filter(O=>(O.name===w.materialName||O.name===w.materialName+" (Outline)")&&b.indexOf(O)===-1)):C.name===w.materialName&&b.indexOf(C)===-1&&b.push(C)}});const M=w.propertyName;b.forEach(T=>{if(M==="_MainTex_ST"){const O=new He(w.targetValue[0],w.targetValue[1]),N=new He(w.targetValue[2],w.targetValue[3]);N.y=1-N.y-O.y,x.addBind(new iU({material:T,scale:O,offset:N}));return}const C=Y_e[M];if(C){x.addBind(new nU({material:T,type:C,targetValue:new ut().fromArray(w.targetValue),targetAlpha:w.targetValue[3]}));return}console.warn(M+" is not supported")})}),o.registerExpression(x)}))),o})}};FG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var J_e=FG,cN=class Hm{constructor(e,n){this._firstPersonOnlyLayer=Hm.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Hm.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=n}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(n=>({meshes:n.meshes.concat(),type:n.type})),this}clone(){return new Hm(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Hm.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:n=Hm.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=n,this.meshAnnotations.forEach(r=>{r.meshes.forEach(i=>{r.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,n,r,i){let s=0;if(n!=null&&n.length>0)for(let o=0;o0&&i.includes(f[0])||d[1]>0&&i.includes(f[1])||d[2]>0&&i.includes(f[2])||d[3]>0&&i.includes(f[3]))continue;const g=n[l],y=r[l];if(g[0]>0&&i.includes(y[0])||g[1]>0&&i.includes(y[1])||g[2]>0&&i.includes(y[2])||g[3]>0&&i.includes(y[3]))continue;const x=n[c],S=r[c];x[0]>0&&i.includes(S[0])||x[1]>0&&i.includes(S[1])||x[2]>0&&i.includes(S[2])||x[3]>0&&i.includes(S[3])||(e[s++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,n){const r=new sM(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),o=s instanceof oP?[]:s.array,a=[];for(let S=0;S{this._isEraseTarget(s)&&r.push(o)}),!r.length){n.layers.enable(this._thirdPersonOnlyLayer),n.layers.enable(this._firstPersonOnlyLayer);return}n.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(n,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer));else{const n=new Ps;n.name=`_headless_${e.name}`,n.layers.set(this._firstPersonOnlyLayer),e.parent.add(n),e.children.filter(r=>r.type==="SkinnedMesh").forEach(r=>{const i=r;this._createHeadlessModelForSkinnedMesh(n,i)})}else if(e.type==="SkinnedMesh"){const n=e;this._createHeadlessModelForSkinnedMesh(e.parent,n)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};cN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;cN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var sU=cN,ewe=new Set(["1.0","1.0-beta"]),twe=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return zn(this,null,function*(){const e=t.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");t.userData.vrmFirstPerson=yield this._import(t,e)}})}_import(t,e){return zn(this,null,function*(){if(e==null)return null;const n=yield this._v1Import(t,e);if(n)return n;const r=yield this._v0Import(t,e);return r||null})}_v1Import(t,e){return zn(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!ewe.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,c=[],d=yield eU(t);return Array.from(d.entries()).forEach(([f,g])=>{var y,x;const S=(y=l==null?void 0:l.meshAnnotations)==null?void 0:y.find(w=>w.node===f);c.push({meshes:g,type:(x=S==null?void 0:S.type)!=null?x:"auto"})}),new sU(e,c)})}_v0Import(t,e){return zn(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield eU(t);return Array.from(a.entries()).forEach(([l,c])=>{const d=r.nodes[l],f=s.meshAnnotations?s.meshAnnotations.find(g=>g.mesh===d.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new sU(e,o)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},oU=new X,aU=new X,nwe=new en,lU=class extends Ps{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new fG(1);n.matrixAutoUpdate=!1,n.material.depthTest=!1,n.material.depthWrite=!1,this.add(n),this._boneAxesMap.set(e,n)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(t=>{t.geometry.dispose(),t.material.dispose()})}updateMatrixWorld(t){Array.from(this._boneAxesMap.entries()).forEach(([e,n])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(oU,nwe,aU);const r=oU.set(.1,.1,.1).divide(aU);n.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(t)}},oT=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],rwe={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function BG(t){return t.invert?t.invert():t.inverse(),t}var Bf=new X,Hf=new en,mP=class{constructor(t){this.humanBones=t,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);r&&(Bf.copy(r.position),Hf.copy(r.quaternion),t[n]={position:Bf.toArray(),rotation:Hf.toArray()})}),t}getPose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);if(!r)return;Bf.set(0,0,0),Hf.identity();const i=this.restPose[n];i!=null&&i.position&&Bf.fromArray(i.position).negate(),i!=null&&i.rotation&&BG(Hf.fromArray(i.rotation)),Bf.add(r.position),Hf.premultiply(r.quaternion),t[n]={position:Bf.toArray(),rotation:Hf.toArray()}}),t}setPose(t){Object.entries(t).forEach(([e,n])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(n!=null&&n.position&&(i.position.fromArray(n.position),s.position&&i.position.add(Bf.fromArray(s.position))),n!=null&&n.rotation&&(i.quaternion.fromArray(n.rotation),s.rotation&&i.quaternion.multiply(Hf.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([t,e])=>{const n=this.getBoneNode(t);n&&(e!=null&&e.position&&n.position.fromArray(e.position),e!=null&&e.rotation&&n.quaternion.fromArray(e.rotation))})}getBone(t){var e;return(e=this.humanBones[t])!=null?e:void 0}getBoneNode(t){var e,n;return(n=(e=this.humanBones[t])==null?void 0:e.node)!=null?n:null}},aT=new X,iwe=new en,swe=new X,cU=class HG extends mP{static _setupTransforms(e){const n=new vn;n.name="VRMHumanoidRig";const r={},i={},s={};oT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=new X,f=new en;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(d,f,aT),r[a]=d,i[a]=c.quaternion.clone();const g=new en;(l=c.parent)==null||l.matrixWorld.decompose(aT,g,aT),s[a]=g}});const o={};return oT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=r[a];let f=a,g;for(;g==null&&(f=rwe[f],f!=null);)g=r[f];const y=new vn;y.name="Normalized_"+c.name,(f?(l=o[f])==null?void 0:l.node:n).add(y),y.position.copy(d),g&&y.position.sub(g),o[a]={node:y}}}),{rigBones:o,root:n,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:s}=HG._setupTransforms(e);super(n),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){oT.forEach(e=>{const n=this.original.getBoneNode(e);if(n!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=iwe.copy(i).invert(),o=this._boneRotations[e];if(n.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition(swe);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=a.applyMatrix4(l.invert());n.position.copy(c)}}})}},uU=class VG{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,n){var r;this.autoUpdateHumanBones=(r=n==null?void 0:n.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new mP(e),this._normalizedHumanBones=new cU(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new mP(e.humanBones),this._normalizedHumanBones=new cU(this._rawHumanBones),this}clone(){return new VG(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},owe={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},awe=new Set(["1.0","1.0-beta"]),dU={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},lwe=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(t){return zn(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return zn(this,null,function*(){const e=yield this._v1Import(t);if(e)return e;const n=yield this._v0Import(t);return n||null})}_v1Import(t){return zn(this,null,function*(){var e,n;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(n=r.extensions)==null?void 0:n.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!awe.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(f=>zn(this,[f],function*([g,y]){let x=g;const S=y.node;if(l){const b=dU[x];b!=null&&(x=b)}const w=yield this.parser.getDependency("node",S);if(w==null){console.warn(`A glTF node bound to the humanoid bone ${x} (index = ${S}) does not exist`);return}c[x]={node:w}}))));const d=new uU(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new lU(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return zn(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>zn(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;if(c<0){console.warn(`A glTF node index for the humanoid bone ${l} is negative (${c}), ignoring this bone.`);return}const d=yield this.parser.getDependency("node",c);if(d==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const f=dU[l],g=f??l;if(s[g]!=null){console.warn(`Multiple bone entries for ${g} detected (index = ${c}), ignoring duplicated entries.`);return}s[g]={node:d}}))));const o=new uU(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new lU(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(t){const e=Object.values(owe).filter(n=>t[n]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return t}},fU=class extends nn{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new rn(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new rn(new Uint16Array(189),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,t=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let t=0;t<64;t++){const e=t/63*this._currentTheta;this._attrPos.setXYZ(t+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<63;t++)this._attrIndex.setXYZ(t*3,0,t+1,t+2);this._attrIndex.needsUpdate=!0}},cwe=class extends nn{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new X,this._currentTail=new X,this._attrPos=new rn(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new rn(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},L_=new en,hU=new en,O0=new X,pU=new X,mU=Math.sqrt(2)/2,uwe=new en(0,0,-mU,mU),dwe=new X(0,1,0),fwe=class extends Ps{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new fU;e.radius=.5;const n=new Cs({color:65280,transparent:!0,opacity:.5,side:wo,depthTest:!1,depthWrite:!1});this._meshPitch=new _r(e,n),this.add(this._meshPitch)}{const e=new fU;e.radius=.5;const n=new Cs({color:16711680,transparent:!0,opacity:.5,side:wo,depthTest:!1,depthWrite:!1});this._meshYaw=new _r(e,n),this.add(this._meshYaw)}{const e=new cwe;e.radius=.1;const n=new Kr({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new no(e,n),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(t){const e=xr.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const n=xr.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=n,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(O0),this.vrmLookAt.getLookAtWorldQuaternion(L_),L_.multiply(this.vrmLookAt.getFaceFrontQuaternion(hU)),this._meshYaw.position.copy(O0),this._meshYaw.quaternion.copy(L_),this._meshPitch.position.copy(O0),this._meshPitch.quaternion.copy(L_),this._meshPitch.quaternion.multiply(hU.setFromAxisAngle(dwe,e)),this._meshPitch.quaternion.multiply(uwe);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(pU).sub(O0),this._lineTarget.geometry.tail.copy(pU),this._lineTarget.geometry.update(),this._lineTarget.position.copy(O0)),super.updateMatrixWorld(t)}},hwe=new X,pwe=new X;function gP(t,e){return t.matrixWorld.decompose(hwe,e,pwe),e}function Z_(t){return[Math.atan2(-t.z,t.x),Math.atan2(t.y,Math.sqrt(t.x*t.x+t.z*t.z))]}function gU(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var vU=new X(0,0,1),mwe=new X,gwe=new X,vwe=new X,ywe=new en,lT=new en,yU=new en,xwe=new en,cT=new us,GG=class WG{constructor(e,n){this.offsetFromHeadBone=new X,this.autoUpdate=!0,this.faceFront=new X(0,0,1),this.humanoid=e,this.applier=n,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new en)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new us)}getEuler(e){return e.set(xr.DEG2RAD*this._pitch,xr.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new WG(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const n=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(n.matrixWorld)}getLookAtWorldQuaternion(e){const n=this.humanoid.getRawBoneNode("head");return gP(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(vU)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=Z_(this.faceFront);return cT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(cT).premultiply(xwe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(lT),this.getFaceFrontQuaternion(yU),e.copy(vU).applyQuaternion(lT).applyQuaternion(yU).applyEuler(this.getEuler(cT))}lookAt(e){const n=ywe.copy(this._restHeadWorldQuaternion).multiply(BG(this.getLookAtWorldQuaternion(lT))),r=this.getLookAtWorldPosition(gwe),i=vwe.copy(e).sub(r).applyQuaternion(n).normalize(),[s,o]=Z_(this.faceFront),[a,l]=Z_(i),c=gU(a-s),d=gU(o-l);this._yaw=xr.RAD2DEG*c,this._pitch=xr.RAD2DEG*d,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(mwe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};GG.EULER_ORDER="YXZ";var bwe=GG,_we=new X(0,0,1),ml=new en,Om=new en,Vo=new us(0,0,0,"YXZ"),Q_=class{constructor(t,e,n,r,i){this.humanoid=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new X(0,0,1),this._restQuatLeftEye=new en,this._restQuatRightEye=new en,this._restLeftEyeParentWorldQuat=new en,this._restRightEyeParentWorldQuat=new en;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),gP(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),gP(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(t,e){const n=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");n&&(e<0?Vo.x=-xr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Vo.x=xr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Vo.y=-xr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):Vo.y=xr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),ml.setFromEuler(Vo),this._getWorldFaceFrontQuat(Om),i.quaternion.copy(Om).multiply(ml).multiply(Om.invert()),ml.copy(this._restLeftEyeParentWorldQuat),n.quaternion.copy(i.quaternion).multiply(ml).premultiply(ml.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?Vo.x=-xr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Vo.x=xr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Vo.y=-xr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):Vo.y=xr.DEG2RAD*this.rangeMapHorizontalInner.map(t),ml.setFromEuler(Vo),this._getWorldFaceFrontQuat(Om),s.quaternion.copy(Om).multiply(ml).multiply(Om.invert()),ml.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(ml).premultiply(ml.invert()).multiply(this._restQuatRightEye))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=xr.RAD2DEG*t.y,n=xr.RAD2DEG*t.x;this.applyYawPitch(e,n)}_getWorldFaceFrontQuat(t){if(this.faceFront.distanceToSquared(_we)<.01)return t.identity();const[e,n]=Z_(this.faceFront);return Vo.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Vo)}};Q_.type="bone";var vP=class{constructor(t,e,n,r,i){this.expressions=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(t,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),t<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-t))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(t)))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=xr.RAD2DEG*t.y,n=xr.RAD2DEG*t.x;this.applyYawPitch(e,n)}};vP.type="expression";var xU=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*kG(t/this.inputMaxValue)}},wwe=new Set(["1.0","1.0-beta"]),D_=.01,Swe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return zn(this,null,function*(){const e=t.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const n=t.userData.vrmExpressionManager;if(n!==null){if(n===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");t.userData.vrmLookAt=yield this._import(t,e,n)}})}_import(t,e,n){return zn(this,null,function*(){if(e==null||n==null)return null;const r=yield this._v1Import(t,e,n);if(r)return r;const i=yield this._v0Import(t,e,n);return i||null})}_v1Import(t,e,n){return zn(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!wwe.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const d=l.lookAt;if(!d)return null;const f=d.type==="expression"?1:10,g=this._v1ImportRangeMap(d.rangeMapHorizontalInner,f),y=this._v1ImportRangeMap(d.rangeMapHorizontalOuter,f),x=this._v1ImportRangeMap(d.rangeMapVerticalDown,f),S=this._v1ImportRangeMap(d.rangeMapVerticalUp,f);let w;d.type==="expression"?w=new vP(n,g,y,x,S):w=new Q_(e,g,y,x,S);const b=this._importLookAt(e,w);return b.offsetFromHeadBone.fromArray((s=d.offsetFromHeadBone)!=null?s:[0,.06,0]),b})}_v1ImportRangeMap(t,e){var n,r;let i=(n=t==null?void 0:t.inputMaxValue)!=null?n:90;const s=(r=t==null?void 0:t.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},Twe=class{constructor(t){this.scene=t.scene,this.meta=t.meta,this.humanoid=t.humanoid,this.expressionManager=t.expressionManager,this.firstPerson=t.firstPerson,this.lookAt=t.lookAt}update(t){this.humanoid.update(),this.lookAt&&this.lookAt.update(t),this.expressionManager&&this.expressionManager.update()}},Cwe=class extends Twe{constructor(t){super(t),this.materials=t.materials,this.springBoneManager=t.springBoneManager,this.nodeConstraintManager=t.nodeConstraintManager}update(t){super.update(t),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(t),this.materials&&this.materials.forEach(e=>{e.update&&e.update(t)})}},Pwe=Object.defineProperty,bU=Object.getOwnPropertySymbols,Rwe=Object.prototype.hasOwnProperty,Nwe=Object.prototype.propertyIsEnumerable,_U=(t,e,n)=>e in t?Pwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,wU=(t,e)=>{for(var n in e||(e={}))Rwe.call(e,n)&&_U(t,n,e[n]);if(bU)for(var n of bU(e))Nwe.call(e,n)&&_U(t,n,e[n]);return t},dh=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),Iwe={"":3e3,srgb:3001};function kwe(t,e){parseInt(Td,10)>=152?t.colorSpace=e:t.encoding=Iwe[e]}var Owe=class{get pending(){return Promise.all(this._pendings)}constructor(t,e){this._parser=t,this._materialParams=e,this._pendings=[]}assignPrimitive(t,e){e!=null&&(this._materialParams[t]=e)}assignColor(t,e,n){if(e!=null){const r=new ut().fromArray(e);n&&r.convertSRGBToLinear(),this._materialParams[t]=r}}assignTexture(t,e,n){return dh(this,null,function*(){const r=dh(this,null,function*(){if(e!=null){const i=yield this._parser.assignTexture(this._materialParams,t,e);if(i==null){console.warn("GLTFMToonMaterialParamsAssignHelper: Failed to load texture. The rendering result may be wrong");return}n&&kwe(i,"srgb")}});return this._pendings.push(r),r})}assignTextureByIndex(t,e,n){return dh(this,null,function*(){return this.assignTexture(t,e!=null?{index:e}:void 0,n)})}},Lwe=`// #define PHONG varying vec3 vViewPosition; @@ -4593,7 +4608,7 @@ void main() { #include #include -}`,Swe=`// #define PHONG +}`,Dwe=`// #define PHONG uniform vec3 litFactor; @@ -5406,9 +5421,9 @@ void main() { gl_FragColor = vec4( col, diffuseColor.a ); postCorrection(); } -`,Mwe={None:"none"},_U={None:"none",ScreenCoordinates:"screenCoordinates"},Ewe={3e3:"",3001:"srgb"};function oT(t){return parseInt(Td,10)>=152?t.colorSpace:Ewe[t.encoding]}var Awe=class extends ea{constructor(t={}){var e;super({vertexShader:wwe,fragmentShader:Swe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=lu,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=Mwe.None,this._outlineWidthMode=_U.None,this._isOutline=!1,t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,t.fog=!0,t.lights=!0,t.clipping=!0,this.uniforms=CR.merge([pt.common,pt.normalmap,pt.emissivemap,pt.fog,pt.lights,{litFactor:{value:new ut(1,1,1)},mapUvTransform:{value:new Zt},colorAlpha:{value:1},normalMapUvTransform:{value:new Zt},shadeColorFactor:{value:new ut(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new Zt},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new Zt},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ut(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new Zt},parametricRimColorFactor:{value:new ut(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new Zt},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ut(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new Zt},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new Zt},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ut(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new Zt},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=t.uniforms)!=null?e:{}]),this.setValues(t),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([n,r])=>`${n}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${oT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${oT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${oT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(Td,10),i=Object.entries(bU(bU({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` +`,jwe={None:"none"},SU={None:"none",ScreenCoordinates:"screenCoordinates"},Uwe={3e3:"",3001:"srgb"};function uT(t){return parseInt(Td,10)>=152?t.colorSpace:Uwe[t.encoding]}var Fwe=class extends ta{constructor(t={}){var e;super({vertexShader:Lwe,fragmentShader:Dwe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=lu,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=jwe.None,this._outlineWidthMode=SU.None,this._isOutline=!1,t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,t.fog=!0,t.lights=!0,t.clipping=!0,this.uniforms=NR.merge([gt.common,gt.normalmap,gt.emissivemap,gt.fog,gt.lights,{litFactor:{value:new ut(1,1,1)},mapUvTransform:{value:new Qt},colorAlpha:{value:1},normalMapUvTransform:{value:new Qt},shadeColorFactor:{value:new ut(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new Qt},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new Qt},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ut(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new Qt},parametricRimColorFactor:{value:new ut(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new Qt},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ut(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new Qt},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new Qt},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ut(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new Qt},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=t.uniforms)!=null?e:{}]),this.setValues(t),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([n,r])=>`${n}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${uT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${uT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${uT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(Td,10),i=Object.entries(wU(wU({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` `)+` -`;n.vertexShader=i+n.vertexShader,n.fragmentShader=i+n.fragmentShader,r<154&&(n.fragmentShader=n.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(t){this.uniforms.litFactor.value=t}get map(){return this.uniforms.map.value}set map(t){this.uniforms.map.value=t}get normalMap(){return this.uniforms.normalMap.value}set normalMap(t){this.uniforms.normalMap.value=t}get normalScale(){return this.uniforms.normalScale.value}set normalScale(t){this.uniforms.normalScale.value=t}get emissive(){return this.uniforms.emissive.value}set emissive(t){this.uniforms.emissive.value=t}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(t){this.uniforms.emissiveIntensity.value=t}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(t){this.uniforms.emissiveMap.value=t}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(t){this.uniforms.shadeColorFactor.value=t}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(t){this.uniforms.shadeMultiplyTexture.value=t}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(t){this.uniforms.shadingShiftFactor.value=t}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(t){this.uniforms.shadingShiftTexture.value=t}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(t){this.uniforms.shadingShiftTextureScale.value=t}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(t){this.uniforms.shadingToonyFactor.value=t}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(t){this.uniforms.giEqualizationFactor.value=t}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(t){this.uniforms.matcapFactor.value=t}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(t){this.uniforms.matcapTexture.value=t}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(t){this.uniforms.parametricRimColorFactor.value=t}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(t){this.uniforms.rimMultiplyTexture.value=t}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(t){this.uniforms.rimLightingMixFactor.value=t}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(t){this.uniforms.parametricRimFresnelPowerFactor.value=t}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(t){this.uniforms.parametricRimLiftFactor.value=t}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(t){this.uniforms.outlineWidthMultiplyTexture.value=t}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(t){this.uniforms.outlineWidthFactor.value=t}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(t){this.uniforms.outlineColorFactor.value=t}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(t){this.uniforms.outlineLightingMixFactor.value=t}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(t){this.uniforms.uvAnimationMaskTexture.value=t}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(t){this.uniforms.uvAnimationScrollXOffset.value=t}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(t){this.uniforms.uvAnimationScrollYOffset.value=t}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(t){this.uniforms.uvAnimationRotationPhase.value=t}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(t){this._ignoreVertexColor=t,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(t){this._v0CompatShade=t,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(t){this._debugMode=t,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(t){this._outlineWidthMode=t,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(t){this._isOutline=t,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(t){this._uploadUniformsWorkaround(),this._updateUVAnimation(t)}copy(t){return super.copy(t),this.map=t.map,this.normalMap=t.normalMap,this.emissiveMap=t.emissiveMap,this.shadeMultiplyTexture=t.shadeMultiplyTexture,this.shadingShiftTexture=t.shadingShiftTexture,this.matcapTexture=t.matcapTexture,this.rimMultiplyTexture=t.rimMultiplyTexture,this.outlineWidthMultiplyTexture=t.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=t.uvAnimationMaskTexture,this.normalMapType=t.normalMapType,this.uvAnimationScrollXSpeedFactor=t.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=t.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=t.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=t.ignoreVertexColor,this.v0CompatShade=t.v0CompatShade,this.debugMode=t.debugMode,this.outlineWidthMode=t.outlineWidthMode,this.isOutline=t.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(t){this.uniforms.uvAnimationScrollXOffset.value+=t*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=t*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=t*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const t=parseInt(Td,10),e=this.outlineWidthMultiplyTexture!==null,n=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:t,OUTLINE:this._isOutline,MTOON_USE_UV:e||n,MTOON_UVS_VERTEX_ONLY:e&&!n,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===_U.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},Twe=new Set(["1.0","1.0-beta"]),HG=class Q_{get name(){return Q_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,o;this.parser=e,this.materialType=(r=n.materialType)!=null?r:Awe,this.renderOrderOffset=(i=n.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(o=n.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return uh(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return uh(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,n){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,n):null}loadMesh(e){return uh(this,null,function*(){var n;const r=this.parser,s=(n=r.json.meshes)==null?void 0:n[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[Q_.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!Twe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Q_.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,n){return uh(this,null,function*(){var r;delete n.metalness,delete n.roughness;const i=new _we(this.parser,n);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,n){const r=this._getMToonExtension(n);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const n=e.material;if(!(n instanceof $r)||!this._shouldGenerateOutline(n))return;e.material=[n];const r=n.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=ls,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const n=e.material,r=new Set;Array.isArray(n)?n.forEach(i=>r.add(i)):r.add(n);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var n;return(e.transparentWithZWrite?0:19)+((n=e.renderQueueOffsetNumber)!=null?n:0)}};HG.EXTENSION_NAME="VRMC_materials_mtoon";var Cwe=HG,Pwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),VG=class pP{get name(){return pP.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Pwe(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;n.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[pP.EXTENSION_NAME];if(a!=null)return a}};VG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Rwe=VG,Nwe=Object.defineProperty,Iwe=Object.defineProperties,kwe=Object.getOwnPropertyDescriptors,wU=Object.getOwnPropertySymbols,Owe=Object.prototype.hasOwnProperty,Lwe=Object.prototype.propertyIsEnumerable,SU=(t,e,n)=>e in t?Nwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gl=(t,e)=>{for(var n in e||(e={}))Owe.call(e,n)&&SU(t,n,e[n]);if(wU)for(var n of wU(e))Lwe.call(e,n)&&SU(t,n,e[n]);return t},MU=(t,e)=>Iwe(t,kwe(e)),Dwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())});function Lm(t){return Math.pow(t,2.2)}var jwe=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(t){var e;this.parser=t,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const n=this.parser.json;n.extensionsUsed=(e=n.extensionsUsed)!=null?e:[],n.extensionsUsed.indexOf("KHR_texture_transform")===-1&&n.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return Dwe(this,null,function*(){var t;const e=this.parser.json,n=(t=e.extensions)==null?void 0:t.VRM,r=n==null?void 0:n.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(t,e){var n,r,i,s,o,a,l,c,d,f,m,y,x,S,_,w,E,T,C,O,N,L,F,G,k,U,H,ne,ee,pe,se,fe,B,Q,K,V,q,he,ae,ce,we,Ee,Xe,Se,je,$e,ue,Z,Ge,Oe,We,tt,wt,dt,J;const $=(r=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?r:!1,Ue=((i=t.floatProperties)==null?void 0:i._ZWrite)===1&&$,He=this._v0ParseRenderQueue(t),Be=(o=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,bt=$?"BLEND":Be?"MASK":"OPAQUE",it=Be?(l=(a=t.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,Gt=((d=(c=t.floatProperties)==null?void 0:c._CullMode)!=null?d:2)===0,Ke=this._portTextureTransform(t),re=((m=(f=t.vectorProperties)==null?void 0:f._Color)!=null?m:[1,1,1,1]).map((ot,xt)=>xt===3?ot:Lm(ot)),Qe=(y=t.textureProperties)==null?void 0:y._MainTex,St=Qe!=null?{index:Qe,extensions:gl({},Ke)}:void 0,mt=(S=(x=t.floatProperties)==null?void 0:x._BumpScale)!=null?S:1,Qt=(_=t.textureProperties)==null?void 0:_._BumpMap,de=Qt!=null?{index:Qt,scale:mt,extensions:gl({},Ke)}:void 0,qe=((E=(w=t.vectorProperties)==null?void 0:w._EmissionColor)!=null?E:[0,0,0,1]).map(Lm),le=(T=t.textureProperties)==null?void 0:T._EmissionMap,Ye=le!=null?{index:le,extensions:gl({},Ke)}:void 0,Te=((O=(C=t.vectorProperties)==null?void 0:C._ShadeColor)!=null?O:[.97,.81,.86,1]).map(Lm),Fe=(N=t.textureProperties)==null?void 0:N._ShadeTexture,st=Fe!=null?{index:Fe,extensions:gl({},Ke)}:void 0;let te=(F=(L=t.floatProperties)==null?void 0:L._ShadeShift)!=null?F:0,ze=(k=(G=t.floatProperties)==null?void 0:G._ShadeToony)!=null?k:.9;ze=vr.lerp(ze,1,.5+.5*te),te=-te-(1-ze);const Je=(H=(U=t.floatProperties)==null?void 0:U._IndirectLightIntensity)!=null?H:.1,At=Je?1-Je:void 0,_t=(ne=t.textureProperties)==null?void 0:ne._SphereAdd,dn=_t!=null?[1,1,1]:void 0,cn=_t!=null?{index:_t}:void 0,Un=(pe=(ee=t.floatProperties)==null?void 0:ee._RimLightingMix)!=null?pe:0,Xi=(se=t.textureProperties)==null?void 0:se._RimTexture,jr=Xi!=null?{index:Xi,extensions:gl({},Ke)}:void 0,To=((B=(fe=t.vectorProperties)==null?void 0:fe._RimColor)!=null?B:[0,0,0,1]).map(Lm),Ei=(K=(Q=t.floatProperties)==null?void 0:Q._RimFresnelPower)!=null?K:1,sa=(q=(V=t.floatProperties)==null?void 0:V._RimLift)!=null?q:0,Ai=["none","worldCoordinates","screenCoordinates"][(ae=(he=t.floatProperties)==null?void 0:he._OutlineWidthMode)!=null?ae:0];let Co=(we=(ce=t.floatProperties)==null?void 0:ce._OutlineWidth)!=null?we:0;Co=.01*Co;const oa=(Ee=t.textureProperties)==null?void 0:Ee._OutlineWidthTexture,cu=oa!=null?{index:oa,extensions:gl({},Ke)}:void 0,uu=((Se=(Xe=t.vectorProperties)==null?void 0:Xe._OutlineColor)!=null?Se:[0,0,0]).map(Lm),du=(($e=(je=t.floatProperties)==null?void 0:je._OutlineColorMode)!=null?$e:0)===1?(Z=(ue=t.floatProperties)==null?void 0:ue._OutlineLightingMix)!=null?Z:1:0,Gl=(Ge=t.textureProperties)==null?void 0:Ge._UvAnimMaskTexture,Y=Gl!=null?{index:Gl,extensions:gl({},Ke)}:void 0,xe=(We=(Oe=t.floatProperties)==null?void 0:Oe._UvAnimScrollX)!=null?We:0;let Ce=(wt=(tt=t.floatProperties)==null?void 0:tt._UvAnimScrollY)!=null?wt:0;Ce!=null&&(Ce=-Ce);const Ne=(J=(dt=t.floatProperties)==null?void 0:dt._UvAnimRotation)!=null?J:0,_e={specVersion:"1.0",transparentWithZWrite:Ue,renderQueueOffsetNumber:He,shadeColorFactor:Te,shadeMultiplyTexture:st,shadingShiftFactor:te,shadingToonyFactor:ze,giEqualizationFactor:At,matcapFactor:dn,matcapTexture:cn,rimLightingMixFactor:Un,rimMultiplyTexture:jr,parametricRimColorFactor:To,parametricRimFresnelPowerFactor:Ei,parametricRimLiftFactor:sa,outlineWidthMode:Ai,outlineWidthFactor:Co,outlineWidthMultiplyTexture:cu,outlineColorFactor:uu,outlineLightingMixFactor:du,uvAnimationMaskTexture:Y,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Ce,uvAnimationRotationSpeedFactor:Ne};return MU(gl({},e),{pbrMetallicRoughness:{baseColorFactor:re,baseColorTexture:St},normalTexture:de,emissiveTexture:Ye,emissiveFactor:qe,alphaMode:bt,alphaCutoff:it,doubleSided:Gt,extensions:{VRMC_materials_mtoon:_e}})}_parseV0UnlitProperties(t,e){var n,r,i,s,o;const a=t.shader==="VRM/UnlitTransparentZWrite",l=t.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",f=l?"BLEND":d?"MASK":"OPAQUE",m=d?(r=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?r:.5:void 0,y=this._portTextureTransform(t),x=((s=(i=t.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Lm),S=(o=t.textureProperties)==null?void 0:o._MainTex,_=S!=null?{index:S,extensions:gl({},y)}:void 0,w={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:x,shadeMultiplyTexture:_};return MU(gl({},e),{pbrMetallicRoughness:{baseColorFactor:x,baseColorTexture:_},alphaMode:f,alphaCutoff:m,extensions:{VRMC_materials_mtoon:w}})}_portTextureTransform(t){var e,n,r,i,s;const o=(e=t.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(n=o==null?void 0:o[0])!=null?n:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(t){var e,n;const r=t.shader==="VRM/UnlitTransparentZWrite",i=((e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||t.shader==="VRM/UnlitTransparent"||r,s=((n=t.floatProperties)==null?void 0:n._ZWrite)===1||r;let o=0;if(i){const a=t.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(t){const e=new Set,n=new Set;t.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?n.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(n).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},EU=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),id=new X,aT=class extends Ps{constructor(t){super(),this._attrPosition=new nn(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(r6);const e=new tn;e.setAttribute("position",this._attrPosition);const n=new qr({color:16711935,depthTest:!1,depthWrite:!1});this._line=new zl(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){id.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,id.x,id.y,id.z),this.constraint.source&&id.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,id.x,id.y,id.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function AU(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Uwe=new X,Fwe=new X;function zwe(t,e){return t.decompose(Uwe,e,Fwe),e}function z1(t){return t.invert?t.invert():t.inverse(),t}var aN=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},Bwe=new X,Hwe=new X,Vwe=new X,Gwe=new Jt,Wwe=new Jt,$we=new Jt,Xwe=class extends aN{get aimAxis(){return this._aimAxis}set aimAxis(t){this._aimAxis=t,this._v3AimAxis.set(t==="PositiveX"?1:t==="NegativeX"?-1:0,t==="PositiveY"?1:t==="NegativeY"?-1:0,t==="PositiveZ"?1:t==="NegativeZ"?-1:0)}get dependencies(){const t=new Set([this.source]);return this.destination.parent&&t.add(this.destination.parent),t}constructor(t,e){super(t,e),this._aimAxis="PositiveX",this._v3AimAxis=new X(1,0,0),this._dstRestQuat=new Jt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const t=Gwe.identity(),e=Wwe.identity();this.destination.parent&&(zwe(this.destination.parent.matrixWorld,t),z1(e.copy(t)));const n=Bwe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=AU(this.source.matrixWorld,Hwe).sub(AU(this.destination.matrixWorld,Vwe)).normalize(),i=$we.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function qwe(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var Kwe=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(t){this._constraints.add(t);let e=this._objectConstraintsMap.get(t.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(t.destination,e)),e.add(t)}deleteConstraint(t){this._constraints.delete(t),this._objectConstraintsMap.get(t.destination).delete(t)}setInitState(){const t=new Set,e=new Set;for(const n of this._constraints)this._processConstraint(n,t,e,r=>r.setInitState())}update(){const t=new Set,e=new Set;for(const n of this._constraints)this._processConstraint(n,t,e,r=>r.update())}_processConstraint(t,e,n,r){if(n.has(t))return;if(e.has(t))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(t);const i=t.dependencies;for(const s of i)qwe(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,n,r)});r(t),n.add(t)}},Ywe=new Jt,Zwe=new Jt,Qwe=class extends aN{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new Jt,this._invSrcRestQuat=new Jt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),z1(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const t=Ywe.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Zwe.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Jwe=new X,e1e=new Jt,t1e=new Jt,n1e=class extends aN{get rollAxis(){return this._rollAxis}set rollAxis(t){this._rollAxis=t,this._v3RollAxis.set(t==="X"?1:0,t==="Y"?1:0,t==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._rollAxis="X",this._v3RollAxis=new X(1,0,0),this._dstRestQuat=new Jt,this._invDstRestQuat=new Jt,this._invSrcRestQuatMulDstRestQuat=new Jt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),z1(this._invDstRestQuat.copy(this._dstRestQuat)),z1(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const t=e1e.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Jwe.copy(this._v3RollAxis).applyQuaternion(t),r=t1e.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},r1e=new Set(["1.0","1.0-beta"]),GG=class W0{get name(){return W0.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return EU(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return EU(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf(W0.EXTENSION_NAME))!==-1))return null;const s=new Kwe,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const d=r.nodes[l],f=(c=d==null?void 0:d.extensions)==null?void 0:c[W0.EXTENSION_NAME];if(f==null)return;const m=f.specVersion;if(!r1e.has(m)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${W0.EXTENSION_NAME} specVersion "${m}"`);return}const y=f.constraint;if(y.roll!=null){const x=this._importRollConstraint(a,o,y.roll);s.addConstraint(x)}else if(y.aim!=null){const x=this._importAimConstraint(a,o,y.aim);s.addConstraint(x)}else if(y.rotation!=null){const x=this._importRotationConstraint(a,o,y.rotation);s.addConstraint(x)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,r){const{source:i,rollAxis:s,weight:o}=r,a=n[i],l=new n1e(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new aT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:o}=r,a=n[i],l=new Xwe(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new aT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,o=n[i],a=new Qwe(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new aT(a);this.helperRoot.add(l)}return a}};GG.EXTENSION_NAME="VRMC_node_constraint";var i1e=GG,D_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),lN=class{},lT=new X,Hf=new X,WG=class extends lN{get type(){return"capsule"}constructor(t){var e,n,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new X(0,0,0),this.radius=(r=t==null?void 0:t.radius)!=null?r:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,n,r){lT.setFromMatrixPosition(t),Hf.subVectors(this.tail,this.offset).applyMatrix4(t),Hf.sub(lT);const i=Hf.lengthSq();r.copy(e).sub(lT);const s=Hf.dot(r);s<=0||(i<=s||Hf.multiplyScalar(s/i),r.sub(Hf));const o=r.length(),a=this.inside?this.radius-n-o:o-n-this.radius;return a<0&&(r.multiplyScalar(1/o),this.inside&&r.negate()),a}},cT=new X,TU=new Zt,$G=class extends lN{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new X(0,0,1)}calculateCollision(t,e,n,r){r.setFromMatrixPosition(t),r.negate().add(e),TU.getNormalMatrix(t),cT.copy(this.normal).applyNormalMatrix(TU).normalize();const i=r.dot(cT)-n;return r.copy(cT),i}},s1e=new X,XG=class extends lN{get type(){return"sphere"}constructor(t){var e,n,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0,this.inside=(r=t==null?void 0:t.inside)!=null?r:!1}calculateCollision(t,e,n,r){r.subVectors(e,s1e.setFromMatrixPosition(t));const i=r.length(),s=this.inside?this.radius-n-i:i-n-this.radius;return s<0&&(r.multiplyScalar(1/i),this.inside&&r.negate()),s}},vl=new X,o1e=class extends tn{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._currentTail=new X,this._shape=t,this._attrPos=new nn(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nn(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0);const n=vl.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){vl.copy(this._currentTail).sub(this._currentOffset);const t=vl.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,t+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,t+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,t,Math.sin(i),Math.cos(i))}const e=Math.atan2(vl.y,Math.sqrt(vl.x*vl.x+vl.z*vl.z)),n=-Math.atan2(vl.z,vl.x);this.rotateZ(e),this.rotateY(n),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){const e=(t+1)%34;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(68+t*2,34+t,34+e)}for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(136+t*2,68+t,68+e),this._attrIndex.setXY(200+t*2,100+t,100+e)}this._attrIndex.needsUpdate=!0}},a1e=class extends tn{constructor(t){super(),this.worldScale=1,this._currentOffset=new X,this._currentNormal=new X,this._shape=t,this._attrPos=new nn(new Float32Array(18),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nn(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},l1e=class extends tn{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._shape=t,this._attrPos=new nn(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nn(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.needsUpdate=!0}},c1e=new X,uT=class extends Ps{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof XG)this._geometry=new l1e(this.collider.shape);else if(this.collider.shape instanceof WG)this._geometry=new o1e(this.collider.shape);else if(this.collider.shape instanceof $G)this._geometry=new a1e(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new qr({color:16711935,depthTest:!1,depthWrite:!1});this._line=new to(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=c1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},u1e=class extends tn{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new X,this._springBone=t,this._attrPos=new nn(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new nn(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},d1e=new X,f1e=class extends Ps{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new u1e(this.springBone);const e=new qr({color:16776960,depthTest:!1,depthWrite:!1});this._line=new to(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=d1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},dT=class extends yn{constructor(t){super(),this.colliderMatrix=new kt,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),h1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function h1e(t,e,n){const r=e.elements;t.copy(e),n&&(t.elements[12]=r[0]*n.x+r[4]*n.y+r[8]*n.z+r[12],t.elements[13]=r[1]*n.x+r[5]*n.y+r[9]*n.z+r[13],t.elements[14]=r[2]*n.x+r[6]*n.y+r[10]*n.z+r[14])}var p1e=new kt;function m1e(t){return t.invert?t.invert():t.getInverse(p1e.copy(t)),t}var g1e=class{constructor(t){this._inverseCache=new kt,this._shouldUpdateInverse=!0,this.matrix=t;const e={set:(n,r,i)=>(this._shouldUpdateInverse=!0,n[r]=i,!0)};this._originalElements=t.elements,t.elements=new Proxy(t.elements,e)}get inverse(){return this._shouldUpdateInverse&&(m1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},fT=new kt,Dm=new X,L0=new X,D0=new X,j0=new X,v1e=new kt,y1e=class{constructor(t,e,n={},r=[]){this._currentTail=new X,this._prevTail=new X,this._boneAxis=new X,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new kt,this._initialLocalRotation=new Jt,this._initialLocalChildPosition=new X;var i,s,o,a,l,c;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=n.hitRadius)!=null?i:0,stiffness:(s=n.stiffness)!=null?s:1,gravityPower:(o=n.gravityPower)!=null?o:0,gravityDir:(l=(a=n.gravityDir)==null?void 0:a.clone())!=null?l:new X(0,-1,0),dragForce:(c=n.dragForce)!=null?c:.4},this.colliderGroups=r}get dependencies(){const t=new Set,e=this.bone.parent;e&&t.add(e);for(let n=0;n{e(i)})}function mP(t,e){t.children.forEach(n=>{e(n)||mP(n,e)})}function b1e(t){var e;const n=new Map;for(const r of t){let i=r;do{const s=((e=n.get(i))!=null?e:0)+1;if(s===t.size)return i;n.set(i,s),i=i.parent}while(i!==null)}return null}var CU=class{constructor(){this._joints=new Set,this._sortedJoints=[],this._hasWarnedCircularDependency=!1,this._ancestors=[],this._objectSpringBonesMap=new Map,this._isSortedJointsDirty=!1,this._relevantChildrenUpdated=this._relevantChildrenUpdated.bind(this)}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const t=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(n=>{t.add(n)})}),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{t.add(n)})}),Array.from(t)}addJoint(t){this._joints.add(t);let e=this._objectSpringBonesMap.get(t.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t),this._isSortedJointsDirty=!0}addSpringBone(t){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(t)}deleteJoint(t){this._joints.delete(t),this._objectSpringBonesMap.get(t.bone).delete(t),this._isSortedJointsDirty=!0}deleteSpringBone(t){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(t)}setInitState(){this._sortJoints();for(let t=0;t{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(this._ancestors.push(s),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(t,e,n,r,i){if(n.has(t))return;if(e.has(t)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}e.add(t);const s=t.dependencies;for(const o of s){let a=!1,l=null;x1e(o,c=>{const d=this._objectSpringBonesMap.get(c);if(d)for(const f of d)a=!0,this._insertJointSort(f,e,n,r,i);else a||(l=c)}),l&&i.add(l)}r.push(t),n.add(t)}_relevantChildrenUpdated(t){var e,n;return((n=(e=this._objectSpringBonesMap.get(t))==null?void 0:e.size)!=null?n:0)>0?!0:(t.updateWorldMatrix(!1,!1),!1)}},PU="VRMC_springBone_extended_collider",_1e=new Set(["1.0","1.0-beta"]),w1e=new Set(["1.0"]),qG=class Vm{get name(){return Vm.EXTENSION_NAME}constructor(e,n){var r;this.parser=e,this.jointHelperRoot=n==null?void 0:n.jointHelperRoot,this.colliderHelperRoot=n==null?void 0:n.colliderHelperRoot,this.useExtendedColliders=(r=n==null?void 0:n.useExtendedColliders)!=null?r:!0}afterRoot(e){return D_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return D_(this,null,function*(){const n=yield this._v1Import(e);if(n!=null)return n;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return D_(this,null,function*(){var n,r,i,s,o;const a=e.parser.json;if(!(((n=a.extensionsUsed)==null?void 0:n.indexOf(Vm.EXTENSION_NAME))!==-1))return null;const c=new CU,d=yield e.parser.getDependencies("node"),f=(r=a.extensions)==null?void 0:r[Vm.EXTENSION_NAME];if(!f)return null;const m=f.specVersion;if(!_1e.has(m))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Vm.EXTENSION_NAME} specVersion "${m}"`),null;const y=(i=f.colliders)==null?void 0:i.map((S,_)=>{var w,E,T,C,O,N,L,F,G,k,U,H,ne,ee,pe;const se=d[S.node];if(se==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${_} attempted to reference a node #${S.node} but not found. Skipping the collider`),null;const fe=S.shape,B=(w=S.extensions)==null?void 0:w[PU];if(this.useExtendedColliders&&B!=null){const Q=B.specVersion;if(!w1e.has(Q))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${PU} specVersion "${Q}". Fallbacking to the ${Vm.EXTENSION_NAME} definition`);else{const K=B.shape;if(K.sphere)return this._importSphereCollider(se,{offset:new X().fromArray((E=K.sphere.offset)!=null?E:[0,0,0]),radius:(T=K.sphere.radius)!=null?T:0,inside:(C=K.sphere.inside)!=null?C:!1});if(K.capsule)return this._importCapsuleCollider(se,{offset:new X().fromArray((O=K.capsule.offset)!=null?O:[0,0,0]),radius:(N=K.capsule.radius)!=null?N:0,tail:new X().fromArray((L=K.capsule.tail)!=null?L:[0,0,0]),inside:(F=K.capsule.inside)!=null?F:!1});if(K.plane)return this._importPlaneCollider(se,{offset:new X().fromArray((G=K.plane.offset)!=null?G:[0,0,0]),normal:new X().fromArray((k=K.plane.normal)!=null?k:[0,0,1])})}}if(fe.sphere)return this._importSphereCollider(se,{offset:new X().fromArray((U=fe.sphere.offset)!=null?U:[0,0,0]),radius:(H=fe.sphere.radius)!=null?H:0,inside:!1});if(fe.capsule)return this._importCapsuleCollider(se,{offset:new X().fromArray((ne=fe.capsule.offset)!=null?ne:[0,0,0]),radius:(ee=fe.capsule.radius)!=null?ee:0,tail:new X().fromArray((pe=fe.capsule.tail)!=null?pe:[0,0,0]),inside:!1});console.warn(`VRMSpringBoneLoaderPlugin: The collider #${_} has no valid shape. Skipping the collider`)}),x=(s=f.colliderGroups)==null?void 0:s.map((S,_)=>{var w;return{colliders:((w=S.colliders)!=null?w:[]).map(T=>{const C=y==null?void 0:y[T];return C??(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${_} attempted to reference a collider #${T} but not found. Skipping the collider`),null)}).filter(T=>T!=null),name:S.name}});return(o=f.springs)==null||o.forEach((S,_)=>{var w;const E=S.joints,T=(w=S.colliderGroups)==null?void 0:w.map(N=>{const L=x==null?void 0:x[N];return L??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${_} attempted to reference a collider group #${N} but not found. Skipping the collider group`),null)}).filter(N=>N!=null),C=S.center!=null?d[S.center]:void 0;let O;E.forEach(N=>{if(O){const L=O.node,F=d[L],G=N.node,k=d[G],U={hitRadius:O.hitRadius,dragForce:O.dragForce,gravityPower:O.gravityPower,stiffness:O.stiffness,gravityDir:O.gravityDir!=null?new X().fromArray(O.gravityDir):void 0},H=this._importJoint(F,k,U,T);C&&(H.center=C),c.addJoint(H)}O=N})}),c.setInitState(),c})}_v0Import(e){return D_(this,null,function*(){var n,r,i;const s=e.parser.json;if(!(((n=s.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const d=new CU,f=yield e.parser.getDependencies("node"),m=(i=l.colliderGroups)==null?void 0:i.map((y,x)=>{var S;const _=f[y.node];return _==null?(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${x} attempted to reference a node #${y.node} but not found. Skipping the collider group`),null):{colliders:((S=y.colliders)!=null?S:[]).map((E,T)=>{var C,O,N;const L=new X(0,0,0);return E.offset&&L.set((C=E.offset.x)!=null?C:0,(O=E.offset.y)!=null?O:0,E.offset.z?-E.offset.z:0),this._importSphereCollider(_,{offset:L,radius:(N=E.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,x)=>{const S=y.bones;S&&S.forEach(_=>{var w,E,T,C;const O=f[_];if(O==null){console.warn(`VRMSpringBoneLoaderPlugin: The spring bone group #${x} attempted to reference a node #${_} but not found. Skipping the node`);return}const N=new X;y.gravityDir?N.set((w=y.gravityDir.x)!=null?w:0,(E=y.gravityDir.y)!=null?E:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const L=y.center!=null?f[y.center]:void 0,F={hitRadius:y.hitRadius,dragForce:y.dragForce,gravityPower:y.gravityPower,stiffness:y.stiffiness,gravityDir:N},G=(C=y.colliderGroups)==null?void 0:C.map(k=>{const U=m==null?void 0:m[k];return U??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${x} attempted to reference a collider group #${k} but not found. Skipping the collider group`),null)}).filter(k=>k!=null);O.traverse(k=>{var U;const H=(U=k.children[0])!=null?U:null,ne=this._importJoint(k,H,F,G);L&&(ne.center=L),d.addJoint(ne)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new y1e(e,n,r,i);if(this.jointHelperRoot){const o=new f1e(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new XG(n),i=new dT(r);if(e.add(i),this.colliderHelperRoot){const s=new uT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,n){const r=new WG(n),i=new dT(r);if(e.add(i),this.colliderHelperRoot){const s=new uT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,n){const r=new $G(n),i=new dT(r);if(e.add(i),this.colliderHelperRoot){const s=new uT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};qG.EXTENSION_NAME="VRMC_springBone";var S1e=qG,M1e=class{get name(){return"VRMLoaderPlugin"}constructor(t,e){var n,r,i,s,o,a,l,c,d,f;this.parser=t;const m=e==null?void 0:e.helperRoot,y=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(n=e==null?void 0:e.expressionPlugin)!=null?n:new z_e(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new H_e(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new K_e(t,{helperRoot:m,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new uwe(t,{helperRoot:m}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new hwe(t),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new Cwe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Rwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new jwe(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new S1e(t,{colliderHelperRoot:m,jointHelperRoot:m}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new i1e(t,{helperRoot:m})}beforeRoot(){return k_(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(t){return k_(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(t)})}getMaterialType(t){const e=this.mtoonMaterialPlugin.getMaterialType(t);return e??null}extendMaterialParams(t,e){return k_(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(t,e),yield this.mtoonMaterialPlugin.extendMaterialParams(t,e)})}afterRoot(t){return k_(this,null,function*(){yield this.metaPlugin.afterRoot(t),yield this.humanoidPlugin.afterRoot(t),yield this.expressionPlugin.afterRoot(t),yield this.lookAtPlugin.afterRoot(t),yield this.firstPersonPlugin.afterRoot(t),yield this.springBonePlugin.afterRoot(t),yield this.nodeConstraintPlugin.afterRoot(t),yield this.mtoonMaterialPlugin.afterRoot(t);const e=t.userData.vrmMeta,n=t.userData.vrmHumanoid;if(e&&n){const r=new mwe({scene:t.scene,expressionManager:t.userData.vrmExpressionManager,firstPerson:t.userData.vrmFirstPerson,humanoid:n,lookAt:t.userData.vrmLookAt,meta:e,materials:t.userData.vrmMToonMaterials,springBoneManager:t.userData.vrmSpringBoneManager,nodeConstraintManager:t.userData.vrmNodeConstraintManager});t.userData.vrm=r}})}};function E1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function RU(t,e,n){if(e.size===1){const o=e.values().next().value;if(o.weight===1)return t[o.index]}const r=new Float32Array(t[0].count*3);let i=0;if(n)i=1;else for(const o of e)i+=o.weight;for(const o of e){const a=t[o.index],l=o.weight/i;for(let c=0;cd.getOrCreate(G)).join(","),L=`${C};${w};${N}`;let F=a.get(L);F==null&&(F=T.clone(),I1e(F,O,x),a.set(L,F)),E.geometry.setAttribute("skinIndex",F)}for(const E of y)E.bind(_,new kt)}}function C1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function P1e(t,e){const n=new Set;for(let r=0;rn)return!1;return!0}var hT=class{constructor(){this._objectIndexMap=new Map,this._index=0}get(t){return this._objectIndexMap.get(t)}getOrCreate(t){let e=this._objectIndexMap.get(t);return e==null&&(e=this._index,this._objectIndexMap.set(t,e),this._index++),e}};function O1e(t){var e,n,r,i;const s=new tn;s.name=t.name,s.setIndex(t.index);for(const[o,a]of Object.entries(t.attributes))s.setAttribute(o,a);for(const[o,a]of Object.entries(t.morphAttributes)){const l=o;s.morphAttributes[l]=a.concat()}s.morphTargetsRelative=t.morphTargetsRelative,s.groups=[];for(const o of t.groups)s.addGroup(o.start,o.count,o.materialIndex);return s.boundingSphere=(n=(e=t.boundingSphere)==null?void 0:e.clone())!=null?n:null,s.boundingBox=(i=(r=t.boundingBox)==null?void 0:r.clone())!=null?i:null,s.drawRange.start=t.drawRange.start,s.drawRange.count=t.drawRange.count,s.userData=t.userData,s}function NU(t){if(Object.values(t).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),t.isShaderMaterial){const e=t.uniforms;e&&Object.values(e).forEach(n=>{const r=n.value;r!=null&&r.isTexture&&r.dispose()})}t.dispose()}function L1e(t){const e=t.geometry;e&&e.dispose();const n=t.skeleton;n&&n.dispose();const r=t.material;r&&(Array.isArray(r)?r.forEach(i=>NU(i)):r&&NU(r))}function D1e(t){t.traverse(L1e)}function j1e(t,e){var n,r;console.warn("VRMUtils.removeUnnecessaryJoints: removeUnnecessaryJoints is deprecated. Use combineSkeletons instead. combineSkeletons contributes more to the performance improvement. This function will be removed in the next major version.");const i=(n=e==null?void 0:e.experimentalSameBoneCounts)!=null?n:!1,s=[];t.traverse(l=>{l.type==="SkinnedMesh"&&s.push(l)});const o=new Map;let a=0;for(const l of s){const d=l.geometry.getAttribute("skinIndex");if(o.has(d))continue;const f=new Map,m=new Map;for(let y=0;y{e.addGroup(o.start,o.count,o.materialIndex)}),e.boundingBox=(r=(n=t.boundingBox)==null?void 0:n.clone())!=null?r:null,e.boundingSphere=(s=(i=t.boundingSphere)==null?void 0:i.clone())!=null?s:null,e.setDrawRange(t.drawRange.start,t.drawRange.count),e.userData=t.userData}function B1e(t,e,n){const r=e.array,i=new r.constructor(r.length);for(let s=0;s{if(!n.isMesh)return;const r=n,i=r.geometry,s=i.index;if(s==null)return;const o=e.get(i);if(o!=null){r.geometry=o;return}const{isVertexUsed:a,vertexCount:l,verticesUsed:c}=U1e(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=F1e(a),m=new tn;z1e(i,m),e.set(i,m),B1e(m,s,d),V1e(m,i.attributes,f),W1e(m,i.morphAttributes,f),r.geometry=m}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function X1e(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var qc=class{constructor(){}};qc.combineMorphs=A1e;qc.combineSkeletons=T1e;qc.deepDispose=D1e;qc.removeUnnecessaryJoints=j1e;qc.removeUnnecessaryVertices=$1e;qc.rotateVRM0=X1e;/*! +`;n.vertexShader=i+n.vertexShader,n.fragmentShader=i+n.fragmentShader,r<154&&(n.fragmentShader=n.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(t){this.uniforms.litFactor.value=t}get map(){return this.uniforms.map.value}set map(t){this.uniforms.map.value=t}get normalMap(){return this.uniforms.normalMap.value}set normalMap(t){this.uniforms.normalMap.value=t}get normalScale(){return this.uniforms.normalScale.value}set normalScale(t){this.uniforms.normalScale.value=t}get emissive(){return this.uniforms.emissive.value}set emissive(t){this.uniforms.emissive.value=t}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(t){this.uniforms.emissiveIntensity.value=t}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(t){this.uniforms.emissiveMap.value=t}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(t){this.uniforms.shadeColorFactor.value=t}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(t){this.uniforms.shadeMultiplyTexture.value=t}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(t){this.uniforms.shadingShiftFactor.value=t}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(t){this.uniforms.shadingShiftTexture.value=t}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(t){this.uniforms.shadingShiftTextureScale.value=t}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(t){this.uniforms.shadingToonyFactor.value=t}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(t){this.uniforms.giEqualizationFactor.value=t}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(t){this.uniforms.matcapFactor.value=t}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(t){this.uniforms.matcapTexture.value=t}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(t){this.uniforms.parametricRimColorFactor.value=t}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(t){this.uniforms.rimMultiplyTexture.value=t}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(t){this.uniforms.rimLightingMixFactor.value=t}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(t){this.uniforms.parametricRimFresnelPowerFactor.value=t}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(t){this.uniforms.parametricRimLiftFactor.value=t}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(t){this.uniforms.outlineWidthMultiplyTexture.value=t}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(t){this.uniforms.outlineWidthFactor.value=t}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(t){this.uniforms.outlineColorFactor.value=t}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(t){this.uniforms.outlineLightingMixFactor.value=t}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(t){this.uniforms.uvAnimationMaskTexture.value=t}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(t){this.uniforms.uvAnimationScrollXOffset.value=t}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(t){this.uniforms.uvAnimationScrollYOffset.value=t}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(t){this.uniforms.uvAnimationRotationPhase.value=t}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(t){this._ignoreVertexColor=t,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(t){this._v0CompatShade=t,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(t){this._debugMode=t,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(t){this._outlineWidthMode=t,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(t){this._isOutline=t,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(t){this._uploadUniformsWorkaround(),this._updateUVAnimation(t)}copy(t){return super.copy(t),this.map=t.map,this.normalMap=t.normalMap,this.emissiveMap=t.emissiveMap,this.shadeMultiplyTexture=t.shadeMultiplyTexture,this.shadingShiftTexture=t.shadingShiftTexture,this.matcapTexture=t.matcapTexture,this.rimMultiplyTexture=t.rimMultiplyTexture,this.outlineWidthMultiplyTexture=t.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=t.uvAnimationMaskTexture,this.normalMapType=t.normalMapType,this.uvAnimationScrollXSpeedFactor=t.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=t.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=t.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=t.ignoreVertexColor,this.v0CompatShade=t.v0CompatShade,this.debugMode=t.debugMode,this.outlineWidthMode=t.outlineWidthMode,this.isOutline=t.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(t){this.uniforms.uvAnimationScrollXOffset.value+=t*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=t*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=t*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const t=parseInt(Td,10),e=this.outlineWidthMultiplyTexture!==null,n=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:t,OUTLINE:this._isOutline,MTOON_USE_UV:e||n,MTOON_UVS_VERTEX_ONLY:e&&!n,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===SU.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},zwe=new Set(["1.0","1.0-beta"]),$G=class J_{get name(){return J_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,o;this.parser=e,this.materialType=(r=n.materialType)!=null?r:Fwe,this.renderOrderOffset=(i=n.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(o=n.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return dh(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return dh(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,n){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,n):null}loadMesh(e){return dh(this,null,function*(){var n;const r=this.parser,s=(n=r.json.meshes)==null?void 0:n[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[J_.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!zwe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${J_.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,n){return dh(this,null,function*(){var r;delete n.metalness,delete n.roughness;const i=new Owe(this.parser,n);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,n){const r=this._getMToonExtension(n);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const n=e.material;if(!(n instanceof Xr)||!this._shouldGenerateOutline(n))return;e.material=[n];const r=n.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=ls,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const n=e.material,r=new Set;Array.isArray(n)?n.forEach(i=>r.add(i)):r.add(n);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var n;return(e.transparentWithZWrite?0:19)+((n=e.renderQueueOffsetNumber)!=null?n:0)}};$G.EXTENSION_NAME="VRMC_materials_mtoon";var Bwe=$G,Hwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),XG=class yP{get name(){return yP.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Hwe(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;n.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[yP.EXTENSION_NAME];if(a!=null)return a}};XG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Vwe=XG,Gwe=Object.defineProperty,Wwe=Object.defineProperties,$we=Object.getOwnPropertyDescriptors,MU=Object.getOwnPropertySymbols,Xwe=Object.prototype.hasOwnProperty,qwe=Object.prototype.propertyIsEnumerable,EU=(t,e,n)=>e in t?Gwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gl=(t,e)=>{for(var n in e||(e={}))Xwe.call(e,n)&&EU(t,n,e[n]);if(MU)for(var n of MU(e))qwe.call(e,n)&&EU(t,n,e[n]);return t},AU=(t,e)=>Wwe(t,$we(e)),Kwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())});function Lm(t){return Math.pow(t,2.2)}var Ywe=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(t){var e;this.parser=t,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const n=this.parser.json;n.extensionsUsed=(e=n.extensionsUsed)!=null?e:[],n.extensionsUsed.indexOf("KHR_texture_transform")===-1&&n.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return Kwe(this,null,function*(){var t;const e=this.parser.json,n=(t=e.extensions)==null?void 0:t.VRM,r=n==null?void 0:n.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(t,e){var n,r,i,s,o,a,l,c,d,f,g,y,x,S,w,b,M,T,C,O,N,L,F,G,k,U,H,te,ee,pe,ie,fe,B,Q,K,V,q,he,ae,ce,we,Ee,Xe,Se,je,$e,ue,Z,Ve,Oe,Ge,et,St,ft,J;const $=(r=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?r:!1,Ue=((i=t.floatProperties)==null?void 0:i._ZWrite)===1&&$,Be=this._v0ParseRenderQueue(t),ze=(o=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,wt=$?"BLEND":ze?"MASK":"OPAQUE",rt=ze?(l=(a=t.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,Wt=((d=(c=t.floatProperties)==null?void 0:c._CullMode)!=null?d:2)===0,Ke=this._portTextureTransform(t),ne=((g=(f=t.vectorProperties)==null?void 0:f._Color)!=null?g:[1,1,1,1]).map((ot,_t)=>_t===3?ot:Lm(ot)),Qe=(y=t.textureProperties)==null?void 0:y._MainTex,Mt=Qe!=null?{index:Qe,extensions:gl({},Ke)}:void 0,yt=(S=(x=t.floatProperties)==null?void 0:x._BumpScale)!=null?S:1,Jt=(w=t.textureProperties)==null?void 0:w._BumpMap,de=Jt!=null?{index:Jt,scale:yt,extensions:gl({},Ke)}:void 0,qe=((M=(b=t.vectorProperties)==null?void 0:b._EmissionColor)!=null?M:[0,0,0,1]).map(Lm),le=(T=t.textureProperties)==null?void 0:T._EmissionMap,Ye=le!=null?{index:le,extensions:gl({},Ke)}:void 0,Te=((O=(C=t.vectorProperties)==null?void 0:C._ShadeColor)!=null?O:[.97,.81,.86,1]).map(Lm),Fe=(N=t.textureProperties)==null?void 0:N._ShadeTexture,st=Fe!=null?{index:Fe,extensions:gl({},Ke)}:void 0;let mt=(F=(L=t.floatProperties)==null?void 0:L._ShadeShift)!=null?F:0,se=(k=(G=t.floatProperties)==null?void 0:G._ShadeToony)!=null?k:.9;se=xr.lerp(se,1,.5+.5*mt),mt=-mt-(1-se);const We=(H=(U=t.floatProperties)==null?void 0:U._IndirectLightIntensity)!=null?H:.1,it=We?1-We:void 0,dt=(te=t.textureProperties)==null?void 0:te._SphereAdd,Ht=dt!=null?[1,1,1]:void 0,_n=dt!=null?{index:dt}:void 0,xn=(pe=(ee=t.floatProperties)==null?void 0:ee._RimLightingMix)!=null?pe:0,er=(ie=t.textureProperties)==null?void 0:ie._RimTexture,wr=er!=null?{index:er,extensions:gl({},Ke)}:void 0,ro=((B=(fe=t.vectorProperties)==null?void 0:fe._RimColor)!=null?B:[0,0,0,1]).map(Lm),Xi=(K=(Q=t.floatProperties)==null?void 0:Q._RimFresnelPower)!=null?K:1,ks=(q=(V=t.floatProperties)==null?void 0:V._RimLift)!=null?q:0,Ti=["none","worldCoordinates","screenCoordinates"][(ae=(he=t.floatProperties)==null?void 0:he._OutlineWidthMode)!=null?ae:0];let Ro=(we=(ce=t.floatProperties)==null?void 0:ce._OutlineWidth)!=null?we:0;Ro=.01*Ro;const oa=(Ee=t.textureProperties)==null?void 0:Ee._OutlineWidthTexture,cu=oa!=null?{index:oa,extensions:gl({},Ke)}:void 0,uu=((Se=(Xe=t.vectorProperties)==null?void 0:Xe._OutlineColor)!=null?Se:[0,0,0]).map(Lm),du=(($e=(je=t.floatProperties)==null?void 0:je._OutlineColorMode)!=null?$e:0)===1?(Z=(ue=t.floatProperties)==null?void 0:ue._OutlineLightingMix)!=null?Z:1:0,Gl=(Ve=t.textureProperties)==null?void 0:Ve._UvAnimMaskTexture,Y=Gl!=null?{index:Gl,extensions:gl({},Ke)}:void 0,xe=(Ge=(Oe=t.floatProperties)==null?void 0:Oe._UvAnimScrollX)!=null?Ge:0;let Ce=(St=(et=t.floatProperties)==null?void 0:et._UvAnimScrollY)!=null?St:0;Ce!=null&&(Ce=-Ce);const Ne=(J=(ft=t.floatProperties)==null?void 0:ft._UvAnimRotation)!=null?J:0,_e={specVersion:"1.0",transparentWithZWrite:Ue,renderQueueOffsetNumber:Be,shadeColorFactor:Te,shadeMultiplyTexture:st,shadingShiftFactor:mt,shadingToonyFactor:se,giEqualizationFactor:it,matcapFactor:Ht,matcapTexture:_n,rimLightingMixFactor:xn,rimMultiplyTexture:wr,parametricRimColorFactor:ro,parametricRimFresnelPowerFactor:Xi,parametricRimLiftFactor:ks,outlineWidthMode:Ti,outlineWidthFactor:Ro,outlineWidthMultiplyTexture:cu,outlineColorFactor:uu,outlineLightingMixFactor:du,uvAnimationMaskTexture:Y,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Ce,uvAnimationRotationSpeedFactor:Ne};return AU(gl({},e),{pbrMetallicRoughness:{baseColorFactor:ne,baseColorTexture:Mt},normalTexture:de,emissiveTexture:Ye,emissiveFactor:qe,alphaMode:wt,alphaCutoff:rt,doubleSided:Wt,extensions:{VRMC_materials_mtoon:_e}})}_parseV0UnlitProperties(t,e){var n,r,i,s,o;const a=t.shader==="VRM/UnlitTransparentZWrite",l=t.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",f=l?"BLEND":d?"MASK":"OPAQUE",g=d?(r=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?r:.5:void 0,y=this._portTextureTransform(t),x=((s=(i=t.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Lm),S=(o=t.textureProperties)==null?void 0:o._MainTex,w=S!=null?{index:S,extensions:gl({},y)}:void 0,b={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:x,shadeMultiplyTexture:w};return AU(gl({},e),{pbrMetallicRoughness:{baseColorFactor:x,baseColorTexture:w},alphaMode:f,alphaCutoff:g,extensions:{VRMC_materials_mtoon:b}})}_portTextureTransform(t){var e,n,r,i,s;const o=(e=t.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(n=o==null?void 0:o[0])!=null?n:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(t){var e,n;const r=t.shader==="VRM/UnlitTransparentZWrite",i=((e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||t.shader==="VRM/UnlitTransparent"||r,s=((n=t.floatProperties)==null?void 0:n._ZWrite)===1||r;let o=0;if(i){const a=t.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(t){const e=new Set,n=new Set;t.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?n.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(n).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},TU=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),id=new X,dT=class extends Ps{constructor(t){super(),this._attrPosition=new rn(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(a6);const e=new nn;e.setAttribute("position",this._attrPosition);const n=new Kr({color:16711935,depthTest:!1,depthWrite:!1});this._line=new zl(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){id.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,id.x,id.y,id.z),this.constraint.source&&id.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,id.x,id.y,id.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function CU(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Zwe=new X,Qwe=new X;function Jwe(t,e){return t.decompose(Zwe,e,Qwe),e}function B1(t){return t.invert?t.invert():t.inverse(),t}var uN=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},e1e=new X,t1e=new X,n1e=new X,r1e=new en,i1e=new en,s1e=new en,o1e=class extends uN{get aimAxis(){return this._aimAxis}set aimAxis(t){this._aimAxis=t,this._v3AimAxis.set(t==="PositiveX"?1:t==="NegativeX"?-1:0,t==="PositiveY"?1:t==="NegativeY"?-1:0,t==="PositiveZ"?1:t==="NegativeZ"?-1:0)}get dependencies(){const t=new Set([this.source]);return this.destination.parent&&t.add(this.destination.parent),t}constructor(t,e){super(t,e),this._aimAxis="PositiveX",this._v3AimAxis=new X(1,0,0),this._dstRestQuat=new en}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const t=r1e.identity(),e=i1e.identity();this.destination.parent&&(Jwe(this.destination.parent.matrixWorld,t),B1(e.copy(t)));const n=e1e.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=CU(this.source.matrixWorld,t1e).sub(CU(this.destination.matrixWorld,n1e)).normalize(),i=s1e.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function a1e(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var l1e=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(t){this._constraints.add(t);let e=this._objectConstraintsMap.get(t.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(t.destination,e)),e.add(t)}deleteConstraint(t){this._constraints.delete(t),this._objectConstraintsMap.get(t.destination).delete(t)}setInitState(){const t=new Set,e=new Set;for(const n of this._constraints)this._processConstraint(n,t,e,r=>r.setInitState())}update(){const t=new Set,e=new Set;for(const n of this._constraints)this._processConstraint(n,t,e,r=>r.update())}_processConstraint(t,e,n,r){if(n.has(t))return;if(e.has(t))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(t);const i=t.dependencies;for(const s of i)a1e(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,n,r)});r(t),n.add(t)}},c1e=new en,u1e=new en,d1e=class extends uN{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new en,this._invSrcRestQuat=new en}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),B1(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const t=c1e.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=u1e.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},f1e=new X,h1e=new en,p1e=new en,m1e=class extends uN{get rollAxis(){return this._rollAxis}set rollAxis(t){this._rollAxis=t,this._v3RollAxis.set(t==="X"?1:0,t==="Y"?1:0,t==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._rollAxis="X",this._v3RollAxis=new X(1,0,0),this._dstRestQuat=new en,this._invDstRestQuat=new en,this._invSrcRestQuatMulDstRestQuat=new en}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),B1(this._invDstRestQuat.copy(this._dstRestQuat)),B1(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const t=h1e.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=f1e.copy(this._v3RollAxis).applyQuaternion(t),r=p1e.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},g1e=new Set(["1.0","1.0-beta"]),qG=class W0{get name(){return W0.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return TU(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return TU(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf(W0.EXTENSION_NAME))!==-1))return null;const s=new l1e,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const d=r.nodes[l],f=(c=d==null?void 0:d.extensions)==null?void 0:c[W0.EXTENSION_NAME];if(f==null)return;const g=f.specVersion;if(!g1e.has(g)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${W0.EXTENSION_NAME} specVersion "${g}"`);return}const y=f.constraint;if(y.roll!=null){const x=this._importRollConstraint(a,o,y.roll);s.addConstraint(x)}else if(y.aim!=null){const x=this._importAimConstraint(a,o,y.aim);s.addConstraint(x)}else if(y.rotation!=null){const x=this._importRotationConstraint(a,o,y.rotation);s.addConstraint(x)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,r){const{source:i,rollAxis:s,weight:o}=r,a=n[i],l=new m1e(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new dT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:o}=r,a=n[i],l=new o1e(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new dT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,o=n[i],a=new d1e(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new dT(a);this.helperRoot.add(l)}return a}};qG.EXTENSION_NAME="VRMC_node_constraint";var v1e=qG,j_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),dN=class{},fT=new X,Vf=new X,KG=class extends dN{get type(){return"capsule"}constructor(t){var e,n,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new X(0,0,0),this.radius=(r=t==null?void 0:t.radius)!=null?r:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,n,r){fT.setFromMatrixPosition(t),Vf.subVectors(this.tail,this.offset).applyMatrix4(t),Vf.sub(fT);const i=Vf.lengthSq();r.copy(e).sub(fT);const s=Vf.dot(r);s<=0||(i<=s||Vf.multiplyScalar(s/i),r.sub(Vf));const o=r.length(),a=this.inside?this.radius-n-o:o-n-this.radius;return a<0&&(r.multiplyScalar(1/o),this.inside&&r.negate()),a}},hT=new X,PU=new Qt,YG=class extends dN{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new X(0,0,1)}calculateCollision(t,e,n,r){r.setFromMatrixPosition(t),r.negate().add(e),PU.getNormalMatrix(t),hT.copy(this.normal).applyNormalMatrix(PU).normalize();const i=r.dot(hT)-n;return r.copy(hT),i}},y1e=new X,ZG=class extends dN{get type(){return"sphere"}constructor(t){var e,n,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0,this.inside=(r=t==null?void 0:t.inside)!=null?r:!1}calculateCollision(t,e,n,r){r.subVectors(e,y1e.setFromMatrixPosition(t));const i=r.length(),s=this.inside?this.radius-n-i:i-n-this.radius;return s<0&&(r.multiplyScalar(1/i),this.inside&&r.negate()),s}},vl=new X,x1e=class extends nn{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._currentTail=new X,this._shape=t,this._attrPos=new rn(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new rn(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0);const n=vl.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){vl.copy(this._currentTail).sub(this._currentOffset);const t=vl.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,t+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,t+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,t,Math.sin(i),Math.cos(i))}const e=Math.atan2(vl.y,Math.sqrt(vl.x*vl.x+vl.z*vl.z)),n=-Math.atan2(vl.z,vl.x);this.rotateZ(e),this.rotateY(n),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){const e=(t+1)%34;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(68+t*2,34+t,34+e)}for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(136+t*2,68+t,68+e),this._attrIndex.setXY(200+t*2,100+t,100+e)}this._attrIndex.needsUpdate=!0}},b1e=class extends nn{constructor(t){super(),this.worldScale=1,this._currentOffset=new X,this._currentNormal=new X,this._shape=t,this._attrPos=new rn(new Float32Array(18),3),this.setAttribute("position",this._attrPos),this._attrIndex=new rn(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},_1e=class extends nn{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._shape=t,this._attrPos=new rn(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new rn(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.needsUpdate=!0}},w1e=new X,pT=class extends Ps{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof ZG)this._geometry=new _1e(this.collider.shape);else if(this.collider.shape instanceof KG)this._geometry=new x1e(this.collider.shape);else if(this.collider.shape instanceof YG)this._geometry=new b1e(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new Kr({color:16711935,depthTest:!1,depthWrite:!1});this._line=new no(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=w1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},S1e=class extends nn{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new X,this._springBone=t,this._attrPos=new rn(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new rn(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},M1e=new X,E1e=class extends Ps{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new S1e(this.springBone);const e=new Kr({color:16776960,depthTest:!1,depthWrite:!1});this._line=new no(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=M1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},mT=class extends vn{constructor(t){super(),this.colliderMatrix=new kt,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),A1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function A1e(t,e,n){const r=e.elements;t.copy(e),n&&(t.elements[12]=r[0]*n.x+r[4]*n.y+r[8]*n.z+r[12],t.elements[13]=r[1]*n.x+r[5]*n.y+r[9]*n.z+r[13],t.elements[14]=r[2]*n.x+r[6]*n.y+r[10]*n.z+r[14])}var T1e=new kt;function C1e(t){return t.invert?t.invert():t.getInverse(T1e.copy(t)),t}var P1e=class{constructor(t){this._inverseCache=new kt,this._shouldUpdateInverse=!0,this.matrix=t;const e={set:(n,r,i)=>(this._shouldUpdateInverse=!0,n[r]=i,!0)};this._originalElements=t.elements,t.elements=new Proxy(t.elements,e)}get inverse(){return this._shouldUpdateInverse&&(C1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},gT=new kt,Dm=new X,L0=new X,D0=new X,j0=new X,R1e=new kt,N1e=class{constructor(t,e,n={},r=[]){this._currentTail=new X,this._prevTail=new X,this._boneAxis=new X,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new kt,this._initialLocalRotation=new en,this._initialLocalChildPosition=new X;var i,s,o,a,l,c;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=n.hitRadius)!=null?i:0,stiffness:(s=n.stiffness)!=null?s:1,gravityPower:(o=n.gravityPower)!=null?o:0,gravityDir:(l=(a=n.gravityDir)==null?void 0:a.clone())!=null?l:new X(0,-1,0),dragForce:(c=n.dragForce)!=null?c:.4},this.colliderGroups=r}get dependencies(){const t=new Set,e=this.bone.parent;e&&t.add(e);for(let n=0;n{e(i)})}function xP(t,e){t.children.forEach(n=>{e(n)||xP(n,e)})}function k1e(t){var e;const n=new Map;for(const r of t){let i=r;do{const s=((e=n.get(i))!=null?e:0)+1;if(s===t.size)return i;n.set(i,s),i=i.parent}while(i!==null)}return null}var RU=class{constructor(){this._joints=new Set,this._sortedJoints=[],this._hasWarnedCircularDependency=!1,this._ancestors=[],this._objectSpringBonesMap=new Map,this._isSortedJointsDirty=!1,this._relevantChildrenUpdated=this._relevantChildrenUpdated.bind(this)}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const t=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(n=>{t.add(n)})}),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{t.add(n)})}),Array.from(t)}addJoint(t){this._joints.add(t);let e=this._objectSpringBonesMap.get(t.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t),this._isSortedJointsDirty=!0}addSpringBone(t){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(t)}deleteJoint(t){this._joints.delete(t),this._objectSpringBonesMap.get(t.bone).delete(t),this._isSortedJointsDirty=!0}deleteSpringBone(t){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(t)}setInitState(){this._sortJoints();for(let t=0;t{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(this._ancestors.push(s),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(t,e,n,r,i){if(n.has(t))return;if(e.has(t)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}e.add(t);const s=t.dependencies;for(const o of s){let a=!1,l=null;I1e(o,c=>{const d=this._objectSpringBonesMap.get(c);if(d)for(const f of d)a=!0,this._insertJointSort(f,e,n,r,i);else a||(l=c)}),l&&i.add(l)}r.push(t),n.add(t)}_relevantChildrenUpdated(t){var e,n;return((n=(e=this._objectSpringBonesMap.get(t))==null?void 0:e.size)!=null?n:0)>0?!0:(t.updateWorldMatrix(!1,!1),!1)}},NU="VRMC_springBone_extended_collider",O1e=new Set(["1.0","1.0-beta"]),L1e=new Set(["1.0"]),QG=class Vm{get name(){return Vm.EXTENSION_NAME}constructor(e,n){var r;this.parser=e,this.jointHelperRoot=n==null?void 0:n.jointHelperRoot,this.colliderHelperRoot=n==null?void 0:n.colliderHelperRoot,this.useExtendedColliders=(r=n==null?void 0:n.useExtendedColliders)!=null?r:!0}afterRoot(e){return j_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return j_(this,null,function*(){const n=yield this._v1Import(e);if(n!=null)return n;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return j_(this,null,function*(){var n,r,i,s,o;const a=e.parser.json;if(!(((n=a.extensionsUsed)==null?void 0:n.indexOf(Vm.EXTENSION_NAME))!==-1))return null;const c=new RU,d=yield e.parser.getDependencies("node"),f=(r=a.extensions)==null?void 0:r[Vm.EXTENSION_NAME];if(!f)return null;const g=f.specVersion;if(!O1e.has(g))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Vm.EXTENSION_NAME} specVersion "${g}"`),null;const y=(i=f.colliders)==null?void 0:i.map((S,w)=>{var b,M,T,C,O,N,L,F,G,k,U,H,te,ee,pe;const ie=d[S.node];if(ie==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} attempted to reference a node #${S.node} but not found. Skipping the collider`),null;const fe=S.shape,B=(b=S.extensions)==null?void 0:b[NU];if(this.useExtendedColliders&&B!=null){const Q=B.specVersion;if(!L1e.has(Q))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${NU} specVersion "${Q}". Fallbacking to the ${Vm.EXTENSION_NAME} definition`);else{const K=B.shape;if(K.sphere)return this._importSphereCollider(ie,{offset:new X().fromArray((M=K.sphere.offset)!=null?M:[0,0,0]),radius:(T=K.sphere.radius)!=null?T:0,inside:(C=K.sphere.inside)!=null?C:!1});if(K.capsule)return this._importCapsuleCollider(ie,{offset:new X().fromArray((O=K.capsule.offset)!=null?O:[0,0,0]),radius:(N=K.capsule.radius)!=null?N:0,tail:new X().fromArray((L=K.capsule.tail)!=null?L:[0,0,0]),inside:(F=K.capsule.inside)!=null?F:!1});if(K.plane)return this._importPlaneCollider(ie,{offset:new X().fromArray((G=K.plane.offset)!=null?G:[0,0,0]),normal:new X().fromArray((k=K.plane.normal)!=null?k:[0,0,1])})}}if(fe.sphere)return this._importSphereCollider(ie,{offset:new X().fromArray((U=fe.sphere.offset)!=null?U:[0,0,0]),radius:(H=fe.sphere.radius)!=null?H:0,inside:!1});if(fe.capsule)return this._importCapsuleCollider(ie,{offset:new X().fromArray((te=fe.capsule.offset)!=null?te:[0,0,0]),radius:(ee=fe.capsule.radius)!=null?ee:0,tail:new X().fromArray((pe=fe.capsule.tail)!=null?pe:[0,0,0]),inside:!1});console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} has no valid shape. Skipping the collider`)}),x=(s=f.colliderGroups)==null?void 0:s.map((S,w)=>{var b;return{colliders:((b=S.colliders)!=null?b:[]).map(T=>{const C=y==null?void 0:y[T];return C??(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${w} attempted to reference a collider #${T} but not found. Skipping the collider`),null)}).filter(T=>T!=null),name:S.name}});return(o=f.springs)==null||o.forEach((S,w)=>{var b;const M=S.joints,T=(b=S.colliderGroups)==null?void 0:b.map(N=>{const L=x==null?void 0:x[N];return L??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${w} attempted to reference a collider group #${N} but not found. Skipping the collider group`),null)}).filter(N=>N!=null),C=S.center!=null?d[S.center]:void 0;let O;M.forEach(N=>{if(O){const L=O.node,F=d[L],G=N.node,k=d[G],U={hitRadius:O.hitRadius,dragForce:O.dragForce,gravityPower:O.gravityPower,stiffness:O.stiffness,gravityDir:O.gravityDir!=null?new X().fromArray(O.gravityDir):void 0},H=this._importJoint(F,k,U,T);C&&(H.center=C),c.addJoint(H)}O=N})}),c.setInitState(),c})}_v0Import(e){return j_(this,null,function*(){var n,r,i;const s=e.parser.json;if(!(((n=s.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const d=new RU,f=yield e.parser.getDependencies("node"),g=(i=l.colliderGroups)==null?void 0:i.map((y,x)=>{var S;const w=f[y.node];return w==null?(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${x} attempted to reference a node #${y.node} but not found. Skipping the collider group`),null):{colliders:((S=y.colliders)!=null?S:[]).map((M,T)=>{var C,O,N;const L=new X(0,0,0);return M.offset&&L.set((C=M.offset.x)!=null?C:0,(O=M.offset.y)!=null?O:0,M.offset.z?-M.offset.z:0),this._importSphereCollider(w,{offset:L,radius:(N=M.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,x)=>{const S=y.bones;S&&S.forEach(w=>{var b,M,T,C;const O=f[w];if(O==null){console.warn(`VRMSpringBoneLoaderPlugin: The spring bone group #${x} attempted to reference a node #${w} but not found. Skipping the node`);return}const N=new X;y.gravityDir?N.set((b=y.gravityDir.x)!=null?b:0,(M=y.gravityDir.y)!=null?M:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const L=y.center!=null?f[y.center]:void 0,F={hitRadius:y.hitRadius,dragForce:y.dragForce,gravityPower:y.gravityPower,stiffness:y.stiffiness,gravityDir:N},G=(C=y.colliderGroups)==null?void 0:C.map(k=>{const U=g==null?void 0:g[k];return U??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${x} attempted to reference a collider group #${k} but not found. Skipping the collider group`),null)}).filter(k=>k!=null);O.traverse(k=>{var U;const H=(U=k.children[0])!=null?U:null,te=this._importJoint(k,H,F,G);L&&(te.center=L),d.addJoint(te)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new N1e(e,n,r,i);if(this.jointHelperRoot){const o=new E1e(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new ZG(n),i=new mT(r);if(e.add(i),this.colliderHelperRoot){const s=new pT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,n){const r=new KG(n),i=new mT(r);if(e.add(i),this.colliderHelperRoot){const s=new pT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,n){const r=new YG(n),i=new mT(r);if(e.add(i),this.colliderHelperRoot){const s=new pT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};QG.EXTENSION_NAME="VRMC_springBone";var D1e=QG,j1e=class{get name(){return"VRMLoaderPlugin"}constructor(t,e){var n,r,i,s,o,a,l,c,d,f;this.parser=t;const g=e==null?void 0:e.helperRoot,y=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(n=e==null?void 0:e.expressionPlugin)!=null?n:new J_e(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new twe(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new lwe(t,{helperRoot:g,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new Swe(t,{helperRoot:g}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new Awe(t),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new Bwe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Vwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new Ywe(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new D1e(t,{colliderHelperRoot:g,jointHelperRoot:g}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new v1e(t,{helperRoot:g})}beforeRoot(){return O_(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(t){return O_(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(t)})}getMaterialType(t){const e=this.mtoonMaterialPlugin.getMaterialType(t);return e??null}extendMaterialParams(t,e){return O_(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(t,e),yield this.mtoonMaterialPlugin.extendMaterialParams(t,e)})}afterRoot(t){return O_(this,null,function*(){yield this.metaPlugin.afterRoot(t),yield this.humanoidPlugin.afterRoot(t),yield this.expressionPlugin.afterRoot(t),yield this.lookAtPlugin.afterRoot(t),yield this.firstPersonPlugin.afterRoot(t),yield this.springBonePlugin.afterRoot(t),yield this.nodeConstraintPlugin.afterRoot(t),yield this.mtoonMaterialPlugin.afterRoot(t);const e=t.userData.vrmMeta,n=t.userData.vrmHumanoid;if(e&&n){const r=new Cwe({scene:t.scene,expressionManager:t.userData.vrmExpressionManager,firstPerson:t.userData.vrmFirstPerson,humanoid:n,lookAt:t.userData.vrmLookAt,meta:e,materials:t.userData.vrmMToonMaterials,springBoneManager:t.userData.vrmSpringBoneManager,nodeConstraintManager:t.userData.vrmNodeConstraintManager});t.userData.vrm=r}})}};function U1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function IU(t,e,n){if(e.size===1){const o=e.values().next().value;if(o.weight===1)return t[o.index]}const r=new Float32Array(t[0].count*3);let i=0;if(n)i=1;else for(const o of e)i+=o.weight;for(const o of e){const a=t[o.index],l=o.weight/i;for(let c=0;cd.getOrCreate(G)).join(","),L=`${C};${b};${N}`;let F=a.get(L);F==null&&(F=T.clone(),W1e(F,O,x),a.set(L,F)),M.geometry.setAttribute("skinIndex",F)}for(const M of y)M.bind(w,new kt)}}function B1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function H1e(t,e){const n=new Set;for(let r=0;rn)return!1;return!0}var vT=class{constructor(){this._objectIndexMap=new Map,this._index=0}get(t){return this._objectIndexMap.get(t)}getOrCreate(t){let e=this._objectIndexMap.get(t);return e==null&&(e=this._index,this._objectIndexMap.set(t,e),this._index++),e}};function X1e(t){var e,n,r,i;const s=new nn;s.name=t.name,s.setIndex(t.index);for(const[o,a]of Object.entries(t.attributes))s.setAttribute(o,a);for(const[o,a]of Object.entries(t.morphAttributes)){const l=o;s.morphAttributes[l]=a.concat()}s.morphTargetsRelative=t.morphTargetsRelative,s.groups=[];for(const o of t.groups)s.addGroup(o.start,o.count,o.materialIndex);return s.boundingSphere=(n=(e=t.boundingSphere)==null?void 0:e.clone())!=null?n:null,s.boundingBox=(i=(r=t.boundingBox)==null?void 0:r.clone())!=null?i:null,s.drawRange.start=t.drawRange.start,s.drawRange.count=t.drawRange.count,s.userData=t.userData,s}function kU(t){if(Object.values(t).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),t.isShaderMaterial){const e=t.uniforms;e&&Object.values(e).forEach(n=>{const r=n.value;r!=null&&r.isTexture&&r.dispose()})}t.dispose()}function q1e(t){const e=t.geometry;e&&e.dispose();const n=t.skeleton;n&&n.dispose();const r=t.material;r&&(Array.isArray(r)?r.forEach(i=>kU(i)):r&&kU(r))}function K1e(t){t.traverse(q1e)}function Y1e(t,e){var n,r;console.warn("VRMUtils.removeUnnecessaryJoints: removeUnnecessaryJoints is deprecated. Use combineSkeletons instead. combineSkeletons contributes more to the performance improvement. This function will be removed in the next major version.");const i=(n=e==null?void 0:e.experimentalSameBoneCounts)!=null?n:!1,s=[];t.traverse(l=>{l.type==="SkinnedMesh"&&s.push(l)});const o=new Map;let a=0;for(const l of s){const d=l.geometry.getAttribute("skinIndex");if(o.has(d))continue;const f=new Map,g=new Map;for(let y=0;y{e.addGroup(o.start,o.count,o.materialIndex)}),e.boundingBox=(r=(n=t.boundingBox)==null?void 0:n.clone())!=null?r:null,e.boundingSphere=(s=(i=t.boundingSphere)==null?void 0:i.clone())!=null?s:null,e.setDrawRange(t.drawRange.start,t.drawRange.count),e.userData=t.userData}function eSe(t,e,n){const r=e.array,i=new r.constructor(r.length);for(let s=0;s{if(!n.isMesh)return;const r=n,i=r.geometry,s=i.index;if(s==null)return;const o=e.get(i);if(o!=null){r.geometry=o;return}const{isVertexUsed:a,vertexCount:l,verticesUsed:c}=Z1e(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=Q1e(a),g=new nn;J1e(i,g),e.set(i,g),eSe(g,s,d),nSe(g,i.attributes,f),iSe(g,i.morphAttributes,f),r.geometry=g}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function oSe(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var qc=class{constructor(){}};qc.combineMorphs=F1e;qc.combineSkeletons=z1e;qc.deepDispose=K1e;qc.removeUnnecessaryJoints=Y1e;qc.removeUnnecessaryVertices=sSe;qc.rotateVRM0=oSe;/*! * @pixiv/three-vrm-core v3.5.4 * The implementation of core features of VRM, for @pixiv/three-vrm * @@ -5450,12 +5465,12 @@ void main() { * Copyright (c) 2019-2026 pixiv Inc. * @pixiv/three-vrm-springbone is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */const q1e={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function ka(t,e,n,r,i){var o;const s=(o=t.humanoid)==null?void 0:o.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function K1e(t){var e;for(const[n,r]of Object.entries(q1e))ka(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function Y1e(t,e,n,r,i,s){const o=Math.sin(e*1.7),a=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;ka(t,"hips",0,l*.045,l*.03),ka(t,"spine",o*.025+s*.07,a*.022,-l*.03),ka(t,"chest",o*.02+s*.02,a*.018,0),ka(t,"upperChest",o*.015,0,0),ka(t,"neck",i*.4+d*.5,r*.4,0),ka(t,"head",i*.6+d*.5+Math.sin(e*.6)*.015,r*.6+Math.sin(e*.27)*.025,Math.sin(e*.5)*.02);const f=Math.sin(e*.8)*.035;ka(t,"leftUpperArm",0,0,1.18+f+l*.04),ka(t,"rightUpperArm",0,0,-1.18-f+l*.04),ka(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),ka(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const Z1e=["happy","angry","sad","surprised","relaxed"],Q1e={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function J1e({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=R.useState(null),o=R.useRef({}),a=R.useRef({t:0,next:3,active:0}),l=R.useRef({yaw:0,pitch:0,tYaw:0,tPitch:0,t:0,next:2.5,lean:0});return R.useEffect(()=>{let c=!1,d=null;const f=new n_e;return f.register(m=>new M1e(m)),f.load(t,m=>{var x;if(c)return;const y=m.userData.vrm;if(!y){r("Datei enthält kein gültiges VRM-Modell.");return}qc.removeUnnecessaryVertices(m.scene),((x=y.meta)==null?void 0:x.metaVersion)==="0"&&qc.rotateVRM0(y),y.scene.rotation.y=Math.PI,K1e(y),d=y,s(y)},void 0,m=>{console.error("VRM-Load-Fehler:",m),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&qc.deepDispose(d.scene),s(null)}},[t,r]),bG((c,d)=>{var x;if(!i)return;const f=((x=e.current)==null?void 0:x.current)??0;i.lookAt&&(i.lookAt.target=c.camera);const m=l.current;m.t+=d,m.t>m.next&&(m.tYaw=(Math.random()-.5)*.5,m.tPitch=(Math.random()-.5)*.24,m.t=0,m.next=2.5+Math.random()*3.5),m.yaw+=(m.tYaw-m.yaw)*Math.min(1,d*1.5),m.pitch+=(m.tPitch-m.pitch)*Math.min(1,d*1.5),m.lean+=(Math.min(1,f*1.6)-m.lean)*Math.min(1,d*3),Y1e(i,c.clock.elapsedTime,f,m.yaw,m.pitch,m.lean);const y=i.expressionManager;if(y){const S=(o.current.aa??0)*.4+f*.6;o.current.aa=S,y.setValue("aa",S);const _=Q1e[n.current];for(const T of Z1e){const C=_===T?.75:0,O=o.current[T]??0,N=O+(C-O)*Math.min(1,d*4);o.current[T]=N,y.setValue(T,N)}const w=a.current;w.t+=d,w.active<=0&&w.t>w.next&&(w.active=.16,w.t=0,w.next=3+Math.random()*4);let E=0;if(w.active>0){w.active-=d;const T=1-w.active/.16;E=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,E))}i.update(d)}),i?g.jsx("primitive",{object:i.scene}):null}function eSe({url:t,audioLevel:e,emotion:n}){const[r,i]=R.useState(null);return g.jsxs("div",{className:"relative h-full w-full",children:[g.jsxs($be,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[g.jsx("ambientLight",{intensity:.85}),g.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),g.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),g.jsx(J1e,{url:t,audioLevel:e,emotion:n,onError:i},t),g.jsx(t_e,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&g.jsx("div",{className:"absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-red-500/15 border border-red-500/30 px-3 py-1.5 text-xs text-red-300",children:r})]})}const tSe=["elevenlabs","edge"],nSe={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function rSe(){const[t,e]=R.useState([]),[n,r]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=R.useState(localStorage.getItem("mc_voice_voice")||""),[o,a]=R.useState(!1),[l,c]=R.useState(()=>{const w=localStorage.getItem("mc_voice_volume");if(w===null||w==="")return .6;const E=Number(w);return Number.isNaN(E)?.6:E}),d=R.useRef(null),f=w=>{c(w),localStorage.setItem("mc_voice_volume",String(w)),window.dispatchEvent(new CustomEvent("mc-voice-volume",{detail:w}))},m=(w,E)=>{r(w),s(E),localStorage.setItem("mc_voice_engine",w),localStorage.setItem("mc_voice_voice",E)};R.useEffect(()=>{fetch("/api/voice/voices").then(w=>w.ok?w.json():Promise.reject()).then(w=>{const E=w.voices||[];if(e(E),!i){const T=E.find(C=>C.engine===n);T&&m(n,T.id)}}).catch(()=>e([]))},[]);const y=async()=>{var w;if(!o){a(!0);try{const E=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:n,voice:i})});if(!E.ok)throw new Error(`TTS ${E.status}`);const T=URL.createObjectURL(await E.blob());(w=d.current)==null||w.pause();const C=new Audio(T);C.volume=Math.min(1,l),d.current=C,C.onended=()=>URL.revokeObjectURL(T),await C.play()}catch(E){console.error("Probe fehlgeschlagen:",E)}finally{a(!1)}}},x=w=>{const E=t.find(T=>T.engine===w);m(w,(E==null?void 0:E.id)||"")},S=t.filter(w=>w.engine===n),_=n==="elevenlabs"&&S.length===0;return g.jsxs("div",{className:"text-sm",children:[g.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[g.jsx(Gm,{className:"h-3.5 w-3.5"})," Stimme"]}),t.length===0?g.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-300",children:"Voice-Dienst nicht erreichbar — Stimmen werden geladen, sobald der Sidecar läuft."}):g.jsxs("div",{className:"space-y-2",children:[g.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:tSe.map(w=>g.jsx("button",{onClick:()=>x(w),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===w?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:nSe[w]},w))}),g.jsx("select",{value:i,onChange:w=>m(n,w.target.value),className:"w-full rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50",children:S.map(w=>g.jsx("option",{value:w.id,children:w.label},w.id))}),g.jsxs("button",{onClick:y,disabled:o||_,className:"flex w-full items-center justify-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-2.5 py-2 text-xs text-primary hover:bg-primary/20 transition-colors disabled:opacity-60",children:[o?g.jsx(_P,{className:"h-3.5 w-3.5 animate-spin"}):g.jsx(DT,{className:"h-3.5 w-3.5"}),o?"Spielt …":"Probe hören"]}),g.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[g.jsx(DT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),g.jsx("input",{type:"range",min:0,max:1.2,step:.05,value:l,onChange:w=>f(Number(w.target.value)),className:"h-1 flex-1 cursor-pointer accent-primary",title:"Lautstärke"}),g.jsxs("span",{className:"w-9 text-right text-[11px] tabular-nums text-muted-foreground",children:[Math.round(l*100),"%"]})]}),_&&g.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",g.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder keine eigene Stimme angelegt."]}),n==="edge"&&g.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})}function iSe(t){const[e,n]=R.useState(!1),r=R.useRef(null),i=R.useRef([]),s=R.useRef(null),o=R.useCallback(async()=>{if(r.current)return;let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(f){console.error("Mikrofon-Zugriff verweigert:",f);return}s.current=l;const c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(l,{mimeType:c});i.current=[],d.ondataavailable=f=>{f.data.size&&i.current.push(f.data)},d.onstop=()=>{var m;const f=new Blob(i.current,{type:c});(m=s.current)==null||m.getTracks().forEach(y=>y.stop()),s.current=null,r.current=null,n(!1),f.size>1200&&t(f)},d.start(),r.current=d,n(!0)},[t]),a=R.useCallback(()=>{var l;(l=r.current)==null||l.stop()},[]);return R.useEffect(()=>()=>{var l,c;(l=r.current)==null||l.stop(),(c=s.current)==null||c.getTracks().forEach(d=>d.stop())},[]),{recording:e,start:o,stop:a}}class cN{constructor(){Ws(this,"ctx");Ws(this,"analyser");Ws(this,"gain");Ws(this,"queue",[]);Ws(this,"playing",!1);Ws(this,"raf",0);Ws(this,"freq");Ws(this,"level",{current:0});Ws(this,"onSpeaking");const e=window.AudioContext||window.webkitAudioContext;this.ctx=new e,this.analyser=this.ctx.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.6,this.gain=this.ctx.createGain(),this.gain.gain.value=cN.readVolume(),this.analyser.connect(this.gain),this.gain.connect(this.ctx.destination),this.freq=new Uint8Array(new ArrayBuffer(this.analyser.frequencyBinCount)),window.addEventListener("mc-voice-volume",n=>{const r=Number(n.detail);Number.isNaN(r)||(this.gain.gain.value=Math.max(0,Math.min(1.5,r)))})}static readVolume(){const e=localStorage.getItem("mc_voice_volume");if(e===null||e==="")return .6;const n=Number(e);return Number.isNaN(n)?.6:Math.max(0,Math.min(1.5,n))}async enqueue(e){this.queue.push(e),this.playing||await this.playNext()}clear(){this.queue=[]}async playNext(){var i,s;const e=this.queue.shift();if(!e){this.playing=!1,this.stopMeter(),(i=this.onSpeaking)==null||i.call(this,!1);return}if(this.playing=!0,(s=this.onSpeaking)==null||s.call(this,!0),this.ctx.state==="suspended")try{await this.ctx.resume()}catch{}let n;try{n=await this.ctx.decodeAudioData(e.slice(0))}catch{return this.playNext()}const r=this.ctx.createBufferSource();r.buffer=n,r.connect(this.analyser),r.onended=()=>{this.playNext()},r.start(),this.startMeter()}startMeter(){cancelAnimationFrame(this.raf);const e=()=>{this.analyser.getByteFrequencyData(this.freq);const n=Math.min(this.freq.length,48);let r=0;for(let s=2;s~|`]+/g," ").replace(/^\s*[-•·]\s+/gm," ").replace(/\s*&\s*/g," und ").replace(/(\d)\s*%/g,"$1 Prozent").replace(/%/g," Prozent ").replace(/(\d)\s*°\s*C?/g,"$1 Grad").replace(/°/g," Grad ").replace(/\s*=\s*/g," gleich ").replace(/\s*\/\s*/g," ").replace(/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{2190}-\u{21FF}\u{2B00}-\u{2BFF}]/gu,"").replace(/\s+/g," ").trim()}function IU(){let t=localStorage.getItem("mc_voice_session");return t||(t="voice-"+Math.random().toString(36).slice(2)+Date.now().toString(36),localStorage.setItem("mc_voice_session",t)),t}function cSe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function uSe(t){const e=[],n=/[^.!?…]+[.!?…]+(\s|$)/g;let r=0,i;for(;i=n.exec(t);)e.push(i[0].trim()),r=n.lastIndex;return{sentences:e,rest:t.slice(r)}}function dSe(){const[t,e]=R.useState("idle"),[n,r]=R.useState([]),[i,s]=R.useState(null),o=R.useRef({current:0}),a=R.useRef("neutral"),l=R.useRef(null),c=R.useRef(IU()),d=R.useCallback(()=>{if(!l.current){const E=new cN;E.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=E,o.current=E.level}return l.current},[]),f=R.useCallback(async E=>{var ne,ee,pe,se;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const fe=new FormData;fe.append("audio",E,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:fe});if(!B.ok)throw new Error(`STT ${B.status}`);C=((ne=(await B.json()).text)==null?void 0:ne.trim())||""}catch(fe){e("error"),s(`Spracherkennung fehlgeschlagen: ${fe.message}`);return}if(!C){e("idle");return}r(fe=>[...fe,{role:"user",text:C}]),e("thinking");const{engine:O,voice:N}=cSe();let L="",F="";r(fe=>[...fe,{role:"assistant",text:""}]);let G=Promise.resolve(),k=!1,U=!1;const H=fe=>{const B=lSe(fe);B&&(G=G.then(async()=>{try{const Q=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:B,engine:O,voice:N})});if(!Q.ok)throw new Error(`TTS ${Q.status}`);await T.enqueue(await Q.arrayBuffer()),k=!0}catch(Q){U=!0,console.error("TTS-Fehler:",Q)}}))};try{const fe=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:C,session_id:c.current,system:aSe})});if(!fe.ok||!fe.body)throw new Error(`Agent ${fe.status}`);const B=fe.body.getReader(),Q=new TextDecoder;let K="";for(;;){const{done:V,value:q}=await B.read();if(V)break;K+=Q.decode(q,{stream:!0});const he=K.split(` + */const aSe={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function ka(t,e,n,r,i){var o;const s=(o=t.humanoid)==null?void 0:o.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function lSe(t){var e;for(const[n,r]of Object.entries(aSe))ka(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function cSe(t,e,n,r,i,s){const o=Math.sin(e*1.7),a=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;ka(t,"hips",0,l*.045,l*.03),ka(t,"spine",o*.025+s*.07,a*.022,-l*.03),ka(t,"chest",o*.02+s*.02,a*.018,0),ka(t,"upperChest",o*.015,0,0),ka(t,"neck",i*.4+d*.5,r*.4,0),ka(t,"head",i*.6+d*.5+Math.sin(e*.6)*.015,r*.6+Math.sin(e*.27)*.025,Math.sin(e*.5)*.02);const f=Math.sin(e*.8)*.035;ka(t,"leftUpperArm",0,0,1.18+f+l*.04),ka(t,"rightUpperArm",0,0,-1.18-f+l*.04),ka(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),ka(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const uSe=["happy","angry","sad","surprised","relaxed"],dSe={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function fSe({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=P.useState(null),o=P.useRef({}),a=P.useRef({t:0,next:3,active:0}),l=P.useRef({yaw:0,pitch:0,tYaw:0,tPitch:0,t:0,next:2.5,lean:0});return P.useEffect(()=>{let c=!1,d=null;const f=new m_e;return f.register(g=>new j1e(g)),f.load(t,g=>{var x;if(c)return;const y=g.userData.vrm;if(!y){r("Datei enthält kein gültiges VRM-Modell.");return}qc.removeUnnecessaryVertices(g.scene),((x=y.meta)==null?void 0:x.metaVersion)==="0"&&qc.rotateVRM0(y),y.scene.rotation.y=Math.PI,lSe(y),d=y,s(y)},void 0,g=>{console.error("VRM-Load-Fehler:",g),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&qc.deepDispose(d.scene),s(null)}},[t,r]),MG((c,d)=>{var x;if(!i)return;const f=((x=e.current)==null?void 0:x.current)??0;i.lookAt&&(i.lookAt.target=c.camera);const g=l.current;g.t+=d,g.t>g.next&&(g.tYaw=(Math.random()-.5)*.5,g.tPitch=(Math.random()-.5)*.24,g.t=0,g.next=2.5+Math.random()*3.5),g.yaw+=(g.tYaw-g.yaw)*Math.min(1,d*1.5),g.pitch+=(g.tPitch-g.pitch)*Math.min(1,d*1.5),g.lean+=(Math.min(1,f*1.6)-g.lean)*Math.min(1,d*3),cSe(i,c.clock.elapsedTime,f,g.yaw,g.pitch,g.lean);const y=i.expressionManager;if(y){const S=(o.current.aa??0)*.4+f*.6;o.current.aa=S,y.setValue("aa",S);const w=dSe[n.current];for(const T of uSe){const C=w===T?.75:0,O=o.current[T]??0,N=O+(C-O)*Math.min(1,d*4);o.current[T]=N,y.setValue(T,N)}const b=a.current;b.t+=d,b.active<=0&&b.t>b.next&&(b.active=.16,b.t=0,b.next=3+Math.random()*4);let M=0;if(b.active>0){b.active-=d;const T=1-b.active/.16;M=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,M))}i.update(d)}),i?p.jsx("primitive",{object:i.scene}):null}function hSe({url:t,audioLevel:e,emotion:n}){const[r,i]=P.useState(null);return p.jsxs("div",{className:"relative h-full w-full",children:[p.jsxs(s_e,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[p.jsx("ambientLight",{intensity:.85}),p.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),p.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),p.jsx(fSe,{url:t,audioLevel:e,emotion:n,onError:i},t),p.jsx(p_e,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&p.jsx("div",{className:"absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-red-500/15 border border-red-500/30 px-3 py-1.5 text-xs text-red-300",children:r})]})}const pSe=["elevenlabs","edge"],mSe={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function gSe(){const[t,e]=P.useState([]),[n,r]=P.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=P.useState(localStorage.getItem("mc_voice_voice")||""),[o,a]=P.useState(!1),[l,c]=P.useState(()=>{const b=localStorage.getItem("mc_voice_volume");if(b===null||b==="")return .6;const M=Number(b);return Number.isNaN(M)?.6:M}),d=P.useRef(null),f=b=>{c(b),localStorage.setItem("mc_voice_volume",String(b)),window.dispatchEvent(new CustomEvent("mc-voice-volume",{detail:b}))},g=(b,M)=>{r(b),s(M),localStorage.setItem("mc_voice_engine",b),localStorage.setItem("mc_voice_voice",M)};P.useEffect(()=>{fetch("/api/voice/voices").then(b=>b.ok?b.json():Promise.reject()).then(b=>{const M=b.voices||[];if(e(M),!i){const T=M.find(C=>C.engine===n);T&&g(n,T.id)}}).catch(()=>e([]))},[]);const y=async()=>{var b;if(!o){a(!0);try{const M=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:n,voice:i})});if(!M.ok)throw new Error(`TTS ${M.status}`);const T=URL.createObjectURL(await M.blob());(b=d.current)==null||b.pause();const C=new Audio(T);C.volume=Math.min(1,l),d.current=C,C.onended=()=>URL.revokeObjectURL(T),await C.play()}catch(M){console.error("Probe fehlgeschlagen:",M)}finally{a(!1)}}},x=b=>{const M=t.find(T=>T.engine===b);g(b,(M==null?void 0:M.id)||"")},S=t.filter(b=>b.engine===n),w=n==="elevenlabs"&&S.length===0;return p.jsxs("div",{className:"text-sm",children:[p.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[p.jsx(Gm,{className:"h-3.5 w-3.5"})," Stimme"]}),t.length===0?p.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-300",children:"Voice-Dienst nicht erreichbar — Stimmen werden geladen, sobald der Sidecar läuft."}):p.jsxs("div",{className:"space-y-2",children:[p.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:pSe.map(b=>p.jsx("button",{onClick:()=>x(b),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===b?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:mSe[b]},b))}),p.jsx("select",{value:i,onChange:b=>g(n,b.target.value),className:"w-full rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50",children:S.map(b=>p.jsx("option",{value:b.id,children:b.label},b.id))}),p.jsxs("button",{onClick:y,disabled:o||w,className:"flex w-full items-center justify-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-2.5 py-2 text-xs text-primary hover:bg-primary/20 transition-colors disabled:opacity-60",children:[o?p.jsx(q1,{className:"h-3.5 w-3.5 animate-spin"}):p.jsx(zT,{className:"h-3.5 w-3.5"}),o?"Spielt …":"Probe hören"]}),p.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[p.jsx(zT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),p.jsx("input",{type:"range",min:0,max:1.2,step:.05,value:l,onChange:b=>f(Number(b.target.value)),className:"h-1 flex-1 cursor-pointer accent-primary",title:"Lautstärke"}),p.jsxs("span",{className:"w-9 text-right text-[11px] tabular-nums text-muted-foreground",children:[Math.round(l*100),"%"]})]}),w&&p.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",p.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder keine eigene Stimme angelegt."]}),n==="edge"&&p.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})}function vSe(t){const[e,n]=P.useState(!1),r=P.useRef(null),i=P.useRef([]),s=P.useRef(null),o=P.useCallback(async()=>{if(r.current)return;let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(f){console.error("Mikrofon-Zugriff verweigert:",f);return}s.current=l;const c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(l,{mimeType:c});i.current=[],d.ondataavailable=f=>{f.data.size&&i.current.push(f.data)},d.onstop=()=>{var g;const f=new Blob(i.current,{type:c});(g=s.current)==null||g.getTracks().forEach(y=>y.stop()),s.current=null,r.current=null,n(!1),f.size>1200&&t(f)},d.start(),r.current=d,n(!0)},[t]),a=P.useCallback(()=>{var l;(l=r.current)==null||l.stop()},[]);return P.useEffect(()=>()=>{var l,c;(l=r.current)==null||l.stop(),(c=s.current)==null||c.getTracks().forEach(d=>d.stop())},[]),{recording:e,start:o,stop:a}}class fN{constructor(){$s(this,"ctx");$s(this,"analyser");$s(this,"gain");$s(this,"queue",[]);$s(this,"playing",!1);$s(this,"raf",0);$s(this,"freq");$s(this,"level",{current:0});$s(this,"onSpeaking");const e=window.AudioContext||window.webkitAudioContext;this.ctx=new e,this.analyser=this.ctx.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.6,this.gain=this.ctx.createGain(),this.gain.gain.value=fN.readVolume(),this.analyser.connect(this.gain),this.gain.connect(this.ctx.destination),this.freq=new Uint8Array(new ArrayBuffer(this.analyser.frequencyBinCount)),window.addEventListener("mc-voice-volume",n=>{const r=Number(n.detail);Number.isNaN(r)||(this.gain.gain.value=Math.max(0,Math.min(1.5,r)))})}static readVolume(){const e=localStorage.getItem("mc_voice_volume");if(e===null||e==="")return .6;const n=Number(e);return Number.isNaN(n)?.6:Math.max(0,Math.min(1.5,n))}async enqueue(e){this.queue.push(e),this.playing||await this.playNext()}clear(){this.queue=[]}async playNext(){var i,s;const e=this.queue.shift();if(!e){this.playing=!1,this.stopMeter(),(i=this.onSpeaking)==null||i.call(this,!1);return}if(this.playing=!0,(s=this.onSpeaking)==null||s.call(this,!0),this.ctx.state==="suspended")try{await this.ctx.resume()}catch{}let n;try{n=await this.ctx.decodeAudioData(e.slice(0))}catch{return this.playNext()}const r=this.ctx.createBufferSource();r.buffer=n,r.connect(this.analyser),r.onended=()=>{this.playNext()},r.start(),this.startMeter()}startMeter(){cancelAnimationFrame(this.raf);const e=()=>{this.analyser.getByteFrequencyData(this.freq);const n=Math.min(this.freq.length,48);let r=0;for(let s=2;s~|`]+/g," ").replace(/^\s*[-•·]\s+/gm," ").replace(/\s*&\s*/g," und ").replace(/(\d)\s*%/g,"$1 Prozent").replace(/%/g," Prozent ").replace(/(\d)\s*°\s*C?/g,"$1 Grad").replace(/°/g," Grad ").replace(/\s*=\s*/g," gleich ").replace(/\s*\/\s*/g," ").replace(/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{2190}-\u{21FF}\u{2B00}-\u{2BFF}]/gu,"").replace(/\s+/g," ").trim()}function OU(){let t=localStorage.getItem("mc_voice_session");return t||(t="voice-"+Math.random().toString(36).slice(2)+Date.now().toString(36),localStorage.setItem("mc_voice_session",t)),t}function wSe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function SSe(t){const e=[],n=/[^.!?…]+[.!?…]+(\s|$)/g;let r=0,i;for(;i=n.exec(t);)e.push(i[0].trim()),r=n.lastIndex;return{sentences:e,rest:t.slice(r)}}function MSe(){const[t,e]=P.useState("idle"),[n,r]=P.useState([]),[i,s]=P.useState(null),o=P.useRef({current:0}),a=P.useRef("neutral"),l=P.useRef(null),c=P.useRef(OU()),d=P.useCallback(()=>{if(!l.current){const M=new fN;M.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=M,o.current=M.level}return l.current},[]),f=P.useCallback(async M=>{var te,ee,pe,ie;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const fe=new FormData;fe.append("audio",M,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:fe});if(!B.ok)throw new Error(`STT ${B.status}`);C=((te=(await B.json()).text)==null?void 0:te.trim())||""}catch(fe){e("error"),s(`Spracherkennung fehlgeschlagen: ${fe.message}`);return}if(!C){e("idle");return}r(fe=>[...fe,{role:"user",text:C}]),e("thinking");const{engine:O,voice:N}=wSe();let L="",F="";r(fe=>[...fe,{role:"assistant",text:""}]);let G=Promise.resolve(),k=!1,U=!1;const H=fe=>{const B=_Se(fe);B&&(G=G.then(async()=>{try{const Q=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:B,engine:O,voice:N})});if(!Q.ok)throw new Error(`TTS ${Q.status}`);await T.enqueue(await Q.arrayBuffer()),k=!0}catch(Q){U=!0,console.error("TTS-Fehler:",Q)}}))};try{const fe=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:C,session_id:c.current,system:bSe})});if(!fe.ok||!fe.body)throw new Error(`Agent ${fe.status}`);const B=fe.body.getReader(),Q=new TextDecoder;let K="";for(;;){const{done:V,value:q}=await B.read();if(V)break;K+=Q.decode(q,{stream:!0});const he=K.split(` `);K=he.pop()||"";for(const ae of he){const ce=ae.split(` -`).find($e=>$e.startsWith("data:"));if(!ce)continue;const we=ce.slice(5).trim();if(we==="[DONE]")continue;let Ee;try{Ee=JSON.parse(we)}catch{continue}if(Ee.error)throw new Error(Ee.error);const Xe=((se=(pe=(ee=Ee.choices)==null?void 0:ee[0])==null?void 0:pe.delta)==null?void 0:se.content)||"";if(!Xe)continue;L+=Xe,F+=Xe,a.current=oSe(L),r($e=>{const ue=$e.slice();return ue[ue.length-1]={role:"assistant",text:L},ue});const{sentences:Se,rest:je}=uSe(F);F=je,Se.forEach(H)}}if(F.trim()&&H(F),await G,!L.trim()){e("idle");return}k||(e("error"),s(U?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(fe){e("error"),s(`Agent-Antwort fehlgeschlagen: ${fe.message}`)}},[d]),{recording:m,start:y,stop:x}=iSe(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),_=R.useCallback(()=>{x()},[x]),w=R.useCallback(()=>{var E;(E=l.current)==null||E.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=IU()},[]);return R.useEffect(()=>{!m&&t==="listening"&&e("transcribing")},[m,t]),{status:t,messages:n,error:i,recording:m,audioLevel:o,emotion:a,pressStart:S,pressEnd:_,reset:w}}const fSe="/avatar.vrm";function hSe(t){return t.split(/(\*\*[^*\n]+\*\*)/g).map((e,n)=>{const r=e.match(/^\*\*([^*]+)\*\*$/);return r?g.jsx("strong",{className:"font-semibold text-foreground",children:r[1]},n):g.jsx("span",{children:e},n)})}function pSe(){return g.jsx("span",{className:"inline-flex items-center gap-1 align-middle",children:[0,1,2].map(t=>g.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground",style:{animationDelay:`${t*.15}s`}},t))})}const mSe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function gSe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:o,pressEnd:a,reset:l}=dSe(),c=R.useRef(!1),d=R.useRef(null);R.useEffect(()=>{var y;(y=d.current)==null||y.scrollIntoView({behavior:"smooth",block:"end"})},[e]),R.useEffect(()=>{const y=_=>_ instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(_.tagName),x=_=>{_.code!=="Space"||_.repeat||c.current||y(_.target)||(_.preventDefault(),c.current=!0,o())},S=_=>{_.code!=="Space"||!c.current||(_.preventDefault(),c.current=!1,a())};return window.addEventListener("keydown",x),window.addEventListener("keyup",S),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",S)}},[o,a]);const f=t==="speaking",m=t==="transcribing"||t==="thinking";return g.jsxs("div",{className:"flex h-full gap-5",children:[g.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[g.jsx("div",{className:"flex-1 min-h-0",children:g.jsx(eSe,{url:fSe,audioLevel:i,emotion:s})}),g.jsxs("div",{className:"shrink-0 flex flex-col items-center gap-3 border-t border-border/40 bg-background/30 py-5 backdrop-blur-sm",children:[g.jsxs("div",{className:rt("flex items-center gap-2 text-sm",t==="error"?"text-red-400":f?"text-primary":"text-muted-foreground"),children:[m&&g.jsx(_P,{className:"h-4 w-4 animate-spin"}),f&&g.jsx(DT,{className:"h-4 w-4 animate-pulse"}),g.jsx("span",{children:n||mSe[t]})]}),g.jsx("button",{onPointerDown:y=>{y.preventDefault(),c.current=!0,o()},onPointerUp:()=>{c.current&&(c.current=!1,a())},onPointerLeave:()=>{c.current&&(c.current=!1,a())},className:rt("flex h-20 w-20 items-center justify-center rounded-full border-2 transition-all select-none touch-none",r?"border-red-500 bg-red-500/20 scale-110 shadow-lg shadow-red-500/30":"border-primary/60 bg-primary/15 hover:bg-primary/25 hover:scale-105"),title:"Gedrückt halten zum Sprechen (oder Leertaste halten)",children:g.jsx(lF,{className:rt("h-8 w-8",r?"text-red-400":"text-primary")})}),g.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",g.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),g.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[g.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4",children:g.jsx(rSe,{})}),g.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[g.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),g.jsx("button",{onClick:l,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:g.jsx(Q8,{className:"h-3.5 w-3.5"})})]}),g.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4 scrollbar-thin",children:[e.length===0&&g.jsx("p",{className:"text-xs text-muted-foreground",children:"Halte den Knopf (oder die Leertaste) und sprich. Hermes hört zu, denkt mit seinem vollen Gedächtnis und seinen Werkzeugen — und antwortet hörbar."}),e.map((y,x)=>g.jsxs("div",{className:rt("flex flex-col gap-1",y.role==="user"?"items-end":"items-start"),children:[g.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:y.role==="user"?"Du":"Hermes"}),g.jsx("div",{className:rt("max-w-[88%] whitespace-pre-wrap break-words rounded-2xl px-3 py-2 text-sm leading-relaxed",y.role==="user"?"rounded-br-sm bg-primary/15 text-foreground":"rounded-bl-sm border border-border/40 bg-background/40 text-foreground/90"),children:y.text?hSe(y.text):g.jsx(pSe,{})})]},x)),g.jsx("div",{ref:d})]})]})]})]})}const kU=[{id:"grundlagen",label:"Grundlagen"},{id:"moe",label:"MoE & Quant"},{id:"lokal",label:"Lokal betreiben"},{id:"modelle",label:"Modell-Landschaft"},{id:"gateway",label:"Gateway-Trick"},{id:"mcp",label:"MCP"},{id:"skills",label:"Skills"},{id:"memory",label:"Gedächtnis & RAG"},{id:"agents",label:"Agenten"},{id:"ide",label:"IDE anbinden"},{id:"tricks",label:"Tricks & Kniffe"},{id:"wartung",label:"Sicherheit & Wartung"},{id:"ressourcen",label:"Ressourcen"},{id:"troubleshooting",label:"Troubleshooting"}];function vSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function go({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:o}){return g.jsxs("section",{id:t,className:rt("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",o&&"md:col-span-2"),children:[g.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[g.jsx(e,{className:rt("h-5 w-5 shrink-0",n)}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&g.jsx("span",{className:rt("text-[9px] font-mono",n),children:i})]})]}),g.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Vf({children:t}){return g.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[g.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[g.jsx(Gm,{className:"h-3 w-3"})," Bei dir konkret"]}),g.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function vn({children:t}){return g.jsx("code",{className:"rounded bg-background/40 border border-border/30 px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:t})}function Dr({href:t,name:e,note:n}){return g.jsxs("li",{className:"leading-relaxed",children:[g.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,g.jsx(x8,{className:"h-3 w-3 opacity-60"})]}),g.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function ySe(){const[t,e]=R.useState(!1);return g.jsxs("div",{className:"space-y-7",children:[g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 flex items-start gap-4",children:[g.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:g.jsx(PT,{className:"h-6 w-6 text-primary"})}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Die AI-Bibel"}),g.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-2xl",children:["Allgemeines Nachschlagewerk für lokale & agentische AI — Konzepte, Tricks, Kniffe und kuratierte Quellen. ",g.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",g.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),g.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:g.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:g.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[g.jsx(NT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?kU:kU.slice(0,9)).map(n=>g.jsx("button",{onClick:()=>vSe(n.id),className:"rounded-lg px-2.5 py-1 text-[11px] font-semibold text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:n.label},n.id)),g.jsx("button",{onClick:()=>e(n=>!n),className:"rounded-lg px-2 py-1 text-[11px] font-semibold text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:t?"weniger":"+ mehr"})]})})}),g.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[g.jsxs(go,{id:"grundlagen",icon:El,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[g.jsxs("p",{children:["Ein LLM ist im Kern ein ",g.jsx("strong",{children:"Wahrscheinlichkeits-Rechner für das nächste Token"}),' (Wortteil). Es „weiß" nichts — es setzt fort, was statistisch am plausibelsten ist. Daraus folgt fast alles andere.']}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),g.jsxs("li",{children:[g.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",g.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),g.jsxs(go,{id:"moe",icon:$1,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",g.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",g.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),g.jsxs("p",{children:[g.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx(vn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),g.jsxs("li",{children:[g.jsx(vn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),g.jsxs("li",{children:[g.jsx(vn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),g.jsxs(Vf,{children:["VRAM/RAM ist die harte Grenze — ",g.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",g.jsx(vn,{children:"Q4_K_M"}),"/",g.jsx(vn,{children:"Q6_K"}),"."]})]}),g.jsxs(go,{id:"lokal",icon:nw,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"llama-swap"})," — Proxy, der ",g.jsx("em",{children:"mehrere"})," Modelle hinter ",g.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),g.jsx("ul",{className:"list-disc pl-4 space-y-1",children:g.jsxs("li",{children:[g.jsx(vn,{children:"CUDA"})," NVIDIA · ",g.jsx(vn,{children:"ROCm"})," AMD · ",g.jsx(vn,{children:"Vulkan"})," herstellerübergreifend · ",g.jsx(vn,{children:"Metal"})," Apple"]})}),g.jsxs("p",{className:"pt-1",children:[g.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",g.jsx(vn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",g.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),g.jsxs(Vf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",g.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",g.jsx(vn,{children:"Vulkan/RADV"})," das offizielle ",g.jsx(vn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",g.jsx(vn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",g.jsx(vn,{children:"coder"})," nutzt Spec-Decoding."]})]}),g.jsxs(go,{id:"modelle",icon:RT,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx("p",{children:g.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Llama"})," (Meta), ",g.jsx("strong",{children:"Gemma"})," (Google), ",g.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"DeepSeek"}),", ",g.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx("p",{children:g.jsx("strong",{children:"Frontier (Cloud-API):"})}),g.jsx("ul",{className:"list-disc pl-4 space-y-1",children:g.jsxs("li",{children:[g.jsx("strong",{children:"Claude"})," (Anthropic), ",g.jsx("strong",{children:"GPT"})," (OpenAI), ",g.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),g.jsxs("p",{className:"pt-1",children:[g.jsx("strong",{children:"Modellwahl nach Aufgabe:"})," schnelles Alltags-Hirn · großes Logik-Hirn für harte Tasks · dediziertes Code-Modell · multimodal für Bilder · Embedding-Modell fürs Gedächtnis."]})]})]}),g.jsx("p",{className:"text-[11px] italic",children:'Leaderboards (HF, LMArena) sind grobe Orientierung — der einzige Benchmark, der zählt, ist deine eigene Aufgabe. Vorsicht vor „Benchmaxxing".'}),g.jsxs(Vf,{children:["Dein Line-up via llama-swap: ",g.jsx(vn,{children:"fast"})," (Alltag/Vision/MoE) · ",g.jsx(vn,{children:"heavy"})," (schwere Logik) ·",g.jsx(vn,{children:"coder"})," · ",g.jsx(vn,{children:"scout"})," · ",g.jsx(vn,{children:"vision"})," · ",g.jsx(vn,{children:"embed"})," (fürs Gedächtnis) ·",g.jsx(vn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",g.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),g.jsxs(go,{id:"gateway",icon:X8,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[g.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",g.jsx("strong",{children:"OpenAI-Format"})," (",g.jsx(vn,{children:"/v1/chat/completions"}),"). Ein",g.jsx("strong",{children:" Gateway"})," davor gibt dir ",g.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",g.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),g.jsxs("p",{children:["Die ",g.jsx(vn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),g.jsxs(Vf,{children:["Dein Gateway: ",g.jsx(vn,{children:"http://192.168.178.151:9001/v1"}),", Model ",g.jsx(vn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",g.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),g.jsxs(go,{id:"mcp",icon:kT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[g.jsxs("p",{children:["Das ",g.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",g.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),g.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),g.jsxs("div",{className:"flex items-start gap-1.5 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-2.5 text-[11px]",children:[g.jsx(V8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),g.jsxs("span",{children:[g.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),g.jsxs(go,{id:"skills",icon:Z8,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[g.jsxs("p",{children:["Ein ",g.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",g.jsx(vn,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),g.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- +`).find($e=>$e.startsWith("data:"));if(!ce)continue;const we=ce.slice(5).trim();if(we==="[DONE]")continue;let Ee;try{Ee=JSON.parse(we)}catch{continue}if(Ee.error)throw new Error(Ee.error);const Xe=((ie=(pe=(ee=Ee.choices)==null?void 0:ee[0])==null?void 0:pe.delta)==null?void 0:ie.content)||"";if(!Xe)continue;L+=Xe,F+=Xe,a.current=xSe(L),r($e=>{const ue=$e.slice();return ue[ue.length-1]={role:"assistant",text:L},ue});const{sentences:Se,rest:je}=SSe(F);F=je,Se.forEach(H)}}if(F.trim()&&H(F),await G,!L.trim()){e("idle");return}k||(e("error"),s(U?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(fe){e("error"),s(`Agent-Antwort fehlgeschlagen: ${fe.message}`)}},[d]),{recording:g,start:y,stop:x}=vSe(f),S=P.useCallback(()=>{d(),e("listening"),y()},[d,y]),w=P.useCallback(()=>{x()},[x]),b=P.useCallback(()=>{var M;(M=l.current)==null||M.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=OU()},[]);return P.useEffect(()=>{!g&&t==="listening"&&e("transcribing")},[g,t]),{status:t,messages:n,error:i,recording:g,audioLevel:o,emotion:a,pressStart:S,pressEnd:w,reset:b}}const ESe="/avatar.vrm";function ASe(t){return t.split(/(\*\*[^*\n]+\*\*)/g).map((e,n)=>{const r=e.match(/^\*\*([^*]+)\*\*$/);return r?p.jsx("strong",{className:"font-semibold text-foreground",children:r[1]},n):p.jsx("span",{children:e},n)})}function TSe(){return p.jsx("span",{className:"inline-flex items-center gap-1 align-middle",children:[0,1,2].map(t=>p.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground",style:{animationDelay:`${t*.15}s`}},t))})}const CSe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function PSe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:o,pressEnd:a,reset:l}=MSe(),c=P.useRef(!1),d=P.useRef(null);P.useEffect(()=>{var y;(y=d.current)==null||y.scrollIntoView({behavior:"smooth",block:"end"})},[e]),P.useEffect(()=>{const y=w=>w instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(w.tagName),x=w=>{w.code!=="Space"||w.repeat||c.current||y(w.target)||(w.preventDefault(),c.current=!0,o())},S=w=>{w.code!=="Space"||!c.current||(w.preventDefault(),c.current=!1,a())};return window.addEventListener("keydown",x),window.addEventListener("keyup",S),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",S)}},[o,a]);const f=t==="speaking",g=t==="transcribing"||t==="thinking";return p.jsxs("div",{className:"flex h-full gap-5",children:[p.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[p.jsx("div",{className:"flex-1 min-h-0",children:p.jsx(hSe,{url:ESe,audioLevel:i,emotion:s})}),p.jsxs("div",{className:"shrink-0 flex flex-col items-center gap-3 border-t border-border/40 bg-background/30 py-5 backdrop-blur-sm",children:[p.jsxs("div",{className:tt("flex items-center gap-2 text-sm",t==="error"?"text-red-400":f?"text-primary":"text-muted-foreground"),children:[g&&p.jsx(q1,{className:"h-4 w-4 animate-spin"}),f&&p.jsx(zT,{className:"h-4 w-4 animate-pulse"}),p.jsx("span",{children:n||CSe[t]})]}),p.jsx("button",{onPointerDown:y=>{y.preventDefault(),c.current=!0,o()},onPointerUp:()=>{c.current&&(c.current=!1,a())},onPointerLeave:()=>{c.current&&(c.current=!1,a())},className:tt("flex h-20 w-20 items-center justify-center rounded-full border-2 transition-all select-none touch-none",r?"border-red-500 bg-red-500/20 scale-110 shadow-lg shadow-red-500/30":"border-primary/60 bg-primary/15 hover:bg-primary/25 hover:scale-105"),title:"Gedrückt halten zum Sprechen (oder Leertaste halten)",children:p.jsx(dF,{className:tt("h-8 w-8",r?"text-red-400":"text-primary")})}),p.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",p.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),p.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[p.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4",children:p.jsx(gSe,{})}),p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[p.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),p.jsx("button",{onClick:l,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:p.jsx(fF,{className:"h-3.5 w-3.5"})})]}),p.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4 scrollbar-thin",children:[e.length===0&&p.jsx("p",{className:"text-xs text-muted-foreground",children:"Halte den Knopf (oder die Leertaste) und sprich. Hermes hört zu, denkt mit seinem vollen Gedächtnis und seinen Werkzeugen — und antwortet hörbar."}),e.map((y,x)=>p.jsxs("div",{className:tt("flex flex-col gap-1",y.role==="user"?"items-end":"items-start"),children:[p.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:y.role==="user"?"Du":"Hermes"}),p.jsx("div",{className:tt("max-w-[88%] whitespace-pre-wrap break-words rounded-2xl px-3 py-2 text-sm leading-relaxed",y.role==="user"?"rounded-br-sm bg-primary/15 text-foreground":"rounded-bl-sm border border-border/40 bg-background/40 text-foreground/90"),children:y.text?ASe(y.text):p.jsx(TSe,{})})]},x)),p.jsx("div",{ref:d})]})]})]})]})}const LU=[{id:"grundlagen",label:"Grundlagen"},{id:"moe",label:"MoE & Quant"},{id:"lokal",label:"Lokal betreiben"},{id:"modelle",label:"Modell-Landschaft"},{id:"gateway",label:"Gateway-Trick"},{id:"mcp",label:"MCP"},{id:"skills",label:"Skills"},{id:"memory",label:"Gedächtnis & RAG"},{id:"agents",label:"Agenten"},{id:"ide",label:"IDE anbinden"},{id:"tricks",label:"Tricks & Kniffe"},{id:"wartung",label:"Sicherheit & Wartung"},{id:"ressourcen",label:"Ressourcen"},{id:"troubleshooting",label:"Troubleshooting"}];function RSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function yo({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:o}){return p.jsxs("section",{id:t,className:tt("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",o&&"md:col-span-2"),children:[p.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[p.jsx(e,{className:tt("h-5 w-5 shrink-0",n)}),p.jsxs("div",{children:[p.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&p.jsx("span",{className:tt("text-[9px] font-mono",n),children:i})]})]}),p.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Gf({children:t}){return p.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[p.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[p.jsx(Gm,{className:"h-3 w-3"})," Bei dir konkret"]}),p.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function gn({children:t}){return p.jsx("code",{className:"rounded bg-background/40 border border-border/30 px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:t})}function Ur({href:t,name:e,note:n}){return p.jsxs("li",{className:"leading-relaxed",children:[p.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,p.jsx(S8,{className:"h-3 w-3 opacity-60"})]}),p.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function NSe(){const[t,e]=P.useState(!1);return p.jsxs("div",{className:"space-y-7",children:[p.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 flex items-start gap-4",children:[p.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:p.jsx(kT,{className:"h-6 w-6 text-primary"})}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Die AI-Bibel"}),p.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-2xl",children:["Allgemeines Nachschlagewerk für lokale & agentische AI — Konzepte, Tricks, Kniffe und kuratierte Quellen. ",p.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",p.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),p.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:p.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:p.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[p.jsx(LT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?LU:LU.slice(0,9)).map(n=>p.jsx("button",{onClick:()=>RSe(n.id),className:"rounded-lg px-2.5 py-1 text-[11px] font-semibold text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:n.label},n.id)),p.jsx("button",{onClick:()=>e(n=>!n),className:"rounded-lg px-2 py-1 text-[11px] font-semibold text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:t?"weniger":"+ mehr"})]})})}),p.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[p.jsxs(yo,{id:"grundlagen",icon:El,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[p.jsxs("p",{children:["Ein LLM ist im Kern ein ",p.jsx("strong",{children:"Wahrscheinlichkeits-Rechner für das nächste Token"}),' (Wortteil). Es „weiß" nichts — es setzt fort, was statistisch am plausibelsten ist. Daraus folgt fast alles andere.']}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[p.jsxs("li",{children:[p.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),p.jsxs("li",{children:[p.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",p.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),p.jsxs(yo,{id:"moe",icon:X1,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[p.jsxs("p",{children:[p.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",p.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",p.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),p.jsxs("p",{children:[p.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[p.jsxs("li",{children:[p.jsx(gn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),p.jsxs("li",{children:[p.jsx(gn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),p.jsxs("li",{children:[p.jsx(gn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),p.jsxs(Gf,{children:["VRAM/RAM ist die harte Grenze — ",p.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",p.jsx(gn,{children:"Q4_K_M"}),"/",p.jsx(gn,{children:"Q6_K"}),"."]})]}),p.jsxs(yo,{id:"lokal",icon:rw,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[p.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{children:[p.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[p.jsxs("li",{children:[p.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"llama-swap"})," — Proxy, der ",p.jsx("em",{children:"mehrere"})," Modelle hinter ",p.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{children:[p.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),p.jsx("ul",{className:"list-disc pl-4 space-y-1",children:p.jsxs("li",{children:[p.jsx(gn,{children:"CUDA"})," NVIDIA · ",p.jsx(gn,{children:"ROCm"})," AMD · ",p.jsx(gn,{children:"Vulkan"})," herstellerübergreifend · ",p.jsx(gn,{children:"Metal"})," Apple"]})}),p.jsxs("p",{className:"pt-1",children:[p.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",p.jsx(gn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",p.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),p.jsxs(Gf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",p.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",p.jsx(gn,{children:"Vulkan/RADV"})," das offizielle ",p.jsx(gn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",p.jsx(gn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",p.jsx(gn,{children:"coder"})," nutzt Spec-Decoding."]})]}),p.jsxs(yo,{id:"modelle",icon:OT,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[p.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{children:p.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[p.jsxs("li",{children:[p.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Llama"})," (Meta), ",p.jsx("strong",{children:"Gemma"})," (Google), ",p.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"DeepSeek"}),", ",p.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{children:p.jsx("strong",{children:"Frontier (Cloud-API):"})}),p.jsx("ul",{className:"list-disc pl-4 space-y-1",children:p.jsxs("li",{children:[p.jsx("strong",{children:"Claude"})," (Anthropic), ",p.jsx("strong",{children:"GPT"})," (OpenAI), ",p.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),p.jsxs("p",{className:"pt-1",children:[p.jsx("strong",{children:"Modellwahl nach Aufgabe:"})," schnelles Alltags-Hirn · großes Logik-Hirn für harte Tasks · dediziertes Code-Modell · multimodal für Bilder · Embedding-Modell fürs Gedächtnis."]})]})]}),p.jsx("p",{className:"text-[11px] italic",children:'Leaderboards (HF, LMArena) sind grobe Orientierung — der einzige Benchmark, der zählt, ist deine eigene Aufgabe. Vorsicht vor „Benchmaxxing".'}),p.jsxs(Gf,{children:["Dein Line-up via llama-swap: ",p.jsx(gn,{children:"fast"})," (Alltag/Vision/MoE) · ",p.jsx(gn,{children:"heavy"})," (schwere Logik) ·",p.jsx(gn,{children:"coder"})," · ",p.jsx(gn,{children:"scout"})," · ",p.jsx(gn,{children:"vision"})," · ",p.jsx(gn,{children:"embed"})," (fürs Gedächtnis) ·",p.jsx(gn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",p.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),p.jsxs(yo,{id:"gateway",icon:Q8,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[p.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",p.jsx("strong",{children:"OpenAI-Format"})," (",p.jsx(gn,{children:"/v1/chat/completions"}),"). Ein",p.jsx("strong",{children:" Gateway"})," davor gibt dir ",p.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",p.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),p.jsxs("p",{children:["Die ",p.jsx(gn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),p.jsxs(Gf,{children:["Dein Gateway: ",p.jsx(gn,{children:"http://192.168.178.151:9001/v1"}),", Model ",p.jsx(gn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",p.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),p.jsxs(yo,{id:"mcp",icon:jT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[p.jsxs("p",{children:["Das ",p.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",p.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),p.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),p.jsxs("div",{className:"flex items-start gap-1.5 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-2.5 text-[11px]",children:[p.jsx(X8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),p.jsxs("span",{children:[p.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),p.jsxs(yo,{id:"skills",icon:n9,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[p.jsxs("p",{children:["Ein ",p.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",p.jsx(gn,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),p.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- name: tdd-pro description: Treibt Entwicklung mit strikter TDD-Praxis --- # Instructions -...`}),g.jsxs("p",{children:["Suchen & installieren über die ",g.jsx("strong",{children:"skills.sh"}),"-Registry: ",g.jsx(vn,{children:"npx skills find"})," /",g.jsx(vn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),g.jsxs(go,{id:"memory",icon:N8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:["LLMs sind ",g.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",g.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:["extrahiert Fakten ",g.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),g.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),g.jsxs("li",{children:[g.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",g.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),g.jsxs(Vf,{children:["Dein Gedächtnis (Tab ",g.jsx("strong",{children:"Gedächtnis"}),") ist ",g.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",g.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",g.jsx(vn,{children:"Identität"})," · ",g.jsx(vn,{children:"Wissen"})," · ",g.jsx(vn,{children:"Regeln"})," · ",g.jsx(vn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",g.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",g.jsx("br",{}),g.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),g.jsxs(go,{id:"agents",icon:Il,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:["Ein ",g.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",g.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Least Privilege:"})," gib einem Agenten nur die Tools, die er wirklich braucht. Kritische Aktionen (Shell auf dem Host, Löschen, Geld/Deploys) hinter menschliche Freigabe."]}),g.jsxs("p",{children:[g.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",g.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),g.jsxs(Vf,{children:[g.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",g.jsx(vn,{children:"fast"}),"). Reden tust du mit ihm im",g.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",g.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",g.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",g.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),g.jsxs(go,{id:"ide",icon:aF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[g.jsxs("p",{children:["Jede ",g.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Cline"})," & ",g.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Continue"}),", ",g.jsx("strong",{children:"aider"})," (CLI), ",g.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),g.jsxs(Vf,{children:["Tipp den Kram nicht ab: der ",g.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",g.jsx(vn,{children:"…:9001/v1"}),", Model ",g.jsx(vn,{children:"auto"}),", Key beliebig."]})]}),g.jsx(go,{id:"tricks",icon:B8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:g.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:[["Kontext sauber halten","Neue Session statt Mega-Historie. Drift, Tempo und Halluzination hängen direkt am Kontext-Müll."],["Plan-then-Act","Erst Plan/Vorgehen bestätigen lassen, dann ausführen. Spart teure Holzwege."],["Gezielte Edits","Nie ganze Dateien überschreiben für eine Zeile — Such-/Ersetz-Tools nutzen. Weniger Tokens, weniger Fehler."],["Non-interaktive Befehle","Keine interaktiven Prompts im Agent-Terminal; lange Tasks als Background-Job. Sonst hängt der Loop."],["DevTools koppeln","Browser-/Konsolen-Zugriff geben — der Agent liest echte Fehler statt blind zu raten."],["Richtige Modellwahl","Schnelles Hirn für Alltag, großes für harte Logik, Coder fürs Coden. Nicht alles mit der Kanone."],["Akzeptanzkriterien","Sag konkret, woran „fertig“ erkennbar ist. Vage Prompts → vage Ergebnisse."],["Verifizieren statt vertrauen","Tests/Live-Check fordern. „Sollte funktionieren“ ist kein Beweis."],["Regeln ins Gedächtnis","Wiederkehrende Vorlieben/Konventionen einmal ablegen — der Agent zieht sie selbst."]].map(([n,r])=>g.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[g.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[g.jsx(bh,{className:"h-3 w-3 text-amber-400"})," ",n]}),g.jsx("p",{className:"text-[11px]",children:r})]},n))})}),g.jsx(go,{id:"wartung",icon:Zm,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[g.jsx(O8,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[g.jsx(rw,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",g.jsx(vn,{children:"restore.sh"})," (Doku in ",g.jsx(vn,{children:"docs/BACKUP.md"}),")."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",g.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",g.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),g.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),g.jsxs("section",{id:"ressourcen",className:"scroll-mt-20 md:col-span-2 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[g.jsx(NT,{className:"h-5 w-5 text-primary"}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),g.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),g.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(RT,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Dr,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),g.jsx(Dr,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),g.jsx(Dr,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),g.jsx(Dr,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),g.jsx(Dr,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),g.jsx(Dr,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(kT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Dr,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),g.jsx(Dr,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),g.jsx(Dr,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),g.jsx(Dr,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),g.jsx(Dr,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(Il,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Dr,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),g.jsx(Dr,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),g.jsx(Dr,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),g.jsx(Dr,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),g.jsx(Dr,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(PT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Dr,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),g.jsx(Dr,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),g.jsx(Dr,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),g.jsx(Dr,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),g.jsx(Dr,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),g.jsx(go,{id:"troubleshooting",icon:z8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:g.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",g.jsx(vn,{children:":9001"}),")? Backend-Status in der ",g.jsx("strong",{children:"Zentrale"})," prüfen."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",g.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",g.jsx(vn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",g.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",g.jsx(vn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),g.jsx("p",{className:"text-center text-[10px] text-muted-foreground/50 pt-2",children:"Mission Control 2 · AI-Bibel · Stand Juni 2026 — lebendes Dokument, wächst mit dem Stack."})]})}function xSe({title:t,hint:e}){return g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-xl font-semibold",children:t}),g.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),g.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[g.jsx(R8,{className:"h-8 w-8 text-muted-foreground"}),g.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const OU=[{id:"mission-control-2",label:"Mission Control",type:"user",reach:"gateway (integr"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user",reach:"hermes-gateway"},{id:"mem0-service",label:"Mem0 (Gedächtnis)",type:"user",reach:"mem0"},{id:"hermes-terminal",label:"Hermes Terminal",type:"user",reach:"hermes-terminal"},{id:"llama-swap",label:"Llama Swap",type:"system",reach:"llama-swap"}];function U0({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:o,onAction:a}){return g.jsxs("div",{className:rt("flex items-center gap-3 rounded-lg border px-3 py-2",i?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[g.jsx(t,{className:rt("h-4 w-4 shrink-0",e)}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs text-foreground truncate",children:n}),g.jsx("div",{className:rt("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),g.jsx("button",{onClick:a,disabled:!i||s,className:rt("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:s?"…":o})]})}function bSe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return g.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[g.jsx("span",{className:rt("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),g.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&g.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),g.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:g.jsx(Zf,{className:rt("h-3.5 w-3.5",r&&"animate-spin")})}),g.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:g.jsx(I8,{className:"h-3.5 w-3.5"})})]})}function pT(t){return t==null?"":t>1024**3?`${(t/1024**3).toFixed(2)} GB`:`${(t/1024**2).toFixed(1)} MB`}function _Se({open:t,onClose:e,defaultTab:n="maintenance"}){var Ke;const[r,i]=R.useState(null),[s,o]=R.useState([]),[a,l]=R.useState("llama-swap"),[c,d]=R.useState(""),[f,m]=R.useState(!1),[y,x]=R.useState(null),[S,_]=R.useState({}),[w,E]=R.useState("maintenance"),[T,C]=R.useState(!1),[O,N]=R.useState(""),[L,F]=R.useState(!1),[G,k]=R.useState(null),[U,H]=R.useState([]),[ne,ee]=R.useState(!1),[pe,se]=R.useState(null),[fe,B]=R.useState(null);function Q(re,Qe,St){B({type:"alert",title:re,message:Qe,onConfirm:()=>{B(null),St&&St()}})}function K(re,Qe,St){B({type:"confirm",title:re,message:Qe,onConfirm:()=>{B(null),St()},onCancel:()=>B(null)})}function V(re){return re?new Date(re*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[q,he]=R.useState(""),[ae,ce]=R.useState(""),[we,Ee]=R.useState(!1),[Xe,Se]=R.useState(!1);R.useEffect(()=>{t&&(he(localStorage.getItem("mc_sudo_password")||""),ce(localStorage.getItem("mc_hf_token")||""))},[t]),R.useEffect(()=>{t&&n&&E(n)},[t,n]);const je=R.useRef(null);function $e(){zt("/api/maintenance/updates").then(i).catch(re=>console.error("Error loading updates",re))}function ue(){zt("/api/jobs").then(re=>o(re.jobs||[])).catch(re=>console.error("Error loading jobs",re))}function Z(){zt("/api/system/services").then(k).catch(()=>{})}function Ge(){zt("/api/system/backups").then(re=>H(re.backups||[])).catch(()=>{})}function Oe(re){m(!0),x(null),zt(`/api/maintenance/logs?service=${re}&lines=150`).then(Qe=>{Qe.ok?d(Qe.text):(d(`Fehler beim Laden der Logs: ${Qe.err||"Unbekannter Fehler"}`),(Qe.status==="incorrect_password"||Qe.status==="password_required")&&x(Qe.status))}).catch(Qe=>d(`Fehler: ${Qe.message}`)).finally(()=>{m(!1),setTimeout(()=>{je.current&&(je.current.scrollTop=je.current.scrollHeight)},50)})}R.useEffect(()=>{if(!t)return;$e(),ue(),Z(),Ge();const re=setInterval(()=>{ue(),$e(),Z()},3e3);return()=>clearInterval(re)},[t]),R.useEffect(()=>{!t||w!=="logs"||Oe(a)},[t,w,a]);function We(re){return(re==null?void 0:re.status)==="busy"?(Q("Update läuft bereits",`Es läuft gerade „${re.running}". Bitte warte, bis es fertig ist.`),ue(),!0):!1}async function tt(){try{const re=await zt("/api/maintenance/os-update",{method:"POST"});if(We(re))return;ue(),E("maintenance")}catch(re){Q("Fehler",`Fehler beim Starten des OS-Updates: ${re.message}`)}}async function wt(){try{const re=await zt("/api/maintenance/engine-update",{method:"POST"});if(We(re))return;ue(),E("maintenance")}catch(re){Q("Fehler",`Fehler beim Engine-Update: ${re.message}`)}}async function dt(){try{const re=await zt("/api/maintenance/swap-update",{method:"POST"});if(We(re))return;ue(),E("maintenance")}catch(re){Q("Fehler",`Fehler beim Router-Update: ${re.message}`)}}async function J(){ee(!0);try{const re=await zt("/api/maintenance/hermes-update",{method:"POST"});if(We(re))return;ue()}catch(re){Q("Fehler",`Hermes-Update fehlgeschlagen: ${re.message}`)}finally{ee(!1)}}async function $(re){se({kind:re,loading:!0,data:null});try{const Qe=await zt(`/api/maintenance/update-details?kind=${re}`);se({kind:re,loading:!1,data:Qe})}catch(Qe){se({kind:re,loading:!1,data:{kind:re,error:Qe.message}})}}function Me(){const re=pe==null?void 0:pe.kind;se(null),re==="os"?tt():re==="engine"?wt():re==="swap"?dt():re==="hermes"&&J()}async function Ue(){C(!0);try{await zt("/api/maintenance/check-updates",{method:"POST"}),ue(),E("maintenance")}catch(re){Q("Fehler",`Fehler bei der Update-Suche: ${re.message}`)}finally{C(!1)}}async function He(re,Qe){try{await zt("/api/models/install",{method:"POST",body:JSON.stringify({repo:re,role:Qe})}),Q("Gestartet",`Modell-Upgrade für '${Qe}' (${re}) gestartet.`),ue(),E("maintenance")}catch(St){Q("Fehler",`Fehler beim Starten des Modell-Upgrades: ${St.message}`)}}async function Be(){K("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await zt("/api/maintenance/reboot",{method:"POST"}),Q("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(re){Q("Fehler",`Fehler beim Reboot: ${re.message}`)}})}async function bt(){F(!0),N("Snapshot wird erzeugt...");try{const re=await zt("/api/system/backup",{method:"POST"});N(re.ok?`Snapshot erzeugt: ${re.snapshot} (${re.files.length} Komponenten)`:"Backup fehlgeschlagen."),Ge()}catch(re){N(`Fehler: ${re.message}`)}finally{F(!1)}}async function it(re){_(Qe=>({...Qe,[re]:!0}));try{const Qe=await zt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:re})});Qe.ok?Q("Dienst neu gestartet",`Dienst ${re} wurde erfolgreich neu gestartet.`,()=>{w==="logs"&&a===re&&Oe(re)}):Q("Fehler",`Fehler beim Neustart: ${Qe.err||"Unbekannter Fehler"}`)}catch(Qe){Q("Fehler",`Fehler beim Neustart: ${Qe.message}`)}finally{_(Qe=>({...Qe,[re]:!1}))}}async function ht(re){try{await zt(`/api/jobs/${re}/cancel`,{method:"POST"}),ue()}catch(Qe){Q("Fehler",`Fehler beim Abbrechen: ${Qe.message}`)}}const Gt=s.find(re=>(re.state==="running"||re.state==="queued")&&re.group==="maintenance");return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:rt("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:e}),g.jsxs("div",{className:rt("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",t?"translate-x-0":"translate-x-full"),children:[g.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),g.jsx("button",{onClick:e,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[g.jsx("button",{onClick:()=>E("maintenance"),className:rt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",w==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),g.jsx("button",{onClick:()=>E("logs"),className:rt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",w==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),g.jsx("button",{onClick:()=>E("settings"),className:rt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",w==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[w==="maintenance"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"space-y-2.5",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),g.jsxs("button",{onClick:Ue,disabled:T||!!Gt,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[g.jsx(Zf,{className:rt("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&g.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",V(r.last_check)]}),Gt&&g.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-300",children:[g.jsx(Zf,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),g.jsxs("span",{children:["Update läuft: ",g.jsx("span",{className:"font-semibold",children:Gt.label})," — bitte warten. Weitere Updates sind solange gesperrt."]})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx(U0,{icon:Zm,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(r!=null&&r.os),status:r!=null&&r.os?`${r.os} verfügbar`:"aktuell",actionLabel:"Anzeigen",onAction:()=>$("os")}),g.jsx(U0,{icon:nw,iconClass:"text-violet-400",name:"Inferenz-Engine (llama.cpp)",available:!!(r!=null&&r.engine),status:r!=null&&r.engine?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>$("engine")}),g.jsx(U0,{icon:cI,iconClass:"text-fuchsia-400",name:"Router (llama-swap)",available:!!(r!=null&&r.swap),status:r!=null&&r.swap?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>$("swap")}),(()=>{var Qe;const re=(Qe=r==null?void 0:r.components)==null?void 0:Qe.find(St=>St.key==="hermes_agent");return g.jsx(U0,{icon:Il,iconClass:"text-amber-400",name:"Hermes-Agent",available:(re==null?void 0:re.update)===!0,busy:ne,status:(re==null?void 0:re.update)===!0?`Update: ${re.latest}`:(re==null?void 0:re.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>$("hermes")})})(),(Ke=r==null?void 0:r.model_list)==null?void 0:Ke.map(re=>g.jsx(U0,{icon:b8,iconClass:"text-emerald-400",name:`Modell · ${re.role}`,available:!0,status:re.title,actionLabel:"Upgrade",onAction:()=>He(re.repo,re.role)},re.role))]})]}),g.jsxs("div",{className:"space-y-2.5",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),g.jsx("div",{className:"space-y-1.5",children:OU.map(re=>{var Qe;return g.jsx(bSe,{label:re.label,system:re.type==="system",ok:(Qe=G==null?void 0:G.services.find(St=>St.name.toLowerCase().includes(re.reach)))==null?void 0:Qe.ok,busy:S[re.id],onRestart:()=>it(re.id),onLogs:()=>{l(re.id),E("logs")}},re.id)})})]}),g.jsxs("div",{className:"space-y-2.5",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),g.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs text-foreground truncate",children:U[0]?`Letztes: ${U[0].snapshot}`:"Noch kein Backup"}),g.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[U.length," Snapshots · Restore per CLI (restore.sh)"]})]}),g.jsxs("button",{onClick:bt,disabled:L,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[g.jsx(_8,{className:rt("h-3.5 w-3.5",L&&"animate-pulse")})," Snapshot"]})]}),O&&g.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:O})]}),g.jsxs("div",{className:"space-y-2.5",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),g.jsxs("button",{onClick:Be,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[g.jsx(Y8,{className:"h-4.5 w-4.5"}),g.jsxs("div",{children:[g.jsx("div",{children:"Host-System neu starten"}),g.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),g.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(re=>re.state==="running"||re.state==="queued").length," Aktiv"]})]}),g.jsx("div",{className:"space-y-3",children:s.length===0?g.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):s.map(re=>{const Qe=re.state==="running"||re.state==="queued";return g.jsxs("div",{className:rt("p-3 rounded-xl border transition-all duration-300",Qe?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{className:"space-y-1",children:[g.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[Qe&&g.jsxs("span",{className:"flex h-2 w-2 relative",children:[g.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),g.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),re.label]}),g.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[g.jsxs("span",{children:["ID: ",re.id]}),g.jsx("span",{children:"•"}),g.jsx("span",{className:rt(re.state==="done"&&"text-emerald-400",re.state==="failed"&&"text-red-400",re.state==="running"&&"text-primary",re.state==="queued"&&"text-amber-400",re.state==="canceled"&&"text-muted-foreground"),children:re.state})]})]}),Qe&&g.jsx("button",{onClick:()=>ht(re.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),re.state==="running"&&g.jsxs("div",{className:"mt-3 space-y-1",children:[g.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:g.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${re.progress??0}%`}})}),g.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[g.jsxs("span",{children:[re.progress??0,"%"]}),re.done_bytes!=null&&re.total_bytes!=null&&g.jsxs("span",{children:[pT(re.done_bytes)," / ",pT(re.total_bytes),re.rate_bps!=null&&` (${pT(re.rate_bps)}/s)`]}),re.eta_s!=null&&g.jsxs("span",{children:["ETA: ",re.eta_s,"s"]})]})]})]},re.id)})})]})]}),w==="logs"&&g.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("select",{value:a,onChange:re=>l(re.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:OU.map(re=>g.jsxs("option",{value:re.id,children:[re.label," (",re.type==="system"?"systemd-root":"user",")"]},re.id))}),g.jsxs("button",{onClick:()=>it(a),disabled:S[a],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[g.jsx(Zf,{className:rt("h-3.5 w-3.5",S[a]&&"animate-spin")}),"Restart"]})]}),g.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[g.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[g.jsx(uF,{className:"h-3 w-3 text-primary"}),g.jsxs("span",{children:["stdout/stderr - ",a]})]}),g.jsx("button",{onClick:()=>Oe(a),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:g.jsx(Zf,{className:rt("h-3 w-3",f&&"animate-spin")})})]}),g.jsx("pre",{ref:je,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:y==="password_required"||y==="incorrect_password"?g.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[g.jsx(_g,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),g.jsx("div",{className:"text-xs font-semibold text-amber-300",children:y==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),g.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",a," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),g.jsx("button",{onClick:()=>E("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):f&&!c?g.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||g.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),w==="settings"&&g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),g.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[g.jsx(Zm,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),g.jsxs("div",{className:"relative",children:[g.jsx("input",{type:we?"text":"password",value:q,onChange:re=>he(re.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),g.jsx("button",{type:"button",onClick:()=>Ee(!we),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:we?g.jsx(aI,{className:"h-4 w-4"}):g.jsx(IT,{className:"h-4 w-4"})})]}),g.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[g.jsx(j8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),g.jsxs("div",{className:"relative",children:[g.jsx("input",{type:Xe?"text":"password",value:ae,onChange:re=>ce(re.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),g.jsx("button",{type:"button",onClick:()=>Se(!Xe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Xe?g.jsx(aI,{className:"h-4 w-4"}):g.jsx(IT,{className:"h-4 w-4"})})]}),g.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),g.jsxs("div",{className:"flex gap-3 pt-2",children:[g.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",q),localStorage.setItem("mc_hf_token",ae),Q("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),g.jsx("button",{onClick:()=>{he(""),ce(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),Q("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),pe&&(()=>{var Qt;const re=pe.data,Qe={os:{icon:Zm,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:nw,cls:"text-violet-400",title:"Inferenz-Engine (llama.cpp)"},swap:{icon:cI,cls:"text-fuchsia-400",title:"Router (llama-swap)"},hermes:{icon:Il,cls:"text-amber-400",title:"Hermes-Agent"}}[pe.kind],St=Qe.icon,mt=re?pe.kind==="os"?(re.count??0)===0:pe.kind==="hermes"?(re.behind??0)===0:re.installed_build!=null&&re.latest_build!=null&&re.latest_build<=re.installed_build:!0;return g.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[g.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>se(null)}),g.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-2xl border border-border/60 bg-card shadow-2xl font-sans text-foreground",children:[g.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-5",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(St,{className:rt("h-4.5 w-4.5",Qe.cls)}),g.jsx("h3",{className:"text-sm font-semibold",children:Qe.title})]}),g.jsx("button",{onClick:()=>se(null),className:"flex h-7 w-7 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:pe.loading?g.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[g.jsx(Zf,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):re!=null&&re.error?g.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:re.error}):pe.kind==="os"?((re==null?void 0:re.count)??0)===0?g.jsx("div",{className:"text-muted-foreground",children:"Keine Pakete zu aktualisieren — System ist aktuell."}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"text-muted-foreground",children:[re.count," Paket(e) werden aktualisiert:"]}),g.jsx("div",{className:"space-y-1",children:re.packages.map(de=>g.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[g.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[g.jsx(q8,{className:"h-3 w-3 text-cyan-400 shrink-0"}),de.name]}),g.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[g.jsx("span",{children:de.current}),g.jsx(ew,{className:"h-3 w-3"}),g.jsx("span",{className:"text-emerald-400",children:de.candidate})]})]},de.name))})]}):pe.kind==="engine"||pe.kind==="swap"?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[g.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(re==null?void 0:re.installed_build)??"?"]}),g.jsx(ew,{className:"h-3.5 w-3.5 text-muted-foreground"}),g.jsxs("span",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/5 px-2 py-1 text-emerald-400",children:["Build ",(re==null?void 0:re.latest_build)??"?"]})]}),((re==null?void 0:re.name)||(re==null?void 0:re.latest_tag))&&g.jsxs("div",{className:"text-muted-foreground",children:["Release: ",g.jsx("span",{className:"text-foreground",children:re==null?void 0:re.name}),re!=null&&re.latest_tag?` (${re.latest_tag})`:""]}),(re==null?void 0:re.url)&&g.jsxs("a",{href:re.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Release-Notes auf GitHub ",g.jsx(bg,{className:"h-3 w-3"})]}),(re==null?void 0:re.body)&&g.jsx("pre",{className:"whitespace-pre-wrap rounded-lg border border-border/40 bg-background/30 p-3 text-[10px] leading-relaxed text-muted-foreground max-h-60 overflow-y-auto scrollbar-thin",children:re.body})]}):(((Qt=re==null?void 0:re.commits)==null?void 0:Qt.length)??0)===0?g.jsx("div",{className:"text-muted-foreground",children:"Keine neuen Commits — Hermes-Agent ist bereits aktuell."}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"text-muted-foreground",children:[re.behind," neue Commit(s) auf ",g.jsxs("span",{className:"font-mono text-foreground",children:["origin/",re.branch]}),":"]}),g.jsx("div",{className:"space-y-1",children:re.commits.map(de=>g.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[g.jsx(L8,{className:"h-3.5 w-3.5 text-primary shrink-0 mt-0.5"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-[11px] truncate",children:de.subject}),g.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[de.hash," · ",de.when]})]})]},de.hash))}),g.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Vor dem Update wird automatisch ein Backup erstellt; danach startet der Hermes-Gateway neu."})]})}),g.jsxs("div",{className:"flex gap-3 border-t border-border/40 p-4 shrink-0",children:[g.jsx("button",{onClick:()=>se(null),className:"h-9 flex-1 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold text-muted-foreground hover:bg-accent transition-colors cursor-pointer",children:"Schließen"}),g.jsx("button",{onClick:Me,disabled:pe.loading||mt||!!Gt,title:Gt?`Update läuft bereits: ${Gt.label}`:void 0,className:"h-9 flex-1 rounded-lg bg-primary text-xs font-semibold text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-40 disabled:cursor-default",children:Gt?"Update läuft…":"Jetzt aktualisieren"})]})]})]})})(),fe&&g.jsx(fV,{type:fe.type,title:fe.title,message:fe.message,onConfirm:fe.onConfirm,onCancel:fe.onCancel})]})}function wSe(){var f,m,y,x,S;uX();const[t,e]=R.useState("dashboard"),[n,r]=R.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[i,s]=R.useState(!1),[o,a]=R.useState("maintenance"),{data:l}=m7(),{data:c}=Q1(2e4);R.useEffect(()=>{document.documentElement.classList.add("dark")},[]),R.useEffect(()=>{const _=w=>{var T;a(((T=w.detail)==null?void 0:T.tab)||"maintenance"),s(!0)};return window.addEventListener("open-system-drawer",_),()=>window.removeEventListener("open-system-drawer",_)},[]),R.useEffect(()=>{const _=w=>{var T;const E=(T=w.detail)==null?void 0:T.view;E&&e(E)};return window.addEventListener("mc-navigate",_),()=>window.removeEventListener("mc-navigate",_)},[]);const d=jT.find(_=>_.id===t);return g.jsxs("div",{className:"flex h-full relative",children:[g.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[g.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),g.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),g.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),g.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),g.jsx(f7,{onNavigate:e}),g.jsx(_Se,{open:i,onClose:()=>s(!1),defaultTab:o}),g.jsxs("aside",{className:rt("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:[g.jsxs("div",{className:rt("flex items-center py-4 border-b border-border/40 shrink-0",n?"flex-col gap-3 px-2":"justify-between px-5"),children:[g.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[g.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!n&&g.jsxs("div",{className:"leading-tight",children:[g.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),g.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),g.jsx("button",{onClick:()=>{r(_=>{const w=!_;return localStorage.setItem("mc_sidebar_collapsed",w.toString()),w})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:n?"Maximieren":"Minimieren",children:n?g.jsx(oF,{className:"h-4 w-4"}):g.jsx(S8,{className:"h-4 w-4"})})]}),g.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:jT.map(_=>g.jsxs("button",{onClick:()=>e(_.id),className:rt("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",n?"justify-center p-2.5":"gap-3 px-3 py-2",t===_.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:n?_.label:void 0,children:[g.jsx(_.icon,{className:"h-4.5 w-4.5 shrink-0"}),!n&&g.jsx("span",{className:"truncate",children:_.label})]},_.id))}),g.jsx("div",{className:rt("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",n?"px-2 text-center":"px-5"),children:n?g.jsx("div",{className:"flex justify-center",children:g.jsx("span",{className:rt("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",l?l.engine_reachable?l.brain&&!l.brain.ready?"bg-amber-500 animate-pulse":"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:l?l.engine_reachable?l.brain&&!l.brain.ready?`Hirn offline (${l.brain.model??"fast"})`:"Engine + Hirn online":"Engine offline":"Backend offline"})}):g.jsxs("div",{className:"space-y-2 text-left",children:[l?g.jsxs(g.Fragment,{children:[g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:rt("h-2 w-2 rounded-full animate-pulse",l.engine_reachable?"bg-emerald-500":"bg-amber-500")}),g.jsxs("span",{className:"truncate",children:["Engine ",l.engine_reachable?"online":"offline"]})]}),l.brain&&!l.brain.ready&&g.jsxs("span",{className:"flex items-center gap-2 text-amber-400",title:`Agent-Hirn '${l.brain.model??"fast"}' lädt nicht/abgestürzt`,children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),g.jsxs("span",{className:"truncate",children:["Hirn offline",l.brain.model?` (${l.brain.model})`:""]})]})]}):g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",g.jsx("span",{className:"truncate",children:"Backend offline"})]}),(c==null?void 0:c.versions)&&g.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[g.jsxs("div",{className:"truncate",title:c.versions.mc2?`${c.versions.mc2.branch}-${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""} (${c.versions.mc2.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"MC2:"})," ",c.versions.mc2?`${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""}`:"—"]}),g.jsxs("div",{className:"truncate",title:((f=c.versions.engine)==null?void 0:f.type)==="git"?`${c.versions.engine.branch}-${c.versions.engine.hash}${c.versions.engine.dirty?"*":""} (${c.versions.engine.date})`:((m=c.versions.engine)==null?void 0:m.version_text)||"unbekannt",children:[g.jsx("strong",{children:"Engine:"})," ",((y=c.versions.engine)==null?void 0:y.type)==="git"?`${c.versions.engine.hash}${c.versions.engine.dirty?"*":""}`:((S=(x=c.versions.engine)==null?void 0:x.version_text)==null?void 0:S.split(" ").pop())||"—"]}),g.jsxs("div",{className:"truncate",title:c.versions.hermes_ui?`${c.versions.hermes_ui.branch}-${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""} (${c.versions.hermes_ui.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"Hermes UI:"})," ",c.versions.hermes_ui?`${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""}`:"—"]}),g.jsxs("div",{className:"truncate",title:c.versions.hermes_agent?`${c.versions.hermes_agent.branch}-${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""} (${c.versions.hermes_agent.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"Hermes Agent:"})," ",c.versions.hermes_agent?`${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),g.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[g.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[g.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:d.hint}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),g.jsxs("button",{onClick:()=>{const _=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(_)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[g.jsx(P8,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:"Suchen"}),g.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),g.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&g.jsx(kfe,{}),t==="models"&&g.jsx(zfe,{}),t==="connect"&&g.jsx(Hfe,{}),t==="memory"&&g.jsx(Kfe,{}),t==="agent"&&g.jsx(Yfe,{}),t==="terminal"&&g.jsx(Zfe,{}),t==="voice"&&g.jsx(gSe,{}),t==="guide"&&g.jsx(ySe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&g.jsx(xSe,{title:d.label,hint:d.hint})]})]})]})}const SSe=new r8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});NW.createRoot(document.getElementById("root")).render(g.jsx(WU.StrictMode,{children:g.jsx(i8,{client:SSe,children:g.jsx(wSe,{})})}));export{Zf as R,Gm as S,LT as T,t9 as a,V1 as g,g as j,R as r}; +...`}),p.jsxs("p",{children:["Suchen & installieren über die ",p.jsx("strong",{children:"skills.sh"}),"-Registry: ",p.jsx(gn,{children:"npx skills find"})," /",p.jsx(gn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),p.jsxs(yo,{id:"memory",icon:D8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[p.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{children:["LLMs sind ",p.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[p.jsxs("li",{children:[p.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",p.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{children:[p.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[p.jsxs("li",{children:["extrahiert Fakten ",p.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),p.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),p.jsxs("li",{children:[p.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",p.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),p.jsxs(Gf,{children:["Dein Gedächtnis (Tab ",p.jsx("strong",{children:"Gedächtnis"}),") ist ",p.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",p.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",p.jsx(gn,{children:"Identität"})," · ",p.jsx(gn,{children:"Wissen"})," · ",p.jsx(gn,{children:"Regeln"})," · ",p.jsx(gn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",p.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",p.jsx("br",{}),p.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),p.jsxs(yo,{id:"agents",icon:Il,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[p.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{children:["Ein ",p.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",p.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[p.jsxs("li",{children:[p.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{children:[p.jsx("strong",{children:"Least Privilege:"})," gib einem Agenten nur die Tools, die er wirklich braucht. Kritische Aktionen (Shell auf dem Host, Löschen, Geld/Deploys) hinter menschliche Freigabe."]}),p.jsxs("p",{children:[p.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",p.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),p.jsxs(Gf,{children:[p.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",p.jsx(gn,{children:"fast"}),"). Reden tust du mit ihm im",p.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",p.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",p.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",p.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),p.jsxs(yo,{id:"ide",icon:cF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[p.jsxs("p",{children:["Jede ",p.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[p.jsxs("li",{children:[p.jsx("strong",{children:"Cline"})," & ",p.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Continue"}),", ",p.jsx("strong",{children:"aider"})," (CLI), ",p.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),p.jsxs(Gf,{children:["Tipp den Kram nicht ab: der ",p.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",p.jsx(gn,{children:"…:9001/v1"}),", Model ",p.jsx(gn,{children:"auto"}),", Key beliebig."]})]}),p.jsx(yo,{id:"tricks",icon:W8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:p.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:[["Kontext sauber halten","Neue Session statt Mega-Historie. Drift, Tempo und Halluzination hängen direkt am Kontext-Müll."],["Plan-then-Act","Erst Plan/Vorgehen bestätigen lassen, dann ausführen. Spart teure Holzwege."],["Gezielte Edits","Nie ganze Dateien überschreiben für eine Zeile — Such-/Ersetz-Tools nutzen. Weniger Tokens, weniger Fehler."],["Non-interaktive Befehle","Keine interaktiven Prompts im Agent-Terminal; lange Tasks als Background-Job. Sonst hängt der Loop."],["DevTools koppeln","Browser-/Konsolen-Zugriff geben — der Agent liest echte Fehler statt blind zu raten."],["Richtige Modellwahl","Schnelles Hirn für Alltag, großes für harte Logik, Coder fürs Coden. Nicht alles mit der Kanone."],["Akzeptanzkriterien","Sag konkret, woran „fertig“ erkennbar ist. Vage Prompts → vage Ergebnisse."],["Verifizieren statt vertrauen","Tests/Live-Check fordern. „Sollte funktionieren“ ist kein Beweis."],["Regeln ins Gedächtnis","Wiederkehrende Vorlieben/Konventionen einmal ablegen — der Agent zieht sie selbst."]].map(([n,r])=>p.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[p.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[p.jsx(_h,{className:"h-3 w-3 text-amber-400"})," ",n]}),p.jsx("p",{className:"text-[11px]",children:r})]},n))})}),p.jsx(yo,{id:"wartung",icon:Zm,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:p.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[p.jsx(uF,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[p.jsxs("li",{children:[p.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[p.jsx(iw,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[p.jsxs("li",{children:[p.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",p.jsx(gn,{children:"restore.sh"})," (Doku in ",p.jsx(gn,{children:"docs/BACKUP.md"}),")."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",p.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",p.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),p.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),p.jsxs("section",{id:"ressourcen",className:"scroll-mt-20 md:col-span-2 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[p.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[p.jsx(LT,{className:"h-5 w-5 text-primary"}),p.jsxs("div",{children:[p.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),p.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),p.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[p.jsx(OT,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[p.jsx(Ur,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),p.jsx(Ur,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),p.jsx(Ur,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),p.jsx(Ur,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),p.jsx(Ur,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),p.jsx(Ur,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[p.jsx(jT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[p.jsx(Ur,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),p.jsx(Ur,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),p.jsx(Ur,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),p.jsx(Ur,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),p.jsx(Ur,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[p.jsx(Il,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[p.jsx(Ur,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),p.jsx(Ur,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),p.jsx(Ur,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),p.jsx(Ur,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),p.jsx(Ur,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[p.jsx(kT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),p.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[p.jsx(Ur,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),p.jsx(Ur,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),p.jsx(Ur,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),p.jsx(Ur,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),p.jsx(Ur,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),p.jsx(yo,{id:"troubleshooting",icon:G8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:p.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[p.jsxs("li",{children:[p.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",p.jsx(gn,{children:":9001"}),")? Backend-Status in der ",p.jsx("strong",{children:"Zentrale"})," prüfen."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",p.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",p.jsx(gn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",p.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),p.jsxs("li",{children:[p.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",p.jsx(gn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),p.jsx("p",{className:"text-center text-[10px] text-muted-foreground/50 pt-2",children:"Mission Control 2 · AI-Bibel · Stand Juni 2026 — lebendes Dokument, wächst mit dem Stack."})]})}function ISe({title:t,hint:e}){return p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{children:[p.jsx("h1",{className:"text-xl font-semibold",children:t}),p.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),p.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[p.jsx(L8,{className:"h-8 w-8 text-muted-foreground"}),p.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const DU=[{id:"mission-control-2",label:"Mission Control",type:"user",reach:"gateway (integr"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user",reach:"hermes-gateway"},{id:"mem0-service",label:"Mem0 (Gedächtnis)",type:"user",reach:"mem0"},{id:"hermes-terminal",label:"Hermes Terminal",type:"user",reach:"hermes-terminal"},{id:"llama-swap",label:"Llama Swap",type:"system",reach:"llama-swap"}];function U0({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:o,onAction:a}){return p.jsxs("div",{className:tt("flex items-center gap-3 rounded-lg border px-3 py-2",i?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[p.jsx(t,{className:tt("h-4 w-4 shrink-0",e)}),p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-xs text-foreground truncate",children:n}),p.jsx("div",{className:tt("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),p.jsx("button",{onClick:a,disabled:!i||s,className:tt("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:s?"…":o})]})}function kSe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return p.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[p.jsx("span",{className:tt("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),p.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&p.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),p.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:p.jsx(Qf,{className:tt("h-3.5 w-3.5",r&&"animate-spin")})}),p.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:p.jsx(j8,{className:"h-3.5 w-3.5"})})]})}function yT(t){return t==null?"":t>1024**3?`${(t/1024**3).toFixed(2)} GB`:`${(t/1024**2).toFixed(1)} MB`}function OSe({open:t,onClose:e,defaultTab:n="maintenance"}){var Ke;const[r,i]=P.useState(null),[s,o]=P.useState([]),[a,l]=P.useState("llama-swap"),[c,d]=P.useState(""),[f,g]=P.useState(!1),[y,x]=P.useState(null),[S,w]=P.useState({}),[b,M]=P.useState("maintenance"),[T,C]=P.useState(!1),[O,N]=P.useState(""),[L,F]=P.useState(!1),[G,k]=P.useState(null),[U,H]=P.useState([]),[te,ee]=P.useState(!1),[pe,ie]=P.useState(null),[fe,B]=P.useState(null);function Q(ne,Qe,Mt){B({type:"alert",title:ne,message:Qe,onConfirm:()=>{B(null),Mt&&Mt()}})}function K(ne,Qe,Mt){B({type:"confirm",title:ne,message:Qe,onConfirm:()=>{B(null),Mt()},onCancel:()=>B(null)})}function V(ne){return ne?new Date(ne*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[q,he]=P.useState(""),[ae,ce]=P.useState(""),[we,Ee]=P.useState(!1),[Xe,Se]=P.useState(!1);P.useEffect(()=>{t&&(he(localStorage.getItem("mc_sudo_password")||""),ce(localStorage.getItem("mc_hf_token")||""))},[t]),P.useEffect(()=>{t&&n&&M(n)},[t,n]);const je=P.useRef(null);function $e(){Lt("/api/maintenance/updates").then(i).catch(ne=>console.error("Error loading updates",ne))}function ue(){Lt("/api/jobs").then(ne=>o(ne.jobs||[])).catch(ne=>console.error("Error loading jobs",ne))}function Z(){Lt("/api/system/services").then(k).catch(()=>{})}function Ve(){Lt("/api/system/backups").then(ne=>H(ne.backups||[])).catch(()=>{})}function Oe(ne){g(!0),x(null),Lt(`/api/maintenance/logs?service=${ne}&lines=150`).then(Qe=>{Qe.ok?d(Qe.text):(d(`Fehler beim Laden der Logs: ${Qe.err||"Unbekannter Fehler"}`),(Qe.status==="incorrect_password"||Qe.status==="password_required")&&x(Qe.status))}).catch(Qe=>d(`Fehler: ${Qe.message}`)).finally(()=>{g(!1),setTimeout(()=>{je.current&&(je.current.scrollTop=je.current.scrollHeight)},50)})}P.useEffect(()=>{if(!t)return;$e(),ue(),Z(),Ve();const ne=setInterval(()=>{ue(),$e(),Z()},3e3);return()=>clearInterval(ne)},[t]),P.useEffect(()=>{!t||b!=="logs"||Oe(a)},[t,b,a]);function Ge(ne){return(ne==null?void 0:ne.status)==="busy"?(Q("Update läuft bereits",`Es läuft gerade „${ne.running}". Bitte warte, bis es fertig ist.`),ue(),!0):!1}async function et(){try{const ne=await Lt("/api/maintenance/os-update",{method:"POST"});if(Ge(ne))return;ue(),M("maintenance")}catch(ne){Q("Fehler",`Fehler beim Starten des OS-Updates: ${ne.message}`)}}async function St(){try{const ne=await Lt("/api/maintenance/engine-update",{method:"POST"});if(Ge(ne))return;ue(),M("maintenance")}catch(ne){Q("Fehler",`Fehler beim Engine-Update: ${ne.message}`)}}async function ft(){try{const ne=await Lt("/api/maintenance/swap-update",{method:"POST"});if(Ge(ne))return;ue(),M("maintenance")}catch(ne){Q("Fehler",`Fehler beim Router-Update: ${ne.message}`)}}async function J(){ee(!0);try{const ne=await Lt("/api/maintenance/hermes-update",{method:"POST"});if(Ge(ne))return;ue()}catch(ne){Q("Fehler",`Hermes-Update fehlgeschlagen: ${ne.message}`)}finally{ee(!1)}}async function $(ne){ie({kind:ne,loading:!0,data:null});try{const Qe=await Lt(`/api/maintenance/update-details?kind=${ne}`);ie({kind:ne,loading:!1,data:Qe})}catch(Qe){ie({kind:ne,loading:!1,data:{kind:ne,error:Qe.message}})}}function Me(){const ne=pe==null?void 0:pe.kind;ie(null),ne==="os"?et():ne==="engine"?St():ne==="swap"?ft():ne==="hermes"&&J()}async function Ue(){C(!0);try{await Lt("/api/maintenance/check-updates",{method:"POST"}),ue(),M("maintenance")}catch(ne){Q("Fehler",`Fehler bei der Update-Suche: ${ne.message}`)}finally{C(!1)}}async function Be(ne,Qe){try{await Lt("/api/models/install",{method:"POST",body:JSON.stringify({repo:ne,role:Qe})}),Q("Gestartet",`Modell-Upgrade für '${Qe}' (${ne}) gestartet.`),ue(),M("maintenance")}catch(Mt){Q("Fehler",`Fehler beim Starten des Modell-Upgrades: ${Mt.message}`)}}async function ze(){K("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await Lt("/api/maintenance/reboot",{method:"POST"}),Q("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(ne){Q("Fehler",`Fehler beim Reboot: ${ne.message}`)}})}async function wt(){F(!0),N("Snapshot wird erzeugt...");try{const ne=await Lt("/api/system/backup",{method:"POST"});N(ne.ok?`Snapshot erzeugt: ${ne.snapshot} (${ne.files.length} Komponenten)`:"Backup fehlgeschlagen."),Ve()}catch(ne){N(`Fehler: ${ne.message}`)}finally{F(!1)}}async function rt(ne){w(Qe=>({...Qe,[ne]:!0}));try{const Qe=await Lt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:ne})});Qe.ok?Q("Dienst neu gestartet",`Dienst ${ne} wurde erfolgreich neu gestartet.`,()=>{b==="logs"&&a===ne&&Oe(ne)}):Q("Fehler",`Fehler beim Neustart: ${Qe.err||"Unbekannter Fehler"}`)}catch(Qe){Q("Fehler",`Fehler beim Neustart: ${Qe.message}`)}finally{w(Qe=>({...Qe,[ne]:!1}))}}async function pt(ne){try{await Lt(`/api/jobs/${ne}/cancel`,{method:"POST"}),ue()}catch(Qe){Q("Fehler",`Fehler beim Abbrechen: ${Qe.message}`)}}const Wt=s.find(ne=>(ne.state==="running"||ne.state==="queued")&&ne.group==="maintenance");return p.jsxs(p.Fragment,{children:[p.jsx("div",{className:tt("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:e}),p.jsxs("div",{className:tt("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",t?"translate-x-0":"translate-x-full"),children:[p.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),p.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),p.jsx("button",{onClick:e,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:p.jsx(Al,{className:"h-4 w-4"})})]}),p.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[p.jsx("button",{onClick:()=>M("maintenance"),className:tt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",b==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),p.jsx("button",{onClick:()=>M("logs"),className:tt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",b==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),p.jsx("button",{onClick:()=>M("settings"),className:tt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",b==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),p.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[b==="maintenance"&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"space-y-2.5",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),p.jsxs("button",{onClick:Ue,disabled:T||!!Wt,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[p.jsx(Qf,{className:tt("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&p.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",V(r.last_check)]}),Wt&&p.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-[11px] text-amber-300",children:[p.jsx(Qf,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),p.jsxs("span",{children:["Update läuft: ",p.jsx("span",{className:"font-semibold",children:Wt.label})," — bitte warten. Weitere Updates sind solange gesperrt."]})]}),p.jsxs("div",{className:"space-y-1.5",children:[p.jsx(U0,{icon:Zm,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(r!=null&&r.os),status:r!=null&&r.os?`${r.os} verfügbar`:"aktuell",actionLabel:"Anzeigen",onAction:()=>$("os")}),p.jsx(U0,{icon:rw,iconClass:"text-violet-400",name:"Inferenz-Engine (llama.cpp)",available:!!(r!=null&&r.engine),status:r!=null&&r.engine?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>$("engine")}),p.jsx(U0,{icon:fI,iconClass:"text-fuchsia-400",name:"Router (llama-swap)",available:!!(r!=null&&r.swap),status:r!=null&&r.swap?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>$("swap")}),(()=>{var Qe;const ne=(Qe=r==null?void 0:r.components)==null?void 0:Qe.find(Mt=>Mt.key==="hermes_agent");return p.jsx(U0,{icon:Il,iconClass:"text-amber-400",name:"Hermes-Agent",available:(ne==null?void 0:ne.update)===!0,busy:te,status:(ne==null?void 0:ne.update)===!0?`Update: ${ne.latest}`:(ne==null?void 0:ne.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>$("hermes")})})(),(Ke=r==null?void 0:r.model_list)==null?void 0:Ke.map(ne=>p.jsx(U0,{icon:M8,iconClass:"text-emerald-400",name:`Modell · ${ne.role}`,available:!0,status:ne.title,actionLabel:"Upgrade",onAction:()=>Be(ne.repo,ne.role)},ne.role))]})]}),p.jsxs("div",{className:"space-y-2.5",children:[p.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),p.jsx("div",{className:"space-y-1.5",children:DU.map(ne=>{var Qe;return p.jsx(kSe,{label:ne.label,system:ne.type==="system",ok:(Qe=G==null?void 0:G.services.find(Mt=>Mt.name.toLowerCase().includes(ne.reach)))==null?void 0:Qe.ok,busy:S[ne.id],onRestart:()=>rt(ne.id),onLogs:()=>{l(ne.id),M("logs")}},ne.id)})})]}),p.jsxs("div",{className:"space-y-2.5",children:[p.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),p.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[p.jsxs("div",{className:"flex-1 min-w-0",children:[p.jsx("div",{className:"text-xs text-foreground truncate",children:U[0]?`Letztes: ${U[0].snapshot}`:"Noch kein Backup"}),p.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[U.length," Snapshots · Restore per CLI (restore.sh)"]})]}),p.jsxs("button",{onClick:wt,disabled:L,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[p.jsx(E8,{className:tt("h-3.5 w-3.5",L&&"animate-pulse")})," Snapshot"]})]}),O&&p.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:O})]}),p.jsxs("div",{className:"space-y-2.5",children:[p.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),p.jsxs("button",{onClick:ze,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[p.jsx(t9,{className:"h-4.5 w-4.5"}),p.jsxs("div",{children:[p.jsx("div",{children:"Host-System neu starten"}),p.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),p.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(ne=>ne.state==="running"||ne.state==="queued").length," Aktiv"]})]}),p.jsx("div",{className:"space-y-3",children:s.length===0?p.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):s.map(ne=>{const Qe=ne.state==="running"||ne.state==="queued";return p.jsxs("div",{className:tt("p-3 rounded-xl border transition-all duration-300",Qe?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[p.jsxs("div",{className:"flex items-start justify-between gap-3",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[Qe&&p.jsxs("span",{className:"flex h-2 w-2 relative",children:[p.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),p.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),ne.label]}),p.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[p.jsxs("span",{children:["ID: ",ne.id]}),p.jsx("span",{children:"•"}),p.jsx("span",{className:tt(ne.state==="done"&&"text-emerald-400",ne.state==="failed"&&"text-red-400",ne.state==="running"&&"text-primary",ne.state==="queued"&&"text-amber-400",ne.state==="canceled"&&"text-muted-foreground"),children:ne.state})]})]}),Qe&&p.jsx("button",{onClick:()=>pt(ne.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),ne.state==="running"&&p.jsxs("div",{className:"mt-3 space-y-1",children:[p.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:p.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${ne.progress??0}%`}})}),p.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[p.jsxs("span",{children:[ne.progress??0,"%"]}),ne.done_bytes!=null&&ne.total_bytes!=null&&p.jsxs("span",{children:[yT(ne.done_bytes)," / ",yT(ne.total_bytes),ne.rate_bps!=null&&` (${yT(ne.rate_bps)}/s)`]}),ne.eta_s!=null&&p.jsxs("span",{children:["ETA: ",ne.eta_s,"s"]})]})]})]},ne.id)})})]})]}),b==="logs"&&p.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("select",{value:a,onChange:ne=>l(ne.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:DU.map(ne=>p.jsxs("option",{value:ne.id,children:[ne.label," (",ne.type==="system"?"systemd-root":"user",")"]},ne.id))}),p.jsxs("button",{onClick:()=>rt(a),disabled:S[a],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[p.jsx(Qf,{className:tt("h-3.5 w-3.5",S[a]&&"animate-spin")}),"Restart"]})]}),p.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[p.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[p.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[p.jsx(pF,{className:"h-3 w-3 text-primary"}),p.jsxs("span",{children:["stdout/stderr - ",a]})]}),p.jsx("button",{onClick:()=>Oe(a),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:p.jsx(Qf,{className:tt("h-3 w-3",f&&"animate-spin")})})]}),p.jsx("pre",{ref:je,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:y==="password_required"||y==="incorrect_password"?p.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[p.jsx(_g,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),p.jsx("div",{className:"text-xs font-semibold text-amber-300",children:y==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),p.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",a," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),p.jsx("button",{onClick:()=>M("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):f&&!c?p.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||p.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),b==="settings"&&p.jsxs("div",{className:"space-y-6",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),p.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[p.jsx(Zm,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),p.jsxs("div",{className:"relative",children:[p.jsx("input",{type:we?"text":"password",value:q,onChange:ne=>he(ne.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),p.jsx("button",{type:"button",onClick:()=>Ee(!we),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:we?p.jsx(uI,{className:"h-4 w-4"}):p.jsx(DT,{className:"h-4 w-4"})})]}),p.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[p.jsx(B8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),p.jsxs("div",{className:"relative",children:[p.jsx("input",{type:Xe?"text":"password",value:ae,onChange:ne=>ce(ne.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),p.jsx("button",{type:"button",onClick:()=>Se(!Xe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Xe?p.jsx(uI,{className:"h-4 w-4"}):p.jsx(DT,{className:"h-4 w-4"})})]}),p.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),p.jsxs("div",{className:"flex gap-3 pt-2",children:[p.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",q),localStorage.setItem("mc_hf_token",ae),Q("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),p.jsx("button",{onClick:()=>{he(""),ce(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),Q("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),pe&&(()=>{var Jt;const ne=pe.data,Qe={os:{icon:Zm,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:rw,cls:"text-violet-400",title:"Inferenz-Engine (llama.cpp)"},swap:{icon:fI,cls:"text-fuchsia-400",title:"Router (llama-swap)"},hermes:{icon:Il,cls:"text-amber-400",title:"Hermes-Agent"}}[pe.kind],Mt=Qe.icon,yt=ne?pe.kind==="os"?(ne.count??0)===0:pe.kind==="hermes"?(ne.behind??0)===0:ne.installed_build!=null&&ne.latest_build!=null&&ne.latest_build<=ne.installed_build:!0;return p.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[p.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>ie(null)}),p.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-2xl border border-border/60 bg-card shadow-2xl font-sans text-foreground",children:[p.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-5",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Mt,{className:tt("h-4.5 w-4.5",Qe.cls)}),p.jsx("h3",{className:"text-sm font-semibold",children:Qe.title})]}),p.jsx("button",{onClick:()=>ie(null),className:"flex h-7 w-7 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:p.jsx(Al,{className:"h-4 w-4"})})]}),p.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:pe.loading?p.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[p.jsx(Qf,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):ne!=null&&ne.error?p.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:ne.error}):pe.kind==="os"?((ne==null?void 0:ne.count)??0)===0?p.jsx("div",{className:"text-muted-foreground",children:"Keine Pakete zu aktualisieren — System ist aktuell."}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"text-muted-foreground",children:[ne.count," Paket(e) werden aktualisiert:"]}),p.jsx("div",{className:"space-y-1",children:ne.packages.map(de=>p.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[p.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[p.jsx(J8,{className:"h-3 w-3 text-cyan-400 shrink-0"}),de.name]}),p.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[p.jsx("span",{children:de.current}),p.jsx(tw,{className:"h-3 w-3"}),p.jsx("span",{className:"text-emerald-400",children:de.candidate})]})]},de.name))})]}):pe.kind==="engine"||pe.kind==="swap"?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[p.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(ne==null?void 0:ne.installed_build)??"?"]}),p.jsx(tw,{className:"h-3.5 w-3.5 text-muted-foreground"}),p.jsxs("span",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/5 px-2 py-1 text-emerald-400",children:["Build ",(ne==null?void 0:ne.latest_build)??"?"]})]}),((ne==null?void 0:ne.name)||(ne==null?void 0:ne.latest_tag))&&p.jsxs("div",{className:"text-muted-foreground",children:["Release: ",p.jsx("span",{className:"text-foreground",children:ne==null?void 0:ne.name}),ne!=null&&ne.latest_tag?` (${ne.latest_tag})`:""]}),(ne==null?void 0:ne.url)&&p.jsxs("a",{href:ne.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Release-Notes auf GitHub ",p.jsx(bg,{className:"h-3 w-3"})]}),(ne==null?void 0:ne.body)&&p.jsx("pre",{className:"whitespace-pre-wrap rounded-lg border border-border/40 bg-background/30 p-3 text-[10px] leading-relaxed text-muted-foreground max-h-60 overflow-y-auto scrollbar-thin",children:ne.body})]}):(((Jt=ne==null?void 0:ne.commits)==null?void 0:Jt.length)??0)===0?p.jsx("div",{className:"text-muted-foreground",children:"Keine neuen Commits — Hermes-Agent ist bereits aktuell."}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"text-muted-foreground",children:[ne.behind," neue Commit(s) auf ",p.jsxs("span",{className:"font-mono text-foreground",children:["origin/",ne.branch]}),":"]}),p.jsx("div",{className:"space-y-1",children:ne.commits.map(de=>p.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[p.jsx(F8,{className:"h-3.5 w-3.5 text-primary shrink-0 mt-0.5"}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"text-[11px] truncate",children:de.subject}),p.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[de.hash," · ",de.when]})]})]},de.hash))}),p.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Vor dem Update wird automatisch ein Backup erstellt; danach startet der Hermes-Gateway neu."})]})}),p.jsxs("div",{className:"flex gap-3 border-t border-border/40 p-4 shrink-0",children:[p.jsx("button",{onClick:()=>ie(null),className:"h-9 flex-1 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold text-muted-foreground hover:bg-accent transition-colors cursor-pointer",children:"Schließen"}),p.jsx("button",{onClick:Me,disabled:pe.loading||yt||!!Wt,title:Wt?`Update läuft bereits: ${Wt.label}`:void 0,className:"h-9 flex-1 rounded-lg bg-primary text-xs font-semibold text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-40 disabled:cursor-default",children:Wt?"Update läuft…":"Jetzt aktualisieren"})]})]})]})})(),fe&&p.jsx(gV,{type:fe.type,title:fe.title,message:fe.message,onConfirm:fe.onConfirm,onCancel:fe.onCancel})]})}function LSe(){var f,g,y,x,S;yX();const[t,e]=P.useState("dashboard"),[n,r]=P.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[i,s]=P.useState(!1),[o,a]=P.useState("maintenance"),{data:l}=_7(),{data:c}=eS(2e4);P.useEffect(()=>{document.documentElement.classList.add("dark")},[]),P.useEffect(()=>{const w=b=>{var T;a(((T=b.detail)==null?void 0:T.tab)||"maintenance"),s(!0)};return window.addEventListener("open-system-drawer",w),()=>window.removeEventListener("open-system-drawer",w)},[]),P.useEffect(()=>{const w=b=>{var T;const M=(T=b.detail)==null?void 0:T.view;M&&e(M)};return window.addEventListener("mc-navigate",w),()=>window.removeEventListener("mc-navigate",w)},[]);const d=BT.find(w=>w.id===t);return p.jsxs("div",{className:"flex h-full relative",children:[p.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[p.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),p.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),p.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),p.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),p.jsx(v7,{onNavigate:e}),p.jsx(OSe,{open:i,onClose:()=>s(!1),defaultTab:o}),p.jsxs("aside",{className:tt("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:[p.jsxs("div",{className:tt("flex items-center py-4 border-b border-border/40 shrink-0",n?"flex-col gap-3 px-2":"justify-between px-5"),children:[p.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[p.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!n&&p.jsxs("div",{className:"leading-tight",children:[p.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),p.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),p.jsx("button",{onClick:()=>{r(w=>{const b=!w;return localStorage.setItem("mc_sidebar_collapsed",b.toString()),b})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:n?"Maximieren":"Minimieren",children:n?p.jsx(lF,{className:"h-4 w-4"}):p.jsx(T8,{className:"h-4 w-4"})})]}),p.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:BT.map(w=>p.jsxs("button",{onClick:()=>e(w.id),className:tt("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",n?"justify-center p-2.5":"gap-3 px-3 py-2",t===w.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:n?w.label:void 0,children:[p.jsx(w.icon,{className:"h-4.5 w-4.5 shrink-0"}),!n&&p.jsx("span",{className:"truncate",children:w.label})]},w.id))}),p.jsx("div",{className:tt("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",n?"px-2 text-center":"px-5"),children:n?p.jsx("div",{className:"flex justify-center",children:p.jsx("span",{className:tt("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",l?l.engine_reachable?l.brain&&!l.brain.ready?"bg-amber-500 animate-pulse":"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:l?l.engine_reachable?l.brain&&!l.brain.ready?`Hirn offline (${l.brain.model??"fast"})`:"Engine + Hirn online":"Engine offline":"Backend offline"})}):p.jsxs("div",{className:"space-y-2 text-left",children:[l?p.jsxs(p.Fragment,{children:[p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx("span",{className:tt("h-2 w-2 rounded-full animate-pulse",l.engine_reachable?"bg-emerald-500":"bg-amber-500")}),p.jsxs("span",{className:"truncate",children:["Engine ",l.engine_reachable?"online":"offline"]})]}),l.brain&&!l.brain.ready&&p.jsxs("span",{className:"flex items-center gap-2 text-amber-400",title:`Agent-Hirn '${l.brain.model??"fast"}' lädt nicht/abgestürzt`,children:[p.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),p.jsxs("span",{className:"truncate",children:["Hirn offline",l.brain.model?` (${l.brain.model})`:""]})]})]}):p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",p.jsx("span",{className:"truncate",children:"Backend offline"})]}),(c==null?void 0:c.versions)&&p.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[p.jsxs("div",{className:"truncate",title:c.versions.mc2?`${c.versions.mc2.branch}-${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""} (${c.versions.mc2.date})`:"nicht gefunden",children:[p.jsx("strong",{children:"MC2:"})," ",c.versions.mc2?`${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""}`:"—"]}),p.jsxs("div",{className:"truncate",title:((f=c.versions.engine)==null?void 0:f.type)==="git"?`${c.versions.engine.branch}-${c.versions.engine.hash}${c.versions.engine.dirty?"*":""} (${c.versions.engine.date})`:((g=c.versions.engine)==null?void 0:g.version_text)||"unbekannt",children:[p.jsx("strong",{children:"Engine:"})," ",((y=c.versions.engine)==null?void 0:y.type)==="git"?`${c.versions.engine.hash}${c.versions.engine.dirty?"*":""}`:((S=(x=c.versions.engine)==null?void 0:x.version_text)==null?void 0:S.split(" ").pop())||"—"]}),p.jsxs("div",{className:"truncate",title:c.versions.hermes_ui?`${c.versions.hermes_ui.branch}-${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""} (${c.versions.hermes_ui.date})`:"nicht gefunden",children:[p.jsx("strong",{children:"Hermes UI:"})," ",c.versions.hermes_ui?`${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""}`:"—"]}),p.jsxs("div",{className:"truncate",title:c.versions.hermes_agent?`${c.versions.hermes_agent.branch}-${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""} (${c.versions.hermes_agent.date})`:"nicht gefunden",children:[p.jsx("strong",{children:"Hermes Agent:"})," ",c.versions.hermes_agent?`${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[p.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[p.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:d.hint}),p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),p.jsxs("button",{onClick:()=>{const w=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(w)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[p.jsx(O8,{className:"h-3.5 w-3.5"}),p.jsx("span",{children:"Suchen"}),p.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),p.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&p.jsx(Vfe,{}),t==="models"&&p.jsx(Jfe,{}),t==="connect"&&p.jsx(the,{}),t==="memory"&&p.jsx(lhe,{}),t==="agent"&&p.jsx(che,{}),t==="terminal"&&p.jsx(uhe,{}),t==="voice"&&p.jsx(PSe,{}),t==="guide"&&p.jsx(NSe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&p.jsx(ISe,{title:d.label,hint:d.hint})]})]})]})}const DSe=new a8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});LW.createRoot(document.getElementById("root")).render(p.jsx(XU.StrictMode,{children:p.jsx(l8,{client:DSe,children:p.jsx(LSe,{})})}));export{Qf as R,Gm as S,FT as T,s9 as a,G1 as g,p as j,P as r}; diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 7bdd96d..d107f51 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,8 +7,8 @@ Mission Control 2.0 - - + +
diff --git a/frontend/src/components/dashboard/VoiceLatencyCard.tsx b/frontend/src/components/dashboard/VoiceLatencyCard.tsx new file mode 100644 index 0000000..4ae76b2 --- /dev/null +++ b/frontend/src/components/dashboard/VoiceLatencyCard.tsx @@ -0,0 +1,81 @@ +import { Gauge } from "lucide-react" +import { useVoiceMetrics } from "@/lib/queries" +import type { VoiceStageStat } from "@/lib/api" + +// Stabile Reihenfolge + deutsche Labels, spiegelt STAGES in backend/services/voice_metrics.py. +const STAGES: { key: string; label: string; hint: string }[] = [ + { key: "stt", label: "STT", hint: "Sprache → Text" }, + { key: "vision", label: "Bildschirm-Sicht", hint: "Vision-Beschreibung" }, + { key: "chat_ttfb", label: "Chat-TTFB", hint: "Zeit bis 1. Token" }, + { key: "tts", label: "TTS", hint: "Text → Sprache" }, +] + +function fmtMs(ms?: number): string { + if (ms == null) return "—" + return ms >= 1000 ? `${(ms / 1000).toFixed(2)} s` : `${Math.round(ms)} ms` +} + +// p95 relativ zum langsamsten p95 aller Stufen → grobe Balkenlänge. +function StageRow({ stat, label, hint, maxP95 }: { stat?: VoiceStageStat; label: string; hint: string; maxP95: number }) { + const has = !!stat && stat.count > 0 + const pct = has && stat!.p95_ms && maxP95 > 0 ? Math.max(4, Math.min(100, (stat!.p95_ms! / maxP95) * 100)) : 0 + return ( +
+
+
+ {label} + {hint} +
+ {has ? ( + {fmtMs(stat!.p50_ms)} + ) : ( + noch keine Messungen + )} +
+
+
+
+ {has && ( +
+ p50 {fmtMs(stat!.p50_ms)} + p95 {fmtMs(stat!.p95_ms)} + zuletzt {fmtMs(stat!.last_ms)} + · n={stat!.count} +
+ )} +
+ ) +} + +export function VoiceLatencyCard() { + const { data: metrics } = useVoiceMetrics(5_000) + const maxP95 = Math.max(1, ...STAGES.map((s) => metrics?.[s.key]?.p95_ms ?? 0)) + const anyData = STAGES.some((s) => (metrics?.[s.key]?.count ?? 0) > 0) + + return ( +
+
+ +

Sprach-Latenz

+ + live + +
+ +
+ {STAGES.map((s) => ( + + ))} +
+ +
+ {anyData + ? "Server-seitige Dauer je Pipeline-Stufe (p50 prominent). Rollender Schnitt über die letzten Turns; Reset bei Neustart." + : "Noch keine Voice-Turns gemessen — sprich einmal über den „Sprechen“-Tab, dann erscheinen hier STT/Vision/Chat/TTS."} +
+
+ ) +} diff --git a/frontend/src/components/models/LaneEditor.tsx b/frontend/src/components/models/LaneEditor.tsx new file mode 100644 index 0000000..0458f64 --- /dev/null +++ b/frontend/src/components/models/LaneEditor.tsx @@ -0,0 +1,178 @@ +import { useEffect, useState } from "react" +import { Sliders, RotateCcw, Check, Loader2, MessageSquare, Code2 } from "lucide-react" +import { updateRoutingPolicy, type RoutingPolicy } from "@/lib/api" +import { useRoutingPolicy, useQueryClient, qk } from "@/lib/queries" +import { cn } from "@/lib/utils" + +// Welche Policy-Felder zu welcher Lane gehören (Rest ist global). +const CHAT_FIELDS: (keyof RoutingPolicy)[] = ["fast", "heavy", "heavy_chars"] +const CODING_FIELDS: (keyof RoutingPolicy)[] = ["coder_lite", "coder", "coding_escalate_chars"] + +export function LaneEditor() { + const qc = useQueryClient() + const { data: meta, isLoading } = useRoutingPolicy() + const [draft, setDraft] = useState(null) + const [saving, setSaving] = useState(false) + const [err, setErr] = useState("") + const [savedAt, setSavedAt] = useState(0) + + // Draft initialisieren, sobald die Policy geladen ist (und nicht überschreiben, wenn schon editiert). + useEffect(() => { + if (meta?.policy && !draft) setDraft({ ...meta.policy }) + }, [meta, draft]) + + if (isLoading || !meta || !draft) { + return ( +
+ Lade Routing-Policy… +
+ ) + } + + const fieldSpec = (key: keyof RoutingPolicy) => meta.fields.find((f) => f.key === key)! + const dirty = (Object.keys(draft) as (keyof RoutingPolicy)[]).some((k) => draft[k] !== meta.policy[k]) + + const set = (key: K, value: RoutingPolicy[K]) => { + setDraft((d) => (d ? { ...d, [key]: value } : d)) + setErr("") + } + const resetField = (key: keyof RoutingPolicy) => set(key, meta.defaults[key]) + + async function save() { + if (!draft) return + const patch: Partial = {} + for (const k of Object.keys(draft) as (keyof RoutingPolicy)[]) { + if (draft[k] !== meta!.policy[k]) (patch as any)[k] = draft[k] + } + if (Object.keys(patch).length === 0) return + setSaving(true) + setErr("") + try { + const { policy } = await updateRoutingPolicy(patch) + setDraft({ ...policy }) + qc.invalidateQueries({ queryKey: qk.routingPolicy }) + qc.invalidateQueries({ queryKey: qk.routing }) + setSavedAt(Date.now()) + setTimeout(() => setSavedAt(0), 2000) + } catch (e: any) { + setErr(e.message || String(e)) + } finally { + setSaving(false) + } + } + + function Field({ k }: { k: keyof RoutingPolicy }) { + const spec = fieldSpec(k) + const val = draft![k] + const isDefault = draft![k] === meta!.defaults[k] + return ( +
+
+ + {!isDefault && ( + + )} +
+ {spec.type === "bool" ? ( + + ) : spec.type === "int" ? ( + set(k, Number(e.target.value) as any)} + className="h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50" + /> + ) : ( + set(k, e.target.value as any)} + className="h-8 w-full rounded-lg border border-border/40 bg-background/40 px-3 font-mono text-[11px] text-foreground outline-none focus:border-primary/50" + /> + )} +
+ ) + } + + return ( +
+
+
+ + Lane-Routing & Policy + hot-reload +
+
+ {err && {err}} + {savedAt > 0 && ( + gespeichert + )} + +
+
+ +

+ Welches echte Modell hinter den virtuellen Lanes chat und{" "} + coding steckt. Änderungen greifen sofort (kein Neustart). Die + Keyword-Heuristiken bleiben im Code. +

+ +
+ {/* chat-Lane */} +
+
+ + chat + (= auto) +
+ {CHAT_FIELDS.map((k) => )} +
+ + {/* coding-Lane */} +
+
+ + coding + (agentisch → immer Coder) +
+ {CODING_FIELDS.map((k) => )} +
+
+ + {/* Globale Schalter */} +
+
+
+
+ ) +} diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index a8b0663..ae850e8 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -191,11 +191,50 @@ export interface RoutingResp { endpoint?: string heavy_threshold_chars?: number routes: { name: string; target: string }[] + lanes?: { name: string; target: string; threshold_chars?: number; escalate_chars?: number; aka?: string }[] fallbacks: Record[] context_window_fallbacks: Record[] gateway_reachable: boolean } +// UI-editierbare Routing-Policy (GET/PUT /api/routing/policy). Aliase + Zeichen-Schwellen +// hinter den Lanes; hot-reload im Backend (kein Restart). +export interface RoutingPolicy { + fast: string + heavy: string + coder: string + coder_lite: string + heavy_chars: number + coding_escalate_chars: number + fast_no_think: boolean +} +export interface RoutingPolicyField { + key: keyof RoutingPolicy + label: string + type: "str" | "int" | "bool" + min?: number + max?: number +} +export interface RoutingPolicyMeta { + policy: RoutingPolicy + defaults: RoutingPolicy + fields: RoutingPolicyField[] +} +export const getRoutingPolicy = () => api("/api/routing/policy") +export const updateRoutingPolicy = (patch: Partial) => + api<{ policy: RoutingPolicy }>("/api/routing/policy", { method: "PUT", body: JSON.stringify(patch) }) + +// Per-Stage-Latenz der Voice/Lucy-Pipeline (GET /api/voice/metrics, C2). +// Schlüssel = Stufe (stt|vision|chat_ttfb|tts), Wert = rollende Statistik. +export interface VoiceStageStat { + count: number + avg_ms?: number + p50_ms?: number + p95_ms?: number + last_ms?: number +} +export type VoiceMetrics = Record + export interface GitInfo { hash: string date: string diff --git a/frontend/src/lib/queries.ts b/frontend/src/lib/queries.ts index acb2466..b68e6e4 100644 --- a/frontend/src/lib/queries.ts +++ b/frontend/src/lib/queries.ts @@ -18,10 +18,12 @@ import { type MemoryGraph, type ModelsResp, type RoutingResp, + type RoutingPolicyMeta, type ServicesResp, type SystemStatus, type TokenStats, type UpdatesResp, + type VoiceMetrics, } from "./api" // Zentrale Query-Keys (eine Quelle der Wahrheit für invalidate). @@ -32,6 +34,8 @@ export const qk = { models: ["models"] as const, groups: ["groups"] as const, routing: ["routing"] as const, + routingPolicy: ["routing-policy"] as const, + voiceMetrics: ["voice-metrics"] as const, jobs: ["jobs"] as const, tokenStats: ["token-stats"] as const, agentStatus: ["agent-status"] as const, @@ -70,6 +74,12 @@ export const useGroups = (refetchInterval = 8_000) => export const useRouting = (refetchInterval = 4_000) => useQuery({ queryKey: qk.routing, queryFn: () => api("/api/routing"), refetchInterval }) +export const useVoiceMetrics = (refetchInterval = 5_000) => + useQuery({ queryKey: qk.voiceMetrics, queryFn: () => api("/api/voice/metrics"), refetchInterval }) + +export const useRoutingPolicy = () => + useQuery({ queryKey: qk.routingPolicy, queryFn: () => api("/api/routing/policy") }) + export const useJobs = (refetchInterval = 2_000) => useQuery({ queryKey: qk.jobs, diff --git a/frontend/src/views/DashboardView.tsx b/frontend/src/views/DashboardView.tsx index 7b11173..e9a7ab4 100644 --- a/frontend/src/views/DashboardView.tsx +++ b/frontend/src/views/DashboardView.tsx @@ -6,6 +6,7 @@ import { RolesCard } from "@/components/dashboard/RolesCard" import { MemoryInputCard } from "@/components/dashboard/MemoryInputCard" import { TokenPerformanceCard } from "@/components/dashboard/TokenPerformanceCard" import { ServicesCard } from "@/components/dashboard/ServicesCard" +import { VoiceLatencyCard } from "@/components/dashboard/VoiceLatencyCard" function ZoneLabel({ children }: { children: React.ReactNode }) { return

{children}

@@ -37,6 +38,12 @@ export function DashboardView() {
+ {/* Sprach-Latenz (Voice/Lucy-Pipeline, C2) */} +
+ Sprach-Latenz + +
+ {/* Betrieb & Wissen */}
Betrieb & Wissen diff --git a/frontend/src/views/models/Cockpit.tsx b/frontend/src/views/models/Cockpit.tsx index 8187462..c009f79 100644 --- a/frontend/src/views/models/Cockpit.tsx +++ b/frontend/src/views/models/Cockpit.tsx @@ -8,6 +8,7 @@ import { cn } from "@/lib/utils" import { fmtSize, fmtCtx } from "@/lib/format" import { getBrandInfo, ROLES, roleTone } from "@/components/models/ModelBadges" import { SpecDraftModal } from "@/components/models/SpecDraftModal" +import { LaneEditor } from "@/components/models/LaneEditor" export function Cockpit() { const qc = useQueryClient() @@ -532,17 +533,22 @@ export function Cockpit() { Continue - {/* COLUMN 2: Central Gateway Node */} -
-
Gateway Auto
-
- Schwelle: > {routing?.heavy_threshold_chars ? (routing.heavy_threshold_chars / 1000) : "4"}k Zeichen +
Gateway · Lanes
+
+ {routing?.lanes?.length ? routing.lanes.map((l) => ( + + {l.name} + {l.threshold_chars ? ` ›${(l.threshold_chars / 1000).toFixed(0)}k` : l.escalate_chars ? ` ⇧${(l.escalate_chars / 1000).toFixed(0)}k` : ""} + + )) : chat · coding}
- Auto-Swap + Router
@@ -696,6 +702,9 @@ export function Cockpit() {
+ {/* ZONE B.4: Lane-Routing & Policy (UI-editierbar, hot-reload) */} + + {/* ZONE B.5: Slot-Belegung */}