diff --git a/backend/routers/models.py b/backend/routers/models.py index 6dd67f2..ebf6776 100644 --- a/backend/routers/models.py +++ b/backend/routers/models.py @@ -161,6 +161,14 @@ def recommend_role(role: str) -> dict: @router.post("/models/{model_id}/role") def set_model_role(model_id: str, body: RoleReq) -> dict: + # Das Agent-Hirn (Rolle 'hermes') braucht den warm-bewussten Flow (Alias + brains-Gruppe + + # ttl 0 + Hermes config.default + Gateway-Restart) — Single Source of Truth UI ↔ Hermes. + if (body.role or "").strip().lower() == "hermes": + from services.agent import set_agent_brain + res = set_agent_brain(model_id) + if not res.get("ok"): + raise HTTPException(400, res.get("reason", "Fehler beim Setzen des Agent-Hirns")) + return res if not llamaswap.set_role(model_id, body.role): raise HTTPException(404, "Modell nicht gefunden") return {"ok": True} diff --git a/backend/services/agent.py b/backend/services/agent.py index 155f3cb..79fbe75 100644 --- a/backend/services/agent.py +++ b/backend/services/agent.py @@ -167,16 +167,40 @@ def set_agent_brain(model_id: str) -> dict: return {"ok": False, "reason": "Modell nicht installiert — erst über Modelle-finden laden."} old = next((m["name"] for m in models.values() if m.get("role") == "hermes"), None) if model_id == old: + # Idempotent härten: auch wenn schon Hirn, warm (brains) + ttl 0 sicherstellen. + try: + from services.llamaswap import set_ttl + brains = (llamaswap.list_groups().get("brains") or {}).get("members") or [] + if model_id not in brains: + llamaswap.set_group("brains", brains + [model_id], swap=False, persist=True) + set_ttl(model_id, 0) + except PermissionError as exc: + return {"ok": False, "reason": str(exc)} return {"ok": True, "old": old, "new": model_id, "note": "ist bereits das Agent-Hirn"} try: llamaswap.set_role(model_id, "hermes") # 1) Alias brains = (llamaswap.list_groups().get("brains") or {}).get("members") or [] new_members = [x for x in brains if x not in (old, model_id)] + [model_id] llamaswap.set_group("brains", new_members, swap=False, persist=True) # 2) warm + # 2b) TTL härten: neues Hirn nie auto-entladen; altes Hirn auf Default entspannen. + from services.llamaswap import set_ttl, DEFAULT_TTL + set_ttl(model_id, 0) + if old: + set_ttl(old, DEFAULT_TTL) except PermissionError as exc: return {"ok": False, "reason": str(exc)} update_brain_model("hermes") # 3) Config + Restart - return {"ok": True, "old": old, "new": model_id} + # Weiche Budget-Warnung (kein Hard-Block): passt Hirn + größtes on-demand zusammen ins GTT? + warning = None + try: + b = hermes_brain_info().get("budget") or {} + if b and not b.get("fits", True): + warning = (f"Speicher-Warnung: Hirn (~{b.get('brain_gb')} GB) + größtes on-demand-" + f"Modell (~{b.get('largest_ondemand_gb')} GB) übersteigen das GTT-Budget " + f"(~{b.get('gtt_gb')} GB) — heavy/coder würden das Hirn verdrängen.") + except Exception: + log.debug("set_agent_brain: Budget-Check fehlgeschlagen", exc_info=True) + return {"ok": True, "old": old, "new": model_id, "warning": warning} def update_brain_model(new_model: str) -> bool: diff --git a/backend/services/llamaswap.py b/backend/services/llamaswap.py index 885a099..48e641a 100644 --- a/backend/services/llamaswap.py +++ b/backend/services/llamaswap.py @@ -21,8 +21,9 @@ from config import ( log = logging.getLogger(__name__) # Kanonische Serving-Rollen — EINE Quelle der Wahrheit (identisch zu sources.ROLE_IDS, -# maintenance, frontend ModelBadges.ROLES). Kein agent/reasoning mehr. -ROLE_IDS = {"fast", "heavy", "coder", "vision", "scout"} +# maintenance, frontend ModelBadges.ROLES). `hermes` = Lucys Agent-Hirn (warm + ko-resident +# in der `brains`-Gruppe); UI-Label „Hirn". +ROLE_IDS = {"fast", "heavy", "coder", "vision", "scout", "hermes"} _CTX_RE = re.compile(r"-(?:c|-ctx-size)\s+(\d+)") _PATH_RE = re.compile(r"-(?:m|-model)\s+([^\s]+)") @@ -371,6 +372,18 @@ def set_ctx(model_id: str, ctx: int) -> bool: return True +def set_ttl(model_id: str, ttl: int) -> bool: + """Idle-TTL (Sekunden) eines bestehenden Modells setzen. ttl=0 → nie automatisch + entladen (für das Agent-Hirn, das dauerhaft warm bleiben muss).""" + cfg = read_config() + spec = (cfg.get("models") or {}).get(model_id) + if not isinstance(spec, dict): + return False + spec["ttl"] = int(ttl) + write_config(cfg) + return True + + def delete_model(model_id: str) -> bool: """Entfernt einen Modell-Eintrag aus der config.yaml, löscht die zugehörigen GGUF-Dateien (auch Splits) vom Datenträger und bereinigt leere Ordner. @@ -433,23 +446,37 @@ def delete_model(model_id: str) -> bool: def brain_model_name() -> str | None: - """Modellname des Agent-Hirns = das Modell mit llama-swap-Alias/Rolle 'fast'.""" - for m in list_models(): + """Modellname von Lucys Agent-Hirn. Bevorzugt das Modell mit dem 'hermes'-Alias/-Rolle; + fällt auf Hermes' aktives `model.default` zurück (deckt den Fall ab, dass die Config direkt + auf einen Modellnamen statt den Alias zeigt).""" + models = list_models() + for m in models: names = {str(a).lower() for a in (m.get("aliases") or [])} if m.get("role"): names.add(str(m["role"]).lower()) - if "fast" in names: + if "hermes" in names: return m["name"] + # Fallback: das real von Hermes genutzte Hirn (model.default), per Alias/Name auflösen. + try: + from services.agent import _active_brain_name + brain = (_active_brain_name() or "").lower() + if brain and brain != "auto": + cur = next((m for m in models if (m.get("role") or "").lower() == brain), None) \ + or next((m for m in models if brain in (m["name"] or "").lower()), None) + if cur: + return cur["name"] + except Exception: + log.debug("brain_model_name: Hermes-Fallback fehlgeschlagen", exc_info=True) return None def brain_status() -> dict: - """Ist das Agent-Hirn ('fast') WIRKLICH geladen & bereit? Prüft /running — ein abgestürztes - Modell (z.B. OOM/Crash nach Engine-Update) erscheint dort NICHT als running. Fängt damit den - Fall 'Engine erreichbar, aber Hirn tot', den engine_reachable() nicht sieht (silent fail).""" + """Ist Lucys Agent-Hirn (Rolle 'hermes') WIRKLICH geladen & bereit? Prüft /running — ein + abgestürztes Modell (z.B. OOM/Crash nach Engine-Update) erscheint dort NICHT als running. + Fängt damit den Fall 'Engine erreichbar, aber Hirn tot', den engine_reachable() nicht sieht.""" name = brain_model_name() running = get_running_models() - return {"role": "fast", "model": name, "ready": bool(name and name in running)} + return {"role": "hermes", "model": name, "ready": bool(name and name in running)} def get_running_models() -> list[str]: diff --git a/backend/services/sources.py b/backend/services/sources.py index 22a900a..323e83f 100644 --- a/backend/services/sources.py +++ b/backend/services/sources.py @@ -1,7 +1,7 @@ """ Vertrauenswürdige Quellen + Kategorien für die automatische Modell-Entdeckung. Rollen = die EINE Quelle der Wahrheit, identisch zu den llama-swap-Serving-Rollen -und der UI: fast · heavy · coder · vision · scout. +und der UI: fast · heavy · coder · vision · hermes (Agent-Hirn) · scout. """ # HF-Orgs, die zuverlässig aktuelle, hochwertige GGUF-Quants veröffentlichen. @@ -9,7 +9,8 @@ TRUSTED_AUTHORS = ["unsloth", "bartowski", "ggml-org", "lmstudio-community"] # Kanonische Rollen — eine Quelle der Wahrheit (deckt sich mit llamaswap.ROLE_IDS, # maintenance.ROLE_MAP, frontend ModelBadges.ROLES + Discover.ROLE_METADATA). -ROLE_IDS = ["fast", "heavy", "coder", "vision", "scout"] +# `hermes` = Lucys Agent-Hirn (warm + ko-resident); UI-Label „Hirn". +ROLE_IDS = ["fast", "heavy", "coder", "vision", "hermes", "scout"] # Kategorien (Reihenfolge = Anzeige + Zuordnungs-Priorität). Ein Modell wird der # ERSTEN Kategorie zugeordnet, deren Stichwort im Repo-Namen vorkommt; sonst „scout". @@ -19,6 +20,8 @@ CATEGORIES = [ "kw": ["-vl-", "-vl", "vision", "llava", "multimodal", "-mm-", "pixtral"]}, {"role": "coder", "title": "Coden & Programmieren", "icon": "code", "kw": ["coder", "-code-", "code-", "codestral", "starcoder"]}, + {"role": "hermes", "title": "Lucys Hirn (Agent)", "icon": "brain-circuit", + "kw": ["hermes"]}, # Agent-Hirn: Hermes-Familie am robustesten (natives Tool-Calling). {"role": "heavy", "title": "Schweres Reasoning", "icon": "brain", "kw": ["reasoning", "-think", "thinking", "gpt-oss", "deepseek-r", "-r1", "qwq", "-70b", "-72b", "-120b", "-123b", "-235b", "-405b", "-a10b", "-a22b"]}, diff --git a/frontend/dist/assets/GraphView-Z2wUzCOt.js b/frontend/dist/assets/GraphView-BUrM8vHT.js similarity index 99% rename from frontend/dist/assets/GraphView-Z2wUzCOt.js rename to frontend/dist/assets/GraphView-BUrM8vHT.js index 4c88dd4..2435f9f 100644 --- a/frontend/dist/assets/GraphView-Z2wUzCOt.js +++ b/frontend/dist/assets/GraphView-BUrM8vHT.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-B3e8J_PY.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{throw TypeError(t)};var AW=(t,e,n)=>e in t?EW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Gs=(t,e,n)=>AW(t,typeof e!="symbol"?e+"":e,n),ZM=(t,e,n)=>e.has(t)||zN("Cannot "+n);var ge=(t,e,n)=>(ZM(t,e,"read from private field"),n?n.call(t):e.get(t)),Gt=(t,e,n)=>e.has(t)?zN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),wt=(t,e,n,r)=>(ZM(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),_n=(t,e,n)=>(ZM(t,e,"access private method"),n);var fb=(t,e,n,r)=>({set _(i){wt(t,e,i,n)},get _(){return ge(t,e,r)}});function TW(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 a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).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 QM={exports:{}},n0={},JM={exports:{}},gn={};/** +var AW=Object.defineProperty;var zN=t=>{throw TypeError(t)};var TW=(t,e,n)=>e in t?AW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Gs=(t,e,n)=>TW(t,typeof e!="symbol"?e+"":e,n),ZM=(t,e,n)=>e.has(t)||zN("Cannot "+n);var ge=(t,e,n)=>(ZM(t,e,"read from private field"),n?n.call(t):e.get(t)),Gt=(t,e,n)=>e.has(t)?zN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),wt=(t,e,n,r)=>(ZM(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),_n=(t,e,n)=>(ZM(t,e,"access private method"),n);var fb=(t,e,n,r)=>({set _(i){wt(t,e,i,n)},get _(){return ge(t,e,r)}});function PW(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 a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).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 QM={exports:{}},n0={},JM={exports:{}},gn={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var EW=Object.defineProperty;var zN=t=>{throw TypeError(t)};var AW=(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 BN;function PW(){if(BN)return gn;BN=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"),a=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function p(H){return H===null||typeof H!="object"?null:(H=f&&H[f]||H["@@iterator"],typeof H=="function"?H:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,S={};function w(H,G,le){this.props=H,this.context=G,this.refs=S,this.updater=le||y}w.prototype.isReactComponent={},w.prototype.setState=function(H,G){if(typeof H!="object"&&typeof H!="function"&&H!=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,H,G,"setState")},w.prototype.forceUpdate=function(H){this.updater.enqueueForceUpdate(this,H,"forceUpdate")};function x(){}x.prototype=w.prototype;function M(H,G,le){this.props=H,this.context=G,this.refs=S,this.updater=le||y}var T=M.prototype=new x;T.constructor=M,b(T,w.prototype),T.isPureReactComponent=!0;var P=Array.isArray,O=Object.prototype.hasOwnProperty,N={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function z(H,G,le){var se,ce={},Se=null,we=null;if(G!=null)for(se in G.ref!==void 0&&(we=G.ref),G.key!==void 0&&(Se=""+G.key),G)O.call(G,se)&&!D.hasOwnProperty(se)&&(ce[se]=G[se]);var We=arguments.length-2;if(We===1)ce.children=le;else if(1{throw TypeError(t)};var AW=(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 VN;function CW(){if(VN)return n0;VN=1;var t=qh(),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 a(o,l,c){var d,f={},p=null,y=null;c!==void 0&&(p=""+c),l.key!==void 0&&(p=""+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(o&&o.defaultProps)for(d in l=o.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:e,type:o,key:p,ref:y,props:f,_owner:i.current}}return n0.Fragment=n,n0.jsx=a,n0.jsxs=a,n0}var GN;function RW(){return GN||(GN=1,QM.exports=CW()),QM.exports}var v=RW(),R=qh();const $j=V1(R),G1=TW({__proto__:null,default:$j},[R]);var hb={},eE={exports:{}},Ws={},tE={exports:{}},nE={};/** + */var VN;function RW(){if(VN)return n0;VN=1;var t=qh(),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 a(o,l,c){var d,f={},p=null,y=null;c!==void 0&&(p=""+c),l.key!==void 0&&(p=""+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(o&&o.defaultProps)for(d in l=o.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:e,type:o,key:p,ref:y,props:f,_owner:i.current}}return n0.Fragment=n,n0.jsx=a,n0.jsxs=a,n0}var GN;function NW(){return GN||(GN=1,QM.exports=RW()),QM.exports}var v=NW(),R=qh();const $j=V1(R),G1=PW({__proto__:null,default:$j},[R]);var hb={},eE={exports:{}},Ws={},tE={exports:{}},nE={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var EW=Object.defineProperty;var zN=t=>{throw TypeError(t)};var AW=(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 WN;function NW(){return WN||(WN=1,(function(t){function e(B,J){var Y=B.length;B.push(J);e:for(;0>>1,G=B[H];if(0>>1;Hi(ce,Y))Sei(we,ce)?(B[H]=we,B[Se]=Y,H=Se):(B[H]=ce,B[se]=Y,H=se);else if(Sei(we,Y))B[H]=we,B[Se]=Y,H=Se;else break e}}return J}function i(B,J){var Y=B.sortIndex-J.sortIndex;return Y!==0?Y:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,f=null,p=3,y=!1,b=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,x=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 J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=B)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function P(B){if(S=!1,T(B),!b)if(n(l)!==null)b=!0,ae(O);else{var J=n(c);J!==null&&he(P,J.startTime-B)}}function O(B,J){b=!1,S&&(S=!1,x(z),z=-1),y=!0;var Y=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!j());){var H=f.callback;if(typeof H=="function"){f.callback=null,p=f.priorityLevel;var G=H(f.expirationTime<=J);J=t.unstable_now(),typeof G=="function"?f.callback=G:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var le=!0;else{var se=n(c);se!==null&&he(P,se.startTime-J),le=!1}return le}finally{f=null,p=Y,y=!1}}var N=!1,D=null,z=-1,V=5,k=-1;function j(){return!(t.unstable_now()-kB||125H?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(x(z),z=-1):S=!0,he(P,Y-H))):(B.sortIndex=G,e(l,B),b||y||(b=!0,ae(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var J=p;return function(){var Y=p;p=J;try{return B.apply(this,arguments)}finally{p=Y}}}})(nE)),nE}var $N;function IW(){return $N||($N=1,tE.exports=NW()),tE.exports}/** + */var WN;function IW(){return WN||(WN=1,(function(t){function e(B,J){var Y=B.length;B.push(J);e:for(;0>>1,G=B[H];if(0>>1;Hi(ce,Y))Sei(we,ce)?(B[H]=we,B[Se]=Y,H=Se):(B[H]=ce,B[se]=Y,H=se);else if(Sei(we,Y))B[H]=we,B[Se]=Y,H=Se;else break e}}return J}function i(B,J){var Y=B.sortIndex-J.sortIndex;return Y!==0?Y:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,f=null,p=3,y=!1,b=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,x=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 J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=B)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function P(B){if(S=!1,T(B),!b)if(n(l)!==null)b=!0,ae(O);else{var J=n(c);J!==null&&he(P,J.startTime-B)}}function O(B,J){b=!1,S&&(S=!1,x(z),z=-1),y=!0;var Y=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!j());){var H=f.callback;if(typeof H=="function"){f.callback=null,p=f.priorityLevel;var G=H(f.expirationTime<=J);J=t.unstable_now(),typeof G=="function"?f.callback=G:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var le=!0;else{var se=n(c);se!==null&&he(P,se.startTime-J),le=!1}return le}finally{f=null,p=Y,y=!1}}var N=!1,D=null,z=-1,V=5,k=-1;function j(){return!(t.unstable_now()-kB||125H?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(x(z),z=-1):S=!0,he(P,Y-H))):(B.sortIndex=G,e(l,B),b||y||(b=!0,ae(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var J=p;return function(){var Y=p;p=J;try{return B.apply(this,arguments)}finally{p=Y}}}})(nE)),nE}var $N;function kW(){return $N||($N=1,tE.exports=IW()),tE.exports}/** * @license React * react-dom.production.min.js * @@ -30,34 +30,34 @@ var EW=Object.defineProperty;var zN=t=>{throw TypeError(t)};var AW=(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 XN;function kW(){if(XN)return Ws;XN=1;var t=qh(),e=IW();function n(u){for(var h="https://reactjs.org/docs/error-decoder.html?invariant="+u,_=1;_"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 p(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 b(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,U,$){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=A,this.attributeNamespace=I,this.mustUseProperty=_,this.propertyName=u,this.type=h,this.sanitizeURL=U,this.removeEmptyString=$}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 x=/[\-:]([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(x,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(x,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(x,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||!(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 p(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 b(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,U,$){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=A,this.attributeNamespace=I,this.mustUseProperty=_,this.propertyName=u,this.type=h,this.sanitizeURL=U,this.removeEmptyString=$}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 x=/[\-:]([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(x,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(x,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(x,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[$]!==U[oe]){var me=` -`+I[$].replace(" at new "," at ");return u.displayName&&me.includes("")&&(me=me.replace("",u.displayName)),me}while(1<=$&&0<=oe);break}}}finally{le=!1,Error.prepareStackTrace=_}return(u=u?u.displayName||u.name:"")?G(u):""}function ce(u){switch(u.tag){case 5:return G(u.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return u=se(u.type,!1),u;case 11:return u=se(u.type.render,!1),u;case 1:return u=se(u.type,!0),u;default:return""}}function Se(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 D:return"Fragment";case N:return"Portal";case V:return"Profiler";case z:return"StrictMode";case ee:return"Suspense";case ie:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case j:return(u.displayName||"Context")+".Consumer";case k:return(u._context.displayName||"Context")+".Provider";case X: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:Se(u.type)||"Memo";case ae:h=u._payload,u=u._init;try{return Se(u(h))}catch{}}return null}function we(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 Se(h);case 8:return h===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function We(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Ee(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function Ge(u){var h=Ee(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,U=_.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function($){A=""+$,U.call(this,$)}}),Object.defineProperty(u,h,{enumerable:_.enumerable}),{getValue:function(){return A},setValue:function($){A=""+$},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function $e(u){u._valueTracker||(u._valueTracker=Ge(u))}function de(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var _=h.getValue(),A="";return u&&(A=Ee(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 Y({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:_??u._wrapperState.initialChecked})}function Le(u,h){var _=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;_=We(h.value!=null?h.value:_),u._wrapperState={initialChecked:A,initialValue:_,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function ne(u,h){h=h.checked,h!=null&&T(u,"checked",h,!1)}function Ce(u,h){ne(u,h);var _=We(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")?Ze(u,h.type,_):h.hasOwnProperty("defaultValue")&&Ze(u,h.type,We(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(u.defaultChecked=!!h.defaultChecked)}function qe(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 Ze(u,h,_){(h!=="number"||Z(u.ownerDocument)!==u)&&(_==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+_&&(u.defaultValue=""+_))}var Q=Array.isArray;function W(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=ht.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 te={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},tt=["Webkit","ms","Moz","O"];Object.keys(te).forEach(function(u){tt.forEach(function(h){h=h+u.charAt(0).toUpperCase()+u.substring(1),te[h]=te[u]})});function Mt(u,h,_){return h==null||typeof h=="boolean"||h===""?"":_||typeof h!="number"||h===0||te.hasOwnProperty(u)&&te[u]?(""+h).trim():h+"px"}function vt(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 Zt=Y({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 fe(u,h){if(h){if(Zt[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 Xe(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 ue=null;function Ye(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Re=null,Be=null,at=null;function pt(u){if(u=ho(u)){if(typeof Re!="function")throw Error(n(280));var h=u.stateNode;h&&(h=Up(h),Re(u.stateNode,u.type,h))}}function Jt(u){Be?at?at.push(u):at=[u]:Be=u}function pn(){if(Be){var u=Be,h=at;if(at=Be=null,pt(u),h)for(u=0;u>>=0,u===0?32:31-(xn(u)/tn|0)|0}var li=64,In=4194304;function Is(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 Vn(u,h){var _=u.pendingLanes;if(_===0)return 0;var A=0,I=u.suspendedLanes,U=u.pingedLanes,$=_&268435455;if($!==0){var oe=$&~I;oe!==0?A=Is(oe):(U&=$,U!==0&&(A=Is(U)))}else $=_&~I,$!==0?A=Is($):U!==0&&(A=Is(U));if(A===0)return 0;if(h!==0&&h!==A&&(h&I)===0&&(I=A&-A,U=h&-h,I>=U||I===16&&(U&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 Zo(u,h,_){u.pendingLanes|=h,h!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,h=31-mt(h),u[h]=_}function _M(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-mt(_),U=1<=qr),js=" ",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 Tx(u,h){switch(u){case"compositionend":return bp(h);case"keypress":return h.which!==32?null:(vv=!0,js);case"textInput":return u=h.data,u===js&&vv?null:u;default:return null}}function Gd(u,h){if(tl)return u==="compositionend"||!Ci&&yv(u,h)?(u=Hd(),$i=uv=na=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}_=Wd(_)}}function Jl(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?Jl(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function rr(){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 Dr(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 Ur(u){var h=rr(),_=u.focusedElem,A=u.selectionRange;if(h!==_&&_&&_.ownerDocument&&Jl(_.ownerDocument.documentElement,_)){if(A!==null&&Dr(_)){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,U=Math.min(A.start,I);A=A.end===void 0?U:Math.min(A.end,I),!u.extend&&U>A&&(I=A,A=U,U=I),I=fs(_,U);var $=fs(_,A);I&&$&&(u.rangeCount!==1||u.anchorNode!==I.node||u.anchorOffset!==I.offset||u.focusNode!==$.node||u.focusOffset!==$.offset)&&(h=h.createRange(),h.setStart(I.node,I.offset),u.removeAllRanges(),U>A?(u.addRange(h),u.extend($.node,$.offset)):(h.setEnd($.node,$.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,Ra=null,ec=null,$d=null,jr=!1;function Ep(u,h,_){var A=_.window===_?_.document:_.nodeType===9?_:_.ownerDocument;jr||Ra==null||Ra!==Z(A)||(A=Ra,"selectionStart"in A&&Dr(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}),$d&&Ql($d,A)||($d=A,A=Ip(ec,"onSelect"),0Fr||(u.current=Rv[Fr],Rv[Fr]=null,Fr--)}function Gn(u,h){Fr++,Rv[Fr]=u.current,u.current=h}var po={},Kr=lr(po),Ri=lr(!1),mo=po;function ic(u,h){var _=u.type.contextTypes;if(!_)return po;var A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var I={},U;for(U in _)I[U]=h[U];return A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=h,u.__reactInternalMemoizedMaskedChildContext=I),I}function ui(u){return u=u.childContextTypes,u!=null}function ef(){$n(Ri),$n(Kr)}function Nv(u,h,_){if(Kr.current!==po)throw Error(n(168));Gn(Kr,h),Gn(Ri,_)}function tf(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,we(u)||"Unknown",I));return Y({},_,A)}function sc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||po,mo=Kr.current,Gn(Kr,u),Gn(Ri,Ri.current),!0}function Iv(u,h,_){var A=u.stateNode;if(!A)throw Error(n(169));_?(u=tf(u,h,mo),A.__reactInternalMemoizedMergedChildContext=u,$n(Ri),$n(Kr),Gn(Kr,u)):$n(Ri),Gn(Ri,_)}var aa=null,nf=!1,jp=!1;function rf(u){aa===null?aa=[u]:aa.push(u)}function Lx(u){nf=!0,rf(u)}function Ia(){if(!jp&&aa!==null){jp=!0;var u=0,h=Pn;try{var _=aa;for(Pn=1;u<_.length;u++){var A=_[u];do A=A(!0);while(A!==null)}aa=null,nf=!1}catch(I){throw aa!==null&&(aa=aa.slice(u+1)),Ie(jt,Ia),I}finally{Pn=h,jp=!1}}return null}var ac=[],Ki=0,Fp=null,zp=0,Ni=[],zr=0,oc=null,ut=1,Fs="";function go(u,h){ac[Ki++]=zp,ac[Ki++]=Fp,Fp=u,zp=h}function kv(u,h,_){Ni[zr++]=ut,Ni[zr++]=Fs,Ni[zr++]=oc,oc=u;var A=ut;u=Fs;var I=32-mt(A)-1;A&=~(1<>=$,I-=$,ut=1<<32-mt(h)+I|_<nn?(pi=Vt,Vt=null):pi=Vt.sibling;var Ln=Qe(Ae,Vt,Pe[nn],ot);if(Ln===null){Vt===null&&(Vt=pi);break}u&&Vt&&Ln.alternate===null&&h(Ae,Vt),ve=U(Ln,ve,nn),Ht===null?Dt=Ln:Ht.sibling=Ln,Ht=Ln,Vt=pi}if(nn===Pe.length)return _(Ae,Vt),Kn&&go(Ae,nn),Dt;if(Vt===null){for(;nnnn?(pi=Vt,Vt=null):pi=Vt.sibling;var Bu=Qe(Ae,Vt,Ln.value,ot);if(Bu===null){Vt===null&&(Vt=pi);break}u&&Vt&&Bu.alternate===null&&h(Ae,Vt),ve=U(Bu,ve,nn),Ht===null?Dt=Bu:Ht.sibling=Bu,Ht=Bu,Vt=pi}if(Ln.done)return _(Ae,Vt),Kn&&go(Ae,nn),Dt;if(Vt===null){for(;!Ln.done;nn++,Ln=Pe.next())Ln=nt(Ae,Ln.value,ot),Ln!==null&&(ve=U(Ln,ve,nn),Ht===null?Dt=Ln:Ht.sibling=Ln,Ht=Ln);return Kn&&go(Ae,nn),Dt}for(Vt=A(Ae,Vt);!Ln.done;nn++,Ln=Pe.next())Ln=_t(Vt,Ae,nn,Ln.value,ot),Ln!==null&&(u&&Ln.alternate!==null&&Vt.delete(Ln.key===null?nn:Ln.key),ve=U(Ln,ve,nn),Ht===null?Dt=Ln:Ht.sibling=Ln,Ht=Ln);return u&&Vt.forEach(function(MW){return h(Ae,MW)}),Kn&&go(Ae,nn),Dt}function kr(Ae,ve,Pe,ot){if(typeof Pe=="object"&&Pe!==null&&Pe.type===D&&Pe.key===null&&(Pe=Pe.props.children),typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case O:e:{for(var Dt=Pe.key,Ht=ve;Ht!==null;){if(Ht.key===Dt){if(Dt=Pe.type,Dt===D){if(Ht.tag===7){_(Ae,Ht.sibling),ve=I(Ht,Pe.props.children),ve.return=Ae,Ae=ve;break e}}else if(Ht.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===ae&&jv(Dt)===Ht.type){_(Ae,Ht.sibling),ve=I(Ht,Pe.props),ve.ref=sf(Ae,Ht,Pe),ve.return=Ae,Ae=ve;break e}_(Ae,Ht);break}else h(Ae,Ht);Ht=Ht.sibling}Pe.type===D?(ve=Sf(Pe.props.children,Ae.mode,ot,Pe.key),ve.return=Ae,Ae=ve):(ot=ib(Pe.type,Pe.key,Pe.props,null,Ae.mode,ot),ot.ref=sf(Ae,ve,Pe),ot.return=Ae,Ae=ot)}return $(Ae);case N:e:{for(Ht=Pe.key;ve!==null;){if(ve.key===Ht)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=$M(Pe,Ae.mode,ot),ve.return=Ae,Ae=ve}return $(Ae);case ae:return Ht=Pe._init,kr(Ae,ve,Ht(Pe._payload),ot)}if(Q(Pe))return Pt(Ae,ve,Pe,ot);if(J(Pe))return Nt(Ae,ve,Pe,ot);af(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=WM(Pe,Ae.mode,ot),ve.return=Ae,Ae=ve),$(Ae)):_(Ae,ve)}return kr}var lc=Fv(!0),of=Fv(!1),cc=lr(null),uc=null,yo=null,Ru=null;function dc(){Ru=yo=uc=null}function lf(u){var h=cc.current;$n(cc),u._currentValue=h}function cf(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 ol(u,h){uc=u,Ru=yo=null,u=u.dependencies,u!==null&&u.firstContext!==null&&((u.lanes&h)!==0&&(ln=!0),u.firstContext=null)}function ps(u){var h=u._currentValue;if(Ru!==u)if(u={context:u,memoizedValue:h,next:null},yo===null){if(uc===null)throw Error(n(308));yo=u,uc.dependencies={lanes:0,firstContext:u}}else yo=yo.next=u;return h}var xo=null;function zv(u){xo===null?xo=[u]:xo.push(u)}function uf(u,h,_,A){var I=h.interleaved;return I===null?(_.next=_,zv(h)):(_.next=I.next,I.next=_),h.interleaved=_,oa(u,A)}function oa(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 Fn=!1;function on(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 zn(u,h){return{eventTime:u,lane:h,tag:0,payload:null,callback:null,next:null}}function Jn(u,h,_){var A=u.updateQueue;if(A===null)return null;if(A=A.shared,(kn&2)!==0){var I=A.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),A.pending=h,oa(u,_)}return I=A.interleaved,I===null?(h.next=h,zv(A)):(h.next=I.next,I.next=h),A.interleaved=h,oa(u,_)}function di(u,h,_){if(h=h.updateQueue,h!==null&&(h=h.shared,(_&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,_|=A,h.lanes=_,uu(u,_)}}function fc(u,h){var _=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,_===A)){var I=null,U=null;if(_=_.firstBaseUpdate,_!==null){do{var $={eventTime:_.eventTime,lane:_.lane,tag:_.tag,payload:_.payload,callback:_.callback,next:null};U===null?I=U=$:U=U.next=$,_=_.next}while(_!==null);U===null?I=U=h:U=U.next=h}else I=U=h;_={baseState:A.baseState,firstBaseUpdate:I,lastBaseUpdate:U,shared:A.shared,effects:A.effects},u.updateQueue=_;return}u=_.lastBaseUpdate,u===null?_.firstBaseUpdate=h:u.next=h,_.lastBaseUpdate=h}function cr(u,h,_,A){var I=u.updateQueue;Fn=!1;var U=I.firstBaseUpdate,$=I.lastBaseUpdate,oe=I.shared.pending;if(oe!==null){I.shared.pending=null;var me=oe,Oe=me.next;me.next=null,$===null?U=Oe:$.next=Oe,$=me;var et=u.alternate;et!==null&&(et=et.updateQueue,oe=et.lastBaseUpdate,oe!==$&&(oe===null?et.firstBaseUpdate=Oe:oe.next=Oe,et.lastBaseUpdate=me))}if(U!==null){var nt=I.baseState;$=0,et=Oe=me=null,oe=U;do{var Qe=oe.lane,_t=oe.eventTime;if((A&Qe)===Qe){et!==null&&(et=et.next={eventTime:_t,lane:0,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null});e:{var Pt=u,Nt=oe;switch(Qe=h,_t=_,Nt.tag){case 1:if(Pt=Nt.payload,typeof Pt=="function"){nt=Pt.call(_t,nt,Qe);break e}nt=Pt;break e;case 3:Pt.flags=Pt.flags&-65537|128;case 0:if(Pt=Nt.payload,Qe=typeof Pt=="function"?Pt.call(_t,nt,Qe):Pt,Qe==null)break e;nt=Y({},nt,Qe);break e;case 2:Fn=!0}}oe.callback!==null&&oe.lane!==0&&(u.flags|=64,Qe=I.effects,Qe===null?I.effects=[oe]:Qe.push(oe))}else _t={eventTime:_t,lane:Qe,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null},et===null?(Oe=et=_t,me=nt):et=et.next=_t,$|=Qe;if(oe=oe.next,oe===null){if(oe=I.shared.pending,oe===null)break;Qe=oe,oe=Qe.next,Qe.next=null,I.lastBaseUpdate=Qe,I.shared.pending=null}}while(!0);if(et===null&&(me=nt),I.baseState=me,I.firstBaseUpdate=Oe,I.lastBaseUpdate=et,h=I.shared.interleaved,h!==null){I=h;do $|=I.lane,I=I.next;while(I!==h)}else U===null&&(I.shared.lanes=0);xf|=$,u.lanes=$,u.memoizedState=nt}}function Nu(u,h,_){if(u=h.effects,h.effects=null,u!==null)for(h=0;h_?_:4,u(!0);var A=gc.transition;gc.transition={};try{u(!1),h()}finally{Pn=_,gc.transition=A}}function So(){return gs().memoizedState}function Xp(u,h,_){var A=ju(u);if(_={lane:A,action:_,hasEagerState:!1,eagerState:null,next:null},vf(u))qp(h,_);else if(_=uf(u,h,_,A),_!==null){var I=xs();To(_,u,A,I),Kp(_,h,A)}}function vc(u,h,_){var A=ju(u),I={lane:A,action:_,hasEagerState:!1,eagerState:null,next:null};if(vf(u))qp(h,I);else{var U=u.alternate;if(u.lanes===0&&(U===null||U.lanes===0)&&(U=h.lastRenderedReducer,U!==null))try{var $=h.lastRenderedState,oe=U($,_);if(I.hasEagerState=!0,I.eagerState=oe,ds(oe,$)){var me=h.interleaved;me===null?(I.next=I,zv(h)):(I.next=me.next,me.next=I),h.interleaved=I;return}}catch{}finally{}_=uf(u,h,I,A),_!==null&&(I=xs(),To(_,u,A,I),Kp(_,h,A))}}function vf(u){var h=u.alternate;return u===Xn||h!==null&&h===Xn}function qp(u,h){fi=ca=!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=_,uu(u,_)}}var Yp={readContext:ps,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},Hx={readContext:ps,useCallback:function(u,h){return Qr().memoizedState=[u,h===void 0?null:h],u},useContext:ps,useEffect:ki,useImperativeHandle:function(u,h,_){return _=_!=null?_.concat([u]):null,La(4194308,4,zx.bind(null,h,u),_)},useLayoutEffect:function(u,h){return La(4194308,4,u,h)},useInsertionEffect:function(u,h){return La(4,2,u,h)},useMemo:function(u,h){var _=Qr();return h=h===void 0?null:h,u=u(),_.memoizedState=[u,h],u},useReducer:function(u,h,_){var A=Qr();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,Xn,u),[A.memoizedState,u]},useRef:function(u){var h=Qr();return u={current:u},h.memoizedState=u},useState:Wv,useDebugValue:Wp,useDeferredValue:function(u){return Qr().memoizedState=u},useTransition:function(){var u=Wv(!1),h=u[0];return u=TM.bind(null,u[1]),Qr().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,_){var A=Xn,I=Qr();if(Kn){if(_===void 0)throw Error(n(407));_=_()}else{if(_=h(),hi===null)throw Error(n(349));(_o&30)!==0||Gp(A,h,_)}I.memoizedState=_;var U={value:_,getSnapshot:h};return I.queue=U,ki(Dx.bind(null,A,U,u),[u]),A.flags|=2048,ua(9,mf.bind(null,A,U,_,h),void 0,null),_},useId:function(){var u=Qr(),h=hi.identifierPrefix;if(Kn){var _=Fs,A=ut;_=(A&~(1<<32-mt(A)-1)).toString(32)+_,h=":"+h+"R"+_,_=cl++,0<_&&(h+="H"+_.toString(32)),h+=":"}else _=Yi++,h=":"+h+"r"+_.toString(32)+":";return u.memoizedState=h},unstable_isNewReconciler:!1},Vx={readContext:ps,useCallback:Bx,useContext:ps,useEffect:$v,useImperativeHandle:qv,useInsertionEffect:Xv,useLayoutEffect:Fx,useMemo:vs,useReducer:pf,useRef:jx,useState:function(){return pf(Ou)},useDebugValue:Wp,useDeferredValue:function(u){var h=gs();return $p(h,ur.memoizedState,u)},useTransition:function(){var u=pf(Ou)[0],h=gs().memoizedState;return[u,h]},useMutableSource:Hv,useSyncExternalStore:Vv,useId:So,unstable_isNewReconciler:!1},Gx={readContext:ps,useCallback:Bx,useContext:ps,useEffect:$v,useImperativeHandle:qv,useInsertionEffect:Xv,useLayoutEffect:Fx,useMemo:vs,useReducer:wo,useRef:jx,useState:function(){return wo(Ou)},useDebugValue:Wp,useDeferredValue:function(u){var h=gs();return ur===null?h.memoizedState=u:$p(h,ur.memoizedState,u)},useTransition:function(){var u=wo(Ou)[0],h=gs().memoizedState;return[u,h]},useMutableSource:Hv,useSyncExternalStore:Vv,useId:So,unstable_isNewReconciler:!1};function Bs(u,h){if(u&&u.defaultProps){h=Y({},h),u=u.defaultProps;for(var _ in u)h[_]===void 0&&(h[_]=u[_]);return h}return h}function yf(u,h,_,A){h=u.memoizedState,_=_(A,h),_=_==null?h:Y({},h,_),u.memoizedState=_,u.lanes===0&&(u.updateQueue.baseState=_)}var Zp={isMounted:function(u){return(u=u._reactInternals)?Ta(u)===u:!1},enqueueSetState:function(u,h,_){u=u._reactInternals;var A=xs(),I=ju(u),U=zn(A,I);U.payload=h,_!=null&&(U.callback=_),h=Jn(u,U,I),h!==null&&(To(h,u,I,A),di(h,u,I))},enqueueReplaceState:function(u,h,_){u=u._reactInternals;var A=xs(),I=ju(u),U=zn(A,I);U.tag=1,U.payload=h,_!=null&&(U.callback=_),h=Jn(u,U,I),h!==null&&(To(h,u,I,A),di(h,u,I))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var _=xs(),A=ju(u),I=zn(_,A);I.tag=2,h!=null&&(I.callback=h),h=Jn(u,I,A),h!==null&&(To(h,u,A,_),di(h,u,A))}};function Wx(u,h,_,A,I,U,$){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(A,U,$):h.prototype&&h.prototype.isPureReactComponent?!Ql(_,A)||!Ql(I,U):!0}function m(u,h,_){var A=!1,I=po,U=h.contextType;return typeof U=="object"&&U!==null?U=ps(U):(I=ui(h)?mo:Kr.current,A=h.contextTypes,U=(A=A!=null)?ic(u,I):po),h=new h(_,U),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=U),h}function g(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={},on(u);var U=h.contextType;typeof U=="object"&&U!==null?I.context=ps(U):(U=ui(h)?mo:Kr.current,I.context=ic(u,U)),I.state=u.memoizedState,U=h.getDerivedStateFromProps,typeof U=="function"&&(yf(u,h,U,_),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),cr(u,_,I,A),I.state=u.memoizedState),typeof I.componentDidMount=="function"&&(u.flags|=4194308)}function C(u,h){try{var _="",A=h;do _+=ce(A),A=A.return;while(A);var I=_}catch(U){I=` +`+I[$].replace(" at new "," at ");return u.displayName&&me.includes("")&&(me=me.replace("",u.displayName)),me}while(1<=$&&0<=oe);break}}}finally{le=!1,Error.prepareStackTrace=_}return(u=u?u.displayName||u.name:"")?G(u):""}function ce(u){switch(u.tag){case 5:return G(u.type);case 16:return G("Lazy");case 13:return G("Suspense");case 19:return G("SuspenseList");case 0:case 2:case 15:return u=se(u.type,!1),u;case 11:return u=se(u.type.render,!1),u;case 1:return u=se(u.type,!0),u;default:return""}}function Se(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 D:return"Fragment";case N:return"Portal";case V:return"Profiler";case z:return"StrictMode";case ee:return"Suspense";case ie:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case j:return(u.displayName||"Context")+".Consumer";case k:return(u._context.displayName||"Context")+".Provider";case X: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:Se(u.type)||"Memo";case ae:h=u._payload,u=u._init;try{return Se(u(h))}catch{}}return null}function we(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 Se(h);case 8:return h===z?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function We(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Ee(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function Ge(u){var h=Ee(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,U=_.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function($){A=""+$,U.call(this,$)}}),Object.defineProperty(u,h,{enumerable:_.enumerable}),{getValue:function(){return A},setValue:function($){A=""+$},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function $e(u){u._valueTracker||(u._valueTracker=Ge(u))}function de(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var _=h.getValue(),A="";return u&&(A=Ee(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 Y({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:_??u._wrapperState.initialChecked})}function Le(u,h){var _=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;_=We(h.value!=null?h.value:_),u._wrapperState={initialChecked:A,initialValue:_,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function ne(u,h){h=h.checked,h!=null&&T(u,"checked",h,!1)}function Ce(u,h){ne(u,h);var _=We(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")?Ze(u,h.type,_):h.hasOwnProperty("defaultValue")&&Ze(u,h.type,We(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(u.defaultChecked=!!h.defaultChecked)}function Xe(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 Ze(u,h,_){(h!=="number"||Z(u.ownerDocument)!==u)&&(_==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+_&&(u.defaultValue=""+_))}var Q=Array.isArray;function W(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=ht.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 te={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},tt=["Webkit","ms","Moz","O"];Object.keys(te).forEach(function(u){tt.forEach(function(h){h=h+u.charAt(0).toUpperCase()+u.substring(1),te[h]=te[u]})});function Mt(u,h,_){return h==null||typeof h=="boolean"||h===""?"":_||typeof h!="number"||h===0||te.hasOwnProperty(u)&&te[u]?(""+h).trim():h+"px"}function vt(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 Zt=Y({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 fe(u,h){if(h){if(Zt[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 ue=null;function Ye(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Re=null,Be=null,at=null;function pt(u){if(u=ho(u)){if(typeof Re!="function")throw Error(n(280));var h=u.stateNode;h&&(h=Up(h),Re(u.stateNode,u.type,h))}}function Jt(u){Be?at?at.push(u):at=[u]:Be=u}function pn(){if(Be){var u=Be,h=at;if(at=Be=null,pt(u),h)for(u=0;u>>=0,u===0?32:31-(xn(u)/tn|0)|0}var li=64,In=4194304;function Is(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 Vn(u,h){var _=u.pendingLanes;if(_===0)return 0;var A=0,I=u.suspendedLanes,U=u.pingedLanes,$=_&268435455;if($!==0){var oe=$&~I;oe!==0?A=Is(oe):(U&=$,U!==0&&(A=Is(U)))}else $=_&~I,$!==0?A=Is($):U!==0&&(A=Is(U));if(A===0)return 0;if(h!==0&&h!==A&&(h&I)===0&&(I=A&-A,U=h&-h,I>=U||I===16&&(U&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 Zo(u,h,_){u.pendingLanes|=h,h!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,h=31-mt(h),u[h]=_}function _M(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-mt(_),U=1<=qr),js=" ",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 Tx(u,h){switch(u){case"compositionend":return bp(h);case"keypress":return h.which!==32?null:(vv=!0,js);case"textInput":return u=h.data,u===js&&vv?null:u;default:return null}}function Gd(u,h){if(tl)return u==="compositionend"||!Ci&&yv(u,h)?(u=Hd(),$i=uv=na=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}_=Wd(_)}}function Jl(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?Jl(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function rr(){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 Dr(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 Ur(u){var h=rr(),_=u.focusedElem,A=u.selectionRange;if(h!==_&&_&&_.ownerDocument&&Jl(_.ownerDocument.documentElement,_)){if(A!==null&&Dr(_)){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,U=Math.min(A.start,I);A=A.end===void 0?U:Math.min(A.end,I),!u.extend&&U>A&&(I=A,A=U,U=I),I=fs(_,U);var $=fs(_,A);I&&$&&(u.rangeCount!==1||u.anchorNode!==I.node||u.anchorOffset!==I.offset||u.focusNode!==$.node||u.focusOffset!==$.offset)&&(h=h.createRange(),h.setStart(I.node,I.offset),u.removeAllRanges(),U>A?(u.addRange(h),u.extend($.node,$.offset)):(h.setEnd($.node,$.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,Ra=null,ec=null,$d=null,jr=!1;function Ep(u,h,_){var A=_.window===_?_.document:_.nodeType===9?_:_.ownerDocument;jr||Ra==null||Ra!==Z(A)||(A=Ra,"selectionStart"in A&&Dr(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}),$d&&Ql($d,A)||($d=A,A=Ip(ec,"onSelect"),0Fr||(u.current=Rv[Fr],Rv[Fr]=null,Fr--)}function Gn(u,h){Fr++,Rv[Fr]=u.current,u.current=h}var po={},Kr=lr(po),Ri=lr(!1),mo=po;function ic(u,h){var _=u.type.contextTypes;if(!_)return po;var A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var I={},U;for(U in _)I[U]=h[U];return A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=h,u.__reactInternalMemoizedMaskedChildContext=I),I}function ui(u){return u=u.childContextTypes,u!=null}function ef(){$n(Ri),$n(Kr)}function Nv(u,h,_){if(Kr.current!==po)throw Error(n(168));Gn(Kr,h),Gn(Ri,_)}function tf(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,we(u)||"Unknown",I));return Y({},_,A)}function sc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||po,mo=Kr.current,Gn(Kr,u),Gn(Ri,Ri.current),!0}function Iv(u,h,_){var A=u.stateNode;if(!A)throw Error(n(169));_?(u=tf(u,h,mo),A.__reactInternalMemoizedMergedChildContext=u,$n(Ri),$n(Kr),Gn(Kr,u)):$n(Ri),Gn(Ri,_)}var aa=null,nf=!1,jp=!1;function rf(u){aa===null?aa=[u]:aa.push(u)}function Lx(u){nf=!0,rf(u)}function Ia(){if(!jp&&aa!==null){jp=!0;var u=0,h=Pn;try{var _=aa;for(Pn=1;u<_.length;u++){var A=_[u];do A=A(!0);while(A!==null)}aa=null,nf=!1}catch(I){throw aa!==null&&(aa=aa.slice(u+1)),Ie(jt,Ia),I}finally{Pn=h,jp=!1}}return null}var ac=[],Ki=0,Fp=null,zp=0,Ni=[],zr=0,oc=null,ut=1,Fs="";function go(u,h){ac[Ki++]=zp,ac[Ki++]=Fp,Fp=u,zp=h}function kv(u,h,_){Ni[zr++]=ut,Ni[zr++]=Fs,Ni[zr++]=oc,oc=u;var A=ut;u=Fs;var I=32-mt(A)-1;A&=~(1<>=$,I-=$,ut=1<<32-mt(h)+I|_<nn?(pi=Vt,Vt=null):pi=Vt.sibling;var Ln=Qe(Ae,Vt,Pe[nn],ot);if(Ln===null){Vt===null&&(Vt=pi);break}u&&Vt&&Ln.alternate===null&&h(Ae,Vt),ve=U(Ln,ve,nn),Ht===null?Dt=Ln:Ht.sibling=Ln,Ht=Ln,Vt=pi}if(nn===Pe.length)return _(Ae,Vt),Kn&&go(Ae,nn),Dt;if(Vt===null){for(;nnnn?(pi=Vt,Vt=null):pi=Vt.sibling;var Bu=Qe(Ae,Vt,Ln.value,ot);if(Bu===null){Vt===null&&(Vt=pi);break}u&&Vt&&Bu.alternate===null&&h(Ae,Vt),ve=U(Bu,ve,nn),Ht===null?Dt=Bu:Ht.sibling=Bu,Ht=Bu,Vt=pi}if(Ln.done)return _(Ae,Vt),Kn&&go(Ae,nn),Dt;if(Vt===null){for(;!Ln.done;nn++,Ln=Pe.next())Ln=nt(Ae,Ln.value,ot),Ln!==null&&(ve=U(Ln,ve,nn),Ht===null?Dt=Ln:Ht.sibling=Ln,Ht=Ln);return Kn&&go(Ae,nn),Dt}for(Vt=A(Ae,Vt);!Ln.done;nn++,Ln=Pe.next())Ln=_t(Vt,Ae,nn,Ln.value,ot),Ln!==null&&(u&&Ln.alternate!==null&&Vt.delete(Ln.key===null?nn:Ln.key),ve=U(Ln,ve,nn),Ht===null?Dt=Ln:Ht.sibling=Ln,Ht=Ln);return u&&Vt.forEach(function(EW){return h(Ae,EW)}),Kn&&go(Ae,nn),Dt}function kr(Ae,ve,Pe,ot){if(typeof Pe=="object"&&Pe!==null&&Pe.type===D&&Pe.key===null&&(Pe=Pe.props.children),typeof Pe=="object"&&Pe!==null){switch(Pe.$$typeof){case O:e:{for(var Dt=Pe.key,Ht=ve;Ht!==null;){if(Ht.key===Dt){if(Dt=Pe.type,Dt===D){if(Ht.tag===7){_(Ae,Ht.sibling),ve=I(Ht,Pe.props.children),ve.return=Ae,Ae=ve;break e}}else if(Ht.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===ae&&jv(Dt)===Ht.type){_(Ae,Ht.sibling),ve=I(Ht,Pe.props),ve.ref=sf(Ae,Ht,Pe),ve.return=Ae,Ae=ve;break e}_(Ae,Ht);break}else h(Ae,Ht);Ht=Ht.sibling}Pe.type===D?(ve=Sf(Pe.props.children,Ae.mode,ot,Pe.key),ve.return=Ae,Ae=ve):(ot=ib(Pe.type,Pe.key,Pe.props,null,Ae.mode,ot),ot.ref=sf(Ae,ve,Pe),ot.return=Ae,Ae=ot)}return $(Ae);case N:e:{for(Ht=Pe.key;ve!==null;){if(ve.key===Ht)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=$M(Pe,Ae.mode,ot),ve.return=Ae,Ae=ve}return $(Ae);case ae:return Ht=Pe._init,kr(Ae,ve,Ht(Pe._payload),ot)}if(Q(Pe))return Pt(Ae,ve,Pe,ot);if(J(Pe))return Nt(Ae,ve,Pe,ot);af(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=WM(Pe,Ae.mode,ot),ve.return=Ae,Ae=ve),$(Ae)):_(Ae,ve)}return kr}var lc=Fv(!0),of=Fv(!1),cc=lr(null),uc=null,yo=null,Ru=null;function dc(){Ru=yo=uc=null}function lf(u){var h=cc.current;$n(cc),u._currentValue=h}function cf(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 ol(u,h){uc=u,Ru=yo=null,u=u.dependencies,u!==null&&u.firstContext!==null&&((u.lanes&h)!==0&&(ln=!0),u.firstContext=null)}function ps(u){var h=u._currentValue;if(Ru!==u)if(u={context:u,memoizedValue:h,next:null},yo===null){if(uc===null)throw Error(n(308));yo=u,uc.dependencies={lanes:0,firstContext:u}}else yo=yo.next=u;return h}var xo=null;function zv(u){xo===null?xo=[u]:xo.push(u)}function uf(u,h,_,A){var I=h.interleaved;return I===null?(_.next=_,zv(h)):(_.next=I.next,I.next=_),h.interleaved=_,oa(u,A)}function oa(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 Fn=!1;function on(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 zn(u,h){return{eventTime:u,lane:h,tag:0,payload:null,callback:null,next:null}}function Jn(u,h,_){var A=u.updateQueue;if(A===null)return null;if(A=A.shared,(kn&2)!==0){var I=A.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),A.pending=h,oa(u,_)}return I=A.interleaved,I===null?(h.next=h,zv(A)):(h.next=I.next,I.next=h),A.interleaved=h,oa(u,_)}function di(u,h,_){if(h=h.updateQueue,h!==null&&(h=h.shared,(_&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,_|=A,h.lanes=_,uu(u,_)}}function fc(u,h){var _=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,_===A)){var I=null,U=null;if(_=_.firstBaseUpdate,_!==null){do{var $={eventTime:_.eventTime,lane:_.lane,tag:_.tag,payload:_.payload,callback:_.callback,next:null};U===null?I=U=$:U=U.next=$,_=_.next}while(_!==null);U===null?I=U=h:U=U.next=h}else I=U=h;_={baseState:A.baseState,firstBaseUpdate:I,lastBaseUpdate:U,shared:A.shared,effects:A.effects},u.updateQueue=_;return}u=_.lastBaseUpdate,u===null?_.firstBaseUpdate=h:u.next=h,_.lastBaseUpdate=h}function cr(u,h,_,A){var I=u.updateQueue;Fn=!1;var U=I.firstBaseUpdate,$=I.lastBaseUpdate,oe=I.shared.pending;if(oe!==null){I.shared.pending=null;var me=oe,Oe=me.next;me.next=null,$===null?U=Oe:$.next=Oe,$=me;var et=u.alternate;et!==null&&(et=et.updateQueue,oe=et.lastBaseUpdate,oe!==$&&(oe===null?et.firstBaseUpdate=Oe:oe.next=Oe,et.lastBaseUpdate=me))}if(U!==null){var nt=I.baseState;$=0,et=Oe=me=null,oe=U;do{var Qe=oe.lane,_t=oe.eventTime;if((A&Qe)===Qe){et!==null&&(et=et.next={eventTime:_t,lane:0,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null});e:{var Pt=u,Nt=oe;switch(Qe=h,_t=_,Nt.tag){case 1:if(Pt=Nt.payload,typeof Pt=="function"){nt=Pt.call(_t,nt,Qe);break e}nt=Pt;break e;case 3:Pt.flags=Pt.flags&-65537|128;case 0:if(Pt=Nt.payload,Qe=typeof Pt=="function"?Pt.call(_t,nt,Qe):Pt,Qe==null)break e;nt=Y({},nt,Qe);break e;case 2:Fn=!0}}oe.callback!==null&&oe.lane!==0&&(u.flags|=64,Qe=I.effects,Qe===null?I.effects=[oe]:Qe.push(oe))}else _t={eventTime:_t,lane:Qe,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null},et===null?(Oe=et=_t,me=nt):et=et.next=_t,$|=Qe;if(oe=oe.next,oe===null){if(oe=I.shared.pending,oe===null)break;Qe=oe,oe=Qe.next,Qe.next=null,I.lastBaseUpdate=Qe,I.shared.pending=null}}while(!0);if(et===null&&(me=nt),I.baseState=me,I.firstBaseUpdate=Oe,I.lastBaseUpdate=et,h=I.shared.interleaved,h!==null){I=h;do $|=I.lane,I=I.next;while(I!==h)}else U===null&&(I.shared.lanes=0);xf|=$,u.lanes=$,u.memoizedState=nt}}function Nu(u,h,_){if(u=h.effects,h.effects=null,u!==null)for(h=0;h_?_:4,u(!0);var A=gc.transition;gc.transition={};try{u(!1),h()}finally{Pn=_,gc.transition=A}}function So(){return gs().memoizedState}function Xp(u,h,_){var A=ju(u);if(_={lane:A,action:_,hasEagerState:!1,eagerState:null,next:null},vf(u))qp(h,_);else if(_=uf(u,h,_,A),_!==null){var I=xs();To(_,u,A,I),Kp(_,h,A)}}function vc(u,h,_){var A=ju(u),I={lane:A,action:_,hasEagerState:!1,eagerState:null,next:null};if(vf(u))qp(h,I);else{var U=u.alternate;if(u.lanes===0&&(U===null||U.lanes===0)&&(U=h.lastRenderedReducer,U!==null))try{var $=h.lastRenderedState,oe=U($,_);if(I.hasEagerState=!0,I.eagerState=oe,ds(oe,$)){var me=h.interleaved;me===null?(I.next=I,zv(h)):(I.next=me.next,me.next=I),h.interleaved=I;return}}catch{}finally{}_=uf(u,h,I,A),_!==null&&(I=xs(),To(_,u,A,I),Kp(_,h,A))}}function vf(u){var h=u.alternate;return u===Xn||h!==null&&h===Xn}function qp(u,h){fi=ca=!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=_,uu(u,_)}}var Yp={readContext:ps,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},Hx={readContext:ps,useCallback:function(u,h){return Qr().memoizedState=[u,h===void 0?null:h],u},useContext:ps,useEffect:ki,useImperativeHandle:function(u,h,_){return _=_!=null?_.concat([u]):null,La(4194308,4,zx.bind(null,h,u),_)},useLayoutEffect:function(u,h){return La(4194308,4,u,h)},useInsertionEffect:function(u,h){return La(4,2,u,h)},useMemo:function(u,h){var _=Qr();return h=h===void 0?null:h,u=u(),_.memoizedState=[u,h],u},useReducer:function(u,h,_){var A=Qr();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,Xn,u),[A.memoizedState,u]},useRef:function(u){var h=Qr();return u={current:u},h.memoizedState=u},useState:Wv,useDebugValue:Wp,useDeferredValue:function(u){return Qr().memoizedState=u},useTransition:function(){var u=Wv(!1),h=u[0];return u=TM.bind(null,u[1]),Qr().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,_){var A=Xn,I=Qr();if(Kn){if(_===void 0)throw Error(n(407));_=_()}else{if(_=h(),hi===null)throw Error(n(349));(_o&30)!==0||Gp(A,h,_)}I.memoizedState=_;var U={value:_,getSnapshot:h};return I.queue=U,ki(Dx.bind(null,A,U,u),[u]),A.flags|=2048,ua(9,mf.bind(null,A,U,_,h),void 0,null),_},useId:function(){var u=Qr(),h=hi.identifierPrefix;if(Kn){var _=Fs,A=ut;_=(A&~(1<<32-mt(A)-1)).toString(32)+_,h=":"+h+"R"+_,_=cl++,0<_&&(h+="H"+_.toString(32)),h+=":"}else _=Yi++,h=":"+h+"r"+_.toString(32)+":";return u.memoizedState=h},unstable_isNewReconciler:!1},Vx={readContext:ps,useCallback:Bx,useContext:ps,useEffect:$v,useImperativeHandle:qv,useInsertionEffect:Xv,useLayoutEffect:Fx,useMemo:vs,useReducer:pf,useRef:jx,useState:function(){return pf(Ou)},useDebugValue:Wp,useDeferredValue:function(u){var h=gs();return $p(h,ur.memoizedState,u)},useTransition:function(){var u=pf(Ou)[0],h=gs().memoizedState;return[u,h]},useMutableSource:Hv,useSyncExternalStore:Vv,useId:So,unstable_isNewReconciler:!1},Gx={readContext:ps,useCallback:Bx,useContext:ps,useEffect:$v,useImperativeHandle:qv,useInsertionEffect:Xv,useLayoutEffect:Fx,useMemo:vs,useReducer:wo,useRef:jx,useState:function(){return wo(Ou)},useDebugValue:Wp,useDeferredValue:function(u){var h=gs();return ur===null?h.memoizedState=u:$p(h,ur.memoizedState,u)},useTransition:function(){var u=wo(Ou)[0],h=gs().memoizedState;return[u,h]},useMutableSource:Hv,useSyncExternalStore:Vv,useId:So,unstable_isNewReconciler:!1};function Bs(u,h){if(u&&u.defaultProps){h=Y({},h),u=u.defaultProps;for(var _ in u)h[_]===void 0&&(h[_]=u[_]);return h}return h}function yf(u,h,_,A){h=u.memoizedState,_=_(A,h),_=_==null?h:Y({},h,_),u.memoizedState=_,u.lanes===0&&(u.updateQueue.baseState=_)}var Zp={isMounted:function(u){return(u=u._reactInternals)?Ta(u)===u:!1},enqueueSetState:function(u,h,_){u=u._reactInternals;var A=xs(),I=ju(u),U=zn(A,I);U.payload=h,_!=null&&(U.callback=_),h=Jn(u,U,I),h!==null&&(To(h,u,I,A),di(h,u,I))},enqueueReplaceState:function(u,h,_){u=u._reactInternals;var A=xs(),I=ju(u),U=zn(A,I);U.tag=1,U.payload=h,_!=null&&(U.callback=_),h=Jn(u,U,I),h!==null&&(To(h,u,I,A),di(h,u,I))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var _=xs(),A=ju(u),I=zn(_,A);I.tag=2,h!=null&&(I.callback=h),h=Jn(u,I,A),h!==null&&(To(h,u,A,_),di(h,u,A))}};function Wx(u,h,_,A,I,U,$){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(A,U,$):h.prototype&&h.prototype.isPureReactComponent?!Ql(_,A)||!Ql(I,U):!0}function m(u,h,_){var A=!1,I=po,U=h.contextType;return typeof U=="object"&&U!==null?U=ps(U):(I=ui(h)?mo:Kr.current,A=h.contextTypes,U=(A=A!=null)?ic(u,I):po),h=new h(_,U),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=U),h}function g(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={},on(u);var U=h.contextType;typeof U=="object"&&U!==null?I.context=ps(U):(U=ui(h)?mo:Kr.current,I.context=ic(u,U)),I.state=u.memoizedState,U=h.getDerivedStateFromProps,typeof U=="function"&&(yf(u,h,U,_),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),cr(u,_,I,A),I.state=u.memoizedState),typeof I.componentDidMount=="function"&&(u.flags|=4194308)}function C(u,h){try{var _="",A=h;do _+=ce(A),A=A.return;while(A);var I=_}catch(U){I=` Error generating stack: `+U.message+` -`+U.stack}return{value:u,source:h,stack:I,digest:null}}function L(u,h,_){return{value:u,source:null,stack:_??null,digest:h??null}}function F(u,h){try{console.error(h.value)}catch(_){setTimeout(function(){throw _})}}var re=typeof WeakMap=="function"?WeakMap:Map;function ye(u,h,_){_=zn(-1,_),_.tag=3,_.payload={element:null};var A=h.value;return _.callback=function(){Qx||(Qx=!0,UM=A),F(u,h)},_}function je(u,h,_){_=zn(-1,_),_.tag=3;var A=u.type.getDerivedStateFromError;if(typeof A=="function"){var I=h.value;_.payload=function(){return A(I)},_.callback=function(){F(u,h)}}var U=u.stateNode;return U!==null&&typeof U.componentDidCatch=="function"&&(_.callback=function(){F(u,h),typeof A!="function"&&(Du===null?Du=new Set([this]):Du.add(this));var $=h.stack;this.componentDidCatch(h.value,{componentStack:$!==null?$:""})}),_}function st(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=hW.bind(null,u,h,_),h.then(u,u))}function St(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 rn(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=zn(-1,1),h.tag=2,Jn(_,h,1))),_.lanes|=1),u):(u.flags|=65536,u.lanes=I,u)}var zt=P.ReactCurrentOwner,ln=!1;function xt(u,h,_,A){h.child=u===null?of(h,null,_,A):lc(h,u.child,_,A)}function Jr(u,h,_,A,I){_=_.render;var U=h.ref;return ol(h,I),A=hf(u,h,_,A,U,I),_=Bv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,yc(u,h,I)):(Kn&&_&&Ov(h),h.flags|=1,xt(u,h,A,I),h.child)}function ys(u,h,_,A,I){if(u===null){var U=_.type;return typeof U=="function"&&!GM(U)&&U.defaultProps===void 0&&_.compare===null&&_.defaultProps===void 0?(h.tag=15,h.type=U,Ne(u,h,U,A,I)):(u=ib(_.type,null,A,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(U=u.child,(u.lanes&I)===0){var $=U.memoizedProps;if(_=_.compare,_=_!==null?_:Ql,_($,A)&&u.ref===h.ref)return yc(u,h,I)}return h.flags|=1,u=zu(U,A),u.ref=h.ref,u.return=h,h.child=u}function Ne(u,h,_,A,I){if(u!==null){var U=u.memoizedProps;if(Ql(U,A)&&u.ref===h.ref)if(ln=!1,h.pendingProps=A=U,(u.lanes&I)!==0)(u.flags&131072)!==0&&(ln=!0);else return h.lanes=u.lanes,yc(u,h,I)}return gt(u,h,_,A,I)}function _e(u,h,_){var A=h.pendingProps,I=A.children,U=u!==null?u.memoizedState:null;if(A.mode==="hidden")if((h.mode&1)===0)h.memoizedState={baseLanes:0,cachePool:null,transitions:null},Gn(Jp,da),da|=_;else{if((_&1073741824)===0)return u=U!==null?U.baseLanes|_:_,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:u,cachePool:null,transitions:null},h.updateQueue=null,Gn(Jp,da),da|=u,null;h.memoizedState={baseLanes:0,cachePool:null,transitions:null},A=U!==null?U.baseLanes:_,Gn(Jp,da),da|=A}else U!==null?(A=U.baseLanes|_,h.memoizedState=null):A=_,Gn(Jp,da),da|=A;return xt(u,h,I,_),h.child}function De(u,h){var _=h.ref;(u===null&&_!==null||u!==null&&u.ref!==_)&&(h.flags|=512,h.flags|=2097152)}function gt(u,h,_,A,I){var U=ui(_)?mo:Kr.current;return U=ic(h,U),ol(h,I),_=hf(u,h,_,A,U,I),A=Bv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,yc(u,h,I)):(Kn&&A&&Ov(h),h.flags|=1,xt(u,h,_,I),h.child)}function Ot(u,h,_,A,I){if(ui(_)){var U=!0;sc(h)}else U=!1;if(ol(h,I),h.stateNode===null)Xx(u,h),m(h,_,A),E(h,_,A,I),A=!0;else if(u===null){var $=h.stateNode,oe=h.memoizedProps;$.props=oe;var me=$.context,Oe=_.contextType;typeof Oe=="object"&&Oe!==null?Oe=ps(Oe):(Oe=ui(_)?mo:Kr.current,Oe=ic(h,Oe));var et=_.getDerivedStateFromProps,nt=typeof et=="function"||typeof $.getSnapshotBeforeUpdate=="function";nt||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(oe!==A||me!==Oe)&&g(h,$,A,Oe),Fn=!1;var Qe=h.memoizedState;$.state=Qe,cr(h,A,$,I),me=h.memoizedState,oe!==A||Qe!==me||Ri.current||Fn?(typeof et=="function"&&(yf(h,_,et,A),me=h.memoizedState),(oe=Fn||Wx(h,_,oe,A,Qe,me,Oe))?(nt||typeof $.UNSAFE_componentWillMount!="function"&&typeof $.componentWillMount!="function"||(typeof $.componentWillMount=="function"&&$.componentWillMount(),typeof $.UNSAFE_componentWillMount=="function"&&$.UNSAFE_componentWillMount()),typeof $.componentDidMount=="function"&&(h.flags|=4194308)):(typeof $.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=A,h.memoizedState=me),$.props=A,$.state=me,$.context=Oe,A=oe):(typeof $.componentDidMount=="function"&&(h.flags|=4194308),A=!1)}else{$=h.stateNode,gr(u,h),oe=h.memoizedProps,Oe=h.type===h.elementType?oe:Bs(h.type,oe),$.props=Oe,nt=h.pendingProps,Qe=$.context,me=_.contextType,typeof me=="object"&&me!==null?me=ps(me):(me=ui(_)?mo:Kr.current,me=ic(h,me));var _t=_.getDerivedStateFromProps;(et=typeof _t=="function"||typeof $.getSnapshotBeforeUpdate=="function")||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(oe!==nt||Qe!==me)&&g(h,$,A,me),Fn=!1,Qe=h.memoizedState,$.state=Qe,cr(h,A,$,I);var Pt=h.memoizedState;oe!==nt||Qe!==Pt||Ri.current||Fn?(typeof _t=="function"&&(yf(h,_,_t,A),Pt=h.memoizedState),(Oe=Fn||Wx(h,_,Oe,A,Qe,Pt,me)||!1)?(et||typeof $.UNSAFE_componentWillUpdate!="function"&&typeof $.componentWillUpdate!="function"||(typeof $.componentWillUpdate=="function"&&$.componentWillUpdate(A,Pt,me),typeof $.UNSAFE_componentWillUpdate=="function"&&$.UNSAFE_componentWillUpdate(A,Pt,me)),typeof $.componentDidUpdate=="function"&&(h.flags|=4),typeof $.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof $.componentDidUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=1024),h.memoizedProps=A,h.memoizedState=Pt),$.props=A,$.state=Pt,$.context=me,A=Oe):(typeof $.componentDidUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=1024),A=!1)}return an(u,h,_,A,U,I)}function an(u,h,_,A,I,U){De(u,h);var $=(h.flags&128)!==0;if(!A&&!$)return I&&Iv(h,_,!1),yc(u,h,U);A=h.stateNode,zt.current=h;var oe=$&&typeof _.getDerivedStateFromError!="function"?null:A.render();return h.flags|=1,u!==null&&$?(h.child=lc(h,u.child,null,U),h.child=lc(h,null,oe,U)):xt(u,h,oe,U),h.memoizedState=A.state,I&&Iv(h,_,!0),h.child}function sn(u){var h=u.stateNode;h.pendingContext?Nv(u,h.pendingContext,h.pendingContext!==h.context):h.context&&Nv(u,h.context,!1),df(u,h.containerInfo)}function En(u,h,_,A,I){return al(),Cu(I),h.flags|=256,xt(u,h,_,A),h.child}var _r={dehydrated:null,treeContext:null,retryLane:0};function bn(u){return{baseLanes:u,cachePool:null,transitions:null}}function Mo(u,h,_){var A=h.pendingProps,I=Yn.current,U=!1,$=(h.flags&128)!==0,oe;if((oe=$)||(oe=u!==null&&u.memoizedState===null?!1:(I&2)!==0),oe?(U=!0,h.flags&=-129):(u===null||u.memoizedState!==null)&&(I|=1),Gn(Yn,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):($=A.children,u=A.fallback,U?(A=h.mode,U=h.child,$={mode:"hidden",children:$},(A&1)===0&&U!==null?(U.childLanes=0,U.pendingProps=$):U=sb($,A,0,null),u=Sf(u,A,_,null),U.return=h,u.return=h,U.sibling=u,h.child=U,h.child.memoizedState=bn(_),h.memoizedState=_r,u):Kv(h,$));if(I=u.memoizedState,I!==null&&(oe=I.dehydrated,oe!==null))return tW(u,h,$,A,oe,I,_);if(U){U=A.fallback,$=h.mode,I=u.child,oe=I.sibling;var me={mode:"hidden",children:A.children};return($&1)===0&&h.child!==I?(A=h.child,A.childLanes=0,A.pendingProps=me,h.deletions=null):(A=zu(I,me),A.subtreeFlags=I.subtreeFlags&14680064),oe!==null?U=zu(oe,U):(U=Sf(U,$,_,null),U.flags|=2),U.return=h,A.return=h,A.sibling=U,h.child=A,A=U,U=h.child,$=u.child.memoizedState,$=$===null?bn(_):{baseLanes:$.baseLanes|_,cachePool:null,transitions:$.transitions},U.memoizedState=$,U.childLanes=u.childLanes&~_,h.memoizedState=_r,A}return U=u.child,u=U.sibling,A=zu(U,{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=sb({mode:"visible",children:h},u.mode,0,null),h.return=u,u.child=h}function $x(u,h,_,A){return A!==null&&Cu(A),lc(h,u.child,null,_),u=Kv(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function tW(u,h,_,A,I,U,$){if(_)return h.flags&256?(h.flags&=-257,A=L(Error(n(422))),$x(u,h,$,A)):h.memoizedState!==null?(h.child=u.child,h.flags|=128,null):(U=A.fallback,I=h.mode,A=sb({mode:"visible",children:A.children},I,0,null),U=Sf(U,I,$,null),U.flags|=2,A.return=h,U.return=h,A.sibling=U,h.child=A,(h.mode&1)!==0&&lc(h,u.child,null,$),h.child.memoizedState=bn($),h.memoizedState=_r,U);if((h.mode&1)===0)return $x(u,h,$,null);if(I.data==="$!"){if(A=I.nextSibling&&I.nextSibling.dataset,A)var oe=A.dgst;return A=oe,U=Error(n(419)),A=L(U,A,void 0),$x(u,h,$,A)}if(oe=($&u.childLanes)!==0,ln||oe){if(A=hi,A!==null){switch($&-$){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|$))!==0?0:I,I!==0&&I!==U.retryLane&&(U.retryLane=I,oa(u,I),To(A,u,I,-1))}return VM(),A=L(Error(n(421))),$x(u,h,$,A)}return I.data==="$?"?(h.flags|=128,h.child=u.child,h=pW.bind(null,u),I._reactRetry=h,null):(u=U.treeContext,Ii=fo(I.nextSibling),Yr=h,Kn=!0,zs=null,u!==null&&(Ni[zr++]=ut,Ni[zr++]=Fs,Ni[zr++]=oc,ut=u.id,Fs=u.overflow,oc=h),h=Kv(h,A.children),h.flags|=4096,h)}function cN(u,h,_){u.lanes|=h;var A=u.alternate;A!==null&&(A.lanes|=h),cf(u.return,h,_)}function PM(u,h,_,A,I){var U=u.memoizedState;U===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:A,tail:_,tailMode:I}:(U.isBackwards=h,U.rendering=null,U.renderingStartTime=0,U.last=A,U.tail=_,U.tailMode=I)}function uN(u,h,_){var A=h.pendingProps,I=A.revealOrder,U=A.tail;if(xt(u,h,A.children,_),A=Yn.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&&cN(u,_,h);else if(u.tag===19)cN(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(Gn(Yn,A),(h.mode&1)===0)h.memoizedState=null;else switch(I){case"forwards":for(_=h.child,I=null;_!==null;)u=_.alternate,u!==null&&la(u)===null&&(I=_),_=_.sibling;_=I,_===null?(I=h.child,h.child=null):(I=_.sibling,_.sibling=null),PM(h,!1,I,_,U);break;case"backwards":for(_=null,I=h.child,h.child=null;I!==null;){if(u=I.alternate,u!==null&&la(u)===null){h.child=I;break}u=I.sibling,I.sibling=_,_=I,I=u}PM(h,!0,_,null,U);break;case"together":PM(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function Xx(u,h){(h.mode&1)===0&&u!==null&&(u.alternate=null,h.alternate=null,h.flags|=2)}function yc(u,h,_){if(u!==null&&(h.dependencies=u.dependencies),xf|=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,_=zu(u,u.pendingProps),h.child=_,_.return=h;u.sibling!==null;)u=u.sibling,_=_.sibling=zu(u,u.pendingProps),_.return=h;_.sibling=null}return h.child}function nW(u,h,_){switch(h.tag){case 3:sn(h),al();break;case 5:pc(h);break;case 1:ui(h.type)&&sc(h);break;case 4:df(h,h.stateNode.containerInfo);break;case 10:var A=h.type._context,I=h.memoizedProps.value;Gn(cc,A._currentValue),A._currentValue=I;break;case 13:if(A=h.memoizedState,A!==null)return A.dehydrated!==null?(Gn(Yn,Yn.current&1),h.flags|=128,null):(_&h.child.childLanes)!==0?Mo(u,h,_):(Gn(Yn,Yn.current&1),u=yc(u,h,_),u!==null?u.sibling:null);Gn(Yn,Yn.current&1);break;case 19:if(A=(_&h.childLanes)!==0,(u.flags&128)!==0){if(A)return uN(u,h,_);h.flags|=128}if(I=h.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),Gn(Yn,Yn.current),A)break;return null;case 22:case 23:return h.lanes=0,_e(u,h,_)}return yc(u,h,_)}var dN,CM,fN,hN;dN=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}},CM=function(){},fN=function(u,h,_,A){var I=u.memoizedProps;if(I!==A){u=h.stateNode,br(ms.current);var U=null;switch(_){case"input":I=Ve(u,I),A=Ve(u,A),U=[];break;case"select":I=Y({},I,{value:void 0}),A=Y({},A,{value:void 0}),U=[];break;case"textarea":I=be(u,I),A=be(u,A),U=[];break;default:typeof I.onClick!="function"&&typeof A.onClick=="function"&&(u.onclick=Jd)}fe(_,A);var $;_=null;for(Oe in I)if(!A.hasOwnProperty(Oe)&&I.hasOwnProperty(Oe)&&I[Oe]!=null)if(Oe==="style"){var oe=I[Oe];for($ in oe)oe.hasOwnProperty($)&&(_||(_={}),_[$]="")}else Oe!=="dangerouslySetInnerHTML"&&Oe!=="children"&&Oe!=="suppressContentEditableWarning"&&Oe!=="suppressHydrationWarning"&&Oe!=="autoFocus"&&(i.hasOwnProperty(Oe)?U||(U=[]):(U=U||[]).push(Oe,null));for(Oe in A){var me=A[Oe];if(oe=I!=null?I[Oe]:void 0,A.hasOwnProperty(Oe)&&me!==oe&&(me!=null||oe!=null))if(Oe==="style")if(oe){for($ in oe)!oe.hasOwnProperty($)||me&&me.hasOwnProperty($)||(_||(_={}),_[$]="");for($ in me)me.hasOwnProperty($)&&oe[$]!==me[$]&&(_||(_={}),_[$]=me[$])}else _||(U||(U=[]),U.push(Oe,_)),_=me;else Oe==="dangerouslySetInnerHTML"?(me=me?me.__html:void 0,oe=oe?oe.__html:void 0,me!=null&&oe!==me&&(U=U||[]).push(Oe,me)):Oe==="children"?typeof me!="string"&&typeof me!="number"||(U=U||[]).push(Oe,""+me):Oe!=="suppressContentEditableWarning"&&Oe!=="suppressHydrationWarning"&&(i.hasOwnProperty(Oe)?(me!=null&&Oe==="onScroll"&&Wn("scroll",u),U||oe===me||(U=[])):(U=U||[]).push(Oe,me))}_&&(U=U||[]).push("style",_);var Oe=U;(h.updateQueue=Oe)&&(h.flags|=4)}},hN=function(u,h,_,A){_!==A&&(h.flags|=4)};function Yv(u,h){if(!Kn)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 Zi(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 rW(u,h,_){var A=h.pendingProps;switch(vo(h),h.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zi(h),null;case 1:return ui(h.type)&&ef(),Zi(h),null;case 3:return A=h.stateNode,ll(),$n(Ri),$n(Kr),Oa(),A.pendingContext&&(A.context=A.pendingContext,A.pendingContext=null),(u===null||u.child===null)&&(Pu(h)?h.flags|=4:u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,zs!==null&&(zM(zs),zs=null))),CM(u,h),Zi(h),null;case 5:Iu(h);var I=br(bo.current);if(_=h.type,u!==null&&h.stateNode!=null)fN(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 Zi(h),null}if(u=br(ms.current),Pu(h)){A=h.stateNode,_=h.type;var U=h.memoizedProps;switch(A[Ir]=h,A[Tu]=U,u=(h.mode&1)!==0,_){case"dialog":Wn("cancel",A),Wn("close",A);break;case"iframe":case"object":case"embed":Wn("load",A);break;case"video":case"audio":for(I=0;I<\/script>",u=u.removeChild(u.firstChild)):typeof A.is=="string"?u=$.createElement(_,{is:A.is}):(u=$.createElement(_),_==="select"&&($=u,A.multiple?$.multiple=!0:A.size&&($.size=A.size))):u=$.createElementNS(u,_),u[Ir]=h,u[Tu]=A,dN(u,h,!1,!1),h.stateNode=u;e:{switch($=Xe(_,A),_){case"dialog":Wn("cancel",u),Wn("close",u),I=A;break;case"iframe":case"object":case"embed":Wn("load",u),I=A;break;case"video":case"audio":for(I=0;Iem&&(h.flags|=128,A=!0,Yv(U,!1),h.lanes=4194304)}else{if(!A)if(u=la($),u!==null){if(h.flags|=128,A=!0,_=u.updateQueue,_!==null&&(h.updateQueue=_,h.flags|=4),Yv(U,!0),U.tail===null&&U.tailMode==="hidden"&&!$.alternate&&!Kn)return Zi(h),null}else 2*lt()-U.renderingStartTime>em&&_!==1073741824&&(h.flags|=128,A=!0,Yv(U,!1),h.lanes=4194304);U.isBackwards?($.sibling=h.child,h.child=$):(_=U.last,_!==null?_.sibling=$:h.child=$,U.last=$)}return U.tail!==null?(h=U.tail,U.rendering=h,U.tail=h.sibling,U.renderingStartTime=lt(),h.sibling=null,_=Yn.current,Gn(Yn,A?_&1|2:_&1),h):(Zi(h),null);case 22:case 23:return HM(),A=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==A&&(h.flags|=8192),A&&(h.mode&1)!==0?(da&1073741824)!==0&&(Zi(h),h.subtreeFlags&6&&(h.flags|=8192)):Zi(h),null;case 24:return null;case 25:return null}throw Error(n(156,h.tag))}function iW(u,h){switch(vo(h),h.tag){case 1:return ui(h.type)&&ef(),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return ll(),$n(Ri),$n(Kr),Oa(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 5:return Iu(h),null;case 13:if($n(Yn),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(n(340));al()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return $n(Yn),null;case 4:return ll(),null;case 10:return lf(h.type._context),null;case 22:case 23:return HM(),null;case 24:return null;default:return null}}var qx=!1,Qi=!1,sW=typeof WeakSet=="function"?WeakSet:Set,At=null;function Qp(u,h){var _=u.ref;if(_!==null)if(typeof _=="function")try{_(null)}catch(A){wr(u,h,A)}else _.current=null}function RM(u,h,_){try{_()}catch(A){wr(u,h,A)}}var pN=!1;function aW(u,h){if(Au=ks,u=rr(),Dr(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,U=A.focusNode;A=A.focusOffset;try{_.nodeType,U.nodeType}catch{_=null;break e}var $=0,oe=-1,me=-1,Oe=0,et=0,nt=u,Qe=null;t:for(;;){for(var _t;nt!==_||I!==0&&nt.nodeType!==3||(oe=$+I),nt!==U||A!==0&&nt.nodeType!==3||(me=$+A),nt.nodeType===3&&($+=nt.nodeValue.length),(_t=nt.firstChild)!==null;)Qe=nt,nt=_t;for(;;){if(nt===u)break t;if(Qe===_&&++Oe===I&&(oe=$),Qe===U&&++et===A&&(me=$),(_t=nt.nextSibling)!==null)break;nt=Qe,Qe=nt.parentNode}nt=_t}_=oe===-1||me===-1?null:{start:oe,end:me}}else _=null}_=_||{start:0,end:0}}else _=null;for(Ev={focusedElem:u,selectionRange:_},ks=!1,At=h;At!==null;)if(h=At,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,At=u;else for(;At!==null;){h=At;try{var Pt=h.alternate;if((h.flags&1024)!==0)switch(h.tag){case 0:case 11:case 15:break;case 1:if(Pt!==null){var Nt=Pt.memoizedProps,kr=Pt.memoizedState,Ae=h.stateNode,ve=Ae.getSnapshotBeforeUpdate(h.elementType===h.type?Nt:Bs(h.type,Nt),kr);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(ot){wr(h,h.return,ot)}if(u=h.sibling,u!==null){u.return=h.return,At=u;break}At=h.return}return Pt=pN,pN=!1,Pt}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 U=I.destroy;I.destroy=void 0,U!==void 0&&RM(h,_,U)}I=I.next}while(I!==A)}}function Kx(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 NM(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 mN(u){var h=u.alternate;h!==null&&(u.alternate=null,mN(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&(delete h[Ir],delete h[Tu],delete h[rc],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 gN(u){return u.tag===5||u.tag===3||u.tag===4}function vN(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||gN(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 IM(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=Jd));else if(A!==4&&(u=u.child,u!==null))for(IM(u,h,_),u=u.sibling;u!==null;)IM(u,h,_),u=u.sibling}function kM(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(kM(u,h,_),u=u.sibling;u!==null;)kM(u,h,_),u=u.sibling}var Oi=null,Eo=!1;function Lu(u,h,_){for(_=_.child;_!==null;)yN(u,h,_),_=_.sibling}function yN(u,h,_){if(Kt&&typeof Kt.onCommitFiberUnmount=="function")try{Kt.onCommitFiberUnmount(yn,_)}catch{}switch(_.tag){case 5:Qi||Qp(_,h);case 6:var A=Oi,I=Eo;Oi=null,Lu(u,h,_),Oi=A,Eo=I,Oi!==null&&(Eo?(u=Oi,_=_.stateNode,u.nodeType===8?u.parentNode.removeChild(_):u.removeChild(_)):Oi.removeChild(_.stateNode));break;case 18:Oi!==null&&(Eo?(u=Oi,_=_.stateNode,u.nodeType===8?Op(u.parentNode,_):u.nodeType===1&&Op(u,_),Bd(u)):Op(Oi,_.stateNode));break;case 4:A=Oi,I=Eo,Oi=_.stateNode.containerInfo,Eo=!0,Lu(u,h,_),Oi=A,Eo=I;break;case 0:case 11:case 14:case 15:if(!Qi&&(A=_.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){I=A=A.next;do{var U=I,$=U.destroy;U=U.tag,$!==void 0&&((U&2)!==0||(U&4)!==0)&&RM(_,h,$),I=I.next}while(I!==A)}Lu(u,h,_);break;case 1:if(!Qi&&(Qp(_,h),A=_.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=_.memoizedProps,A.state=_.memoizedState,A.componentWillUnmount()}catch(oe){wr(_,h,oe)}Lu(u,h,_);break;case 21:Lu(u,h,_);break;case 22:_.mode&1?(Qi=(A=Qi)||_.memoizedState!==null,Lu(u,h,_),Qi=A):Lu(u,h,_);break;default:Lu(u,h,_)}}function xN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var _=u.stateNode;_===null&&(_=u.stateNode=new sW),h.forEach(function(A){var I=mW.bind(null,u,A);_.has(A)||(_.add(A),A.then(I,I))})}}function Ao(u,h){var _=h.deletions;if(_!==null)for(var A=0;A<_.length;A++){var I=_[A];try{var U=u,$=h,oe=$;e:for(;oe!==null;){switch(oe.tag){case 5:Oi=oe.stateNode,Eo=!1;break e;case 3:Oi=oe.stateNode.containerInfo,Eo=!0;break e;case 4:Oi=oe.stateNode.containerInfo,Eo=!0;break e}oe=oe.return}if(Oi===null)throw Error(n(160));yN(U,$,I),Oi=null,Eo=!1;var me=I.alternate;me!==null&&(me.return=null),I.return=null}catch(Oe){wr(I,h,Oe)}}if(h.subtreeFlags&12854)for(h=h.child;h!==null;)bN(h,u),h=h.sibling}function bN(u,h){var _=u.alternate,A=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:if(Ao(h,u),ul(u),A&4){try{Zv(3,u,u.return),Kx(3,u)}catch(Nt){wr(u,u.return,Nt)}try{Zv(5,u,u.return)}catch(Nt){wr(u,u.return,Nt)}}break;case 1:Ao(h,u),ul(u),A&512&&_!==null&&Qp(_,_.return);break;case 5:if(Ao(h,u),ul(u),A&512&&_!==null&&Qp(_,_.return),u.flags&32){var I=u.stateNode;try{Ke(I,"")}catch(Nt){wr(u,u.return,Nt)}}if(A&4&&(I=u.stateNode,I!=null)){var U=u.memoizedProps,$=_!==null?_.memoizedProps:U,oe=u.type,me=u.updateQueue;if(u.updateQueue=null,me!==null)try{oe==="input"&&U.type==="radio"&&U.name!=null&&ne(I,U),Xe(oe,$);var Oe=Xe(oe,U);for($=0;$I&&(I=$),A&=~U}if(A=I,A=lt()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*lW(A/1960))-A,10u?16:u,Uu===null)var A=!1;else{if(u=Uu,Uu=null,eb=0,(kn&6)!==0)throw Error(n(331));var I=kn;for(kn|=4,At=u.current;At!==null;){var U=At,$=U.child;if((At.flags&16)!==0){var oe=U.deletions;if(oe!==null){for(var me=0;melt()-DM?_f(u,0):LM|=_),Vs(u,h)}function IN(u,h){h===0&&((u.mode&1)===0?h=1:(h=In,In<<=1,(In&130023424)===0&&(In=4194304)));var _=xs();u=oa(u,h),u!==null&&(Zo(u,h,_),Vs(u,_))}function pW(u){var h=u.memoizedState,_=0;h!==null&&(_=h.retryLane),IN(u,_)}function mW(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),IN(u,_)}var kN;kN=function(u,h,_){if(u!==null)if(u.memoizedProps!==h.pendingProps||Ri.current)ln=!0;else{if((u.lanes&_)===0&&(h.flags&128)===0)return ln=!1,nW(u,h,_);ln=(u.flags&131072)!==0}else ln=!1,Kn&&(h.flags&1048576)!==0&&kv(h,zp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;Xx(u,h),u=h.pendingProps;var I=ic(h,Kr.current);ol(h,_),I=hf(null,h,A,u,I,_);var U=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,ui(A)?(U=!0,sc(h)):U=!1,h.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,on(h),I.updater=Zp,h.stateNode=I,I._reactInternals=h,E(h,A,u,_),h=an(null,h,A,!0,U,_)):(h.tag=0,Kn&&U&&Ov(h),xt(null,h,I,_),h=h.child),h;case 16:A=h.elementType;e:{switch(Xx(u,h),u=h.pendingProps,I=A._init,A=I(A._payload),h.type=A,I=h.tag=vW(A),u=Bs(A,u),I){case 0:h=gt(null,h,A,u,_);break e;case 1:h=Ot(null,h,A,u,_);break e;case 11:h=Jr(null,h,A,u,_);break e;case 14:h=ys(null,h,A,Bs(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:Bs(A,I),gt(u,h,A,I,_);case 1:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Ot(u,h,A,I,_);case 3:e:{if(sn(h),u===null)throw Error(n(387));A=h.pendingProps,U=h.memoizedState,I=U.element,gr(u,h),cr(h,A,null,_);var $=h.memoizedState;if(A=$.element,U.isDehydrated)if(U={element:A,isDehydrated:!1,cache:$.cache,pendingSuspenseBoundaries:$.pendingSuspenseBoundaries,transitions:$.transitions},h.updateQueue.baseState=U,h.memoizedState=U,h.flags&256){I=C(Error(n(423)),h),h=En(u,h,A,_,I);break e}else if(A!==I){I=C(Error(n(424)),h),h=En(u,h,A,_,I);break e}else for(Ii=fo(h.stateNode.containerInfo.firstChild),Yr=h,Kn=!0,zs=null,_=of(h,null,A,_),h.child=_;_;)_.flags=_.flags&-3|4096,_=_.sibling;else{if(al(),A===I){h=yc(u,h,_);break e}xt(u,h,A,_)}h=h.child}return h;case 5:return pc(h),u===null&&Hp(h),A=h.type,I=h.pendingProps,U=u!==null?u.memoizedProps:null,$=I.children,Av(A,I)?$=null:U!==null&&Av(A,U)&&(h.flags|=32),De(u,h),xt(u,h,$,_),h.child;case 6:return u===null&&Hp(h),null;case 13:return Mo(u,h,_);case 4:return df(h,h.stateNode.containerInfo),A=h.pendingProps,u===null?h.child=lc(h,null,A,_):xt(u,h,A,_),h.child;case 11:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Jr(u,h,A,I,_);case 7:return xt(u,h,h.pendingProps,_),h.child;case 8:return xt(u,h,h.pendingProps.children,_),h.child;case 12:return xt(u,h,h.pendingProps.children,_),h.child;case 10:e:{if(A=h.type._context,I=h.pendingProps,U=h.memoizedProps,$=I.value,Gn(cc,A._currentValue),A._currentValue=$,U!==null)if(ds(U.value,$)){if(U.children===I.children&&!Ri.current){h=yc(u,h,_);break e}}else for(U=h.child,U!==null&&(U.return=h);U!==null;){var oe=U.dependencies;if(oe!==null){$=U.child;for(var me=oe.firstContext;me!==null;){if(me.context===A){if(U.tag===1){me=zn(-1,_&-_),me.tag=2;var Oe=U.updateQueue;if(Oe!==null){Oe=Oe.shared;var et=Oe.pending;et===null?me.next=me:(me.next=et.next,et.next=me),Oe.pending=me}}U.lanes|=_,me=U.alternate,me!==null&&(me.lanes|=_),cf(U.return,_,h),oe.lanes|=_;break}me=me.next}}else if(U.tag===10)$=U.type===h.type?null:U.child;else if(U.tag===18){if($=U.return,$===null)throw Error(n(341));$.lanes|=_,oe=$.alternate,oe!==null&&(oe.lanes|=_),cf($,_,h),$=U.sibling}else $=U.child;if($!==null)$.return=U;else for($=U;$!==null;){if($===h){$=null;break}if(U=$.sibling,U!==null){U.return=$.return,$=U;break}$=$.return}U=$}xt(u,h,I.children,_),h=h.child}return h;case 9:return I=h.type,A=h.pendingProps.children,ol(h,_),I=ps(I),A=A(I),h.flags|=1,xt(u,h,A,_),h.child;case 14:return A=h.type,I=Bs(A,h.pendingProps),I=Bs(A.type,I),ys(u,h,A,I,_);case 15:return Ne(u,h,h.type,h.pendingProps,_);case 17:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Xx(u,h),h.tag=1,ui(A)?(u=!0,sc(h)):u=!1,ol(h,_),m(h,A,I),E(h,A,I,_),an(null,h,A,!0,u,_);case 19:return uN(u,h,_);case 22:return _e(u,h,_)}throw Error(n(156,h.tag))};function ON(u,h){return Ie(u,h)}function gW(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 Ua(u,h,_,A){return new gW(u,h,_,A)}function GM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function vW(u){if(typeof u=="function")return GM(u)?1:0;if(u!=null){if(u=u.$$typeof,u===X)return 11;if(u===pe)return 14}return 2}function zu(u,h){var _=u.alternate;return _===null?(_=Ua(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 ib(u,h,_,A,I,U){var $=2;if(A=u,typeof u=="function")GM(u)&&($=1);else if(typeof u=="string")$=5;else e:switch(u){case D:return Sf(_.children,I,U,h);case z:$=8,I|=8;break;case V:return u=Ua(12,_,h,I|2),u.elementType=V,u.lanes=U,u;case ee:return u=Ua(13,_,h,I),u.elementType=ee,u.lanes=U,u;case ie:return u=Ua(19,_,h,I),u.elementType=ie,u.lanes=U,u;case he:return sb(_,I,U,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:$=10;break e;case j:$=9;break e;case X:$=11;break e;case pe:$=14;break e;case ae:$=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=Ua($,_,h,I),h.elementType=u,h.type=A,h.lanes=U,h}function Sf(u,h,_,A){return u=Ua(7,u,A,h),u.lanes=_,u}function sb(u,h,_,A){return u=Ua(22,u,A,h),u.elementType=he,u.lanes=_,u.stateNode={isHidden:!1},u}function WM(u,h,_){return u=Ua(6,u,null,h),u.lanes=_,u}function $M(u,h,_){return h=Ua(4,u.children!==null?u.children:[],u.key,h),h.lanes=_,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function yW(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=Ud(0),this.expirationTimes=Ud(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ud(0),this.identifierPrefix=A,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function XM(u,h,_,A,I,U,$,oe,me){return u=new yW(u,h,_,oe,me),h===1?(h=1,U===!0&&(h|=8)):h=0,U=Ua(3,null,null,h),u.current=U,U.stateNode=u,U.memoizedState={element:A,isDehydrated:_,cache:null,transitions:null,pendingSuspenseBoundaries:null},on(U),u}function xW(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(),eE.exports=kW(),eE.exports}var KN;function OW(){if(KN)return hb;KN=1;var t=Xj();return hb.createRoot=t.createRoot,hb.hydrateRoot=t.hydrateRoot,hb}var LW=OW();const DW=V1(LW);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(){}},hh,ud,sg,Dj,UW=(Dj=class extends Gy{constructor(){super();Gt(this,hh);Gt(this,ud);Gt(this,sg);wt(this,sg,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ge(this,ud)||this.setEventListener(ge(this,sg))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,ud))==null||e.call(this),wt(this,ud,void 0))}setEventListener(e){var n;wt(this,sg,e),(n=ge(this,ud))==null||n.call(this),wt(this,ud,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ge(this,hh)!==e&&(wt(this,hh,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ge(this,hh)=="boolean"?ge(this,hh):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},hh=new WeakMap,ud=new WeakMap,sg=new WeakMap,Dj),gC=new UW,jW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},dd,mC,Uj,FW=(Uj=class{constructor(){Gt(this,dd,jW);Gt(this,mC,!1)}setTimeoutProvider(t){wt(this,dd,t)}setTimeout(t,e){return ge(this,dd).setTimeout(t,e)}clearTimeout(t){ge(this,dd).clearTimeout(t)}setInterval(t,e){return ge(this,dd).setInterval(t,e)}clearInterval(t){ge(this,dd).clearInterval(t)}},dd=new WeakMap,mC=new WeakMap,Uj),th=new FW;function zW(t){setTimeout(t,0)}var BW=typeof window>"u"||"Deno"in globalThis;function qs(){}function HW(t,e){return typeof t=="function"?t(e):t}function mT(t){return typeof t=="number"&&t>=0&&t!==1/0}function qj(t,e){return Math.max(t+(e||0)-Date.now(),0)}function xd(t,e){return typeof t=="function"?t(e):t}function ga(t,e){return typeof t=="function"?t(e):t}function YN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:o}=t;if(a){if(r){if(e.queryHash!==vC(a,e.options))return!1}else if(!ay(e.queryKey,a))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||i&&i!==e.state.fetchStatus||s&&!s(e))}function ZN(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(sy(e.options.mutationKey)!==sy(s))return!1}else if(!ay(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function vC(t,e){return((e==null?void 0:e.queryKeyHashFn)||sy)(t)}function sy(t){return JSON.stringify(t,(e,n)=>vT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ay(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>ay(t[n],e[n])):!1}var VW=Object.prototype.hasOwnProperty;function Kj(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=QN(t)&&QN(e);if(!r&&!(vT(t)&&vT(e)))return e;const s=(r?t:Object.keys(t)).length,a=r?e:Object.keys(e),o=a.length,l=r?new Array(o):{};let c=0;for(let d=0;d{th.setTimeout(e,t)})}function yT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Kj(t,e):e}function WW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function $W(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var yC=Symbol();function Yj(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===yC?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Zj(t,e){return typeof t=="function"?t(...e):!!t}function XW(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=()=>BW;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 qW=zW;function KW(){let t=[],e=0,n=o=>{o()},r=o=>{o()},i=qW;const s=o=>{e?t.push(o):i(()=>{n(o)})},a=()=>{const o=t;t=[],o.length&&i(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||a()}return l},batchCalls:o=>(...l)=>{s(()=>{o(...l)})},schedule:s,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{i=o}}}var zi=KW(),ag,fd,og,jj,YW=(jj=class extends Gy{constructor(){super();Gt(this,ag,!0);Gt(this,fd);Gt(this,og);wt(this,og,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,fd)||this.setEventListener(ge(this,og))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,fd))==null||e.call(this),wt(this,fd,void 0))}setEventListener(e){var n;wt(this,og,e),(n=ge(this,fd))==null||n.call(this),wt(this,fd,e(this.setOnline.bind(this)))}setOnline(e){ge(this,ag)!==e&&(wt(this,ag,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ge(this,ag)}},ag=new WeakMap,fd=new WeakMap,og=new WeakMap,jj),ew=new YW;function ZW(t){return Math.min(1e3*2**t,3e4)}function Qj(t){return(t??"online")==="online"?ew.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 Jj(t){let e=!1,n=0,r;const i=xT(),s=()=>i.status!=="pending",a=S=>{var w;if(!s()){const x=new bT(S);p(x),(w=t.onCancel)==null||w.call(t,x)}},o=()=>{e=!0},l=()=>{e=!1},c=()=>gC.isFocused()&&(t.networkMode==="always"||ew.isOnline())&&t.canRun(),d=()=>Qj(t.networkMode)&&t.canRun(),f=S=>{s()||(r==null||r(),i.resolve(S))},p=S=>{s()||(r==null||r(),i.reject(S))},y=()=>new Promise(S=>{var w;r=x=>{(s()||c())&&S(x)},(w=t.onPause)==null||w.call(t)}).then(()=>{var S;r=void 0,s()||(S=t.onContinue)==null||S.call(t)}),b=()=>{if(s())return;let S;const w=n===0?t.initialPromise:void 0;try{S=w??t.fn()}catch(x){S=Promise.reject(x)}Promise.resolve(S).then(f).catch(x=>{var N;if(s())return;const M=t.retry??(oy.isServer()?0:3),T=t.retryDelay??ZW,P=typeof T=="function"?T(n,x):T,O=M===!0||typeof M=="number"&&nc()?void 0:y()).then(()=>{e?p(x):b()})})};return{promise:i,status:()=>i.status,cancel:a,continue:()=>(r==null||r(),i),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?b():y().then(b),i)}}var ph,Fj,eF=(Fj=class{constructor(){Gt(this,ph)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mT(this.gcTime)&&wt(this,ph,th.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(oy.isServer()?1/0:300*1e3))}clearGcTimeout(){ge(this,ph)!==void 0&&(th.clearTimeout(ge(this,ph)),wt(this,ph,void 0))}},ph=new WeakMap,Fj);function QW(t){return{onFetch:(e,n)=>{var d,f,p,y,b;const r=e.options,i=(p=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],a=((b=e.state.data)==null?void 0:b.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let S=!1;const w=T=>{XW(T,()=>e.signal,()=>S=!0)},x=Yj(e.options,e.fetchOptions),M=async(T,P,O)=>{if(S)return Promise.reject(e.signal.reason);if(P==null&&T.pages.length)return Promise.resolve(T);const D=(()=>{const j={client:e.client,queryKey:e.queryKey,pageParam:P,direction:O?"backward":"forward",meta:e.options.meta};return w(j),j})(),z=await x(D),{maxPages:V}=e.options,k=O?$W:WW;return{pages:k(T.pages,z,V),pageParams:k(T.pageParams,P,V)}};if(i&&s.length){const T=i==="backward",P=T?JW:eI,O={pages:s,pageParams:a},N=P(r,O);o=await M(O,N,T)}else{const T=t??s.length;do{const P=l===0?a[0]??r.initialPageParam:eI(r,o);if(l>0&&P==null)break;o=await M(o,P),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 eI(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 JW(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 lg,mh,cg,Ha,gh,gi,Fy,vh,ma,tF,Tc,zj,e8=(zj=class extends eF{constructor(e){super();Gt(this,ma);Gt(this,lg);Gt(this,mh);Gt(this,cg);Gt(this,Ha);Gt(this,gh);Gt(this,gi);Gt(this,Fy);Gt(this,vh);wt(this,vh,!1),wt(this,Fy,e.defaultOptions),this.setOptions(e.options),this.observers=[],wt(this,gh,e.client),wt(this,Ha,ge(this,gh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,wt(this,mh,nI(this.options)),this.state=e.state??ge(this,mh),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return ge(this,lg)}get promise(){var e;return(e=ge(this,gi))==null?void 0:e.promise}setOptions(e){if(this.options={...ge(this,Fy),...e},e!=null&&e._type&&wt(this,lg,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=nI(this.options);n.data!==void 0&&(this.setState(tI(n.data,n.dataUpdatedAt)),wt(this,mh,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ge(this,Ha).remove(this)}setData(e,n){const r=yT(this.state.data,e,this.options);return _n(this,ma,Tc).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){_n(this,ma,Tc).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=ge(this,gi))==null?void 0:r.promise;return(i=ge(this,gi))==null||i.cancel(e),n?n.then(qs).catch(qs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return ge(this,mh)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>ga(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yC||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>xd(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:!qj(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,gi))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,gi))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ge(this,Ha).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,gi)&&(ge(this,vh)||_n(this,ma,tF).call(this)?ge(this,gi).cancel({revert:!0}):ge(this,gi).cancelRetry()),this.scheduleGc()),ge(this,Ha).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_n(this,ma,Tc).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,p,y,b,S,w,x,M,T;if(this.state.fetchStatus!=="idle"&&((c=ge(this,gi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ge(this,gi))return ge(this,gi).continueRetry(),ge(this,gi).promise}if(e&&this.setOptions(e),!this.options.queryFn){const P=this.observers.find(O=>O.options.queryFn);P&&this.setOptions(P.options)}const r=new AbortController,i=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(wt(this,vh,!0),r.signal)})},s=()=>{const P=Yj(this.options,n),N=(()=>{const D={client:ge(this,gh),queryKey:this.queryKey,meta:this.meta};return i(D),D})();return wt(this,vh,!1),this.options.persister?this.options.persister(P,N,this):P(N)},o=(()=>{const P={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ge(this,gh),state:this.state,fetchFn:s};return i(P),P})(),l=ge(this,lg)==="infinite"?QW(this.options.pages):this.options.behavior;l==null||l.onFetch(o,this),wt(this,cg,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&_n(this,ma,Tc).call(this,{type:"fetch",meta:(f=o.fetchOptions)==null?void 0:f.meta}),wt(this,gi,Jj({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:P=>{P instanceof bT&&P.revert&&this.setState({...ge(this,cg),fetchStatus:"idle"}),r.abort()},onFail:(P,O)=>{_n(this,ma,Tc).call(this,{type:"failed",failureCount:P,error:O})},onPause:()=>{_n(this,ma,Tc).call(this,{type:"pause"})},onContinue:()=>{_n(this,ma,Tc).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const P=await ge(this,gi).start();if(P===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(P),(y=(p=ge(this,Ha).config).onSuccess)==null||y.call(p,P,this),(S=(b=ge(this,Ha).config).onSettled)==null||S.call(b,P,this.state.error,this),P}catch(P){if(P instanceof bT){if(P.silent)return ge(this,gi).promise;if(P.revert){if(this.state.data===void 0)throw P;return this.state.data}}throw _n(this,ma,Tc).call(this,{type:"error",error:P}),(x=(w=ge(this,Ha).config).onError)==null||x.call(w,P,this),(T=(M=ge(this,Ha).config).onSettled)==null||T.call(M,this.state.data,P,this),P}finally{this.scheduleGc()}}},lg=new WeakMap,mh=new WeakMap,cg=new WeakMap,Ha=new WeakMap,gh=new WeakMap,gi=new WeakMap,Fy=new WeakMap,vh=new WeakMap,ma=new WeakSet,tF=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Tc=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,...nF(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...tI(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return wt(this,cg,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,Ha).notify({query:this,type:"updated",action:e})})},zj);function nF(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qj(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function tI(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function nI(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 Xs,An,zy,ws,yh,ug,Nc,hd,By,dg,fg,xh,bh,pd,hg,Bn,F0,_T,wT,ST,MT,ET,AT,TT,rF,Bj,t8=(Bj=class extends Gy{constructor(e,n){super();Gt(this,Bn);Gt(this,Xs);Gt(this,An);Gt(this,zy);Gt(this,ws);Gt(this,yh);Gt(this,ug);Gt(this,Nc);Gt(this,hd);Gt(this,By);Gt(this,dg);Gt(this,fg);Gt(this,xh);Gt(this,bh);Gt(this,pd);Gt(this,hg,new Set);this.options=n,wt(this,Xs,e),wt(this,hd,null),wt(this,Nc,xT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ge(this,An).addObserver(this),rI(ge(this,An),this.options)?_n(this,Bn,F0).call(this):this.updateResult(),_n(this,Bn,MT).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return PT(ge(this,An),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return PT(ge(this,An),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_n(this,Bn,ET).call(this),_n(this,Bn,AT).call(this),ge(this,An).removeObserver(this)}setOptions(e){const n=this.options,r=ge(this,An);if(this.options=ge(this,Xs).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ga(this.options.enabled,ge(this,An))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_n(this,Bn,TT).call(this),ge(this,An).setOptions(this.options),n._defaulted&&!gT(this.options,n)&&ge(this,Xs).getQueryCache().notify({type:"observerOptionsUpdated",query:ge(this,An),observer:this});const i=this.hasListeners();i&&iI(ge(this,An),r,this.options,n)&&_n(this,Bn,F0).call(this),this.updateResult(),i&&(ge(this,An)!==r||ga(this.options.enabled,ge(this,An))!==ga(n.enabled,ge(this,An))||xd(this.options.staleTime,ge(this,An))!==xd(n.staleTime,ge(this,An)))&&_n(this,Bn,_T).call(this);const s=_n(this,Bn,wT).call(this);i&&(ge(this,An)!==r||ga(this.options.enabled,ge(this,An))!==ga(n.enabled,ge(this,An))||s!==ge(this,pd))&&_n(this,Bn,ST).call(this,s)}getOptimisticResult(e){const n=ge(this,Xs).getQueryCache().build(ge(this,Xs),e),r=this.createResult(n,e);return r8(this,r)&&(wt(this,ws,r),wt(this,ug,this.options),wt(this,yh,ge(this,An).state)),r}getCurrentResult(){return ge(this,ws)}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,Nc).status==="pending"&&ge(this,Nc).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){ge(this,hg).add(e)}getCurrentQuery(){return ge(this,An)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=ge(this,Xs).defaultQueryOptions(e),r=ge(this,Xs).getQueryCache().build(ge(this,Xs),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return _n(this,Bn,F0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),ge(this,ws)))}createResult(e,n){var V;const r=ge(this,An),i=this.options,s=ge(this,ws),a=ge(this,yh),o=ge(this,ug),c=e!==r?e.state:ge(this,zy),{state:d}=e;let f={...d},p=!1,y;if(n._optimisticResults){const k=this.hasListeners(),j=!k&&rI(e,n),X=k&&iI(e,r,n,i);(j||X)&&(f={...f,...nF(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:S,status:w}=f;y=f.data;let x=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(k=s.data,x=!0):k=typeof n.placeholderData=="function"?n.placeholderData((V=ge(this,fg))==null?void 0:V.state.data,ge(this,fg)):n.placeholderData,k!==void 0&&(w="success",y=yT(s==null?void 0:s.data,k,n),p=!0)}if(n.select&&y!==void 0&&!x)if(s&&y===(a==null?void 0:a.data)&&n.select===ge(this,By))y=ge(this,dg);else try{wt(this,By,n.select),y=n.select(y),y=yT(s==null?void 0:s.data,y,n),wt(this,dg,y),wt(this,hd,null)}catch(k){wt(this,hd,k)}ge(this,hd)&&(b=ge(this,hd),y=ge(this,dg),S=Date.now(),w="error");const M=f.fetchStatus==="fetching",T=w==="pending",P=w==="error",O=T&&M,N=y!==void 0,z={status:w,fetchStatus:f.fetchStatus,isPending:T,isSuccess:w==="success",isError:P,isInitialLoading:O,isLoading:O,data:y,dataUpdatedAt:f.dataUpdatedAt,error:b,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:P&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:P&&N,isStale:xC(e,n),refetch:this.refetch,promise:ge(this,Nc),isEnabled:ga(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=z.data!==void 0,j=z.status==="error"&&!k,X=pe=>{j?pe.reject(z.error):k&&pe.resolve(z.data)},ee=()=>{const pe=wt(this,Nc,z.promise=xT());X(pe)},ie=ge(this,Nc);switch(ie.status){case"pending":e.queryHash===r.queryHash&&X(ie);break;case"fulfilled":(j||z.data!==ie.value)&&ee();break;case"rejected":(!j||z.error!==ie.reason)&&ee();break}}return z}updateResult(){const e=ge(this,ws),n=this.createResult(ge(this,An),this.options);if(wt(this,yh,ge(this,An).state),wt(this,ug,this.options),ge(this,yh).data!==void 0&&wt(this,fg,ge(this,An)),gT(n,e))return;wt(this,ws,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!ge(this,hg).size)return!0;const a=new Set(s??ge(this,hg));return this.options.throwOnError&&a.add("error"),Object.keys(ge(this,ws)).some(o=>{const l=o;return ge(this,ws)[l]!==e[l]&&a.has(l)})};_n(this,Bn,rF).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_n(this,Bn,MT).call(this)}},Xs=new WeakMap,An=new WeakMap,zy=new WeakMap,ws=new WeakMap,yh=new WeakMap,ug=new WeakMap,Nc=new WeakMap,hd=new WeakMap,By=new WeakMap,dg=new WeakMap,fg=new WeakMap,xh=new WeakMap,bh=new WeakMap,pd=new WeakMap,hg=new WeakMap,Bn=new WeakSet,F0=function(e){_n(this,Bn,TT).call(this);let n=ge(this,An).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(qs)),n},_T=function(){_n(this,Bn,ET).call(this);const e=xd(this.options.staleTime,ge(this,An));if(oy.isServer()||ge(this,ws).isStale||!mT(e))return;const r=qj(ge(this,ws).dataUpdatedAt,e)+1;wt(this,xh,th.setTimeout(()=>{ge(this,ws).isStale||this.updateResult()},r))},wT=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ge(this,An)):this.options.refetchInterval)??!1},ST=function(e){_n(this,Bn,AT).call(this),wt(this,pd,e),!(oy.isServer()||ga(this.options.enabled,ge(this,An))===!1||!mT(ge(this,pd))||ge(this,pd)===0)&&wt(this,bh,th.setInterval(()=>{(this.options.refetchIntervalInBackground||gC.isFocused())&&_n(this,Bn,F0).call(this)},ge(this,pd)))},MT=function(){_n(this,Bn,_T).call(this),_n(this,Bn,ST).call(this,_n(this,Bn,wT).call(this))},ET=function(){ge(this,xh)!==void 0&&(th.clearTimeout(ge(this,xh)),wt(this,xh,void 0))},AT=function(){ge(this,bh)!==void 0&&(th.clearInterval(ge(this,bh)),wt(this,bh,void 0))},TT=function(){const e=ge(this,Xs).getQueryCache().build(ge(this,Xs),this.options);if(e===ge(this,An))return;const n=ge(this,An);wt(this,An,e),wt(this,zy,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},rF=function(e){zi.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(ge(this,ws))}),ge(this,Xs).getQueryCache().notify({query:ge(this,An),type:"observerResultsUpdated"})})},Bj);function n8(t,e){return ga(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&ga(e.retryOnMount,t)===!1)}function rI(t,e){return n8(t,e)||t.state.data!==void 0&&PT(t,e,e.refetchOnMount)}function PT(t,e,n){if(ga(e.enabled,t)!==!1&&xd(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&xC(t,e)}return!1}function iI(t,e,n,r){return(t!==e||ga(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&xC(t,n)}function xC(t,e){return ga(e.enabled,t)!==!1&&t.isStaleByTime(xd(e.staleTime,t))}function r8(t,e){return!gT(t.getCurrentResult(),e)}var Hy,yl,ns,_h,xl,rd,Hj,i8=(Hj=class extends eF{constructor(e){super();Gt(this,xl);Gt(this,Hy);Gt(this,yl);Gt(this,ns);Gt(this,_h);wt(this,Hy,e.client),this.mutationId=e.mutationId,wt(this,ns,e.mutationCache),wt(this,yl,[]),this.state=e.state||s8(),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,ns).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){wt(this,yl,ge(this,yl).filter(n=>n!==e)),this.scheduleGc(),ge(this,ns).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ge(this,yl).length||(this.state.status==="pending"?this.scheduleGc():ge(this,ns).remove(this))}continue(){var e;return((e=ge(this,_h))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,l,c,d,f,p,y,b,S,w,x,M,T,P,O,N,D;const n=()=>{_n(this,xl,rd).call(this,{type:"continue"})},r={client:ge(this,Hy),meta:this.options.meta,mutationKey:this.options.mutationKey};wt(this,_h,Jj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(z,V)=>{_n(this,xl,rd).call(this,{type:"failed",failureCount:z,error:V})},onPause:()=>{_n(this,xl,rd).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ge(this,ns).canRun(this)}));const i=this.state.status==="pending",s=!ge(this,_h).canStart();try{if(i)n();else{_n(this,xl,rd).call(this,{type:"pending",variables:e,isPaused:s}),ge(this,ns).config.onMutate&&await ge(this,ns).config.onMutate(e,this,r);const V=await((o=(a=this.options).onMutate)==null?void 0:o.call(a,e,r));V!==this.state.context&&_n(this,xl,rd).call(this,{type:"pending",context:V,variables:e,isPaused:s})}const z=await ge(this,_h).start();return await((c=(l=ge(this,ns).config).onSuccess)==null?void 0:c.call(l,z,e,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,z,e,this.state.context,r)),await((y=(p=ge(this,ns).config).onSettled)==null?void 0:y.call(p,z,null,this.state.variables,this.state.context,this,r)),await((S=(b=this.options).onSettled)==null?void 0:S.call(b,z,null,e,this.state.context,r)),_n(this,xl,rd).call(this,{type:"success",data:z}),z}catch(z){try{await((x=(w=ge(this,ns).config).onError)==null?void 0:x.call(w,z,e,this.state.context,this,r))}catch(V){Promise.reject(V)}try{await((T=(M=this.options).onError)==null?void 0:T.call(M,z,e,this.state.context,r))}catch(V){Promise.reject(V)}try{await((O=(P=ge(this,ns).config).onSettled)==null?void 0:O.call(P,void 0,z,this.state.variables,this.state.context,this,r))}catch(V){Promise.reject(V)}try{await((D=(N=this.options).onSettled)==null?void 0:D.call(N,void 0,z,e,this.state.context,r))}catch(V){Promise.reject(V)}throw _n(this,xl,rd).call(this,{type:"error",error:z}),z}finally{ge(this,ns).runNext(this)}}},Hy=new WeakMap,yl=new WeakMap,ns=new WeakMap,_h=new WeakMap,xl=new WeakSet,rd=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,ns).notify({mutation:this,type:"updated",action:e})})},Hj);function s8(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ic,Lo,Vy,Vj,a8=(Vj=class extends Gy{constructor(e={}){super();Gt(this,Ic);Gt(this,Lo);Gt(this,Vy);this.config=e,wt(this,Ic,new Set),wt(this,Lo,new Map),wt(this,Vy,0)}build(e,n,r){const i=new i8({client:e,mutationCache:this,mutationId:++fb(this,Vy)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){ge(this,Ic).add(e);const n=pb(e);if(typeof n=="string"){const r=ge(this,Lo).get(n);r?r.push(e):ge(this,Lo).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ge(this,Ic).delete(e)){const n=pb(e);if(typeof n=="string"){const r=ge(this,Lo).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,Lo).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=pb(e);if(typeof n=="string"){const r=ge(this,Lo).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=pb(e);if(typeof n=="string"){const i=(r=ge(this,Lo).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,Ic).forEach(e=>{this.notify({type:"removed",mutation:e})}),ge(this,Ic).clear(),ge(this,Lo).clear()})}getAll(){return Array.from(ge(this,Ic))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>ZN(n,r))}findAll(e={}){return this.getAll().filter(n=>ZN(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(qs))))}},Ic=new WeakMap,Lo=new WeakMap,Vy=new WeakMap,Vj);function pb(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,Gj,o8=(Gj=class extends Gy{constructor(e={}){super();Gt(this,bl);this.config=e,wt(this,bl,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??vC(i,n);let a=this.get(s);return a||(a=new e8({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}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=>YN(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>YN(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,Gj),Mr,md,gd,pg,mg,vd,gg,vg,Wj,l8=(Wj=class{constructor(t={}){Gt(this,Mr);Gt(this,md);Gt(this,gd);Gt(this,pg);Gt(this,mg);Gt(this,vd);Gt(this,gg);Gt(this,vg);wt(this,Mr,t.queryCache||new o8),wt(this,md,t.mutationCache||new a8),wt(this,gd,t.defaultOptions||{}),wt(this,pg,new Map),wt(this,mg,new Map),wt(this,vd,0)}mount(){fb(this,vd)._++,ge(this,vd)===1&&(wt(this,gg,gC.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Mr).onFocus())})),wt(this,vg,ew.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Mr).onOnline())})))}unmount(){var t,e;fb(this,vd)._--,ge(this,vd)===0&&((t=ge(this,gg))==null||t.call(this),wt(this,gg,void 0),(e=ge(this,vg))==null||e.call(this),wt(this,vg,void 0))}isFetching(t){return ge(this,Mr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ge(this,md).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Mr).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=ge(this,Mr).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(xd(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return ge(this,Mr).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,Mr).get(r.queryHash),s=i==null?void 0:i.state.data,a=HW(e,s);if(a!==void 0)return ge(this,Mr).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(t,e,n){return zi.batch(()=>ge(this,Mr).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,Mr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ge(this,Mr);zi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ge(this,Mr);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,Mr).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(qs).catch(qs)}invalidateQueries(t,e={}){return zi.batch(()=>(ge(this,Mr).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,Mr).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(qs)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(qs)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ge(this,Mr).build(this,e);return n.isStaleByTime(xd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(qs).catch(qs)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(qs).catch(qs)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return ew.isOnline()?ge(this,md).resumePausedMutations():Promise.resolve()}getQueryCache(){return ge(this,Mr)}getMutationCache(){return ge(this,md)}getDefaultOptions(){return ge(this,gd)}setDefaultOptions(t){wt(this,gd,t)}setQueryDefaults(t,e){ge(this,pg).set(sy(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ge(this,pg).values()],n={};return e.forEach(r=>{ay(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){ge(this,mg).set(sy(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ge(this,mg).values()],n={};return e.forEach(r=>{ay(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ge(this,gd).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=vC(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===yC&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ge(this,gd).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ge(this,Mr).clear(),ge(this,md).clear()}},Mr=new WeakMap,md=new WeakMap,gd=new WeakMap,pg=new WeakMap,mg=new WeakMap,vd=new WeakMap,gg=new WeakMap,vg=new WeakMap,Wj),iF=R.createContext(void 0),Nd=t=>{const e=R.useContext(iF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},c8=({client:t,children:e})=>(R.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),v.jsx(iF.Provider,{value:t,children:e})),sF=R.createContext(!1),u8=()=>R.useContext(sF);sF.Provider;function d8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var f8=R.createContext(d8()),h8=()=>R.useContext(f8),p8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?Zj(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},m8=t=>{R.useEffect(()=>{t.clearReset()},[t])},g8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||Zj(n,[t.error,r])),v8=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))}},y8=(t,e)=>t.isLoading&&t.isFetching&&!e,x8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,sI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function b8(t,e,n){var y,b,S,w;const r=u8(),i=h8(),s=Nd(),a=s.defaultQueryOptions(t);(b=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||b.call(y,a);const o=s.getQueryCache().get(a.queryHash),l=t.subscribed!==!1;a._optimisticResults=r?"isRestoring":l?"optimistic":void 0,v8(a),p8(a,i,o),m8(i);const c=!s.getQueryCache().get(a.queryHash),[d]=R.useState(()=>new e(s,a)),f=d.getOptimisticResult(a),p=!r&&l;if(R.useSyncExternalStore(R.useCallback(x=>{const M=p?d.subscribe(zi.batchCalls(x)):qs;return d.updateResult(),M},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(a)},[a,d]),x8(a,f))throw sI(a,d,i);if(g8({result:f,errorResetBoundary:i,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw f.error;if((w=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,a,f),a.experimental_prefetchInRender&&!oy.isServer()&&y8(f,r)){const x=c?sI(a,d,i):o==null?void 0:o.promise;x==null||x.catch(qs).finally(()=>{d.updateResult()})}return a.notifyOnChangeProps?f:d.trackResult(f)}function bi(t,e){return b8(t,t8)}/** +`+U.stack}return{value:u,source:h,stack:I,digest:null}}function L(u,h,_){return{value:u,source:null,stack:_??null,digest:h??null}}function F(u,h){try{console.error(h.value)}catch(_){setTimeout(function(){throw _})}}var re=typeof WeakMap=="function"?WeakMap:Map;function ye(u,h,_){_=zn(-1,_),_.tag=3,_.payload={element:null};var A=h.value;return _.callback=function(){Qx||(Qx=!0,UM=A),F(u,h)},_}function je(u,h,_){_=zn(-1,_),_.tag=3;var A=u.type.getDerivedStateFromError;if(typeof A=="function"){var I=h.value;_.payload=function(){return A(I)},_.callback=function(){F(u,h)}}var U=u.stateNode;return U!==null&&typeof U.componentDidCatch=="function"&&(_.callback=function(){F(u,h),typeof A!="function"&&(Du===null?Du=new Set([this]):Du.add(this));var $=h.stack;this.componentDidCatch(h.value,{componentStack:$!==null?$:""})}),_}function st(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=pW.bind(null,u,h,_),h.then(u,u))}function St(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 rn(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=zn(-1,1),h.tag=2,Jn(_,h,1))),_.lanes|=1),u):(u.flags|=65536,u.lanes=I,u)}var zt=P.ReactCurrentOwner,ln=!1;function xt(u,h,_,A){h.child=u===null?of(h,null,_,A):lc(h,u.child,_,A)}function Jr(u,h,_,A,I){_=_.render;var U=h.ref;return ol(h,I),A=hf(u,h,_,A,U,I),_=Bv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,yc(u,h,I)):(Kn&&_&&Ov(h),h.flags|=1,xt(u,h,A,I),h.child)}function ys(u,h,_,A,I){if(u===null){var U=_.type;return typeof U=="function"&&!GM(U)&&U.defaultProps===void 0&&_.compare===null&&_.defaultProps===void 0?(h.tag=15,h.type=U,Ne(u,h,U,A,I)):(u=ib(_.type,null,A,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(U=u.child,(u.lanes&I)===0){var $=U.memoizedProps;if(_=_.compare,_=_!==null?_:Ql,_($,A)&&u.ref===h.ref)return yc(u,h,I)}return h.flags|=1,u=zu(U,A),u.ref=h.ref,u.return=h,h.child=u}function Ne(u,h,_,A,I){if(u!==null){var U=u.memoizedProps;if(Ql(U,A)&&u.ref===h.ref)if(ln=!1,h.pendingProps=A=U,(u.lanes&I)!==0)(u.flags&131072)!==0&&(ln=!0);else return h.lanes=u.lanes,yc(u,h,I)}return gt(u,h,_,A,I)}function _e(u,h,_){var A=h.pendingProps,I=A.children,U=u!==null?u.memoizedState:null;if(A.mode==="hidden")if((h.mode&1)===0)h.memoizedState={baseLanes:0,cachePool:null,transitions:null},Gn(Jp,da),da|=_;else{if((_&1073741824)===0)return u=U!==null?U.baseLanes|_:_,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:u,cachePool:null,transitions:null},h.updateQueue=null,Gn(Jp,da),da|=u,null;h.memoizedState={baseLanes:0,cachePool:null,transitions:null},A=U!==null?U.baseLanes:_,Gn(Jp,da),da|=A}else U!==null?(A=U.baseLanes|_,h.memoizedState=null):A=_,Gn(Jp,da),da|=A;return xt(u,h,I,_),h.child}function De(u,h){var _=h.ref;(u===null&&_!==null||u!==null&&u.ref!==_)&&(h.flags|=512,h.flags|=2097152)}function gt(u,h,_,A,I){var U=ui(_)?mo:Kr.current;return U=ic(h,U),ol(h,I),_=hf(u,h,_,A,U,I),A=Bv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,yc(u,h,I)):(Kn&&A&&Ov(h),h.flags|=1,xt(u,h,_,I),h.child)}function Ot(u,h,_,A,I){if(ui(_)){var U=!0;sc(h)}else U=!1;if(ol(h,I),h.stateNode===null)Xx(u,h),m(h,_,A),E(h,_,A,I),A=!0;else if(u===null){var $=h.stateNode,oe=h.memoizedProps;$.props=oe;var me=$.context,Oe=_.contextType;typeof Oe=="object"&&Oe!==null?Oe=ps(Oe):(Oe=ui(_)?mo:Kr.current,Oe=ic(h,Oe));var et=_.getDerivedStateFromProps,nt=typeof et=="function"||typeof $.getSnapshotBeforeUpdate=="function";nt||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(oe!==A||me!==Oe)&&g(h,$,A,Oe),Fn=!1;var Qe=h.memoizedState;$.state=Qe,cr(h,A,$,I),me=h.memoizedState,oe!==A||Qe!==me||Ri.current||Fn?(typeof et=="function"&&(yf(h,_,et,A),me=h.memoizedState),(oe=Fn||Wx(h,_,oe,A,Qe,me,Oe))?(nt||typeof $.UNSAFE_componentWillMount!="function"&&typeof $.componentWillMount!="function"||(typeof $.componentWillMount=="function"&&$.componentWillMount(),typeof $.UNSAFE_componentWillMount=="function"&&$.UNSAFE_componentWillMount()),typeof $.componentDidMount=="function"&&(h.flags|=4194308)):(typeof $.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=A,h.memoizedState=me),$.props=A,$.state=me,$.context=Oe,A=oe):(typeof $.componentDidMount=="function"&&(h.flags|=4194308),A=!1)}else{$=h.stateNode,gr(u,h),oe=h.memoizedProps,Oe=h.type===h.elementType?oe:Bs(h.type,oe),$.props=Oe,nt=h.pendingProps,Qe=$.context,me=_.contextType,typeof me=="object"&&me!==null?me=ps(me):(me=ui(_)?mo:Kr.current,me=ic(h,me));var _t=_.getDerivedStateFromProps;(et=typeof _t=="function"||typeof $.getSnapshotBeforeUpdate=="function")||typeof $.UNSAFE_componentWillReceiveProps!="function"&&typeof $.componentWillReceiveProps!="function"||(oe!==nt||Qe!==me)&&g(h,$,A,me),Fn=!1,Qe=h.memoizedState,$.state=Qe,cr(h,A,$,I);var Pt=h.memoizedState;oe!==nt||Qe!==Pt||Ri.current||Fn?(typeof _t=="function"&&(yf(h,_,_t,A),Pt=h.memoizedState),(Oe=Fn||Wx(h,_,Oe,A,Qe,Pt,me)||!1)?(et||typeof $.UNSAFE_componentWillUpdate!="function"&&typeof $.componentWillUpdate!="function"||(typeof $.componentWillUpdate=="function"&&$.componentWillUpdate(A,Pt,me),typeof $.UNSAFE_componentWillUpdate=="function"&&$.UNSAFE_componentWillUpdate(A,Pt,me)),typeof $.componentDidUpdate=="function"&&(h.flags|=4),typeof $.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof $.componentDidUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=1024),h.memoizedProps=A,h.memoizedState=Pt),$.props=A,$.state=Pt,$.context=me,A=Oe):(typeof $.componentDidUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=4),typeof $.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Qe===u.memoizedState||(h.flags|=1024),A=!1)}return an(u,h,_,A,U,I)}function an(u,h,_,A,I,U){De(u,h);var $=(h.flags&128)!==0;if(!A&&!$)return I&&Iv(h,_,!1),yc(u,h,U);A=h.stateNode,zt.current=h;var oe=$&&typeof _.getDerivedStateFromError!="function"?null:A.render();return h.flags|=1,u!==null&&$?(h.child=lc(h,u.child,null,U),h.child=lc(h,null,oe,U)):xt(u,h,oe,U),h.memoizedState=A.state,I&&Iv(h,_,!0),h.child}function sn(u){var h=u.stateNode;h.pendingContext?Nv(u,h.pendingContext,h.pendingContext!==h.context):h.context&&Nv(u,h.context,!1),df(u,h.containerInfo)}function En(u,h,_,A,I){return al(),Cu(I),h.flags|=256,xt(u,h,_,A),h.child}var _r={dehydrated:null,treeContext:null,retryLane:0};function bn(u){return{baseLanes:u,cachePool:null,transitions:null}}function Mo(u,h,_){var A=h.pendingProps,I=Yn.current,U=!1,$=(h.flags&128)!==0,oe;if((oe=$)||(oe=u!==null&&u.memoizedState===null?!1:(I&2)!==0),oe?(U=!0,h.flags&=-129):(u===null||u.memoizedState!==null)&&(I|=1),Gn(Yn,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):($=A.children,u=A.fallback,U?(A=h.mode,U=h.child,$={mode:"hidden",children:$},(A&1)===0&&U!==null?(U.childLanes=0,U.pendingProps=$):U=sb($,A,0,null),u=Sf(u,A,_,null),U.return=h,u.return=h,U.sibling=u,h.child=U,h.child.memoizedState=bn(_),h.memoizedState=_r,u):Kv(h,$));if(I=u.memoizedState,I!==null&&(oe=I.dehydrated,oe!==null))return nW(u,h,$,A,oe,I,_);if(U){U=A.fallback,$=h.mode,I=u.child,oe=I.sibling;var me={mode:"hidden",children:A.children};return($&1)===0&&h.child!==I?(A=h.child,A.childLanes=0,A.pendingProps=me,h.deletions=null):(A=zu(I,me),A.subtreeFlags=I.subtreeFlags&14680064),oe!==null?U=zu(oe,U):(U=Sf(U,$,_,null),U.flags|=2),U.return=h,A.return=h,A.sibling=U,h.child=A,A=U,U=h.child,$=u.child.memoizedState,$=$===null?bn(_):{baseLanes:$.baseLanes|_,cachePool:null,transitions:$.transitions},U.memoizedState=$,U.childLanes=u.childLanes&~_,h.memoizedState=_r,A}return U=u.child,u=U.sibling,A=zu(U,{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=sb({mode:"visible",children:h},u.mode,0,null),h.return=u,u.child=h}function $x(u,h,_,A){return A!==null&&Cu(A),lc(h,u.child,null,_),u=Kv(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function nW(u,h,_,A,I,U,$){if(_)return h.flags&256?(h.flags&=-257,A=L(Error(n(422))),$x(u,h,$,A)):h.memoizedState!==null?(h.child=u.child,h.flags|=128,null):(U=A.fallback,I=h.mode,A=sb({mode:"visible",children:A.children},I,0,null),U=Sf(U,I,$,null),U.flags|=2,A.return=h,U.return=h,A.sibling=U,h.child=A,(h.mode&1)!==0&&lc(h,u.child,null,$),h.child.memoizedState=bn($),h.memoizedState=_r,U);if((h.mode&1)===0)return $x(u,h,$,null);if(I.data==="$!"){if(A=I.nextSibling&&I.nextSibling.dataset,A)var oe=A.dgst;return A=oe,U=Error(n(419)),A=L(U,A,void 0),$x(u,h,$,A)}if(oe=($&u.childLanes)!==0,ln||oe){if(A=hi,A!==null){switch($&-$){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|$))!==0?0:I,I!==0&&I!==U.retryLane&&(U.retryLane=I,oa(u,I),To(A,u,I,-1))}return VM(),A=L(Error(n(421))),$x(u,h,$,A)}return I.data==="$?"?(h.flags|=128,h.child=u.child,h=mW.bind(null,u),I._reactRetry=h,null):(u=U.treeContext,Ii=fo(I.nextSibling),Yr=h,Kn=!0,zs=null,u!==null&&(Ni[zr++]=ut,Ni[zr++]=Fs,Ni[zr++]=oc,ut=u.id,Fs=u.overflow,oc=h),h=Kv(h,A.children),h.flags|=4096,h)}function cN(u,h,_){u.lanes|=h;var A=u.alternate;A!==null&&(A.lanes|=h),cf(u.return,h,_)}function PM(u,h,_,A,I){var U=u.memoizedState;U===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:A,tail:_,tailMode:I}:(U.isBackwards=h,U.rendering=null,U.renderingStartTime=0,U.last=A,U.tail=_,U.tailMode=I)}function uN(u,h,_){var A=h.pendingProps,I=A.revealOrder,U=A.tail;if(xt(u,h,A.children,_),A=Yn.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&&cN(u,_,h);else if(u.tag===19)cN(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(Gn(Yn,A),(h.mode&1)===0)h.memoizedState=null;else switch(I){case"forwards":for(_=h.child,I=null;_!==null;)u=_.alternate,u!==null&&la(u)===null&&(I=_),_=_.sibling;_=I,_===null?(I=h.child,h.child=null):(I=_.sibling,_.sibling=null),PM(h,!1,I,_,U);break;case"backwards":for(_=null,I=h.child,h.child=null;I!==null;){if(u=I.alternate,u!==null&&la(u)===null){h.child=I;break}u=I.sibling,I.sibling=_,_=I,I=u}PM(h,!0,_,null,U);break;case"together":PM(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function Xx(u,h){(h.mode&1)===0&&u!==null&&(u.alternate=null,h.alternate=null,h.flags|=2)}function yc(u,h,_){if(u!==null&&(h.dependencies=u.dependencies),xf|=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,_=zu(u,u.pendingProps),h.child=_,_.return=h;u.sibling!==null;)u=u.sibling,_=_.sibling=zu(u,u.pendingProps),_.return=h;_.sibling=null}return h.child}function rW(u,h,_){switch(h.tag){case 3:sn(h),al();break;case 5:pc(h);break;case 1:ui(h.type)&&sc(h);break;case 4:df(h,h.stateNode.containerInfo);break;case 10:var A=h.type._context,I=h.memoizedProps.value;Gn(cc,A._currentValue),A._currentValue=I;break;case 13:if(A=h.memoizedState,A!==null)return A.dehydrated!==null?(Gn(Yn,Yn.current&1),h.flags|=128,null):(_&h.child.childLanes)!==0?Mo(u,h,_):(Gn(Yn,Yn.current&1),u=yc(u,h,_),u!==null?u.sibling:null);Gn(Yn,Yn.current&1);break;case 19:if(A=(_&h.childLanes)!==0,(u.flags&128)!==0){if(A)return uN(u,h,_);h.flags|=128}if(I=h.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),Gn(Yn,Yn.current),A)break;return null;case 22:case 23:return h.lanes=0,_e(u,h,_)}return yc(u,h,_)}var dN,CM,fN,hN;dN=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}},CM=function(){},fN=function(u,h,_,A){var I=u.memoizedProps;if(I!==A){u=h.stateNode,br(ms.current);var U=null;switch(_){case"input":I=Ve(u,I),A=Ve(u,A),U=[];break;case"select":I=Y({},I,{value:void 0}),A=Y({},A,{value:void 0}),U=[];break;case"textarea":I=be(u,I),A=be(u,A),U=[];break;default:typeof I.onClick!="function"&&typeof A.onClick=="function"&&(u.onclick=Jd)}fe(_,A);var $;_=null;for(Oe in I)if(!A.hasOwnProperty(Oe)&&I.hasOwnProperty(Oe)&&I[Oe]!=null)if(Oe==="style"){var oe=I[Oe];for($ in oe)oe.hasOwnProperty($)&&(_||(_={}),_[$]="")}else Oe!=="dangerouslySetInnerHTML"&&Oe!=="children"&&Oe!=="suppressContentEditableWarning"&&Oe!=="suppressHydrationWarning"&&Oe!=="autoFocus"&&(i.hasOwnProperty(Oe)?U||(U=[]):(U=U||[]).push(Oe,null));for(Oe in A){var me=A[Oe];if(oe=I!=null?I[Oe]:void 0,A.hasOwnProperty(Oe)&&me!==oe&&(me!=null||oe!=null))if(Oe==="style")if(oe){for($ in oe)!oe.hasOwnProperty($)||me&&me.hasOwnProperty($)||(_||(_={}),_[$]="");for($ in me)me.hasOwnProperty($)&&oe[$]!==me[$]&&(_||(_={}),_[$]=me[$])}else _||(U||(U=[]),U.push(Oe,_)),_=me;else Oe==="dangerouslySetInnerHTML"?(me=me?me.__html:void 0,oe=oe?oe.__html:void 0,me!=null&&oe!==me&&(U=U||[]).push(Oe,me)):Oe==="children"?typeof me!="string"&&typeof me!="number"||(U=U||[]).push(Oe,""+me):Oe!=="suppressContentEditableWarning"&&Oe!=="suppressHydrationWarning"&&(i.hasOwnProperty(Oe)?(me!=null&&Oe==="onScroll"&&Wn("scroll",u),U||oe===me||(U=[])):(U=U||[]).push(Oe,me))}_&&(U=U||[]).push("style",_);var Oe=U;(h.updateQueue=Oe)&&(h.flags|=4)}},hN=function(u,h,_,A){_!==A&&(h.flags|=4)};function Yv(u,h){if(!Kn)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 Zi(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 iW(u,h,_){var A=h.pendingProps;switch(vo(h),h.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Zi(h),null;case 1:return ui(h.type)&&ef(),Zi(h),null;case 3:return A=h.stateNode,ll(),$n(Ri),$n(Kr),Oa(),A.pendingContext&&(A.context=A.pendingContext,A.pendingContext=null),(u===null||u.child===null)&&(Pu(h)?h.flags|=4:u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,zs!==null&&(zM(zs),zs=null))),CM(u,h),Zi(h),null;case 5:Iu(h);var I=br(bo.current);if(_=h.type,u!==null&&h.stateNode!=null)fN(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 Zi(h),null}if(u=br(ms.current),Pu(h)){A=h.stateNode,_=h.type;var U=h.memoizedProps;switch(A[Ir]=h,A[Tu]=U,u=(h.mode&1)!==0,_){case"dialog":Wn("cancel",A),Wn("close",A);break;case"iframe":case"object":case"embed":Wn("load",A);break;case"video":case"audio":for(I=0;I<\/script>",u=u.removeChild(u.firstChild)):typeof A.is=="string"?u=$.createElement(_,{is:A.is}):(u=$.createElement(_),_==="select"&&($=u,A.multiple?$.multiple=!0:A.size&&($.size=A.size))):u=$.createElementNS(u,_),u[Ir]=h,u[Tu]=A,dN(u,h,!1,!1),h.stateNode=u;e:{switch($=qe(_,A),_){case"dialog":Wn("cancel",u),Wn("close",u),I=A;break;case"iframe":case"object":case"embed":Wn("load",u),I=A;break;case"video":case"audio":for(I=0;Iem&&(h.flags|=128,A=!0,Yv(U,!1),h.lanes=4194304)}else{if(!A)if(u=la($),u!==null){if(h.flags|=128,A=!0,_=u.updateQueue,_!==null&&(h.updateQueue=_,h.flags|=4),Yv(U,!0),U.tail===null&&U.tailMode==="hidden"&&!$.alternate&&!Kn)return Zi(h),null}else 2*lt()-U.renderingStartTime>em&&_!==1073741824&&(h.flags|=128,A=!0,Yv(U,!1),h.lanes=4194304);U.isBackwards?($.sibling=h.child,h.child=$):(_=U.last,_!==null?_.sibling=$:h.child=$,U.last=$)}return U.tail!==null?(h=U.tail,U.rendering=h,U.tail=h.sibling,U.renderingStartTime=lt(),h.sibling=null,_=Yn.current,Gn(Yn,A?_&1|2:_&1),h):(Zi(h),null);case 22:case 23:return HM(),A=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==A&&(h.flags|=8192),A&&(h.mode&1)!==0?(da&1073741824)!==0&&(Zi(h),h.subtreeFlags&6&&(h.flags|=8192)):Zi(h),null;case 24:return null;case 25:return null}throw Error(n(156,h.tag))}function sW(u,h){switch(vo(h),h.tag){case 1:return ui(h.type)&&ef(),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return ll(),$n(Ri),$n(Kr),Oa(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 5:return Iu(h),null;case 13:if($n(Yn),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(n(340));al()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return $n(Yn),null;case 4:return ll(),null;case 10:return lf(h.type._context),null;case 22:case 23:return HM(),null;case 24:return null;default:return null}}var qx=!1,Qi=!1,aW=typeof WeakSet=="function"?WeakSet:Set,At=null;function Qp(u,h){var _=u.ref;if(_!==null)if(typeof _=="function")try{_(null)}catch(A){wr(u,h,A)}else _.current=null}function RM(u,h,_){try{_()}catch(A){wr(u,h,A)}}var pN=!1;function oW(u,h){if(Au=ks,u=rr(),Dr(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,U=A.focusNode;A=A.focusOffset;try{_.nodeType,U.nodeType}catch{_=null;break e}var $=0,oe=-1,me=-1,Oe=0,et=0,nt=u,Qe=null;t:for(;;){for(var _t;nt!==_||I!==0&&nt.nodeType!==3||(oe=$+I),nt!==U||A!==0&&nt.nodeType!==3||(me=$+A),nt.nodeType===3&&($+=nt.nodeValue.length),(_t=nt.firstChild)!==null;)Qe=nt,nt=_t;for(;;){if(nt===u)break t;if(Qe===_&&++Oe===I&&(oe=$),Qe===U&&++et===A&&(me=$),(_t=nt.nextSibling)!==null)break;nt=Qe,Qe=nt.parentNode}nt=_t}_=oe===-1||me===-1?null:{start:oe,end:me}}else _=null}_=_||{start:0,end:0}}else _=null;for(Ev={focusedElem:u,selectionRange:_},ks=!1,At=h;At!==null;)if(h=At,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,At=u;else for(;At!==null;){h=At;try{var Pt=h.alternate;if((h.flags&1024)!==0)switch(h.tag){case 0:case 11:case 15:break;case 1:if(Pt!==null){var Nt=Pt.memoizedProps,kr=Pt.memoizedState,Ae=h.stateNode,ve=Ae.getSnapshotBeforeUpdate(h.elementType===h.type?Nt:Bs(h.type,Nt),kr);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(ot){wr(h,h.return,ot)}if(u=h.sibling,u!==null){u.return=h.return,At=u;break}At=h.return}return Pt=pN,pN=!1,Pt}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 U=I.destroy;I.destroy=void 0,U!==void 0&&RM(h,_,U)}I=I.next}while(I!==A)}}function Kx(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 NM(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 mN(u){var h=u.alternate;h!==null&&(u.alternate=null,mN(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&(delete h[Ir],delete h[Tu],delete h[rc],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 gN(u){return u.tag===5||u.tag===3||u.tag===4}function vN(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||gN(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 IM(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=Jd));else if(A!==4&&(u=u.child,u!==null))for(IM(u,h,_),u=u.sibling;u!==null;)IM(u,h,_),u=u.sibling}function kM(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(kM(u,h,_),u=u.sibling;u!==null;)kM(u,h,_),u=u.sibling}var Oi=null,Eo=!1;function Lu(u,h,_){for(_=_.child;_!==null;)yN(u,h,_),_=_.sibling}function yN(u,h,_){if(Kt&&typeof Kt.onCommitFiberUnmount=="function")try{Kt.onCommitFiberUnmount(yn,_)}catch{}switch(_.tag){case 5:Qi||Qp(_,h);case 6:var A=Oi,I=Eo;Oi=null,Lu(u,h,_),Oi=A,Eo=I,Oi!==null&&(Eo?(u=Oi,_=_.stateNode,u.nodeType===8?u.parentNode.removeChild(_):u.removeChild(_)):Oi.removeChild(_.stateNode));break;case 18:Oi!==null&&(Eo?(u=Oi,_=_.stateNode,u.nodeType===8?Op(u.parentNode,_):u.nodeType===1&&Op(u,_),Bd(u)):Op(Oi,_.stateNode));break;case 4:A=Oi,I=Eo,Oi=_.stateNode.containerInfo,Eo=!0,Lu(u,h,_),Oi=A,Eo=I;break;case 0:case 11:case 14:case 15:if(!Qi&&(A=_.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){I=A=A.next;do{var U=I,$=U.destroy;U=U.tag,$!==void 0&&((U&2)!==0||(U&4)!==0)&&RM(_,h,$),I=I.next}while(I!==A)}Lu(u,h,_);break;case 1:if(!Qi&&(Qp(_,h),A=_.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=_.memoizedProps,A.state=_.memoizedState,A.componentWillUnmount()}catch(oe){wr(_,h,oe)}Lu(u,h,_);break;case 21:Lu(u,h,_);break;case 22:_.mode&1?(Qi=(A=Qi)||_.memoizedState!==null,Lu(u,h,_),Qi=A):Lu(u,h,_);break;default:Lu(u,h,_)}}function xN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var _=u.stateNode;_===null&&(_=u.stateNode=new aW),h.forEach(function(A){var I=gW.bind(null,u,A);_.has(A)||(_.add(A),A.then(I,I))})}}function Ao(u,h){var _=h.deletions;if(_!==null)for(var A=0;A<_.length;A++){var I=_[A];try{var U=u,$=h,oe=$;e:for(;oe!==null;){switch(oe.tag){case 5:Oi=oe.stateNode,Eo=!1;break e;case 3:Oi=oe.stateNode.containerInfo,Eo=!0;break e;case 4:Oi=oe.stateNode.containerInfo,Eo=!0;break e}oe=oe.return}if(Oi===null)throw Error(n(160));yN(U,$,I),Oi=null,Eo=!1;var me=I.alternate;me!==null&&(me.return=null),I.return=null}catch(Oe){wr(I,h,Oe)}}if(h.subtreeFlags&12854)for(h=h.child;h!==null;)bN(h,u),h=h.sibling}function bN(u,h){var _=u.alternate,A=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:if(Ao(h,u),ul(u),A&4){try{Zv(3,u,u.return),Kx(3,u)}catch(Nt){wr(u,u.return,Nt)}try{Zv(5,u,u.return)}catch(Nt){wr(u,u.return,Nt)}}break;case 1:Ao(h,u),ul(u),A&512&&_!==null&&Qp(_,_.return);break;case 5:if(Ao(h,u),ul(u),A&512&&_!==null&&Qp(_,_.return),u.flags&32){var I=u.stateNode;try{Ke(I,"")}catch(Nt){wr(u,u.return,Nt)}}if(A&4&&(I=u.stateNode,I!=null)){var U=u.memoizedProps,$=_!==null?_.memoizedProps:U,oe=u.type,me=u.updateQueue;if(u.updateQueue=null,me!==null)try{oe==="input"&&U.type==="radio"&&U.name!=null&&ne(I,U),qe(oe,$);var Oe=qe(oe,U);for($=0;$I&&(I=$),A&=~U}if(A=I,A=lt()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*cW(A/1960))-A,10u?16:u,Uu===null)var A=!1;else{if(u=Uu,Uu=null,eb=0,(kn&6)!==0)throw Error(n(331));var I=kn;for(kn|=4,At=u.current;At!==null;){var U=At,$=U.child;if((At.flags&16)!==0){var oe=U.deletions;if(oe!==null){for(var me=0;melt()-DM?_f(u,0):LM|=_),Vs(u,h)}function IN(u,h){h===0&&((u.mode&1)===0?h=1:(h=In,In<<=1,(In&130023424)===0&&(In=4194304)));var _=xs();u=oa(u,h),u!==null&&(Zo(u,h,_),Vs(u,_))}function mW(u){var h=u.memoizedState,_=0;h!==null&&(_=h.retryLane),IN(u,_)}function gW(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),IN(u,_)}var kN;kN=function(u,h,_){if(u!==null)if(u.memoizedProps!==h.pendingProps||Ri.current)ln=!0;else{if((u.lanes&_)===0&&(h.flags&128)===0)return ln=!1,rW(u,h,_);ln=(u.flags&131072)!==0}else ln=!1,Kn&&(h.flags&1048576)!==0&&kv(h,zp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;Xx(u,h),u=h.pendingProps;var I=ic(h,Kr.current);ol(h,_),I=hf(null,h,A,u,I,_);var U=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,ui(A)?(U=!0,sc(h)):U=!1,h.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,on(h),I.updater=Zp,h.stateNode=I,I._reactInternals=h,E(h,A,u,_),h=an(null,h,A,!0,U,_)):(h.tag=0,Kn&&U&&Ov(h),xt(null,h,I,_),h=h.child),h;case 16:A=h.elementType;e:{switch(Xx(u,h),u=h.pendingProps,I=A._init,A=I(A._payload),h.type=A,I=h.tag=yW(A),u=Bs(A,u),I){case 0:h=gt(null,h,A,u,_);break e;case 1:h=Ot(null,h,A,u,_);break e;case 11:h=Jr(null,h,A,u,_);break e;case 14:h=ys(null,h,A,Bs(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:Bs(A,I),gt(u,h,A,I,_);case 1:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Ot(u,h,A,I,_);case 3:e:{if(sn(h),u===null)throw Error(n(387));A=h.pendingProps,U=h.memoizedState,I=U.element,gr(u,h),cr(h,A,null,_);var $=h.memoizedState;if(A=$.element,U.isDehydrated)if(U={element:A,isDehydrated:!1,cache:$.cache,pendingSuspenseBoundaries:$.pendingSuspenseBoundaries,transitions:$.transitions},h.updateQueue.baseState=U,h.memoizedState=U,h.flags&256){I=C(Error(n(423)),h),h=En(u,h,A,_,I);break e}else if(A!==I){I=C(Error(n(424)),h),h=En(u,h,A,_,I);break e}else for(Ii=fo(h.stateNode.containerInfo.firstChild),Yr=h,Kn=!0,zs=null,_=of(h,null,A,_),h.child=_;_;)_.flags=_.flags&-3|4096,_=_.sibling;else{if(al(),A===I){h=yc(u,h,_);break e}xt(u,h,A,_)}h=h.child}return h;case 5:return pc(h),u===null&&Hp(h),A=h.type,I=h.pendingProps,U=u!==null?u.memoizedProps:null,$=I.children,Av(A,I)?$=null:U!==null&&Av(A,U)&&(h.flags|=32),De(u,h),xt(u,h,$,_),h.child;case 6:return u===null&&Hp(h),null;case 13:return Mo(u,h,_);case 4:return df(h,h.stateNode.containerInfo),A=h.pendingProps,u===null?h.child=lc(h,null,A,_):xt(u,h,A,_),h.child;case 11:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Jr(u,h,A,I,_);case 7:return xt(u,h,h.pendingProps,_),h.child;case 8:return xt(u,h,h.pendingProps.children,_),h.child;case 12:return xt(u,h,h.pendingProps.children,_),h.child;case 10:e:{if(A=h.type._context,I=h.pendingProps,U=h.memoizedProps,$=I.value,Gn(cc,A._currentValue),A._currentValue=$,U!==null)if(ds(U.value,$)){if(U.children===I.children&&!Ri.current){h=yc(u,h,_);break e}}else for(U=h.child,U!==null&&(U.return=h);U!==null;){var oe=U.dependencies;if(oe!==null){$=U.child;for(var me=oe.firstContext;me!==null;){if(me.context===A){if(U.tag===1){me=zn(-1,_&-_),me.tag=2;var Oe=U.updateQueue;if(Oe!==null){Oe=Oe.shared;var et=Oe.pending;et===null?me.next=me:(me.next=et.next,et.next=me),Oe.pending=me}}U.lanes|=_,me=U.alternate,me!==null&&(me.lanes|=_),cf(U.return,_,h),oe.lanes|=_;break}me=me.next}}else if(U.tag===10)$=U.type===h.type?null:U.child;else if(U.tag===18){if($=U.return,$===null)throw Error(n(341));$.lanes|=_,oe=$.alternate,oe!==null&&(oe.lanes|=_),cf($,_,h),$=U.sibling}else $=U.child;if($!==null)$.return=U;else for($=U;$!==null;){if($===h){$=null;break}if(U=$.sibling,U!==null){U.return=$.return,$=U;break}$=$.return}U=$}xt(u,h,I.children,_),h=h.child}return h;case 9:return I=h.type,A=h.pendingProps.children,ol(h,_),I=ps(I),A=A(I),h.flags|=1,xt(u,h,A,_),h.child;case 14:return A=h.type,I=Bs(A,h.pendingProps),I=Bs(A.type,I),ys(u,h,A,I,_);case 15:return Ne(u,h,h.type,h.pendingProps,_);case 17:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Xx(u,h),h.tag=1,ui(A)?(u=!0,sc(h)):u=!1,ol(h,_),m(h,A,I),E(h,A,I,_),an(null,h,A,!0,u,_);case 19:return uN(u,h,_);case 22:return _e(u,h,_)}throw Error(n(156,h.tag))};function ON(u,h){return Ie(u,h)}function vW(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 Ua(u,h,_,A){return new vW(u,h,_,A)}function GM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function yW(u){if(typeof u=="function")return GM(u)?1:0;if(u!=null){if(u=u.$$typeof,u===X)return 11;if(u===pe)return 14}return 2}function zu(u,h){var _=u.alternate;return _===null?(_=Ua(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 ib(u,h,_,A,I,U){var $=2;if(A=u,typeof u=="function")GM(u)&&($=1);else if(typeof u=="string")$=5;else e:switch(u){case D:return Sf(_.children,I,U,h);case z:$=8,I|=8;break;case V:return u=Ua(12,_,h,I|2),u.elementType=V,u.lanes=U,u;case ee:return u=Ua(13,_,h,I),u.elementType=ee,u.lanes=U,u;case ie:return u=Ua(19,_,h,I),u.elementType=ie,u.lanes=U,u;case he:return sb(_,I,U,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:$=10;break e;case j:$=9;break e;case X:$=11;break e;case pe:$=14;break e;case ae:$=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=Ua($,_,h,I),h.elementType=u,h.type=A,h.lanes=U,h}function Sf(u,h,_,A){return u=Ua(7,u,A,h),u.lanes=_,u}function sb(u,h,_,A){return u=Ua(22,u,A,h),u.elementType=he,u.lanes=_,u.stateNode={isHidden:!1},u}function WM(u,h,_){return u=Ua(6,u,null,h),u.lanes=_,u}function $M(u,h,_){return h=Ua(4,u.children!==null?u.children:[],u.key,h),h.lanes=_,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function xW(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=Ud(0),this.expirationTimes=Ud(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ud(0),this.identifierPrefix=A,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function XM(u,h,_,A,I,U,$,oe,me){return u=new xW(u,h,_,oe,me),h===1?(h=1,U===!0&&(h|=8)):h=0,U=Ua(3,null,null,h),u.current=U,U.stateNode=u,U.memoizedState={element:A,isDehydrated:_,cache:null,transitions:null,pendingSuspenseBoundaries:null},on(U),u}function bW(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(),eE.exports=OW(),eE.exports}var KN;function LW(){if(KN)return hb;KN=1;var t=Xj();return hb.createRoot=t.createRoot,hb.hydrateRoot=t.hydrateRoot,hb}var DW=LW();const UW=V1(DW);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(){}},hh,ud,sg,Dj,jW=(Dj=class extends Gy{constructor(){super();Gt(this,hh);Gt(this,ud);Gt(this,sg);wt(this,sg,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ge(this,ud)||this.setEventListener(ge(this,sg))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,ud))==null||e.call(this),wt(this,ud,void 0))}setEventListener(e){var n;wt(this,sg,e),(n=ge(this,ud))==null||n.call(this),wt(this,ud,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ge(this,hh)!==e&&(wt(this,hh,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ge(this,hh)=="boolean"?ge(this,hh):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},hh=new WeakMap,ud=new WeakMap,sg=new WeakMap,Dj),gC=new jW,FW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},dd,mC,Uj,zW=(Uj=class{constructor(){Gt(this,dd,FW);Gt(this,mC,!1)}setTimeoutProvider(t){wt(this,dd,t)}setTimeout(t,e){return ge(this,dd).setTimeout(t,e)}clearTimeout(t){ge(this,dd).clearTimeout(t)}setInterval(t,e){return ge(this,dd).setInterval(t,e)}clearInterval(t){ge(this,dd).clearInterval(t)}},dd=new WeakMap,mC=new WeakMap,Uj),th=new zW;function BW(t){setTimeout(t,0)}var HW=typeof window>"u"||"Deno"in globalThis;function qs(){}function VW(t,e){return typeof t=="function"?t(e):t}function mT(t){return typeof t=="number"&&t>=0&&t!==1/0}function qj(t,e){return Math.max(t+(e||0)-Date.now(),0)}function xd(t,e){return typeof t=="function"?t(e):t}function ga(t,e){return typeof t=="function"?t(e):t}function YN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:o}=t;if(a){if(r){if(e.queryHash!==vC(a,e.options))return!1}else if(!ay(e.queryKey,a))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&e.isStale()!==o||i&&i!==e.state.fetchStatus||s&&!s(e))}function ZN(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(sy(e.options.mutationKey)!==sy(s))return!1}else if(!ay(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function vC(t,e){return((e==null?void 0:e.queryKeyHashFn)||sy)(t)}function sy(t){return JSON.stringify(t,(e,n)=>vT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ay(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>ay(t[n],e[n])):!1}var GW=Object.prototype.hasOwnProperty;function Kj(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=QN(t)&&QN(e);if(!r&&!(vT(t)&&vT(e)))return e;const s=(r?t:Object.keys(t)).length,a=r?e:Object.keys(e),o=a.length,l=r?new Array(o):{};let c=0;for(let d=0;d{th.setTimeout(e,t)})}function yT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Kj(t,e):e}function $W(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function XW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var yC=Symbol();function Yj(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===yC?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Zj(t,e){return typeof t=="function"?t(...e):!!t}function qW(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=()=>HW;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 KW=BW;function YW(){let t=[],e=0,n=o=>{o()},r=o=>{o()},i=KW;const s=o=>{e?t.push(o):i(()=>{n(o)})},a=()=>{const o=t;t=[],o.length&&i(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;e++;try{l=o()}finally{e--,e||a()}return l},batchCalls:o=>(...l)=>{s(()=>{o(...l)})},schedule:s,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{i=o}}}var zi=YW(),ag,fd,og,jj,ZW=(jj=class extends Gy{constructor(){super();Gt(this,ag,!0);Gt(this,fd);Gt(this,og);wt(this,og,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,fd)||this.setEventListener(ge(this,og))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,fd))==null||e.call(this),wt(this,fd,void 0))}setEventListener(e){var n;wt(this,og,e),(n=ge(this,fd))==null||n.call(this),wt(this,fd,e(this.setOnline.bind(this)))}setOnline(e){ge(this,ag)!==e&&(wt(this,ag,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ge(this,ag)}},ag=new WeakMap,fd=new WeakMap,og=new WeakMap,jj),ew=new ZW;function QW(t){return Math.min(1e3*2**t,3e4)}function Qj(t){return(t??"online")==="online"?ew.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 Jj(t){let e=!1,n=0,r;const i=xT(),s=()=>i.status!=="pending",a=S=>{var w;if(!s()){const x=new bT(S);p(x),(w=t.onCancel)==null||w.call(t,x)}},o=()=>{e=!0},l=()=>{e=!1},c=()=>gC.isFocused()&&(t.networkMode==="always"||ew.isOnline())&&t.canRun(),d=()=>Qj(t.networkMode)&&t.canRun(),f=S=>{s()||(r==null||r(),i.resolve(S))},p=S=>{s()||(r==null||r(),i.reject(S))},y=()=>new Promise(S=>{var w;r=x=>{(s()||c())&&S(x)},(w=t.onPause)==null||w.call(t)}).then(()=>{var S;r=void 0,s()||(S=t.onContinue)==null||S.call(t)}),b=()=>{if(s())return;let S;const w=n===0?t.initialPromise:void 0;try{S=w??t.fn()}catch(x){S=Promise.reject(x)}Promise.resolve(S).then(f).catch(x=>{var N;if(s())return;const M=t.retry??(oy.isServer()?0:3),T=t.retryDelay??QW,P=typeof T=="function"?T(n,x):T,O=M===!0||typeof M=="number"&&nc()?void 0:y()).then(()=>{e?p(x):b()})})};return{promise:i,status:()=>i.status,cancel:a,continue:()=>(r==null||r(),i),cancelRetry:o,continueRetry:l,canStart:d,start:()=>(d()?b():y().then(b),i)}}var ph,Fj,eF=(Fj=class{constructor(){Gt(this,ph)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mT(this.gcTime)&&wt(this,ph,th.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(oy.isServer()?1/0:300*1e3))}clearGcTimeout(){ge(this,ph)!==void 0&&(th.clearTimeout(ge(this,ph)),wt(this,ph,void 0))}},ph=new WeakMap,Fj);function JW(t){return{onFetch:(e,n)=>{var d,f,p,y,b;const r=e.options,i=(p=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:p.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],a=((b=e.state.data)==null?void 0:b.pageParams)||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let S=!1;const w=T=>{qW(T,()=>e.signal,()=>S=!0)},x=Yj(e.options,e.fetchOptions),M=async(T,P,O)=>{if(S)return Promise.reject(e.signal.reason);if(P==null&&T.pages.length)return Promise.resolve(T);const D=(()=>{const j={client:e.client,queryKey:e.queryKey,pageParam:P,direction:O?"backward":"forward",meta:e.options.meta};return w(j),j})(),z=await x(D),{maxPages:V}=e.options,k=O?XW:$W;return{pages:k(T.pages,z,V),pageParams:k(T.pageParams,P,V)}};if(i&&s.length){const T=i==="backward",P=T?e8:eI,O={pages:s,pageParams:a},N=P(r,O);o=await M(O,N,T)}else{const T=t??s.length;do{const P=l===0?a[0]??r.initialPageParam:eI(r,o);if(l>0&&P==null)break;o=await M(o,P),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 eI(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 e8(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 lg,mh,cg,Ha,gh,gi,Fy,vh,ma,tF,Tc,zj,t8=(zj=class extends eF{constructor(e){super();Gt(this,ma);Gt(this,lg);Gt(this,mh);Gt(this,cg);Gt(this,Ha);Gt(this,gh);Gt(this,gi);Gt(this,Fy);Gt(this,vh);wt(this,vh,!1),wt(this,Fy,e.defaultOptions),this.setOptions(e.options),this.observers=[],wt(this,gh,e.client),wt(this,Ha,ge(this,gh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,wt(this,mh,nI(this.options)),this.state=e.state??ge(this,mh),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return ge(this,lg)}get promise(){var e;return(e=ge(this,gi))==null?void 0:e.promise}setOptions(e){if(this.options={...ge(this,Fy),...e},e!=null&&e._type&&wt(this,lg,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=nI(this.options);n.data!==void 0&&(this.setState(tI(n.data,n.dataUpdatedAt)),wt(this,mh,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ge(this,Ha).remove(this)}setData(e,n){const r=yT(this.state.data,e,this.options);return _n(this,ma,Tc).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){_n(this,ma,Tc).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=ge(this,gi))==null?void 0:r.promise;return(i=ge(this,gi))==null||i.cancel(e),n?n.then(qs).catch(qs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return ge(this,mh)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>ga(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yC||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>xd(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:!qj(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,gi))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,gi))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ge(this,Ha).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,gi)&&(ge(this,vh)||_n(this,ma,tF).call(this)?ge(this,gi).cancel({revert:!0}):ge(this,gi).cancelRetry()),this.scheduleGc()),ge(this,Ha).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_n(this,ma,Tc).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,p,y,b,S,w,x,M,T;if(this.state.fetchStatus!=="idle"&&((c=ge(this,gi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ge(this,gi))return ge(this,gi).continueRetry(),ge(this,gi).promise}if(e&&this.setOptions(e),!this.options.queryFn){const P=this.observers.find(O=>O.options.queryFn);P&&this.setOptions(P.options)}const r=new AbortController,i=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(wt(this,vh,!0),r.signal)})},s=()=>{const P=Yj(this.options,n),N=(()=>{const D={client:ge(this,gh),queryKey:this.queryKey,meta:this.meta};return i(D),D})();return wt(this,vh,!1),this.options.persister?this.options.persister(P,N,this):P(N)},o=(()=>{const P={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ge(this,gh),state:this.state,fetchFn:s};return i(P),P})(),l=ge(this,lg)==="infinite"?JW(this.options.pages):this.options.behavior;l==null||l.onFetch(o,this),wt(this,cg,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&_n(this,ma,Tc).call(this,{type:"fetch",meta:(f=o.fetchOptions)==null?void 0:f.meta}),wt(this,gi,Jj({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,onCancel:P=>{P instanceof bT&&P.revert&&this.setState({...ge(this,cg),fetchStatus:"idle"}),r.abort()},onFail:(P,O)=>{_n(this,ma,Tc).call(this,{type:"failed",failureCount:P,error:O})},onPause:()=>{_n(this,ma,Tc).call(this,{type:"pause"})},onContinue:()=>{_n(this,ma,Tc).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0}));try{const P=await ge(this,gi).start();if(P===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(P),(y=(p=ge(this,Ha).config).onSuccess)==null||y.call(p,P,this),(S=(b=ge(this,Ha).config).onSettled)==null||S.call(b,P,this.state.error,this),P}catch(P){if(P instanceof bT){if(P.silent)return ge(this,gi).promise;if(P.revert){if(this.state.data===void 0)throw P;return this.state.data}}throw _n(this,ma,Tc).call(this,{type:"error",error:P}),(x=(w=ge(this,Ha).config).onError)==null||x.call(w,P,this),(T=(M=ge(this,Ha).config).onSettled)==null||T.call(M,this.state.data,P,this),P}finally{this.scheduleGc()}}},lg=new WeakMap,mh=new WeakMap,cg=new WeakMap,Ha=new WeakMap,gh=new WeakMap,gi=new WeakMap,Fy=new WeakMap,vh=new WeakMap,ma=new WeakSet,tF=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Tc=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,...nF(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...tI(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return wt(this,cg,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,Ha).notify({query:this,type:"updated",action:e})})},zj);function nF(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Qj(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function tI(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function nI(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 Xs,An,zy,ws,yh,ug,Nc,hd,By,dg,fg,xh,bh,pd,hg,Bn,F0,_T,wT,ST,MT,ET,AT,TT,rF,Bj,n8=(Bj=class extends Gy{constructor(e,n){super();Gt(this,Bn);Gt(this,Xs);Gt(this,An);Gt(this,zy);Gt(this,ws);Gt(this,yh);Gt(this,ug);Gt(this,Nc);Gt(this,hd);Gt(this,By);Gt(this,dg);Gt(this,fg);Gt(this,xh);Gt(this,bh);Gt(this,pd);Gt(this,hg,new Set);this.options=n,wt(this,Xs,e),wt(this,hd,null),wt(this,Nc,xT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ge(this,An).addObserver(this),rI(ge(this,An),this.options)?_n(this,Bn,F0).call(this):this.updateResult(),_n(this,Bn,MT).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return PT(ge(this,An),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return PT(ge(this,An),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_n(this,Bn,ET).call(this),_n(this,Bn,AT).call(this),ge(this,An).removeObserver(this)}setOptions(e){const n=this.options,r=ge(this,An);if(this.options=ge(this,Xs).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ga(this.options.enabled,ge(this,An))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_n(this,Bn,TT).call(this),ge(this,An).setOptions(this.options),n._defaulted&&!gT(this.options,n)&&ge(this,Xs).getQueryCache().notify({type:"observerOptionsUpdated",query:ge(this,An),observer:this});const i=this.hasListeners();i&&iI(ge(this,An),r,this.options,n)&&_n(this,Bn,F0).call(this),this.updateResult(),i&&(ge(this,An)!==r||ga(this.options.enabled,ge(this,An))!==ga(n.enabled,ge(this,An))||xd(this.options.staleTime,ge(this,An))!==xd(n.staleTime,ge(this,An)))&&_n(this,Bn,_T).call(this);const s=_n(this,Bn,wT).call(this);i&&(ge(this,An)!==r||ga(this.options.enabled,ge(this,An))!==ga(n.enabled,ge(this,An))||s!==ge(this,pd))&&_n(this,Bn,ST).call(this,s)}getOptimisticResult(e){const n=ge(this,Xs).getQueryCache().build(ge(this,Xs),e),r=this.createResult(n,e);return i8(this,r)&&(wt(this,ws,r),wt(this,ug,this.options),wt(this,yh,ge(this,An).state)),r}getCurrentResult(){return ge(this,ws)}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,Nc).status==="pending"&&ge(this,Nc).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){ge(this,hg).add(e)}getCurrentQuery(){return ge(this,An)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=ge(this,Xs).defaultQueryOptions(e),r=ge(this,Xs).getQueryCache().build(ge(this,Xs),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return _n(this,Bn,F0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),ge(this,ws)))}createResult(e,n){var V;const r=ge(this,An),i=this.options,s=ge(this,ws),a=ge(this,yh),o=ge(this,ug),c=e!==r?e.state:ge(this,zy),{state:d}=e;let f={...d},p=!1,y;if(n._optimisticResults){const k=this.hasListeners(),j=!k&&rI(e,n),X=k&&iI(e,r,n,i);(j||X)&&(f={...f,...nF(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:b,errorUpdatedAt:S,status:w}=f;y=f.data;let x=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(o==null?void 0:o.placeholderData)?(k=s.data,x=!0):k=typeof n.placeholderData=="function"?n.placeholderData((V=ge(this,fg))==null?void 0:V.state.data,ge(this,fg)):n.placeholderData,k!==void 0&&(w="success",y=yT(s==null?void 0:s.data,k,n),p=!0)}if(n.select&&y!==void 0&&!x)if(s&&y===(a==null?void 0:a.data)&&n.select===ge(this,By))y=ge(this,dg);else try{wt(this,By,n.select),y=n.select(y),y=yT(s==null?void 0:s.data,y,n),wt(this,dg,y),wt(this,hd,null)}catch(k){wt(this,hd,k)}ge(this,hd)&&(b=ge(this,hd),y=ge(this,dg),S=Date.now(),w="error");const M=f.fetchStatus==="fetching",T=w==="pending",P=w==="error",O=T&&M,N=y!==void 0,z={status:w,fetchStatus:f.fetchStatus,isPending:T,isSuccess:w==="success",isError:P,isInitialLoading:O,isLoading:O,data:y,dataUpdatedAt:f.dataUpdatedAt,error:b,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:P&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:P&&N,isStale:xC(e,n),refetch:this.refetch,promise:ge(this,Nc),isEnabled:ga(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=z.data!==void 0,j=z.status==="error"&&!k,X=pe=>{j?pe.reject(z.error):k&&pe.resolve(z.data)},ee=()=>{const pe=wt(this,Nc,z.promise=xT());X(pe)},ie=ge(this,Nc);switch(ie.status){case"pending":e.queryHash===r.queryHash&&X(ie);break;case"fulfilled":(j||z.data!==ie.value)&&ee();break;case"rejected":(!j||z.error!==ie.reason)&&ee();break}}return z}updateResult(){const e=ge(this,ws),n=this.createResult(ge(this,An),this.options);if(wt(this,yh,ge(this,An).state),wt(this,ug,this.options),ge(this,yh).data!==void 0&&wt(this,fg,ge(this,An)),gT(n,e))return;wt(this,ws,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!ge(this,hg).size)return!0;const a=new Set(s??ge(this,hg));return this.options.throwOnError&&a.add("error"),Object.keys(ge(this,ws)).some(o=>{const l=o;return ge(this,ws)[l]!==e[l]&&a.has(l)})};_n(this,Bn,rF).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_n(this,Bn,MT).call(this)}},Xs=new WeakMap,An=new WeakMap,zy=new WeakMap,ws=new WeakMap,yh=new WeakMap,ug=new WeakMap,Nc=new WeakMap,hd=new WeakMap,By=new WeakMap,dg=new WeakMap,fg=new WeakMap,xh=new WeakMap,bh=new WeakMap,pd=new WeakMap,hg=new WeakMap,Bn=new WeakSet,F0=function(e){_n(this,Bn,TT).call(this);let n=ge(this,An).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(qs)),n},_T=function(){_n(this,Bn,ET).call(this);const e=xd(this.options.staleTime,ge(this,An));if(oy.isServer()||ge(this,ws).isStale||!mT(e))return;const r=qj(ge(this,ws).dataUpdatedAt,e)+1;wt(this,xh,th.setTimeout(()=>{ge(this,ws).isStale||this.updateResult()},r))},wT=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ge(this,An)):this.options.refetchInterval)??!1},ST=function(e){_n(this,Bn,AT).call(this),wt(this,pd,e),!(oy.isServer()||ga(this.options.enabled,ge(this,An))===!1||!mT(ge(this,pd))||ge(this,pd)===0)&&wt(this,bh,th.setInterval(()=>{(this.options.refetchIntervalInBackground||gC.isFocused())&&_n(this,Bn,F0).call(this)},ge(this,pd)))},MT=function(){_n(this,Bn,_T).call(this),_n(this,Bn,ST).call(this,_n(this,Bn,wT).call(this))},ET=function(){ge(this,xh)!==void 0&&(th.clearTimeout(ge(this,xh)),wt(this,xh,void 0))},AT=function(){ge(this,bh)!==void 0&&(th.clearInterval(ge(this,bh)),wt(this,bh,void 0))},TT=function(){const e=ge(this,Xs).getQueryCache().build(ge(this,Xs),this.options);if(e===ge(this,An))return;const n=ge(this,An);wt(this,An,e),wt(this,zy,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},rF=function(e){zi.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(ge(this,ws))}),ge(this,Xs).getQueryCache().notify({query:ge(this,An),type:"observerResultsUpdated"})})},Bj);function r8(t,e){return ga(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&ga(e.retryOnMount,t)===!1)}function rI(t,e){return r8(t,e)||t.state.data!==void 0&&PT(t,e,e.refetchOnMount)}function PT(t,e,n){if(ga(e.enabled,t)!==!1&&xd(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&xC(t,e)}return!1}function iI(t,e,n,r){return(t!==e||ga(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&xC(t,n)}function xC(t,e){return ga(e.enabled,t)!==!1&&t.isStaleByTime(xd(e.staleTime,t))}function i8(t,e){return!gT(t.getCurrentResult(),e)}var Hy,yl,ns,_h,xl,rd,Hj,s8=(Hj=class extends eF{constructor(e){super();Gt(this,xl);Gt(this,Hy);Gt(this,yl);Gt(this,ns);Gt(this,_h);wt(this,Hy,e.client),this.mutationId=e.mutationId,wt(this,ns,e.mutationCache),wt(this,yl,[]),this.state=e.state||a8(),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,ns).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){wt(this,yl,ge(this,yl).filter(n=>n!==e)),this.scheduleGc(),ge(this,ns).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ge(this,yl).length||(this.state.status==="pending"?this.scheduleGc():ge(this,ns).remove(this))}continue(){var e;return((e=ge(this,_h))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,l,c,d,f,p,y,b,S,w,x,M,T,P,O,N,D;const n=()=>{_n(this,xl,rd).call(this,{type:"continue"})},r={client:ge(this,Hy),meta:this.options.meta,mutationKey:this.options.mutationKey};wt(this,_h,Jj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(z,V)=>{_n(this,xl,rd).call(this,{type:"failed",failureCount:z,error:V})},onPause:()=>{_n(this,xl,rd).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ge(this,ns).canRun(this)}));const i=this.state.status==="pending",s=!ge(this,_h).canStart();try{if(i)n();else{_n(this,xl,rd).call(this,{type:"pending",variables:e,isPaused:s}),ge(this,ns).config.onMutate&&await ge(this,ns).config.onMutate(e,this,r);const V=await((o=(a=this.options).onMutate)==null?void 0:o.call(a,e,r));V!==this.state.context&&_n(this,xl,rd).call(this,{type:"pending",context:V,variables:e,isPaused:s})}const z=await ge(this,_h).start();return await((c=(l=ge(this,ns).config).onSuccess)==null?void 0:c.call(l,z,e,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,z,e,this.state.context,r)),await((y=(p=ge(this,ns).config).onSettled)==null?void 0:y.call(p,z,null,this.state.variables,this.state.context,this,r)),await((S=(b=this.options).onSettled)==null?void 0:S.call(b,z,null,e,this.state.context,r)),_n(this,xl,rd).call(this,{type:"success",data:z}),z}catch(z){try{await((x=(w=ge(this,ns).config).onError)==null?void 0:x.call(w,z,e,this.state.context,this,r))}catch(V){Promise.reject(V)}try{await((T=(M=this.options).onError)==null?void 0:T.call(M,z,e,this.state.context,r))}catch(V){Promise.reject(V)}try{await((O=(P=ge(this,ns).config).onSettled)==null?void 0:O.call(P,void 0,z,this.state.variables,this.state.context,this,r))}catch(V){Promise.reject(V)}try{await((D=(N=this.options).onSettled)==null?void 0:D.call(N,void 0,z,e,this.state.context,r))}catch(V){Promise.reject(V)}throw _n(this,xl,rd).call(this,{type:"error",error:z}),z}finally{ge(this,ns).runNext(this)}}},Hy=new WeakMap,yl=new WeakMap,ns=new WeakMap,_h=new WeakMap,xl=new WeakSet,rd=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,ns).notify({mutation:this,type:"updated",action:e})})},Hj);function a8(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ic,Lo,Vy,Vj,o8=(Vj=class extends Gy{constructor(e={}){super();Gt(this,Ic);Gt(this,Lo);Gt(this,Vy);this.config=e,wt(this,Ic,new Set),wt(this,Lo,new Map),wt(this,Vy,0)}build(e,n,r){const i=new s8({client:e,mutationCache:this,mutationId:++fb(this,Vy)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){ge(this,Ic).add(e);const n=pb(e);if(typeof n=="string"){const r=ge(this,Lo).get(n);r?r.push(e):ge(this,Lo).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ge(this,Ic).delete(e)){const n=pb(e);if(typeof n=="string"){const r=ge(this,Lo).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,Lo).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=pb(e);if(typeof n=="string"){const r=ge(this,Lo).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=pb(e);if(typeof n=="string"){const i=(r=ge(this,Lo).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,Ic).forEach(e=>{this.notify({type:"removed",mutation:e})}),ge(this,Ic).clear(),ge(this,Lo).clear()})}getAll(){return Array.from(ge(this,Ic))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>ZN(n,r))}findAll(e={}){return this.getAll().filter(n=>ZN(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(qs))))}},Ic=new WeakMap,Lo=new WeakMap,Vy=new WeakMap,Vj);function pb(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,Gj,l8=(Gj=class extends Gy{constructor(e={}){super();Gt(this,bl);this.config=e,wt(this,bl,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??vC(i,n);let a=this.get(s);return a||(a=new t8({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}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=>YN(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>YN(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,Gj),Mr,md,gd,pg,mg,vd,gg,vg,Wj,c8=(Wj=class{constructor(t={}){Gt(this,Mr);Gt(this,md);Gt(this,gd);Gt(this,pg);Gt(this,mg);Gt(this,vd);Gt(this,gg);Gt(this,vg);wt(this,Mr,t.queryCache||new l8),wt(this,md,t.mutationCache||new o8),wt(this,gd,t.defaultOptions||{}),wt(this,pg,new Map),wt(this,mg,new Map),wt(this,vd,0)}mount(){fb(this,vd)._++,ge(this,vd)===1&&(wt(this,gg,gC.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Mr).onFocus())})),wt(this,vg,ew.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Mr).onOnline())})))}unmount(){var t,e;fb(this,vd)._--,ge(this,vd)===0&&((t=ge(this,gg))==null||t.call(this),wt(this,gg,void 0),(e=ge(this,vg))==null||e.call(this),wt(this,vg,void 0))}isFetching(t){return ge(this,Mr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ge(this,md).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Mr).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=ge(this,Mr).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(xd(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return ge(this,Mr).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,Mr).get(r.queryHash),s=i==null?void 0:i.state.data,a=VW(e,s);if(a!==void 0)return ge(this,Mr).build(this,r).setData(a,{...n,manual:!0})}setQueriesData(t,e,n){return zi.batch(()=>ge(this,Mr).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,Mr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ge(this,Mr);zi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ge(this,Mr);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,Mr).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(qs).catch(qs)}invalidateQueries(t,e={}){return zi.batch(()=>(ge(this,Mr).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,Mr).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(qs)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(qs)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ge(this,Mr).build(this,e);return n.isStaleByTime(xd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(qs).catch(qs)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(qs).catch(qs)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return ew.isOnline()?ge(this,md).resumePausedMutations():Promise.resolve()}getQueryCache(){return ge(this,Mr)}getMutationCache(){return ge(this,md)}getDefaultOptions(){return ge(this,gd)}setDefaultOptions(t){wt(this,gd,t)}setQueryDefaults(t,e){ge(this,pg).set(sy(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ge(this,pg).values()],n={};return e.forEach(r=>{ay(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){ge(this,mg).set(sy(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ge(this,mg).values()],n={};return e.forEach(r=>{ay(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ge(this,gd).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=vC(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===yC&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ge(this,gd).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ge(this,Mr).clear(),ge(this,md).clear()}},Mr=new WeakMap,md=new WeakMap,gd=new WeakMap,pg=new WeakMap,mg=new WeakMap,vd=new WeakMap,gg=new WeakMap,vg=new WeakMap,Wj),iF=R.createContext(void 0),Nd=t=>{const e=R.useContext(iF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},u8=({client:t,children:e})=>(R.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),v.jsx(iF.Provider,{value:t,children:e})),sF=R.createContext(!1),d8=()=>R.useContext(sF);sF.Provider;function f8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var h8=R.createContext(f8()),p8=()=>R.useContext(h8),m8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?Zj(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},g8=t=>{R.useEffect(()=>{t.clearReset()},[t])},v8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||Zj(n,[t.error,r])),y8=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))}},x8=(t,e)=>t.isLoading&&t.isFetching&&!e,b8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,sI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function _8(t,e,n){var y,b,S,w;const r=d8(),i=p8(),s=Nd(),a=s.defaultQueryOptions(t);(b=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||b.call(y,a);const o=s.getQueryCache().get(a.queryHash),l=t.subscribed!==!1;a._optimisticResults=r?"isRestoring":l?"optimistic":void 0,y8(a),m8(a,i,o),g8(i);const c=!s.getQueryCache().get(a.queryHash),[d]=R.useState(()=>new e(s,a)),f=d.getOptimisticResult(a),p=!r&&l;if(R.useSyncExternalStore(R.useCallback(x=>{const M=p?d.subscribe(zi.batchCalls(x)):qs;return d.updateResult(),M},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(a)},[a,d]),b8(a,f))throw sI(a,d,i);if(v8({result:f,errorResetBoundary:i,throwOnError:a.throwOnError,query:o,suspense:a.suspense}))throw f.error;if((w=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,a,f),a.experimental_prefetchInRender&&!oy.isServer()&&x8(f,r)){const x=c?sI(a,d,i):o==null?void 0:o.promise;x==null||x.catch(qs).finally(()=>{d.updateResult()})}return a.notifyOnChangeProps?f:d.trackResult(f)}function bi(t,e){return _8(t,n8)}/** * @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=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();/** + */const w8=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 w8={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 S8={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 S8=R.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...o},l)=>R.createElement("svg",{ref:l,...w8,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:aF("lucide",i),...o},[...a.map(([c,d])=>R.createElement(c,d)),...Array.isArray(s)?s:[s]]));/** + */const M8=R.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:a,...o},l)=>R.createElement("svg",{ref:l,...S8,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:aF("lucide",i),...o},[...a.map(([c,d])=>R.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 dt=(t,e)=>{const n=R.forwardRef(({className:r,...i},s)=>R.createElement(S8,{ref:s,iconNode:e,className:aF(`lucide-${_8(t)}`,r),...i}));return n.displayName=`${t}`,n};/** + */const dt=(t,e)=>{const n=R.forwardRef(({className:r,...i},s)=>R.createElement(M8,{ref:s,iconNode:e,className:aF(`lucide-${w8(t)}`,r),...i}));return n.displayName=`${t}`,n};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -72,7 +72,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const M8=dt("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** + */const E8=dt("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. @@ -87,7 +87,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const E8=dt("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 A8=dt("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. @@ -97,12 +97,17 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. + */const T8=dt("BrainCircuit",[["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:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["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:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** + * @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=dt("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 A8=dt("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 P8=dt("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. @@ -117,7 +122,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const T8=dt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const C8=dt("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. @@ -132,27 +137,27 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const P8=dt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const R8=dt("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 C8=dt("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 N8=dt("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 R8=dt("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 I8=dt("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 N8=dt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + */const k8=dt("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 I8=dt("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"}]]);/** + */const O8=dt("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. @@ -162,7 +167,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const k8=dt("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 L8=dt("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. @@ -172,7 +177,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const O8=dt("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 D8=dt("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. @@ -187,7 +192,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const L8=dt("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 U8=dt("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. @@ -212,17 +217,17 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const D8=dt("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 j8=dt("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 U8=dt("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** + */const F8=dt("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** * @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=dt("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 z8=dt("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. @@ -232,12 +237,12 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const F8=dt("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 B8=dt("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 z8=dt("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 H8=dt("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. @@ -247,7 +252,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const B8=dt("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** + */const V8=dt("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. @@ -257,12 +262,12 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const H8=dt("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 G8=dt("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 V8=dt("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 W8=dt("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. @@ -272,22 +277,22 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const G8=dt("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 $8=dt("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 W8=dt("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 X8=dt("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 $8=dt("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 q8=dt("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 X8=dt("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 K8=dt("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. @@ -297,17 +302,17 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const q8=dt("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 Y8=dt("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 K8=dt("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"}]]);/** + */const Z8=dt("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 Y8=dt("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 Q8=dt("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. @@ -322,22 +327,22 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Z8=dt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** + */const J8=dt("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 Q8=dt("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 e9=dt("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 J8=dt("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 t9=dt("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 e9=dt("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 n9=dt("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. @@ -352,12 +357,12 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const t9=dt("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** + */const r9=dt("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 n9=dt("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 i9=dt("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. @@ -372,7 +377,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const r9=dt("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 s9=dt("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. @@ -382,7 +387,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const i9=dt("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 a9=dt("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. @@ -392,12 +397,12 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const s9=dt("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 o9=dt("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 a9=dt("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 l9=dt("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. @@ -412,7 +417,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const o9=dt("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"}]]);/** + */const c9=dt("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. @@ -427,7 +432,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const l9=dt("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 u9=dt("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. @@ -447,7 +452,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const c9=dt("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 d9=dt("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. @@ -467,8 +472,8 @@ Error generating stack: `+U.message+` * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const wh=dt("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"}]]),z0=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:G8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:nw},{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:$c},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:mF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:fF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:C8}];var uI=1,u9=.9,d9=.8,f9=.17,iE=.1,sE=.999,h9=.9999,p9=.99,m9=/[\\\/_+.#"@\[\(\{&]/,g9=/[\\\/_+.#"@\[\(\{&]/g,v9=/[\s-]/,vF=/[\s-]/g;function UT(t,e,n,r,i,s,a){if(s===e.length)return i===t.length?uI:p9;var o=`${i},${s}`;if(a[o]!==void 0)return a[o];for(var l=r.charAt(s),c=n.indexOf(l,i),d=0,f,p,y,b;c>=0;)f=UT(t,e,n,r,c+1,s+1,a),f>d&&(c===i?f*=uI:m9.test(t.charAt(c-1))?(f*=d9,y=t.slice(i,c-1).match(g9),y&&i>0&&(f*=Math.pow(sE,y.length))):v9.test(t.charAt(c-1))?(f*=u9,b=t.slice(i,c-1).match(vF),b&&i>0&&(f*=Math.pow(sE,b.length))):(f*=f9,i>0&&(f*=Math.pow(sE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=h9)),(ff&&(f=p*iE)),f>d&&(d=f),c=n.indexOf(l,c+1);return a[o]=d,d}function dI(t){return t.toLowerCase().replace(vF," ")}function y9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,UT(t,e,dI(t),dI(e),0,0,{})}function bd(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 _g(...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 x;const{scope:p,children:y,...b}=f,S=((x=p==null?void 0:p[t])==null?void 0:x[l])||o,w=R.useMemo(()=>b,Object.values(b));return v.jsx(S.Provider,{value:w,children:y})};c.displayName=s+"Provider";function d(f,p){var S;const y=((S=p==null?void 0:p[t])==null?void 0:S[l])||o,b=R.useContext(y);if(b)return b;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(a=>R.createContext(a));return function(o){const l=(o==null?void 0:o[t])||s;return R.useMemo(()=>({[`__scope${t}`]:{...o,[t]:l}}),[o,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 a=r.reduce((o,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...o,...f}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var ly=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},_9=G1[" useId ".trim().toString()]||(()=>{}),w9=0;function zc(t){const[e,n]=R.useState(_9());return ly(()=>{n(r=>r??String(w9++))},[t]),e?`radix-${e}`:""}var S9=G1[" useInsertionEffect ".trim().toString()]||ly;function M9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,a]=E9({defaultProp:e,onChange:n}),o=t!==void 0,l=o?t:i;{const d=R.useRef(t!==void 0);R.useEffect(()=>{const f=d.current;f!==o&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${o?"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=o},[o,r])}const c=R.useCallback(d=>{var f;if(o){const p=A9(d)?d(t):d;p!==t&&((f=a.current)==null||f.call(a,p))}else s(d)},[o,t,s,a]);return[l,c]}function E9({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return S9(()=>{s.current=e},[e]),R.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}function A9(t){return typeof t=="function"}var X1=Xj();function yF(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,a=null,o=!1;const l=[];hI(i)&&typeof mb=="function"&&(i=mb(i._payload)),R.Children.forEach(i,p=>{var y;if(N9(p)){o=!0;const b=p;let S="child"in b.props?b.props.child:b.props.children;hI(S)&&typeof mb=="function"&&(S=mb(S._payload)),a=P9(b,S),l.push((y=a==null?void 0:a.props)==null?void 0:y.children)}else l.push(p)}),a?a=R.cloneElement(a,void 0,l):!o&&R.Children.count(i)===1&&R.isValidElement(i)&&(a=i);const c=a?R9(a):void 0,d=Kh(r,c);if(!a){if(i||i===0)throw new Error(o?L9(t):O9(t));return i}const f=C9(s,a.props??{});return a.type!==R.Fragment&&(f.ref=r?d:c),R.cloneElement(a,f)});return e.displayName=`${t}.Slot`,e}var T9=Symbol.for("radix.slottable"),P9=(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 C9(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]=(...o)=>{const l=s(...o);return i(...o),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 R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===T9}var I9=Symbol.for("react.lazy");function hI(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.`,mb=G1[" use ".trim().toString()],D9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Gi=D9.reduce((t,e)=>{const n=yF(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:a,...o}=i,l=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...o,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function U9(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 j9(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 F9="DismissableLayer",jT="dismissableLayer.update",z9="dismissableLayer.pointerDownOutside",B9="dismissableLayer.focusOutside",pI,SC=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xF=R.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=t,d=R.useContext(SC),[f,p]=R.useState(null),y=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=R.useState({}),S=Kh(e,V=>p(V)),w=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),M=w.indexOf(x),T=f?w.indexOf(f):-1,P=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=M,N=R.useRef(!1),D=W9(V=>{const k=V.target;if(!(k instanceof Node))return;const j=[...d.branches].some(X=>X.contains(k));!O||j||(s==null||s(V),o==null||o(V),V.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),z=$9(V=>{if(r&&N.current)return;const k=V.target;[...d.branches].some(X=>X.contains(k))||(a==null||a(V),o==null||o(V),V.defaultPrevented||l==null||l())},y);return j9(V=>{T===d.layers.size-1&&(i==null||i(V),!V.defaultPrevented&&l&&(V.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 V=()=>b({});return document.addEventListener(jT,V),()=>document.removeEventListener(jT,V)},[]),v.jsx(Gi.div,{...c,ref:S,style:{pointerEvents:P?O?"auto":"none":void 0,...t.style},onFocusCapture:bd(t.onFocusCapture,z.onFocusCapture),onBlurCapture:bd(t.onBlurCapture,z.onBlurCapture),onPointerDownCapture:bd(t.onPointerDownCapture,D.onPointerDownCapture)})});xF.displayName=F9;var H9="DismissableLayerBranch",V9=R.forwardRef((t,e)=>{const n=R.useContext(SC),r=R.useRef(null),i=Kh(e,r);return R.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(Gi.div,{...t,ref:i})});V9.displayName=H9;function G9(){const t=R.useContext(SC),[e,n]=R.useState(null);return R.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,a=cy(t),o=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 p(){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 b(M){l.current&&c.current.set(M.type,!1)}const S=M=>{if(M.target&&!o.current){let T=function(){n.removeEventListener("click",d.current);const O=p();f(),O||bF(z9,a,P,{discrete:!0})};const P={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();o.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const M of w)n.addEventListener(M,y,!0),n.addEventListener(M,b);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",S),n.removeEventListener("click",d.current);for(const M of w)n.removeEventListener(M,y,!0),n.removeEventListener(M,b)}},[n,a,r,i,s]),{onPointerDownCapture:()=>o.current=!0}}function $9(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&&bF(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 mI(){const t=new CustomEvent(jT);document.dispatchEvent(t)}function bF(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?U9(i,s):i.dispatchEvent(s)}var aE="focusScope.autoFocusOnMount",oE="focusScope.autoFocusOnUnmount",gI={bubbles:!1,cancelable:!0},X9="FocusScope",_F=R.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=t,[o,l]=R.useState(null),c=cy(i),d=cy(s),f=R.useRef(null),p=Kh(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||!o)return;const P=T.target;o.contains(P)?f.current=P:id(f.current,{select:!0})},w=function(T){if(y.paused||!o)return;const P=T.relatedTarget;P!==null&&(o.contains(P)||id(f.current,{select:!0}))},x=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&id(o)};document.addEventListener("focusin",S),document.addEventListener("focusout",w);const M=new MutationObserver(x);return o&&M.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",w),M.disconnect()}}},[r,o,y.paused]),R.useEffect(()=>{if(o){yI.add(y);const S=document.activeElement;if(!o.contains(S)){const x=new CustomEvent(aE,gI);o.addEventListener(aE,c),o.dispatchEvent(x),x.defaultPrevented||(q9(J9(wF(o)),{select:!0}),document.activeElement===S&&id(o))}return()=>{o.removeEventListener(aE,c),setTimeout(()=>{const x=new CustomEvent(oE,gI);o.addEventListener(oE,d),o.dispatchEvent(x),x.defaultPrevented||id(S??document.body,{select:!0}),o.removeEventListener(oE,d),yI.remove(y)},0)}}},[o,c,d,y]);const b=R.useCallback(S=>{if(!n&&!r||y.paused)return;const w=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,x=document.activeElement;if(w&&x){const M=S.currentTarget,[T,P]=K9(M);T&&P?!S.shiftKey&&x===P?(S.preventDefault(),n&&id(T,{select:!0})):S.shiftKey&&x===T&&(S.preventDefault(),n&&id(P,{select:!0})):x===M&&S.preventDefault()}},[n,r,y.paused]);return v.jsx(Gi.div,{tabIndex:-1,...a,ref:p,onKeyDown:b})});_F.displayName=X9;function q9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(id(r,{select:e}),document.activeElement!==n)return}function K9(t){const e=wF(t),n=vI(e,t),r=vI(e.reverse(),t);return[n,r]}function wF(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(!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 id(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Z9(t)&&e&&t.select()}}var yI=Q9();function Q9(){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 J9(t){return t.filter(e=>e.tagName!=="A")}var e$="Portal",SF=R.forwardRef((t,e)=>{var o;const{container:n,...r}=t,[i,s]=R.useState(!1);ly(()=>s(!0),[]);const a=n||i&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return a?X1.createPortal(v.jsx(Gi.div,{...r,ref:e}),a):null});SF.displayName=e$;function t$(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}var q1=t=>{const{present:e,children:n}=t,r=n$(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=r$(r.ref,i$(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null};q1.displayName="Presence";function n$(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),a=t?"mounted":"unmounted",[o,l]=t$(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=gb(r.current);s.current=o==="mounted"?c:"none"},[o]),ly(()=>{const c=r.current,d=i.current;if(d!==t){const p=s.current,y=gb(c);t?l("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&p!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),ly(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=gb(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)})}},p=y=>{y.target===e&&(s.current=gb(r.current))};return e.addEventListener("animationstart",p),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",p),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(o),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 r$(...t){const e=R.useRef(t);return e.current=t,R.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(a=>{const o=bI(a,n);return!i&&typeof o=="function"&&(i=!0),o});if(i)return()=>{for(let a=0;a{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),vb++,()=>{vb===1&&(dl==null||dl.start.remove(),dl==null||dl.end.remove(),dl=null),vb=Math.max(0,vb-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 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$=TF(),Zm="data-scroll-locked",A$=function(t,e,n,r){var i=t.left,s=t.top,a=t.right,o=t.gap;return n===void 0&&(n="margin"),` - .`.concat(o$,` { + */const wh=dt("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"}]]),z0=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:$8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:nw},{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:$c},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:mF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:fF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:N8}];var uI=1,f9=.9,h9=.8,p9=.17,iE=.1,sE=.999,m9=.9999,g9=.99,v9=/[\\\/_+.#"@\[\(\{&]/,y9=/[\\\/_+.#"@\[\(\{&]/g,x9=/[\s-]/,vF=/[\s-]/g;function UT(t,e,n,r,i,s,a){if(s===e.length)return i===t.length?uI:g9;var o=`${i},${s}`;if(a[o]!==void 0)return a[o];for(var l=r.charAt(s),c=n.indexOf(l,i),d=0,f,p,y,b;c>=0;)f=UT(t,e,n,r,c+1,s+1,a),f>d&&(c===i?f*=uI:v9.test(t.charAt(c-1))?(f*=h9,y=t.slice(i,c-1).match(y9),y&&i>0&&(f*=Math.pow(sE,y.length))):x9.test(t.charAt(c-1))?(f*=f9,b=t.slice(i,c-1).match(vF),b&&i>0&&(f*=Math.pow(sE,b.length))):(f*=p9,i>0&&(f*=Math.pow(sE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=m9)),(ff&&(f=p*iE)),f>d&&(d=f),c=n.indexOf(l,c+1);return a[o]=d,d}function dI(t){return t.toLowerCase().replace(vF," ")}function b9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,UT(t,e,dI(t),dI(e),0,0,{})}function bd(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 _g(...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 x;const{scope:p,children:y,...b}=f,S=((x=p==null?void 0:p[t])==null?void 0:x[l])||o,w=R.useMemo(()=>b,Object.values(b));return v.jsx(S.Provider,{value:w,children:y})};c.displayName=s+"Provider";function d(f,p){var S;const y=((S=p==null?void 0:p[t])==null?void 0:S[l])||o,b=R.useContext(y);if(b)return b;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(a=>R.createContext(a));return function(o){const l=(o==null?void 0:o[t])||s;return R.useMemo(()=>({[`__scope${t}`]:{...o,[t]:l}}),[o,l])}};return i.scopeName=t,[r,w9(i,...e)]}function w9(...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 a=r.reduce((o,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...o,...f}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var ly=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},S9=G1[" useId ".trim().toString()]||(()=>{}),M9=0;function zc(t){const[e,n]=R.useState(S9());return ly(()=>{n(r=>r??String(M9++))},[t]),e?`radix-${e}`:""}var E9=G1[" useInsertionEffect ".trim().toString()]||ly;function A9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,a]=T9({defaultProp:e,onChange:n}),o=t!==void 0,l=o?t:i;{const d=R.useRef(t!==void 0);R.useEffect(()=>{const f=d.current;f!==o&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${o?"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=o},[o,r])}const c=R.useCallback(d=>{var f;if(o){const p=P9(d)?d(t):d;p!==t&&((f=a.current)==null||f.call(a,p))}else s(d)},[o,t,s,a]);return[l,c]}function T9({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return E9(()=>{s.current=e},[e]),R.useEffect(()=>{var a;i.current!==n&&((a=s.current)==null||a.call(s,n),i.current=n)},[n,i]),[n,r,s]}function P9(t){return typeof t=="function"}var X1=Xj();function yF(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,a=null,o=!1;const l=[];hI(i)&&typeof mb=="function"&&(i=mb(i._payload)),R.Children.forEach(i,p=>{var y;if(k9(p)){o=!0;const b=p;let S="child"in b.props?b.props.child:b.props.children;hI(S)&&typeof mb=="function"&&(S=mb(S._payload)),a=R9(b,S),l.push((y=a==null?void 0:a.props)==null?void 0:y.children)}else l.push(p)}),a?a=R.cloneElement(a,void 0,l):!o&&R.Children.count(i)===1&&R.isValidElement(i)&&(a=i);const c=a?I9(a):void 0,d=Kh(r,c);if(!a){if(i||i===0)throw new Error(o?U9(t):D9(t));return i}const f=N9(s,a.props??{});return a.type!==R.Fragment&&(f.ref=r?d:c),R.cloneElement(a,f)});return e.displayName=`${t}.Slot`,e}var C9=Symbol.for("radix.slottable"),R9=(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 N9(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]=(...o)=>{const l=s(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function I9(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 k9(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===C9}var O9=Symbol.for("react.lazy");function hI(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===O9&&"_payload"in t&&L9(t._payload)}function L9(t){return typeof t=="object"&&t!==null&&"then"in t}var D9=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,U9=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,mb=G1[" use ".trim().toString()],j9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Gi=j9.reduce((t,e)=>{const n=yF(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:a,...o}=i,l=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...o,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function F9(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 z9(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 B9="DismissableLayer",jT="dismissableLayer.update",H9="dismissableLayer.pointerDownOutside",V9="dismissableLayer.focusOutside",pI,SC=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xF=R.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=t,d=R.useContext(SC),[f,p]=R.useState(null),y=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=R.useState({}),S=Kh(e,V=>p(V)),w=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),M=w.indexOf(x),T=f?w.indexOf(f):-1,P=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=M,N=R.useRef(!1),D=X9(V=>{const k=V.target;if(!(k instanceof Node))return;const j=[...d.branches].some(X=>X.contains(k));!O||j||(s==null||s(V),o==null||o(V),V.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),z=q9(V=>{if(r&&N.current)return;const k=V.target;[...d.branches].some(X=>X.contains(k))||(a==null||a(V),o==null||o(V),V.defaultPrevented||l==null||l())},y);return z9(V=>{T===d.layers.size-1&&(i==null||i(V),!V.defaultPrevented&&l&&(V.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 V=()=>b({});return document.addEventListener(jT,V),()=>document.removeEventListener(jT,V)},[]),v.jsx(Gi.div,{...c,ref:S,style:{pointerEvents:P?O?"auto":"none":void 0,...t.style},onFocusCapture:bd(t.onFocusCapture,z.onFocusCapture),onBlurCapture:bd(t.onBlurCapture,z.onBlurCapture),onPointerDownCapture:bd(t.onPointerDownCapture,D.onPointerDownCapture)})});xF.displayName=B9;var G9="DismissableLayerBranch",W9=R.forwardRef((t,e)=>{const n=R.useContext(SC),r=R.useRef(null),i=Kh(e,r);return R.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(Gi.div,{...t,ref:i})});W9.displayName=G9;function $9(){const t=R.useContext(SC),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function X9(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,a=cy(t),o=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 p(){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 b(M){l.current&&c.current.set(M.type,!1)}const S=M=>{if(M.target&&!o.current){let T=function(){n.removeEventListener("click",d.current);const O=p();f(),O||bF(H9,a,P,{discrete:!0})};const P={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();o.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const M of w)n.addEventListener(M,y,!0),n.addEventListener(M,b);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",S),n.removeEventListener("click",d.current);for(const M of w)n.removeEventListener(M,y,!0),n.removeEventListener(M,b)}},[n,a,r,i,s]),{onPointerDownCapture:()=>o.current=!0}}function q9(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&&bF(V9,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(jT);document.dispatchEvent(t)}function bF(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?F9(i,s):i.dispatchEvent(s)}var aE="focusScope.autoFocusOnMount",oE="focusScope.autoFocusOnUnmount",gI={bubbles:!1,cancelable:!0},K9="FocusScope",_F=R.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...a}=t,[o,l]=R.useState(null),c=cy(i),d=cy(s),f=R.useRef(null),p=Kh(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||!o)return;const P=T.target;o.contains(P)?f.current=P:id(f.current,{select:!0})},w=function(T){if(y.paused||!o)return;const P=T.relatedTarget;P!==null&&(o.contains(P)||id(f.current,{select:!0}))},x=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&id(o)};document.addEventListener("focusin",S),document.addEventListener("focusout",w);const M=new MutationObserver(x);return o&&M.observe(o,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",w),M.disconnect()}}},[r,o,y.paused]),R.useEffect(()=>{if(o){yI.add(y);const S=document.activeElement;if(!o.contains(S)){const x=new CustomEvent(aE,gI);o.addEventListener(aE,c),o.dispatchEvent(x),x.defaultPrevented||(Y9(t$(wF(o)),{select:!0}),document.activeElement===S&&id(o))}return()=>{o.removeEventListener(aE,c),setTimeout(()=>{const x=new CustomEvent(oE,gI);o.addEventListener(oE,d),o.dispatchEvent(x),x.defaultPrevented||id(S??document.body,{select:!0}),o.removeEventListener(oE,d),yI.remove(y)},0)}}},[o,c,d,y]);const b=R.useCallback(S=>{if(!n&&!r||y.paused)return;const w=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,x=document.activeElement;if(w&&x){const M=S.currentTarget,[T,P]=Z9(M);T&&P?!S.shiftKey&&x===P?(S.preventDefault(),n&&id(T,{select:!0})):S.shiftKey&&x===T&&(S.preventDefault(),n&&id(P,{select:!0})):x===M&&S.preventDefault()}},[n,r,y.paused]);return v.jsx(Gi.div,{tabIndex:-1,...a,ref:p,onKeyDown:b})});_F.displayName=K9;function Y9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(id(r,{select:e}),document.activeElement!==n)return}function Z9(t){const e=wF(t),n=vI(e,t),r=vI(e.reverse(),t);return[n,r]}function wF(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(!Q9(n,{upTo:e}))return n}function Q9(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 J9(t){return t instanceof HTMLInputElement&&"select"in t}function id(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&J9(t)&&e&&t.select()}}var yI=e$();function e$(){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 t$(t){return t.filter(e=>e.tagName!=="A")}var n$="Portal",SF=R.forwardRef((t,e)=>{var o;const{container:n,...r}=t,[i,s]=R.useState(!1);ly(()=>s(!0),[]);const a=n||i&&((o=globalThis==null?void 0:globalThis.document)==null?void 0:o.body);return a?X1.createPortal(v.jsx(Gi.div,{...r,ref:e}),a):null});SF.displayName=n$;function r$(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}var q1=t=>{const{present:e,children:n}=t,r=i$(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=s$(r.ref,a$(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null};q1.displayName="Presence";function i$(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),a=t?"mounted":"unmounted",[o,l]=r$(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=gb(r.current);s.current=o==="mounted"?c:"none"},[o]),ly(()=>{const c=r.current,d=i.current;if(d!==t){const p=s.current,y=gb(c);t?l("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&p!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),ly(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=gb(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)})}},p=y=>{y.target===e&&(s.current=gb(r.current))};return e.addEventListener("animationstart",p),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",p),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(o),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 s$(...t){const e=R.useRef(t);return e.current=t,R.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(a=>{const o=bI(a,n);return!i&&typeof o=="function"&&(i=!0),o});if(i)return()=>{for(let a=0;a{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),vb++,()=>{vb===1&&(dl==null||dl.start.remove(),dl==null||dl.end.remove(),dl=null),vb=Math.max(0,vb-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 M$;var e=E$(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])}},T$=TF(),Zm="data-scroll-locked",P$=function(t,e,n,r){var i=t.left,s=t.top,a=t.right,o=t.gap;return n===void 0&&(n="margin"),` + .`.concat(c$,` { overflow: hidden `).concat(r,`; padding-right: `).concat(o,"px ").concat(r,`; } @@ -502,12 +507,12 @@ Error generating stack: `+U.message+` } body[`).concat(Zm,`] { - `).concat(l$,": ").concat(o,`px; + `).concat(u$,": ").concat(o,`px; } -`)},SI=function(){var t=parseInt(document.body.getAttribute(Zm)||"0",10);return isFinite(t)?t:0},T$=function(){R.useEffect(function(){return document.body.setAttribute(Zm,(SI()+1).toString()),function(){var t=SI()-1;t<=0?document.body.removeAttribute(Zm):document.body.setAttribute(Zm,t.toString())}},[])},P$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;T$();var s=R.useMemo(function(){return M$(i)},[i]);return R.createElement(E$,{styles:A$(s,!e,i,n?"":"!important")})},FT=!1;if(typeof window<"u")try{var yb=Object.defineProperty({},"passive",{get:function(){return FT=!0,!0}});window.addEventListener("test",yb,yb),window.removeEventListener("test",yb,yb)}catch{FT=!1}var nm=FT?{passive:!1}:!1,C$=function(t){return t.tagName==="TEXTAREA"},PF=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!C$(t)&&n[e]==="visible")},R$=function(t){return PF(t,"overflowY")},N$=function(t){return PF(t,"overflowX")},MI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=CF(t,r);if(i){var s=RF(t,r),a=s[1],o=s[2];if(a>o)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]},CF=function(t,e){return t==="v"?R$(e):N$(e)},RF=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),a=s*r,o=n.target,l=e.contains(o),c=!1,d=a>0,f=0,p=0;do{if(!o)break;var y=RF(t,o),b=y[0],S=y[1],w=y[2],x=S-w-s*b;(b||x)&&CF(t,o)&&(f+=x,p+=b);var M=o.parentNode;o=M&&M.nodeType===Node.DOCUMENT_FRAGMENT_NODE?M.host:M}while(!l&&o!==document.body||l&&(e.contains(o)||e===o));return(d&&Math.abs(f)<1||!d&&Math.abs(p)<1)&&(c=!0),c},xb=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},D$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},U$=function(t){return` +`)},SI=function(){var t=parseInt(document.body.getAttribute(Zm)||"0",10);return isFinite(t)?t:0},C$=function(){R.useEffect(function(){return document.body.setAttribute(Zm,(SI()+1).toString()),function(){var t=SI()-1;t<=0?document.body.removeAttribute(Zm):document.body.setAttribute(Zm,t.toString())}},[])},R$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;C$();var s=R.useMemo(function(){return A$(i)},[i]);return R.createElement(T$,{styles:P$(s,!e,i,n?"":"!important")})},FT=!1;if(typeof window<"u")try{var yb=Object.defineProperty({},"passive",{get:function(){return FT=!0,!0}});window.addEventListener("test",yb,yb),window.removeEventListener("test",yb,yb)}catch{FT=!1}var nm=FT?{passive:!1}:!1,N$=function(t){return t.tagName==="TEXTAREA"},PF=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!N$(t)&&n[e]==="visible")},I$=function(t){return PF(t,"overflowY")},k$=function(t){return PF(t,"overflowX")},MI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=CF(t,r);if(i){var s=RF(t,r),a=s[1],o=s[2];if(a>o)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},O$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},L$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},CF=function(t,e){return t==="v"?I$(e):k$(e)},RF=function(t,e){return t==="v"?O$(e):L$(e)},D$=function(t,e){return t==="h"&&e==="rtl"?-1:1},U$=function(t,e,n,r,i){var s=D$(t,window.getComputedStyle(e).direction),a=s*r,o=n.target,l=e.contains(o),c=!1,d=a>0,f=0,p=0;do{if(!o)break;var y=RF(t,o),b=y[0],S=y[1],w=y[2],x=S-w-s*b;(b||x)&&CF(t,o)&&(f+=x,p+=b);var M=o.parentNode;o=M&&M.nodeType===Node.DOCUMENT_FRAGMENT_NODE?M.host:M}while(!l&&o!==document.body||l&&(e.contains(o)||e===o));return(d&&Math.abs(f)<1||!d&&Math.abs(p)<1)&&(c=!0),c},xb=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},j$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},F$=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},j$=0,rm=[];function F$(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(j$++)[0],s=R.useState(TF)[0],a=R.useRef(t);R.useEffect(function(){a.current=t},[t]),R.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=a$([t.lockRef.current],(t.shards||[]).map(AI),!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 o=R.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!a.current.allowPinchZoom;var x=xb(S),M=n.current,T="deltaX"in S?S.deltaX:M[0]-x[0],P="deltaY"in S?S.deltaY:M[1]-x[1],O,N=S.target,D=Math.abs(T)>Math.abs(P)?"h":"v";if("touches"in S&&D==="h"&&N.type==="range")return!1;var z=window.getSelection(),V=z&&z.anchorNode,k=V?V===N||V.contains(N):!1;if(k)return!1;var j=MI(D,N);if(!j)return!0;if(j?O=D:(O=D==="v"?"h":"v",j=MI(D,N)),!j)return!1;if(!r.current&&"changedTouches"in S&&(T||P)&&(r.current=O),!O)return!0;var X=r.current||O;return L$(X,w,S,X==="h"?T:P)},[]),l=R.useCallback(function(S){var w=S;if(!(!rm.length||rm[rm.length-1]!==s)){var x="deltaY"in w?EI(w):xb(w),M=e.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&D$(O.delta,x)})[0];if(M&&M.should){w.cancelable&&w.preventDefault();return}if(!M){var T=(a.current.shards||[]).map(AI).filter(Boolean).filter(function(O){return O.contains(w.target)}),P=T.length>0?o(w,T[0]):!a.current.noIsolation;P&&w.cancelable&&w.preventDefault()}}},[]),c=R.useCallback(function(S,w,x,M){var T={name:S,delta:w,target:x,should:M,shadowParent:z$(x)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(P){return P!==T})},1)},[]),d=R.useCallback(function(S){n.current=xb(S),r.current=void 0},[]),f=R.useCallback(function(S){c(S.type,EI(S),S.target,o(S,t.lockRef.current))},[]),p=R.useCallback(function(S){c(S.type,xb(S),S.target,o(S,t.lockRef.current))},[]);R.useEffect(function(){return rm.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),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,b=t.inert;return R.createElement(R.Fragment,null,b?R.createElement(s,{styles:U$(i)}):null,y?R.createElement(P$,{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$(AF,F$);var NF=R.forwardRef(function(t,e){return R.createElement(K1,_l({},t,{ref:e,sideCar:B$}))});NF.classNames=K1.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,bb=new WeakMap,_b={},dE=0,IF=function(t){return t&&(t.host||IF(t.parentNode))},V$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=IF(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]);_b[n]||(_b[n]=new WeakMap);var s=_b[n],a=[],o=new Set,l=new Set(i),c=function(f){!f||o.has(f)||(o.add(f),c(f.parentNode))};i.forEach(c);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(p){if(o.has(p))d(p);else try{var y=p.getAttribute(r),b=y!==null&&y!=="false",S=(im.get(p)||0)+1,w=(s.get(p)||0)+1;im.set(p,S),s.set(p,w),a.push(p),S===1&&b&&bb.set(p,!0),w===1&&p.setAttribute(n,"true"),b||p.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",p,x)}})};return d(e),o.clear(),dE++,function(){a.forEach(function(f){var p=im.get(f)-1,y=s.get(f)-1;im.set(f,p),s.set(f,y),p||(bb.has(f)||f.removeAttribute(r),bb.delete(f)),y||f.removeAttribute(n)}),dE--,dE||(im=new WeakMap,im=new WeakMap,bb=new WeakMap,_b={})}},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}},Y1="Dialog",[kF]=x9(Y1),[$$,Wo]=kF(Y1),OF=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!0}=t,o=R.useRef(null),l=R.useRef(null),[c,d]=M9({prop:r,defaultProp:i??!1,onChange:s,caller:Y1});return v.jsx($$,{scope:e,triggerRef:o,contentRef:l,contentId:zc(),titleId:zc(),descriptionId:zc(),open:c,onOpenChange:d,onOpenToggle:R.useCallback(()=>d(f=>!f),[d]),modal:a,children:n})};OF.displayName=Y1;var LF="DialogTrigger",X$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wo(LF,n),s=Kh(e,i.triggerRef);return v.jsx(Gi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":EC(i.open),...r,ref:s,onClick:bd(t.onClick,i.onOpenToggle)})});X$.displayName=LF;var MC="DialogPortal",[q$,DF]=kF(MC,{forceMount:void 0}),UF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Wo(MC,e);return v.jsx(q$,{scope:e,forceMount:n,children:R.Children.map(r,a=>v.jsx(q1,{present:n||s.open,children:v.jsx(SF,{asChild:!0,container:i,children:a})}))})};UF.displayName=MC;var iw="DialogOverlay",jF=R.forwardRef((t,e)=>{const n=DF(iw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wo(iw,t.__scopeDialog);return s.modal?v.jsx(q1,{present:r||s.open,children:v.jsx(Y$,{...i,ref:e})}):null});jF.displayName=iw;var K$=yF("DialogOverlay.RemoveScroll"),Y$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wo(iw,n),s=G9(),a=Kh(e,s);return v.jsx(NF,{as:K$,allowPinchZoom:!0,shards:[i.contentRef],children:v.jsx(Gi.div,{"data-state":EC(i.open),...r,ref:a,style:{pointerEvents:"auto",...r.style}})})}),wg="DialogContent",FF=R.forwardRef((t,e)=>{const n=DF(wg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wo(wg,t.__scopeDialog);return v.jsx(q1,{present:r||s.open,children:s.modal?v.jsx(Z$,{...i,ref:e}):v.jsx(Q$,{...i,ref:e})})});FF.displayName=wg;var Z$=R.forwardRef((t,e)=>{const n=Wo(wg,t.__scopeDialog),r=R.useRef(null),i=Kh(e,n.contentRef,r);return R.useEffect(()=>{const s=r.current;if(s)return W$(s)},[]),v.jsx(zF,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:bd(t.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:bd(t.onPointerDownOutside,s=>{const a=s.detail.originalEvent,o=a.button===0&&a.ctrlKey===!0;(a.button===2||o)&&s.preventDefault()}),onFocusOutside:bd(t.onFocusOutside,s=>s.preventDefault())})}),Q$=R.forwardRef((t,e)=>{const n=Wo(wg,t.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return v.jsx(zF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.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 a=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),zF=R.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...a}=t,o=Wo(wg,n);return s$(),v.jsx(v.Fragment,{children:v.jsx(_F,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:v.jsx(xF,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":EC(o.open),...a,ref:e,deferPointerDownOutside:!0,onDismiss:()=>o.onOpenChange(!1)})})})}),BF="DialogTitle",J$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wo(BF,n);return v.jsx(Gi.h2,{id:i.titleId,...r,ref:e})});J$.displayName=BF;var HF="DialogDescription",e7=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wo(HF,n);return v.jsx(Gi.p,{id:i.descriptionId,...r,ref:e})});e7.displayName=HF;var VF="DialogClose",t7=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wo(VF,n);return v.jsx(Gi.button,{type:"button",...r,ref:e,onClick:bd(t.onClick,()=>i.onOpenChange(!1))})});t7.displayName=VF;function EC(t){return t?"open":"closed"}var r0='[cmdk-group=""]',fE='[cmdk-group-items=""]',n7='[cmdk-group-heading=""]',GF='[cmdk-item=""]',TI=`${GF}:not([aria-disabled="true"])`,zT="cmdk-item-select",Dm="data-value",r7=(t,e,n)=>y9(t,e,n),WF=R.createContext(void 0),Wy=()=>R.useContext(WF),$F=R.createContext(void 0),AC=()=>R.useContext($F),XF=R.createContext(void 0),qF=R.forwardRef((t,e)=>{let n=Um(()=>{var G,le;return{search:"",value:(le=(G=t.value)!=null?G:t.defaultValue)!=null?le:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Um(()=>new Set),i=Um(()=>new Map),s=Um(()=>new Map),a=Um(()=>new Set),o=KF(t),{label:l,children:c,value:d,onValueChange:f,filter:p,shouldFilter:y,loop:b,disablePointerSelection:S=!1,vimBindings:w=!0,...x}=t,M=zc(),T=zc(),P=zc(),O=R.useRef(null),N=p7();Nh(()=>{if(d!==void 0){let G=d.trim();n.current.value=G,D.emit()}},[d]),Nh(()=>{N(6,ee)},[]);let D=R.useMemo(()=>({subscribe:G=>(a.current.add(G),()=>a.current.delete(G)),snapshot:()=>n.current,setState:(G,le,se)=>{var ce,Se,we,We;if(!Object.is(n.current[G],le)){if(n.current[G]=le,G==="search")X(),k(),N(1,j);else if(G==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ee=document.getElementById(P);Ee?Ee.focus():(ce=document.getElementById(M))==null||ce.focus()}if(N(7,()=>{var Ee;n.current.selectedItemId=(Ee=ie())==null?void 0:Ee.id,D.emit()}),se||N(5,ee),((Se=o.current)==null?void 0:Se.value)!==void 0){let Ee=le??"";(We=(we=o.current).onValueChange)==null||We.call(we,Ee);return}}D.emit()}},emit:()=>{a.current.forEach(G=>G())}}),[]),z=R.useMemo(()=>({value:(G,le,se)=>{var ce;le!==((ce=s.current.get(G))==null?void 0:ce.value)&&(s.current.set(G,{value:le,keywords:se}),n.current.filtered.items.set(G,V(le,se)),N(2,()=>{k(),D.emit()}))},item:(G,le)=>(r.current.add(G),le&&(i.current.has(le)?i.current.get(le).add(G):i.current.set(le,new Set([G]))),N(3,()=>{X(),k(),n.current.value||j(),D.emit()}),()=>{s.current.delete(G),r.current.delete(G),n.current.filtered.items.delete(G);let se=ie();N(4,()=>{X(),(se==null?void 0:se.getAttribute("id"))===G&&j(),D.emit()})}),group:G=>(i.current.has(G)||i.current.set(G,new Set),()=>{s.current.delete(G),i.current.delete(G)}),filter:()=>o.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:M,inputId:P,labelId:T,listInnerRef:O}),[]);function V(G,le){var se,ce;let Se=(ce=(se=o.current)==null?void 0:se.filter)!=null?ce:r7;return G?Se(G,n.current.search,le):0}function k(){if(!n.current.search||o.current.shouldFilter===!1)return;let G=n.current.filtered.items,le=[];n.current.filtered.groups.forEach(ce=>{let Se=i.current.get(ce),we=0;Se.forEach(We=>{let Ee=G.get(We);we=Math.max(Ee,we)}),le.push([ce,we])});let se=O.current;pe().sort((ce,Se)=>{var we,We;let Ee=ce.getAttribute("id"),Ge=Se.getAttribute("id");return((we=G.get(Ge))!=null?we:0)-((We=G.get(Ee))!=null?We:0)}).forEach(ce=>{let Se=ce.closest(fE);Se?Se.appendChild(ce.parentElement===Se?ce:ce.closest(`${fE} > *`)):se.appendChild(ce.parentElement===se?ce:ce.closest(`${fE} > *`))}),le.sort((ce,Se)=>Se[1]-ce[1]).forEach(ce=>{var Se;let we=(Se=O.current)==null?void 0:Se.querySelector(`${r0}[${Dm}="${encodeURIComponent(ce[0])}"]`);we==null||we.parentElement.appendChild(we)})}function j(){let G=pe().find(se=>se.getAttribute("aria-disabled")!=="true"),le=G==null?void 0:G.getAttribute(Dm);D.setState("value",le||void 0)}function X(){var G,le,se,ce;if(!n.current.search||o.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Se=0;for(let we of r.current){let We=(le=(G=s.current.get(we))==null?void 0:G.value)!=null?le:"",Ee=(ce=(se=s.current.get(we))==null?void 0:se.keywords)!=null?ce:[],Ge=V(We,Ee);n.current.filtered.items.set(we,Ge),Ge>0&&Se++}for(let[we,We]of i.current)for(let Ee of We)if(n.current.filtered.items.get(Ee)>0){n.current.filtered.groups.add(we);break}n.current.filtered.count=Se}function ee(){var G,le,se;let ce=ie();ce&&(((G=ce.parentElement)==null?void 0:G.firstChild)===ce&&((se=(le=ce.closest(r0))==null?void 0:le.querySelector(n7))==null||se.scrollIntoView({block:"nearest"})),ce.scrollIntoView({block:"nearest"}))}function ie(){var G;return(G=O.current)==null?void 0:G.querySelector(`${GF}[aria-selected="true"]`)}function pe(){var G;return Array.from(((G=O.current)==null?void 0:G.querySelectorAll(TI))||[])}function ae(G){let le=pe()[G];le&&D.setState("value",le.getAttribute(Dm))}function he(G){var le;let se=ie(),ce=pe(),Se=ce.findIndex(We=>We===se),we=ce[Se+G];(le=o.current)!=null&&le.loop&&(we=Se+G<0?ce[ce.length-1]:Se+G===ce.length?ce[0]:ce[Se+G]),we&&D.setState("value",we.getAttribute(Dm))}function B(G){let le=ie(),se=le==null?void 0:le.closest(r0),ce;for(;se&&!ce;)se=G>0?f7(se,r0):h7(se,r0),ce=se==null?void 0:se.querySelector(TI);ce?D.setState("value",ce.getAttribute(Dm)):he(G)}let J=()=>ae(pe().length-1),Y=G=>{G.preventDefault(),G.metaKey?J():G.altKey?B(1):he(1)},H=G=>{G.preventDefault(),G.metaKey?ae(0):G.altKey?B(-1):he(-1)};return R.createElement(Gi.div,{ref:e,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:G=>{var le;(le=x.onKeyDown)==null||le.call(x,G);let se=G.nativeEvent.isComposing||G.keyCode===229;if(!(G.defaultPrevented||se))switch(G.key){case"n":case"j":{w&&G.ctrlKey&&Y(G);break}case"ArrowDown":{Y(G);break}case"p":case"k":{w&&G.ctrlKey&&H(G);break}case"ArrowUp":{H(G);break}case"Home":{G.preventDefault(),ae(0);break}case"End":{G.preventDefault(),J();break}case"Enter":{G.preventDefault();let ce=ie();if(ce){let Se=new Event(zT);ce.dispatchEvent(Se)}}}}},R.createElement("label",{"cmdk-label":"",htmlFor:z.inputId,id:z.labelId,style:g7},l),Z1(t,G=>R.createElement($F.Provider,{value:D},R.createElement(WF.Provider,{value:z},G))))}),i7=R.forwardRef((t,e)=>{var n,r;let i=zc(),s=R.useRef(null),a=R.useContext(XF),o=Wy(),l=KF(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;Nh(()=>{if(!c)return o.item(i,a==null?void 0:a.id)},[c]);let d=YF(i,s,[t.value,t.children,s],t.keywords),f=AC(),p=Ad(N=>N.value&&N.value===d.current),y=Ad(N=>c||o.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(zT,b),()=>N.removeEventListener(zT,b)},[y,t.onSelect,t.disabled]);function b(){var N,D;S(),(D=(N=l.current).onSelect)==null||D.call(N,d.current)}function S(){f.setState("value",d.current,!0)}if(!y)return null;let{disabled:w,value:x,onSelect:M,forceMount:T,keywords:P,...O}=t;return R.createElement(Gi.div,{ref:_g(s,e),...O,id:i,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!p,"data-disabled":!!w,"data-selected":!!p,onPointerMove:w||o.getDisablePointerSelection()?void 0:S,onClick:w?void 0:b},t.children)}),s7=R.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,a=zc(),o=R.useRef(null),l=R.useRef(null),c=zc(),d=Wy(),f=Ad(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(a):!0);Nh(()=>d.group(a),[]),YF(a,o,[t.value,t.heading,l]);let p=R.useMemo(()=>({id:a,forceMount:i}),[i]);return R.createElement(Gi.div,{ref:_g(o,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(XF.Provider,{value:p},y))))}),a7=R.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=R.useRef(null),s=Ad(a=>!a.search);return!n&&!s?null:R.createElement(Gi.div,{ref:_g(i,e),...r,"cmdk-separator":"",role:"separator"})}),o7=R.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=AC(),a=Ad(c=>c.search),o=Ad(c=>c.selectedItemId),l=Wy();return R.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),R.createElement(Gi.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":o,id:l.inputId,type:"text",value:i?t.value:a,onChange:c=>{i||s.setState("search",c.target.value),n==null||n(c.target.value)}})}),l7=R.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=R.useRef(null),a=R.useRef(null),o=Ad(c=>c.selectedItemId),l=Wy();return R.useEffect(()=>{if(a.current&&s.current){let c=a.current,d=s.current,f,p=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let y=c.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return p.observe(c),()=>{cancelAnimationFrame(f),p.unobserve(c)}}},[]),R.createElement(Gi.div,{ref:_g(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:l.listId},Z1(t,c=>R.createElement("div",{ref:_g(a,l.listInnerRef),"cmdk-list-sizer":""},c)))}),c7=R.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:a,...o}=t;return R.createElement(OF,{open:n,onOpenChange:r},R.createElement(UF,{container:a},R.createElement(jF,{"cmdk-overlay":"",className:i}),R.createElement(FF,{"aria-label":t.label,"cmdk-dialog":"",className:s},R.createElement(qF,{ref:e,...o}))))}),u7=R.forwardRef((t,e)=>Ad(n=>n.filtered.count===0)?R.createElement(Gi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),d7=R.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return R.createElement(Gi.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Z1(t,a=>R.createElement("div",{"aria-hidden":!0},a)))}),sm=Object.assign(qF,{List:l7,Item:i7,Input:o7,Group:s7,Separator:a7,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 KF(t){let e=R.useRef(t);return Nh(()=>{e.current=t}),e}var Nh=typeof window>"u"?R.useEffect:R.useLayoutEffect;function Um(t){let e=R.useRef();return e.current===void 0&&(e.current=t()),e}function Ad(t){let e=AC(),n=()=>t(e.snapshot());return R.useSyncExternalStore(e.subscribe,n,n)}function YF(t,e,n,r=[]){let i=R.useRef(),s=Wy();return Nh(()=>{var a;let o=(()=>{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,o,l),(a=e.current)==null||a.setAttribute(Dm,o),i.current=o}),i}var p7=()=>{let[t,e]=R.useState(),n=Um(()=>new Map);return Nh(()=>{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 Z1({asChild:t,children:e},n){return t&&R.isValidElement(e)?R.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]=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)},[]),v.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] overscroll-contain",onClick:()=>n(!1),children:v.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:[v.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"}),v.jsxs(sm.List,{className:"max-h-80 overflow-y-auto p-2",children:[v.jsx(sm.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),v.jsx(sm.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:z0.map(r=>v.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:[v.jsx(r.icon,{className:"h-4 w-4 text-primary"}),v.jsx("span",{children:r.label}),v.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:r.hint})]},r.id))})]})]})})}async function It(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 o=await fetch(t,{...e,headers:n,body:s});if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);return o.json()}const y7=(t,e,n=!1,r=!0)=>It("/api/groups",{method:"PUT",body:JSON.stringify({group:t,members:e,swap:n,persist:r})}),x7=t=>It("/api/routing/policy",{method:"PUT",body:JSON.stringify(t)}),qn={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)=>bi({queryKey:qn.memoryGraph,queryFn:()=>It("/api/memory/graph"),enabled:t}),_7=()=>bi({queryKey:qn.health,queryFn:()=>It("/api/health"),refetchInterval:1e4}),$y=(t=5e3)=>bi({queryKey:qn.systemStatus,queryFn:()=>It("/api/system/status"),refetchInterval:t}),w7=(t=3e3)=>bi({queryKey:qn.services,queryFn:()=>It("/api/system/services"),refetchInterval:t}),Bg=(t=4e3)=>bi({queryKey:qn.models,queryFn:()=>It("/api/models"),refetchInterval:t}),S7=(t=8e3)=>bi({queryKey:qn.groups,queryFn:()=>It("/api/groups"),refetchInterval:t}),M7=(t=5e3)=>bi({queryKey:qn.voiceMetrics,queryFn:()=>It("/api/voice/metrics"),refetchInterval:t}),E7=()=>bi({queryKey:qn.routingPolicy,queryFn:()=>It("/api/routing/policy")}),A7=(t=2e3)=>bi({queryKey:qn.jobs,queryFn:()=>It("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),TC=(t=3e3)=>bi({queryKey:qn.tokenStats,queryFn:()=>It("/api/system/token-stats"),refetchInterval:t}),PC=(t=5e3)=>bi({queryKey:qn.agentStatus,queryFn:()=>It("/api/agent/status"),refetchInterval:t}),T7=(t=6e4)=>bi({queryKey:qn.hermesBrain,queryFn:()=>It("/api/agent/brain"),refetchInterval:t}),CC=t=>bi({queryKey:qn.updates,queryFn:()=>It("/api/maintenance/updates"),refetchInterval:t}),P7=()=>bi({queryKey:qn.discover,queryFn:()=>It("/api/discover")}),C7=t=>bi({queryKey:qn.drafts(t),queryFn:()=>It(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),R7=t=>bi({queryKey:qn.connect(t),queryFn:()=>It(t?`/api/connect?${t}`:"/api/connect")}),N7=()=>bi({queryKey:qn.connectHealth,queryFn:()=>It("/api/connect/health"),refetchInterval:15e3}),BT=t=>bi({queryKey:qn.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),It(`/api/memory?${e}`)},select:e=>t!=null&&t.limit?e.slice(0,t.limit):e});let HT=[],VT=[];const GT=new Set,ZF=()=>GT.forEach(t=>t());function QF(t){return GT.add(t),()=>{GT.delete(t)}}function I7(t){HT=[...HT,t].slice(-40),ZF()}function k7(t){VT=[...VT,t].slice(-40),ZF()}const O7=()=>R.useSyncExternalStore(QF,()=>HT),L7=()=>R.useSyncExternalStore(QF,()=>VT);function D7(){const{data:t,dataUpdatedAt:e}=$y(3e3),{data:n,dataUpdatedAt:r}=TC(3e3),i=R.useRef(null);R.useEffect(()=>{var s,a,o,l;t&&I7({t:Date.now(),cpu:((s=t.cpu)==null?void 0:s.percent)??0,ram:((a=t.ram)==null?void 0:a.percent)??0,gpu:((o=t.gpu)==null?void 0:o.busy_percent)??null,disk:((l=t.disk)==null?void 0:l.percent)??null})},[e]),R.useEffect(()=>{if(!n)return;const s=Date.now(),a=n.prompt_tokens,o=n.completion_tokens;if(i.current){const l=Math.max((s-i.current.t)/1e3,.001);k7({t:s,prompt:Math.max(0,(a-i.current.p)/l),completion:Math.max(0,(o-i.current.c)/l)})}i.current={p:a,c:o,t:s}},[r])}function U7(){const{data:t,error:e}=$y(3e3),n=O7();return{sys:t,hist:n,error:e}}function sd(t){return(t/1024**3).toFixed(1)}function WT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Io(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function j7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function PI(t){return t?`${Math.round(t/1024)}k`:"—"}function JF(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{var n=t.children,r=t.width,i=t.height,s=t.viewBox,a=t.className,o=t.style,l=t.title,c=t.desc,d=G7(t,V7),f=s||{width:r,height:i,x:0,y:0},p=tr("recharts-surface",a);return R.createElement("svg",$T({},Xa(d),{className:p,width:r,height:i,style:o,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)}),$7=["children","className"];function XT(){return XT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.className,i=X7(t,$7),s=tr("recharts-layer",r);return R.createElement("g",XT({className:s},Xa(i),{ref:e}),n)}),K7=R.createContext(null);function Er(t){return function(){return t}}const qT=Math.PI,KT=2*qT,$f=1e-6,Y7=KT-$f;function r5(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return r5;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;i$f)if(!(Math.abs(f*l-c*d)>$f)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let y=r-a,b=i-o,S=l*l+c*c,w=y*y+b*b,x=Math.sqrt(S),M=Math.sqrt(p),T=s*Math.tan((qT-Math.acos((S+p-w)/(2*x*M)))/2),P=T/M,O=T/x;Math.abs(P-1)>$f&&this._append`L${e+P*d},${n+P*f}`,this._append`A${s},${s},0,0,${+(f*y>d*b)},${this._x1=e+O*l},${this._y1=n+O*c}`}}arc(e,n,r,i,s,a){if(e=+e,n=+n,r=+r,a=!!a,r<0)throw new Error(`negative radius: ${r}`);let o=r*Math.cos(i),l=r*Math.sin(i),c=e+o,d=n+l,f=1^a,p=a?i-s:s-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>$f||Math.abs(this._y1-d)>$f)&&this._append`L${c},${d}`,r&&(p<0&&(p=p%KT+KT),p>Y7?this._append`A${r},${r},0,1,${f},${e-o},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=d}`:p>$f&&this._append`A${r},${r},0,${+(p>=qT)},${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 i5(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 Q7(e)}function NC(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function s5(t){this._context=t}s5.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 J1(t){return new s5(t)}function a5(t){return t[0]}function o5(t){return t[1]}function l5(t,e){var n=Er(!0),r=null,i=J1,s=null,a=i5(o);t=typeof t=="function"?t:t===void 0?a5:Er(t),e=typeof e=="function"?e:e===void 0?o5:Er(e);function o(l){var c,d=(l=NC(l)).length,f,p=!1,y;for(r==null&&(s=i(y=a())),c=0;c<=d;++c)!(c=y;--b)o.point(T[b],P[b]);o.lineEnd(),o.areaEnd()}x&&(T[p]=+t(w,p,f),P[p]=+e(w,p,f),o.point(r?+r(w,p,f):T[p],n?+n(w,p,f):P[p]))}if(M)return o=null,M+""||null}function d(){return l5().defined(i).curve(a).context(s)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:Er(+f),r=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Er(+f),c):t},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Er(+f),c):r},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:Er(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Er(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Er(+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:Er(!!f),c):i},c.curve=function(f){return arguments.length?(a=f,s!=null&&(o=a(s)),c):a},c.context=function(f){return arguments.length?(f==null?s=o=null:o=a(s=f),c):s},c}class c5{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 J7(t){return new c5(t,!0)}function eX(t){return new c5(t,!1)}function sw(){}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 u5(t){this._context=t}u5.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 tX(t){return new u5(t)}function d5(t){this._context=t}d5.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:aw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function nX(t){return new d5(t)}function f5(t){this._context=t}f5.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 rX(t){return new f5(t)}function h5(t){this._context=t}h5.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 iX(t){return new h5(t)}function CI(t){return t<0?-1:1}function RI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),o=(s*i+a*r)/(r+i);return(CI(s)+CI(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function NI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function hE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,a=t._y1,o=(s-r)/3;t._context.bezierCurveTo(r+o,i+o*e,s-o,a-o*n,s,a)}function ow(t){this._context=t}ow.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:hE(this,this._t0,NI(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,hE(this,NI(this,n=RI(this,t,e)),n);break;default:hE(this,this._t0,n=RI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function p5(t){this._context=new m5(t)}(p5.prototype=Object.create(ow.prototype)).point=function(t,e){ow.prototype.point.call(this,e,t)};function m5(t){this._context=t}m5.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 sX(t){return new ow(t)}function aX(t){return new p5(t)}function g5(t){this._context=t}g5.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=II(t),i=II(e),s=0,a=1;a=0;--e)i[e]=(a[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 eS(t,.5)}function cX(t){return new eS(t,0)}function uX(t){return new eS(t,1)}function Ih(t,e){if((a=t.length)>1)for(var n=1,r,i,s=t[e[0]],a,o=s.length;n=0;)n[e]=e;return n}function dX(t,e){return t[e]}function fX(t){const e=[];return e.key=t,e}function hX(){var t=Er([]),e=YT,n=Ih,r=dX;function i(s){var a=Array.from(t.apply(this,arguments),fX),o,l=a.length,c=-1,d;for(const f of s)for(o=0,++c;o0){for(var n,r,i=0,s=t[0].length,a;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,a;r1&&arguments[1]!==void 0?arguments[1]:yX,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 o=n[a-1];return typeof o=="string"?i+o+s:o!==void 0?i+yd(o)+s:i+s},"")}var Va=t=>t===0?0:t>0?1:-1,Rl=t=>typeof t=="number"&&t!=+t,kh=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,kt=t=>(typeof t=="number"||t instanceof Number)&&!Rl(t),Nl=t=>kt(t)||typeof t=="string",xX=0,uy=t=>{var e=++xX;return"".concat(t||"").concat(e)},Td=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(!kt(e)&&typeof e!="string")return r;var s;if(kh(e)){if(n==null)return r;var a=e.indexOf("%");s=n*parseFloat(e.slice(0,a))/100}else s=+e;return Rl(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},x5=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",OC=t=>Vi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Ys(t){return t!=null}function Hg(){}var _5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,LC=(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=>{RC(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},bX=(t,e,n)=>r=>(t(e,n,r),null),_X=(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];RC(i)&&typeof s=="function"&&(r||(r={}),r[i]=bX(s,e,n))}),r};function kI(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 wX(t){for(var e=1;e(a[o]===void 0&&r[o]!==void 0&&(a[o]=r[o]),a),n);return s}function AX(t,e){const n=new Map;for(let r=0;rObject.prototype.propertyIsEnumerable.call(t,e))}function DC(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const NX="[object RegExp]",S5="[object String]",M5="[object Number]",E5="[object Boolean]",A5="[object Arguments]",IX="[object Symbol]",kX="[object Date]",OX="[object Map]",LX="[object Set]",DX="[object Array]",UX="[object ArrayBuffer]",jX="[object Object]",FX="[object DataView]",zX="[object Uint8Array]",BX="[object Uint8ClampedArray]",HX="[object Uint16Array]",VX="[object Uint32Array]",GX="[object Int8Array]",WX="[object Int16Array]",$X="[object Int32Array]",XX="[object Float32Array]",qX="[object Float64Array]",OI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function KX(t){return typeof OI.Buffer<"u"&&OI.Buffer.isBuffer(t)}function YX(t,e){return nh(t,void 0,t,new Map,e)}function nh(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(QT(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const a=new Array(t.length);r.set(t,a);for(let o=0;o{}):JT(t,e,function r(i,s,a,o,l,c){const d=n(i,s,a,o,l,c);return d!==void 0?!!d:JT(i,s,r,c,!1)},new Map,!0)}function JT(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return JX(t,e,n,r);case"function":return Object.keys(e).length>0?JT(t,{...e},n,r,i):z_(t,e);default:return T5(t)&&i?typeof e=="string"?e==="":!0:z_(t,e)}}function JX(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return C5(t,e,n,r);if(e instanceof Map)return eq(t,e,n,r);if(e instanceof Set)return tq(t,e,n,r);const i=Object.keys(e);if(t==null||QT(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 nq(t){return t=QX(t),e=>R5(e,t)}function rq(t,e){return YX(t,(n,r,i,s)=>{if(typeof t=="object"){if(DC(t)==="[object Object]"&&typeof t.constructor!="function"){const a={};return s.set(t,a),ko(a,t,i,s),a}switch(Object.prototype.toString.call(t)){case M5:case S5:case E5:{const a=new t.constructor(t==null?void 0:t.valueOf());return ko(a,t),a}case A5:{const a={};return ko(a,t),a.length=t.length,a[Symbol.iterator]=t[Symbol.iterator],a}default:return}}})}function iq(t){return rq(t)}const sq=/^(?:0|[1-9]\d*)$/;function N5(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t=0}function I5(t){return t!=null&&typeof t!="function"&&uq(t.length)}function dq(t){return typeof t=="object"&&t!==null}function fq(t){return dq(t)&&I5(t)}function LI(t,e=w5){return fq(t)?AX(Array.from(t),TX(cq(e),1)):[]}function hq(t,e,n){return e===!0?LI(t,n):typeof e=="function"?LI(t,e):t}var pE={exports:{}},mE={},gE={exports:{}},vE={};/** +`)},z$=0,rm=[];function B$(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(z$++)[0],s=R.useState(TF)[0],a=R.useRef(t);R.useEffect(function(){a.current=t},[t]),R.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=l$([t.lockRef.current],(t.shards||[]).map(AI),!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 o=R.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!a.current.allowPinchZoom;var x=xb(S),M=n.current,T="deltaX"in S?S.deltaX:M[0]-x[0],P="deltaY"in S?S.deltaY:M[1]-x[1],O,N=S.target,D=Math.abs(T)>Math.abs(P)?"h":"v";if("touches"in S&&D==="h"&&N.type==="range")return!1;var z=window.getSelection(),V=z&&z.anchorNode,k=V?V===N||V.contains(N):!1;if(k)return!1;var j=MI(D,N);if(!j)return!0;if(j?O=D:(O=D==="v"?"h":"v",j=MI(D,N)),!j)return!1;if(!r.current&&"changedTouches"in S&&(T||P)&&(r.current=O),!O)return!0;var X=r.current||O;return U$(X,w,S,X==="h"?T:P)},[]),l=R.useCallback(function(S){var w=S;if(!(!rm.length||rm[rm.length-1]!==s)){var x="deltaY"in w?EI(w):xb(w),M=e.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&j$(O.delta,x)})[0];if(M&&M.should){w.cancelable&&w.preventDefault();return}if(!M){var T=(a.current.shards||[]).map(AI).filter(Boolean).filter(function(O){return O.contains(w.target)}),P=T.length>0?o(w,T[0]):!a.current.noIsolation;P&&w.cancelable&&w.preventDefault()}}},[]),c=R.useCallback(function(S,w,x,M){var T={name:S,delta:w,target:x,should:M,shadowParent:H$(x)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(P){return P!==T})},1)},[]),d=R.useCallback(function(S){n.current=xb(S),r.current=void 0},[]),f=R.useCallback(function(S){c(S.type,EI(S),S.target,o(S,t.lockRef.current))},[]),p=R.useCallback(function(S){c(S.type,xb(S),S.target,o(S,t.lockRef.current))},[]);R.useEffect(function(){return rm.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:p}),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,b=t.inert;return R.createElement(R.Fragment,null,b?R.createElement(s,{styles:F$(i)}):null,y?R.createElement(R$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function H$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const V$=v$(AF,B$);var NF=R.forwardRef(function(t,e){return R.createElement(K1,_l({},t,{ref:e,sideCar:V$}))});NF.classNames=K1.classNames;var G$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},im=new WeakMap,bb=new WeakMap,_b={},dE=0,IF=function(t){return t&&(t.host||IF(t.parentNode))},W$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=IF(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})},$$=function(t,e,n,r){var i=W$(e,Array.isArray(t)?t:[t]);_b[n]||(_b[n]=new WeakMap);var s=_b[n],a=[],o=new Set,l=new Set(i),c=function(f){!f||o.has(f)||(o.add(f),c(f.parentNode))};i.forEach(c);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(p){if(o.has(p))d(p);else try{var y=p.getAttribute(r),b=y!==null&&y!=="false",S=(im.get(p)||0)+1,w=(s.get(p)||0)+1;im.set(p,S),s.set(p,w),a.push(p),S===1&&b&&bb.set(p,!0),w===1&&p.setAttribute(n,"true"),b||p.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",p,x)}})};return d(e),o.clear(),dE++,function(){a.forEach(function(f){var p=im.get(f)-1,y=s.get(f)-1;im.set(f,p),s.set(f,y),p||(bb.has(f)||f.removeAttribute(r),bb.delete(f)),y||f.removeAttribute(n)}),dE--,dE||(im=new WeakMap,im=new WeakMap,bb=new WeakMap,_b={})}},X$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=G$(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),$$(r,i,n,"aria-hidden")):function(){return null}},Y1="Dialog",[kF]=_9(Y1),[q$,Wo]=kF(Y1),OF=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:a=!0}=t,o=R.useRef(null),l=R.useRef(null),[c,d]=A9({prop:r,defaultProp:i??!1,onChange:s,caller:Y1});return v.jsx(q$,{scope:e,triggerRef:o,contentRef:l,contentId:zc(),titleId:zc(),descriptionId:zc(),open:c,onOpenChange:d,onOpenToggle:R.useCallback(()=>d(f=>!f),[d]),modal:a,children:n})};OF.displayName=Y1;var LF="DialogTrigger",K$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wo(LF,n),s=Kh(e,i.triggerRef);return v.jsx(Gi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":EC(i.open),...r,ref:s,onClick:bd(t.onClick,i.onOpenToggle)})});K$.displayName=LF;var MC="DialogPortal",[Y$,DF]=kF(MC,{forceMount:void 0}),UF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Wo(MC,e);return v.jsx(Y$,{scope:e,forceMount:n,children:R.Children.map(r,a=>v.jsx(q1,{present:n||s.open,children:v.jsx(SF,{asChild:!0,container:i,children:a})}))})};UF.displayName=MC;var iw="DialogOverlay",jF=R.forwardRef((t,e)=>{const n=DF(iw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wo(iw,t.__scopeDialog);return s.modal?v.jsx(q1,{present:r||s.open,children:v.jsx(Q$,{...i,ref:e})}):null});jF.displayName=iw;var Z$=yF("DialogOverlay.RemoveScroll"),Q$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wo(iw,n),s=$9(),a=Kh(e,s);return v.jsx(NF,{as:Z$,allowPinchZoom:!0,shards:[i.contentRef],children:v.jsx(Gi.div,{"data-state":EC(i.open),...r,ref:a,style:{pointerEvents:"auto",...r.style}})})}),wg="DialogContent",FF=R.forwardRef((t,e)=>{const n=DF(wg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wo(wg,t.__scopeDialog);return v.jsx(q1,{present:r||s.open,children:s.modal?v.jsx(J$,{...i,ref:e}):v.jsx(e7,{...i,ref:e})})});FF.displayName=wg;var J$=R.forwardRef((t,e)=>{const n=Wo(wg,t.__scopeDialog),r=R.useRef(null),i=Kh(e,n.contentRef,r);return R.useEffect(()=>{const s=r.current;if(s)return X$(s)},[]),v.jsx(zF,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:bd(t.onCloseAutoFocus,s=>{var a;s.preventDefault(),(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:bd(t.onPointerDownOutside,s=>{const a=s.detail.originalEvent,o=a.button===0&&a.ctrlKey===!0;(a.button===2||o)&&s.preventDefault()}),onFocusOutside:bd(t.onFocusOutside,s=>s.preventDefault())})}),e7=R.forwardRef((t,e)=>{const n=Wo(wg,t.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return v.jsx(zF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var a,o;(a=t.onCloseAutoFocus)==null||a.call(t,s),s.defaultPrevented||(r.current||(o=n.triggerRef.current)==null||o.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 a=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(a))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),zF=R.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...a}=t,o=Wo(wg,n);return o$(),v.jsx(v.Fragment,{children:v.jsx(_F,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:v.jsx(xF,{role:"dialog",id:o.contentId,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"data-state":EC(o.open),...a,ref:e,deferPointerDownOutside:!0,onDismiss:()=>o.onOpenChange(!1)})})})}),BF="DialogTitle",t7=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wo(BF,n);return v.jsx(Gi.h2,{id:i.titleId,...r,ref:e})});t7.displayName=BF;var HF="DialogDescription",n7=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wo(HF,n);return v.jsx(Gi.p,{id:i.descriptionId,...r,ref:e})});n7.displayName=HF;var VF="DialogClose",r7=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wo(VF,n);return v.jsx(Gi.button,{type:"button",...r,ref:e,onClick:bd(t.onClick,()=>i.onOpenChange(!1))})});r7.displayName=VF;function EC(t){return t?"open":"closed"}var r0='[cmdk-group=""]',fE='[cmdk-group-items=""]',i7='[cmdk-group-heading=""]',GF='[cmdk-item=""]',TI=`${GF}:not([aria-disabled="true"])`,zT="cmdk-item-select",Dm="data-value",s7=(t,e,n)=>b9(t,e,n),WF=R.createContext(void 0),Wy=()=>R.useContext(WF),$F=R.createContext(void 0),AC=()=>R.useContext($F),XF=R.createContext(void 0),qF=R.forwardRef((t,e)=>{let n=Um(()=>{var G,le;return{search:"",value:(le=(G=t.value)!=null?G:t.defaultValue)!=null?le:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Um(()=>new Set),i=Um(()=>new Map),s=Um(()=>new Map),a=Um(()=>new Set),o=KF(t),{label:l,children:c,value:d,onValueChange:f,filter:p,shouldFilter:y,loop:b,disablePointerSelection:S=!1,vimBindings:w=!0,...x}=t,M=zc(),T=zc(),P=zc(),O=R.useRef(null),N=g7();Nh(()=>{if(d!==void 0){let G=d.trim();n.current.value=G,D.emit()}},[d]),Nh(()=>{N(6,ee)},[]);let D=R.useMemo(()=>({subscribe:G=>(a.current.add(G),()=>a.current.delete(G)),snapshot:()=>n.current,setState:(G,le,se)=>{var ce,Se,we,We;if(!Object.is(n.current[G],le)){if(n.current[G]=le,G==="search")X(),k(),N(1,j);else if(G==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ee=document.getElementById(P);Ee?Ee.focus():(ce=document.getElementById(M))==null||ce.focus()}if(N(7,()=>{var Ee;n.current.selectedItemId=(Ee=ie())==null?void 0:Ee.id,D.emit()}),se||N(5,ee),((Se=o.current)==null?void 0:Se.value)!==void 0){let Ee=le??"";(We=(we=o.current).onValueChange)==null||We.call(we,Ee);return}}D.emit()}},emit:()=>{a.current.forEach(G=>G())}}),[]),z=R.useMemo(()=>({value:(G,le,se)=>{var ce;le!==((ce=s.current.get(G))==null?void 0:ce.value)&&(s.current.set(G,{value:le,keywords:se}),n.current.filtered.items.set(G,V(le,se)),N(2,()=>{k(),D.emit()}))},item:(G,le)=>(r.current.add(G),le&&(i.current.has(le)?i.current.get(le).add(G):i.current.set(le,new Set([G]))),N(3,()=>{X(),k(),n.current.value||j(),D.emit()}),()=>{s.current.delete(G),r.current.delete(G),n.current.filtered.items.delete(G);let se=ie();N(4,()=>{X(),(se==null?void 0:se.getAttribute("id"))===G&&j(),D.emit()})}),group:G=>(i.current.has(G)||i.current.set(G,new Set),()=>{s.current.delete(G),i.current.delete(G)}),filter:()=>o.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:M,inputId:P,labelId:T,listInnerRef:O}),[]);function V(G,le){var se,ce;let Se=(ce=(se=o.current)==null?void 0:se.filter)!=null?ce:s7;return G?Se(G,n.current.search,le):0}function k(){if(!n.current.search||o.current.shouldFilter===!1)return;let G=n.current.filtered.items,le=[];n.current.filtered.groups.forEach(ce=>{let Se=i.current.get(ce),we=0;Se.forEach(We=>{let Ee=G.get(We);we=Math.max(Ee,we)}),le.push([ce,we])});let se=O.current;pe().sort((ce,Se)=>{var we,We;let Ee=ce.getAttribute("id"),Ge=Se.getAttribute("id");return((we=G.get(Ge))!=null?we:0)-((We=G.get(Ee))!=null?We:0)}).forEach(ce=>{let Se=ce.closest(fE);Se?Se.appendChild(ce.parentElement===Se?ce:ce.closest(`${fE} > *`)):se.appendChild(ce.parentElement===se?ce:ce.closest(`${fE} > *`))}),le.sort((ce,Se)=>Se[1]-ce[1]).forEach(ce=>{var Se;let we=(Se=O.current)==null?void 0:Se.querySelector(`${r0}[${Dm}="${encodeURIComponent(ce[0])}"]`);we==null||we.parentElement.appendChild(we)})}function j(){let G=pe().find(se=>se.getAttribute("aria-disabled")!=="true"),le=G==null?void 0:G.getAttribute(Dm);D.setState("value",le||void 0)}function X(){var G,le,se,ce;if(!n.current.search||o.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let Se=0;for(let we of r.current){let We=(le=(G=s.current.get(we))==null?void 0:G.value)!=null?le:"",Ee=(ce=(se=s.current.get(we))==null?void 0:se.keywords)!=null?ce:[],Ge=V(We,Ee);n.current.filtered.items.set(we,Ge),Ge>0&&Se++}for(let[we,We]of i.current)for(let Ee of We)if(n.current.filtered.items.get(Ee)>0){n.current.filtered.groups.add(we);break}n.current.filtered.count=Se}function ee(){var G,le,se;let ce=ie();ce&&(((G=ce.parentElement)==null?void 0:G.firstChild)===ce&&((se=(le=ce.closest(r0))==null?void 0:le.querySelector(i7))==null||se.scrollIntoView({block:"nearest"})),ce.scrollIntoView({block:"nearest"}))}function ie(){var G;return(G=O.current)==null?void 0:G.querySelector(`${GF}[aria-selected="true"]`)}function pe(){var G;return Array.from(((G=O.current)==null?void 0:G.querySelectorAll(TI))||[])}function ae(G){let le=pe()[G];le&&D.setState("value",le.getAttribute(Dm))}function he(G){var le;let se=ie(),ce=pe(),Se=ce.findIndex(We=>We===se),we=ce[Se+G];(le=o.current)!=null&&le.loop&&(we=Se+G<0?ce[ce.length-1]:Se+G===ce.length?ce[0]:ce[Se+G]),we&&D.setState("value",we.getAttribute(Dm))}function B(G){let le=ie(),se=le==null?void 0:le.closest(r0),ce;for(;se&&!ce;)se=G>0?p7(se,r0):m7(se,r0),ce=se==null?void 0:se.querySelector(TI);ce?D.setState("value",ce.getAttribute(Dm)):he(G)}let J=()=>ae(pe().length-1),Y=G=>{G.preventDefault(),G.metaKey?J():G.altKey?B(1):he(1)},H=G=>{G.preventDefault(),G.metaKey?ae(0):G.altKey?B(-1):he(-1)};return R.createElement(Gi.div,{ref:e,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:G=>{var le;(le=x.onKeyDown)==null||le.call(x,G);let se=G.nativeEvent.isComposing||G.keyCode===229;if(!(G.defaultPrevented||se))switch(G.key){case"n":case"j":{w&&G.ctrlKey&&Y(G);break}case"ArrowDown":{Y(G);break}case"p":case"k":{w&&G.ctrlKey&&H(G);break}case"ArrowUp":{H(G);break}case"Home":{G.preventDefault(),ae(0);break}case"End":{G.preventDefault(),J();break}case"Enter":{G.preventDefault();let ce=ie();if(ce){let Se=new Event(zT);ce.dispatchEvent(Se)}}}}},R.createElement("label",{"cmdk-label":"",htmlFor:z.inputId,id:z.labelId,style:y7},l),Z1(t,G=>R.createElement($F.Provider,{value:D},R.createElement(WF.Provider,{value:z},G))))}),a7=R.forwardRef((t,e)=>{var n,r;let i=zc(),s=R.useRef(null),a=R.useContext(XF),o=Wy(),l=KF(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:a==null?void 0:a.forceMount;Nh(()=>{if(!c)return o.item(i,a==null?void 0:a.id)},[c]);let d=YF(i,s,[t.value,t.children,s],t.keywords),f=AC(),p=Ad(N=>N.value&&N.value===d.current),y=Ad(N=>c||o.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(zT,b),()=>N.removeEventListener(zT,b)},[y,t.onSelect,t.disabled]);function b(){var N,D;S(),(D=(N=l.current).onSelect)==null||D.call(N,d.current)}function S(){f.setState("value",d.current,!0)}if(!y)return null;let{disabled:w,value:x,onSelect:M,forceMount:T,keywords:P,...O}=t;return R.createElement(Gi.div,{ref:_g(s,e),...O,id:i,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!p,"data-disabled":!!w,"data-selected":!!p,onPointerMove:w||o.getDisablePointerSelection()?void 0:S,onClick:w?void 0:b},t.children)}),o7=R.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,a=zc(),o=R.useRef(null),l=R.useRef(null),c=zc(),d=Wy(),f=Ad(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(a):!0);Nh(()=>d.group(a),[]),YF(a,o,[t.value,t.heading,l]);let p=R.useMemo(()=>({id:a,forceMount:i}),[i]);return R.createElement(Gi.div,{ref:_g(o,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(XF.Provider,{value:p},y))))}),l7=R.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=R.useRef(null),s=Ad(a=>!a.search);return!n&&!s?null:R.createElement(Gi.div,{ref:_g(i,e),...r,"cmdk-separator":"",role:"separator"})}),c7=R.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=AC(),a=Ad(c=>c.search),o=Ad(c=>c.selectedItemId),l=Wy();return R.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),R.createElement(Gi.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":o,id:l.inputId,type:"text",value:i?t.value:a,onChange:c=>{i||s.setState("search",c.target.value),n==null||n(c.target.value)}})}),u7=R.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=R.useRef(null),a=R.useRef(null),o=Ad(c=>c.selectedItemId),l=Wy();return R.useEffect(()=>{if(a.current&&s.current){let c=a.current,d=s.current,f,p=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let y=c.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return p.observe(c),()=>{cancelAnimationFrame(f),p.unobserve(c)}}},[]),R.createElement(Gi.div,{ref:_g(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:l.listId},Z1(t,c=>R.createElement("div",{ref:_g(a,l.listInnerRef),"cmdk-list-sizer":""},c)))}),d7=R.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:a,...o}=t;return R.createElement(OF,{open:n,onOpenChange:r},R.createElement(UF,{container:a},R.createElement(jF,{"cmdk-overlay":"",className:i}),R.createElement(FF,{"aria-label":t.label,"cmdk-dialog":"",className:s},R.createElement(qF,{ref:e,...o}))))}),f7=R.forwardRef((t,e)=>Ad(n=>n.filtered.count===0)?R.createElement(Gi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),h7=R.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return R.createElement(Gi.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Z1(t,a=>R.createElement("div",{"aria-hidden":!0},a)))}),sm=Object.assign(qF,{List:u7,Item:a7,Input:c7,Group:o7,Separator:l7,Dialog:d7,Empty:f7,Loading:h7});function p7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function m7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function KF(t){let e=R.useRef(t);return Nh(()=>{e.current=t}),e}var Nh=typeof window>"u"?R.useEffect:R.useLayoutEffect;function Um(t){let e=R.useRef();return e.current===void 0&&(e.current=t()),e}function Ad(t){let e=AC(),n=()=>t(e.snapshot());return R.useSyncExternalStore(e.subscribe,n,n)}function YF(t,e,n,r=[]){let i=R.useRef(),s=Wy();return Nh(()=>{var a;let o=(()=>{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,o,l),(a=e.current)==null||a.setAttribute(Dm,o),i.current=o}),i}var g7=()=>{let[t,e]=R.useState(),n=Um(()=>new Map);return Nh(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function v7(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(v7(e),{ref:e.ref},n(e.props.children)):n(e)}var y7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function x7({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)},[]),v.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] overscroll-contain",onClick:()=>n(!1),children:v.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:[v.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"}),v.jsxs(sm.List,{className:"max-h-80 overflow-y-auto p-2",children:[v.jsx(sm.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),v.jsx(sm.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:z0.map(r=>v.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:[v.jsx(r.icon,{className:"h-4 w-4 text-primary"}),v.jsx("span",{children:r.label}),v.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:r.hint})]},r.id))})]})]})})}async function It(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 o=await fetch(t,{...e,headers:n,body:s});if(!o.ok)throw new Error(`${o.status} ${o.statusText}`);return o.json()}const b7=(t,e,n=!1,r=!0)=>It("/api/groups",{method:"PUT",body:JSON.stringify({group:t,members:e,swap:n,persist:r})}),_7=t=>It("/api/routing/policy",{method:"PUT",body:JSON.stringify(t)}),qn={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"]},w7=(t=!0)=>bi({queryKey:qn.memoryGraph,queryFn:()=>It("/api/memory/graph"),enabled:t}),S7=()=>bi({queryKey:qn.health,queryFn:()=>It("/api/health"),refetchInterval:1e4}),$y=(t=5e3)=>bi({queryKey:qn.systemStatus,queryFn:()=>It("/api/system/status"),refetchInterval:t}),M7=(t=3e3)=>bi({queryKey:qn.services,queryFn:()=>It("/api/system/services"),refetchInterval:t}),Bg=(t=4e3)=>bi({queryKey:qn.models,queryFn:()=>It("/api/models"),refetchInterval:t}),E7=(t=8e3)=>bi({queryKey:qn.groups,queryFn:()=>It("/api/groups"),refetchInterval:t}),A7=(t=5e3)=>bi({queryKey:qn.voiceMetrics,queryFn:()=>It("/api/voice/metrics"),refetchInterval:t}),T7=()=>bi({queryKey:qn.routingPolicy,queryFn:()=>It("/api/routing/policy")}),P7=(t=2e3)=>bi({queryKey:qn.jobs,queryFn:()=>It("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),TC=(t=3e3)=>bi({queryKey:qn.tokenStats,queryFn:()=>It("/api/system/token-stats"),refetchInterval:t}),PC=(t=5e3)=>bi({queryKey:qn.agentStatus,queryFn:()=>It("/api/agent/status"),refetchInterval:t}),C7=(t=6e4)=>bi({queryKey:qn.hermesBrain,queryFn:()=>It("/api/agent/brain"),refetchInterval:t}),CC=t=>bi({queryKey:qn.updates,queryFn:()=>It("/api/maintenance/updates"),refetchInterval:t}),R7=()=>bi({queryKey:qn.discover,queryFn:()=>It("/api/discover")}),N7=t=>bi({queryKey:qn.drafts(t),queryFn:()=>It(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),I7=t=>bi({queryKey:qn.connect(t),queryFn:()=>It(t?`/api/connect?${t}`:"/api/connect")}),k7=()=>bi({queryKey:qn.connectHealth,queryFn:()=>It("/api/connect/health"),refetchInterval:15e3}),BT=t=>bi({queryKey:qn.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),It(`/api/memory?${e}`)},select:e=>t!=null&&t.limit?e.slice(0,t.limit):e});let HT=[],VT=[];const GT=new Set,ZF=()=>GT.forEach(t=>t());function QF(t){return GT.add(t),()=>{GT.delete(t)}}function O7(t){HT=[...HT,t].slice(-40),ZF()}function L7(t){VT=[...VT,t].slice(-40),ZF()}const D7=()=>R.useSyncExternalStore(QF,()=>HT),U7=()=>R.useSyncExternalStore(QF,()=>VT);function j7(){const{data:t,dataUpdatedAt:e}=$y(3e3),{data:n,dataUpdatedAt:r}=TC(3e3),i=R.useRef(null);R.useEffect(()=>{var s,a,o,l;t&&O7({t:Date.now(),cpu:((s=t.cpu)==null?void 0:s.percent)??0,ram:((a=t.ram)==null?void 0:a.percent)??0,gpu:((o=t.gpu)==null?void 0:o.busy_percent)??null,disk:((l=t.disk)==null?void 0:l.percent)??null})},[e]),R.useEffect(()=>{if(!n)return;const s=Date.now(),a=n.prompt_tokens,o=n.completion_tokens;if(i.current){const l=Math.max((s-i.current.t)/1e3,.001);L7({t:s,prompt:Math.max(0,(a-i.current.p)/l),completion:Math.max(0,(o-i.current.c)/l)})}i.current={p:a,c:o,t:s}},[r])}function F7(){const{data:t,error:e}=$y(3e3),n=D7();return{sys:t,hist:n,error:e}}function sd(t){return(t/1024**3).toFixed(1)}function WT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Io(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function z7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function PI(t){return t?`${Math.round(t/1024)}k`:"—"}function JF(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{var n=t.children,r=t.width,i=t.height,s=t.viewBox,a=t.className,o=t.style,l=t.title,c=t.desc,d=$7(t,W7),f=s||{width:r,height:i,x:0,y:0},p=tr("recharts-surface",a);return R.createElement("svg",$T({},Xa(d),{className:p,width:r,height:i,style:o,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)}),q7=["children","className"];function XT(){return XT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.className,i=K7(t,q7),s=tr("recharts-layer",r);return R.createElement("g",XT({className:s},Xa(i),{ref:e}),n)}),Z7=R.createContext(null);function Er(t){return function(){return t}}const qT=Math.PI,KT=2*qT,$f=1e-6,Q7=KT-$f;function r5(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return r5;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;i$f)if(!(Math.abs(f*l-c*d)>$f)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let y=r-a,b=i-o,S=l*l+c*c,w=y*y+b*b,x=Math.sqrt(S),M=Math.sqrt(p),T=s*Math.tan((qT-Math.acos((S+p-w)/(2*x*M)))/2),P=T/M,O=T/x;Math.abs(P-1)>$f&&this._append`L${e+P*d},${n+P*f}`,this._append`A${s},${s},0,0,${+(f*y>d*b)},${this._x1=e+O*l},${this._y1=n+O*c}`}}arc(e,n,r,i,s,a){if(e=+e,n=+n,r=+r,a=!!a,r<0)throw new Error(`negative radius: ${r}`);let o=r*Math.cos(i),l=r*Math.sin(i),c=e+o,d=n+l,f=1^a,p=a?i-s:s-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>$f||Math.abs(this._y1-d)>$f)&&this._append`L${c},${d}`,r&&(p<0&&(p=p%KT+KT),p>Q7?this._append`A${r},${r},0,1,${f},${e-o},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=d}`:p>$f&&this._append`A${r},${r},0,${+(p>=qT)},${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 i5(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 NC(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function s5(t){this._context=t}s5.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 J1(t){return new s5(t)}function a5(t){return t[0]}function o5(t){return t[1]}function l5(t,e){var n=Er(!0),r=null,i=J1,s=null,a=i5(o);t=typeof t=="function"?t:t===void 0?a5:Er(t),e=typeof e=="function"?e:e===void 0?o5:Er(e);function o(l){var c,d=(l=NC(l)).length,f,p=!1,y;for(r==null&&(s=i(y=a())),c=0;c<=d;++c)!(c=y;--b)o.point(T[b],P[b]);o.lineEnd(),o.areaEnd()}x&&(T[p]=+t(w,p,f),P[p]=+e(w,p,f),o.point(r?+r(w,p,f):T[p],n?+n(w,p,f):P[p]))}if(M)return o=null,M+""||null}function d(){return l5().defined(i).curve(a).context(s)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:Er(+f),r=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Er(+f),c):t},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Er(+f),c):r},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:Er(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Er(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Er(+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:Er(!!f),c):i},c.curve=function(f){return arguments.length?(a=f,s!=null&&(o=a(s)),c):a},c.context=function(f){return arguments.length?(f==null?s=o=null:o=a(s=f),c):s},c}class c5{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 tX(t){return new c5(t,!0)}function nX(t){return new c5(t,!1)}function sw(){}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 u5(t){this._context=t}u5.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 rX(t){return new u5(t)}function d5(t){this._context=t}d5.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:aw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function iX(t){return new d5(t)}function f5(t){this._context=t}f5.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 sX(t){return new f5(t)}function h5(t){this._context=t}h5.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 aX(t){return new h5(t)}function CI(t){return t<0?-1:1}function RI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),o=(s*i+a*r)/(r+i);return(CI(s)+CI(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(o))||0}function NI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function hE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,a=t._y1,o=(s-r)/3;t._context.bezierCurveTo(r+o,i+o*e,s-o,a-o*n,s,a)}function ow(t){this._context=t}ow.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:hE(this,this._t0,NI(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,hE(this,NI(this,n=RI(this,t,e)),n);break;default:hE(this,this._t0,n=RI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function p5(t){this._context=new m5(t)}(p5.prototype=Object.create(ow.prototype)).point=function(t,e){ow.prototype.point.call(this,e,t)};function m5(t){this._context=t}m5.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 oX(t){return new ow(t)}function lX(t){return new p5(t)}function g5(t){this._context=t}g5.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=II(t),i=II(e),s=0,a=1;a=0;--e)i[e]=(a[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 uX(t){return new eS(t,.5)}function dX(t){return new eS(t,0)}function fX(t){return new eS(t,1)}function Ih(t,e){if((a=t.length)>1)for(var n=1,r,i,s=t[e[0]],a,o=s.length;n=0;)n[e]=e;return n}function hX(t,e){return t[e]}function pX(t){const e=[];return e.key=t,e}function mX(){var t=Er([]),e=YT,n=Ih,r=hX;function i(s){var a=Array.from(t.apply(this,arguments),pX),o,l=a.length,c=-1,d;for(const f of s)for(o=0,++c;o0){for(var n,r,i=0,s=t[0].length,a;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,a;r1&&arguments[1]!==void 0?arguments[1]:bX,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 o=n[a-1];return typeof o=="string"?i+o+s:o!==void 0?i+yd(o)+s:i+s},"")}var Va=t=>t===0?0:t>0?1:-1,Rl=t=>typeof t=="number"&&t!=+t,kh=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,kt=t=>(typeof t=="number"||t instanceof Number)&&!Rl(t),Nl=t=>kt(t)||typeof t=="string",_X=0,uy=t=>{var e=++_X;return"".concat(t||"").concat(e)},Td=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(!kt(e)&&typeof e!="string")return r;var s;if(kh(e)){if(n==null)return r;var a=e.indexOf("%");s=n*parseFloat(e.slice(0,a))/100}else s=+e;return Rl(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},x5=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",OC=t=>Vi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Ys(t){return t!=null}function Hg(){}var _5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,LC=(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=>{RC(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},wX=(t,e,n)=>r=>(t(e,n,r),null),SX=(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];RC(i)&&typeof s=="function"&&(r||(r={}),r[i]=wX(s,e,n))}),r};function kI(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 MX(t){for(var e=1;e(a[o]===void 0&&r[o]!==void 0&&(a[o]=r[o]),a),n);return s}function PX(t,e){const n=new Map;for(let r=0;rObject.prototype.propertyIsEnumerable.call(t,e))}function DC(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const kX="[object RegExp]",S5="[object String]",M5="[object Number]",E5="[object Boolean]",A5="[object Arguments]",OX="[object Symbol]",LX="[object Date]",DX="[object Map]",UX="[object Set]",jX="[object Array]",FX="[object ArrayBuffer]",zX="[object Object]",BX="[object DataView]",HX="[object Uint8Array]",VX="[object Uint8ClampedArray]",GX="[object Uint16Array]",WX="[object Uint32Array]",$X="[object Int8Array]",XX="[object Int16Array]",qX="[object Int32Array]",KX="[object Float32Array]",YX="[object Float64Array]",OI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function ZX(t){return typeof OI.Buffer<"u"&&OI.Buffer.isBuffer(t)}function QX(t,e){return nh(t,void 0,t,new Map,e)}function nh(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(QT(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const a=new Array(t.length);r.set(t,a);for(let o=0;o{}):JT(t,e,function r(i,s,a,o,l,c){const d=n(i,s,a,o,l,c);return d!==void 0?!!d:JT(i,s,r,c,!1)},new Map,!0)}function JT(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return tq(t,e,n,r);case"function":return Object.keys(e).length>0?JT(t,{...e},n,r,i):z_(t,e);default:return T5(t)&&i?typeof e=="string"?e==="":!0:z_(t,e)}}function tq(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return C5(t,e,n,r);if(e instanceof Map)return nq(t,e,n,r);if(e instanceof Set)return rq(t,e,n,r);const i=Object.keys(e);if(t==null||QT(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 iq(t){return t=eq(t),e=>R5(e,t)}function sq(t,e){return QX(t,(n,r,i,s)=>{if(typeof t=="object"){if(DC(t)==="[object Object]"&&typeof t.constructor!="function"){const a={};return s.set(t,a),ko(a,t,i,s),a}switch(Object.prototype.toString.call(t)){case M5:case S5:case E5:{const a=new t.constructor(t==null?void 0:t.valueOf());return ko(a,t),a}case A5:{const a={};return ko(a,t),a.length=t.length,a[Symbol.iterator]=t[Symbol.iterator],a}default:return}}})}function aq(t){return sq(t)}const oq=/^(?:0|[1-9]\d*)$/;function N5(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t=0}function I5(t){return t!=null&&typeof t!="function"&&fq(t.length)}function hq(t){return typeof t=="object"&&t!==null}function pq(t){return hq(t)&&I5(t)}function LI(t,e=w5){return pq(t)?PX(Array.from(t),CX(dq(e),1)):[]}function mq(t,e,n){return e===!0?LI(t,n):typeof e=="function"?LI(t,e):t}var pE={exports:{}},mE={},gE={exports:{}},vE={};/** * @license React * use-sync-external-store-shim.production.js * @@ -515,7 +520,7 @@ Error generating stack: `+U.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var DI;function pq(){if(DI)return vE;DI=1;var t=qh();function e(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue;function o(f,p){var y=p(),b=r({inst:{value:y,getSnapshot:p}}),S=b[0].inst,w=b[1];return s(function(){S.value=y,S.getSnapshot=p,l(S)&&w({inst:S})},[f,y,p]),i(function(){return l(S)&&w({inst:S}),f(function(){l(S)&&w({inst:S})})},[f]),a(y),y}function l(f){var p=f.getSnapshot;f=f.value;try{var y=p();return!n(f,y)}catch{return!0}}function c(f,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return vE.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,vE}var UI;function mq(){return UI||(UI=1,gE.exports=pq()),gE.exports}/** + */var DI;function gq(){if(DI)return vE;DI=1;var t=qh();function e(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,a=t.useDebugValue;function o(f,p){var y=p(),b=r({inst:{value:y,getSnapshot:p}}),S=b[0].inst,w=b[1];return s(function(){S.value=y,S.getSnapshot=p,l(S)&&w({inst:S})},[f,y,p]),i(function(){return l(S)&&w({inst:S}),f(function(){l(S)&&w({inst:S})})},[f]),a(y),y}function l(f){var p=f.getSnapshot;f=f.value;try{var y=p();return!n(f,y)}catch{return!0}}function c(f,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:o;return vE.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,vE}var UI;function vq(){return UI||(UI=1,gE.exports=gq()),gE.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -523,12 +528,12 @@ Error generating stack: `+U.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var jI;function gq(){if(jI)return mE;jI=1;var t=qh(),e=mq();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,a=t.useEffect,o=t.useMemo,l=t.useDebugValue;return mE.useSyncExternalStoreWithSelector=function(c,d,f,p,y){var b=s(null);if(b.current===null){var S={hasValue:!1,value:null};b.current=S}else S=b.current;b=o(function(){function x(N){if(!M){if(M=!0,T=N,N=p(N),y!==void 0&&S.hasValue){var D=S.value;if(y(D,N))return P=D}return P=N}if(D=P,r(T,N))return D;var z=p(N);return y!==void 0&&y(D,z)?(T=N,D):(T=N,P=z)}var M=!1,T,P,O=f===void 0?null:f;return[function(){return x(d())},O===null?void 0:function(){return x(O())}]},[d,f,p,y]);var w=i(c,b[0],b[1]);return a(function(){S.hasValue=!0,S.value=w},[w]),l(w),w},mE}var FI;function vq(){return FI||(FI=1,pE.exports=gq()),pE.exports}var yq=vq(),UC=R.createContext(null),xq=t=>t,Wr=()=>{var t=R.useContext(UC);return t?t.store.dispatch:xq},B_=()=>{},bq=()=>B_,_q=(t,e)=>t===e;function Ft(t){var e=R.useContext(UC),n=R.useMemo(()=>e?r=>{if(r!=null)return t(r)}:B_,[e,t]);return yq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:bq,e?e.store.getState:B_,e?e.store.getState:B_,n,_q)}function wq(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Sq(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 zI=t=>Array.isArray(t)?t:[t];function Mq(t){const e=Array.isArray(t[0])?t[0]:t;return Sq(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function Eq(t,e){const n=[],{length:r}=t;for(let i=0;itypeof WeakRef>"u"?Aq:WeakRef,k5=Tq(),Pq=0,BI=1;function Sb(){return{s:Pq,v:void 0,o:null,p:null}}function Cq(t){return t instanceof k5?t.deref():t}function O5(t,e={}){let n=Sb();const{resultEqualityCheck:r}=e;let i,s=0;function a(){let o=n;const{length:l}=arguments;for(let f=0,p=l;f{n=Sb(),a.resetResultsCount()},a.resultsCount=()=>s,a.resetResultsCount=()=>{s=0},a}function Rq(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,a=0,o,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),wq(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:p=[],argsMemoize:y=O5,argsMemoizeOptions:b=[]}=d,S=zI(p),w=zI(b),x=Mq(i),M=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){a++;const O=Eq(x,arguments);return o=M.apply(null,O),o},...w);return Object.assign(T,{resultFunc:c,memoizedResultFunc:M,dependencies:x,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>o,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var ke=Rq(O5);function Nq(t,e=1){const n=[],r=Math.floor(e),i=(s,a)=>{for(let o=0;o{if(t!==e){const r=HI(t),i=HI(e);if(r===i&&r===0){if(te)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function L5(t){return typeof t=="symbol"||t instanceof Symbol}const kq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Oq=/^\w*$/;function Lq(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||L5(t)?!0:typeof t=="string"&&(Oq.test(t)||!kq.test(t))||e!=null}function Dq(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(o=>String(o));const i=(o,l)=>{let c=o;for(let d=0;dl==null||o==null?l:typeof o=="object"&&"key"in o?Object.hasOwn(l,o.key)?l[o.key]:i(l,o.path):typeof o=="function"?o(l):Array.isArray(o)?i(l,o):typeof l=="object"?l[o]:l,a=e.map(o=>(Array.isArray(o)&&o.length===1&&(o=o[0]),o==null||typeof o=="function"||Array.isArray(o)||Lq(o)?o:{key:o,path:kC(o)}));return t.map(o=>({original:o,criteria:a.map(l=>s(l,o))})).slice().sort((o,l)=>{for(let c=0;co.original)}function tS(t,...e){const n=e.length;return n>1&&eP(t,e[0],e[1])?e=[]:n>2&&eP(e[0],e[1],e[2])&&(e=[e[0]]),Dq(t,Nq(e),["asc"])}var D5=t=>t.legend.settings,Uq=t=>t.legend.size,jq=t=>t.legend.payload;ke([jq,D5],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?tS(r,n):r});function Fq(t,e){return Vq(t)||Hq(t,e)||Bq(t,e)||zq()}function zq(){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 Bq(t,e){if(t){if(typeof t=="string")return VI(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)?VI(t,e):void 0}}function VI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nMb||Math.abs(t.left-e.left)>Mb||Math.abs(t.top-e.top)>Mb||Math.abs(t.width-e.width)>Mb}function WI(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function Gq(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=R.useState({height:0,left:0,top:0,width:0}),n=Fq(e,2),r=n[0],i=n[1],s=R.useRef(null),a=R.useRef(r);a.current=r;var o=R.useCallback(l=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),l!=null){var c=WI(l);if(GI(c,a.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=WI(l);GI(f,a.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,o]}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 Wq=typeof Symbol=="function"&&Symbol.observable||"@@observable",$I=Wq,yE=()=>Math.random().toString(36).substring(7).split("").join("."),$q={INIT:`@@redux/INIT${yE()}`,REPLACE:`@@redux/REPLACE${yE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yE()}`},lw=$q;function jC(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,a=s,o=0,l=!1;function c(){a===s&&(a=new Map,s.forEach((w,x)=>{a.set(x,w)}))}function d(){if(l)throw new Error(Di(3));return i}function f(w){if(typeof w!="function")throw new Error(Di(4));if(l)throw new Error(Di(5));let x=!0;c();const M=o++;return a.set(M,w),function(){if(x){if(l)throw new Error(Di(6));x=!1,c(),a.delete(M),s=null}}}function p(w){if(!jC(w))throw new Error(Di(7));if(typeof w.type>"u")throw new Error(Di(8));if(typeof w.type!="string")throw new Error(Di(17));if(l)throw new Error(Di(9));try{l=!0,i=r(i,w)}finally{l=!1}return(s=a).forEach(M=>{M()}),w}function y(w){if(typeof w!="function")throw new Error(Di(10));r=w,p({type:lw.REPLACE})}function b(){const w=f;return{subscribe(x){if(typeof x!="object"||x===null)throw new Error(Di(11));function M(){const P=x;P.next&&P.next(d())}return M(),{unsubscribe:w(M)}},[$I](){return this}}}return p({type:lw.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:y,[$I]:b}}function Xq(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 j5(t){const e=Object.keys(t),n={};for(let s=0;s"u")throw o&&o.type,new Error(Di(14));c[f]=b,l=l||b!==y}return l=l||r.length!==Object.keys(a).length,l?c:a}}function cw(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function qq(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(Di(15))};const a={getState:i.getState,dispatch:(l,...c)=>s(l,...c)},o=t.map(l=>l(a));return s=cw(...o)(i.dispatch),{...i,dispatch:s}}}function F5(t){return jC(t)&&"type"in t&&typeof t.type=="string"}var z5=Symbol.for("immer-nothing"),XI=Symbol.for("immer-draftable"),Ps=Symbol.for("immer-state");function Uo(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var xa=Object,Sg=xa.getPrototypeOf,uw="constructor",nS="prototype",tP="configurable",dw="enumerable",H_="writable",dy="value",Xc=t=>!!t&&!!t[Ps];function Bo(t){var e;return t?B5(t)||iS(t)||!!t[XI]||!!((e=t[uw])!=null&&e[XI])||sS(t)||aS(t):!1}var Kq=xa[nS][uw].toString(),qI=new WeakMap;function B5(t){if(!t||!FC(t))return!1;const e=Sg(t);if(e===null||e===xa[nS])return!0;const n=xa.hasOwnProperty.call(e,uw)&&e[uw];if(n===Object)return!0;if(!jm(n))return!1;let r=qI.get(n);return r===void 0&&(r=Function.toString.call(n),qI.set(n,r)),r===Kq}function rS(t,e,n=!0){Xy(t)===0?(n?Reflect.ownKeys(t):xa.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function Xy(t){const e=t[Ps];return e?e.type_:iS(t)?1:sS(t)?2:aS(t)?3:0}var KI=(t,e,n=Xy(t))=>n===2?t.has(e):xa[nS].hasOwnProperty.call(t,e),nP=(t,e,n=Xy(t))=>n===2?t.get(e):t[e],fw=(t,e,n,r=Xy(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function Yq(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var iS=Array.isArray,sS=t=>t instanceof Map,aS=t=>t instanceof Set,FC=t=>typeof t=="object",jm=t=>typeof t=="function",xE=t=>typeof t=="boolean";function Zq(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Cc=t=>t.copy_||t.base_,zC=t=>t.modified_?t.copy_:t.base_;function rP(t,e){if(sS(t))return new Map(t);if(aS(t))return new Set(t);if(iS(t))return Array[nS].slice.call(t);const n=B5(t);if(e===!0||e==="class_only"&&!n){const r=xa.getOwnPropertyDescriptors(t);delete r[Ps];let i=Reflect.ownKeys(r);for(let s=0;s1&&xa.defineProperties(t,{set:Eb,add:Eb,clear:Eb,delete:Eb}),xa.freeze(t),e&&rS(t,(n,r)=>{BC(r,!0)},!1)),t}function Qq(){Uo(2)}var Eb={[dy]:Qq};function oS(t){return t===null||!FC(t)?!0:xa.isFrozen(t)}var hw="MapSet",iP="Patches",YI="ArrayMethods",H5={};function Oh(t){const e=H5[t];return e||Uo(0,t),e}var ZI=t=>!!H5[t],fy,V5=()=>fy,Jq=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ZI(hw)?Oh(hw):void 0,arrayMethodsPlugin_:ZI(YI)?Oh(YI):void 0});function QI(t,e){e&&(t.patchPlugin_=Oh(iP),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function sP(t){aP(t),t.drafts_.forEach(eK),t.drafts_=null}function aP(t){t===fy&&(fy=t.parent_)}var JI=t=>fy=Jq(fy,t);function eK(t){const e=t[Ps];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function ek(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Ps].modified_&&(sP(e),Uo(4)),Bo(t)&&(t=tk(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Ps].base_,t,e)}else t=tk(e,n);return tK(e,t,!0),sP(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==z5?t:void 0}function tk(t,e){if(oS(e))return e;const n=e[Ps];if(!n)return pw(e,t.handledSet_,t);if(!lS(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);$5(n,t)}return n.copy_}function tK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&BC(e,n)}function G5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var lS=(t,e)=>t.scope_===e,nK=[];function W5(t,e,n,r){const i=Cc(t),s=t.type_;if(r!==void 0&&nP(i,r,s)===e){fw(i,r,n,s);return}if(!t.draftLocations_){const o=t.draftLocations_=new Map;rS(i,(l,c)=>{if(Xc(c)){const d=o.get(c)||[];d.push(l),o.set(c,d)}})}const a=t.draftLocations_.get(e)??nK;for(const o of a)fw(i,o,n,s)}function rK(t,e,n){t.callbacks_.push(function(i){var o;const s=e;if(!s||!lS(s,i))return;(o=i.mapSetPlugin_)==null||o.fixSetContents(s);const a=zC(s);W5(t,s.draft_??s,a,n),$5(s,i)})}function $5(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)}G5(t)}}function iK(t,e,n){const{scope_:r}=t;if(Xc(n)){const i=n[Ps];lS(i,r)&&i.callbacks_.push(function(){V_(t);const a=zC(i);W5(t,n,a,e)})}else Bo(n)&&t.callbacks_.push(function(){const s=Cc(t);t.type_===3?s.has(n)&&pw(n,r.handledSet_,r):nP(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&pw(nP(t.copy_,e,t.type_),r.handledSet_,r)})}function pw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Xc(t)||e.has(t)||!Bo(t)||oS(t)||(e.add(t),rS(t,(r,i)=>{if(Xc(i)){const s=i[Ps];if(lS(s,n)){const a=zC(s);fw(t,r,a,t.type_),G5(s)}}else Bo(i)&&pw(i,e,n)})),t}function sK(t,e){const n=iS(t),r={type_:n?1:0,scope_:e?e.scope_:V5(),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:a,proxy:o}=Proxy.revocable(i,s);return r.draft_=o,r.revoke_=a,[o,r]}var mw={get(t,e){if(e===Ps)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=Cc(t);if(!KI(i,e,t.type_))return aK(t,i,e);const s=i[e];if(t.finalized_||!Bo(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&Zq(e))return s;if(s===bE(t.base_,e)){V_(t);const a=t.type_===1?+e:e,o=lP(t.scope_,s,t,a);return t.copy_[a]=o}return s},has(t,e){return e in Cc(t)},ownKeys(t){return Reflect.ownKeys(Cc(t))},set(t,e,n){const r=X5(Cc(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=bE(Cc(t),e),s=i==null?void 0:i[Ps];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(Yq(n,i)&&(n!==void 0||KI(t.base_,e,t.type_)))return!0;V_(t),oP(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),iK(t,e,n)),!0},deleteProperty(t,e){return V_(t),bE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),oP(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Cc(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[H_]:!0,[tP]:t.type_!==1||e!=="length",[dw]:r[dw],[dy]:n[e]}},defineProperty(){Uo(11)},getPrototypeOf(t){return Sg(t.base_)},setPrototypeOf(){Uo(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 bE(t,e){const n=t[Ps];return(n?Cc(n):t)[e]}function aK(t,e,n){var i;const r=X5(e,n);return r?dy in r?r[dy]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function X5(t,e){if(!(e in t))return;let n=Sg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Sg(n)}}function oP(t){t.modified_||(t.modified_=!0,t.parent_&&oP(t.parent_))}function V_(t){t.copy_||(t.assigned_=new Map,t.copy_=rP(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(jm(n)&&!jm(r)){const a=r;r=n;const o=this;return function(c=a,...d){return o.produce(c,f=>r.call(this,f,...d))}}jm(r)||Uo(6),i!==void 0&&!jm(i)&&Uo(7);let s;if(Bo(n)){const a=JI(this),o=lP(a,n,void 0);let l=!0;try{s=r(o),l=!1}finally{l?sP(a):aP(a)}return QI(a,i),ek(s,a)}else if(!n||!FC(n)){if(s=r(n),s===void 0&&(s=n),s===z5&&(s=void 0),this.autoFreeze_&&BC(s,!0),i){const a=[],o=[];Oh(iP).generateReplacementPatches_(n,s,{patches_:a,inversePatches_:o}),i(a,o)}return s}else Uo(1,n)},this.produceWithPatches=(n,r)=>{if(jm(n))return(o,...l)=>this.produceWithPatches(o,c=>n(c,...l));let i,s;return[this.produce(n,r,(o,l)=>{i=o,s=l}),i,s]},xE(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),xE(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),xE(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Bo(e)||Uo(8),Xc(e)&&(e=Ga(e));const n=JI(this),r=lP(n,e,void 0);return r[Ps].isManual_=!0,aP(n),r}finishDraft(e,n){const r=e&&e[Ps];(!r||!r.isManual_)&&Uo(9);const{scope_:i}=r;return QI(i,n),ek(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=Oh(iP).applyPatches_;return Xc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function lP(t,e,n,r){const[i,s]=sS(e)?Oh(hw).proxyMap_(e,n):aS(e)?Oh(hw).proxySet_(e,n):sK(e,n);return((n==null?void 0:n.scope_)??V5()).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 Ga(t){return Xc(t)||Uo(10,t),q5(t)}function q5(t){if(!Bo(t)||oS(t))return t;const e=t[Ps];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=rP(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=rP(t,!0);return rS(n,(i,s)=>{fw(n,i,q5(s))},r),e&&(e.finalized_=!1),n}var lK=new oK,K5=lK.produce;function Y5(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var cK=Y5(),uK=Y5,dK=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 Ma(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(_a(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=>F5(r)&&r.type===t,n}var Z5=class B0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,B0.prototype)}static get[Symbol.species](){return B0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new B0(...e[0].concat(this)):new B0(...e.concat(this))}};function nk(t){return Bo(t)?K5(t,()=>{}):t}function Ab(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 hK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let a=new Z5;return n&&(fK(n)?a.push(cK):a.push(uK(n.extraArgument))),a},Q5="RTK_autoBatch",ar=()=>t=>({payload:t,meta:{[Q5]:!0}}),rk=t=>e=>{setTimeout(e,t)},pK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(a),n())},s=t(i),a=setTimeout(i,e)},J5=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,a=!1;const o=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?pK(window.requestAnimationFrame,100):rk(10):t.type==="callback"?t.queueNotification:rk(t.timeout),c=()=>{a=!1,s&&(s=!1,o.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),p=r.subscribe(f);return o.add(d),()=>{p(),o.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[Q5]),s=!i,s&&(a||(a=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},mK=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new Z5(t);return r&&i.push(J5(typeof r=="object"?r:void 0)),i};function gK(t){const e=hK(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=t||{};let o;if(typeof n=="function")o=n;else if(jC(n))o=j5(n);else throw new Error(_a(1));let l;typeof r=="function"?l=r(e):l=e();let c=cw;i&&(c=dK({trace:!1,...typeof i=="object"&&i}));const d=qq(...l),f=mK(d);let p=typeof a=="function"?a(f):f();const y=c(...p);return U5(o,s,y)}function e4(t){const e={},n=[];let r;const i={addCase(s,a){const o=typeof s=="string"?s:s.type;if(!o)throw new Error(_a(28));if(o in e)throw new Error(_a(29));return e[o]=a,i},addAsyncThunk(s,a){return a.pending&&(e[s.pending.type]=a.pending),a.rejected&&(e[s.rejected.type]=a.rejected),a.fulfilled&&(e[s.fulfilled.type]=a.fulfilled),a.settled&&n.push({matcher:s.settled,reducer:a.settled}),i},addMatcher(s,a){return n.push({matcher:s,reducer:a}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function vK(t){return typeof t=="function"}function yK(t,e){let[n,r,i]=e4(e),s;if(vK(t))s=()=>nk(t());else{const o=nk(t);s=()=>o}function a(o=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(Xc(d)){const y=f(d,l);return y===void 0?d:y}else{if(Bo(d))return K5(d,p=>f(p,l));{const p=f(d,l);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},o)}return a.getInitialState=s,a}var xK="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",bK=(t=21)=>{let e="",n=t;for(;n--;)e+=xK[Math.random()*64|0];return e},_K=Symbol.for("rtk-slice-createasyncthunk");function wK(t,e){return`${t}/${e}`}function SK({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[_K];return function(i){const{name:s,reducerPath:a=s}=i;if(!s)throw new Error(_a(11));const o=(typeof i.reducers=="function"?i.reducers(EK()):i.reducers)||{},l=Object.keys(o),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(P,O){const N=typeof P=="string"?P:P.type;if(!N)throw new Error(_a(12));if(N in c.sliceCaseReducersByType)throw new Error(_a(13));return c.sliceCaseReducersByType[N]=O,d},addMatcher(P,O){return c.sliceMatchers.push({matcher:P,reducer:O}),d},exposeAction(P,O){return c.actionCreators[P]=O,d},exposeCaseReducer(P,O){return c.sliceCaseReducersByName[P]=O,d}};l.forEach(P=>{const O=o[P],N={reducerName:P,type:wK(s,P),createNotation:typeof i.reducers=="function"};TK(O)?CK(N,O,d,e):AK(N,O,d)});function f(){const[P={},O=[],N=void 0]=typeof i.extraReducers=="function"?e4(i.extraReducers):[i.extraReducers],D={...P,...c.sliceCaseReducersByType};return yK(i.initialState,z=>{for(let V in D)z.addCase(V,D[V]);for(let V of c.sliceMatchers)z.addMatcher(V.matcher,V.reducer);for(let V of O)z.addMatcher(V.matcher,V.reducer);N&&z.addDefaultCase(N)})}const p=P=>P,y=new Map,b=new WeakMap;let S;function w(P,O){return S||(S=f()),S(P,O)}function x(){return S||(S=f()),S.getInitialState()}function M(P,O=!1){function N(z){let V=z[P];return typeof V>"u"&&O&&(V=Ab(b,N,x)),V}function D(z=p){const V=Ab(y,O,()=>new WeakMap);return Ab(V,z,()=>{const k={};for(const[j,X]of Object.entries(i.selectors??{}))k[j]=MK(X,z,()=>Ab(b,z,x),O);return k})}return{reducerPath:P,getSelectors:D,get selectors(){return D(N)},selectSlice:N}}const T={name:s,reducer:w,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...M(a),injectInto(P,{reducerPath:O,...N}={}){const D=O??a;return P.inject({reducerPath:D,reducer:w},N),{...T,...M(D,!0)}}};return T}}function MK(t,e,n,r){function i(s,...a){let o=e(s);return typeof o>"u"&&r&&(o=n()),t(o,...a)}return i.unwrapped=t,i}var cs=SK();function EK(){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 AK({type:t,reducerName:e,createNotation:n},r,i){let s,a;if("reducer"in r){if(n&&!PK(r))throw new Error(_a(17));s=r.reducer,a=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,a?Ma(t,a):Ma(t))}function TK(t){return t._reducerDefinitionType==="asyncThunk"}function PK(t){return t._reducerDefinitionType==="reducerWithPrepare"}function CK({type:t,reducerName:e},n,r,i){if(!i)throw new Error(_a(18));const{payloadCreator:s,fulfilled:a,pending:o,rejected:l,settled:c,options:d}=n,f=i(t,s,d);r.exposeAction(e,f),a&&r.addCase(f.fulfilled,a),o&&r.addCase(f.pending,o),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:a||Tb,pending:o||Tb,rejected:l||Tb,settled:c||Tb})}function Tb(){}var RK="task",t4="listener",n4="completed",HC="cancelled",NK=`task-${HC}`,IK=`task-${n4}`,cP=`${t4}-${HC}`,kK=`${t4}-${n4}`,cS=class{constructor(t){Gs(this,"code");Gs(this,"name","TaskAbortError");Gs(this,"message");this.code=t,this.message=`${RK} ${HC} (reason: ${t})`}},VC=(t,e)=>{if(typeof t!="function")throw new TypeError(_a(32))},gw=()=>{},r4=(t,e=gw)=>(t.catch(e),t),i4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),Sh=t=>{if(t.aborted)throw new cS(t.reason)};function s4(t,e){let n=gw;return new Promise((r,i)=>{const s=()=>i(new cS(t.reason));if(t.aborted){s();return}n=i4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=gw})}var OK=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof cS?"cancelled":"rejected",error:n}}finally{e==null||e()}},vw=t=>e=>r4(s4(t,e).then(n=>(Sh(t),n))),a4=t=>{const e=vw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:Qm}=Object,ik={},uS="listenerMiddleware",LK=(t,e)=>{const n=r=>i4(t,()=>r.abort(t.reason));return(r,i)=>{VC(r);const s=new AbortController;n(s);const a=OK(async()=>{Sh(t),Sh(s.signal);const o=await r({pause:vw(s.signal),delay:a4(s.signal),signal:s.signal});return Sh(s.signal),o},()=>s.abort(IK));return i!=null&&i.autoJoin&&e.push(a.catch(gw)),{result:vw(t)(a),cancel(){s.abort(NK)}}}},DK=(t,e)=>{const n=async(r,i)=>{Sh(e);let s=()=>{};const o=[new Promise((l,c)=>{let d=t({predicate:r,effect:(f,p)=>{p.unsubscribe(),l([f,p.getState(),p.getOriginalState()])}});s=()=>{d(),c()}})];i!=null&&o.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await s4(e,Promise.race(o));return Sh(e),l}finally{s()}};return((r,i)=>r4(n(r,i)))},o4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Ma(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(_a(21));return VC(s),{predicate:i,type:e,effect:s}},l4=Qm(t=>{const{type:e,predicate:n,effect:r}=o4(t);return{id:bK(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(_a(22))}}},{withTypes:()=>l4}),sk=(t,e)=>{const{type:n,effect:r,predicate:i}=o4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},uP=t=>{t.pending.forEach(e=>{e.abort(cP)})},UK=(t,e)=>()=>{for(const n of e.keys())uP(n);t.clear()},ak=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},c4=Qm(Ma(`${uS}/add`),{withTypes:()=>c4}),jK=Ma(`${uS}/removeAll`),u4=Qm(Ma(`${uS}/remove`),{withTypes:()=>u4}),FK=(...t)=>{console.error(`${uS}/error`,...t)},qy=(t={})=>{const e=new Map,n=new Map,r=y=>{const b=n.get(y)??0;n.set(y,b+1)},i=y=>{const b=n.get(y)??1;b===1?n.delete(y):n.set(y,b-1)},{extra:s,onError:a=FK}=t;VC(a);const o=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),b=>{y.unsubscribe(),b!=null&&b.cancelActive&&uP(y)}),l=(y=>{const b=sk(e,y)??l4(y);return o(b)});Qm(l,{withTypes:()=>l});const c=y=>{const b=sk(e,y);return b&&(b.unsubscribe(),y.cancelActive&&uP(b)),!!b};Qm(c,{withTypes:()=>c});const d=async(y,b,S,w)=>{const x=new AbortController,M=DK(l,x.signal),T=[];try{y.pending.add(x),r(y),await Promise.resolve(y.effect(b,Qm({},S,{getOriginalState:w,condition:(P,O)=>M(P,O).then(Boolean),take:M,delay:a4(x.signal),pause:vw(x.signal),extra:s,signal:x.signal,fork:LK(x.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((P,O,N)=>{P!==x&&(P.abort(cP),N.delete(P))})},cancel:()=>{x.abort(cP),y.pending.delete(x)},throwIfCancelled:()=>{Sh(x.signal)}})))}catch(P){P instanceof cS||ak(a,P,{raisedBy:"effect"})}finally{await Promise.all(T),x.abort(kK),i(y),y.pending.delete(x)}},f=UK(e,n);return{middleware:y=>b=>S=>{if(!F5(S))return b(S);if(c4.match(S))return l(S.payload);if(jK.match(S)){f();return}if(u4.match(S))return c(S.payload);let w=y.getState();const x=()=>{if(w===ik)throw new Error(_a(23));return w};let M;try{if(M=b(S),e.size>0){const T=y.getState(),P=Array.from(e.values());for(const O of P){let N=!1;try{N=O.predicate(S,T,w)}catch(D){N=!1,ak(a,D,{raisedBy:"predicate"})}N&&d(O,S,y,x)}}}finally{w=ik}return M},startListening:l,stopListening:c,clearListeners:f}};function _a(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 zK={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},d4=cs({name:"chartLayout",initialState:zK,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}}}),dS=d4.actions,BK=dS.setMargin,HK=dS.setLayout,VK=dS.setChartSize,GK=dS.setScale,WK=d4.reducer;function f4(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function wn(t){return Number.isFinite(t)}function Il(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function ok(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 Gm(t){for(var e=1;e{if(e&&n){var r=n.width,i=n.height,s=e.align,a=e.verticalAlign,o=e.layout;if((o==="vertical"||o==="horizontal"&&a==="middle")&&s!=="center"&&kt(t[s]))return Gm(Gm({},t),{},{[s]:t[s]+(r||0)});if((o==="horizontal"||o==="vertical"&&s==="center")&&a!=="middle"&&kt(t[a]))return Gm(Gm({},t),{},{[a]:t[a]+(i||0)})}return t},jl=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",h4=(t,e,n,r)=>{if(r)return t.map(o=>o.coordinate);var i,s,a=t.map(o=>(o.coordinate===e&&(i=!0),o.coordinate===n&&(s=!0),o.coordinate));return i||a.push(e),s||a.push(n),a},p4=(t,e,n)=>{if(!t)return null;var r=t.duplicateDomain,i=t.type,s=t.range,a=t.scale,o=t.realScaleType,l=t.isCategorical,c=t.categoricalDomain,d=t.tickCount,f=t.ticks,p=t.niceTicks,y=t.axisType;if(!a)return null;var b=o==="scaleBand"&&a.bandwidth?a.bandwidth()/2:2,S=i==="category"&&a.bandwidth?a.bandwidth()/b:0;if(S=y==="angleAxis"&&s&&s.length>=2?Va(s[0]-s[1])*2*S:S,f||p){var w=(f||p||[]).map((x,M)=>{var T=r?r.indexOf(x):x,P=a.map(T);return wn(P)?{coordinate:P+S,value:x,offset:S,index:M}:null}).filter(Ys);return w}return l&&c?c.map((x,M)=>{var T=a.map(x);return wn(T)?{coordinate:T+S,value:x,index:M,offset:S}:null}).filter(Ys):a.ticks&&d!=null?a.ticks(d).map((x,M)=>{var T=a.map(x);return wn(T)?{coordinate:T+S,value:x,index:M,offset:S}:null}).filter(Ys):a.domain().map((x,M)=>{var T=a.map(x);return wn(T)?{coordinate:T+S,value:r?r[x]:x,index:M,offset:S}:null}).filter(Ys)},YK=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+=p,c[1]=s):(c[0]=a,a+=p,c[1]=a)}}}},ZK=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)}}}},QK={sign:YK,expand:pX,none:Ih,silhouette:mX,wiggle:gX,positive:ZK},JK=(t,e,n)=>{var r,i=(r=QK[n])!==null&&r!==void 0?r:Ih,s=hX().keys(e).value((o,l)=>Number(yi(o,l,0))).order(YT).offset(i),a=s(t);return a.forEach((o,l)=>{o.forEach((c,d)=>{var f=yi(t[d],e[l],0);Array.isArray(f)&&f.length===2&&kt(f[0])&&kt(f[1])&&(c[0]=f[0],c[1]=f[1])})}),a};function eY(t){return t==null?void 0:String(t)}function lk(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,a=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Vi(i[e.dataKey])){var o=b5(n,"value",i[e.dataKey]);if(o)return o.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var l=yi(i,Vi(a)?e.dataKey:a),c=e.scale.map(l);return kt(c)?c:null}var tY=t=>{var e=t.flat(2).filter(kt);return[Math.min(...e),Math.max(...e)]},nY=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 nY(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var a=s.stackedData,o=a.reduce((l,c)=>{var d=f4(c,e,n),f=tY(d);return!wn(f[0])||!wn(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},ck=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,uk=/^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=tS(e,d=>d.coordinate),s=1/0,a=1,o=i.length;a{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},sY=(t,e)=>e==="centric"?t.angle:t.radius,Jc=t=>t.layout.width,eu=t=>t.layout.height,aY=t=>t.layout.scale,g4=t=>t.layout.margin,fS=ke(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),hS=ke(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),oY="data-recharts-item-index",lY="data-recharts-item-id",Ky=60;function fk(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 Pb(t){for(var e=1;et.brush.height;function hY(t){var e=hS(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Ky;return n+i}return n},0)}function pY(t){var e=hS(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Ky;return n+i}return n},0)}function mY(t){var e=fS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function gY(t){var e=fS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Wi=ke([Jc,eu,g4,fY,hY,pY,mY,gY,D5,Uq],(t,e,n,r,i,s,a,o,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+a,bottom:(n.bottom||0)+o},p=Pb(Pb({},f),d),y=p.bottom;p.bottom+=r,p=KK(p,l,c);var b=t-p.left-p.right,S=e-p.top-p.bottom;return Pb(Pb({brushBottom:y},p),{},{width:Math.max(b,0),height:Math.max(S,0)})}),vY=ke(Wi,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),v4=ke(Jc,eu,(t,e)=>({x:0,y:0,width:t,height:e})),yY=R.createContext(null),Js=()=>R.useContext(yY)!=null,pS=t=>t.brush,mS=ke([pS,Wi,g4],(t,e,n)=>({height:t.height,x:kt(t.x)?t.x:e.left,y:kt(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:kt(t.width)?t.width:e.width}));function xY(t,e,{signal:n,edges:r}={}){let i,s=null;const a=r!=null&&r.includes("leading"),o=r==null||r.includes("trailing"),l=()=>{s!==null&&(t.apply(i,s),i=void 0,s=null)},c=()=>{o&&l(),y()};let d=null;const f=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},e)},p=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{p(),i=void 0,s=null},b=()=>{l()},S=function(...w){if(n!=null&&n.aborted)return;i=this,s=w;const x=d==null;f(),a&&x&&l()};return S.schedule=f,S.cancel=y,S.flush=b,n==null||n.addEventListener("abort",y,{once:!0}),S}function bY(t,e=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:s}=n,a=Array(2);r&&(a[0]="leading"),i&&(a[1]="trailing");let o,l=null;const c=xY(function(...p){o=t.apply(this,p),l=null},e,{edges:a}),d=function(...p){return s!=null&&(l===null&&(l=Date.now()),Date.now()-l>=s)?(o=t.apply(this,p),l=Date.now(),c.cancel(),c.schedule(),o):(c.apply(this,p),o)},f=()=>(c.flush(),o);return d.cancel=c.cancel,d.flush=f,d}function _Y(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return bY(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[a++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},y4=(t,e,n)=>{var r=n.width,i=r===void 0?wl.width:r,s=n.height,a=s===void 0?wl.height:s,o=n.aspect,l=n.maxHeight,c=kh(i)?t:Number(i),d=kh(a)?e:Number(a);return o&&o>0&&(c?d=c/o:d&&(c=d*o),l&&d!=null&&d>l&&(d=l)),{calculatedWidth:c,calculatedHeight:d}},wY={width:0,height:0,overflow:"visible"},SY={width:0,overflowX:"visible"},MY={height:0,overflowY:"visible"},EY={},AY=t=>{var e=t.width,n=t.height,r=kh(e),i=kh(n);return r&&i?wY:r?SY:i?MY:EY};function TY(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 PY=["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 FY(i)?R.createElement(x4.Provider,{value:i},e):null}var GC=()=>R.useContext(x4),zY=R.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,i=r===void 0?wl.initialDimension:r,s=t.width,a=t.height,o=t.minWidth,l=o===void 0?wl.minWidth:o,c=t.minHeight,d=t.maxHeight,f=t.children,p=t.debounce,y=p===void 0?wl.debounce:p,b=t.id,S=t.className,w=t.onResize,x=t.style,M=x===void 0?{}:x,T=UY(t,PY),P=R.useRef(null),O=R.useRef();O.current=w,R.useImperativeHandle(e,()=>P.current);var N=R.useState({containerWidth:i.width,containerHeight:i.height}),D=IY(N,2),z=D[0],V=D[1],k=R.useCallback((ae,he)=>{V(B=>{var J=Math.round(ae),Y=Math.round(he);return B.containerWidth===J&&B.containerHeight===Y?B:{containerWidth:J,containerHeight:Y}})},[]);R.useEffect(()=>{if(P.current==null||typeof ResizeObserver>"u")return Hg;var ae=H=>{var G,le=H[0];if(le!=null){var se=le.contentRect,ce=se.width,Se=se.height;k(ce,Se),(G=O.current)===null||G===void 0||G.call(O,ce,Se)}};y>0&&(ae=_Y(ae,y,{trailing:!0,leading:!1}));var he=new ResizeObserver(ae),B=P.current.getBoundingClientRect(),J=B.width,Y=B.height;return k(J,Y),he.observe(P.current),()=>{he.disconnect()}},[k,y]);var j=z.containerWidth,X=z.containerHeight;xw(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ee=y4(j,X,{width:s,height:a,aspect:n,maxHeight:d}),ie=ee.calculatedWidth,pe=ee.calculatedHeight;return xw(j<0||X<0||ie!=null&&ie>0||pe!=null&&pe>0,`The width(%s) and height(%s) of chart should be greater than 0, + */var jI;function yq(){if(jI)return mE;jI=1;var t=qh(),e=vq();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,a=t.useEffect,o=t.useMemo,l=t.useDebugValue;return mE.useSyncExternalStoreWithSelector=function(c,d,f,p,y){var b=s(null);if(b.current===null){var S={hasValue:!1,value:null};b.current=S}else S=b.current;b=o(function(){function x(N){if(!M){if(M=!0,T=N,N=p(N),y!==void 0&&S.hasValue){var D=S.value;if(y(D,N))return P=D}return P=N}if(D=P,r(T,N))return D;var z=p(N);return y!==void 0&&y(D,z)?(T=N,D):(T=N,P=z)}var M=!1,T,P,O=f===void 0?null:f;return[function(){return x(d())},O===null?void 0:function(){return x(O())}]},[d,f,p,y]);var w=i(c,b[0],b[1]);return a(function(){S.hasValue=!0,S.value=w},[w]),l(w),w},mE}var FI;function xq(){return FI||(FI=1,pE.exports=yq()),pE.exports}var bq=xq(),UC=R.createContext(null),_q=t=>t,Wr=()=>{var t=R.useContext(UC);return t?t.store.dispatch:_q},B_=()=>{},wq=()=>B_,Sq=(t,e)=>t===e;function Ft(t){var e=R.useContext(UC),n=R.useMemo(()=>e?r=>{if(r!=null)return t(r)}:B_,[e,t]);return bq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:wq,e?e.store.getState:B_,e?e.store.getState:B_,n,Sq)}function Mq(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Eq(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 zI=t=>Array.isArray(t)?t:[t];function Aq(t){const e=Array.isArray(t[0])?t[0]:t;return Eq(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function Tq(t,e){const n=[],{length:r}=t;for(let i=0;itypeof WeakRef>"u"?Pq:WeakRef,k5=Cq(),Rq=0,BI=1;function Sb(){return{s:Rq,v:void 0,o:null,p:null}}function Nq(t){return t instanceof k5?t.deref():t}function O5(t,e={}){let n=Sb();const{resultEqualityCheck:r}=e;let i,s=0;function a(){let o=n;const{length:l}=arguments;for(let f=0,p=l;f{n=Sb(),a.resetResultsCount()},a.resultsCount=()=>s,a.resetResultsCount=()=>{s=0},a}function Iq(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,a=0,o,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),Mq(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:p=[],argsMemoize:y=O5,argsMemoizeOptions:b=[]}=d,S=zI(p),w=zI(b),x=Aq(i),M=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){a++;const O=Tq(x,arguments);return o=M.apply(null,O),o},...w);return Object.assign(T,{resultFunc:c,memoizedResultFunc:M,dependencies:x,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>o,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var ke=Iq(O5);function kq(t,e=1){const n=[],r=Math.floor(e),i=(s,a)=>{for(let o=0;o{if(t!==e){const r=HI(t),i=HI(e);if(r===i&&r===0){if(te)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function L5(t){return typeof t=="symbol"||t instanceof Symbol}const Lq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Dq=/^\w*$/;function Uq(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||L5(t)?!0:typeof t=="string"&&(Dq.test(t)||!Lq.test(t))||e!=null}function jq(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(o=>String(o));const i=(o,l)=>{let c=o;for(let d=0;dl==null||o==null?l:typeof o=="object"&&"key"in o?Object.hasOwn(l,o.key)?l[o.key]:i(l,o.path):typeof o=="function"?o(l):Array.isArray(o)?i(l,o):typeof l=="object"?l[o]:l,a=e.map(o=>(Array.isArray(o)&&o.length===1&&(o=o[0]),o==null||typeof o=="function"||Array.isArray(o)||Uq(o)?o:{key:o,path:kC(o)}));return t.map(o=>({original:o,criteria:a.map(l=>s(l,o))})).slice().sort((o,l)=>{for(let c=0;co.original)}function tS(t,...e){const n=e.length;return n>1&&eP(t,e[0],e[1])?e=[]:n>2&&eP(e[0],e[1],e[2])&&(e=[e[0]]),jq(t,kq(e),["asc"])}var D5=t=>t.legend.settings,Fq=t=>t.legend.size,zq=t=>t.legend.payload;ke([zq,D5],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?tS(r,n):r});function Bq(t,e){return Wq(t)||Gq(t,e)||Vq(t,e)||Hq()}function Hq(){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 Vq(t,e){if(t){if(typeof t=="string")return VI(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)?VI(t,e):void 0}}function VI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nMb||Math.abs(t.left-e.left)>Mb||Math.abs(t.top-e.top)>Mb||Math.abs(t.width-e.width)>Mb}function WI(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function $q(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=R.useState({height:0,left:0,top:0,width:0}),n=Bq(e,2),r=n[0],i=n[1],s=R.useRef(null),a=R.useRef(r);a.current=r;var o=R.useCallback(l=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),l!=null){var c=WI(l);if(GI(c,a.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=WI(l);GI(f,a.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,o]}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 Xq=typeof Symbol=="function"&&Symbol.observable||"@@observable",$I=Xq,yE=()=>Math.random().toString(36).substring(7).split("").join("."),qq={INIT:`@@redux/INIT${yE()}`,REPLACE:`@@redux/REPLACE${yE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yE()}`},lw=qq;function jC(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,a=s,o=0,l=!1;function c(){a===s&&(a=new Map,s.forEach((w,x)=>{a.set(x,w)}))}function d(){if(l)throw new Error(Di(3));return i}function f(w){if(typeof w!="function")throw new Error(Di(4));if(l)throw new Error(Di(5));let x=!0;c();const M=o++;return a.set(M,w),function(){if(x){if(l)throw new Error(Di(6));x=!1,c(),a.delete(M),s=null}}}function p(w){if(!jC(w))throw new Error(Di(7));if(typeof w.type>"u")throw new Error(Di(8));if(typeof w.type!="string")throw new Error(Di(17));if(l)throw new Error(Di(9));try{l=!0,i=r(i,w)}finally{l=!1}return(s=a).forEach(M=>{M()}),w}function y(w){if(typeof w!="function")throw new Error(Di(10));r=w,p({type:lw.REPLACE})}function b(){const w=f;return{subscribe(x){if(typeof x!="object"||x===null)throw new Error(Di(11));function M(){const P=x;P.next&&P.next(d())}return M(),{unsubscribe:w(M)}},[$I](){return this}}}return p({type:lw.INIT}),{dispatch:p,subscribe:f,getState:d,replaceReducer:y,[$I]:b}}function Kq(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 j5(t){const e=Object.keys(t),n={};for(let s=0;s"u")throw o&&o.type,new Error(Di(14));c[f]=b,l=l||b!==y}return l=l||r.length!==Object.keys(a).length,l?c:a}}function cw(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function Yq(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(Di(15))};const a={getState:i.getState,dispatch:(l,...c)=>s(l,...c)},o=t.map(l=>l(a));return s=cw(...o)(i.dispatch),{...i,dispatch:s}}}function F5(t){return jC(t)&&"type"in t&&typeof t.type=="string"}var z5=Symbol.for("immer-nothing"),XI=Symbol.for("immer-draftable"),Ps=Symbol.for("immer-state");function Uo(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var xa=Object,Sg=xa.getPrototypeOf,uw="constructor",nS="prototype",tP="configurable",dw="enumerable",H_="writable",dy="value",Xc=t=>!!t&&!!t[Ps];function Bo(t){var e;return t?B5(t)||iS(t)||!!t[XI]||!!((e=t[uw])!=null&&e[XI])||sS(t)||aS(t):!1}var Zq=xa[nS][uw].toString(),qI=new WeakMap;function B5(t){if(!t||!FC(t))return!1;const e=Sg(t);if(e===null||e===xa[nS])return!0;const n=xa.hasOwnProperty.call(e,uw)&&e[uw];if(n===Object)return!0;if(!jm(n))return!1;let r=qI.get(n);return r===void 0&&(r=Function.toString.call(n),qI.set(n,r)),r===Zq}function rS(t,e,n=!0){Xy(t)===0?(n?Reflect.ownKeys(t):xa.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function Xy(t){const e=t[Ps];return e?e.type_:iS(t)?1:sS(t)?2:aS(t)?3:0}var KI=(t,e,n=Xy(t))=>n===2?t.has(e):xa[nS].hasOwnProperty.call(t,e),nP=(t,e,n=Xy(t))=>n===2?t.get(e):t[e],fw=(t,e,n,r=Xy(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function Qq(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var iS=Array.isArray,sS=t=>t instanceof Map,aS=t=>t instanceof Set,FC=t=>typeof t=="object",jm=t=>typeof t=="function",xE=t=>typeof t=="boolean";function Jq(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Cc=t=>t.copy_||t.base_,zC=t=>t.modified_?t.copy_:t.base_;function rP(t,e){if(sS(t))return new Map(t);if(aS(t))return new Set(t);if(iS(t))return Array[nS].slice.call(t);const n=B5(t);if(e===!0||e==="class_only"&&!n){const r=xa.getOwnPropertyDescriptors(t);delete r[Ps];let i=Reflect.ownKeys(r);for(let s=0;s1&&xa.defineProperties(t,{set:Eb,add:Eb,clear:Eb,delete:Eb}),xa.freeze(t),e&&rS(t,(n,r)=>{BC(r,!0)},!1)),t}function eK(){Uo(2)}var Eb={[dy]:eK};function oS(t){return t===null||!FC(t)?!0:xa.isFrozen(t)}var hw="MapSet",iP="Patches",YI="ArrayMethods",H5={};function Oh(t){const e=H5[t];return e||Uo(0,t),e}var ZI=t=>!!H5[t],fy,V5=()=>fy,tK=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ZI(hw)?Oh(hw):void 0,arrayMethodsPlugin_:ZI(YI)?Oh(YI):void 0});function QI(t,e){e&&(t.patchPlugin_=Oh(iP),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function sP(t){aP(t),t.drafts_.forEach(nK),t.drafts_=null}function aP(t){t===fy&&(fy=t.parent_)}var JI=t=>fy=tK(fy,t);function nK(t){const e=t[Ps];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function ek(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Ps].modified_&&(sP(e),Uo(4)),Bo(t)&&(t=tk(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Ps].base_,t,e)}else t=tk(e,n);return rK(e,t,!0),sP(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==z5?t:void 0}function tk(t,e){if(oS(e))return e;const n=e[Ps];if(!n)return pw(e,t.handledSet_,t);if(!lS(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);$5(n,t)}return n.copy_}function rK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&BC(e,n)}function G5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var lS=(t,e)=>t.scope_===e,iK=[];function W5(t,e,n,r){const i=Cc(t),s=t.type_;if(r!==void 0&&nP(i,r,s)===e){fw(i,r,n,s);return}if(!t.draftLocations_){const o=t.draftLocations_=new Map;rS(i,(l,c)=>{if(Xc(c)){const d=o.get(c)||[];d.push(l),o.set(c,d)}})}const a=t.draftLocations_.get(e)??iK;for(const o of a)fw(i,o,n,s)}function sK(t,e,n){t.callbacks_.push(function(i){var o;const s=e;if(!s||!lS(s,i))return;(o=i.mapSetPlugin_)==null||o.fixSetContents(s);const a=zC(s);W5(t,s.draft_??s,a,n),$5(s,i)})}function $5(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)}G5(t)}}function aK(t,e,n){const{scope_:r}=t;if(Xc(n)){const i=n[Ps];lS(i,r)&&i.callbacks_.push(function(){V_(t);const a=zC(i);W5(t,n,a,e)})}else Bo(n)&&t.callbacks_.push(function(){const s=Cc(t);t.type_===3?s.has(n)&&pw(n,r.handledSet_,r):nP(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&pw(nP(t.copy_,e,t.type_),r.handledSet_,r)})}function pw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Xc(t)||e.has(t)||!Bo(t)||oS(t)||(e.add(t),rS(t,(r,i)=>{if(Xc(i)){const s=i[Ps];if(lS(s,n)){const a=zC(s);fw(t,r,a,t.type_),G5(s)}}else Bo(i)&&pw(i,e,n)})),t}function oK(t,e){const n=iS(t),r={type_:n?1:0,scope_:e?e.scope_:V5(),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:a,proxy:o}=Proxy.revocable(i,s);return r.draft_=o,r.revoke_=a,[o,r]}var mw={get(t,e){if(e===Ps)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=Cc(t);if(!KI(i,e,t.type_))return lK(t,i,e);const s=i[e];if(t.finalized_||!Bo(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&Jq(e))return s;if(s===bE(t.base_,e)){V_(t);const a=t.type_===1?+e:e,o=lP(t.scope_,s,t,a);return t.copy_[a]=o}return s},has(t,e){return e in Cc(t)},ownKeys(t){return Reflect.ownKeys(Cc(t))},set(t,e,n){const r=X5(Cc(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=bE(Cc(t),e),s=i==null?void 0:i[Ps];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(Qq(n,i)&&(n!==void 0||KI(t.base_,e,t.type_)))return!0;V_(t),oP(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),aK(t,e,n)),!0},deleteProperty(t,e){return V_(t),bE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),oP(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Cc(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[H_]:!0,[tP]:t.type_!==1||e!=="length",[dw]:r[dw],[dy]:n[e]}},defineProperty(){Uo(11)},getPrototypeOf(t){return Sg(t.base_)},setPrototypeOf(){Uo(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 bE(t,e){const n=t[Ps];return(n?Cc(n):t)[e]}function lK(t,e,n){var i;const r=X5(e,n);return r?dy in r?r[dy]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function X5(t,e){if(!(e in t))return;let n=Sg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Sg(n)}}function oP(t){t.modified_||(t.modified_=!0,t.parent_&&oP(t.parent_))}function V_(t){t.copy_||(t.assigned_=new Map,t.copy_=rP(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var cK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(jm(n)&&!jm(r)){const a=r;r=n;const o=this;return function(c=a,...d){return o.produce(c,f=>r.call(this,f,...d))}}jm(r)||Uo(6),i!==void 0&&!jm(i)&&Uo(7);let s;if(Bo(n)){const a=JI(this),o=lP(a,n,void 0);let l=!0;try{s=r(o),l=!1}finally{l?sP(a):aP(a)}return QI(a,i),ek(s,a)}else if(!n||!FC(n)){if(s=r(n),s===void 0&&(s=n),s===z5&&(s=void 0),this.autoFreeze_&&BC(s,!0),i){const a=[],o=[];Oh(iP).generateReplacementPatches_(n,s,{patches_:a,inversePatches_:o}),i(a,o)}return s}else Uo(1,n)},this.produceWithPatches=(n,r)=>{if(jm(n))return(o,...l)=>this.produceWithPatches(o,c=>n(c,...l));let i,s;return[this.produce(n,r,(o,l)=>{i=o,s=l}),i,s]},xE(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),xE(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),xE(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Bo(e)||Uo(8),Xc(e)&&(e=Ga(e));const n=JI(this),r=lP(n,e,void 0);return r[Ps].isManual_=!0,aP(n),r}finishDraft(e,n){const r=e&&e[Ps];(!r||!r.isManual_)&&Uo(9);const{scope_:i}=r;return QI(i,n),ek(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=Oh(iP).applyPatches_;return Xc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function lP(t,e,n,r){const[i,s]=sS(e)?Oh(hw).proxyMap_(e,n):aS(e)?Oh(hw).proxySet_(e,n):oK(e,n);return((n==null?void 0:n.scope_)??V5()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?sK(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 Ga(t){return Xc(t)||Uo(10,t),q5(t)}function q5(t){if(!Bo(t)||oS(t))return t;const e=t[Ps];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=rP(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=rP(t,!0);return rS(n,(i,s)=>{fw(n,i,q5(s))},r),e&&(e.finalized_=!1),n}var uK=new cK,K5=uK.produce;function Y5(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var dK=Y5(),fK=Y5,hK=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 Ma(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(_a(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=>F5(r)&&r.type===t,n}var Z5=class B0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,B0.prototype)}static get[Symbol.species](){return B0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new B0(...e[0].concat(this)):new B0(...e.concat(this))}};function nk(t){return Bo(t)?K5(t,()=>{}):t}function Ab(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function pK(t){return typeof t=="boolean"}var mK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let a=new Z5;return n&&(pK(n)?a.push(dK):a.push(fK(n.extraArgument))),a},Q5="RTK_autoBatch",ar=()=>t=>({payload:t,meta:{[Q5]:!0}}),rk=t=>e=>{setTimeout(e,t)},gK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(a),n())},s=t(i),a=setTimeout(i,e)},J5=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,a=!1;const o=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?gK(window.requestAnimationFrame,100):rk(10):t.type==="callback"?t.queueNotification:rk(t.timeout),c=()=>{a=!1,s&&(s=!1,o.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),p=r.subscribe(f);return o.add(d),()=>{p(),o.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[Q5]),s=!i,s&&(a||(a=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},vK=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new Z5(t);return r&&i.push(J5(typeof r=="object"?r:void 0)),i};function yK(t){const e=mK(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:a=void 0}=t||{};let o;if(typeof n=="function")o=n;else if(jC(n))o=j5(n);else throw new Error(_a(1));let l;typeof r=="function"?l=r(e):l=e();let c=cw;i&&(c=hK({trace:!1,...typeof i=="object"&&i}));const d=Yq(...l),f=vK(d);let p=typeof a=="function"?a(f):f();const y=c(...p);return U5(o,s,y)}function e4(t){const e={},n=[];let r;const i={addCase(s,a){const o=typeof s=="string"?s:s.type;if(!o)throw new Error(_a(28));if(o in e)throw new Error(_a(29));return e[o]=a,i},addAsyncThunk(s,a){return a.pending&&(e[s.pending.type]=a.pending),a.rejected&&(e[s.rejected.type]=a.rejected),a.fulfilled&&(e[s.fulfilled.type]=a.fulfilled),a.settled&&n.push({matcher:s.settled,reducer:a.settled}),i},addMatcher(s,a){return n.push({matcher:s,reducer:a}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function xK(t){return typeof t=="function"}function bK(t,e){let[n,r,i]=e4(e),s;if(xK(t))s=()=>nk(t());else{const o=nk(t);s=()=>o}function a(o=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(Xc(d)){const y=f(d,l);return y===void 0?d:y}else{if(Bo(d))return K5(d,p=>f(p,l));{const p=f(d,l);if(p===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return p}}return d},o)}return a.getInitialState=s,a}var _K="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",wK=(t=21)=>{let e="",n=t;for(;n--;)e+=_K[Math.random()*64|0];return e},SK=Symbol.for("rtk-slice-createasyncthunk");function MK(t,e){return`${t}/${e}`}function EK({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[SK];return function(i){const{name:s,reducerPath:a=s}=i;if(!s)throw new Error(_a(11));const o=(typeof i.reducers=="function"?i.reducers(TK()):i.reducers)||{},l=Object.keys(o),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(P,O){const N=typeof P=="string"?P:P.type;if(!N)throw new Error(_a(12));if(N in c.sliceCaseReducersByType)throw new Error(_a(13));return c.sliceCaseReducersByType[N]=O,d},addMatcher(P,O){return c.sliceMatchers.push({matcher:P,reducer:O}),d},exposeAction(P,O){return c.actionCreators[P]=O,d},exposeCaseReducer(P,O){return c.sliceCaseReducersByName[P]=O,d}};l.forEach(P=>{const O=o[P],N={reducerName:P,type:MK(s,P),createNotation:typeof i.reducers=="function"};CK(O)?NK(N,O,d,e):PK(N,O,d)});function f(){const[P={},O=[],N=void 0]=typeof i.extraReducers=="function"?e4(i.extraReducers):[i.extraReducers],D={...P,...c.sliceCaseReducersByType};return bK(i.initialState,z=>{for(let V in D)z.addCase(V,D[V]);for(let V of c.sliceMatchers)z.addMatcher(V.matcher,V.reducer);for(let V of O)z.addMatcher(V.matcher,V.reducer);N&&z.addDefaultCase(N)})}const p=P=>P,y=new Map,b=new WeakMap;let S;function w(P,O){return S||(S=f()),S(P,O)}function x(){return S||(S=f()),S.getInitialState()}function M(P,O=!1){function N(z){let V=z[P];return typeof V>"u"&&O&&(V=Ab(b,N,x)),V}function D(z=p){const V=Ab(y,O,()=>new WeakMap);return Ab(V,z,()=>{const k={};for(const[j,X]of Object.entries(i.selectors??{}))k[j]=AK(X,z,()=>Ab(b,z,x),O);return k})}return{reducerPath:P,getSelectors:D,get selectors(){return D(N)},selectSlice:N}}const T={name:s,reducer:w,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:x,...M(a),injectInto(P,{reducerPath:O,...N}={}){const D=O??a;return P.inject({reducerPath:D,reducer:w},N),{...T,...M(D,!0)}}};return T}}function AK(t,e,n,r){function i(s,...a){let o=e(s);return typeof o>"u"&&r&&(o=n()),t(o,...a)}return i.unwrapped=t,i}var cs=EK();function TK(){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 PK({type:t,reducerName:e,createNotation:n},r,i){let s,a;if("reducer"in r){if(n&&!RK(r))throw new Error(_a(17));s=r.reducer,a=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,a?Ma(t,a):Ma(t))}function CK(t){return t._reducerDefinitionType==="asyncThunk"}function RK(t){return t._reducerDefinitionType==="reducerWithPrepare"}function NK({type:t,reducerName:e},n,r,i){if(!i)throw new Error(_a(18));const{payloadCreator:s,fulfilled:a,pending:o,rejected:l,settled:c,options:d}=n,f=i(t,s,d);r.exposeAction(e,f),a&&r.addCase(f.fulfilled,a),o&&r.addCase(f.pending,o),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:a||Tb,pending:o||Tb,rejected:l||Tb,settled:c||Tb})}function Tb(){}var IK="task",t4="listener",n4="completed",HC="cancelled",kK=`task-${HC}`,OK=`task-${n4}`,cP=`${t4}-${HC}`,LK=`${t4}-${n4}`,cS=class{constructor(t){Gs(this,"code");Gs(this,"name","TaskAbortError");Gs(this,"message");this.code=t,this.message=`${IK} ${HC} (reason: ${t})`}},VC=(t,e)=>{if(typeof t!="function")throw new TypeError(_a(32))},gw=()=>{},r4=(t,e=gw)=>(t.catch(e),t),i4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),Sh=t=>{if(t.aborted)throw new cS(t.reason)};function s4(t,e){let n=gw;return new Promise((r,i)=>{const s=()=>i(new cS(t.reason));if(t.aborted){s();return}n=i4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=gw})}var DK=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof cS?"cancelled":"rejected",error:n}}finally{e==null||e()}},vw=t=>e=>r4(s4(t,e).then(n=>(Sh(t),n))),a4=t=>{const e=vw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:Qm}=Object,ik={},uS="listenerMiddleware",UK=(t,e)=>{const n=r=>i4(t,()=>r.abort(t.reason));return(r,i)=>{VC(r);const s=new AbortController;n(s);const a=DK(async()=>{Sh(t),Sh(s.signal);const o=await r({pause:vw(s.signal),delay:a4(s.signal),signal:s.signal});return Sh(s.signal),o},()=>s.abort(OK));return i!=null&&i.autoJoin&&e.push(a.catch(gw)),{result:vw(t)(a),cancel(){s.abort(kK)}}}},jK=(t,e)=>{const n=async(r,i)=>{Sh(e);let s=()=>{};const o=[new Promise((l,c)=>{let d=t({predicate:r,effect:(f,p)=>{p.unsubscribe(),l([f,p.getState(),p.getOriginalState()])}});s=()=>{d(),c()}})];i!=null&&o.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await s4(e,Promise.race(o));return Sh(e),l}finally{s()}};return((r,i)=>r4(n(r,i)))},o4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Ma(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(_a(21));return VC(s),{predicate:i,type:e,effect:s}},l4=Qm(t=>{const{type:e,predicate:n,effect:r}=o4(t);return{id:wK(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(_a(22))}}},{withTypes:()=>l4}),sk=(t,e)=>{const{type:n,effect:r,predicate:i}=o4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},uP=t=>{t.pending.forEach(e=>{e.abort(cP)})},FK=(t,e)=>()=>{for(const n of e.keys())uP(n);t.clear()},ak=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},c4=Qm(Ma(`${uS}/add`),{withTypes:()=>c4}),zK=Ma(`${uS}/removeAll`),u4=Qm(Ma(`${uS}/remove`),{withTypes:()=>u4}),BK=(...t)=>{console.error(`${uS}/error`,...t)},qy=(t={})=>{const e=new Map,n=new Map,r=y=>{const b=n.get(y)??0;n.set(y,b+1)},i=y=>{const b=n.get(y)??1;b===1?n.delete(y):n.set(y,b-1)},{extra:s,onError:a=BK}=t;VC(a);const o=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),b=>{y.unsubscribe(),b!=null&&b.cancelActive&&uP(y)}),l=(y=>{const b=sk(e,y)??l4(y);return o(b)});Qm(l,{withTypes:()=>l});const c=y=>{const b=sk(e,y);return b&&(b.unsubscribe(),y.cancelActive&&uP(b)),!!b};Qm(c,{withTypes:()=>c});const d=async(y,b,S,w)=>{const x=new AbortController,M=jK(l,x.signal),T=[];try{y.pending.add(x),r(y),await Promise.resolve(y.effect(b,Qm({},S,{getOriginalState:w,condition:(P,O)=>M(P,O).then(Boolean),take:M,delay:a4(x.signal),pause:vw(x.signal),extra:s,signal:x.signal,fork:UK(x.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((P,O,N)=>{P!==x&&(P.abort(cP),N.delete(P))})},cancel:()=>{x.abort(cP),y.pending.delete(x)},throwIfCancelled:()=>{Sh(x.signal)}})))}catch(P){P instanceof cS||ak(a,P,{raisedBy:"effect"})}finally{await Promise.all(T),x.abort(LK),i(y),y.pending.delete(x)}},f=FK(e,n);return{middleware:y=>b=>S=>{if(!F5(S))return b(S);if(c4.match(S))return l(S.payload);if(zK.match(S)){f();return}if(u4.match(S))return c(S.payload);let w=y.getState();const x=()=>{if(w===ik)throw new Error(_a(23));return w};let M;try{if(M=b(S),e.size>0){const T=y.getState(),P=Array.from(e.values());for(const O of P){let N=!1;try{N=O.predicate(S,T,w)}catch(D){N=!1,ak(a,D,{raisedBy:"predicate"})}N&&d(O,S,y,x)}}}finally{w=ik}return M},startListening:l,stopListening:c,clearListeners:f}};function _a(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 HK={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},d4=cs({name:"chartLayout",initialState:HK,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}}}),dS=d4.actions,VK=dS.setMargin,GK=dS.setLayout,WK=dS.setChartSize,$K=dS.setScale,XK=d4.reducer;function f4(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function wn(t){return Number.isFinite(t)}function Il(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function ok(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 Gm(t){for(var e=1;e{if(e&&n){var r=n.width,i=n.height,s=e.align,a=e.verticalAlign,o=e.layout;if((o==="vertical"||o==="horizontal"&&a==="middle")&&s!=="center"&&kt(t[s]))return Gm(Gm({},t),{},{[s]:t[s]+(r||0)});if((o==="horizontal"||o==="vertical"&&s==="center")&&a!=="middle"&&kt(t[a]))return Gm(Gm({},t),{},{[a]:t[a]+(i||0)})}return t},jl=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",h4=(t,e,n,r)=>{if(r)return t.map(o=>o.coordinate);var i,s,a=t.map(o=>(o.coordinate===e&&(i=!0),o.coordinate===n&&(s=!0),o.coordinate));return i||a.push(e),s||a.push(n),a},p4=(t,e,n)=>{if(!t)return null;var r=t.duplicateDomain,i=t.type,s=t.range,a=t.scale,o=t.realScaleType,l=t.isCategorical,c=t.categoricalDomain,d=t.tickCount,f=t.ticks,p=t.niceTicks,y=t.axisType;if(!a)return null;var b=o==="scaleBand"&&a.bandwidth?a.bandwidth()/2:2,S=i==="category"&&a.bandwidth?a.bandwidth()/b:0;if(S=y==="angleAxis"&&s&&s.length>=2?Va(s[0]-s[1])*2*S:S,f||p){var w=(f||p||[]).map((x,M)=>{var T=r?r.indexOf(x):x,P=a.map(T);return wn(P)?{coordinate:P+S,value:x,offset:S,index:M}:null}).filter(Ys);return w}return l&&c?c.map((x,M)=>{var T=a.map(x);return wn(T)?{coordinate:T+S,value:x,index:M,offset:S}:null}).filter(Ys):a.ticks&&d!=null?a.ticks(d).map((x,M)=>{var T=a.map(x);return wn(T)?{coordinate:T+S,value:x,index:M,offset:S}:null}).filter(Ys):a.domain().map((x,M)=>{var T=a.map(x);return wn(T)?{coordinate:T+S,value:r?r[x]:x,index:M,offset:S}:null}).filter(Ys)},QK=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+=p,c[1]=s):(c[0]=a,a+=p,c[1]=a)}}}},JK=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:QK,expand:gX,none:Ih,silhouette:vX,wiggle:yX,positive:JK},tY=(t,e,n)=>{var r,i=(r=eY[n])!==null&&r!==void 0?r:Ih,s=mX().keys(e).value((o,l)=>Number(yi(o,l,0))).order(YT).offset(i),a=s(t);return a.forEach((o,l)=>{o.forEach((c,d)=>{var f=yi(t[d],e[l],0);Array.isArray(f)&&f.length===2&&kt(f[0])&&kt(f[1])&&(c[0]=f[0],c[1]=f[1])})}),a};function nY(t){return t==null?void 0:String(t)}function lk(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,a=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Vi(i[e.dataKey])){var o=b5(n,"value",i[e.dataKey]);if(o)return o.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var l=yi(i,Vi(a)?e.dataKey:a),c=e.scale.map(l);return kt(c)?c:null}var rY=t=>{var e=t.flat(2).filter(kt);return[Math.min(...e),Math.max(...e)]},iY=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],sY=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return iY(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var a=s.stackedData,o=a.reduce((l,c)=>{var d=f4(c,e,n),f=rY(d);return!wn(f[0])||!wn(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(o[0],r[0]),Math.max(o[1],r[1])]},[1/0,-1/0]))},ck=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,uk=/^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=tS(e,d=>d.coordinate),s=1/0,a=1,o=i.length;a{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},oY=(t,e)=>e==="centric"?t.angle:t.radius,Jc=t=>t.layout.width,eu=t=>t.layout.height,lY=t=>t.layout.scale,g4=t=>t.layout.margin,fS=ke(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),hS=ke(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),cY="data-recharts-item-index",uY="data-recharts-item-id",Ky=60;function fk(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 Pb(t){for(var e=1;et.brush.height;function mY(t){var e=hS(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Ky;return n+i}return n},0)}function gY(t){var e=hS(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:Ky;return n+i}return n},0)}function vY(t){var e=fS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function yY(t){var e=fS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Wi=ke([Jc,eu,g4,pY,mY,gY,vY,yY,D5,Fq],(t,e,n,r,i,s,a,o,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+a,bottom:(n.bottom||0)+o},p=Pb(Pb({},f),d),y=p.bottom;p.bottom+=r,p=ZK(p,l,c);var b=t-p.left-p.right,S=e-p.top-p.bottom;return Pb(Pb({brushBottom:y},p),{},{width:Math.max(b,0),height:Math.max(S,0)})}),xY=ke(Wi,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),v4=ke(Jc,eu,(t,e)=>({x:0,y:0,width:t,height:e})),bY=R.createContext(null),Js=()=>R.useContext(bY)!=null,pS=t=>t.brush,mS=ke([pS,Wi,g4],(t,e,n)=>({height:t.height,x:kt(t.x)?t.x:e.left,y:kt(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:kt(t.width)?t.width:e.width}));function _Y(t,e,{signal:n,edges:r}={}){let i,s=null;const a=r!=null&&r.includes("leading"),o=r==null||r.includes("trailing"),l=()=>{s!==null&&(t.apply(i,s),i=void 0,s=null)},c=()=>{o&&l(),y()};let d=null;const f=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},e)},p=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{p(),i=void 0,s=null},b=()=>{l()},S=function(...w){if(n!=null&&n.aborted)return;i=this,s=w;const x=d==null;f(),a&&x&&l()};return S.schedule=f,S.cancel=y,S.flush=b,n==null||n.addEventListener("abort",y,{once:!0}),S}function wY(t,e=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:s}=n,a=Array(2);r&&(a[0]="leading"),i&&(a[1]="trailing");let o,l=null;const c=_Y(function(...p){o=t.apply(this,p),l=null},e,{edges:a}),d=function(...p){return s!=null&&(l===null&&(l=Date.now()),Date.now()-l>=s)?(o=t.apply(this,p),l=Date.now(),c.cancel(),c.schedule(),o):(c.apply(this,p),o)},f=()=>(c.flush(),o);return d.cancel=c.cancel,d.flush=f,d}function SY(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return wY(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[a++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},y4=(t,e,n)=>{var r=n.width,i=r===void 0?wl.width:r,s=n.height,a=s===void 0?wl.height:s,o=n.aspect,l=n.maxHeight,c=kh(i)?t:Number(i),d=kh(a)?e:Number(a);return o&&o>0&&(c?d=c/o:d&&(c=d*o),l&&d!=null&&d>l&&(d=l)),{calculatedWidth:c,calculatedHeight:d}},MY={width:0,height:0,overflow:"visible"},EY={width:0,overflowX:"visible"},AY={height:0,overflowY:"visible"},TY={},PY=t=>{var e=t.width,n=t.height,r=kh(e),i=kh(n);return r&&i?MY:r?EY:i?AY:TY};function CY(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 RY=["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 BY(i)?R.createElement(x4.Provider,{value:i},e):null}var GC=()=>R.useContext(x4),HY=R.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,i=r===void 0?wl.initialDimension:r,s=t.width,a=t.height,o=t.minWidth,l=o===void 0?wl.minWidth:o,c=t.minHeight,d=t.maxHeight,f=t.children,p=t.debounce,y=p===void 0?wl.debounce:p,b=t.id,S=t.className,w=t.onResize,x=t.style,M=x===void 0?{}:x,T=FY(t,RY),P=R.useRef(null),O=R.useRef();O.current=w,R.useImperativeHandle(e,()=>P.current);var N=R.useState({containerWidth:i.width,containerHeight:i.height}),D=OY(N,2),z=D[0],V=D[1],k=R.useCallback((ae,he)=>{V(B=>{var J=Math.round(ae),Y=Math.round(he);return B.containerWidth===J&&B.containerHeight===Y?B:{containerWidth:J,containerHeight:Y}})},[]);R.useEffect(()=>{if(P.current==null||typeof ResizeObserver>"u")return Hg;var ae=H=>{var G,le=H[0];if(le!=null){var se=le.contentRect,ce=se.width,Se=se.height;k(ce,Se),(G=O.current)===null||G===void 0||G.call(O,ce,Se)}};y>0&&(ae=SY(ae,y,{trailing:!0,leading:!1}));var he=new ResizeObserver(ae),B=P.current.getBoundingClientRect(),J=B.width,Y=B.height;return k(J,Y),he.observe(P.current),()=>{he.disconnect()}},[k,y]);var j=z.containerWidth,X=z.containerHeight;xw(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ee=y4(j,X,{width:s,height:a,aspect:n,maxHeight:d}),ie=ee.calculatedWidth,pe=ee.calculatedHeight;return xw(j<0||X<0||ie!=null&&ie>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.`,ie,pe,s,a,l,c,n),R.createElement("div",bw({id:b?"".concat(b):void 0,className:tr("recharts-responsive-container",S),style:pk(pk({},M),{},{width:s,height:a,minWidth:l,minHeight:c,maxHeight:d}),ref:P},T),R.createElement("div",{style:AY({width:s,height:a})},R.createElement(b4,{width:ie,height:pe},f)))}),BY=R.forwardRef((t,e)=>{var n=GC();if(Il(n.width)&&Il(n.height))return t.children;var r=TY({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,a=y4(void 0,void 0,{width:i,height:s,aspect:t.aspect,maxHeight:t.maxHeight}),o=a.calculatedWidth,l=a.calculatedHeight;return kt(o)&&kt(l)?R.createElement(b4,{width:o,height:l},t.children):R.createElement(zY,bw({},t,{width:i,height:s,ref:e}))});function WC(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 gS=()=>{var t,e=Js(),n=Ft(vY),r=Ft(mS),i=(t=Ft(pS))===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}},HY={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_4=()=>{var t;return(t=Ft(Wi))!==null&&t!==void 0?t:HY},w4=()=>Ft(Jc),S4=()=>Ft(eu),hr=t=>t.layout.layoutType,Vg=()=>Ft(hr),$C=()=>{var t=Vg();if(t==="horizontal"||t==="vertical")return t},M4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},VY=()=>{var t=Vg();return t!==void 0},Yy=t=>{var e=Wr(),n=Js(),r=t.width,i=t.height,s=GC(),a=r,o=i;return s&&(a=s.width>0?s.width:r,o=s.height>0?s.height:i),R.useEffect(()=>{!n&&Il(a)&&Il(o)&&e(VK({width:a,height:o}))},[e,n,a,o]),null},E4=Symbol.for("immer-nothing"),gk=Symbol.for("immer-draftable"),Ea=Symbol.for("immer-state");function jo(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var py=Object.getPrototypeOf;function Mg(t){return!!t&&!!t[Ea]}function Lh(t){var e;return t?A4(t)||Array.isArray(t)||!!t[gk]||!!((e=t.constructor)!=null&&e[gk])||Zy(t)||yS(t):!1}var GY=Object.prototype.constructor.toString(),vk=new WeakMap;function A4(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=vk.get(n);return r===void 0&&(r=Function.toString.call(n),vk.set(n,r)),r===GY}function _w(t,e,n=!0){vS(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 vS(t){const e=t[Ea];return e?e.type_:Array.isArray(t)?1:Zy(t)?2:yS(t)?3:0}function dP(t,e){return vS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function T4(t,e,n){const r=vS(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function WY(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Zy(t){return t instanceof Map}function yS(t){return t instanceof Set}function Xf(t){return t.copy_||t.base_}function fP(t,e){if(Zy(t))return new Map(t);if(yS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=A4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Ea];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=>XC(n,!0))),t}function $Y(){jo(2)}var Cb={value:$Y};function xS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var XY={};function Dh(t){const e=XY[t];return e||jo(0,t),e}var my;function P4(){return my}function qY(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function yk(t,e){e&&(Dh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function hP(t){pP(t),t.drafts_.forEach(KY),t.drafts_=null}function pP(t){t===my&&(my=t.parent_)}function xk(t){return my=qY(my,t)}function KY(t){const e=t[Ea];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function bk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Ea].modified_&&(hP(e),jo(4)),Lh(t)&&(t=ww(e,t),e.parent_||Sw(e,t)),e.patches_&&Dh("Patches").generateReplacementPatches_(n[Ea].base_,t,e.patches_,e.inversePatches_)):t=ww(e,n,[]),hP(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==E4?t:void 0}function ww(t,e,n){if(xS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Ea];if(!i)return _w(e,(s,a)=>_k(t,i,e,s,a,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 a=s,o=!1;i.type_===3&&(a=new Set(s),s.clear(),o=!0),_w(a,(l,c)=>_k(t,i,s,l,c,n,o),r),Sw(t,s,!1),n&&t.patches_&&Dh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function _k(t,e,n,r,i,s,a){if(i==null||typeof i!="object"&&!a)return;const o=xS(i);if(!(o&&!a)){if(Mg(i)){const l=s&&e&&e.type_!==3&&!dP(e.assigned_,r)?s.concat(r):void 0,c=ww(t,i,l);if(T4(n,r,c),Mg(c))t.canAutoFreeze_=!1;else return}else a&&n.add(i);if(Lh(i)&&!o){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===i&&o)return;ww(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(Zy(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_&&XC(e,n)}function YY(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=qC;n&&(i=[r],s=gy);const{revoke:a,proxy:o}=Proxy.revocable(i,s);return r.draft_=o,r.revoke_=a,o}var qC={get(t,e){if(e===Ea)return t;const n=Xf(t);if(!dP(n,e))return ZY(t,n,e);const r=n[e];return t.finalized_||!Lh(r)?r:r===_E(t.base_,e)?(wE(t),t.copy_[e]=gP(r,t)):r},has(t,e){return e in Xf(t)},ownKeys(t){return Reflect.ownKeys(Xf(t))},set(t,e,n){const r=C4(Xf(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=_E(Xf(t),e),s=i==null?void 0:i[Ea];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(WY(n,i)&&(n!==void 0||dP(t.base_,e)))return!0;wE(t),mP(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 _E(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,wE(t),mP(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Xf(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){jo(11)},getPrototypeOf(t){return py(t.base_)},setPrototypeOf(){jo(12)}},gy={};_w(qC,(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 qC.set.call(this,t[0],e,n,t[0])};function _E(t,e){const n=t[Ea];return(n?Xf(n):t)[e]}function ZY(t,e,n){var i;const r=C4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function C4(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 mP(t){t.modified_||(t.modified_=!0,t.parent_&&mP(t.parent_))}function wE(t){t.copy_||(t.copy_=fP(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var QY=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 a=this;return function(l=s,...c){return a.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&jo(6),r!==void 0&&typeof r!="function"&&jo(7);let i;if(Lh(e)){const s=xk(this),a=gP(e,void 0);let o=!0;try{i=n(a),o=!1}finally{o?hP(s):pP(s)}return yk(s,r),bk(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===E4&&(i=void 0),this.autoFreeze_&&XC(i,!0),r){const s=[],a=[];Dh("Patches").generateReplacementPatches_(e,i,s,a),r(s,a)}return i}else jo(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(a,...o)=>this.produceWithPatches(a,l=>e(l,...o));let r,i;return[this.produce(e,n,(a,o)=>{r=a,i=o}),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){Lh(t)||jo(8),Mg(t)&&(t=JY(t));const e=xk(this),n=gP(t,void 0);return n[Ea].isManual_=!0,pP(e),n}finishDraft(t,e){const n=t&&t[Ea];(!n||!n.isManual_)&&jo(9);const{scope_:r}=n;return yk(r,e),bk(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=Dh("Patches").applyPatches_;return Mg(t)?r(t,e):this.produce(t,i=>r(i,e))}};function gP(t,e){const n=Zy(t)?Dh("MapSet").proxyMap_(t,e):yS(t)?Dh("MapSet").proxySet_(t,e):YY(t,e);return(e?e.scope_:P4()).drafts_.push(n),n}function JY(t){return Mg(t)||jo(10,t),R4(t)}function R4(t){if(!Lh(t)||xS(t))return t;const e=t[Ea];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=fP(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=fP(t,!0);return _w(n,(i,s)=>{T4(n,i,R4(s))},r),e&&(e.finalized_=!1),n}var eZ=new QY;eZ.produce;var tZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},N4=cs({name:"legend",initialState:tZ,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=Ga(t).payload.indexOf(r);s>-1&&(t.payload[s]=i)},prepare:ar()},removeLegendPayload:{reducer(t,e){var n=Ga(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:ar()}}}),Qy=N4.actions;Qy.setLegendSize;Qy.setLegendSettings;var nZ=Qy.addLegendPayload,rZ=Qy.replaceLegendPayload,iZ=Qy.removeLegendPayload,sZ=N4.reducer,SE={exports:{}},ME={};/** + height and width.`,ie,pe,s,a,l,c,n),R.createElement("div",bw({id:b?"".concat(b):void 0,className:tr("recharts-responsive-container",S),style:pk(pk({},M),{},{width:s,height:a,minWidth:l,minHeight:c,maxHeight:d}),ref:P},T),R.createElement("div",{style:PY({width:s,height:a})},R.createElement(b4,{width:ie,height:pe},f)))}),VY=R.forwardRef((t,e)=>{var n=GC();if(Il(n.width)&&Il(n.height))return t.children;var r=CY({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,a=y4(void 0,void 0,{width:i,height:s,aspect:t.aspect,maxHeight:t.maxHeight}),o=a.calculatedWidth,l=a.calculatedHeight;return kt(o)&&kt(l)?R.createElement(b4,{width:o,height:l},t.children):R.createElement(HY,bw({},t,{width:i,height:s,ref:e}))});function WC(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 gS=()=>{var t,e=Js(),n=Ft(xY),r=Ft(mS),i=(t=Ft(pS))===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}},GY={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_4=()=>{var t;return(t=Ft(Wi))!==null&&t!==void 0?t:GY},w4=()=>Ft(Jc),S4=()=>Ft(eu),hr=t=>t.layout.layoutType,Vg=()=>Ft(hr),$C=()=>{var t=Vg();if(t==="horizontal"||t==="vertical")return t},M4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},WY=()=>{var t=Vg();return t!==void 0},Yy=t=>{var e=Wr(),n=Js(),r=t.width,i=t.height,s=GC(),a=r,o=i;return s&&(a=s.width>0?s.width:r,o=s.height>0?s.height:i),R.useEffect(()=>{!n&&Il(a)&&Il(o)&&e(WK({width:a,height:o}))},[e,n,a,o]),null},E4=Symbol.for("immer-nothing"),gk=Symbol.for("immer-draftable"),Ea=Symbol.for("immer-state");function jo(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var py=Object.getPrototypeOf;function Mg(t){return!!t&&!!t[Ea]}function Lh(t){var e;return t?A4(t)||Array.isArray(t)||!!t[gk]||!!((e=t.constructor)!=null&&e[gk])||Zy(t)||yS(t):!1}var $Y=Object.prototype.constructor.toString(),vk=new WeakMap;function A4(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=vk.get(n);return r===void 0&&(r=Function.toString.call(n),vk.set(n,r)),r===$Y}function _w(t,e,n=!0){vS(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 vS(t){const e=t[Ea];return e?e.type_:Array.isArray(t)?1:Zy(t)?2:yS(t)?3:0}function dP(t,e){return vS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function T4(t,e,n){const r=vS(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function XY(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Zy(t){return t instanceof Map}function yS(t){return t instanceof Set}function Xf(t){return t.copy_||t.base_}function fP(t,e){if(Zy(t))return new Map(t);if(yS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=A4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Ea];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=>XC(n,!0))),t}function qY(){jo(2)}var Cb={value:qY};function xS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var KY={};function Dh(t){const e=KY[t];return e||jo(0,t),e}var my;function P4(){return my}function YY(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function yk(t,e){e&&(Dh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function hP(t){pP(t),t.drafts_.forEach(ZY),t.drafts_=null}function pP(t){t===my&&(my=t.parent_)}function xk(t){return my=YY(my,t)}function ZY(t){const e=t[Ea];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function bk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Ea].modified_&&(hP(e),jo(4)),Lh(t)&&(t=ww(e,t),e.parent_||Sw(e,t)),e.patches_&&Dh("Patches").generateReplacementPatches_(n[Ea].base_,t,e.patches_,e.inversePatches_)):t=ww(e,n,[]),hP(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==E4?t:void 0}function ww(t,e,n){if(xS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Ea];if(!i)return _w(e,(s,a)=>_k(t,i,e,s,a,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 a=s,o=!1;i.type_===3&&(a=new Set(s),s.clear(),o=!0),_w(a,(l,c)=>_k(t,i,s,l,c,n,o),r),Sw(t,s,!1),n&&t.patches_&&Dh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function _k(t,e,n,r,i,s,a){if(i==null||typeof i!="object"&&!a)return;const o=xS(i);if(!(o&&!a)){if(Mg(i)){const l=s&&e&&e.type_!==3&&!dP(e.assigned_,r)?s.concat(r):void 0,c=ww(t,i,l);if(T4(n,r,c),Mg(c))t.canAutoFreeze_=!1;else return}else a&&n.add(i);if(Lh(i)&&!o){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===i&&o)return;ww(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(Zy(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_&&XC(e,n)}function QY(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=qC;n&&(i=[r],s=gy);const{revoke:a,proxy:o}=Proxy.revocable(i,s);return r.draft_=o,r.revoke_=a,o}var qC={get(t,e){if(e===Ea)return t;const n=Xf(t);if(!dP(n,e))return JY(t,n,e);const r=n[e];return t.finalized_||!Lh(r)?r:r===_E(t.base_,e)?(wE(t),t.copy_[e]=gP(r,t)):r},has(t,e){return e in Xf(t)},ownKeys(t){return Reflect.ownKeys(Xf(t))},set(t,e,n){const r=C4(Xf(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=_E(Xf(t),e),s=i==null?void 0:i[Ea];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(XY(n,i)&&(n!==void 0||dP(t.base_,e)))return!0;wE(t),mP(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 _E(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,wE(t),mP(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Xf(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){jo(11)},getPrototypeOf(t){return py(t.base_)},setPrototypeOf(){jo(12)}},gy={};_w(qC,(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 qC.set.call(this,t[0],e,n,t[0])};function _E(t,e){const n=t[Ea];return(n?Xf(n):t)[e]}function JY(t,e,n){var i;const r=C4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function C4(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 mP(t){t.modified_||(t.modified_=!0,t.parent_&&mP(t.parent_))}function wE(t){t.copy_||(t.copy_=fP(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 a=this;return function(l=s,...c){return a.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&jo(6),r!==void 0&&typeof r!="function"&&jo(7);let i;if(Lh(e)){const s=xk(this),a=gP(e,void 0);let o=!0;try{i=n(a),o=!1}finally{o?hP(s):pP(s)}return yk(s,r),bk(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===E4&&(i=void 0),this.autoFreeze_&&XC(i,!0),r){const s=[],a=[];Dh("Patches").generateReplacementPatches_(e,i,s,a),r(s,a)}return i}else jo(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(a,...o)=>this.produceWithPatches(a,l=>e(l,...o));let r,i;return[this.produce(e,n,(a,o)=>{r=a,i=o}),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){Lh(t)||jo(8),Mg(t)&&(t=tZ(t));const e=xk(this),n=gP(t,void 0);return n[Ea].isManual_=!0,pP(e),n}finishDraft(t,e){const n=t&&t[Ea];(!n||!n.isManual_)&&jo(9);const{scope_:r}=n;return yk(r,e),bk(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=Dh("Patches").applyPatches_;return Mg(t)?r(t,e):this.produce(t,i=>r(i,e))}};function gP(t,e){const n=Zy(t)?Dh("MapSet").proxyMap_(t,e):yS(t)?Dh("MapSet").proxySet_(t,e):QY(t,e);return(e?e.scope_:P4()).drafts_.push(n),n}function tZ(t){return Mg(t)||jo(10,t),R4(t)}function R4(t){if(!Lh(t)||xS(t))return t;const e=t[Ea];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=fP(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=fP(t,!0);return _w(n,(i,s)=>{T4(n,i,R4(s))},r),e&&(e.finalized_=!1),n}var nZ=new eZ;nZ.produce;var rZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},N4=cs({name:"legend",initialState:rZ,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=Ga(t).payload.indexOf(r);s>-1&&(t.payload[s]=i)},prepare:ar()},removeLegendPayload:{reducer(t,e){var n=Ga(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:ar()}}}),Qy=N4.actions;Qy.setLegendSize;Qy.setLegendSettings;var iZ=Qy.addLegendPayload,sZ=Qy.replaceLegendPayload,aZ=Qy.removeLegendPayload,oZ=N4.reducer,SE={exports:{}},ME={};/** * @license React * use-sync-external-store-with-selector.production.js * @@ -536,12 +541,12 @@ 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 wk;function aZ(){if(wk)return ME;wk=1;var t=qh();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,a=t.useMemo,o=t.useDebugValue;return ME.useSyncExternalStoreWithSelector=function(l,c,d,f,p){var y=i(null);if(y.current===null){var b={hasValue:!1,value:null};y.current=b}else b=y.current;y=a(function(){function w(O){if(!x){if(x=!0,M=O,O=f(O),p!==void 0&&b.hasValue){var N=b.value;if(p(N,O))return T=N}return T=O}if(N=T,n(M,O))return N;var D=f(O);return p!==void 0&&p(N,D)?(M=O,N):(M=O,T=D)}var x=!1,M,T,P=d===void 0?null:d;return[function(){return w(c())},P===null?void 0:function(){return w(P())}]},[c,d,f,p]);var S=r(l,y[0],y[1]);return s(function(){b.hasValue=!0,b.value=S},[S]),o(S),S},ME}var Sk;function oZ(){return Sk||(Sk=1,SE.exports=aZ()),SE.exports}oZ();function lZ(t){t()}function cZ(){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 Mk={notify(){},get:()=>[]};function uZ(t,e){let n,r=Mk,i=0,s=!1;function a(S){d();const w=r.subscribe(S);let x=!1;return()=>{x||(x=!0,w(),f())}}function o(){r.notify()}function l(){b.onStateChange&&b.onStateChange()}function c(){return s}function d(){i++,n||(n=t.subscribe(l),r=cZ())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Mk)}function p(){s||(s=!0,d())}function y(){s&&(s=!1,f())}const b={addNestedSub:a,notifyNestedSubs:o,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:y,getListeners:()=>r};return b}var dZ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",fZ=dZ(),hZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",pZ=hZ(),mZ=()=>fZ||pZ?R.useLayoutEffect:R.useEffect,gZ=mZ();function Ek(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function vZ(t,e){if(Ek(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=uZ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),a=R.useMemo(()=>i.getState(),[i]);gZ(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),a!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,a]);const o=n||xZ;return R.createElement(o.Provider,{value:s},e)}var _Z=bZ,wZ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function SZ(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function bS(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(wZ.has(r)){if(t[r]==null&&e[r]==null)continue;if(!vZ(t[r],e[r]))return!1}else if(!SZ(t[r],e[r]))return!1;return!0}function vP(){return vP=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,a=s===void 0?am.labelStyle:s,o=t.payload,l=t.formatter,c=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,p=t.label,y=t.labelFormatter,b=t.accessibilityLayer,S=b===void 0?am.accessibilityLayer:b,w=()=>{if(o&&o.length){var z={padding:0,margin:0},V=kZ(o,c),k=V.map((j,X)=>{if(!j||j.type==="none")return null;var ee=j.formatter||l||IZ,ie=j.value,pe=j.name,ae=ie,he=pe;if(ee){var B=ee(ie,pe,j,X,o);if(Array.isArray(B)){var J=TZ(B,2);ae=J[0],he=J[1]}else if(B!=null)ae=B;else return null}var Y=i0(i0({},am.itemStyle),{},{color:j.color||am.itemStyle.color},i);return R.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(X),style:Y},Nl(he)?R.createElement("span",{className:"recharts-tooltip-item-name"},he):null,Nl(he)?R.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,R.createElement("span",{className:"recharts-tooltip-item-value"},ae),R.createElement("span",{className:"recharts-tooltip-item-unit"},j.unit||""))});return R.createElement("ul",{className:"recharts-tooltip-item-list",style:z},k)}return null},x=i0(i0({},am.contentStyle),r),M=i0({margin:0},a),T=!Vi(p),P=T?p:"",O=tr("recharts-default-tooltip",d),N=tr("recharts-tooltip-label",f);T&&y&&o!==void 0&&o!==null&&(P=y(p,o));var D=S?{role:"status","aria-live":"assertive"}:{};return R.createElement("div",vP({className:O,style:x},D),R.createElement("p",{className:N,style:M},R.isValidElement(P)?P:"".concat(P)),w())},s0="recharts-tooltip-wrapper",LZ={visibility:"hidden"};function DZ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return tr(s0,{["".concat(s0,"-right")]:kt(n)&&e&&kt(e.x)&&n>=e.x,["".concat(s0,"-left")]:kt(n)&&e&&kt(e.x)&&n=e.y,["".concat(s0,"-top")]:kt(r)&&e&&kt(e.y)&&r0?i:0),f=n[r]+i;if(e[r])return a[r]?d:f;var p=l[r];if(p==null)return 0;if(a[r]){var y=d,b=p;return yw?Math.max(d,p):Math.max(f,p)}function UZ(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 jZ(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,i=t.offsetLeft,s=t.position,a=t.reverseDirection,o=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,f,p;return o.height>0&&o.width>0&&n?(f=Pk({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),p=Pk({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=UZ({translateX:f,translateY:p,useTranslate3d:l})):d=LZ,{cssProperties:d,cssClasses:DZ({translateX:f,translateY:p,coordinate:n})}}var FZ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Jy={isSsr:FZ()};function zZ(t,e){return GZ(t)||VZ(t,e)||HZ(t,e)||BZ()}function BZ(){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 HZ(t,e){if(t){if(typeof t=="string")return Ck(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)?Ck(t,e):void 0}}function Ck(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nJy.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=zZ(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 Rk(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 om(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=qZ(l,2),d=c[0],f=c[1];R.useEffect(()=>{var x=M=>{if(M.key==="Escape"){var T,P,O,N;f({dismissed:!0,dismissedAtCoordinate:{x:(T=(P=t.coordinate)===null||P===void 0?void 0:P.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",x),()=>{document.removeEventListener("keydown",x)}},[(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=(a=t.coordinate)===null||a===void 0?void 0:a.y)!==null&&s!==void 0?s:0)!==d.dismissedAtCoordinate.y)&&f(om(om({},d),{},{dismissed:!1}));var p=jZ({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=p.cssClasses,b=p.cssProperties,S=t.hasPortalFromProps?{}:om(om({transition:JZ({prefersReducedMotion:o,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},b),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),w=om(om({},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:w,ref:t.innerRef},t.children)}var tQ=R.memo(eQ),k4=()=>{var t;return(t=Ft(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function yP(){return yP=Object.assign?Object.assign.bind():function(t){for(var e=1;ewn(t.x)&&wn(t.y),Lk=t=>t.base!=null&&Mw(t.base)&&Mw(t),a0=t=>t.x,o0=t=>t.y,sQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(OC(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=Ok["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return Ok[n]||J1},Dk={connectNulls:!1,type:"linear"},aQ=t=>{var e=t.type,n=e===void 0?Dk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,a=t.layout,o=t.connectNulls,l=o===void 0?Dk.connectNulls:o,c=sQ(n,a),d=l?i.filter(Mw):i;if(Array.isArray(s)){var f,p=i.map((x,M)=>kk(kk({},x),{},{base:s[M]}));a==="vertical"?f=wb().y(o0).x1(a0).x0(x=>x.base.x):f=wb().x(a0).y1(o0).y0(x=>x.base.y);var y=f.defined(Lk).curve(c),b=l?p.filter(Lk):p;return y(b)}var S;a==="vertical"&&kt(s)?S=wb().y(o0).x1(a0).x0(s):kt(s)?S=wb().x(a0).y1(o0).y0(s):S=l5().x(a0).y(o0);var w=S.defined(Mw).curve(c);return w(d)},G_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Vg();if((!n||!n.length)&&!r)return null;var a={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},o=n&&n.length?aQ(a):r;return R.createElement("path",yP({},zo(t),LC(t),{className:tr("recharts-curve",e),d:o===null?void 0:o,ref:i}))},oQ=["x","y","top","left","width","height","className"];function xP(){return xP=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),mQ=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,i=r===void 0?0:r,s=t.top,a=s===void 0?0:s,o=t.left,l=o===void 0?0:o,c=t.width,d=c===void 0?0:c,f=t.height,p=f===void 0?0:f,y=t.className,b=fQ(t,oQ),S=lQ({x:n,y:i,top:a,left:l,width:d,height:p},b);return!kt(n)||!kt(i)||!kt(d)||!kt(p)||!kt(a)||!kt(l)?null:R.createElement("path",xP({},Xa(S),{className:tr("recharts-cross",y),d:pQ(n,i,d,p,a,l)}))};function gQ(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,O4=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],L4=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),jk=(t,e)=>n=>{var r=O4(t,e);return L4(r,n)},vQ=(t,e)=>n=>{var r=O4(t,e),i=[...r.map((s,a)=>s*a).slice(1),0];return L4(i,n)},yQ=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]]},xQ=function(){for(var e=arguments.length,n=new Array(e),r=0;r{var i=jk(t,n),s=jk(e,r),a=vQ(t,n),o=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,p=0;p<8;++p){var y=i(f)-d,b=a(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,a=e.dt,o=a===void 0?16.67:a,l=1,c=[0],d=0,f=0,p=1e4,y=0;y{var M,T,P;if(x<=0)return 0;if(x>=1)return l;var O=x*w,N=Math.floor(O),D=O-N;return((M=c[N])!==null&&M!==void 0?M:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((P=c[N])!==null&&P!==void 0?P:0))*D}},wQ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Fk(t);case"spring":return _Q();default:if(t.split("(")[0]==="cubic-bezier")return Fk(t)}return typeof t=="function"?t:null},SQ=(t,e,n)=>{var r,i=s=>{var a=e.tick(s);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(i,a);return}r=t.setTimeout(i,a)};return r=t.setTimeout(i,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},D4=R.createContext(SQ);D4.Provider;function MQ(t){var e=R.useContext(D4);return R.useMemo(()=>t??e,[t,e])}function EQ(t,e,n){return(e=AQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function AQ(t){var e=TQ(t,"string");return typeof e=="symbol"?e:e+""}function TQ(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 zk="init",Bk="pending",Hk="active",PQ="completed";function TE(t){return Math.max(0,t)}class CQ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;EQ(this,"state",zk),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=TE(e.animationDuration),this.animationBegin=TE(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()===zk)return this.state=Bk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===Bk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Hk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):TE(this.animationBegin-n)}if(this.getState()===Hk){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=PQ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class RQ extends CQ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Dc(this.getFrom(),this.getTo(),this.getProgress()))}}class NQ{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=a=>{a-r>=n?e(a):i=requestAnimationFrame(s)};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function IQ(t,e){return DQ(t)||LQ(t,e)||OQ(t,e)||kQ()}function kQ(){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 OQ(t,e){if(t){if(typeof t=="string")return Vk(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)?Vk(t,e):void 0}}function Vk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{},onAnimationStart:()=>{}},Gk=0,PE=1;function U4(t){var e=Za(t,UQ),n=e.animationId,r=e.isActive,i=e.canBegin,s=e.duration,a=e.easing,o=e.begin,l=e.onAnimationEnd,c=e.onAnimationStart,d=e.children,f=I4(),p=r==="auto"?!Jy.isSsr&&!f:r,y=MQ(e.animationController),b=R.useState(p?Gk:PE),S=IQ(b,2),w=S[0],x=S[1];return R.useEffect(()=>{p||x(PE)},[p]),R.useEffect(()=>{var M=wQ(a);if(!p||!i||M==null)return Hg;var T=new NQ,P=new RQ({animationId:n,easing:M,animationDuration:s,animationBegin:o,onAnimationStart:c,onAnimationEnd:l,from:Gk,to:PE});return y(T,P,x)},[y,n,p,i,s,a,o,c,l]),d(Number(w))}function j4(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 jQ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),FQ=(t,e,n)=>t.map(r=>"".concat(jQ(r)," ").concat(e,"ms ").concat(n)).join(","),zQ=["radius"],BQ=["radius"],Wk,$k,Xk,qk,Kk,Yk,Zk,Qk,Jk,eO;function tO(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 nO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var s=yd(n),a=yd(r),o=Math.min(Math.abs(s)/2,Math.abs(a)/2),l=a>=0?1:-1,c=s>=0?1:-1,d=a>=0&&s>=0||a<0&&s<0?1:0,f;if(o>0&&Array.isArray(i)){for(var p=[0,0,0,0],y=0,b=4;yo?o:w}f=Ui(Wk||(Wk=fl(["M",",",""])),t,e+l*p[0]),p[0]>0&&(f+=Ui($k||($k=fl(["A ",",",",0,0,",",",",",""])),p[0],p[0],d,t+c*p[0],e)),f+=Ui(Xk||(Xk=fl(["L ",",",""])),t+n-c*p[1],e),p[1]>0&&(f+=Ui(qk||(qk=fl(["A ",",",",0,0,",`, + */var wk;function lZ(){if(wk)return ME;wk=1;var t=qh();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,a=t.useMemo,o=t.useDebugValue;return ME.useSyncExternalStoreWithSelector=function(l,c,d,f,p){var y=i(null);if(y.current===null){var b={hasValue:!1,value:null};y.current=b}else b=y.current;y=a(function(){function w(O){if(!x){if(x=!0,M=O,O=f(O),p!==void 0&&b.hasValue){var N=b.value;if(p(N,O))return T=N}return T=O}if(N=T,n(M,O))return N;var D=f(O);return p!==void 0&&p(N,D)?(M=O,N):(M=O,T=D)}var x=!1,M,T,P=d===void 0?null:d;return[function(){return w(c())},P===null?void 0:function(){return w(P())}]},[c,d,f,p]);var S=r(l,y[0],y[1]);return s(function(){b.hasValue=!0,b.value=S},[S]),o(S),S},ME}var Sk;function cZ(){return Sk||(Sk=1,SE.exports=lZ()),SE.exports}cZ();function uZ(t){t()}function dZ(){let t=null,e=null;return{clear(){t=null,e=null},notify(){uZ(()=>{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 Mk={notify(){},get:()=>[]};function fZ(t,e){let n,r=Mk,i=0,s=!1;function a(S){d();const w=r.subscribe(S);let x=!1;return()=>{x||(x=!0,w(),f())}}function o(){r.notify()}function l(){b.onStateChange&&b.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=Mk)}function p(){s||(s=!0,d())}function y(){s&&(s=!1,f())}const b={addNestedSub:a,notifyNestedSubs:o,handleChangeWrapper:l,isSubscribed:c,trySubscribe:p,tryUnsubscribe:y,getListeners:()=>r};return b}var hZ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",pZ=hZ(),mZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",gZ=mZ(),vZ=()=>pZ||gZ?R.useLayoutEffect:R.useEffect,yZ=vZ();function Ek(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function xZ(t,e){if(Ek(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=fZ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),a=R.useMemo(()=>i.getState(),[i]);yZ(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),a!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,a]);const o=n||_Z;return R.createElement(o.Provider,{value:s},e)}var SZ=wZ,MZ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function EZ(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function bS(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(MZ.has(r)){if(t[r]==null&&e[r]==null)continue;if(!xZ(t[r],e[r]))return!1}else if(!EZ(t[r],e[r]))return!1;return!0}function vP(){return vP=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,a=s===void 0?am.labelStyle:s,o=t.payload,l=t.formatter,c=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,p=t.label,y=t.labelFormatter,b=t.accessibilityLayer,S=b===void 0?am.accessibilityLayer:b,w=()=>{if(o&&o.length){var z={padding:0,margin:0},V=LZ(o,c),k=V.map((j,X)=>{if(!j||j.type==="none")return null;var ee=j.formatter||l||OZ,ie=j.value,pe=j.name,ae=ie,he=pe;if(ee){var B=ee(ie,pe,j,X,o);if(Array.isArray(B)){var J=CZ(B,2);ae=J[0],he=J[1]}else if(B!=null)ae=B;else return null}var Y=i0(i0({},am.itemStyle),{},{color:j.color||am.itemStyle.color},i);return R.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(X),style:Y},Nl(he)?R.createElement("span",{className:"recharts-tooltip-item-name"},he):null,Nl(he)?R.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,R.createElement("span",{className:"recharts-tooltip-item-value"},ae),R.createElement("span",{className:"recharts-tooltip-item-unit"},j.unit||""))});return R.createElement("ul",{className:"recharts-tooltip-item-list",style:z},k)}return null},x=i0(i0({},am.contentStyle),r),M=i0({margin:0},a),T=!Vi(p),P=T?p:"",O=tr("recharts-default-tooltip",d),N=tr("recharts-tooltip-label",f);T&&y&&o!==void 0&&o!==null&&(P=y(p,o));var D=S?{role:"status","aria-live":"assertive"}:{};return R.createElement("div",vP({className:O,style:x},D),R.createElement("p",{className:N,style:M},R.isValidElement(P)?P:"".concat(P)),w())},s0="recharts-tooltip-wrapper",UZ={visibility:"hidden"};function jZ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return tr(s0,{["".concat(s0,"-right")]:kt(n)&&e&&kt(e.x)&&n>=e.x,["".concat(s0,"-left")]:kt(n)&&e&&kt(e.x)&&n=e.y,["".concat(s0,"-top")]:kt(r)&&e&&kt(e.y)&&r0?i:0),f=n[r]+i;if(e[r])return a[r]?d:f;var p=l[r];if(p==null)return 0;if(a[r]){var y=d,b=p;return yw?Math.max(d,p):Math.max(f,p)}function FZ(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 zZ(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,i=t.offsetLeft,s=t.position,a=t.reverseDirection,o=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,f,p;return o.height>0&&o.width>0&&n?(f=Pk({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),p=Pk({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=FZ({translateX:f,translateY:p,useTranslate3d:l})):d=UZ,{cssProperties:d,cssClasses:jZ({translateX:f,translateY:p,coordinate:n})}}var BZ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Jy={isSsr:BZ()};function HZ(t,e){return $Z(t)||WZ(t,e)||GZ(t,e)||VZ()}function VZ(){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 GZ(t,e){if(t){if(typeof t=="string")return Ck(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)?Ck(t,e):void 0}}function Ck(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nJy.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=HZ(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 Rk(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 om(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=YZ(l,2),d=c[0],f=c[1];R.useEffect(()=>{var x=M=>{if(M.key==="Escape"){var T,P,O,N;f({dismissed:!0,dismissedAtCoordinate:{x:(T=(P=t.coordinate)===null||P===void 0?void 0:P.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",x),()=>{document.removeEventListener("keydown",x)}},[(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=(a=t.coordinate)===null||a===void 0?void 0:a.y)!==null&&s!==void 0?s:0)!==d.dismissedAtCoordinate.y)&&f(om(om({},d),{},{dismissed:!1}));var p=zZ({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=p.cssClasses,b=p.cssProperties,S=t.hasPortalFromProps?{}:om(om({transition:tQ({prefersReducedMotion:o,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},b),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),w=om(om({},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:w,ref:t.innerRef},t.children)}var rQ=R.memo(nQ),k4=()=>{var t;return(t=Ft(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function yP(){return yP=Object.assign?Object.assign.bind():function(t){for(var e=1;ewn(t.x)&&wn(t.y),Lk=t=>t.base!=null&&Mw(t.base)&&Mw(t),a0=t=>t.x,o0=t=>t.y,oQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(OC(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=Ok["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return Ok[n]||J1},Dk={connectNulls:!1,type:"linear"},lQ=t=>{var e=t.type,n=e===void 0?Dk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,a=t.layout,o=t.connectNulls,l=o===void 0?Dk.connectNulls:o,c=oQ(n,a),d=l?i.filter(Mw):i;if(Array.isArray(s)){var f,p=i.map((x,M)=>kk(kk({},x),{},{base:s[M]}));a==="vertical"?f=wb().y(o0).x1(a0).x0(x=>x.base.x):f=wb().x(a0).y1(o0).y0(x=>x.base.y);var y=f.defined(Lk).curve(c),b=l?p.filter(Lk):p;return y(b)}var S;a==="vertical"&&kt(s)?S=wb().y(o0).x1(a0).x0(s):kt(s)?S=wb().x(a0).y1(o0).y0(s):S=l5().x(a0).y(o0);var w=S.defined(Mw).curve(c);return w(d)},G_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Vg();if((!n||!n.length)&&!r)return null;var a={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},o=n&&n.length?lQ(a):r;return R.createElement("path",yP({},zo(t),LC(t),{className:tr("recharts-curve",e),d:o===null?void 0:o,ref:i}))},cQ=["x","y","top","left","width","height","className"];function xP(){return xP=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),vQ=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,i=r===void 0?0:r,s=t.top,a=s===void 0?0:s,o=t.left,l=o===void 0?0:o,c=t.width,d=c===void 0?0:c,f=t.height,p=f===void 0?0:f,y=t.className,b=pQ(t,cQ),S=uQ({x:n,y:i,top:a,left:l,width:d,height:p},b);return!kt(n)||!kt(i)||!kt(d)||!kt(p)||!kt(a)||!kt(l)?null:R.createElement("path",xP({},Xa(S),{className:tr("recharts-cross",y),d:gQ(n,i,d,p,a,l)}))};function yQ(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,O4=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],L4=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),jk=(t,e)=>n=>{var r=O4(t,e);return L4(r,n)},xQ=(t,e)=>n=>{var r=O4(t,e),i=[...r.map((s,a)=>s*a).slice(1),0];return L4(i,n)},bQ=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=jk(t,n),s=jk(e,r),a=xQ(t,n),o=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,p=0;p<8;++p){var y=i(f)-d,b=a(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,a=e.dt,o=a===void 0?16.67:a,l=1,c=[0],d=0,f=0,p=1e4,y=0;y{var M,T,P;if(x<=0)return 0;if(x>=1)return l;var O=x*w,N=Math.floor(O),D=O-N;return((M=c[N])!==null&&M!==void 0?M:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((P=c[N])!==null&&P!==void 0?P:0))*D}},MQ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Fk(t);case"spring":return SQ();default:if(t.split("(")[0]==="cubic-bezier")return Fk(t)}return typeof t=="function"?t:null},EQ=(t,e,n)=>{var r,i=s=>{var a=e.tick(s);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(i,a);return}r=t.setTimeout(i,a)};return r=t.setTimeout(i,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},D4=R.createContext(EQ);D4.Provider;function AQ(t){var e=R.useContext(D4);return R.useMemo(()=>t??e,[t,e])}function TQ(t,e,n){return(e=PQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function PQ(t){var e=CQ(t,"string");return typeof e=="symbol"?e:e+""}function CQ(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 zk="init",Bk="pending",Hk="active",RQ="completed";function TE(t){return Math.max(0,t)}class NQ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;TQ(this,"state",zk),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=TE(e.animationDuration),this.animationBegin=TE(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()===zk)return this.state=Bk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===Bk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Hk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):TE(this.animationBegin-n)}if(this.getState()===Hk){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=RQ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class IQ extends NQ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Dc(this.getFrom(),this.getTo(),this.getProgress()))}}class kQ{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=a=>{a-r>=n?e(a):i=requestAnimationFrame(s)};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function OQ(t,e){return jQ(t)||UQ(t,e)||DQ(t,e)||LQ()}function LQ(){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 DQ(t,e){if(t){if(typeof t=="string")return Vk(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)?Vk(t,e):void 0}}function Vk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{},onAnimationStart:()=>{}},Gk=0,PE=1;function U4(t){var e=Za(t,FQ),n=e.animationId,r=e.isActive,i=e.canBegin,s=e.duration,a=e.easing,o=e.begin,l=e.onAnimationEnd,c=e.onAnimationStart,d=e.children,f=I4(),p=r==="auto"?!Jy.isSsr&&!f:r,y=AQ(e.animationController),b=R.useState(p?Gk:PE),S=OQ(b,2),w=S[0],x=S[1];return R.useEffect(()=>{p||x(PE)},[p]),R.useEffect(()=>{var M=MQ(a);if(!p||!i||M==null)return Hg;var T=new kQ,P=new IQ({animationId:n,easing:M,animationDuration:s,animationBegin:o,onAnimationStart:c,onAnimationEnd:l,from:Gk,to:PE});return y(T,P,x)},[y,n,p,i,s,a,o,c,l]),d(Number(w))}function j4(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 zQ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),BQ=(t,e,n)=>t.map(r=>"".concat(zQ(r)," ").concat(e,"ms ").concat(n)).join(","),HQ=["radius"],VQ=["radius"],Wk,$k,Xk,qk,Kk,Yk,Zk,Qk,Jk,eO;function tO(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 nO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var s=yd(n),a=yd(r),o=Math.min(Math.abs(s)/2,Math.abs(a)/2),l=a>=0?1:-1,c=s>=0?1:-1,d=a>=0&&s>=0||a<0&&s<0?1:0,f;if(o>0&&Array.isArray(i)){for(var p=[0,0,0,0],y=0,b=4;yo?o:w}f=Ui(Wk||(Wk=fl(["M",",",""])),t,e+l*p[0]),p[0]>0&&(f+=Ui($k||($k=fl(["A ",",",",0,0,",",",",",""])),p[0],p[0],d,t+c*p[0],e)),f+=Ui(Xk||(Xk=fl(["L ",",",""])),t+n-c*p[1],e),p[1]>0&&(f+=Ui(qk||(qk=fl(["A ",",",",0,0,",`, `,",",""])),p[1],p[1],d,t+n,e+l*p[1])),f+=Ui(Kk||(Kk=fl(["L ",",",""])),t+n,e+r-l*p[2]),p[2]>0&&(f+=Ui(Yk||(Yk=fl(["A ",",",",0,0,",`, `,",",""])),p[2],p[2],d,t+n-c*p[2],e+r)),f+=Ui(Zk||(Zk=fl(["L ",",",""])),t+c*p[3],e+r),p[3]>0&&(f+=Ui(Qk||(Qk=fl(["A ",",",",0,0,",`, `,",",""])),p[3],p[3],d,t,e+r-l*p[3])),f+="Z"}else if(o>0&&i===+i&&i>0){var x=Math.min(o,i);f=Ui(Jk||(Jk=fl(["M ",",",` @@ -551,14 +556,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho L `,",",` A `,",",",0,0,",",",",",` L `,",",` - A `,",",",0,0,",",",","," Z"])),t,e+l*x,x,x,d,t+c*x,e,t+n-c*x,e,x,x,d,t+n,e+l*x,t+n,e+r-l*x,x,x,d,t+n-c*x,e+r,t+c*x,e+r,x,x,d,t,e+r-l*x)}else f=Ui(eO||(eO=fl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},aO={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},ZQ=t=>{var e=Za(t,aO),n=R.useRef(null),r=R.useState(-1),i=$Q(r,2),s=i[0],a=i[1];R.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var B=n.current.getTotalLength();B&&a(B)}catch{}},[]);var o=e.x,l=e.y,c=e.width,d=e.height,f=e.radius,p=e.className,y=e.animationEasing,b=e.animationDuration,S=e.animationBegin,w=e.isAnimationActive,x=e.isUpdateAnimationActive,M=R.useRef(c),T=R.useRef(d),P=R.useRef(o),O=R.useRef(l),N=R.useMemo(()=>({x:o,y:l,width:c,height:d,radius:f}),[o,l,c,d,f]),D=j4(N,"rectangle-");if(o!==+o||l!==+l||c!==+c||d!==+d||c===0||d===0)return null;var z=tr("recharts-rectangle",p);if(!x){var V=Xa(e);V.radius;var k=rO(V,zQ);return R.createElement("path",Aw({},k,{x:yd(o),y:yd(l),width:yd(c),height:yd(d),radius:typeof f=="number"?f:void 0,className:z,d:sO(o,l,c,d,f)}))}var j=M.current,X=T.current,ee=P.current,ie=O.current,pe="0px ".concat(s===-1?1:s,"px"),ae="".concat(s,"px ").concat(s,"px"),he=FQ(["strokeDasharray"],b,typeof y=="string"?y:aO.animationEasing);return R.createElement(U4,{animationId:D,key:D,canBegin:s>0,duration:b,easing:y,isActive:x,begin:S},B=>{var J=Dc(j,c,B),Y=Dc(X,d,B),H=Dc(ee,o,B),G=Dc(ie,l,B);n.current&&(M.current=J,T.current=Y,P.current=H,O.current=G);var le;w?B>0?le={transition:he,strokeDasharray:ae}:le={strokeDasharray:pe}:le={strokeDasharray:ae};var se=Xa(e);se.radius;var ce=rO(se,BQ);return R.createElement("path",Aw({},ce,{radius:typeof f=="number"?f:void 0,className:z,d:sO(H,G,J,Y,f),ref:n,style:nO(nO({},le),e.style)}))})};function oO(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*180/Math.PI,Bi=(t,e,n,r)=>({x:t+Math.cos(-Tw*r)*n,y:e+Math.sin(-Tw*r)*n}),nJ=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)},iJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,a=rJ({x:n,y:r},{x:i,y:s});if(a<=0)return{radius:a,angle:0};var o=(n-i)/a,l=Math.acos(o);return r>s&&(l=2*Math.PI-l),{radius:a,angle:tJ(l),angleInRadian:l}},sJ=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}},aJ=(t,e)=>{var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),a=Math.min(i,s);return t+a*360},oJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=iJ({x:n,y:r},e),s=i.radius,a=i.angle,o=e.innerRadius,l=e.outerRadius;if(sl||s===0)return null;var c=sJ(e),d=c.startAngle,f=c.endAngle,p=a,y;if(d<=f){for(;p>f;)p-=360;for(;p=d&&p<=f}else{for(;p>d;)p-=360;for(;p=f&&p<=d}return y?lO(lO({},e),{},{radius:s,angle:aJ(p,e)}):null};function F4(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,a=Bi(e,n,r,i),o=Bi(e,n,r,s);return{points:[a,o],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}var cO,uO,dO,fO,hO,pO,mO;function bP(){return bP=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=Va(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Rb=t=>{var e=t.cx,n=t.cy,r=t.radius,i=t.angle,s=t.sign,a=t.isExternal,o=t.cornerRadius,l=t.cornerIsExternal,c=o*(a?1:-1)+r,d=Math.asin(o/c)/Tw,f=l?i:i+s*d,p=Bi(e,n,c,f),y=Bi(e,n,r,f),b=l?i-s*d:i,S=Bi(e,n,c*Math.cos(d*Tw),b);return{center:p,circleTangency:y,lineTangency:S,theta:d}},z4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,a=t.endAngle,o=lJ(s,a),l=s+o,c=Bi(e,n,i,s),d=Bi(e,n,i,l),f=Ui(cO||(cO=rh(["M ",",",` + A `,",",",0,0,",",",","," Z"])),t,e+l*x,x,x,d,t+c*x,e,t+n-c*x,e,x,x,d,t+n,e+l*x,t+n,e+r-l*x,x,x,d,t+n-c*x,e+r,t+c*x,e+r,x,x,d,t,e+r-l*x)}else f=Ui(eO||(eO=fl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},aO={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},JQ=t=>{var e=Za(t,aO),n=R.useRef(null),r=R.useState(-1),i=qQ(r,2),s=i[0],a=i[1];R.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var B=n.current.getTotalLength();B&&a(B)}catch{}},[]);var o=e.x,l=e.y,c=e.width,d=e.height,f=e.radius,p=e.className,y=e.animationEasing,b=e.animationDuration,S=e.animationBegin,w=e.isAnimationActive,x=e.isUpdateAnimationActive,M=R.useRef(c),T=R.useRef(d),P=R.useRef(o),O=R.useRef(l),N=R.useMemo(()=>({x:o,y:l,width:c,height:d,radius:f}),[o,l,c,d,f]),D=j4(N,"rectangle-");if(o!==+o||l!==+l||c!==+c||d!==+d||c===0||d===0)return null;var z=tr("recharts-rectangle",p);if(!x){var V=Xa(e);V.radius;var k=rO(V,HQ);return R.createElement("path",Aw({},k,{x:yd(o),y:yd(l),width:yd(c),height:yd(d),radius:typeof f=="number"?f:void 0,className:z,d:sO(o,l,c,d,f)}))}var j=M.current,X=T.current,ee=P.current,ie=O.current,pe="0px ".concat(s===-1?1:s,"px"),ae="".concat(s,"px ").concat(s,"px"),he=BQ(["strokeDasharray"],b,typeof y=="string"?y:aO.animationEasing);return R.createElement(U4,{animationId:D,key:D,canBegin:s>0,duration:b,easing:y,isActive:x,begin:S},B=>{var J=Dc(j,c,B),Y=Dc(X,d,B),H=Dc(ee,o,B),G=Dc(ie,l,B);n.current&&(M.current=J,T.current=Y,P.current=H,O.current=G);var le;w?B>0?le={transition:he,strokeDasharray:ae}:le={strokeDasharray:pe}:le={strokeDasharray:ae};var se=Xa(e);se.radius;var ce=rO(se,VQ);return R.createElement("path",Aw({},ce,{radius:typeof f=="number"?f:void 0,className:z,d:sO(H,G,J,Y,f),ref:n,style:nO(nO({},le),e.style)}))})};function oO(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*180/Math.PI,Bi=(t,e,n,r)=>({x:t+Math.cos(-Tw*r)*n,y:e+Math.sin(-Tw*r)*n}),iJ=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},sJ=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},aJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,a=sJ({x:n,y:r},{x:i,y:s});if(a<=0)return{radius:a,angle:0};var o=(n-i)/a,l=Math.acos(o);return r>s&&(l=2*Math.PI-l),{radius:a,angle:rJ(l),angleInRadian:l}},oJ=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}},lJ=(t,e)=>{var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),a=Math.min(i,s);return t+a*360},cJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=aJ({x:n,y:r},e),s=i.radius,a=i.angle,o=e.innerRadius,l=e.outerRadius;if(sl||s===0)return null;var c=oJ(e),d=c.startAngle,f=c.endAngle,p=a,y;if(d<=f){for(;p>f;)p-=360;for(;p=d&&p<=f}else{for(;p>d;)p-=360;for(;p=f&&p<=d}return y?lO(lO({},e),{},{radius:s,angle:lJ(p,e)}):null};function F4(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,a=Bi(e,n,r,i),o=Bi(e,n,r,s);return{points:[a,o],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}var cO,uO,dO,fO,hO,pO,mO;function bP(){return bP=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=Va(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Rb=t=>{var e=t.cx,n=t.cy,r=t.radius,i=t.angle,s=t.sign,a=t.isExternal,o=t.cornerRadius,l=t.cornerIsExternal,c=o*(a?1:-1)+r,d=Math.asin(o/c)/Tw,f=l?i:i+s*d,p=Bi(e,n,c,f),y=Bi(e,n,r,f),b=l?i-s*d:i,S=Bi(e,n,c*Math.cos(d*Tw),b);return{center:p,circleTangency:y,lineTangency:S,theta:d}},z4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,a=t.endAngle,o=uJ(s,a),l=s+o,c=Bi(e,n,i,s),d=Bi(e,n,i,l),f=Ui(cO||(cO=rh(["M ",",",` A `,",",`,0, `,",",`, `,",",` `])),c.x,c.y,i,i,+(Math.abs(o)>180),+(s>l),d.x,d.y);if(r>0){var p=Bi(e,n,r,s),y=Bi(e,n,r,l);f+=Ui(uO||(uO=rh(["L ",",",` A `,",",`,0, `,",",`, - `,","," Z"])),y.x,y.y,r,r,+(Math.abs(o)>180),+(s<=l),p.x,p.y)}else f+=Ui(dO||(dO=rh(["L ",","," Z"])),e,n);return f},cJ=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,a=t.forceCornerRadius,o=t.cornerIsExternal,l=t.startAngle,c=t.endAngle,d=Va(c-l),f=Rb({cx:e,cy:n,radius:i,angle:l,sign:d,cornerRadius:s,cornerIsExternal:o}),p=f.circleTangency,y=f.lineTangency,b=f.theta,S=Rb({cx:e,cy:n,radius:i,angle:c,sign:-d,cornerRadius:s,cornerIsExternal:o}),w=S.circleTangency,x=S.lineTangency,M=S.theta,T=o?Math.abs(l-c):Math.abs(l-c)-b-M;if(T<0)return a?Ui(fO||(fO=rh(["M ",",",` + `,","," Z"])),y.x,y.y,r,r,+(Math.abs(o)>180),+(s<=l),p.x,p.y)}else f+=Ui(dO||(dO=rh(["L ",","," Z"])),e,n);return f},dJ=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,a=t.forceCornerRadius,o=t.cornerIsExternal,l=t.startAngle,c=t.endAngle,d=Va(c-l),f=Rb({cx:e,cy:n,radius:i,angle:l,sign:d,cornerRadius:s,cornerIsExternal:o}),p=f.circleTangency,y=f.lineTangency,b=f.theta,S=Rb({cx:e,cy:n,radius:i,angle:c,sign:-d,cornerRadius:s,cornerIsExternal:o}),w=S.circleTangency,x=S.lineTangency,M=S.theta,T=o?Math.abs(l-c):Math.abs(l-c)-b-M;if(T<0)return a?Ui(fO||(fO=rh(["M ",",",` a`,",",",0,0,1,",`,0 a`,",",",0,0,1,",`,0 `])),y.x,y.y,s,s,s*2,s,s,-s*2):z4({cx:e,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var P=Ui(hO||(hO=rh(["M ",",",` @@ -568,26 +573,26 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `])),y.x,y.y,s,s,+(d<0),p.x,p.y,i,i,+(T>180),+(d<0),w.x,w.y,s,s,+(d<0),x.x,x.y);if(r>0){var O=Rb({cx:e,cy:n,radius:r,angle:l,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:o}),N=O.circleTangency,D=O.lineTangency,z=O.theta,V=Rb({cx:e,cy:n,radius:r,angle:c,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:o}),k=V.circleTangency,j=V.lineTangency,X=V.theta,ee=o?Math.abs(l-c):Math.abs(l-c)-z-X;if(ee<0&&s===0)return"".concat(P,"L").concat(e,",").concat(n,"Z");P+=Ui(pO||(pO=rh(["L",",",` A`,",",",0,0,",",",",",` A`,",",",0,",",",",",",",` - A`,",",",0,0,",",",",","Z"])),j.x,j.y,s,s,+(d<0),k.x,k.y,r,r,+(ee>180),+(d>0),N.x,N.y,s,s,+(d<0),D.x,D.y)}else P+=Ui(mO||(mO=rh(["L",",","Z"])),e,n);return P},uJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},dJ=t=>{var e=Za(t,uJ),n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,d=e.endAngle,f=e.className;if(s0&&Math.abs(c-d)<360?S=cJ({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(b,y/2),forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:d}):S=z4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),R.createElement("path",bP({},Xa(e),{className:p,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(_5(e)){if(t==="centric"){var r=e.cx,i=e.cy,s=e.innerRadius,a=e.outerRadius,o=e.angle,l=Bi(r,i,s,o),c=Bi(r,i,a,o);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return F4(e)}}function hJ(t){return L5(t)?NaN:Number(t)}function CE(t){return t?(t=hJ(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function B4(t,e,n){n&&typeof n!="number"&&eP(t,e,n)&&(e=n=void 0),t=CE(t),e===void 0?(e=t,t=0):e=CE(e),n=n===void 0?tt.chartData,KC=ke([$o],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),_S=(t,e,n,r)=>r?KC(t):$o(t),pJ=(t,e,n)=>n?KC(t):$o(t),mJ=ke([_S],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});ke([KC],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var gJ=ke([$o],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function YC(t,e){return bJ(t)||xJ(t,e)||yJ(t,e)||vJ()}function vJ(){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 yJ(t,e){if(t){if(typeof t=="string")return gO(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)?gO(t,e):void 0}}function gO(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};Tt.decimalPlaces=Tt.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*or;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Tt.dividedBy=Tt.div=function(t){return Bc(this,new this.constructor(t))};Tt.dividedToIntegerBy=Tt.idiv=function(t){var e=this,n=e.constructor;return Zn(Bc(e,new n(t),0,1),n.precision)};Tt.equals=Tt.eq=function(t){return!this.cmp(t)};Tt.exponent=function(){return Vr(this)};Tt.greaterThan=Tt.gt=function(t){return this.cmp(t)>0};Tt.greaterThanOrEqualTo=Tt.gte=function(t){return this.cmp(t)>=0};Tt.isInteger=Tt.isint=function(){return this.e>this.d.length-2};Tt.isNegative=Tt.isneg=function(){return this.s<0};Tt.isPositive=Tt.ispos=function(){return this.s>0};Tt.isZero=function(){return this.s===0};Tt.lessThan=Tt.lt=function(t){return this.cmp(t)<0};Tt.lessThanOrEqualTo=Tt.lte=function(t){return this.cmp(t)<1};Tt.logarithm=Tt.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(va))throw Error(Ka+"NaN");if(n.s<1)throw Error(Ka+(n.s?"NaN":"-Infinity"));return n.eq(va)?new r(0):(dr=!1,e=Bc(vy(n,s),vy(t,s),s),dr=!0,Zn(e,i))};Tt.minus=Tt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?$4(e,t):G4(e,(t.s=-t.s,t))};Tt.modulo=Tt.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(Ka+"NaN");return n.s?(dr=!1,e=Bc(n,t,0,1).times(t),dr=!0,n.minus(e)):Zn(new r(n),i)};Tt.naturalExponential=Tt.exp=function(){return W4(this)};Tt.naturalLogarithm=Tt.ln=function(){return vy(this)};Tt.negated=Tt.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Tt.plus=Tt.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?G4(e,t):$4(e,(t.s=-t.s,t))};Tt.precision=Tt.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Mh+t);if(e=Vr(i)+1,r=i.d.length-1,n=r*or+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};Tt.squareRoot=Tt.sqrt=function(){var t,e,n,r,i,s,a,o=this,l=o.constructor;if(o.s<1){if(!o.s)return new l(0);throw Error(Ka+"NaN")}for(t=Vr(o),dr=!1,i=Math.sqrt(+o),i==0||i==1/0?(e=Sl(o.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Wg((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=a=n+3;;)if(s=r,r=s.plus(Bc(o,s,a+2)).times(.5),Sl(s.d).slice(0,a)===(e=Sl(r.d)).slice(0,a)){if(e=e.slice(a-3,a+1),i==a&&e=="4999"){if(Zn(s,n+1,0),s.times(s).eq(o)){r=s;break}}else if(e!="9999")break;a+=4}return dr=!0,Zn(r,n)};Tt.times=Tt.mul=function(t){var e,n,r,i,s,a,o,l,c,d=this,f=d.constructor,p=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=p.length,c=y.length,l=0;){for(e=0,i=l+r;i>r;)o=s[i]+y[r]*p[i-r-1]+e,s[i--]=o%vi|0,e=o/vi|0;s[i]=(s[i]+e)%vi|0}for(;!s[--a];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,dr?Zn(t,f.precision):t};Tt.toDecimalPlaces=Tt.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(kl(t,0,Gg),e===void 0?e=r.rounding:kl(e,0,8),Zn(n,t+Vr(n)+1,e))};Tt.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Uh(r,!0):(kl(t,0,Gg),e===void 0?e=i.rounding:kl(e,0,8),r=Zn(new i(r),t+1,e),n=Uh(r,!0,t+1)),n};Tt.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Uh(i):(kl(t,0,Gg),e===void 0?e=s.rounding:kl(e,0,8),r=Zn(new s(i),t+Vr(i)+1,e),n=Uh(r.abs(),!1,t+Vr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Tt.toInteger=Tt.toint=function(){var t=this,e=t.constructor;return Zn(new e(t),Vr(t)+1,e.rounding)};Tt.toNumber=function(){return+this};Tt.toPower=Tt.pow=function(t){var e,n,r,i,s,a,o=this,l=o.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(va);if(o=new l(o),!o.s){if(t.s<1)throw Error(Ka+"Infinity");return o}if(o.eq(va))return o;if(r=l.precision,t.eq(va))return Zn(o,r);if(e=t.e,n=t.d.length-1,a=e>=n,s=o.s,a){if((n=d<0?-d:d)<=V4){for(i=new l(va),e=Math.ceil(r/or+4),dr=!1;n%2&&(i=i.times(o),xO(i.d,e)),n=Wg(n/2),n!==0;)o=o.times(o),xO(o.d,e);return dr=!0,t.s<0?new l(va).div(i):Zn(i,r)}}else if(s<0)throw Error(Ka+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,o.s=1,dr=!1,i=t.times(vy(o,r+c)),dr=!0,i=W4(i),i.s=s,i};Tt.toPrecision=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?(n=Vr(i),r=Uh(i,n<=s.toExpNeg||n>=s.toExpPos)):(kl(t,1,Gg),e===void 0?e=s.rounding:kl(e,0,8),i=Zn(new s(i),t,e),n=Vr(i),r=Uh(i,t<=n||n<=s.toExpNeg,t)),r};Tt.toSignificantDigits=Tt.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(kl(t,1,Gg),e===void 0?e=r.rounding:kl(e,0,8)),Zn(new r(n),t,e)};Tt.toString=Tt.valueOf=Tt.val=Tt.toJSON=Tt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Vr(t),n=t.constructor;return Uh(t,e<=n.toExpNeg||e>=n.toExpPos)};function G4(t,e){var n,r,i,s,a,o,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),dr?Zn(e,f):e;if(l=t.d,c=e.d,a=t.e,i=e.e,l=l.slice(),s=a-i,s){for(s<0?(r=l,s=-s,o=c.length):(r=c,i=a,o=l.length),a=Math.ceil(f/or),o=a>o?a+1:o+1,s>o&&(s=o,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(o=l.length,s=c.length,o-s<0&&(s=o,r=c,c=l,l=r),n=0;s;)n=(l[--s]=l[s]+c[s]+n)/vi|0,l[s]%=vi;for(n&&(l.unshift(n),++i),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=i,dr?Zn(e,f):e}function kl(t,e,n){if(t!==~~t||tn)throw Error(Mh+t)}function Sl(t){var e,n,r,i=t.length-1,s="",a=t[0];if(i>0){for(s+=a,e=1;ea?1:-1;else for(o=l=0;oi[o]?1:-1;break}return l}function n(r,i,s){for(var a=0;s--;)r[s]-=a,a=r[s]1;)r.shift()}return function(r,i,s,a){var o,l,c,d,f,p,y,b,S,w,x,M,T,P,O,N,D,z,V=r.constructor,k=r.s==i.s?1:-1,j=r.d,X=i.d;if(!r.s)return new V(r);if(!i.s)throw Error(Ka+"Division by zero");for(l=r.e-i.e,D=X.length,O=j.length,y=new V(k),b=y.d=[],c=0;X[c]==(j[c]||0);)++c;if(X[c]>(j[c]||0)&&--l,s==null?M=s=V.precision:a?M=s+(Vr(r)-Vr(i))+1:M=s,M<0)return new V(0);if(M=M/or+2|0,c=0,D==1)for(d=0,X=X[0],M++;(c1&&(X=t(X,d),j=t(j,d),D=X.length,O=j.length),P=D,S=j.slice(0,D),w=S.length;w=vi/2&&++N;do d=0,o=e(X,S,D,w),o<0?(x=S[0],D!=w&&(x=x*vi+(S[1]||0)),d=x/N|0,d>1?(d>=vi&&(d=vi-1),f=t(X,d),p=f.length,w=S.length,o=e(f,S,p,w),o==1&&(d--,n(f,D16)throw Error(ZC+Vr(t));if(!t.s)return new d(va);for(dr=!1,o=f,a=new d(.03125);t.abs().gte(.1);)t=t.times(a),c+=5;for(r=Math.log(qf(2,c))/Math.LN10*2+5|0,o+=r,n=i=s=new d(va),d.precision=o;;){if(i=Zn(i.times(t),o),n=n.times(++l),a=s.plus(Bc(i,n,o)),Sl(a.d).slice(0,o)===Sl(s.d).slice(0,o)){for(;c--;)s=Zn(s.times(s),o);return d.precision=f,e==null?(dr=!0,Zn(s,f)):s}s=a}}function Vr(t){for(var e=t.e*or,n=t.d[0];n>=10;n/=10)e++;return e}function RE(t,e,n){if(e>t.LN10.sd())throw dr=!0,n&&(t.precision=n),Error(Ka+"LN10 precision limit exceeded");return Zn(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,a,o,l,c,d,f=1,p=10,y=t,b=y.d,S=y.constructor,w=S.precision;if(y.s<1)throw Error(Ka+(y.s?"NaN":"-Infinity"));if(y.eq(va))return new S(0);if(e==null?(dr=!1,c=w):c=e,y.eq(10))return e==null&&(dr=!0),RE(S,c);if(c+=p,S.precision=c,n=Sl(b),r=n.charAt(0),s=Vr(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=Vr(y),r>1?(y=new S("0."+n),s++):y=new S(r+"."+n.slice(1))}else return l=RE(S,c+2,w).times(s+""),y=vy(new S(r+"."+n.slice(1)),c-p).plus(l),S.precision=w,e==null?(dr=!0,Zn(y,w)):y;for(o=a=y=Bc(y.minus(va),y.plus(va),c),d=Zn(y.times(y),c),i=3;;){if(a=Zn(a.times(d),c),l=o.plus(Bc(a,new S(i),c)),Sl(l.d).slice(0,c)===Sl(o.d).slice(0,c))return o=o.times(2),s!==0&&(o=o.plus(RE(S,c+2,w).times(s+""))),o=Bc(o,new S(f),c),S.precision=w,e==null?(dr=!0,Zn(o,w)):o;o=l,i+=2}}function yO(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=Wg(n/or),t.d=[],r=(n+1)%or,n<0&&(r+=or),rPw||t.e<-Pw))throw Error(ZC+n)}else t.s=0,t.e=0,t.d=[0];return t}function Zn(t,e,n){var r,i,s,a,o,l,c,d,f=t.d;for(a=1,s=f[0];s>=10;s/=10)a++;if(r=e-a,r<0)r+=or,i=e,c=f[d=0];else{if(d=Math.ceil((r+1)/or),s=f.length,d>=s)return t;for(c=s=f[d],a=1;s>=10;s/=10)a++;r%=or,i=r-or+a}if(n!==void 0&&(s=qf(10,a-i-1),o=c/s%10|0,l=e<0||f[d+1]!==void 0||c%s,l=n<4?(o||l)&&(n==0||n==(t.s<0?3:2)):o>5||o==5&&(n==4||l||n==6&&(r>0?i>0?c/qf(10,a-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=Vr(t),f.length=1,e=e-s-1,f[0]=qf(10,(or-e%or)%or),t.e=Wg(-e/or)||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=qf(10,or-r),f[d]=i>0?(c/qf(10,a-i)%qf(10,i)|0)*s:0),l)for(;;)if(d==0){(f[0]+=s)==vi&&(f[0]=1,++t.e);break}else{if(f[d]+=s,f[d]!=vi)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(dr&&(t.e>Pw||t.e<-Pw))throw Error(ZC+Vr(t));return t}function $4(t,e){var n,r,i,s,a,o,l,c,d,f,p=t.constructor,y=p.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new p(t),dr?Zn(e,y):e;if(l=t.d,f=e.d,r=e.e,c=t.e,l=l.slice(),a=c-r,a){for(d=a<0,d?(n=l,a=-a,o=f.length):(n=f,r=c,o=l.length),i=Math.max(Math.ceil(y/or),o)+2,a>i&&(a=i,n.length=1),n.reverse(),i=a;i--;)n.push(0);n.reverse()}else{for(i=l.length,o=f.length,d=i0;--i)l[o++]=0;for(i=f.length;i>a;){if(l[--i]0?s=s.charAt(0)+"."+s.slice(1)+ad(r):a>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-a)>0&&(s+=ad(r))):i>=a?(s+=ad(i+1-a),n&&(r=n-i-1)>0&&(s=s+"."+ad(r))):((r=i+1)0&&(i+1===a&&(s+="."),s+=ad(r))),t.s<0?"-"+s:s}function xO(t,e){if(t.length>e)return t.length=e,!0}function X4(t){var e,n,r;function i(s){var a=this;if(!(a instanceof i))return new i(s);if(a.constructor=i,s instanceof i){a.s=s.s,a.e=s.e,a.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(Mh+s);if(s>0)a.s=1;else if(s<0)s=-s,a.s=-1;else{a.s=0,a.e=0,a.d=[0];return}if(s===~~s&&s<1e7){a.e=0,a.d=[s];return}return yO(a,s.toString())}else if(typeof s!="string")throw Error(Mh+s);if(s.charCodeAt(0)===45?(s=s.slice(1),a.s=-1):a.s=1,SJ.test(s))yO(a,s);else throw Error(Mh+s)}if(i.prototype=Tt,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=X4,i.config=i.set=MJ,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(Mh+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Mh+n+": "+r);return this}var QC=X4(wJ);va=new QC(1);const Tn=QC;function q4(t){var e;return t===0?e=1:e=Math.floor(new Tn(t).abs().log(10).toNumber())+1,e}function K4(t,e,n){for(var r=new Tn(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 PJ(t)||TJ(t,e)||AJ(t,e)||EJ()}function EJ(){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 bO(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)?bO(t,e):void 0}}function bO(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]},JC=(t,e,n)=>{if(t.lte(0))return new Tn(0);var r=q4(t.toNumber()),i=new Tn(10).pow(r),s=t.div(i),a=r!==1?.05:.1,o=new Tn(Math.ceil(s.div(a).toNumber())).add(n).mul(a),l=o.mul(i);return e?new Tn(l.toNumber()):new Tn(Math.ceil(l.toNumber()))},Z4=(t,e,n)=>{var r;if(t.lte(0))return new Tn(0);var i=[1,2,2.5,5],s=t.toNumber(),a=Math.floor(new Tn(s).abs().log(10).toNumber()),o=new Tn(10).pow(a),l=t.div(o).toNumber(),c=i.findIndex(y=>y>=l-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=i.length){var d=Math.floor(c/i.length);c%=i.length,o=o.mul(new Tn(10).pow(d))}var f=(r=i[c])!==null&&r!==void 0?r:1,p=new Tn(f).mul(o);return e?p:new Tn(Math.ceil(p.toNumber()))},CJ=(t,e,n)=>{var r=new Tn(1),i=new Tn(t);if(!i.isint()&&n){var s=Math.abs(t);s<1?(r=new Tn(10).pow(q4(t)-1),i=new Tn(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Tn(Math.floor(t)))}else t===0?i=new Tn(Math.floor((e-1)/2)):n||(i=new Tn(Math.floor(t)));for(var a=Math.floor((e-1)/2),o=[],l=0;l4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:JC;if(!Number.isFinite((n-e)/(r-1)))return{step:new Tn(0),tickMin:new Tn(0),tickMax:new Tn(0)};var o=a(new Tn(n).sub(e).div(r-1),i,s),l;e<=0&&n>=0?l=new Tn(0):(l=new Tn(e).add(n).div(2),l=l.sub(new Tn(l).mod(o)));var c=Math.ceil(l.sub(e).div(o).toNumber()),d=Math.ceil(new Tn(n).sub(l).div(o).toNumber()),f=c+d+1;return f>r?Q4(e,n,r,i,s+1,a):(f0?d+(r-f):d,c=n>0?c:c+(r-f)),{step:o,tickMin:l.sub(new Tn(c).mul(o)),tickMax:l.add(new Tn(d).mul(o))})},_O=function(e){var n=yy(e,2),r=n[0],i=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),c=Y4([r,i]),d=yy(c,2),f=d[0],p=d[1];if(f===-1/0||p===1/0){var y=p===1/0?[f,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),p];return r>i?y.reverse():y}if(f===p)return CJ(f,s,a);var b=o==="snap125"?Z4:JC,S=Q4(f,p,l,a,0,b),w=S.step,x=S.tickMin,M=S.tickMax,T=K4(x,M.add(new Tn(.1).mul(w)),w);return r>i?T.reverse():T},wO=function(e,n){var r=yy(e,2),i=r[0],s=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Y4([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 p=o==="snap125"?Z4:JC,y=Math.max(n,2),b=p(new Tn(f).sub(d).div(y-1),a,0),S=[...K4(new Tn(d),new Tn(f),b),f];return a===!1&&(S=S.map(w=>Math.round(w))),i>s?S.reverse():S},RJ=t=>t.rootProps.barCategoryGap,wS=t=>t.rootProps.stackOffset,J4=t=>t.rootProps.reverseStackOrder,e2=t=>t.options.chartName,t2=t=>t.rootProps.syncId,ez=t=>t.rootProps.syncMethod,n2=t=>t.options.eventEmitter,NJ=t=>t.rootProps.baseValue,Ms={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Mf={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"},SS=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function MS(t,e,n){if(n!=="auto")return n;if(t!=null)return jl(t,e)?"category":"number"}function SO(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 Cw(t){for(var e=1;e{if(e!=null)return t.polarAxis.angleAxis[e]},r2=ke([LJ,M4],(t,e)=>{var n;if(t!=null)return t;var r=(n=MS(e,"angleAxis",MO.type))!==null&&n!==void 0?n:"category";return Cw(Cw({},MO),{},{type:r})}),DJ=(t,e)=>t.polarAxis.radiusAxis[e],i2=ke([DJ,M4],(t,e)=>{var n;if(t!=null)return t;var r=(n=MS(e,"radiusAxis",EO.type))!==null&&n!==void 0?n:"category";return Cw(Cw({},EO),{},{type:r})}),ES=t=>t.polarOptions,s2=ke([Jc,eu,Wi],nJ),tz=ke([ES,s2],(t,e)=>{if(t!=null)return Td(t.innerRadius,e,0)}),nz=ke([ES,s2],(t,e)=>{if(t!=null)return Td(t.outerRadius,e,e*.8)}),UJ=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},rz=ke([ES],UJ);ke([r2,rz],SS);var iz=ke([s2,tz,nz],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});ke([i2,iz],SS);var sz=ke([hr,ES,tz,nz,Jc,eu],(t,e,n,r,i,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var a=e.cx,o=e.cy,l=e.startAngle,c=e.endAngle;return{cx:Td(a,i,i/2),cy:Td(o,s,s/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),_i=(t,e)=>e,AS=(t,e,n)=>n;function a2(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,a=n.dataKey,o=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=a2(l);d.forEach((p,y)=>{var b=a==null||s?y:String(yi(p,a,null)),S=yi(p,l.dataKey,0),w;o.has(b)?w=o.get(b):w={},Object.assign(w,{[f]:S}),o.set(b,w)})}}),Array.from(o.values())}function o2(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var TS=(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 jJ(t,e){if(t.length===e.length){for(var n=0;n{var e=hr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},$g=t=>t.tooltip.settings.axisId;function l2(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 a(){return s.apply(this,arguments)}return a.toString=function(){return s.toString()},a})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var a=i[0],o=i[1];return a<=o?s>=a&&s<=o:s>=o&&s<=a},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,a)=>{var o=t(s);if(o!=null){if(t.bandwidth&&a!==null&&a!==void 0&&a.position){var l=t.bandwidth();switch(a.position){case"middle":o+=l/2;break;case"end":o+=l;break}}return o}}}}}var FJ=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!El(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 _d(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function zJ(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function c2(t){let e,n,r;t.length!==2?(e=_d,n=(o,l)=>_d(t(o),l),r=(o,l)=>t(o)-l):(e=t===_d||t===zJ?t:BJ,n=t,r=t);function i(o,l,c=0,d=o.length){if(c>>1;n(o[f],l)<0?c=f+1:d=f}while(c>>1;n(o[f],l)<=0?c=f+1:d=f}while(cc&&r(o[f-1],l)>-r(o[f],l)?f-1:f}return{left:i,center:a,right:s}}function BJ(){return 0}function oz(t){return t===null?NaN:+t}function*HJ(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const VJ=c2(_d),ex=VJ.right;c2(oz).center;class AO extends Map{constructor(e,n=$J){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(TO(this,e))}has(e){return super.has(TO(this,e))}set(e,n){return super.set(GJ(this,e),n)}delete(e){return super.delete(WJ(this,e))}}function TO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function GJ({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function WJ({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function $J(t){return t!==null&&typeof t=="object"?t.valueOf():t}function XJ(t=_d){if(t===_d)return lz;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 lz(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const qJ=Math.sqrt(50),KJ=Math.sqrt(10),YJ=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),a=s>=qJ?10:s>=KJ?5:s>=YJ?2:1;let o,l,c;return i<0?(c=Math.pow(10,-i)/a,o=Math.round(t*c),l=Math.round(e*c),o/ce&&--l,c=-c):(c=Math.pow(10,i)*a,o=Math.round(t/c),l=Math.round(e/c),o*ce&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const o=s-i+1,l=new Array(o);if(r)if(a<0)for(let c=0;c=r)&&(n=r);return n}function CO(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function cz(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?lz:XJ(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),p=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),y=Math.max(n,Math.floor(e-c*f/l+p)),b=Math.min(r,Math.floor(e+(l-c)*f/l+p));cz(t,e,y,b,i)}const s=t[e];let a=n,o=r;for(l0(t,n,e),i(t[r],s)>0&&l0(t,n,r);a0;)--o}i(t[n],s)===0?l0(t,n,o):(++o,l0(t,o,r)),o<=e&&(n=o+1),e<=o&&(r=o-1)}return t}function l0(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function ZJ(t,e,n){if(t=Float64Array.from(HJ(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return CO(t);if(e>=1)return PO(t);var r,i=(r-1)*e,s=Math.floor(i),a=PO(cz(t,s).subarray(0,s+1)),o=CO(t.subarray(s+1));return a+(o-a)*(i-s)}}function QJ(t,e,n=oz){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),a=+n(t[s],s,t),o=+n(t[s+1],s+1,t);return a+(o-a)*(i-s)}}function JJ(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?Nb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Nb(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=nee.exec(t))?new Zs(e[1],e[2],e[3],1):(e=ree.exec(t))?new Zs(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=iee.exec(t))?Nb(e[1],e[2],e[3],e[4]):(e=see.exec(t))?Nb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=aee.exec(t))?DO(e[1],e[2]/100,e[3]/100,1):(e=oee.exec(t))?DO(e[1],e[2]/100,e[3]/100,e[4]):RO.hasOwnProperty(t)?kO(RO[t]):t==="transparent"?new Zs(NaN,NaN,NaN,0):null}function kO(t){return new Zs(t>>16&255,t>>8&255,t&255,1)}function Nb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Zs(t,e,n,r)}function uee(t){return t instanceof tx||(t=_y(t)),t?(t=t.rgb(),new Zs(t.r,t.g,t.b,t.opacity)):new Zs}function EP(t,e,n,r){return arguments.length===1?uee(t):new Zs(t,e,n,r??1)}function Zs(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}f2(Zs,EP,dz(tx,{brighter(t){return t=t==null?Nw:Math.pow(Nw,t),new Zs(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?xy:Math.pow(xy,t),new Zs(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zs(Eh(this.r),Eh(this.g),Eh(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:OO,formatHex:OO,formatHex8:dee,formatRgb:LO,toString:LO}));function OO(){return`#${ih(this.r)}${ih(this.g)}${ih(this.b)}`}function dee(){return`#${ih(this.r)}${ih(this.g)}${ih(this.b)}${ih((isNaN(this.opacity)?1:this.opacity)*255)}`}function LO(){const t=Iw(this.opacity);return`${t===1?"rgb(":"rgba("}${Eh(this.r)}, ${Eh(this.g)}, ${Eh(this.b)}${t===1?")":`, ${t})`}`}function Iw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Eh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ih(t){return t=Eh(t),(t<16?"0":"")+t.toString(16)}function DO(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Fo(t,e,n,r)}function fz(t){if(t instanceof Fo)return new Fo(t.h,t.s,t.l,t.opacity);if(t instanceof tx||(t=_y(t)),!t)return new Fo;if(t instanceof Fo)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),a=NaN,o=s-i,l=(s+i)/2;return o?(e===s?a=(n-r)/o+(n0&&l<1?0:a,new Fo(a,o,l,t.opacity)}function fee(t,e,n,r){return arguments.length===1?fz(t):new Fo(t,e,n,r??1)}function Fo(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}f2(Fo,fee,dz(tx,{brighter(t){return t=t==null?Nw:Math.pow(Nw,t),new Fo(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?xy:Math.pow(xy,t),new Fo(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 Zs(NE(t>=240?t-240:t+120,i,r),NE(t,i,r),NE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Fo(UO(this.h),Ib(this.s),Ib(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("}${UO(this.h)}, ${Ib(this.s)*100}%, ${Ib(this.l)*100}%${t===1?")":`, ${t})`}`}}));function UO(t){return t=(t||0)%360,t<0?t+360:t}function Ib(t){return Math.max(0,Math.min(1,t||0))}function NE(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 h2=t=>()=>t;function hee(t,e){return function(n){return t+n*e}}function pee(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 mee(t){return(t=+t)==1?hz:function(e,n){return n-e?pee(e,n,t):h2(isNaN(e)?n:e)}}function hz(t,e){var n=e-t;return n?hee(t,n):h2(isNaN(t)?e:t)}const jO=(function t(e){var n=mee(e);function r(i,s){var a=n((i=EP(i)).r,(s=EP(s)).r),o=n(i.g,s.g),l=n(i.b,s.b),c=hz(i.opacity,s.opacity);return function(d){return i.r=a(d),i.g=o(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=t,r})(1);function gee(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),o[a]?o[a]+=s:o[++a]=s),(r=r[0])===(i=i[0])?o[a]?o[a]+=i:o[++a]=i:(o[++a]=null,l.push({i:a,x:kw(r,i)})),n=IE.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function Tee(t,e,n){var r=t[0],i=t[1],s=e[0],a=e[1];return i2?Pee:Tee,l=c=null,f}function f(p){return p==null||isNaN(p=+p)?s:(l||(l=o(t.map(r),e,n)))(r(a(p)))}return f.invert=function(p){return a(i((c||(c=o(e,t.map(r),kw)))(p)))},f.domain=function(p){return arguments.length?(t=Array.from(p,Ow),d()):t.slice()},f.range=function(p){return arguments.length?(e=Array.from(p),d()):e.slice()},f.rangeRound=function(p){return e=Array.from(p),n=p2,d()},f.clamp=function(p){return arguments.length?(a=p?!0:Es,d()):a!==Es},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,y){return r=p,i=y,d()}}function m2(){return CS()(Es,Es)}function Cee(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 Eg(t){return t=Lw(Math.abs(t)),t?t[1]:NaN}function Ree(t,e){return function(n,r){for(var i=n.length,s=[],a=0,o=t[0],l=0;i>0&&o>0&&(l+o+1>r&&(o=Math.max(1,r-l)),s.push(n.substring(i-=o,i+o)),!((l+=o+1)>r));)o=t[a=(a+1)%t.length];return s.reverse().join(e)}}function Nee(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Iee=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wy(t){if(!(e=Iee.exec(t)))throw new Error("invalid format: "+t);var e;return new g2({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=g2.prototype;function g2(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+""}g2.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 kee(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 Oee(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,a=r.length;return s===a?r:s>a?r+new Array(s-a+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 zO(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 BO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Cee,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)=>zO(t*100,e),r:zO,s:Oee,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function HO(t){return t}var VO=Array.prototype.map,GO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Lee(t){var e=t.grouping===void 0||t.thousands===void 0?HO:Ree(VO.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?HO:Nee(VO.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",o=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f,p){f=wy(f);var y=f.fill,b=f.align,S=f.sign,w=f.symbol,x=f.zero,M=f.width,T=f.comma,P=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):BO[N]||(P===void 0&&(P=12),O=!0,N="g"),(x||y==="0"&&b==="=")&&(x=!0,y="0",b="=");var D=(p&&p.prefix!==void 0?p.prefix:"")+(w==="$"?n:w==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),z=(w==="$"?r:/[%p]/.test(N)?a:"")+(p&&p.suffix!==void 0?p.suffix:""),V=BO[N],k=/[defgprs%]/.test(N);P=P===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function j(X){var ee=D,ie=z,pe,ae,he;if(N==="c")ie=V(X)+ie,X="";else{X=+X;var B=X<0||1/X<0;if(X=isNaN(X)?l:V(Math.abs(X),P),O&&(X=kee(X)),B&&+X==0&&S!=="+"&&(B=!1),ee=(B?S==="("?S:o:S==="-"||S==="("?"":S)+ee,ie=(N==="s"&&!isNaN(X)&&Dw!==void 0?GO[8+Dw/3]:"")+ie+(B&&S==="("?")":""),k){for(pe=-1,ae=X.length;++pehe||he>57){ie=(he===46?i+X.slice(pe+1):X.slice(pe))+ie,X=X.slice(0,pe);break}}}T&&!x&&(X=e(X,1/0));var J=ee.length+X.length+ie.length,Y=J>1)+ee+X+ie+Y.slice(J);break;default:X=Y+ee+X+ie;break}return s(X)}return j.toString=function(){return f+""},j}function d(f,p){var y=Math.max(-8,Math.min(8,Math.floor(Eg(p)/3)))*3,b=Math.pow(10,-y),S=c((f=wy(f),f.type="f",f),{suffix:GO[8+y/3]});return function(w){return S(b*w)}}return{format:c,formatPrefix:d}}var kb,v2,pz;Dee({thousands:",",grouping:[3],currency:["$",""]});function Dee(t){return kb=Lee(t),v2=kb.format,pz=kb.formatPrefix,kb}function Uee(t){return Math.max(0,-Eg(Math.abs(t)))}function jee(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Eg(e)/3)))*3-Eg(Math.abs(t)))}function Fee(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Eg(e)-Eg(t))+1}function mz(t,e,n,r){var i=SP(t,e,n),s;switch(r=wy(r??",f"),r.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=jee(i,a))&&(r.precision=s),pz(r,a)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=Fee(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=Uee(i))&&(r.precision=s-(r.type==="%")*2);break}}return v2(r)}function Id(t){var e=t.domain;return t.ticks=function(n){var r=e();return _P(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return mz(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,a=r[i],o=r[s],l,c,d=10;for(o0;){if(c=wP(a,o,n),c===l)return r[i]=a,r[s]=o,e(r);if(c>0)a=Math.floor(a/c)*c,o=Math.ceil(o/c)*c;else if(c<0)a=Math.ceil(a*c)/c,o=Math.floor(o*c)/c;else break;l=c}return t},t}function gz(){var t=m2();return t.copy=function(){return nx(t,gz())},Qa.apply(t,arguments),Id(t)}function vz(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 vz(t).unknown(e)},t=arguments.length?Array.from(t,Ow):[0,1],Id(n)}function yz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],a;return sMath.pow(t,e)}function Gee(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 XO(t){return(e,n)=>-t(-e,n)}function y2(t){const e=t(WO,$O),n=e.domain;let r=10,i,s;function a(){return i=Gee(r),s=Vee(r),n()[0]<0?(i=XO(i),s=XO(s),t(zee,Bee)):t(WO,$O),e}return e.base=function(o){return arguments.length?(r=+o,a()):r},e.domain=function(o){return arguments.length?(n(o),a()):n()},e.ticks=o=>{const l=n();let c=l[0],d=l[l.length-1];const f=d0){for(;p<=y;++p)for(b=1;bd)break;x.push(S)}}else for(;p<=y;++p)for(b=r-1;b>=1;--b)if(S=p>0?b/s(-p):b*s(p),!(Sd)break;x.push(S)}x.length*2{if(o==null&&(o=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=wy(l)).precision==null&&(l.trim=!0),l=v2(l)),o===1/0)return l;const c=Math.max(1,r*o/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(yz(n(),{floor:o=>s(Math.floor(i(o))),ceil:o=>s(Math.ceil(i(o)))})),e}function xz(){const t=y2(CS()).domain([1,10]);return t.copy=()=>nx(t,xz()).base(t.base()),Qa.apply(t,arguments),t}function qO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function KO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function x2(t){var e=1,n=t(qO(e),KO(e));return n.constant=function(r){return arguments.length?t(qO(e=+r),KO(e)):e},Id(n)}function bz(){var t=x2(CS());return t.copy=function(){return nx(t,bz()).constant(t.constant())},Qa.apply(t,arguments)}function YO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Wee(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function $ee(t){return t<0?-t*t:t*t}function b2(t){var e=t(Es,Es),n=1;function r(){return n===1?t(Es,Es):n===.5?t(Wee,$ee):t(YO(n),YO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Id(e)}function _2(){var t=b2(CS());return t.copy=function(){return nx(t,_2()).exponent(t.exponent())},Qa.apply(t,arguments),t}function Xee(){return _2.apply(null,arguments).exponent(.5)}function ZO(t){return Math.sign(t)*t*t}function qee(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function _z(){var t=m2(),e=[0,1],n=!1,r;function i(s){var a=qee(t(s));return isNaN(a)?r:n?Math.round(a):a}return i.invert=function(s){return t.invert(ZO(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(ZO)),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 _z(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Qa.apply(i,arguments),Id(i)}function wz(){var t=[],e=[],n=[],r;function i(){var a=0,o=Math.max(1,e.length);for(n=new Array(o-1);++a0?n[o-1]:t[0],o=n?[r[n-1],e]:[r[c-1],r[c]]},a.unknown=function(l){return arguments.length&&(s=l),a},a.thresholds=function(){return r.slice()},a.copy=function(){return Sz().domain([t,e]).range(i).unknown(s)},Qa.apply(Id(a),arguments)}function Mz(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[ex(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 a=e.indexOf(s);return[t[a-1],t[a]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return Mz().domain(t).range(e).unknown(n)},Qa.apply(i,arguments)}const kE=new Date,OE=new Date;function ai(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 a=i(s),o=i.ceil(s);return s-a(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,o)=>{const l=[];if(s=i.ceil(s),o=o==null?1:Math.floor(o),!(s0))return l;let c;do l.push(c=new Date(+s)),e(s,o),t(s);while(cai(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,o)=>{if(a>=a)if(o<0)for(;++o<=0;)for(;e(a,-1),!s(a););else for(;--o>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(kE.setTime(+s),OE.setTime(+a),t(kE),t(OE),Math.floor(n(kE,OE))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const Uw=ai(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Uw.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?ai(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Uw);Uw.range;const Uc=1e3,Wa=Uc*60,jc=Wa*60,qc=jc*24,w2=qc*7,QO=qc*30,LE=qc*365,sh=ai(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Uc)},(t,e)=>(e-t)/Uc,t=>t.getUTCSeconds());sh.range;const S2=ai(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uc)},(t,e)=>{t.setTime(+t+e*Wa)},(t,e)=>(e-t)/Wa,t=>t.getMinutes());S2.range;const M2=ai(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Wa)},(t,e)=>(e-t)/Wa,t=>t.getUTCMinutes());M2.range;const E2=ai(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uc-t.getMinutes()*Wa)},(t,e)=>{t.setTime(+t+e*jc)},(t,e)=>(e-t)/jc,t=>t.getHours());E2.range;const A2=ai(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*jc)},(t,e)=>(e-t)/jc,t=>t.getUTCHours());A2.range;const rx=ai(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Wa)/qc,t=>t.getDate()-1);rx.range;const RS=ai(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/qc,t=>t.getUTCDate()-1);RS.range;const Ez=ai(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/qc,t=>Math.floor(t/qc));Ez.range;function Zh(t){return ai(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())*Wa)/w2)}const NS=Zh(0),jw=Zh(1),Kee=Zh(2),Yee=Zh(3),Ag=Zh(4),Zee=Zh(5),Qee=Zh(6);NS.range;jw.range;Kee.range;Yee.range;Ag.range;Zee.range;Qee.range;function Qh(t){return ai(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)/w2)}const IS=Qh(0),Fw=Qh(1),Jee=Qh(2),ete=Qh(3),Tg=Qh(4),tte=Qh(5),nte=Qh(6);IS.range;Fw.range;Jee.range;ete.range;Tg.range;tte.range;nte.range;const T2=ai(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());T2.range;const P2=ai(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());P2.range;const Kc=ai(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());Kc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ai(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)});Kc.range;const Yc=ai(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());Yc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ai(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)});Yc.range;function Az(t,e,n,r,i,s){const a=[[sh,1,Uc],[sh,5,5*Uc],[sh,15,15*Uc],[sh,30,30*Uc],[s,1,Wa],[s,5,5*Wa],[s,15,15*Wa],[s,30,30*Wa],[i,1,jc],[i,3,3*jc],[i,6,6*jc],[i,12,12*jc],[r,1,qc],[r,2,2*qc],[n,1,w2],[e,1,QO],[e,3,3*QO],[t,1,LE]];function o(c,d,f){const p=dw).right(a,p);if(y===a.length)return t.every(SP(c/LE,d/LE,f));if(y===0)return Uw.every(Math.max(SP(c,d,f),1));const[b,S]=a[p/a[y-1][2]53)return null;"w"in de||(de.w=1),"Z"in de?(Ve=UE(c0(de.y,0,1)),Le=Ve.getUTCDay(),Ve=Le>4||Le===0?Fw.ceil(Ve):Fw(Ve),Ve=RS.offset(Ve,(de.V-1)*7),de.y=Ve.getUTCFullYear(),de.m=Ve.getUTCMonth(),de.d=Ve.getUTCDate()+(de.w+6)%7):(Ve=DE(c0(de.y,0,1)),Le=Ve.getDay(),Ve=Le>4||Le===0?jw.ceil(Ve):jw(Ve),Ve=rx.offset(Ve,(de.V-1)*7),de.y=Ve.getFullYear(),de.m=Ve.getMonth(),de.d=Ve.getDate()+(de.w+6)%7)}else("W"in de||"U"in de)&&("w"in de||(de.w="u"in de?de.u%7:"W"in de?1:0),Le="Z"in de?UE(c0(de.y,0,1)).getUTCDay():DE(c0(de.y,0,1)).getDay(),de.m=0,de.d="W"in de?(de.w+6)%7+de.W*7-(Le+5)%7:de.w+de.U*7-(Le+6)%7);return"Z"in de?(de.H+=de.Z/100|0,de.M+=de.Z%100,UE(de)):DE(de)}}function z(Ee,Ge,$e,de){for(var Z=0,Ve=Ge.length,Le=$e.length,ne,Ce;Z=Le)return-1;if(ne=Ge.charCodeAt(Z++),ne===37){if(ne=Ge.charAt(Z++),Ce=O[ne in JO?Ge.charAt(Z++):ne],!Ce||(de=Ce(Ee,$e,de))<0)return-1}else if(ne!=$e.charCodeAt(de++))return-1}return de}function V(Ee,Ge,$e){var de=c.exec(Ge.slice($e));return de?(Ee.p=d.get(de[0].toLowerCase()),$e+de[0].length):-1}function k(Ee,Ge,$e){var de=y.exec(Ge.slice($e));return de?(Ee.w=b.get(de[0].toLowerCase()),$e+de[0].length):-1}function j(Ee,Ge,$e){var de=f.exec(Ge.slice($e));return de?(Ee.w=p.get(de[0].toLowerCase()),$e+de[0].length):-1}function X(Ee,Ge,$e){var de=x.exec(Ge.slice($e));return de?(Ee.m=M.get(de[0].toLowerCase()),$e+de[0].length):-1}function ee(Ee,Ge,$e){var de=S.exec(Ge.slice($e));return de?(Ee.m=w.get(de[0].toLowerCase()),$e+de[0].length):-1}function ie(Ee,Ge,$e){return z(Ee,e,Ge,$e)}function pe(Ee,Ge,$e){return z(Ee,n,Ge,$e)}function ae(Ee,Ge,$e){return z(Ee,r,Ge,$e)}function he(Ee){return a[Ee.getDay()]}function B(Ee){return s[Ee.getDay()]}function J(Ee){return l[Ee.getMonth()]}function Y(Ee){return o[Ee.getMonth()]}function H(Ee){return i[+(Ee.getHours()>=12)]}function G(Ee){return 1+~~(Ee.getMonth()/3)}function le(Ee){return a[Ee.getUTCDay()]}function se(Ee){return s[Ee.getUTCDay()]}function ce(Ee){return l[Ee.getUTCMonth()]}function Se(Ee){return o[Ee.getUTCMonth()]}function we(Ee){return i[+(Ee.getUTCHours()>=12)]}function We(Ee){return 1+~~(Ee.getUTCMonth()/3)}return{format:function(Ee){var Ge=N(Ee+="",T);return Ge.toString=function(){return Ee},Ge},parse:function(Ee){var Ge=D(Ee+="",!1);return Ge.toString=function(){return Ee},Ge},utcFormat:function(Ee){var Ge=N(Ee+="",P);return Ge.toString=function(){return Ee},Ge},utcParse:function(Ee){var Ge=D(Ee+="",!0);return Ge.toString=function(){return Ee},Ge}}}var JO={"-":"",_:" ",0:"0"},Si=/^\s*\d+/,lte=/^%/,cte=/[\\^$*+?|[\]().{}]/g;function Un(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function dte(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function fte(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function hte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function pte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function mte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function eL(t,e,n){var r=Si.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function tL(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function gte(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 vte(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function yte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function nL(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function xte(t,e,n){var r=Si.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function rL(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function bte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function _te(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function wte(t,e,n){var r=Si.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ste(t,e,n){var r=Si.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Mte(t,e,n){var r=lte.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ete(t,e,n){var r=Si.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Ate(t,e,n){var r=Si.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function iL(t,e){return Un(t.getDate(),e,2)}function Tte(t,e){return Un(t.getHours(),e,2)}function Pte(t,e){return Un(t.getHours()%12||12,e,2)}function Cte(t,e){return Un(1+rx.count(Kc(t),t),e,3)}function Tz(t,e){return Un(t.getMilliseconds(),e,3)}function Rte(t,e){return Tz(t,e)+"000"}function Nte(t,e){return Un(t.getMonth()+1,e,2)}function Ite(t,e){return Un(t.getMinutes(),e,2)}function kte(t,e){return Un(t.getSeconds(),e,2)}function Ote(t){var e=t.getDay();return e===0?7:e}function Lte(t,e){return Un(NS.count(Kc(t)-1,t),e,2)}function Pz(t){var e=t.getDay();return e>=4||e===0?Ag(t):Ag.ceil(t)}function Dte(t,e){return t=Pz(t),Un(Ag.count(Kc(t),t)+(Kc(t).getDay()===4),e,2)}function Ute(t){return t.getDay()}function jte(t,e){return Un(jw.count(Kc(t)-1,t),e,2)}function Fte(t,e){return Un(t.getFullYear()%100,e,2)}function zte(t,e){return t=Pz(t),Un(t.getFullYear()%100,e,2)}function Bte(t,e){return Un(t.getFullYear()%1e4,e,4)}function Hte(t,e){var n=t.getDay();return t=n>=4||n===0?Ag(t):Ag.ceil(t),Un(t.getFullYear()%1e4,e,4)}function Vte(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Un(e/60|0,"0",2)+Un(e%60,"0",2)}function sL(t,e){return Un(t.getUTCDate(),e,2)}function Gte(t,e){return Un(t.getUTCHours(),e,2)}function Wte(t,e){return Un(t.getUTCHours()%12||12,e,2)}function $te(t,e){return Un(1+RS.count(Yc(t),t),e,3)}function Cz(t,e){return Un(t.getUTCMilliseconds(),e,3)}function Xte(t,e){return Cz(t,e)+"000"}function qte(t,e){return Un(t.getUTCMonth()+1,e,2)}function Kte(t,e){return Un(t.getUTCMinutes(),e,2)}function Yte(t,e){return Un(t.getUTCSeconds(),e,2)}function Zte(t){var e=t.getUTCDay();return e===0?7:e}function Qte(t,e){return Un(IS.count(Yc(t)-1,t),e,2)}function Rz(t){var e=t.getUTCDay();return e>=4||e===0?Tg(t):Tg.ceil(t)}function Jte(t,e){return t=Rz(t),Un(Tg.count(Yc(t),t)+(Yc(t).getUTCDay()===4),e,2)}function ene(t){return t.getUTCDay()}function tne(t,e){return Un(Fw.count(Yc(t)-1,t),e,2)}function nne(t,e){return Un(t.getUTCFullYear()%100,e,2)}function rne(t,e){return t=Rz(t),Un(t.getUTCFullYear()%100,e,2)}function ine(t,e){return Un(t.getUTCFullYear()%1e4,e,4)}function sne(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Tg(t):Tg.ceil(t),Un(t.getUTCFullYear()%1e4,e,4)}function ane(){return"+0000"}function aL(){return"%"}function oL(t){return+t}function lL(t){return Math.floor(+t/1e3)}var lm,Nz,Iz;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 lm=ote(t),Nz=lm.format,lm.parse,Iz=lm.utcFormat,lm.utcParse,lm}function lne(t){return new Date(t)}function cne(t){return t instanceof Date?+t:+new Date(+t)}function C2(t,e,n,r,i,s,a,o,l,c){var d=m2(),f=d.invert,p=d.domain,y=c(".%L"),b=c(":%S"),S=c("%I:%M"),w=c("%I %p"),x=c("%a %d"),M=c("%b %d"),T=c("%B"),P=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)=>ZJ(t,s/r))},n.copy=function(){return Dz(e).domain(t)},tu.apply(n,arguments)}function OS(){var t=0,e=.5,n=1,r=1,i,s,a,o,l,c=Es,d,f=!1,p;function y(S){return isNaN(S=+S)?p:(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 gne(r)?r:"point"}};function vne(t,e){for(var n=0,r=t.length,i=t[0]e)?n=s+1:r=s}return n}function Hz(t,e){if(t){var n=e??t.domain(),r=n.map(s=>{var a;return(a=t(s))!==null&&a!==void 0?a:0}),i=t.range();if(!(n.length===0||i.length<2))return s=>{var a,o,l=vne(r,s);if(l<=0)return n[0];if(l>=n.length)return n[n.length-1];var c=(a=r[l-1])!==null&&a!==void 0?a:0,d=(o=r[l])!==null&&o!==void 0?o:0;return Math.abs(s-c)<=Math.abs(s-d)?n[l-1]:n[l]}}}function yne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Hz(t,void 0)}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 zw(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);nt.cartesianAxis.xAxis[e],nu=(t,e)=>{var n=Gz(t,e);return n??ti},ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:PP,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:Ky},Wz=(t,e)=>t.cartesianAxis.yAxis[e],ru=(t,e)=>{var n=Wz(t,e);return n??ni},Ane={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:""},k2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Ane},Cs=(t,e,n)=>{switch(e){case"xAxis":return nu(t,n);case"yAxis":return ru(t,n);case"zAxis":return k2(t,n);case"angleAxis":return r2(t,n);case"radiusAxis":return i2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Tne=(t,e,n)=>{switch(e){case"xAxis":return nu(t,n);case"yAxis":return ru(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},ix=(t,e,n)=>{switch(e){case"xAxis":return nu(t,n);case"yAxis":return ru(t,n);case"angleAxis":return r2(t,n);case"radiusAxis":return i2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},$z=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function Xz(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 qz=t=>t.graphicalItems.cartesianItems,Pne=ke([_i,AS],Xz),Kz=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),qg=ke([qz,Cs,Pne],Kz,{memoizeOptions:{resultEqualityCheck:PS}}),Yz=ke([qg],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(o2)),Zz=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),Cne=ke([qg],Zz),Qz=t=>t.map(e=>e.data).filter(Boolean).flat(1),Rne=ke([qg],t=>t.some(e=>!e.data)),Jz=ke([qg],Qz,{memoizeOptions:{resultEqualityCheck:PS}}),eB=(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)},O2=ke([Jz,_S],eB),Nne=(t,e,n)=>(e==null?void 0:e.dataKey)!=null?t.map(r=>({value:yi(r,e.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>t.map(i=>({value:yi(i,r)}))):t.map(r=>({value:r})),tB=(t,e,n,r,i,s)=>{var a=r.chartData,o=a===void 0?[]:a,l=r.dataStartIndex,c=r.dataEndIndex,d=Nne(t,e,n);if(i&&(e==null?void 0:e.dataKey)!=null&&s.length>0){var f=o.slice(l,c+1),p=f.map(y=>({value:yi(y,e.dataKey)})).filter(y=>y.value!=null);return[...p,...d]}return d},sx=ke([O2,Cs,qg,_S,Rne,Jz],tB);function eg(t){if(Nl(t)||t instanceof Date){var e=Number(t);if(wn(e))return e}}function fL(t){if(Array.isArray(t)){var e=[eg(t[0]),eg(t[1])];return El(e)?e:void 0}var n=eg(t);if(n!=null)return[n,n]}function Ol(t){return t.map(eg).filter(Ys)}function Ine(t,e){var n=eg(t),r=eg(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var kne=ke([sx],t=>t==null?void 0:t.map(e=>e.value).sort(Ine));function nB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function One(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!Rl(e))r=e;else if(Array.isArray(e)){var i=Ol(e);i.length>0&&(r=Math.max(...i))}return r==null?[]:Ol(n.flatMap(s=>{var a=yi(t,s.dataKey),o,l;if(Array.isArray(a)){var c=Vz(a,2);o=c[0],l=c[1]}else o=l=a;if(!(!wn(o)||!wn(l)))return[r-o,r+l]}))}var oi=t=>{var e=wi(t),n=$g(t);return ix(t,e,n)},Pg=ke([oi],t=>t==null?void 0:t.dataKey),Lne=ke([Yz,_S,oi],az),rB=(t,e,n,r)=>{var i={},s=e.reduce((a,o)=>{if(o.stackId==null)return a;var l=a[o.stackId];return l==null&&(l=[]),l.push(o),a[o.stackId]=l,a},i);return Object.fromEntries(Object.entries(s).map(a=>{var o=Vz(a,2),l=o[0],c=o[1],d=r?[...c].reverse():c,f=d.map(a2);return[l,{stackedData:JK(t,f,n),graphicalItems:d}]}))},iB=ke([Lne,Yz,wS,J4],rB),sB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return rY(t,i,s)},Dne=ke([Cs],t=>t.allowDataOverflow),L2=t=>{var e;if(t==null||!("domain"in t))return PP;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=Ol(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:PP},aB=ke([Cs],L2),oB=ke([aB,Dne],H4),Une=ke([iB,$o,_i,oB],sB,{memoizeOptions:{resultEqualityCheck:TS}}),D2=t=>t.errorBars,jne=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>nB(n,r)),Bw=function(){for(var e=arguments.length,n=new Array(e),r=0;r5&&arguments[5]!==void 0?arguments[5]:[],o,l;if(r.length>0&&r.forEach(c=>{var d,f=c.data!=null?[...c.data]:a,p=(d=i[c.id])===null||d===void 0?void 0:d.filter(y=>nB(s,y));f.forEach(y=>{var b,S=yi(y,(b=n.dataKey)!==null&&b!==void 0?b:c.dataKey),w=One(y,S,p);if(w.length>=2){var x=Math.min(...w),M=Math.max(...w);(o==null||xl)&&(l=M)}var T=fL(S);T!=null&&(o=o==null?T[0]:Math.min(o,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=fL(yi(c,n.dataKey));d!=null&&(o=o==null?d[0]:Math.min(o,d[0]),l=l==null?d[1]:Math.max(l,d[1]))}),wn(o)&&wn(l))return[o,l]},Fne=ke([O2,Cs,Cne,D2,_i,mJ],lB,{memoizeOptions:{resultEqualityCheck:TS}});function zne(t){var e=t.value;if(Nl(e)||e instanceof Date)return e}var Bne=(t,e,n)=>{var r=t.map(zne).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&x5(r))?B4(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},cB=t=>t.referenceElements.dots,Kg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),Hne=ke([cB,_i,AS],Kg),uB=t=>t.referenceElements.areas,Vne=ke([uB,_i,AS],Kg),dB=t=>t.referenceElements.lines,Gne=ke([dB,_i,AS],Kg),fB=(t,e)=>{if(t!=null){var n=Ol(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Wne=ke(Hne,_i,fB),hB=(t,e)=>{if(t!=null){var n=Ol(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)]}},$ne=ke([Vne,_i],hB);function Xne(t){var e;if(t.x!=null)return Ol([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:Ol(n)}function qne(t){var e;if(t.y!=null)return Ol([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:Ol(n)}var pB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?Xne(r):qne(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Kne=ke([Gne,_i],pB),Yne=ke(Wne,Kne,$ne,(t,e,n)=>Bw(t,n,e)),mB=(t,e,n,r,i,s,a,o)=>{if(n!=null)return n;var l=a==="vertical"&&o==="xAxis"||a==="horizontal"&&o==="yAxis",c=l?Bw(r,s,i):Bw(s,i);return _J(e,c,t.allowDataOverflow)},Zne=ke([Cs,aB,oB,Une,Fne,Yne,hr,_i],mB,{memoizeOptions:{resultEqualityCheck:TS}}),Qne=[0,1],gB=(t,e,n,r,i,s,a)=>{if(!((t==null||n==null||n.length===0)&&a===void 0)){var o=t.dataKey,l=t.type,c=jl(e,s);if(c&&o==null){var d;return B4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?Bne(r,t,c):i==="expand"&&!c?Qne:a}},U2=ke([Cs,hr,O2,sx,wS,_i,Zne],gB),Yg=ke([Cs,$z,e2],Bz),vB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=L2(e),s=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&El(t)){if(s)return _O(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return wO(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&El(t))return _O(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&El(t))return wO(t,e.tickCount,e.allowDecimals,"adaptive")}}},j2=ke([U2,ix,Yg],vB),yB=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&El(e)&&Array.isArray(n)&&n.length>0){var i,s,a=e[0],o=(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(a,o),Math.max(l,c)]}return e},Jne=ke([Cs,U2,j2,_i],yB),ere=ke(sx,Cs,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(Ol(t.map(f=>f.value))).sort((f,p)=>f-p),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var a=s-i;if(a===0)return 1/0;for(var o=0;oi,(t,e,n,r,i)=>{if(!wn(t))return 0;var s=e==="vertical"?r.height:r.width;if(i==="gap")return t*s/2;if(i==="no-gap"){var a=Td(n,t*s),o=t*s/2;return o-a-(o-a)/s*a}return 0}),tre=(t,e,n)=>{var r=nu(t,e);return r==null||typeof r.padding!="string"?0:xB(t,"xAxis",e,n,r.padding)},nre=(t,e,n)=>{var r=ru(t,e);return r==null||typeof r.padding!="string"?0:xB(t,"yAxis",e,n,r.padding)},rre=ke(nu,tre,(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}}),ire=ke(ru,nre,(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}}),bB=ke([Wi,rre,mS,pS,(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]}),_B=ke([Wi,hr,ire,mS,pS,(t,e,n)=>n],(t,e,n,r,i,s)=>{var a=i.padding;return s?[r.height-a.bottom,a.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),ax=(t,e,n,r)=>{var i;switch(e){case"xAxis":return bB(t,n,r);case"yAxis":return _B(t,n,r);case"zAxis":return(i=k2(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return rz(t);case"radiusAxis":return iz(t,n);default:return}},wB=ke([Cs,ax],SS),sre=ke([Yg,Jne],FJ),F2=ke([Cs,Yg,sre,wB],I2),SB=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var i=n.type,s=n.scale,a=jl(t,r);if(a&&(i==="number"||s!=="auto"))return e.map(o=>o.value)}},z2=ke([hr,sx,ix,_i],SB),LS=ke([F2],l2);ke([F2],yne);ke([F2,kne],Hz);ke([qg,D2,_i],jne);function MB(t,e){return t.ide.id?1:0}var DS=(t,e)=>e,US=(t,e,n)=>n,are=ke(fS,DS,US,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(MB)),ore=ke(hS,DS,US,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(MB)),EB=(t,e)=>({width:t.width,height:e.height}),lre=(t,e)=>{var n=typeof e.width=="number"?e.width:Ky;return{width:n,height:t.height}},cre=ke(Wi,nu,EB),ure=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},dre=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},fre=ke(eu,Wi,are,DS,US,(t,e,n,r,i)=>{var s={},a;return n.forEach(o=>{var l=EB(e,o);a==null&&(a=ure(e,r,t));var c=r==="top"&&!i||r==="bottom"&&i;s[o.id]=a-Number(c)*l.height,a+=(c?-1:1)*l.height}),s}),hre=ke(Jc,Wi,ore,DS,US,(t,e,n,r,i)=>{var s={},a;return n.forEach(o=>{var l=lre(e,o);a==null&&(a=dre(e,r,t));var c=r==="left"&&!i||r==="right"&&i;s[o.id]=a-Number(c)*l.width,a+=(c?-1:1)*l.width}),s}),pre=(t,e)=>{var n=nu(t,e);if(n!=null)return fre(t,n.orientation,n.mirror)},mre=ke([Wi,nu,pre,(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}}}),gre=(t,e)=>{var n=ru(t,e);if(n!=null)return hre(t,n.orientation,n.mirror)},vre=ke([Wi,ru,gre,(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}}}),yre=ke(Wi,ru,(t,e)=>{var n=typeof e.width=="number"?e.width:Ky;return{width:n,height:t.height}}),AB=(t,e,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,s=n.type,a=n.dataKey,o=jl(t,r),l=e.map(d=>d.value),c=l.filter(d=>d!=null);if(a&&o&&s==="category"&&i&&x5(c))return l}},B2=ke([hr,sx,Cs,_i],AB),hL=ke([hr,Tne,Yg,LS,B2,z2,ax,j2,_i],(t,e,n,r,i,s,a,o,l)=>{if(e!=null){var c=jl(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:o,range:a,realScaleType:n,scale:r}}}),xre=(t,e,n,r,i,s,a,o,l)=>{if(!(e==null||r==null)){var c=jl(t,l),d=e.type,f=e.ticks,p=e.tickCount,y=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,b=d==="category"&&r.bandwidth?r.bandwidth()/y:0;b=l==="angleAxis"&&s!=null&&s.length>=2?Va(s[0]-s[1])*2*b:b;var S=f||i;return S?S.map((w,x)=>{var M=a?a.indexOf(w):w,T=r.map(M);return wn(T)?{index:x,coordinate:T+b,value:w,offset:b}:null}).filter(Ys):c&&o?o.map((w,x)=>{var M=r.map(w);return wn(M)?{coordinate:M+b,value:w,index:x,offset:b}:null}).filter(Ys):r.ticks?r.ticks(p).map((w,x)=>{var M=r.map(w);return wn(M)?{coordinate:M+b,value:w,index:x,offset:b}:null}).filter(Ys):r.domain().map((w,x)=>{var M=r.map(w);return wn(M)?{coordinate:M+b,value:a?a[w]:w,index:x,offset:b}:null}).filter(Ys)}},TB=ke([hr,ix,Yg,LS,j2,ax,B2,z2,_i],xre),bre=(t,e,n,r,i,s,a)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var o=jl(t,a),l=e.tickCount,c=0;return c=a==="angleAxis"&&(r==null?void 0:r.length)>=2?Va(r[0]-r[1])*2*c:c,o&&s?s.map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:d,index:f,offset:c}:null}).filter(Ys):n.ticks?n.ticks(l).map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:d,index:f,offset:c}:null}).filter(Ys):n.domain().map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:i?i[d]:d,index:f,offset:c}:null}).filter(Ys)}},PB=ke([hr,ix,LS,ax,B2,z2,_i],bre),CB=ke(Cs,LS,(t,e)=>{if(!(t==null||e==null))return zw(zw({},t),{},{scale:e})}),_re=ke([Cs,Yg,U2,wB],I2),wre=ke([_re],l2);ke((t,e,n)=>k2(t,n),wre,(t,e)=>{if(!(t==null||e==null))return zw(zw({},t),{},{scale:e})});var Sre=ke([hr,fS,hS],(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}}),Mre=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};ke([Mre],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,i=t[0];for(var s of t){var a=Math.abs(s.coordinate-e);at.options.defaultTooltipEventType,NB=t=>t.options.validateTooltipEventTypes;function IB(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=RB(t),r=NB(t);return IB(e,n,r)}function Ere(t){return Ft(e=>ox(e,t))}var kB=(t,e)=>{var n,r=Number(e);if(!(Rl(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},Are=t=>t.tooltip.settings,ld={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Tre={itemInteraction:{click:ld,hover:ld},axisInteraction:{click:ld,hover:ld},keyboardInteraction:ld,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}},OB=cs({name:"tooltip",initialState:Tre,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=Ga(t).tooltipItemPayloads.indexOf(r);s>-1&&(t.tooltipItemPayloads[s]=i)},prepare:ar()},removeTooltipEntrySettings:{reducer(t,e){var n=Ga(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}}}),Ja=OB.actions,Pre=Ja.addTooltipEntrySettings,Cre=Ja.replaceTooltipEntrySettings,Rre=Ja.removeTooltipEntrySettings,Nre=Ja.setTooltipSettingsState,Ire=Ja.setActiveMouseOverItemIndex;Ja.mouseLeaveItem;var LB=Ja.mouseLeaveChart;Ja.setActiveClickItemIndex;var DB=Ja.setMouseOverAxisIndex,kre=Ja.setMouseClickAxisIndex,H0=Ja.setSyncInteraction,Hw=Ja.setKeyboardInteraction,Ore=OB.reducer;function pL(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 Ob(t){for(var e=1;e{if(e==null)return ld;var i=jre(t,e,n);if(i==null)return ld;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(Fre(i)){if(s)return Ob(Ob({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Ob(Ob({},ld),{},{coordinate:i.coordinate})};function zre(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 Bre(t,e){var n=zre(t),r=e[0],i=e[1];if(n===void 0)return!1;var s=Math.min(r,i),a=Math.max(r,i);return n>=s&&n<=a}function Hre(t,e,n){if(n==null||e==null)return!0;var r=yi(t,e);return r==null||!El(n)?!0:Bre(r,n)}var X0=(t,e,n,r)=>{var i=t==null?void 0:t.index;if(i==null)return null;var s=Number(i);if(!wn(s))return i;var a=0,o=1/0;e.length>0&&(o=e.length-1);var l=Math.max(a,Math.min(s,o)),c=e[l];return c==null||Hre(c,n,r)?String(l):null},jB=(t,e,n,r,i,s,a)=>{if(s!=null){var o=a[0],l=o==null?void 0:o.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}}}},FB=(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(a=>{var o;return((o=a.settings)===null||o===void 0?void 0:o.graphicalItemId)===i})},zB=t=>t.options.tooltipPayloadSearcher,Zg=t=>t.tooltip;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 gL(t){for(var e=1;et(e)}function vL(t){if(typeof t=="string")return t}function Kre(t){if(!(t==null||typeof t!="object")){var e="name"in t?$re(t.name):void 0,n="unit"in t?Xre(t.unit):void 0,r="dataKey"in t?qre(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?vL(t.color):void 0,a="fill"in t?vL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:a}}}function Yre(t,e){return t??e}var BB=(t,e,n,r,i,s,a)=>{if(!(e==null||s==null)){var o=n.chartData,l=n.computedData,c=n.dataStartIndex,d=n.dataEndIndex,f=[];return t.reduce((p,y)=>{var b,S=y.dataDefinedOnItem,w=y.settings,x=Yre(S,o),M=Array.isArray(x)?f4(x,c,d):x,T=(b=w==null?void 0:w.dataKey)!==null&&b!==void 0?b:r,P=w==null?void 0:w.nameKey,O;if(r&&Array.isArray(M)&&!Array.isArray(M[0])&&a==="axis"?O=b5(M,r,i):O=s(M,e,l,P),Array.isArray(O))O.forEach(D=>{var z,V,k=Kre(D),j=k==null?void 0:k.name,X=k==null?void 0:k.dataKey,ee=k==null?void 0:k.payload,ie=gL(gL({},w),{},{name:j,unit:k==null?void 0:k.unit,color:(z=k==null?void 0:k.color)!==null&&z!==void 0?z:w==null?void 0:w.color,fill:(V=k==null?void 0:k.fill)!==null&&V!==void 0?V:w==null?void 0:w.fill});p.push(dk({tooltipEntrySettings:ie,dataKey:X,payload:ee,value:yi(ee,X),name:j==null?void 0:String(j)}))});else{var N;p.push(dk({tooltipEntrySettings:w,dataKey:T,payload:O,value:yi(O,T),name:(N=yi(O,P))!==null&&N!==void 0?N:w==null?void 0:w.name}))}return p},f)}},H2=ke([oi,$z,e2],Bz),Zre=ke([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),Qre=ke([wi,$g],Xz),Jh=ke([Zre,oi,Qre],Kz,{memoizeOptions:{resultEqualityCheck:PS}}),Jre=ke([Jh],t=>t.filter(o2)),HB=ke([Jh],Qz,{memoizeOptions:{resultEqualityCheck:PS}}),eie=ke([Jh],t=>t.some(e=>!e.data)),jh=ke([HB,$o],eB),tie=ke([Jre,$o,oi],az),V2=ke([jh,oi,Jh,$o,eie,HB],tB),VB=ke([oi],L2),nie=ke([oi],t=>t.allowDataOverflow),GB=ke([VB,nie],H4),rie=ke([Jh],t=>t.filter(o2)),iie=ke([tie,rie,wS,J4],rB),sie=ke([iie,$o,wi,GB],sB),aie=ke([Jh],Zz),oie=ke([jh,oi,aie,D2,wi,gJ],lB,{memoizeOptions:{resultEqualityCheck:TS}}),lie=ke([cB,wi,$g],Kg),cie=ke([lie,wi],fB),uie=ke([uB,wi,$g],Kg),die=ke([uie,wi],hB),fie=ke([dB,wi,$g],Kg),hie=ke([fie,wi],pB),pie=ke([cie,hie,die],Bw),mie=ke([oi,VB,GB,sie,oie,pie,hr,wi],mB),Cg=ke([oi,hr,jh,V2,wS,wi,mie],gB),gie=ke([Cg,oi,H2],vB),vie=ke([oi,Cg,gie,wi],yB),WB=t=>{var e=wi(t),n=$g(t),r=!1;return ax(t,e,n,r)},$B=ke([oi,WB],SS),yie=ke([oi,H2,vie,$B],I2),XB=ke([yie],l2),xie=ke([hr,V2,oi,wi],AB),bie=ke([hr,V2,oi,wi],SB),_ie=(t,e,n,r,i,s,a,o)=>{if(e){var l=e.type,c=jl(t,o);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=l==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=o==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Va(i[0]-i[1])*2*f:f,c&&a?a.map((p,y)=>{var b=r.map(p);return wn(b)?{coordinate:b+f,value:p,index:y,offset:f}:null}).filter(Ys):r.domain().map((p,y)=>{var b=r.map(p);return wn(b)?{coordinate:b+f,value:s?s[p]:p,index:y,offset:f}:null}).filter(Ys)}}},iu=ke([hr,oi,H2,XB,WB,xie,bie,wi],_ie),G2=ke([RB,NB,Are],(t,e,n)=>IB(n.shared,t,e)),qB=t=>t.tooltip.settings.trigger,W2=t=>t.tooltip.settings.defaultIndex,lx=ke([Zg,G2,qB,W2],UB),Sy=ke([lx,jh,Pg,Cg],X0),KB=ke([iu,Sy],kB),wie=ke([lx],t=>{if(t)return t.dataKey}),Sie=ke([lx],t=>{if(t)return t.graphicalItemId}),YB=ke([Zg,G2,qB,W2],FB),Mie=ke([Jc,eu,hr,Wi,iu,W2,YB],jB),Eie=ke([lx,Mie],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Aie=ke([lx],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),Tie=ke([YB,Sy,$o,Pg,KB,zB,G2],BB),Pie=ke([Tie],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});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;eFt(oi),kie=()=>{var t=Iie(),e=Ft(iu),n=Ft(XB);return yw(!t||!n?void 0:xL(xL({},t),{},{scale:n}),e)};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 cm(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}},jie=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="centric"){var s=i.coordinate,a=r.radius;return cm(cm(cm({},r),Bi(r.cx,r.cy,a,s)),{},{angle:s,radius:a})}var o=i.coordinate,l=r.angle;return cm(cm(cm({},r),Bi(r.cx,r.cy,o,l)),{},{angle:l,radius:o})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function Fie(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 ZB=(t,e,n,r,i)=>{var s,a=(s=e==null?void 0:e.length)!==null&&s!==void 0?s:0;if(a<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=0;o0?(l=n[o-1])===null||l===void 0?void 0:l.coordinate:(c=n[a-1])===null||c===void 0?void 0:c.coordinate,b=(d=n[o])===null||d===void 0?void 0:d.coordinate,S=o>=a-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(p=n[o+1])===null||p===void 0?void 0:p.coordinate,w=void 0;if(!(y==null||b==null||S==null))if(Va(b-y)!==Va(S-b)){var x=[];if(Va(S-b)===Va(i[1]-i[0])){w=S;var M=b+i[1]-i[0];x[0]=Math.min(M,(M+y)/2),x[1]=Math.max(M,(M+y)/2)}else{w=y;var T=S+i[1]-i[0];x[0]=Math.min(b,(T+b)/2),x[1]=Math.max(b,(T+b)/2)}var P=[Math.min(b,(w+b)/2),Math.max(b,(w+b)/2)];if(t>P[0]&&t<=P[1]||t>=x[0]&&t<=x[1]){var O;return(O=n[o])===null||O===void 0?void 0:O.index}}else{var N=Math.min(y,S),D=Math.max(y,S);if(t>(N+b)/2&&t<=(D+b)/2){var z;return(z=n[o])===null||z===void 0?void 0:z.index}}}else if(e)for(var V=0;V(k.coordinate+X.coordinate)/2||V>0&&V(k.coordinate+X.coordinate)/2&&t<=(k.coordinate+j.coordinate)/2)return k.index}}return-1},QB=()=>Ft(e2),$2=(t,e)=>e,JB=(t,e,n)=>n,X2=(t,e,n,r)=>r,zie=ke(iu,t=>tS(t,e=>e.coordinate)),q2=ke([Zg,$2,JB,X2],UB),K2=ke([q2,jh,Pg,Cg],X0),Bie=(t,e,n)=>{if(e!=null){var r=Zg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},eH=ke([Zg,$2,JB,X2],FB),Vw=ke([Jc,eu,hr,Wi,iu,X2,eH],jB),Hie=ke([q2,Vw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),tH=ke([iu,K2],kB),Vie=ke([eH,K2,$o,Pg,tH,zB,$2],BB),Gie=ke([q2,K2],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),Wie=(t,e,n,r,i,s,a)=>{if(!(!t||!n||!r||!i)&&Fie(t,a)){var o=iY(t,e),l=ZB(o,s,i,n,r),c=Uie(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},$ie=(t,e,n,r,i,s,a)=>{if(!(!t||!r||!i||!s||!n)){var o=oJ(t,n);if(o){var l=sY(o,e),c=ZB(l,a,s,r,i),d=jie(e,s,c,o);return{activeIndex:String(c),activeCoordinate:d}}}},Xie=(t,e,n,r,i,s,a,o)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?Wie(t,e,r,i,s,a,o):$ie(t,e,n,r,i,s,a)},qie=ke(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}}),Kie=ke(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(r=>parseInt(r,10)).concat(Object.values(Ms)),n=Array.from(new Set(e));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:jJ}});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;ewL(wL({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),Jie)},tse=new Set(Object.values(Ms));function nse(t){return tse.has(t)}var nH=cs({name:"zIndex",initialState:ese,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&&!nse(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()}}}),jS=nH.actions,rse=jS.registerZIndexPortal,jE=jS.unregisterZIndexPortal,ise=jS.registerZIndexPortalElement,sse=jS.unregisterZIndexPortalElement,ase=nH.reducer;function su(t){var e=t.zIndex,n=t.children,r=VY(),i=r&&e!==void 0&&e!==0,s=Js(),a=R.useRef(void 0),o=R.useRef(new Set),l=Wr(),c=Ft(f=>qie(f,e,s));if(R.useLayoutEffect(()=>{if(!i){var f=o.current;f.forEach(y=>{l(jE({zIndex:y}))}),f.clear(),a.current=void 0;return}if(o.current.has(e)||(l(rse({zIndex:e})),o.current.add(e)),c){a.current=c;var p=o.current;p.forEach(y=>{y!==e&&(l(jE({zIndex:y})),p.delete(y))})}},[l,e,i,c]),R.useLayoutEffect(()=>{var f=o.current;return()=>{f.forEach(p=>{l(jE({zIndex:p}))}),f.clear()}},[l]),!i)return n;var d=c??a.current;return d?X1.createPortal(n,d):null}function CP(){return CP=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.useContext(rH),FE={exports:{}},ML;function pse(){return ML||(ML=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,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new i(d,f||l,p),b=n?n+c:c;return l._events[b]?l._events[b].fn?l._events[b]=[l._events[b],y]:l._events[b].push(y):(l._events[b]=y,l._eventsCount++),l}function a(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function o(){this._events=new r,this._eventsCount=0}o.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},o.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 p=0,y=f.length,b=new Array(y);p{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!Rl(n))return t[n]}},yse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},iH=cs({name:"options",initialState:yse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),xse=iH.reducer,bse=iH.actions.createEventEmitter;function _se(t){return t.tooltip.syncInteraction}var wse={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},sH=cs({name:"chartData",initialState:wse,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)}}}),Y2=sH.actions,AL=Y2.setChartData,Sse=Y2.setDataStartEndIndexes;Y2.setComputedData;var Mse=sH.reducer,Ese=["x","y"];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 um(t){for(var e=1;el.rootProps.className);R.useEffect(()=>{if(t==null)return Hg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(H0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var p;if(a&&d!==null&&d!==void 0&&(p=d.payload)!==null&&p!==void 0&&p.coordinate&&d.payload.sourceViewBox){var y=d.payload.coordinate,b=y.x,S=y.y,w=Cse(y,Ese),x=d.payload.sourceViewBox,M=x.x,T=x.y,P=x.width,O=x.height,N=um(um({},w),{},{x:a.x+(P?(b-M)/P:0)*a.width,y:a.y+(O?(S-T)/O:0)*a.height});n(um(um({},d),{},{payload:um(um({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var D;if(typeof r=="function"){var z={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},V=r(i,z);D=i[V]}else r==="value"&&(D=i.find(he=>String(he.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||a==null){n(H0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(D==null){n(H0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var j=k.x,X=k.y,ee=Math.min(j,a.x+a.width),ie=Math.min(X,a.y+a.height),pe={x:s==="horizontal"?D.coordinate:ee,y:s==="horizontal"?ie:D.coordinate},ae=H0({active:d.payload.active,coordinate:pe,dataKey:d.payload.dataKey,index:String(D.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(ae)}}};return My.on(RP,l),()=>{My.off(RP,l)}},[o,n,e,t,r,i,s,a])}function Ise(){var t=Ft(t2),e=Ft(n2),n=Wr();R.useEffect(()=>{if(t==null)return Hg;var r=(i,s,a)=>{e!==a&&t===i&&n(Sse(s))};return My.on(EL,r),()=>{My.off(EL,r)}},[n,e,t])}function kse(){var t=Wr();R.useEffect(()=>{t(bse())},[t]),Nse(),Ise()}function Ose(t,e,n,r,i,s){var a=Ft(b=>Bie(b,t,e)),o=Ft(Sie),l=Ft(n2),c=Ft(t2),d=Ft(ez),f=Ft(_se),p=(f==null?void 0:f.sourceViewBox)!=null,y=gS();R.useEffect(()=>{if(!p&&c!=null&&l!=null){var b=H0({active:s,coordinate:n,dataKey:a,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:o});My.emit(RP,c,b,l)}},[p,n,a,o,i,r,l,c,d,s,y])}function PL(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;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{D(Nre({shared:M,trigger:T,axisId:N,active:i,defaultIndex:z}))},[D,M,T,N,i,z]);var V=gS(),k=k4(),j=Ere(M),X=(e=Ft($e=>Gie($e,j,T,z)))!==null&&e!==void 0?e:{},ee=X.activeIndex,ie=X.isActive,pe=Ft($e=>Vie($e,j,T,z)),ae=Ft($e=>tH($e,j,T,z)),he=Ft($e=>Hie($e,j,T,z)),B=pe,J=hse(),Y=(n=i??ie)!==null&&n!==void 0?n:!1,H=Gq([B,Y]),G=jse(H,2),le=G[0],se=G[1],ce=j==="axis"?ae:void 0;Ose(j,T,he,ce,ee,Y);var Se=O??J;if(Se==null||V==null||j==null)return null;var we=B??NL;Y||(we=NL),c&&we.length&&(we=hq(we.filter($e=>$e.value!=null&&($e.hide!==!0||r.includeHidden)),p,Vse));var We=we.length>0,Ee=CL(CL({},r),{},{payload:we,label:ce,active:Y,activeIndex:ee,coordinate:he,accessibilityLayer:k}),Ge=R.createElement(tQ,{allowEscapeViewBox:s,animationDuration:a,animationEasing:o,isAnimationActive:d,active:Y,coordinate:he,hasPayload:We,offset:f,position:y,reverseDirection:b,useTranslate3d:S,viewBox:V,wrapperStyle:w,lastBoundingBox:le,innerRef:se,hasPortalFromProps:!!O},Gse(l,Ee));return R.createElement(R.Fragment,null,X1.createPortal(Ge,Se),Y&&R.createElement(fse,{cursor:x,tooltipEventType:j,coordinate:he,payload:we,index:ee}))}function Xse(t,e,n){return(e=qse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qse(t){var e=Kse(t,"string");return typeof e=="symbol"?e:e+""}function Kse(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 Yse{constructor(e){Xse(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 IL(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 Zse(t){for(var e=1;e{try{var n=document.getElementById(OL);n||(n=document.createElement("span"),n.setAttribute("id",OL),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,nae,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},q0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Jy.isSsr)return{width:0,height:0};if(!aH.enableCache)return LL(e,n);var r=rae(e,n),i=kL.get(r);if(i)return i;var s=LL(e,n);return kL.set(r,s),s},oH;function Gw(t,e){return oae(t)||aae(t,e)||sae(t,e)||iae()}function iae(){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 sae(t,e){if(t){if(typeof t=="string")return DL(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)?DL(t,e):void 0}}function DL(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(cH));var s=i.map(o=>({word:o,width:q0(o,r).width})),a=n?0:q0(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:a}}catch{return null}};function dH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function Tae(t){return Vi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var fH=(t,e,n,r)=>t.reduce((i,s)=>{var a=s.word,o=s.width,l=i[i.length-1];if(l&&o!=null&&(e==null||r||l.width+o+nt.reduce((e,n)=>e.width>n.width?e:n),Pae="…",VL=(t,e,n,r,i,s,a,o)=>{var l=t.slice(0,e),c=uH({breakAll:n,style:r,children:l+Pae});if(!c)return[!1,[]];var d=fH(c.wordsWithComputedWidth,s,a,o),f=d.length>i||hH(d).width>Number(s);return[f,d]},Cae=(t,e,n,r,i)=>{var s=t.maxLines,a=t.children,o=t.style,l=t.breakAll,c=kt(s),d=String(a),f=fH(e,r,n,i);if(!c||i)return f;var p=f.length>s||hH(f).width>Number(r);if(!p)return f;for(var y=0,b=d.length-1,S=0,w;y<=b&&S<=d.length-1;){var x=Math.floor((y+b)/2),M=x-1,T=VL(d,M,l,o,s,r,n,i),P=BL(T,2),O=P[0],N=P[1],D=VL(d,x,l,o,s,r,n,i),z=BL(D,1),V=z[0];if(!O&&!V&&(y=x+1),O&&V&&(b=x-1),!O&&V){w=N;break}S++}return w||f},GL=t=>{var e=Vi(t)?[]:t.toString().split(cH);return[{words:e,width:void 0}]},Rae=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,a=t.maxLines;if((e||n)&&!Jy.isSsr){var o,l,c=uH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;o=d,l=f}else return GL(r);return Cae({breakAll:s,children:r,maxLines:a,style:i},o,l,e,!!n)}return GL(r)},pH="#808080",Nae={angle:0,breakAll:!1,capHeight:"0.71em",fill:pH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Z2=R.forwardRef((t,e)=>{var n=Za(t,Nae),r=n.x,i=n.y,s=n.lineHeight,a=n.capHeight,o=n.fill,l=n.scaleToFit,c=n.textAnchor,d=n.verticalAnchor,f=zL(n,bae),p=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,b=f.dy,S=f.angle,w=f.className,x=f.breakAll,M=zL(f,_ae);if(!Nl(r)||!Nl(i)||p.length===0)return null;var T=Number(r)+(kt(y)?y:0),P=Number(i)+(kt(b)?b:0);if(!wn(T)||!wn(P))return null;var O;switch(d){case"start":O=zE("calc(".concat(a,")"));break;case"middle":O=zE("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(a," / 2))"));break;default:O=zE("calc(".concat(p.length-1," * -").concat(s,")"));break}var N=[],D=p[0];if(l&&D!=null){var z=D.width,V=f.width;N.push("scale(".concat(kt(V)&&kt(z)?V/z:1,")"))}return S&&N.push("rotate(".concat(S,", ").concat(T,", ").concat(P,")")),N.length&&(M.transform=N.join(" ")),R.createElement("text",NP({},Xa(M),{ref:e,x:T,y:P,className:tr("recharts-text",w),textAnchor:c,fill:o.includes("url")?pH:o}),p.map((k,j)=>{var X=k.words.join(x?"":" ");return R.createElement("tspan",{x:T,dy:j===0?O:s,key:"".concat(X,"-").concat(j)},X)}))});Z2.displayName="Text";function WL(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,a=WC(e),o=a.x,l=a.y,c=a.height,d=a.upperWidth,f=a.lowerWidth,p=o,y=o+(d-f)/2,b=(p+y)/2,S=(d+f)/2,w=p+d/2,x=c>=0?1:-1,M=x*i,T=x>0?"end":"start",P=x>0?"start":"end",O=d>=0?1:-1,N=O*i,D=O>0?"end":"start",z=O>0?"start":"end",V=s;if(n==="top"){var k={x:p+d/2,y:l-M,horizontalAnchor:"middle",verticalAnchor:T};return V&&(k.height=Math.max(l-V.y,0),k.width=d),k}if(n==="bottom"){var j={x:y+f/2,y:l+c+M,horizontalAnchor:"middle",verticalAnchor:P};return V&&(j.height=Math.max(V.y+V.height-(l+c),0),j.width=f),j}if(n==="left"){var X={x:b-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"};return V&&(X.width=Math.max(X.x-V.x,0),X.height=c),X}if(n==="right"){var ee={x:b+S+N,y:l+c/2,horizontalAnchor:z,verticalAnchor:"middle"};return V&&(ee.width=Math.max(V.x+V.width-ee.x,0),ee.height=c),ee}var ie=V?{width:S,height:c}:{};return n==="insideLeft"?pl({x:b+N,y:l+c/2,horizontalAnchor:z,verticalAnchor:"middle"},ie):n==="insideRight"?pl({x:b+S-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"},ie):n==="insideTop"?pl({x:p+d/2,y:l+M,horizontalAnchor:"middle",verticalAnchor:P},ie):n==="insideBottom"?pl({x:y+f/2,y:l+c-M,horizontalAnchor:"middle",verticalAnchor:T},ie):n==="insideTopLeft"?pl({x:p+N,y:l+M,horizontalAnchor:z,verticalAnchor:P},ie):n==="insideTopRight"?pl({x:p+d-N,y:l+M,horizontalAnchor:D,verticalAnchor:P},ie):n==="insideBottomLeft"?pl({x:y+N,y:l+c-M,horizontalAnchor:z,verticalAnchor:T},ie):n==="insideBottomRight"?pl({x:y+f-N,y:l+c-M,horizontalAnchor:D,verticalAnchor:T},ie):n&&typeof n=="object"&&(kt(n.x)||kh(n.x))&&(kt(n.y)||kh(n.y))?pl({x:o+Td(n.x,S),y:l+Td(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},ie):pl({x:w,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},ie)},Dae=["labelRef"],Uae=["content"];function $L(t,e){if(t==null)return{};var n,r,i=jae(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,a=t.height,o=t.children,l=R.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:i,width:s,height:a}),[e,n,r,i,s,a]);return R.createElement(mH.Provider,{value:l},o)},gH=()=>{var t=R.useContext(mH),e=gS();return t||(e?WC(e):void 0)},Vae=R.createContext(null),Gae=()=>{var t=R.useContext(Vae),e=Ft(sz);return t||e},Wae=t=>{var e=t.value,n=t.formatter,r=Vi(t.children)?e:t.children;return typeof n=="function"?n(r):r},Q2=t=>t!=null&&typeof t=="function",$ae=(t,e)=>{var n=Va(e-t),r=Math.min(Math.abs(e-t),360);return n*r},Xae=(t,e,n,r,i)=>{var s=t.offset,a=t.className,o=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,p=i.endAngle,y=i.clockWise,b=(c+d)/2,S=$ae(f,p),w=S>=0?1:-1,x,M;switch(e){case"insideStart":x=f+w*s,M=y;break;case"insideEnd":x=p-w*s,M=!y;break;case"end":x=p+w*s,M=y;break;default:throw new Error("Unsupported position ".concat(e))}M=S<=0?M:!M;var T=Bi(o,l,b,x),P=Bi(o,l,b,x+(M?1:-1)*359),O="M".concat(T.x,",").concat(T.y,` + A`,",",",0,0,",",",",","Z"])),j.x,j.y,s,s,+(d<0),k.x,k.y,r,r,+(ee>180),+(d>0),N.x,N.y,s,s,+(d<0),D.x,D.y)}else P+=Ui(mO||(mO=rh(["L",",","Z"])),e,n);return P},fJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},hJ=t=>{var e=Za(t,fJ),n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,a=e.cornerRadius,o=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(b,y/2),forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:d}):S=z4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),R.createElement("path",bP({},Xa(e),{className:p,d:S}))};function pJ(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(_5(e)){if(t==="centric"){var r=e.cx,i=e.cy,s=e.innerRadius,a=e.outerRadius,o=e.angle,l=Bi(r,i,s,o),c=Bi(r,i,a,o);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return F4(e)}}function mJ(t){return L5(t)?NaN:Number(t)}function CE(t){return t?(t=mJ(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function B4(t,e,n){n&&typeof n!="number"&&eP(t,e,n)&&(e=n=void 0),t=CE(t),e===void 0?(e=t,t=0):e=CE(e),n=n===void 0?tt.chartData,KC=ke([$o],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),_S=(t,e,n,r)=>r?KC(t):$o(t),gJ=(t,e,n)=>n?KC(t):$o(t),vJ=ke([_S],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});ke([KC],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var yJ=ke([$o],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function YC(t,e){return wJ(t)||_J(t,e)||bJ(t,e)||xJ()}function xJ(){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 bJ(t,e){if(t){if(typeof t=="string")return gO(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)?gO(t,e):void 0}}function gO(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};Tt.decimalPlaces=Tt.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*or;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Tt.dividedBy=Tt.div=function(t){return Bc(this,new this.constructor(t))};Tt.dividedToIntegerBy=Tt.idiv=function(t){var e=this,n=e.constructor;return Zn(Bc(e,new n(t),0,1),n.precision)};Tt.equals=Tt.eq=function(t){return!this.cmp(t)};Tt.exponent=function(){return Vr(this)};Tt.greaterThan=Tt.gt=function(t){return this.cmp(t)>0};Tt.greaterThanOrEqualTo=Tt.gte=function(t){return this.cmp(t)>=0};Tt.isInteger=Tt.isint=function(){return this.e>this.d.length-2};Tt.isNegative=Tt.isneg=function(){return this.s<0};Tt.isPositive=Tt.ispos=function(){return this.s>0};Tt.isZero=function(){return this.s===0};Tt.lessThan=Tt.lt=function(t){return this.cmp(t)<0};Tt.lessThanOrEqualTo=Tt.lte=function(t){return this.cmp(t)<1};Tt.logarithm=Tt.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(va))throw Error(Ka+"NaN");if(n.s<1)throw Error(Ka+(n.s?"NaN":"-Infinity"));return n.eq(va)?new r(0):(dr=!1,e=Bc(vy(n,s),vy(t,s),s),dr=!0,Zn(e,i))};Tt.minus=Tt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?$4(e,t):G4(e,(t.s=-t.s,t))};Tt.modulo=Tt.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(Ka+"NaN");return n.s?(dr=!1,e=Bc(n,t,0,1).times(t),dr=!0,n.minus(e)):Zn(new r(n),i)};Tt.naturalExponential=Tt.exp=function(){return W4(this)};Tt.naturalLogarithm=Tt.ln=function(){return vy(this)};Tt.negated=Tt.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Tt.plus=Tt.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?G4(e,t):$4(e,(t.s=-t.s,t))};Tt.precision=Tt.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Mh+t);if(e=Vr(i)+1,r=i.d.length-1,n=r*or+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};Tt.squareRoot=Tt.sqrt=function(){var t,e,n,r,i,s,a,o=this,l=o.constructor;if(o.s<1){if(!o.s)return new l(0);throw Error(Ka+"NaN")}for(t=Vr(o),dr=!1,i=Math.sqrt(+o),i==0||i==1/0?(e=Sl(o.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Wg((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=a=n+3;;)if(s=r,r=s.plus(Bc(o,s,a+2)).times(.5),Sl(s.d).slice(0,a)===(e=Sl(r.d)).slice(0,a)){if(e=e.slice(a-3,a+1),i==a&&e=="4999"){if(Zn(s,n+1,0),s.times(s).eq(o)){r=s;break}}else if(e!="9999")break;a+=4}return dr=!0,Zn(r,n)};Tt.times=Tt.mul=function(t){var e,n,r,i,s,a,o,l,c,d=this,f=d.constructor,p=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=p.length,c=y.length,l=0;){for(e=0,i=l+r;i>r;)o=s[i]+y[r]*p[i-r-1]+e,s[i--]=o%vi|0,e=o/vi|0;s[i]=(s[i]+e)%vi|0}for(;!s[--a];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,dr?Zn(t,f.precision):t};Tt.toDecimalPlaces=Tt.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(kl(t,0,Gg),e===void 0?e=r.rounding:kl(e,0,8),Zn(n,t+Vr(n)+1,e))};Tt.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Uh(r,!0):(kl(t,0,Gg),e===void 0?e=i.rounding:kl(e,0,8),r=Zn(new i(r),t+1,e),n=Uh(r,!0,t+1)),n};Tt.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Uh(i):(kl(t,0,Gg),e===void 0?e=s.rounding:kl(e,0,8),r=Zn(new s(i),t+Vr(i)+1,e),n=Uh(r.abs(),!1,t+Vr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Tt.toInteger=Tt.toint=function(){var t=this,e=t.constructor;return Zn(new e(t),Vr(t)+1,e.rounding)};Tt.toNumber=function(){return+this};Tt.toPower=Tt.pow=function(t){var e,n,r,i,s,a,o=this,l=o.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(va);if(o=new l(o),!o.s){if(t.s<1)throw Error(Ka+"Infinity");return o}if(o.eq(va))return o;if(r=l.precision,t.eq(va))return Zn(o,r);if(e=t.e,n=t.d.length-1,a=e>=n,s=o.s,a){if((n=d<0?-d:d)<=V4){for(i=new l(va),e=Math.ceil(r/or+4),dr=!1;n%2&&(i=i.times(o),xO(i.d,e)),n=Wg(n/2),n!==0;)o=o.times(o),xO(o.d,e);return dr=!0,t.s<0?new l(va).div(i):Zn(i,r)}}else if(s<0)throw Error(Ka+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,o.s=1,dr=!1,i=t.times(vy(o,r+c)),dr=!0,i=W4(i),i.s=s,i};Tt.toPrecision=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?(n=Vr(i),r=Uh(i,n<=s.toExpNeg||n>=s.toExpPos)):(kl(t,1,Gg),e===void 0?e=s.rounding:kl(e,0,8),i=Zn(new s(i),t,e),n=Vr(i),r=Uh(i,t<=n||n<=s.toExpNeg,t)),r};Tt.toSignificantDigits=Tt.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(kl(t,1,Gg),e===void 0?e=r.rounding:kl(e,0,8)),Zn(new r(n),t,e)};Tt.toString=Tt.valueOf=Tt.val=Tt.toJSON=Tt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Vr(t),n=t.constructor;return Uh(t,e<=n.toExpNeg||e>=n.toExpPos)};function G4(t,e){var n,r,i,s,a,o,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),dr?Zn(e,f):e;if(l=t.d,c=e.d,a=t.e,i=e.e,l=l.slice(),s=a-i,s){for(s<0?(r=l,s=-s,o=c.length):(r=c,i=a,o=l.length),a=Math.ceil(f/or),o=a>o?a+1:o+1,s>o&&(s=o,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(o=l.length,s=c.length,o-s<0&&(s=o,r=c,c=l,l=r),n=0;s;)n=(l[--s]=l[s]+c[s]+n)/vi|0,l[s]%=vi;for(n&&(l.unshift(n),++i),o=l.length;l[--o]==0;)l.pop();return e.d=l,e.e=i,dr?Zn(e,f):e}function kl(t,e,n){if(t!==~~t||tn)throw Error(Mh+t)}function Sl(t){var e,n,r,i=t.length-1,s="",a=t[0];if(i>0){for(s+=a,e=1;ea?1:-1;else for(o=l=0;oi[o]?1:-1;break}return l}function n(r,i,s){for(var a=0;s--;)r[s]-=a,a=r[s]1;)r.shift()}return function(r,i,s,a){var o,l,c,d,f,p,y,b,S,w,x,M,T,P,O,N,D,z,V=r.constructor,k=r.s==i.s?1:-1,j=r.d,X=i.d;if(!r.s)return new V(r);if(!i.s)throw Error(Ka+"Division by zero");for(l=r.e-i.e,D=X.length,O=j.length,y=new V(k),b=y.d=[],c=0;X[c]==(j[c]||0);)++c;if(X[c]>(j[c]||0)&&--l,s==null?M=s=V.precision:a?M=s+(Vr(r)-Vr(i))+1:M=s,M<0)return new V(0);if(M=M/or+2|0,c=0,D==1)for(d=0,X=X[0],M++;(c1&&(X=t(X,d),j=t(j,d),D=X.length,O=j.length),P=D,S=j.slice(0,D),w=S.length;w=vi/2&&++N;do d=0,o=e(X,S,D,w),o<0?(x=S[0],D!=w&&(x=x*vi+(S[1]||0)),d=x/N|0,d>1?(d>=vi&&(d=vi-1),f=t(X,d),p=f.length,w=S.length,o=e(f,S,p,w),o==1&&(d--,n(f,D16)throw Error(ZC+Vr(t));if(!t.s)return new d(va);for(dr=!1,o=f,a=new d(.03125);t.abs().gte(.1);)t=t.times(a),c+=5;for(r=Math.log(qf(2,c))/Math.LN10*2+5|0,o+=r,n=i=s=new d(va),d.precision=o;;){if(i=Zn(i.times(t),o),n=n.times(++l),a=s.plus(Bc(i,n,o)),Sl(a.d).slice(0,o)===Sl(s.d).slice(0,o)){for(;c--;)s=Zn(s.times(s),o);return d.precision=f,e==null?(dr=!0,Zn(s,f)):s}s=a}}function Vr(t){for(var e=t.e*or,n=t.d[0];n>=10;n/=10)e++;return e}function RE(t,e,n){if(e>t.LN10.sd())throw dr=!0,n&&(t.precision=n),Error(Ka+"LN10 precision limit exceeded");return Zn(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,a,o,l,c,d,f=1,p=10,y=t,b=y.d,S=y.constructor,w=S.precision;if(y.s<1)throw Error(Ka+(y.s?"NaN":"-Infinity"));if(y.eq(va))return new S(0);if(e==null?(dr=!1,c=w):c=e,y.eq(10))return e==null&&(dr=!0),RE(S,c);if(c+=p,S.precision=c,n=Sl(b),r=n.charAt(0),s=Vr(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=Vr(y),r>1?(y=new S("0."+n),s++):y=new S(r+"."+n.slice(1))}else return l=RE(S,c+2,w).times(s+""),y=vy(new S(r+"."+n.slice(1)),c-p).plus(l),S.precision=w,e==null?(dr=!0,Zn(y,w)):y;for(o=a=y=Bc(y.minus(va),y.plus(va),c),d=Zn(y.times(y),c),i=3;;){if(a=Zn(a.times(d),c),l=o.plus(Bc(a,new S(i),c)),Sl(l.d).slice(0,c)===Sl(o.d).slice(0,c))return o=o.times(2),s!==0&&(o=o.plus(RE(S,c+2,w).times(s+""))),o=Bc(o,new S(f),c),S.precision=w,e==null?(dr=!0,Zn(o,w)):o;o=l,i+=2}}function yO(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=Wg(n/or),t.d=[],r=(n+1)%or,n<0&&(r+=or),rPw||t.e<-Pw))throw Error(ZC+n)}else t.s=0,t.e=0,t.d=[0];return t}function Zn(t,e,n){var r,i,s,a,o,l,c,d,f=t.d;for(a=1,s=f[0];s>=10;s/=10)a++;if(r=e-a,r<0)r+=or,i=e,c=f[d=0];else{if(d=Math.ceil((r+1)/or),s=f.length,d>=s)return t;for(c=s=f[d],a=1;s>=10;s/=10)a++;r%=or,i=r-or+a}if(n!==void 0&&(s=qf(10,a-i-1),o=c/s%10|0,l=e<0||f[d+1]!==void 0||c%s,l=n<4?(o||l)&&(n==0||n==(t.s<0?3:2)):o>5||o==5&&(n==4||l||n==6&&(r>0?i>0?c/qf(10,a-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=Vr(t),f.length=1,e=e-s-1,f[0]=qf(10,(or-e%or)%or),t.e=Wg(-e/or)||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=qf(10,or-r),f[d]=i>0?(c/qf(10,a-i)%qf(10,i)|0)*s:0),l)for(;;)if(d==0){(f[0]+=s)==vi&&(f[0]=1,++t.e);break}else{if(f[d]+=s,f[d]!=vi)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(dr&&(t.e>Pw||t.e<-Pw))throw Error(ZC+Vr(t));return t}function $4(t,e){var n,r,i,s,a,o,l,c,d,f,p=t.constructor,y=p.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new p(t),dr?Zn(e,y):e;if(l=t.d,f=e.d,r=e.e,c=t.e,l=l.slice(),a=c-r,a){for(d=a<0,d?(n=l,a=-a,o=f.length):(n=f,r=c,o=l.length),i=Math.max(Math.ceil(y/or),o)+2,a>i&&(a=i,n.length=1),n.reverse(),i=a;i--;)n.push(0);n.reverse()}else{for(i=l.length,o=f.length,d=i0;--i)l[o++]=0;for(i=f.length;i>a;){if(l[--i]0?s=s.charAt(0)+"."+s.slice(1)+ad(r):a>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-a)>0&&(s+=ad(r))):i>=a?(s+=ad(i+1-a),n&&(r=n-i-1)>0&&(s=s+"."+ad(r))):((r=i+1)0&&(i+1===a&&(s+="."),s+=ad(r))),t.s<0?"-"+s:s}function xO(t,e){if(t.length>e)return t.length=e,!0}function X4(t){var e,n,r;function i(s){var a=this;if(!(a instanceof i))return new i(s);if(a.constructor=i,s instanceof i){a.s=s.s,a.e=s.e,a.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(Mh+s);if(s>0)a.s=1;else if(s<0)s=-s,a.s=-1;else{a.s=0,a.e=0,a.d=[0];return}if(s===~~s&&s<1e7){a.e=0,a.d=[s];return}return yO(a,s.toString())}else if(typeof s!="string")throw Error(Mh+s);if(s.charCodeAt(0)===45?(s=s.slice(1),a.s=-1):a.s=1,EJ.test(s))yO(a,s);else throw Error(Mh+s)}if(i.prototype=Tt,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=X4,i.config=i.set=AJ,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(Mh+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Mh+n+": "+r);return this}var QC=X4(MJ);va=new QC(1);const Tn=QC;function q4(t){var e;return t===0?e=1:e=Math.floor(new Tn(t).abs().log(10).toNumber())+1,e}function K4(t,e,n){for(var r=new Tn(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 RJ(t)||CJ(t,e)||PJ(t,e)||TJ()}function TJ(){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 PJ(t,e){if(t){if(typeof t=="string")return bO(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)?bO(t,e):void 0}}function bO(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]},JC=(t,e,n)=>{if(t.lte(0))return new Tn(0);var r=q4(t.toNumber()),i=new Tn(10).pow(r),s=t.div(i),a=r!==1?.05:.1,o=new Tn(Math.ceil(s.div(a).toNumber())).add(n).mul(a),l=o.mul(i);return e?new Tn(l.toNumber()):new Tn(Math.ceil(l.toNumber()))},Z4=(t,e,n)=>{var r;if(t.lte(0))return new Tn(0);var i=[1,2,2.5,5],s=t.toNumber(),a=Math.floor(new Tn(s).abs().log(10).toNumber()),o=new Tn(10).pow(a),l=t.div(o).toNumber(),c=i.findIndex(y=>y>=l-1e-10);if(c===-1&&(o=o.mul(10),c=0),c+=n,c>=i.length){var d=Math.floor(c/i.length);c%=i.length,o=o.mul(new Tn(10).pow(d))}var f=(r=i[c])!==null&&r!==void 0?r:1,p=new Tn(f).mul(o);return e?p:new Tn(Math.ceil(p.toNumber()))},NJ=(t,e,n)=>{var r=new Tn(1),i=new Tn(t);if(!i.isint()&&n){var s=Math.abs(t);s<1?(r=new Tn(10).pow(q4(t)-1),i=new Tn(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Tn(Math.floor(t)))}else t===0?i=new Tn(Math.floor((e-1)/2)):n||(i=new Tn(Math.floor(t)));for(var a=Math.floor((e-1)/2),o=[],l=0;l4&&arguments[4]!==void 0?arguments[4]:0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:JC;if(!Number.isFinite((n-e)/(r-1)))return{step:new Tn(0),tickMin:new Tn(0),tickMax:new Tn(0)};var o=a(new Tn(n).sub(e).div(r-1),i,s),l;e<=0&&n>=0?l=new Tn(0):(l=new Tn(e).add(n).div(2),l=l.sub(new Tn(l).mod(o)));var c=Math.ceil(l.sub(e).div(o).toNumber()),d=Math.ceil(new Tn(n).sub(l).div(o).toNumber()),f=c+d+1;return f>r?Q4(e,n,r,i,s+1,a):(f0?d+(r-f):d,c=n>0?c:c+(r-f)),{step:o,tickMin:l.sub(new Tn(c).mul(o)),tickMax:l.add(new Tn(d).mul(o))})},_O=function(e){var n=yy(e,2),r=n[0],i=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),c=Y4([r,i]),d=yy(c,2),f=d[0],p=d[1];if(f===-1/0||p===1/0){var y=p===1/0?[f,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),p];return r>i?y.reverse():y}if(f===p)return NJ(f,s,a);var b=o==="snap125"?Z4:JC,S=Q4(f,p,l,a,0,b),w=S.step,x=S.tickMin,M=S.tickMax,T=K4(x,M.add(new Tn(.1).mul(w)),w);return r>i?T.reverse():T},wO=function(e,n){var r=yy(e,2),i=r[0],s=r[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Y4([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 p=o==="snap125"?Z4:JC,y=Math.max(n,2),b=p(new Tn(f).sub(d).div(y-1),a,0),S=[...K4(new Tn(d),new Tn(f),b),f];return a===!1&&(S=S.map(w=>Math.round(w))),i>s?S.reverse():S},IJ=t=>t.rootProps.barCategoryGap,wS=t=>t.rootProps.stackOffset,J4=t=>t.rootProps.reverseStackOrder,e2=t=>t.options.chartName,t2=t=>t.rootProps.syncId,ez=t=>t.rootProps.syncMethod,n2=t=>t.options.eventEmitter,kJ=t=>t.rootProps.baseValue,Ms={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Mf={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"},SS=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function MS(t,e,n){if(n!=="auto")return n;if(t!=null)return jl(t,e)?"category":"number"}function SO(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 Cw(t){for(var e=1;e{if(e!=null)return t.polarAxis.angleAxis[e]},r2=ke([UJ,M4],(t,e)=>{var n;if(t!=null)return t;var r=(n=MS(e,"angleAxis",MO.type))!==null&&n!==void 0?n:"category";return Cw(Cw({},MO),{},{type:r})}),jJ=(t,e)=>t.polarAxis.radiusAxis[e],i2=ke([jJ,M4],(t,e)=>{var n;if(t!=null)return t;var r=(n=MS(e,"radiusAxis",EO.type))!==null&&n!==void 0?n:"category";return Cw(Cw({},EO),{},{type:r})}),ES=t=>t.polarOptions,s2=ke([Jc,eu,Wi],iJ),tz=ke([ES,s2],(t,e)=>{if(t!=null)return Td(t.innerRadius,e,0)}),nz=ke([ES,s2],(t,e)=>{if(t!=null)return Td(t.outerRadius,e,e*.8)}),FJ=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},rz=ke([ES],FJ);ke([r2,rz],SS);var iz=ke([s2,tz,nz],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});ke([i2,iz],SS);var sz=ke([hr,ES,tz,nz,Jc,eu],(t,e,n,r,i,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var a=e.cx,o=e.cy,l=e.startAngle,c=e.endAngle;return{cx:Td(a,i,i/2),cy:Td(o,s,s/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),_i=(t,e)=>e,AS=(t,e,n)=>n;function a2(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,a=n.dataKey,o=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=a2(l);d.forEach((p,y)=>{var b=a==null||s?y:String(yi(p,a,null)),S=yi(p,l.dataKey,0),w;o.has(b)?w=o.get(b):w={},Object.assign(w,{[f]:S}),o.set(b,w)})}}),Array.from(o.values())}function o2(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var TS=(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 zJ(t,e){if(t.length===e.length){for(var n=0;n{var e=hr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},$g=t=>t.tooltip.settings.axisId;function l2(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 a(){return s.apply(this,arguments)}return a.toString=function(){return s.toString()},a})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var a=i[0],o=i[1];return a<=o?s>=a&&s<=o:s>=o&&s<=a},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,a)=>{var o=t(s);if(o!=null){if(t.bandwidth&&a!==null&&a!==void 0&&a.position){var l=t.bandwidth();switch(a.position){case"middle":o+=l/2;break;case"end":o+=l;break}}return o}}}}}var BJ=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!El(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 _d(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function HJ(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function c2(t){let e,n,r;t.length!==2?(e=_d,n=(o,l)=>_d(t(o),l),r=(o,l)=>t(o)-l):(e=t===_d||t===HJ?t:VJ,n=t,r=t);function i(o,l,c=0,d=o.length){if(c>>1;n(o[f],l)<0?c=f+1:d=f}while(c>>1;n(o[f],l)<=0?c=f+1:d=f}while(cc&&r(o[f-1],l)>-r(o[f],l)?f-1:f}return{left:i,center:a,right:s}}function VJ(){return 0}function oz(t){return t===null?NaN:+t}function*GJ(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const WJ=c2(_d),ex=WJ.right;c2(oz).center;class AO extends Map{constructor(e,n=qJ){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(TO(this,e))}has(e){return super.has(TO(this,e))}set(e,n){return super.set($J(this,e),n)}delete(e){return super.delete(XJ(this,e))}}function TO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function $J({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function XJ({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function qJ(t){return t!==null&&typeof t=="object"?t.valueOf():t}function KJ(t=_d){if(t===_d)return lz;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 lz(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const YJ=Math.sqrt(50),ZJ=Math.sqrt(10),QJ=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),a=s>=YJ?10:s>=ZJ?5:s>=QJ?2:1;let o,l,c;return i<0?(c=Math.pow(10,-i)/a,o=Math.round(t*c),l=Math.round(e*c),o/ce&&--l,c=-c):(c=Math.pow(10,i)*a,o=Math.round(t/c),l=Math.round(e/c),o*ce&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const o=s-i+1,l=new Array(o);if(r)if(a<0)for(let c=0;c=r)&&(n=r);return n}function CO(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function cz(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?lz:KJ(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),p=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),y=Math.max(n,Math.floor(e-c*f/l+p)),b=Math.min(r,Math.floor(e+(l-c)*f/l+p));cz(t,e,y,b,i)}const s=t[e];let a=n,o=r;for(l0(t,n,e),i(t[r],s)>0&&l0(t,n,r);a0;)--o}i(t[n],s)===0?l0(t,n,o):(++o,l0(t,o,r)),o<=e&&(n=o+1),e<=o&&(r=o-1)}return t}function l0(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function JJ(t,e,n){if(t=Float64Array.from(GJ(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return CO(t);if(e>=1)return PO(t);var r,i=(r-1)*e,s=Math.floor(i),a=PO(cz(t,s).subarray(0,s+1)),o=CO(t.subarray(s+1));return a+(o-a)*(i-s)}}function eee(t,e,n=oz){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),a=+n(t[s],s,t),o=+n(t[s+1],s+1,t);return a+(o-a)*(i-s)}}function tee(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?Nb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Nb(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=iee.exec(t))?new Zs(e[1],e[2],e[3],1):(e=see.exec(t))?new Zs(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=aee.exec(t))?Nb(e[1],e[2],e[3],e[4]):(e=oee.exec(t))?Nb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=lee.exec(t))?DO(e[1],e[2]/100,e[3]/100,1):(e=cee.exec(t))?DO(e[1],e[2]/100,e[3]/100,e[4]):RO.hasOwnProperty(t)?kO(RO[t]):t==="transparent"?new Zs(NaN,NaN,NaN,0):null}function kO(t){return new Zs(t>>16&255,t>>8&255,t&255,1)}function Nb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Zs(t,e,n,r)}function fee(t){return t instanceof tx||(t=_y(t)),t?(t=t.rgb(),new Zs(t.r,t.g,t.b,t.opacity)):new Zs}function EP(t,e,n,r){return arguments.length===1?fee(t):new Zs(t,e,n,r??1)}function Zs(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}f2(Zs,EP,dz(tx,{brighter(t){return t=t==null?Nw:Math.pow(Nw,t),new Zs(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?xy:Math.pow(xy,t),new Zs(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zs(Eh(this.r),Eh(this.g),Eh(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:OO,formatHex:OO,formatHex8:hee,formatRgb:LO,toString:LO}));function OO(){return`#${ih(this.r)}${ih(this.g)}${ih(this.b)}`}function hee(){return`#${ih(this.r)}${ih(this.g)}${ih(this.b)}${ih((isNaN(this.opacity)?1:this.opacity)*255)}`}function LO(){const t=Iw(this.opacity);return`${t===1?"rgb(":"rgba("}${Eh(this.r)}, ${Eh(this.g)}, ${Eh(this.b)}${t===1?")":`, ${t})`}`}function Iw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Eh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ih(t){return t=Eh(t),(t<16?"0":"")+t.toString(16)}function DO(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Fo(t,e,n,r)}function fz(t){if(t instanceof Fo)return new Fo(t.h,t.s,t.l,t.opacity);if(t instanceof tx||(t=_y(t)),!t)return new Fo;if(t instanceof Fo)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),a=NaN,o=s-i,l=(s+i)/2;return o?(e===s?a=(n-r)/o+(n0&&l<1?0:a,new Fo(a,o,l,t.opacity)}function pee(t,e,n,r){return arguments.length===1?fz(t):new Fo(t,e,n,r??1)}function Fo(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}f2(Fo,pee,dz(tx,{brighter(t){return t=t==null?Nw:Math.pow(Nw,t),new Fo(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?xy:Math.pow(xy,t),new Fo(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 Zs(NE(t>=240?t-240:t+120,i,r),NE(t,i,r),NE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Fo(UO(this.h),Ib(this.s),Ib(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("}${UO(this.h)}, ${Ib(this.s)*100}%, ${Ib(this.l)*100}%${t===1?")":`, ${t})`}`}}));function UO(t){return t=(t||0)%360,t<0?t+360:t}function Ib(t){return Math.max(0,Math.min(1,t||0))}function NE(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 h2=t=>()=>t;function mee(t,e){return function(n){return t+n*e}}function gee(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 vee(t){return(t=+t)==1?hz:function(e,n){return n-e?gee(e,n,t):h2(isNaN(e)?n:e)}}function hz(t,e){var n=e-t;return n?mee(t,n):h2(isNaN(t)?e:t)}const jO=(function t(e){var n=vee(e);function r(i,s){var a=n((i=EP(i)).r,(s=EP(s)).r),o=n(i.g,s.g),l=n(i.b,s.b),c=hz(i.opacity,s.opacity);return function(d){return i.r=a(d),i.g=o(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=t,r})(1);function yee(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),o[a]?o[a]+=s:o[++a]=s),(r=r[0])===(i=i[0])?o[a]?o[a]+=i:o[++a]=i:(o[++a]=null,l.push({i:a,x:kw(r,i)})),n=IE.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function Cee(t,e,n){var r=t[0],i=t[1],s=e[0],a=e[1];return i2?Ree:Cee,l=c=null,f}function f(p){return p==null||isNaN(p=+p)?s:(l||(l=o(t.map(r),e,n)))(r(a(p)))}return f.invert=function(p){return a(i((c||(c=o(e,t.map(r),kw)))(p)))},f.domain=function(p){return arguments.length?(t=Array.from(p,Ow),d()):t.slice()},f.range=function(p){return arguments.length?(e=Array.from(p),d()):e.slice()},f.rangeRound=function(p){return e=Array.from(p),n=p2,d()},f.clamp=function(p){return arguments.length?(a=p?!0:Es,d()):a!==Es},f.interpolate=function(p){return arguments.length?(n=p,d()):n},f.unknown=function(p){return arguments.length?(s=p,f):s},function(p,y){return r=p,i=y,d()}}function m2(){return CS()(Es,Es)}function Nee(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 Eg(t){return t=Lw(Math.abs(t)),t?t[1]:NaN}function Iee(t,e){return function(n,r){for(var i=n.length,s=[],a=0,o=t[0],l=0;i>0&&o>0&&(l+o+1>r&&(o=Math.max(1,r-l)),s.push(n.substring(i-=o,i+o)),!((l+=o+1)>r));)o=t[a=(a+1)%t.length];return s.reverse().join(e)}}function kee(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Oee=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wy(t){if(!(e=Oee.exec(t)))throw new Error("invalid format: "+t);var e;return new g2({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=g2.prototype;function g2(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+""}g2.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 Lee(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 Dee(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,a=r.length;return s===a?r:s>a?r+new Array(s-a+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 zO(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 BO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Nee,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)=>zO(t*100,e),r:zO,s:Dee,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function HO(t){return t}var VO=Array.prototype.map,GO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Uee(t){var e=t.grouping===void 0||t.thousands===void 0?HO:Iee(VO.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?HO:kee(VO.call(t.numerals,String)),a=t.percent===void 0?"%":t.percent+"",o=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f,p){f=wy(f);var y=f.fill,b=f.align,S=f.sign,w=f.symbol,x=f.zero,M=f.width,T=f.comma,P=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):BO[N]||(P===void 0&&(P=12),O=!0,N="g"),(x||y==="0"&&b==="=")&&(x=!0,y="0",b="=");var D=(p&&p.prefix!==void 0?p.prefix:"")+(w==="$"?n:w==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),z=(w==="$"?r:/[%p]/.test(N)?a:"")+(p&&p.suffix!==void 0?p.suffix:""),V=BO[N],k=/[defgprs%]/.test(N);P=P===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function j(X){var ee=D,ie=z,pe,ae,he;if(N==="c")ie=V(X)+ie,X="";else{X=+X;var B=X<0||1/X<0;if(X=isNaN(X)?l:V(Math.abs(X),P),O&&(X=Lee(X)),B&&+X==0&&S!=="+"&&(B=!1),ee=(B?S==="("?S:o:S==="-"||S==="("?"":S)+ee,ie=(N==="s"&&!isNaN(X)&&Dw!==void 0?GO[8+Dw/3]:"")+ie+(B&&S==="("?")":""),k){for(pe=-1,ae=X.length;++pehe||he>57){ie=(he===46?i+X.slice(pe+1):X.slice(pe))+ie,X=X.slice(0,pe);break}}}T&&!x&&(X=e(X,1/0));var J=ee.length+X.length+ie.length,Y=J>1)+ee+X+ie+Y.slice(J);break;default:X=Y+ee+X+ie;break}return s(X)}return j.toString=function(){return f+""},j}function d(f,p){var y=Math.max(-8,Math.min(8,Math.floor(Eg(p)/3)))*3,b=Math.pow(10,-y),S=c((f=wy(f),f.type="f",f),{suffix:GO[8+y/3]});return function(w){return S(b*w)}}return{format:c,formatPrefix:d}}var kb,v2,pz;jee({thousands:",",grouping:[3],currency:["$",""]});function jee(t){return kb=Uee(t),v2=kb.format,pz=kb.formatPrefix,kb}function Fee(t){return Math.max(0,-Eg(Math.abs(t)))}function zee(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Eg(e)/3)))*3-Eg(Math.abs(t)))}function Bee(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Eg(e)-Eg(t))+1}function mz(t,e,n,r){var i=SP(t,e,n),s;switch(r=wy(r??",f"),r.type){case"s":{var a=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=zee(i,a))&&(r.precision=s),pz(r,a)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=Bee(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=Fee(i))&&(r.precision=s-(r.type==="%")*2);break}}return v2(r)}function Id(t){var e=t.domain;return t.ticks=function(n){var r=e();return _P(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return mz(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,a=r[i],o=r[s],l,c,d=10;for(o0;){if(c=wP(a,o,n),c===l)return r[i]=a,r[s]=o,e(r);if(c>0)a=Math.floor(a/c)*c,o=Math.ceil(o/c)*c;else if(c<0)a=Math.ceil(a*c)/c,o=Math.floor(o*c)/c;else break;l=c}return t},t}function gz(){var t=m2();return t.copy=function(){return nx(t,gz())},Qa.apply(t,arguments),Id(t)}function vz(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 vz(t).unknown(e)},t=arguments.length?Array.from(t,Ow):[0,1],Id(n)}function yz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],a;return sMath.pow(t,e)}function $ee(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 XO(t){return(e,n)=>-t(-e,n)}function y2(t){const e=t(WO,$O),n=e.domain;let r=10,i,s;function a(){return i=$ee(r),s=Wee(r),n()[0]<0?(i=XO(i),s=XO(s),t(Hee,Vee)):t(WO,$O),e}return e.base=function(o){return arguments.length?(r=+o,a()):r},e.domain=function(o){return arguments.length?(n(o),a()):n()},e.ticks=o=>{const l=n();let c=l[0],d=l[l.length-1];const f=d0){for(;p<=y;++p)for(b=1;bd)break;x.push(S)}}else for(;p<=y;++p)for(b=r-1;b>=1;--b)if(S=p>0?b/s(-p):b*s(p),!(Sd)break;x.push(S)}x.length*2{if(o==null&&(o=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=wy(l)).precision==null&&(l.trim=!0),l=v2(l)),o===1/0)return l;const c=Math.max(1,r*o/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(yz(n(),{floor:o=>s(Math.floor(i(o))),ceil:o=>s(Math.ceil(i(o)))})),e}function xz(){const t=y2(CS()).domain([1,10]);return t.copy=()=>nx(t,xz()).base(t.base()),Qa.apply(t,arguments),t}function qO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function KO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function x2(t){var e=1,n=t(qO(e),KO(e));return n.constant=function(r){return arguments.length?t(qO(e=+r),KO(e)):e},Id(n)}function bz(){var t=x2(CS());return t.copy=function(){return nx(t,bz()).constant(t.constant())},Qa.apply(t,arguments)}function YO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Xee(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function qee(t){return t<0?-t*t:t*t}function b2(t){var e=t(Es,Es),n=1;function r(){return n===1?t(Es,Es):n===.5?t(Xee,qee):t(YO(n),YO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Id(e)}function _2(){var t=b2(CS());return t.copy=function(){return nx(t,_2()).exponent(t.exponent())},Qa.apply(t,arguments),t}function Kee(){return _2.apply(null,arguments).exponent(.5)}function ZO(t){return Math.sign(t)*t*t}function Yee(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function _z(){var t=m2(),e=[0,1],n=!1,r;function i(s){var a=Yee(t(s));return isNaN(a)?r:n?Math.round(a):a}return i.invert=function(s){return t.invert(ZO(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(ZO)),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 _z(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Qa.apply(i,arguments),Id(i)}function wz(){var t=[],e=[],n=[],r;function i(){var a=0,o=Math.max(1,e.length);for(n=new Array(o-1);++a0?n[o-1]:t[0],o=n?[r[n-1],e]:[r[c-1],r[c]]},a.unknown=function(l){return arguments.length&&(s=l),a},a.thresholds=function(){return r.slice()},a.copy=function(){return Sz().domain([t,e]).range(i).unknown(s)},Qa.apply(Id(a),arguments)}function Mz(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[ex(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 a=e.indexOf(s);return[t[a-1],t[a]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return Mz().domain(t).range(e).unknown(n)},Qa.apply(i,arguments)}const kE=new Date,OE=new Date;function ai(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 a=i(s),o=i.ceil(s);return s-a(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,o)=>{const l=[];if(s=i.ceil(s),o=o==null?1:Math.floor(o),!(s0))return l;let c;do l.push(c=new Date(+s)),e(s,o),t(s);while(cai(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,o)=>{if(a>=a)if(o<0)for(;++o<=0;)for(;e(a,-1),!s(a););else for(;--o>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(kE.setTime(+s),OE.setTime(+a),t(kE),t(OE),Math.floor(n(kE,OE))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const Uw=ai(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Uw.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?ai(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Uw);Uw.range;const Uc=1e3,Wa=Uc*60,jc=Wa*60,qc=jc*24,w2=qc*7,QO=qc*30,LE=qc*365,sh=ai(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Uc)},(t,e)=>(e-t)/Uc,t=>t.getUTCSeconds());sh.range;const S2=ai(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uc)},(t,e)=>{t.setTime(+t+e*Wa)},(t,e)=>(e-t)/Wa,t=>t.getMinutes());S2.range;const M2=ai(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Wa)},(t,e)=>(e-t)/Wa,t=>t.getUTCMinutes());M2.range;const E2=ai(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Uc-t.getMinutes()*Wa)},(t,e)=>{t.setTime(+t+e*jc)},(t,e)=>(e-t)/jc,t=>t.getHours());E2.range;const A2=ai(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*jc)},(t,e)=>(e-t)/jc,t=>t.getUTCHours());A2.range;const rx=ai(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Wa)/qc,t=>t.getDate()-1);rx.range;const RS=ai(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/qc,t=>t.getUTCDate()-1);RS.range;const Ez=ai(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/qc,t=>Math.floor(t/qc));Ez.range;function Zh(t){return ai(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())*Wa)/w2)}const NS=Zh(0),jw=Zh(1),Zee=Zh(2),Qee=Zh(3),Ag=Zh(4),Jee=Zh(5),ete=Zh(6);NS.range;jw.range;Zee.range;Qee.range;Ag.range;Jee.range;ete.range;function Qh(t){return ai(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)/w2)}const IS=Qh(0),Fw=Qh(1),tte=Qh(2),nte=Qh(3),Tg=Qh(4),rte=Qh(5),ite=Qh(6);IS.range;Fw.range;tte.range;nte.range;Tg.range;rte.range;ite.range;const T2=ai(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());T2.range;const P2=ai(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());P2.range;const Kc=ai(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());Kc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ai(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)});Kc.range;const Yc=ai(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());Yc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:ai(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)});Yc.range;function Az(t,e,n,r,i,s){const a=[[sh,1,Uc],[sh,5,5*Uc],[sh,15,15*Uc],[sh,30,30*Uc],[s,1,Wa],[s,5,5*Wa],[s,15,15*Wa],[s,30,30*Wa],[i,1,jc],[i,3,3*jc],[i,6,6*jc],[i,12,12*jc],[r,1,qc],[r,2,2*qc],[n,1,w2],[e,1,QO],[e,3,3*QO],[t,1,LE]];function o(c,d,f){const p=dw).right(a,p);if(y===a.length)return t.every(SP(c/LE,d/LE,f));if(y===0)return Uw.every(Math.max(SP(c,d,f),1));const[b,S]=a[p/a[y-1][2]53)return null;"w"in de||(de.w=1),"Z"in de?(Ve=UE(c0(de.y,0,1)),Le=Ve.getUTCDay(),Ve=Le>4||Le===0?Fw.ceil(Ve):Fw(Ve),Ve=RS.offset(Ve,(de.V-1)*7),de.y=Ve.getUTCFullYear(),de.m=Ve.getUTCMonth(),de.d=Ve.getUTCDate()+(de.w+6)%7):(Ve=DE(c0(de.y,0,1)),Le=Ve.getDay(),Ve=Le>4||Le===0?jw.ceil(Ve):jw(Ve),Ve=rx.offset(Ve,(de.V-1)*7),de.y=Ve.getFullYear(),de.m=Ve.getMonth(),de.d=Ve.getDate()+(de.w+6)%7)}else("W"in de||"U"in de)&&("w"in de||(de.w="u"in de?de.u%7:"W"in de?1:0),Le="Z"in de?UE(c0(de.y,0,1)).getUTCDay():DE(c0(de.y,0,1)).getDay(),de.m=0,de.d="W"in de?(de.w+6)%7+de.W*7-(Le+5)%7:de.w+de.U*7-(Le+6)%7);return"Z"in de?(de.H+=de.Z/100|0,de.M+=de.Z%100,UE(de)):DE(de)}}function z(Ee,Ge,$e,de){for(var Z=0,Ve=Ge.length,Le=$e.length,ne,Ce;Z=Le)return-1;if(ne=Ge.charCodeAt(Z++),ne===37){if(ne=Ge.charAt(Z++),Ce=O[ne in JO?Ge.charAt(Z++):ne],!Ce||(de=Ce(Ee,$e,de))<0)return-1}else if(ne!=$e.charCodeAt(de++))return-1}return de}function V(Ee,Ge,$e){var de=c.exec(Ge.slice($e));return de?(Ee.p=d.get(de[0].toLowerCase()),$e+de[0].length):-1}function k(Ee,Ge,$e){var de=y.exec(Ge.slice($e));return de?(Ee.w=b.get(de[0].toLowerCase()),$e+de[0].length):-1}function j(Ee,Ge,$e){var de=f.exec(Ge.slice($e));return de?(Ee.w=p.get(de[0].toLowerCase()),$e+de[0].length):-1}function X(Ee,Ge,$e){var de=x.exec(Ge.slice($e));return de?(Ee.m=M.get(de[0].toLowerCase()),$e+de[0].length):-1}function ee(Ee,Ge,$e){var de=S.exec(Ge.slice($e));return de?(Ee.m=w.get(de[0].toLowerCase()),$e+de[0].length):-1}function ie(Ee,Ge,$e){return z(Ee,e,Ge,$e)}function pe(Ee,Ge,$e){return z(Ee,n,Ge,$e)}function ae(Ee,Ge,$e){return z(Ee,r,Ge,$e)}function he(Ee){return a[Ee.getDay()]}function B(Ee){return s[Ee.getDay()]}function J(Ee){return l[Ee.getMonth()]}function Y(Ee){return o[Ee.getMonth()]}function H(Ee){return i[+(Ee.getHours()>=12)]}function G(Ee){return 1+~~(Ee.getMonth()/3)}function le(Ee){return a[Ee.getUTCDay()]}function se(Ee){return s[Ee.getUTCDay()]}function ce(Ee){return l[Ee.getUTCMonth()]}function Se(Ee){return o[Ee.getUTCMonth()]}function we(Ee){return i[+(Ee.getUTCHours()>=12)]}function We(Ee){return 1+~~(Ee.getUTCMonth()/3)}return{format:function(Ee){var Ge=N(Ee+="",T);return Ge.toString=function(){return Ee},Ge},parse:function(Ee){var Ge=D(Ee+="",!1);return Ge.toString=function(){return Ee},Ge},utcFormat:function(Ee){var Ge=N(Ee+="",P);return Ge.toString=function(){return Ee},Ge},utcParse:function(Ee){var Ge=D(Ee+="",!0);return Ge.toString=function(){return Ee},Ge}}}var JO={"-":"",_:" ",0:"0"},Si=/^\s*\d+/,ute=/^%/,dte=/[\\^$*+?|[\]().{}]/g;function Un(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function hte(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function pte(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function mte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function gte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function vte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function eL(t,e,n){var r=Si.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function tL(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function yte(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 xte(t,e,n){var r=Si.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function bte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function nL(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function _te(t,e,n){var r=Si.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function rL(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function wte(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Ste(t,e,n){var r=Si.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Mte(t,e,n){var r=Si.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ete(t,e,n){var r=Si.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Ate(t,e,n){var r=ute.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Tte(t,e,n){var r=Si.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Pte(t,e,n){var r=Si.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function iL(t,e){return Un(t.getDate(),e,2)}function Cte(t,e){return Un(t.getHours(),e,2)}function Rte(t,e){return Un(t.getHours()%12||12,e,2)}function Nte(t,e){return Un(1+rx.count(Kc(t),t),e,3)}function Tz(t,e){return Un(t.getMilliseconds(),e,3)}function Ite(t,e){return Tz(t,e)+"000"}function kte(t,e){return Un(t.getMonth()+1,e,2)}function Ote(t,e){return Un(t.getMinutes(),e,2)}function Lte(t,e){return Un(t.getSeconds(),e,2)}function Dte(t){var e=t.getDay();return e===0?7:e}function Ute(t,e){return Un(NS.count(Kc(t)-1,t),e,2)}function Pz(t){var e=t.getDay();return e>=4||e===0?Ag(t):Ag.ceil(t)}function jte(t,e){return t=Pz(t),Un(Ag.count(Kc(t),t)+(Kc(t).getDay()===4),e,2)}function Fte(t){return t.getDay()}function zte(t,e){return Un(jw.count(Kc(t)-1,t),e,2)}function Bte(t,e){return Un(t.getFullYear()%100,e,2)}function Hte(t,e){return t=Pz(t),Un(t.getFullYear()%100,e,2)}function Vte(t,e){return Un(t.getFullYear()%1e4,e,4)}function Gte(t,e){var n=t.getDay();return t=n>=4||n===0?Ag(t):Ag.ceil(t),Un(t.getFullYear()%1e4,e,4)}function Wte(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Un(e/60|0,"0",2)+Un(e%60,"0",2)}function sL(t,e){return Un(t.getUTCDate(),e,2)}function $te(t,e){return Un(t.getUTCHours(),e,2)}function Xte(t,e){return Un(t.getUTCHours()%12||12,e,2)}function qte(t,e){return Un(1+RS.count(Yc(t),t),e,3)}function Cz(t,e){return Un(t.getUTCMilliseconds(),e,3)}function Kte(t,e){return Cz(t,e)+"000"}function Yte(t,e){return Un(t.getUTCMonth()+1,e,2)}function Zte(t,e){return Un(t.getUTCMinutes(),e,2)}function Qte(t,e){return Un(t.getUTCSeconds(),e,2)}function Jte(t){var e=t.getUTCDay();return e===0?7:e}function ene(t,e){return Un(IS.count(Yc(t)-1,t),e,2)}function Rz(t){var e=t.getUTCDay();return e>=4||e===0?Tg(t):Tg.ceil(t)}function tne(t,e){return t=Rz(t),Un(Tg.count(Yc(t),t)+(Yc(t).getUTCDay()===4),e,2)}function nne(t){return t.getUTCDay()}function rne(t,e){return Un(Fw.count(Yc(t)-1,t),e,2)}function ine(t,e){return Un(t.getUTCFullYear()%100,e,2)}function sne(t,e){return t=Rz(t),Un(t.getUTCFullYear()%100,e,2)}function ane(t,e){return Un(t.getUTCFullYear()%1e4,e,4)}function one(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Tg(t):Tg.ceil(t),Un(t.getUTCFullYear()%1e4,e,4)}function lne(){return"+0000"}function aL(){return"%"}function oL(t){return+t}function lL(t){return Math.floor(+t/1e3)}var lm,Nz,Iz;cne({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 cne(t){return lm=cte(t),Nz=lm.format,lm.parse,Iz=lm.utcFormat,lm.utcParse,lm}function une(t){return new Date(t)}function dne(t){return t instanceof Date?+t:+new Date(+t)}function C2(t,e,n,r,i,s,a,o,l,c){var d=m2(),f=d.invert,p=d.domain,y=c(".%L"),b=c(":%S"),S=c("%I:%M"),w=c("%I %p"),x=c("%a %d"),M=c("%b %d"),T=c("%B"),P=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)=>JJ(t,s/r))},n.copy=function(){return Dz(e).domain(t)},tu.apply(n,arguments)}function OS(){var t=0,e=.5,n=1,r=1,i,s,a,o,l,c=Es,d,f=!1,p;function y(S){return isNaN(S=+S)?p:(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 yne(r)?r:"point"}};function xne(t,e){for(var n=0,r=t.length,i=t[0]e)?n=s+1:r=s}return n}function Hz(t,e){if(t){var n=e??t.domain(),r=n.map(s=>{var a;return(a=t(s))!==null&&a!==void 0?a:0}),i=t.range();if(!(n.length===0||i.length<2))return s=>{var a,o,l=xne(r,s);if(l<=0)return n[0];if(l>=n.length)return n[n.length-1];var c=(a=r[l-1])!==null&&a!==void 0?a:0,d=(o=r[l])!==null&&o!==void 0?o:0;return Math.abs(s-c)<=Math.abs(s-d)?n[l-1]:n[l]}}}function bne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Hz(t,void 0)}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 zw(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);nt.cartesianAxis.xAxis[e],nu=(t,e)=>{var n=Gz(t,e);return n??ti},ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:PP,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:Ky},Wz=(t,e)=>t.cartesianAxis.yAxis[e],ru=(t,e)=>{var n=Wz(t,e);return n??ni},Pne={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:""},k2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Pne},Cs=(t,e,n)=>{switch(e){case"xAxis":return nu(t,n);case"yAxis":return ru(t,n);case"zAxis":return k2(t,n);case"angleAxis":return r2(t,n);case"radiusAxis":return i2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Cne=(t,e,n)=>{switch(e){case"xAxis":return nu(t,n);case"yAxis":return ru(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},ix=(t,e,n)=>{switch(e){case"xAxis":return nu(t,n);case"yAxis":return ru(t,n);case"angleAxis":return r2(t,n);case"radiusAxis":return i2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},$z=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function Xz(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 qz=t=>t.graphicalItems.cartesianItems,Rne=ke([_i,AS],Xz),Kz=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),qg=ke([qz,Cs,Rne],Kz,{memoizeOptions:{resultEqualityCheck:PS}}),Yz=ke([qg],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(o2)),Zz=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),Nne=ke([qg],Zz),Qz=t=>t.map(e=>e.data).filter(Boolean).flat(1),Ine=ke([qg],t=>t.some(e=>!e.data)),Jz=ke([qg],Qz,{memoizeOptions:{resultEqualityCheck:PS}}),eB=(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)},O2=ke([Jz,_S],eB),kne=(t,e,n)=>(e==null?void 0:e.dataKey)!=null?t.map(r=>({value:yi(r,e.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>t.map(i=>({value:yi(i,r)}))):t.map(r=>({value:r})),tB=(t,e,n,r,i,s)=>{var a=r.chartData,o=a===void 0?[]:a,l=r.dataStartIndex,c=r.dataEndIndex,d=kne(t,e,n);if(i&&(e==null?void 0:e.dataKey)!=null&&s.length>0){var f=o.slice(l,c+1),p=f.map(y=>({value:yi(y,e.dataKey)})).filter(y=>y.value!=null);return[...p,...d]}return d},sx=ke([O2,Cs,qg,_S,Ine,Jz],tB);function eg(t){if(Nl(t)||t instanceof Date){var e=Number(t);if(wn(e))return e}}function fL(t){if(Array.isArray(t)){var e=[eg(t[0]),eg(t[1])];return El(e)?e:void 0}var n=eg(t);if(n!=null)return[n,n]}function Ol(t){return t.map(eg).filter(Ys)}function One(t,e){var n=eg(t),r=eg(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var Lne=ke([sx],t=>t==null?void 0:t.map(e=>e.value).sort(One));function nB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function Dne(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!Rl(e))r=e;else if(Array.isArray(e)){var i=Ol(e);i.length>0&&(r=Math.max(...i))}return r==null?[]:Ol(n.flatMap(s=>{var a=yi(t,s.dataKey),o,l;if(Array.isArray(a)){var c=Vz(a,2);o=c[0],l=c[1]}else o=l=a;if(!(!wn(o)||!wn(l)))return[r-o,r+l]}))}var oi=t=>{var e=wi(t),n=$g(t);return ix(t,e,n)},Pg=ke([oi],t=>t==null?void 0:t.dataKey),Une=ke([Yz,_S,oi],az),rB=(t,e,n,r)=>{var i={},s=e.reduce((a,o)=>{if(o.stackId==null)return a;var l=a[o.stackId];return l==null&&(l=[]),l.push(o),a[o.stackId]=l,a},i);return Object.fromEntries(Object.entries(s).map(a=>{var o=Vz(a,2),l=o[0],c=o[1],d=r?[...c].reverse():c,f=d.map(a2);return[l,{stackedData:tY(t,f,n),graphicalItems:d}]}))},iB=ke([Une,Yz,wS,J4],rB),sB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return sY(t,i,s)},jne=ke([Cs],t=>t.allowDataOverflow),L2=t=>{var e;if(t==null||!("domain"in t))return PP;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=Ol(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:PP},aB=ke([Cs],L2),oB=ke([aB,jne],H4),Fne=ke([iB,$o,_i,oB],sB,{memoizeOptions:{resultEqualityCheck:TS}}),D2=t=>t.errorBars,zne=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>nB(n,r)),Bw=function(){for(var e=arguments.length,n=new Array(e),r=0;r5&&arguments[5]!==void 0?arguments[5]:[],o,l;if(r.length>0&&r.forEach(c=>{var d,f=c.data!=null?[...c.data]:a,p=(d=i[c.id])===null||d===void 0?void 0:d.filter(y=>nB(s,y));f.forEach(y=>{var b,S=yi(y,(b=n.dataKey)!==null&&b!==void 0?b:c.dataKey),w=Dne(y,S,p);if(w.length>=2){var x=Math.min(...w),M=Math.max(...w);(o==null||xl)&&(l=M)}var T=fL(S);T!=null&&(o=o==null?T[0]:Math.min(o,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=fL(yi(c,n.dataKey));d!=null&&(o=o==null?d[0]:Math.min(o,d[0]),l=l==null?d[1]:Math.max(l,d[1]))}),wn(o)&&wn(l))return[o,l]},Bne=ke([O2,Cs,Nne,D2,_i,vJ],lB,{memoizeOptions:{resultEqualityCheck:TS}});function Hne(t){var e=t.value;if(Nl(e)||e instanceof Date)return e}var Vne=(t,e,n)=>{var r=t.map(Hne).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&x5(r))?B4(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},cB=t=>t.referenceElements.dots,Kg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),Gne=ke([cB,_i,AS],Kg),uB=t=>t.referenceElements.areas,Wne=ke([uB,_i,AS],Kg),dB=t=>t.referenceElements.lines,$ne=ke([dB,_i,AS],Kg),fB=(t,e)=>{if(t!=null){var n=Ol(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Xne=ke(Gne,_i,fB),hB=(t,e)=>{if(t!=null){var n=Ol(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)]}},qne=ke([Wne,_i],hB);function Kne(t){var e;if(t.x!=null)return Ol([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:Ol(n)}function Yne(t){var e;if(t.y!=null)return Ol([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:Ol(n)}var pB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?Kne(r):Yne(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},Zne=ke([$ne,_i],pB),Qne=ke(Xne,Zne,qne,(t,e,n)=>Bw(t,n,e)),mB=(t,e,n,r,i,s,a,o)=>{if(n!=null)return n;var l=a==="vertical"&&o==="xAxis"||a==="horizontal"&&o==="yAxis",c=l?Bw(r,s,i):Bw(s,i);return SJ(e,c,t.allowDataOverflow)},Jne=ke([Cs,aB,oB,Fne,Bne,Qne,hr,_i],mB,{memoizeOptions:{resultEqualityCheck:TS}}),ere=[0,1],gB=(t,e,n,r,i,s,a)=>{if(!((t==null||n==null||n.length===0)&&a===void 0)){var o=t.dataKey,l=t.type,c=jl(e,s);if(c&&o==null){var d;return B4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?Vne(r,t,c):i==="expand"&&!c?ere:a}},U2=ke([Cs,hr,O2,sx,wS,_i,Jne],gB),Yg=ke([Cs,$z,e2],Bz),vB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=L2(e),s=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&El(t)){if(s)return _O(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return wO(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&El(t))return _O(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&El(t))return wO(t,e.tickCount,e.allowDecimals,"adaptive")}}},j2=ke([U2,ix,Yg],vB),yB=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&El(e)&&Array.isArray(n)&&n.length>0){var i,s,a=e[0],o=(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(a,o),Math.max(l,c)]}return e},tre=ke([Cs,U2,j2,_i],yB),nre=ke(sx,Cs,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(Ol(t.map(f=>f.value))).sort((f,p)=>f-p),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var a=s-i;if(a===0)return 1/0;for(var o=0;oi,(t,e,n,r,i)=>{if(!wn(t))return 0;var s=e==="vertical"?r.height:r.width;if(i==="gap")return t*s/2;if(i==="no-gap"){var a=Td(n,t*s),o=t*s/2;return o-a-(o-a)/s*a}return 0}),rre=(t,e,n)=>{var r=nu(t,e);return r==null||typeof r.padding!="string"?0:xB(t,"xAxis",e,n,r.padding)},ire=(t,e,n)=>{var r=ru(t,e);return r==null||typeof r.padding!="string"?0:xB(t,"yAxis",e,n,r.padding)},sre=ke(nu,rre,(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}}),are=ke(ru,ire,(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}}),bB=ke([Wi,sre,mS,pS,(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]}),_B=ke([Wi,hr,are,mS,pS,(t,e,n)=>n],(t,e,n,r,i,s)=>{var a=i.padding;return s?[r.height-a.bottom,a.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),ax=(t,e,n,r)=>{var i;switch(e){case"xAxis":return bB(t,n,r);case"yAxis":return _B(t,n,r);case"zAxis":return(i=k2(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return rz(t);case"radiusAxis":return iz(t,n);default:return}},wB=ke([Cs,ax],SS),ore=ke([Yg,tre],BJ),F2=ke([Cs,Yg,ore,wB],I2),SB=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var i=n.type,s=n.scale,a=jl(t,r);if(a&&(i==="number"||s!=="auto"))return e.map(o=>o.value)}},z2=ke([hr,sx,ix,_i],SB),LS=ke([F2],l2);ke([F2],bne);ke([F2,Lne],Hz);ke([qg,D2,_i],zne);function MB(t,e){return t.ide.id?1:0}var DS=(t,e)=>e,US=(t,e,n)=>n,lre=ke(fS,DS,US,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(MB)),cre=ke(hS,DS,US,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(MB)),EB=(t,e)=>({width:t.width,height:e.height}),ure=(t,e)=>{var n=typeof e.width=="number"?e.width:Ky;return{width:n,height:t.height}},dre=ke(Wi,nu,EB),fre=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},hre=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},pre=ke(eu,Wi,lre,DS,US,(t,e,n,r,i)=>{var s={},a;return n.forEach(o=>{var l=EB(e,o);a==null&&(a=fre(e,r,t));var c=r==="top"&&!i||r==="bottom"&&i;s[o.id]=a-Number(c)*l.height,a+=(c?-1:1)*l.height}),s}),mre=ke(Jc,Wi,cre,DS,US,(t,e,n,r,i)=>{var s={},a;return n.forEach(o=>{var l=ure(e,o);a==null&&(a=hre(e,r,t));var c=r==="left"&&!i||r==="right"&&i;s[o.id]=a-Number(c)*l.width,a+=(c?-1:1)*l.width}),s}),gre=(t,e)=>{var n=nu(t,e);if(n!=null)return pre(t,n.orientation,n.mirror)},vre=ke([Wi,nu,gre,(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}}}),yre=(t,e)=>{var n=ru(t,e);if(n!=null)return mre(t,n.orientation,n.mirror)},xre=ke([Wi,ru,yre,(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}}}),bre=ke(Wi,ru,(t,e)=>{var n=typeof e.width=="number"?e.width:Ky;return{width:n,height:t.height}}),AB=(t,e,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,s=n.type,a=n.dataKey,o=jl(t,r),l=e.map(d=>d.value),c=l.filter(d=>d!=null);if(a&&o&&s==="category"&&i&&x5(c))return l}},B2=ke([hr,sx,Cs,_i],AB),hL=ke([hr,Cne,Yg,LS,B2,z2,ax,j2,_i],(t,e,n,r,i,s,a,o,l)=>{if(e!=null){var c=jl(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:o,range:a,realScaleType:n,scale:r}}}),_re=(t,e,n,r,i,s,a,o,l)=>{if(!(e==null||r==null)){var c=jl(t,l),d=e.type,f=e.ticks,p=e.tickCount,y=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,b=d==="category"&&r.bandwidth?r.bandwidth()/y:0;b=l==="angleAxis"&&s!=null&&s.length>=2?Va(s[0]-s[1])*2*b:b;var S=f||i;return S?S.map((w,x)=>{var M=a?a.indexOf(w):w,T=r.map(M);return wn(T)?{index:x,coordinate:T+b,value:w,offset:b}:null}).filter(Ys):c&&o?o.map((w,x)=>{var M=r.map(w);return wn(M)?{coordinate:M+b,value:w,index:x,offset:b}:null}).filter(Ys):r.ticks?r.ticks(p).map((w,x)=>{var M=r.map(w);return wn(M)?{coordinate:M+b,value:w,index:x,offset:b}:null}).filter(Ys):r.domain().map((w,x)=>{var M=r.map(w);return wn(M)?{coordinate:M+b,value:a?a[w]:w,index:x,offset:b}:null}).filter(Ys)}},TB=ke([hr,ix,Yg,LS,j2,ax,B2,z2,_i],_re),wre=(t,e,n,r,i,s,a)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var o=jl(t,a),l=e.tickCount,c=0;return c=a==="angleAxis"&&(r==null?void 0:r.length)>=2?Va(r[0]-r[1])*2*c:c,o&&s?s.map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:d,index:f,offset:c}:null}).filter(Ys):n.ticks?n.ticks(l).map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:d,index:f,offset:c}:null}).filter(Ys):n.domain().map((d,f)=>{var p=n.map(d);return wn(p)?{coordinate:p+c,value:i?i[d]:d,index:f,offset:c}:null}).filter(Ys)}},PB=ke([hr,ix,LS,ax,B2,z2,_i],wre),CB=ke(Cs,LS,(t,e)=>{if(!(t==null||e==null))return zw(zw({},t),{},{scale:e})}),Sre=ke([Cs,Yg,U2,wB],I2),Mre=ke([Sre],l2);ke((t,e,n)=>k2(t,n),Mre,(t,e)=>{if(!(t==null||e==null))return zw(zw({},t),{},{scale:e})});var Ere=ke([hr,fS,hS],(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}}),Are=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};ke([Are],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,i=t[0];for(var s of t){var a=Math.abs(s.coordinate-e);at.options.defaultTooltipEventType,NB=t=>t.options.validateTooltipEventTypes;function IB(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=RB(t),r=NB(t);return IB(e,n,r)}function Tre(t){return Ft(e=>ox(e,t))}var kB=(t,e)=>{var n,r=Number(e);if(!(Rl(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},Pre=t=>t.tooltip.settings,ld={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Cre={itemInteraction:{click:ld,hover:ld},axisInteraction:{click:ld,hover:ld},keyboardInteraction:ld,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}},OB=cs({name:"tooltip",initialState:Cre,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=Ga(t).tooltipItemPayloads.indexOf(r);s>-1&&(t.tooltipItemPayloads[s]=i)},prepare:ar()},removeTooltipEntrySettings:{reducer(t,e){var n=Ga(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}}}),Ja=OB.actions,Rre=Ja.addTooltipEntrySettings,Nre=Ja.replaceTooltipEntrySettings,Ire=Ja.removeTooltipEntrySettings,kre=Ja.setTooltipSettingsState,Ore=Ja.setActiveMouseOverItemIndex;Ja.mouseLeaveItem;var LB=Ja.mouseLeaveChart;Ja.setActiveClickItemIndex;var DB=Ja.setMouseOverAxisIndex,Lre=Ja.setMouseClickAxisIndex,H0=Ja.setSyncInteraction,Hw=Ja.setKeyboardInteraction,Dre=OB.reducer;function pL(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 Ob(t){for(var e=1;e{if(e==null)return ld;var i=zre(t,e,n);if(i==null)return ld;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(Bre(i)){if(s)return Ob(Ob({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Ob(Ob({},ld),{},{coordinate:i.coordinate})};function Hre(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 Vre(t,e){var n=Hre(t),r=e[0],i=e[1];if(n===void 0)return!1;var s=Math.min(r,i),a=Math.max(r,i);return n>=s&&n<=a}function Gre(t,e,n){if(n==null||e==null)return!0;var r=yi(t,e);return r==null||!El(n)?!0:Vre(r,n)}var X0=(t,e,n,r)=>{var i=t==null?void 0:t.index;if(i==null)return null;var s=Number(i);if(!wn(s))return i;var a=0,o=1/0;e.length>0&&(o=e.length-1);var l=Math.max(a,Math.min(s,o)),c=e[l];return c==null||Gre(c,n,r)?String(l):null},jB=(t,e,n,r,i,s,a)=>{if(s!=null){var o=a[0],l=o==null?void 0:o.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}}}},FB=(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(a=>{var o;return((o=a.settings)===null||o===void 0?void 0:o.graphicalItemId)===i})},zB=t=>t.options.tooltipPayloadSearcher,Zg=t=>t.tooltip;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 gL(t){for(var e=1;et(e)}function vL(t){if(typeof t=="string")return t}function Zre(t){if(!(t==null||typeof t!="object")){var e="name"in t?qre(t.name):void 0,n="unit"in t?Kre(t.unit):void 0,r="dataKey"in t?Yre(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?vL(t.color):void 0,a="fill"in t?vL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:a}}}function Qre(t,e){return t??e}var BB=(t,e,n,r,i,s,a)=>{if(!(e==null||s==null)){var o=n.chartData,l=n.computedData,c=n.dataStartIndex,d=n.dataEndIndex,f=[];return t.reduce((p,y)=>{var b,S=y.dataDefinedOnItem,w=y.settings,x=Qre(S,o),M=Array.isArray(x)?f4(x,c,d):x,T=(b=w==null?void 0:w.dataKey)!==null&&b!==void 0?b:r,P=w==null?void 0:w.nameKey,O;if(r&&Array.isArray(M)&&!Array.isArray(M[0])&&a==="axis"?O=b5(M,r,i):O=s(M,e,l,P),Array.isArray(O))O.forEach(D=>{var z,V,k=Zre(D),j=k==null?void 0:k.name,X=k==null?void 0:k.dataKey,ee=k==null?void 0:k.payload,ie=gL(gL({},w),{},{name:j,unit:k==null?void 0:k.unit,color:(z=k==null?void 0:k.color)!==null&&z!==void 0?z:w==null?void 0:w.color,fill:(V=k==null?void 0:k.fill)!==null&&V!==void 0?V:w==null?void 0:w.fill});p.push(dk({tooltipEntrySettings:ie,dataKey:X,payload:ee,value:yi(ee,X),name:j==null?void 0:String(j)}))});else{var N;p.push(dk({tooltipEntrySettings:w,dataKey:T,payload:O,value:yi(O,T),name:(N=yi(O,P))!==null&&N!==void 0?N:w==null?void 0:w.name}))}return p},f)}},H2=ke([oi,$z,e2],Bz),Jre=ke([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),eie=ke([wi,$g],Xz),Jh=ke([Jre,oi,eie],Kz,{memoizeOptions:{resultEqualityCheck:PS}}),tie=ke([Jh],t=>t.filter(o2)),HB=ke([Jh],Qz,{memoizeOptions:{resultEqualityCheck:PS}}),nie=ke([Jh],t=>t.some(e=>!e.data)),jh=ke([HB,$o],eB),rie=ke([tie,$o,oi],az),V2=ke([jh,oi,Jh,$o,nie,HB],tB),VB=ke([oi],L2),iie=ke([oi],t=>t.allowDataOverflow),GB=ke([VB,iie],H4),sie=ke([Jh],t=>t.filter(o2)),aie=ke([rie,sie,wS,J4],rB),oie=ke([aie,$o,wi,GB],sB),lie=ke([Jh],Zz),cie=ke([jh,oi,lie,D2,wi,yJ],lB,{memoizeOptions:{resultEqualityCheck:TS}}),uie=ke([cB,wi,$g],Kg),die=ke([uie,wi],fB),fie=ke([uB,wi,$g],Kg),hie=ke([fie,wi],hB),pie=ke([dB,wi,$g],Kg),mie=ke([pie,wi],pB),gie=ke([die,mie,hie],Bw),vie=ke([oi,VB,GB,oie,cie,gie,hr,wi],mB),Cg=ke([oi,hr,jh,V2,wS,wi,vie],gB),yie=ke([Cg,oi,H2],vB),xie=ke([oi,Cg,yie,wi],yB),WB=t=>{var e=wi(t),n=$g(t),r=!1;return ax(t,e,n,r)},$B=ke([oi,WB],SS),bie=ke([oi,H2,xie,$B],I2),XB=ke([bie],l2),_ie=ke([hr,V2,oi,wi],AB),wie=ke([hr,V2,oi,wi],SB),Sie=(t,e,n,r,i,s,a,o)=>{if(e){var l=e.type,c=jl(t,o);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=l==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=o==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Va(i[0]-i[1])*2*f:f,c&&a?a.map((p,y)=>{var b=r.map(p);return wn(b)?{coordinate:b+f,value:p,index:y,offset:f}:null}).filter(Ys):r.domain().map((p,y)=>{var b=r.map(p);return wn(b)?{coordinate:b+f,value:s?s[p]:p,index:y,offset:f}:null}).filter(Ys)}}},iu=ke([hr,oi,H2,XB,WB,_ie,wie,wi],Sie),G2=ke([RB,NB,Pre],(t,e,n)=>IB(n.shared,t,e)),qB=t=>t.tooltip.settings.trigger,W2=t=>t.tooltip.settings.defaultIndex,lx=ke([Zg,G2,qB,W2],UB),Sy=ke([lx,jh,Pg,Cg],X0),KB=ke([iu,Sy],kB),Mie=ke([lx],t=>{if(t)return t.dataKey}),Eie=ke([lx],t=>{if(t)return t.graphicalItemId}),YB=ke([Zg,G2,qB,W2],FB),Aie=ke([Jc,eu,hr,Wi,iu,W2,YB],jB),Tie=ke([lx,Aie],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Pie=ke([lx],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),Cie=ke([YB,Sy,$o,Pg,KB,zB,G2],BB),Rie=ke([Cie],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});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;eFt(oi),Lie=()=>{var t=Oie(),e=Ft(iu),n=Ft(XB);return yw(!t||!n?void 0:xL(xL({},t),{},{scale:n}),e)};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 cm(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}},zie=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="centric"){var s=i.coordinate,a=r.radius;return cm(cm(cm({},r),Bi(r.cx,r.cy,a,s)),{},{angle:s,radius:a})}var o=i.coordinate,l=r.angle;return cm(cm(cm({},r),Bi(r.cx,r.cy,o,l)),{},{angle:l,radius:o})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function Bie(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 ZB=(t,e,n,r,i)=>{var s,a=(s=e==null?void 0:e.length)!==null&&s!==void 0?s:0;if(a<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var o=0;o0?(l=n[o-1])===null||l===void 0?void 0:l.coordinate:(c=n[a-1])===null||c===void 0?void 0:c.coordinate,b=(d=n[o])===null||d===void 0?void 0:d.coordinate,S=o>=a-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(p=n[o+1])===null||p===void 0?void 0:p.coordinate,w=void 0;if(!(y==null||b==null||S==null))if(Va(b-y)!==Va(S-b)){var x=[];if(Va(S-b)===Va(i[1]-i[0])){w=S;var M=b+i[1]-i[0];x[0]=Math.min(M,(M+y)/2),x[1]=Math.max(M,(M+y)/2)}else{w=y;var T=S+i[1]-i[0];x[0]=Math.min(b,(T+b)/2),x[1]=Math.max(b,(T+b)/2)}var P=[Math.min(b,(w+b)/2),Math.max(b,(w+b)/2)];if(t>P[0]&&t<=P[1]||t>=x[0]&&t<=x[1]){var O;return(O=n[o])===null||O===void 0?void 0:O.index}}else{var N=Math.min(y,S),D=Math.max(y,S);if(t>(N+b)/2&&t<=(D+b)/2){var z;return(z=n[o])===null||z===void 0?void 0:z.index}}}else if(e)for(var V=0;V(k.coordinate+X.coordinate)/2||V>0&&V(k.coordinate+X.coordinate)/2&&t<=(k.coordinate+j.coordinate)/2)return k.index}}return-1},QB=()=>Ft(e2),$2=(t,e)=>e,JB=(t,e,n)=>n,X2=(t,e,n,r)=>r,Hie=ke(iu,t=>tS(t,e=>e.coordinate)),q2=ke([Zg,$2,JB,X2],UB),K2=ke([q2,jh,Pg,Cg],X0),Vie=(t,e,n)=>{if(e!=null){var r=Zg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},eH=ke([Zg,$2,JB,X2],FB),Vw=ke([Jc,eu,hr,Wi,iu,X2,eH],jB),Gie=ke([q2,Vw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),tH=ke([iu,K2],kB),Wie=ke([eH,K2,$o,Pg,tH,zB,$2],BB),$ie=ke([q2,K2],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),Xie=(t,e,n,r,i,s,a)=>{if(!(!t||!n||!r||!i)&&Bie(t,a)){var o=aY(t,e),l=ZB(o,s,i,n,r),c=Fie(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},qie=(t,e,n,r,i,s,a)=>{if(!(!t||!r||!i||!s||!n)){var o=cJ(t,n);if(o){var l=oY(o,e),c=ZB(l,a,s,r,i),d=zie(e,s,c,o);return{activeIndex:String(c),activeCoordinate:d}}}},Kie=(t,e,n,r,i,s,a,o)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?Xie(t,e,r,i,s,a,o):qie(t,e,n,r,i,s,a)},Yie=ke(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}}),Zie=ke(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(r=>parseInt(r,10)).concat(Object.values(Ms)),n=Array.from(new Set(e));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:zJ}});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;ewL(wL({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),tse)},rse=new Set(Object.values(Ms));function ise(t){return rse.has(t)}var nH=cs({name:"zIndex",initialState:nse,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&&!ise(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()}}}),jS=nH.actions,sse=jS.registerZIndexPortal,jE=jS.unregisterZIndexPortal,ase=jS.registerZIndexPortalElement,ose=jS.unregisterZIndexPortalElement,lse=nH.reducer;function su(t){var e=t.zIndex,n=t.children,r=WY(),i=r&&e!==void 0&&e!==0,s=Js(),a=R.useRef(void 0),o=R.useRef(new Set),l=Wr(),c=Ft(f=>Yie(f,e,s));if(R.useLayoutEffect(()=>{if(!i){var f=o.current;f.forEach(y=>{l(jE({zIndex:y}))}),f.clear(),a.current=void 0;return}if(o.current.has(e)||(l(sse({zIndex:e})),o.current.add(e)),c){a.current=c;var p=o.current;p.forEach(y=>{y!==e&&(l(jE({zIndex:y})),p.delete(y))})}},[l,e,i,c]),R.useLayoutEffect(()=>{var f=o.current;return()=>{f.forEach(p=>{l(jE({zIndex:p}))}),f.clear()}},[l]),!i)return n;var d=c??a.current;return d?X1.createPortal(n,d):null}function CP(){return CP=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.useContext(rH),FE={exports:{}},ML;function gse(){return ML||(ML=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,p){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new i(d,f||l,p),b=n?n+c:c;return l._events[b]?l._events[b].fn?l._events[b]=[l._events[b],y]:l._events[b].push(y):(l._events[b]=y,l._eventsCount++),l}function a(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function o(){this._events=new r,this._eventsCount=0}o.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},o.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 p=0,y=f.length,b=new Array(y);p{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!Rl(n))return t[n]}},bse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},iH=cs({name:"options",initialState:bse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),_se=iH.reducer,wse=iH.actions.createEventEmitter;function Sse(t){return t.tooltip.syncInteraction}var Mse={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},sH=cs({name:"chartData",initialState:Mse,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)}}}),Y2=sH.actions,AL=Y2.setChartData,Ese=Y2.setDataStartEndIndexes;Y2.setComputedData;var Ase=sH.reducer,Tse=["x","y"];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 um(t){for(var e=1;el.rootProps.className);R.useEffect(()=>{if(t==null)return Hg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(H0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var p;if(a&&d!==null&&d!==void 0&&(p=d.payload)!==null&&p!==void 0&&p.coordinate&&d.payload.sourceViewBox){var y=d.payload.coordinate,b=y.x,S=y.y,w=Nse(y,Tse),x=d.payload.sourceViewBox,M=x.x,T=x.y,P=x.width,O=x.height,N=um(um({},w),{},{x:a.x+(P?(b-M)/P:0)*a.width,y:a.y+(O?(S-T)/O:0)*a.height});n(um(um({},d),{},{payload:um(um({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var D;if(typeof r=="function"){var z={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},V=r(i,z);D=i[V]}else r==="value"&&(D=i.find(he=>String(he.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||a==null){n(H0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(D==null){n(H0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var j=k.x,X=k.y,ee=Math.min(j,a.x+a.width),ie=Math.min(X,a.y+a.height),pe={x:s==="horizontal"?D.coordinate:ee,y:s==="horizontal"?ie:D.coordinate},ae=H0({active:d.payload.active,coordinate:pe,dataKey:d.payload.dataKey,index:String(D.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(ae)}}};return My.on(RP,l),()=>{My.off(RP,l)}},[o,n,e,t,r,i,s,a])}function Ose(){var t=Ft(t2),e=Ft(n2),n=Wr();R.useEffect(()=>{if(t==null)return Hg;var r=(i,s,a)=>{e!==a&&t===i&&n(Ese(s))};return My.on(EL,r),()=>{My.off(EL,r)}},[n,e,t])}function Lse(){var t=Wr();R.useEffect(()=>{t(wse())},[t]),kse(),Ose()}function Dse(t,e,n,r,i,s){var a=Ft(b=>Vie(b,t,e)),o=Ft(Eie),l=Ft(n2),c=Ft(t2),d=Ft(ez),f=Ft(Sse),p=(f==null?void 0:f.sourceViewBox)!=null,y=gS();R.useEffect(()=>{if(!p&&c!=null&&l!=null){var b=H0({active:s,coordinate:n,dataKey:a,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:o});My.emit(RP,c,b,l)}},[p,n,a,o,i,r,l,c,d,s,y])}function PL(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;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{D(kre({shared:M,trigger:T,axisId:N,active:i,defaultIndex:z}))},[D,M,T,N,i,z]);var V=gS(),k=k4(),j=Tre(M),X=(e=Ft($e=>$ie($e,j,T,z)))!==null&&e!==void 0?e:{},ee=X.activeIndex,ie=X.isActive,pe=Ft($e=>Wie($e,j,T,z)),ae=Ft($e=>tH($e,j,T,z)),he=Ft($e=>Gie($e,j,T,z)),B=pe,J=mse(),Y=(n=i??ie)!==null&&n!==void 0?n:!1,H=$q([B,Y]),G=zse(H,2),le=G[0],se=G[1],ce=j==="axis"?ae:void 0;Dse(j,T,he,ce,ee,Y);var Se=O??J;if(Se==null||V==null||j==null)return null;var we=B??NL;Y||(we=NL),c&&we.length&&(we=mq(we.filter($e=>$e.value!=null&&($e.hide!==!0||r.includeHidden)),p,Wse));var We=we.length>0,Ee=CL(CL({},r),{},{payload:we,label:ce,active:Y,activeIndex:ee,coordinate:he,accessibilityLayer:k}),Ge=R.createElement(rQ,{allowEscapeViewBox:s,animationDuration:a,animationEasing:o,isAnimationActive:d,active:Y,coordinate:he,hasPayload:We,offset:f,position:y,reverseDirection:b,useTranslate3d:S,viewBox:V,wrapperStyle:w,lastBoundingBox:le,innerRef:se,hasPortalFromProps:!!O},$se(l,Ee));return R.createElement(R.Fragment,null,X1.createPortal(Ge,Se),Y&&R.createElement(pse,{cursor:x,tooltipEventType:j,coordinate:he,payload:we,index:ee}))}function Kse(t,e,n){return(e=Yse(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Yse(t){var e=Zse(t,"string");return typeof e=="symbol"?e:e+""}function Zse(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 Qse{constructor(e){Kse(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 IL(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 Jse(t){for(var e=1;e{try{var n=document.getElementById(OL);n||(n=document.createElement("span"),n.setAttribute("id",OL),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,iae,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},q0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Jy.isSsr)return{width:0,height:0};if(!aH.enableCache)return LL(e,n);var r=sae(e,n),i=kL.get(r);if(i)return i;var s=LL(e,n);return kL.set(r,s),s},oH;function Gw(t,e){return cae(t)||lae(t,e)||oae(t,e)||aae()}function aae(){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 oae(t,e){if(t){if(typeof t=="string")return DL(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)?DL(t,e):void 0}}function DL(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(cH));var s=i.map(o=>({word:o,width:q0(o,r).width})),a=n?0:q0(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:a}}catch{return null}};function dH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function Cae(t){return Vi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var fH=(t,e,n,r)=>t.reduce((i,s)=>{var a=s.word,o=s.width,l=i[i.length-1];if(l&&o!=null&&(e==null||r||l.width+o+nt.reduce((e,n)=>e.width>n.width?e:n),Rae="…",VL=(t,e,n,r,i,s,a,o)=>{var l=t.slice(0,e),c=uH({breakAll:n,style:r,children:l+Rae});if(!c)return[!1,[]];var d=fH(c.wordsWithComputedWidth,s,a,o),f=d.length>i||hH(d).width>Number(s);return[f,d]},Nae=(t,e,n,r,i)=>{var s=t.maxLines,a=t.children,o=t.style,l=t.breakAll,c=kt(s),d=String(a),f=fH(e,r,n,i);if(!c||i)return f;var p=f.length>s||hH(f).width>Number(r);if(!p)return f;for(var y=0,b=d.length-1,S=0,w;y<=b&&S<=d.length-1;){var x=Math.floor((y+b)/2),M=x-1,T=VL(d,M,l,o,s,r,n,i),P=BL(T,2),O=P[0],N=P[1],D=VL(d,x,l,o,s,r,n,i),z=BL(D,1),V=z[0];if(!O&&!V&&(y=x+1),O&&V&&(b=x-1),!O&&V){w=N;break}S++}return w||f},GL=t=>{var e=Vi(t)?[]:t.toString().split(cH);return[{words:e,width:void 0}]},Iae=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,a=t.maxLines;if((e||n)&&!Jy.isSsr){var o,l,c=uH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;o=d,l=f}else return GL(r);return Nae({breakAll:s,children:r,maxLines:a,style:i},o,l,e,!!n)}return GL(r)},pH="#808080",kae={angle:0,breakAll:!1,capHeight:"0.71em",fill:pH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Z2=R.forwardRef((t,e)=>{var n=Za(t,kae),r=n.x,i=n.y,s=n.lineHeight,a=n.capHeight,o=n.fill,l=n.scaleToFit,c=n.textAnchor,d=n.verticalAnchor,f=zL(n,wae),p=R.useMemo(()=>Iae({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,b=f.dy,S=f.angle,w=f.className,x=f.breakAll,M=zL(f,Sae);if(!Nl(r)||!Nl(i)||p.length===0)return null;var T=Number(r)+(kt(y)?y:0),P=Number(i)+(kt(b)?b:0);if(!wn(T)||!wn(P))return null;var O;switch(d){case"start":O=zE("calc(".concat(a,")"));break;case"middle":O=zE("calc(".concat((p.length-1)/2," * -").concat(s," + (").concat(a," / 2))"));break;default:O=zE("calc(".concat(p.length-1," * -").concat(s,")"));break}var N=[],D=p[0];if(l&&D!=null){var z=D.width,V=f.width;N.push("scale(".concat(kt(V)&&kt(z)?V/z:1,")"))}return S&&N.push("rotate(".concat(S,", ").concat(T,", ").concat(P,")")),N.length&&(M.transform=N.join(" ")),R.createElement("text",NP({},Xa(M),{ref:e,x:T,y:P,className:tr("recharts-text",w),textAnchor:c,fill:o.includes("url")?pH:o}),p.map((k,j)=>{var X=k.words.join(x?"":" ");return R.createElement("tspan",{x:T,dy:j===0?O:s,key:"".concat(X,"-").concat(j)},X)}))});Z2.displayName="Text";function WL(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,a=WC(e),o=a.x,l=a.y,c=a.height,d=a.upperWidth,f=a.lowerWidth,p=o,y=o+(d-f)/2,b=(p+y)/2,S=(d+f)/2,w=p+d/2,x=c>=0?1:-1,M=x*i,T=x>0?"end":"start",P=x>0?"start":"end",O=d>=0?1:-1,N=O*i,D=O>0?"end":"start",z=O>0?"start":"end",V=s;if(n==="top"){var k={x:p+d/2,y:l-M,horizontalAnchor:"middle",verticalAnchor:T};return V&&(k.height=Math.max(l-V.y,0),k.width=d),k}if(n==="bottom"){var j={x:y+f/2,y:l+c+M,horizontalAnchor:"middle",verticalAnchor:P};return V&&(j.height=Math.max(V.y+V.height-(l+c),0),j.width=f),j}if(n==="left"){var X={x:b-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"};return V&&(X.width=Math.max(X.x-V.x,0),X.height=c),X}if(n==="right"){var ee={x:b+S+N,y:l+c/2,horizontalAnchor:z,verticalAnchor:"middle"};return V&&(ee.width=Math.max(V.x+V.width-ee.x,0),ee.height=c),ee}var ie=V?{width:S,height:c}:{};return n==="insideLeft"?pl({x:b+N,y:l+c/2,horizontalAnchor:z,verticalAnchor:"middle"},ie):n==="insideRight"?pl({x:b+S-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"},ie):n==="insideTop"?pl({x:p+d/2,y:l+M,horizontalAnchor:"middle",verticalAnchor:P},ie):n==="insideBottom"?pl({x:y+f/2,y:l+c-M,horizontalAnchor:"middle",verticalAnchor:T},ie):n==="insideTopLeft"?pl({x:p+N,y:l+M,horizontalAnchor:z,verticalAnchor:P},ie):n==="insideTopRight"?pl({x:p+d-N,y:l+M,horizontalAnchor:D,verticalAnchor:P},ie):n==="insideBottomLeft"?pl({x:y+N,y:l+c-M,horizontalAnchor:z,verticalAnchor:T},ie):n==="insideBottomRight"?pl({x:y+f-N,y:l+c-M,horizontalAnchor:D,verticalAnchor:T},ie):n&&typeof n=="object"&&(kt(n.x)||kh(n.x))&&(kt(n.y)||kh(n.y))?pl({x:o+Td(n.x,S),y:l+Td(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},ie):pl({x:w,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},ie)},jae=["labelRef"],Fae=["content"];function $L(t,e){if(t==null)return{};var n,r,i=zae(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,a=t.height,o=t.children,l=R.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:i,width:s,height:a}),[e,n,r,i,s,a]);return R.createElement(mH.Provider,{value:l},o)},gH=()=>{var t=R.useContext(mH),e=gS();return t||(e?WC(e):void 0)},Wae=R.createContext(null),$ae=()=>{var t=R.useContext(Wae),e=Ft(sz);return t||e},Xae=t=>{var e=t.value,n=t.formatter,r=Vi(t.children)?e:t.children;return typeof n=="function"?n(r):r},Q2=t=>t!=null&&typeof t=="function",qae=(t,e)=>{var n=Va(e-t),r=Math.min(Math.abs(e-t),360);return n*r},Kae=(t,e,n,r,i)=>{var s=t.offset,a=t.className,o=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,p=i.endAngle,y=i.clockWise,b=(c+d)/2,S=qae(f,p),w=S>=0?1:-1,x,M;switch(e){case"insideStart":x=f+w*s,M=y;break;case"insideEnd":x=p-w*s,M=!y;break;case"end":x=p+w*s,M=y;break;default:throw new Error("Unsupported position ".concat(e))}M=S<=0?M:!M;var T=Bi(o,l,b,x),P=Bi(o,l,b,x+(M?1:-1)*359),O="M".concat(T.x,",").concat(T.y,` A`).concat(b,",").concat(b,",0,1,").concat(M?0:1,`, - `).concat(P.x,",").concat(P.y),N=Vi(t.id)?uy("recharts-radial-line-"):t.id;return R.createElement("text",kc({},r,{dominantBaseline:"central",className:tr("recharts-radial-bar-label",a)}),R.createElement("defs",null,R.createElement("path",{id:N,d:O})),R.createElement("textPath",{xlinkHref:"#".concat(N)},n))},qae=(t,e,n)=>{var r=t.cx,i=t.cy,s=t.innerRadius,a=t.outerRadius,o=t.startAngle,l=t.endAngle,c=(o+l)/2;if(n==="outside"){var d=Bi(r,i,a+e,c),f=d.x,p=d.y;return{x:f,y:p,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+a)/2,b=Bi(r,i,y,c),S=b.x,w=b.y;return{x:S,y:w,textAnchor:"middle",verticalAnchor:"middle"}},W_=t=>t!=null&&"cx"in t&&kt(t.cx),Kae={angle:0,offset:5,zIndex:Ms.label,position:"middle",textBreakAll:!1};function Yae(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 od(t){var e=Za(t,Kae),n=e.viewBox,r=e.parentViewBox,i=e.position,s=e.value,a=e.children,o=e.content,l=e.className,c=l===void 0?"":l,d=e.textBreakAll,f=e.labelRef,p=Gae(),y=gH(),b=i==="center"?y:p??y,S,w,x;n==null?S=b:W_(n)?S=n:S=WC(n);var M=Yae(S);if(!S||Vi(s)&&Vi(a)&&!R.isValidElement(o)&&typeof o!="function")return null;var T=V0(V0({},e),{},{viewBox:S});if(R.isValidElement(o)){T.labelRef;var P=$L(T,Dae);return R.cloneElement(o,P)}if(typeof o=="function"){T.content;var O=$L(T,Uae);if(w=R.createElement(o,O),R.isValidElement(w))return w}else w=Wae(e);var N=Xa(e);if(W_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return Xae(e,i,w,N,S);x=qae(S,e.offset,e.position)}else{if(!M)return null;var D=Lae({viewBox:M,position:i,offset:e.offset,parentViewBox:W_(r)?void 0:r});x=V0(V0({x:D.x,y:D.y,textAnchor:D.horizontalAnchor,verticalAnchor:D.verticalAnchor},D.width!==void 0?{width:D.width}:{}),D.height!==void 0?{height:D.height}:{})}return R.createElement(su,{zIndex:e.zIndex},R.createElement(Z2,kc({ref:f,className:tr("recharts-label",c)},N,x,{textAnchor:dH(N.textAnchor)?N.textAnchor:x.textAnchor,breakAll:d}),w))}od.displayName="Label";var Zae=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?R.createElement(od,kc({key:"label-implicit"},r)):Nl(t)?R.createElement(od,kc({key:"label-implicit",value:t},r)):R.isValidElement(t)?t.type===od?R.cloneElement(t,V0({key:"label-implicit"},r)):R.createElement(od,kc({key:"label-implicit",content:t},r)):Q2(t)?R.createElement(od,kc({key:"label-implicit",content:t},r)):t&&typeof t=="object"?R.createElement(od,kc({},t,{key:"label-implicit"},r)):null};function Qae(t){var e=t.label,n=t.labelRef,r=gH();return Zae(e,r,n)||null}var Jae=["valueAccessor"],eoe=["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(Tae(e))return e},vH=R.createContext(void 0),roe=vH.Provider,yH=R.createContext(void 0);yH.Provider;function ioe(){return R.useContext(vH)}function soe(){return R.useContext(yH)}function $_(t){var e=t.valueAccessor,n=e===void 0?noe:e,r=qL(t,Jae),i=r.dataKey;r.clockWise;var s=r.id,a=r.textBreakAll,o=r.zIndex,l=qL(r,eoe),c=ioe(),d=soe(),f=c||d;return!f||!f.length?null:R.createElement(su,{zIndex:o??Ms.label},R.createElement(qa,{className:"recharts-label-list"},f.map((p,y)=>{var b,S=Vi(i)?n(p,y):yi(p.payload,i),w=Vi(s)?{}:{id:"".concat(s,"-").concat(y)};return R.createElement(od,Ww({key:"label-".concat(y)},Xa(p),l,w,{fill:(b=r.fill)!==null&&b!==void 0?b:p.fill,parentViewBox:p.parentViewBox,value:S,textBreakAll:a,viewBox:p.viewBox,index:y,zIndex:0}))})))}$_.displayName="LabelList";function aoe(t){var e=t.label;return e?e===!0?R.createElement($_,{key:"labelList-implicit"}):R.isValidElement(e)||Q2(e)?R.createElement($_,{key:"labelList-implicit",content:e}):typeof e=="object"?R.createElement($_,Ww({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function IP(){return IP=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=tr("recharts-dot",i);return kt(e)&&kt(n)&&kt(r)?R.createElement("circle",IP({},zo(t),LC(t),{className:s,cx:e,cy:n,r})):null},ooe={radiusAxis:{},angleAxis:{}},bH=cs({name:"polarAxis",initialState:ooe,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]}}}),FS=bH.actions;FS.addRadiusAxis;FS.removeRadiusAxis;FS.addAngleAxis;FS.removeAngleAxis;var loe=bH.reducer;function coe(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var _H=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;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 YL(t){for(var e=1;e{r||(i.current===null?n(Pre(e)):i.current!==e&&n(Cre({prev:i.current,next:e})),i.current=e)},[e,n,r]),R.useLayoutEffect(()=>()=>{i.current&&(n(Rre(i.current)),i.current=null)},[n]),null}function xoe(t){var e=t.legendPayload,n=Wr(),r=Js(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(nZ(e)):i.current!==e&&n(rZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),R.useLayoutEffect(()=>()=>{i.current&&(n(iZ(i.current)),i.current=null)},[n]),null}function boe(t,e){return Moe(t)||Soe(t,e)||woe(t,e)||_oe()}function _oe(){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 woe(t,e){if(t){if(typeof t=="string")return ZL(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)?ZL(t,e):void 0}}function ZL(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 eR(r,e)}function Toe(t,e){var n=e.map((r,i)=>t[i]);return eR(n,e)}function Poe(t,e){for(var n=new Map,r=0;r{var y=n(f,p);if(y!=null){var b=r.get(y);if(b!==void 0)return i.add(y),b}}),a=[];for(var o of r){var l=boe(o,2),c=l[0],d=l[1];i.has(c)||a.push(d)}return eR(s,e,a)}function kP(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===J2?Aoe(t,e):n===Eoe?Toe(t,e):Coe(t,e,n)}function SH(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(a,o){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(o===0){i.current=!0;return}o===1&&(r.current=a),o>0&&i.current&&l&&(e.current=a)},[e]);return{startValue:r.current,syncStepValue:s}}function Roe(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 QL(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)?QL(t,e):void 0}}function QL(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]),o=R.useCallback(()=>{typeof e=="function"&&e(),s(!1)},[e]);return{isAnimating:i,handleAnimationStart:a,handleAnimationEnd:o}}function Doe(t){var e,n=t.animationInput,r=t.animationIdPrefix,i=t.items,s=t.previousItemsRef,a=t.isAnimationActive,o=t.animationBegin,l=t.animationDuration,c=t.animationEasing,d=t.onAnimationStart,f=t.onAnimationEnd,p=t.animationInterpolateFn,y=t.animationMatchBy,b=t.shouldUpdatePreviousRef,S=t.children,w=t.layout,x=j4(n,r),M=SH(x,s),T=(e=M.startValue)!==null&&e!==void 0?e:null,P=kP(T,i,y??J2);return R.createElement(U4,{animationId:x,begin:o,duration:l,isActive:a,easing:c,onAnimationEnd:f,onAnimationStart:d,key:x},O=>{var N=T==null,D=i==null?i:p(P,O,w),z=b?b(O):O>0;return M.syncStepValue(D,O,z),D==null?null:S(D,O,N)})}var BE;function Uoe(t,e){return Boe(t)||zoe(t,e)||Foe(t,e)||joe()}function joe(){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 Foe(t,e){if(t){if(typeof t=="string")return JL(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)?JL(t,e):void 0}}function JL(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=Uoe(t,1),n=e[0];return n},MH=(BE=G1.useId)!==null&&BE!==void 0?BE:Hoe;function Voe(t,e){var n=MH();return e||(t?"".concat(t,"-").concat(n):n)}var Goe=R.createContext(void 0),Woe=t=>{var e=t.id,n=t.type,r=t.children,i=Voe("recharts-".concat(n),e);return R.createElement(Goe.Provider,{value:i},r(i))},$oe={cartesianItems:[],polarItems:[]},EH=cs({name:"graphicalItems",initialState:$oe,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=Ga(t).cartesianItems.indexOf(r);s>-1&&(t.cartesianItems[s]=i)},prepare:ar()},removeCartesianGraphicalItem:{reducer(t,e){var n=Ga(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=Ga(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=Ga(t).polarItems.indexOf(r);s>-1&&(t.polarItems[s]=i)},prepare:ar()}}}),Qg=EH.actions,Xoe=Qg.addCartesianGraphicalItem,qoe=Qg.replaceCartesianGraphicalItem,Koe=Qg.removeCartesianGraphicalItem;Qg.addPolarGraphicalItem;Qg.removePolarGraphicalItem;Qg.replacePolarGraphicalItem;var Yoe=EH.reducer,Zoe=t=>{var e=Wr(),n=R.useRef(null);return R.useLayoutEffect(()=>{n.current===null?e(Xoe(t)):n.current!==t&&e(qoe({prev:n.current,next:t})),n.current=t},[e,t]),R.useLayoutEffect(()=>()=>{n.current&&(e(Koe(n.current)),n.current=null)},[e]),null},Qoe=R.memo(Zoe),Joe=["points"];function e3(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 HE(t){for(var e=1;e{var x,M,T=HE(HE(HE({r:3},a),p),{},{index:w,cx:(x=S.x)!==null&&x!==void 0?x:void 0,cy:(M=S.y)!==null&&M!==void 0?M:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return R.createElement(sle,{key:"dot-".concat(w),option:n,dotProps:T,className:i})}),b={};return o&&l!=null&&(b.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(l,")")),R.createElement(su,{zIndex:d},R.createElement(qa,$w({className:r},b),y))}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({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),_le=ke([ble,Jc,eu],(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)}}),tR=()=>Ft(_le),wle=()=>Ft(Pie);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 VE(t){for(var e=1;e{var e=t.point,n=t.childIndex,r=t.mainColor,i=t.activeDot,s=t.dataKey,a=t.clipPath;if(i===!1||e.x==null||e.y==null)return null;var o={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=VE(VE(VE({},o),Q1(i)),LC(i)),c;return R.isValidElement(i)?c=R.cloneElement(i,l):typeof i=="function"?c=i(l):c=R.createElement(xH,l),R.createElement(qa,{className:"recharts-active-dot",clipPath:a},c)};function i3(t){var e=t.points,n=t.mainColor,r=t.activeDot,i=t.itemDataKey,s=t.clipPath,a=t.zIndex,o=a===void 0?Ms.activeDot:a,l=Ft(Sy),c=wle();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return Vi(d)?null:R.createElement(su,{zIndex:o},R.createElement(Ale,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var Tle=t=>{var e=t.chartData,n=Wr(),r=Js();return R.useEffect(()=>r?()=>{}:(n(AL(e)),()=>{n(AL(void 0))}),[e,n,r]),null},s3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},PH=cs({name:"brush",initialState:s3,reducers:{setBrushSettings(t,e){return e.payload==null?s3:e.payload}}});PH.actions.setBrushSettings;var Ple=PH.reducer;function Cle(t){return(t%180+180)%180}var Rle=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=Cle(i),a=s*Math.PI/180,o=Math.atan(r/n),l=a>o&&a{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=Ga(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=Ga(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=Ga(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),Jg=CH.actions;Jg.addDot;Jg.removeDot;Jg.addArea;Jg.removeArea;Jg.addLine;Jg.removeLine;var Ile=CH.reducer;function kle(t,e){return Ule(t)||Dle(t,e)||Lle(t,e)||Ole()}function Ole(){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 Lle(t,e){if(t){if(typeof t=="string")return a3(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)?a3(t,e):void 0}}function a3(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=kle(n,1),i=r[0],s=tR();if(s==null)return null;var a=s.x,o=s.y,l=s.width,c=s.height;return R.createElement(jle.Provider,{value:i},R.createElement("defs",null,R.createElement("clipPath",{id:i},R.createElement("rect",{x:a,y:o,height:c,width:l}))),e)};function RH(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 Hle(t,e){return RH(t,e+1)}function Vle(t,e,n,r,i){for(var s=(r||[]).slice(),a=e.start,o=e.end,l=0,c=1,d=a,f=function(){var b=r==null?void 0:r[l];if(b===void 0)return{v:RH(r,c)};var S=l,w,x=()=>(w===void 0&&(w=n(b,S)),w),M=b.coordinate,T=l===0||Ey(t,M,x,d,o);T||(l=0,d=a,c+=1),T&&(d=M+t*(x()/2+i),l+=c)},p;c<=s.length;)if(p=f(),p)return p.v;return[]}function Gle(t,e,n,r,i){var s=(r||[]).slice(),a=s.length;if(a===0)return[];for(var o=e.start,l=e.end,c=1;c<=a;c++){for(var d=(a-1)%c,f=o,p=!0,y=function(){var P=r[S];if(P==null)return 0;var O=S,N,D=()=>(N===void 0&&(N=n(P,O)),N),z=P.coordinate,V=S===d||Ey(t,z,D,f,l);if(!V)return p=!1,1;V&&(f=z+t*(D()/2+i))},b,S=d;S(S===void 0&&(S=n(y,p)),S);if(p===a-1){var x=t*(b.coordinate+t*w()/2-l);s[p]=b=rs(rs({},b),{},{tickCoord:x>0?b.coordinate-x*t:b.coordinate})}else s[p]=b=rs(rs({},b),{},{tickCoord:b.coordinate});if(b.tickCoord!=null){var M=Ey(t,b.tickCoord,w,o,l);M&&(l=b.tickCoord-t*(w()/2+i),s[p]=rs(rs({},b),{},{isShow:!0}))}},d=a-1;d>=0;d--)c(d);return s}function Kle(t,e,n,r,i,s){var a=(r||[]).slice(),o=a.length,l=e.start,c=e.end;if(s){var d=r[o-1];if(d!=null){var f=n(d,o-1),p=t*(d.coordinate+t*f/2-c);if(a[o-1]=d=rs(rs({},d),{},{tickCoord:p>0?d.coordinate-p*t:d.coordinate}),d.tickCoord!=null){var y=Ey(t,d.tickCoord,()=>f,l,c);y&&(c=d.tickCoord-t*(f/2+i),a[o-1]=rs(rs({},d),{},{isShow:!0}))}}}for(var b=s?o-1:o,S=function(M){var T=a[M];if(T==null)return 1;var P=T,O,N=()=>(O===void 0&&(O=n(T,M)),O);if(M===0){var D=t*(P.coordinate-t*N()/2-l);a[M]=P=rs(rs({},P),{},{tickCoord:D<0?P.coordinate-D*t:P.coordinate})}else a[M]=P=rs(rs({},P),{},{tickCoord:P.coordinate});if(P.tickCoord!=null){var z=Ey(t,P.tickCoord,N,l,c);z&&(l=P.tickCoord+t*(N()/2+i),a[M]=rs(rs({},P),{},{isShow:!0}))}},w=0;w{var D=typeof c=="function"?c(O.value,N):O.value;return b==="width"?zle(q0(D,{fontSize:e,letterSpacing:n}),S,f):q0(D,{fontSize:e,letterSpacing:n})[b]},x=i[0],M=i[1],T=i.length>=2&&x!=null&&M!=null?Va(M.coordinate-x.coordinate):1,P=Ble(s,T,b);return l==="equidistantPreserveStart"?Vle(T,P,w,i,a):l==="equidistantPreserveEnd"?Gle(T,P,w,i,a):(l==="preserveStart"||l==="preserveStartEnd"?y=Kle(T,P,w,i,a,l==="preserveStartEnd"):y=qle(T,P,w,i,a),y.filter(O=>O.isShow))}var Yle=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,i=r,s=t.tickSize,a=s===void 0?0:s,o=t.tickMargin,l=o===void 0?0:o,c=0;if(e){Array.from(e).forEach(y=>{if(y){var b=y.getBoundingClientRect();b.width>c&&(c=b.width)}});var d=n?n.getBoundingClientRect().width:0,f=a+l,p=c+f+d+(n?i:0);return Math.round(p)}return 0},Zle={xAxis:{},yAxis:{}},NH=cs({name:"renderedTicks",initialState:Zle,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]}}}),IH=NH.actions,Qle=IH.setRenderedTicks,Jle=IH.removeRenderedTicks,ece=NH.reducer,tce=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function l3(t,e){return sce(t)||ice(t,e)||rce(t,e)||nce()}function nce(){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 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||n==null)return Hg;var s=e.map(a=>({value:a.value,coordinate:a.coordinate,offset:a.offset,index:a.index}));return i(Qle({ticks:s,axisId:r,axisType:n})),()=>{i(Jle({axisId:r,axisType:n}))}},[i,e,r,n]),null}var vce=R.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,i=t.tick,s=t.tickLine,a=t.stroke,o=t.tickFormatter,l=t.unit,c=t.padding,d=t.tickTextProps,f=t.orientation,p=t.mirror,y=t.x,b=t.y,S=t.width,w=t.height,x=t.tickSize,M=t.tickMargin,T=t.fontSize,P=t.letterSpacing,O=t.getTicksConfig,N=t.events,D=t.axisType,z=t.axisId,V=nR(Ar(Ar({},O),{},{ticks:r}),T,P),k=zo(O),j=Q1(i),X=dH(k.textAnchor)?k.textAnchor:hce(f,p),ee=pce(f,p),ie={};typeof s=="object"&&(ie=s);var pe=Ar(Ar({},k),{},{fill:"none"},ie),ae=V.map(J=>Ar({entry:J},fce(J,y,b,S,w,f,x,p,M))),he=ae.map(J=>{var Y=J.entry,H=J.line;return R.createElement(qa,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(Y.value,"-").concat(Y.coordinate,"-").concat(Y.tickCoord)},s&&R.createElement("line",Fh({},pe,H,{className:tr("recharts-cartesian-axis-tick-line",Yh(s,"className"))})))}),B=ae.map((J,Y)=>{var H,G,le=J.entry,se=J.tick,ce=Ar(Ar(Ar(Ar({verticalAnchor:ee},k),{},{textAnchor:X,stroke:"none",fill:a},se),{},{index:Y,payload:le,visibleTicksCount:V.length,tickFormatter:o,padding:c},d),{},{angle:(H=(G=d==null?void 0:d.angle)!==null&&G!==void 0?G:k.angle)!==null&&H!==void 0?H:0}),Se=Ar(Ar({},ce),j);return R.createElement(qa,Fh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(le.value,"-").concat(le.coordinate,"-").concat(le.tickCoord)},_X(N,le,Y)),i&&R.createElement(mce,{option:i,tickProps:Se,value:"".concat(typeof o=="function"?o(le.value,Y):le.value).concat(l||"")}))});return R.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(D,"-ticks")},R.createElement(gce,{ticks:V,axisId:z,axisType:D}),B.length>0&&R.createElement(su,{zIndex:Ms.label},R.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(D,"-tick-labels"),ref:e},B)),he.length>0&&R.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(D,"-tick-lines")},he))}),yce=R.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,i=t.height,s=t.className,a=t.hide,o=t.ticks,l=t.axisType,c=t.axisId,d=ace(t,tce),f=R.useState(""),p=l3(f,2),y=p[0],b=p[1],S=R.useState(""),w=l3(S,2),x=w[0],M=w[1],T=R.useRef(null);R.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return Yle({ticks:T.current,label:(O=t.labelRef)===null||O===void 0?void 0:O.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var P=R.useCallback(O=>{if(O){var N=O.getElementsByClassName("recharts-cartesian-axis-tick-value");T.current=N;var D=N[0];if(D){var z=window.getComputedStyle(D),V=z.fontSize,k=z.letterSpacing;(V!==y||k!==x)&&(b(V),M(k))}}},[y,x]);return a||r!=null&&r<=0||i!=null&&i<=0?null:R.createElement(su,{zIndex:t.zIndex},R.createElement(qa,{className:tr("recharts-cartesian-axis",s)},R.createElement(dce,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:zo(t)}),R.createElement(vce,{ref:P,axisType:l,events:d,fontSize:y,getTicksConfig:t,height:t.height,letterSpacing:x,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:o,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),R.createElement(Hae,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},R.createElement(Qae,{label:t.label,labelRef:t.labelRef}),t.children)))}),rR=R.forwardRef((t,e)=>{var n=Za(t,Hc);return R.createElement(yce,Fh({},n,{ref:e}))});rR.displayName="CartesianAxis";var xce=["x1","y1","x2","y2","key"],bce=["offset"],_ce=["xAxisId","yAxisId"],wce=["xAxisId","yAxisId"];function d3(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 is(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,a=t.height,o=t.ry;return R.createElement("rect",{x:r,y:i,ry:o,width:s,height:a,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function kH(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,a=n.y1,o=n.x2,l=n.y2,c=n.key,d=Xw(n,xce),f=(i=zo(d))!==null&&i!==void 0?i:{};f.offset;var p=Xw(f,bce);r=R.createElement("line",ah({},p,{x1:s,y1:a,x2:o,y2:l,fill:"none",key:c}))}return r}function Pce(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 a=Xw(t,_ce),o=s.map((l,c)=>{var d=is(is({},a),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return R.createElement(kH,{key:"line-".concat(c),option:i,lineItemProps:d})});return R.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Cce(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 a=Xw(t,wce),o=s.map((l,c)=>{var d=is(is({},a),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return R.createElement(kH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return R.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Rce(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,a=t.height,o=t.horizontalPoints,l=t.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length||o==null)return null;var d=o.map(p=>Math.round(p+i-i)).sort((p,y)=>p-y);i!==d[0]&&d.unshift(0);var f=d.map((p,y)=>{var b=d[y+1],S=b==null,w=S?i+a-p:b-p;if(w<=0)return null;var x=y%e.length;return R.createElement("rect",{key:"react-".concat(y),y:p,x:r,height:w,width:s,stroke:"none",fill:e[x],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function Nce(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,a=t.y,o=t.width,l=t.height,c=t.verticalPoints;if(!n||!r||!r.length)return null;var d=c.map(p=>Math.round(p+s-s)).sort((p,y)=>p-y);s!==d[0]&&d.unshift(0);var f=d.map((p,y)=>{var b=d[y+1],S=b==null,w=S?s+o-p:b-p;if(w<=0)return null;var x=y%r.length;return R.createElement("rect",{key:"react-".concat(y),x:p,y:a,width:w,height:l,stroke:"none",fill:r[x],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Ice=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return h4(nR(is(is(is({},Hc),n),{},{ticks:p4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},kce=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return h4(nR(is(is(is({},Hc),n),{},{ticks:p4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},Oce={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ms.grid};function OH(t){var e=w4(),n=S4(),r=_4(),i=is(is({},Za(t,Oce)),{},{x:kt(t.x)?t.x:r.left,y:kt(t.y)?t.y:r.top,width:kt(t.width)?t.width:r.width,height:kt(t.height)?t.height:r.height}),s=i.xAxisId,a=i.yAxisId,o=i.x,l=i.y,c=i.width,d=i.height,f=i.syncWithTicks,p=i.horizontalValues,y=i.verticalValues,b=Js(),S=Ft(V=>hL(V,"xAxis",s,b)),w=Ft(V=>hL(V,"yAxis",a,b));if(!Il(c)||!Il(d)||!kt(o)||!kt(l))return null;var x=i.verticalCoordinatesGenerator||Ice,M=i.horizontalCoordinatesGenerator||kce,T=i.horizontalPoints,P=i.verticalPoints;if((!T||!T.length)&&typeof M=="function"){var O=p&&p.length,N=M({yAxis:w?is(is({},w),{},{ticks:O?p:w.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((!P||!P.length)&&typeof x=="function"){var D=y&&y.length,z=x({xAxis:S?is(is({},S),{},{ticks:D?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},D?!0:f);xw(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof z,"]")),Array.isArray(z)&&(P=z)}return R.createElement(su,{zIndex:i.zIndex},R.createElement("g",{className:"recharts-cartesian-grid"},R.createElement(Tce,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),R.createElement(Rce,ah({},i,{horizontalPoints:T})),R.createElement(Nce,ah({},i,{verticalPoints:P})),R.createElement(Pce,ah({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:w})),R.createElement(Cce,ah({},i,{offset:r,verticalPoints:P,xAxis:S,yAxis:w}))))}OH.displayName="CartesianGrid";var Lce={},LH=cs({name:"errorBars",initialState:Lce,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(a=>a.dataKey===i.dataKey&&a.direction===i.direction?s:a))},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))}}}),iR=LH.actions;iR.addErrorBar;iR.replaceErrorBar;iR.removeErrorBar;var Dce=LH.reducer;function DH(t,e){var n,r,i=Ft(c=>nu(c,t)),s=Ft(c=>ru(c,e)),a=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:ti.allowDataOverflow,o=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:ni.allowDataOverflow,l=a||o;return{needClip:l,needClipX:a,needClipY:o}}function Uce(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=tR(),s=DH(e,n),a=s.needClipX,o=s.needClipY,l=s.needClip,c=Ft(T=>bB(T,e,!1)),d=Ft(T=>_B(T,n,!1));if(!l||!i)return null;var f=i.x,p=i.y,y=i.width,b=i.height,S=a&&c?Math.min(c[0],c[1]):f-y/2,w=o&&d?Math.min(d[0],d[1]):p-b/2,x=a&&c?Math.abs(c[1]-c[0]):y*2,M=o&&d?Math.abs(d[1]-d[0]):b*2;return R.createElement("clipPath",{id:"clipPath-".concat(r)},R.createElement("rect",{x:S,y:w,width:x,height:M}))}function jce(t){var e=Q1(t),n=3,r=2;if(e!=null){var i=e.r,s=e.strokeWidth,a=Number(i),o=Number(s);return(Number.isNaN(a)||a<0)&&(a=n),(Number.isNaN(o)||o<0)&&(o=r),{r:a,strokeWidth:o}}return{r:n,strokeWidth:r}}function sR(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:AH}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.yAxisId)!==null&&n!==void 0?n:AH}var UH=(t,e,n)=>CB(t,"xAxis",sR(t,e),n),jH=(t,e,n)=>PB(t,"xAxis",sR(t,e),n),FH=(t,e,n)=>CB(t,"yAxis",aR(t,e),n),zH=(t,e,n)=>PB(t,"yAxis",aR(t,e),n),Fce=ke([hr,UH,FH,jH,zH],(t,e,n,r,i)=>jl(t,"xAxis")?yw(e,r,!1):yw(n,i,!1)),zce=(t,e)=>e,BH=ke([qz,zce],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),HH=t=>{var e=hr(t),n=jl(e,"xAxis");return n?"yAxis":"xAxis"},Bce=(t,e)=>{var n=HH(t);return n==="yAxis"?aR(t,e):sR(t,e)},Hce=(t,e,n)=>iB(t,HH(t),Bce(t,e),n),Vce=ke([BH,Hce],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=a2(t);if(!(r==null||i==null)){var s=(n=e[r])===null||n===void 0?void 0:n.stackedData,a=s==null?void 0:s.find(o=>o.key===i);if(a!=null)return a.map(o=>[o[0],o[1]])}}}),Gce=ke([hr,UH,FH,jH,zH,Vce,pJ,Fce,BH,NJ],(t,e,n,r,i,s,a,o,l,c)=>{var d=a.chartData,f=a.dataStartIndex,p=a.dataEndIndex;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null)){var y=l.data,b;if(y&&y.length>0?b=y:b=d==null?void 0:d.slice(f,p+1),b!=null)return gue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:b,chartBaseValue:c,bandSize:o})}}),Wce=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],$ce=["id","baseLine"];function K0(){return K0=Object.assign?Object.assign.bind():function(t){for(var e=1;ef.y||0));return kt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),kt(d)?R.createElement("rect",{x:of.x||0));return kt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),kt(d)?R.createElement("rect",{x:0,y:ot==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Rg(Rg({},n.next),{},{x:Dc(n.prev.x,n.next.x,e),y:Dc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),GH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:J2,animationInterpolateFn:iue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:Zce,xAxisId:0,yAxisId:0,zIndex:Ms.area};function Kw(t,e){return t&&t!=="none"?t:e}var sue=t=>{var e=t.dataKey,n=t.name,r=t.stroke,i=t.fill,s=t.legendType,a=t.hide;return[{inactive:a,dataKey:e,type:s,color:Kw(r,i),value:m4(n,e),payload:t}]},aue=R.memo(t=>{var e=t.dataKey,n=t.data,r=t.stroke,i=t.strokeWidth,s=t.fill,a=t.name,o=t.hide,l=t.unit,c=t.tooltipType,d=t.id,f={dataDefinedOnItem:n,getPosition:Hg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:m4(a,e),hide:o,type:c,color:Kw(r,s),unit:l,graphicalItemId:d}};return R.createElement(yoe,{tooltipEntrySettings:f})});function oue(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,a=r.dataKey,o=zo(r);return R.createElement(ole,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:a,baseProps:o,needClip:i,clipPathId:e})}function lue(t){var e=t.showLabels,n=t.children,r=t.points,i=r.map(s=>{var a,o,l={x:(a=s.x)!==null&&a!==void 0?a:0,y:(o=s.y)!==null&&o!==void 0?o:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Rg(Rg({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return R.createElement(roe,{value:e?i:void 0},n)}function cue(t){var e=t.points,n=t.baseLine,r=t.needClip,i=t.clipPathId,s=t.props,a=t.animationElapsedTime,o=t.isAnimating,l=t.isEntrance,c=s.layout,d=s.type,f=s.stroke,p=s.connectNulls,y=s.isRange,b=s.shape,S=s.id,w=VH(s,Qce),x=Xa(w),M=Rg(Rg({},x),{},{id:S,points:e,connectNulls:p,type:d,baseLine:n,layout:c,stroke:f,isRange:y,animationElapsedTime:a,isAnimating:o,isEntrance:l});return R.createElement(R.Fragment,null,(e==null?void 0:e.length)>1&&R.createElement(qa,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},R.createElement(voe,{option:b,DefaultShape:GH.shape,shapeProps:M})),R.createElement(oue,{points:e,props:w,clipPathId:i}))}function uue(t,e,n){if(kt(t)){var r=kt(e)?e:void 0;return Dc(r,t,n)}if(Vi(t)||Rl(t)){var i=kt(e)?e:void 0;return Dc(i,0,n)}return t}function due(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=t.previousPointsRef,s=t.previousBaselineRef,a=r.points,o=r.baseLine,l=r.isAnimationActive,c=r.animationBegin,d=r.animationDuration,f=r.animationEasing,p=r.animationMatchBy,y=r.animationInterpolateFn,b=R.useMemo(()=>({points:a,baseLine:o}),[a,o]),S=SH(b,s),w=$C(),x=Loe(r.onAnimationStart,r.onAnimationEnd),M=x.isAnimating,T=x.handleAnimationStart,P=x.handleAnimationEnd,O=S.startValue;if(w==null)return null;var N;return Array.isArray(o)&&Array.isArray(O)?N=kP(O,o,p):Array.isArray(o)?N=kP(null,o,p):N=null,R.createElement(Doe,{animationInput:b,animationIdPrefix:"recharts-area-",items:a,previousItemsRef:i,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:T,onAnimationEnd:P,animationInterpolateFn:y,animationMatchBy:p,layout:w},(D,z,V)=>{var k;return z===1?k=o:Array.isArray(o)?k=y(N,z,w):k=V?o:uue(o,O,z),S.syncStepValue(k,z),R.createElement(lue,{showLabels:!M,points:a},r.children,R.createElement(cue,{points:D,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:z,isAnimating:M||z<1,isEntrance:V}),R.createElement(aoe,{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(due,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class hue extends R.PureComponent{render(){var e=this.props,n=e.hide,r=e.dot,i=e.points,s=e.className,a=e.top,o=e.left,l=e.needClip,c=e.xAxisId,d=e.yAxisId,f=e.width,p=e.height,y=e.id,b=e.baseLine,S=e.zIndex;if(n)return null;var w=tr("recharts-area",s),x=y,M=jce(r),T=M.r,P=M.strokeWidth,O=_H(r),N=T*2+P,D=l?"url(#clipPath-".concat(O?"":"dots-").concat(x,")"):void 0;return R.createElement(su,{zIndex:S},R.createElement(qa,{className:w},l&&R.createElement("defs",null,R.createElement(Uce,{clipPathId:x,xAxisId:c,yAxisId:d}),!O&&R.createElement("clipPath",{id:"clipPath-dots-".concat(x)},R.createElement("rect",{x:o-N/2,y:a-N/2,width:f+N,height:p+N}))),R.createElement(fue,{needClip:l,clipPathId:x,props:this.props})),R.createElement(i3,{points:i,mainColor:Kw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}),this.props.isRange&&Array.isArray(b)&&R.createElement(i3,{points:b,mainColor:Kw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}))}}function pue(t){var e,n=t.activeDot,r=t.animationBegin,i=t.animationDuration,s=t.animationEasing,a=t.connectNulls,o=t.dot,l=t.fill,c=t.fillOpacity,d=t.hide,f=t.isAnimationActive,p=t.legendType,y=t.stroke,b=t.xAxisId,S=t.yAxisId,w=VH(t,Jce),x=Vg(),M=QB(),T=DH(b,S),P=T.needClip,O=Js(),N=(e=Ft(pe=>Gce(pe,t.id,O)))!==null&&e!==void 0?e:{},D=N.points,z=N.isRange,V=N.baseLine,k=tR();if(x!=="horizontal"&&x!=="vertical"||k==null||M!=="AreaChart"&&M!=="ComposedChart")return null;var j=k.height,X=k.width,ee=k.x,ie=k.y;return!D||!D.length?null:R.createElement(hue,qw({},w,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:V,connectNulls:a,dot:o,fill:l,fillOpacity:c,height:j,hide:d,layout:x,isAnimationActive:f,isRange:z,legendType:p,needClip:P,points:D,stroke:y,width:X,left:ee,top:ie,xAxisId:b,yAxisId:S}))}var mue=(t,e,n,r,i)=>{var s=n??e;if(kt(s))return s;var a=t==="horizontal"?i:r,o=a.scale.domain();if(a.type==="number"){var l=Math.max(o[0],o[1]),c=Math.min(o[0],o[1]);return s==="dataMin"?c:s==="dataMax"||l<0?l:Math.max(Math.min(o[0],o[1]),0)}return s==="dataMin"?o[0]:s==="dataMax"?o[1]:o[0]};function gue(t){var e=t.areaSettings,n=e.connectNulls,r=e.baseValue,i=e.dataKey,s=t.stackedData,a=t.layout,o=t.chartBaseValue,l=t.xAxis,c=t.yAxis,d=t.displayedData,f=t.dataStartIndex,p=t.xAxisTicks,y=t.yAxisTicks,b=t.bandSize,S=s&&s.length,w=mue(a,o,r,l,c),x=a==="horizontal",M=!1,T=d.map((O,N)=>{var D,z,V,k;if(S)k=s[f+N];else{var j=yi(O,i);Array.isArray(j)?(k=j,M=!0):k=[w,j]}var X=(D=(z=k)===null||z===void 0?void 0:z[1])!==null&&D!==void 0?D:null,ee=X==null||S&&!n&&yi(O,i)==null;if(x){var ie;return{x:lk({axis:l,ticks:p,bandSize:b,entry:O,index:N}),y:ee?null:(ie=c.scale.map(X))!==null&&ie!==void 0?ie:null,value:k,payload:O}}return{x:ee?null:(V=l.scale.map(X))!==null&&V!==void 0?V:null,y:lk({axis:c,ticks:y,bandSize:b,entry:O,index:N}),value:k,payload:O}}),P;return S||M?P=T.map(O=>{var N,D=Array.isArray(O.value)?O.value[0]:null;if(x){var z;return{x:O.x,y:D!=null&&O.y!=null&&(z=c.scale.map(D))!==null&&z!==void 0?z:null,payload:O.payload}}return{x:D!=null&&(N=l.scale.map(D))!==null&&N!==void 0?N:null,y:O.y,payload:O.payload}}):P=x?c.scale.map(w):l.scale.map(w),{points:T,baseLine:P??0,isRange:M}}function vue(t){var e=Za(t,GH),n=Js();return R.createElement(Woe,{id:e.id,type:"area"},r=>R.createElement(R.Fragment,null,R.createElement(xoe,{legendPayload:sue(e)}),R.createElement(aue,{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(Qoe,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:eY(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),R.createElement(pue,qw({},e,{id:r}))))}var WH=R.memo(vue,bS);WH.displayName="Area";var yue=["domain","range"],xue=["domain","range"];function p3(t,e){if(t==null)return{};var n,r,i=bue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{if(a!=null)return v3(v3({},s),{},{type:a})},[s,a]);return R.useLayoutEffect(()=>{o!=null&&(n.current===null?e(fle(o)):n.current!==o&&e(hle({prev:n.current,next:o})),n.current=o)},[o,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(ple(n.current)),n.current=null)},[e]),null}var Cue=t=>{var e=t.xAxisId,n=t.className,r=Ft(v4),i=Js(),s="xAxis",a=Ft(p=>TB(p,s,e,i)),o=Ft(p=>cre(p,e)),l=Ft(p=>mre(p,e)),c=Ft(p=>Gz(p,e));if(o==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=LP(t,wue);c.id,c.scale;var f=LP(c,Sue);return R.createElement(rR,OP({},d,f,{x:l.x,y:l.y,width:o.width,height:o.height,className:tr("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:a,axisType:s,axisId:e}))},Rue={allowDataOverflow:ti.allowDataOverflow,allowDecimals:ti.allowDecimals,allowDuplicatedCategory:ti.allowDuplicatedCategory,angle:ti.angle,axisLine:Hc.axisLine,height:ti.height,hide:!1,includeHidden:ti.includeHidden,interval:ti.interval,label:!1,minTickGap:ti.minTickGap,mirror:ti.mirror,orientation:ti.orientation,padding:ti.padding,reversed:ti.reversed,scale:ti.scale,tick:ti.tick,tickCount:ti.tickCount,tickLine:Hc.tickLine,tickSize:Hc.tickSize,type:ti.type,niceTicks:ti.niceTicks,xAxisId:0},Nue=t=>{var e=Za(t,Rue);return R.createElement(R.Fragment,null,R.createElement(Pue,{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(Cue,e))},XH=R.memo(Nue,$H);XH.displayName="XAxis";var Iue=["type"],kue=["dangerouslySetInnerHTML","ticks","scale"],Oue=["id","scale"];function DP(){return DP=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(a!=null)return x3(x3({},s),{},{type:a})},[a,s]);return R.useLayoutEffect(()=>{o!=null&&(n.current===null?e(mle(o)):n.current!==o&&e(gle({prev:n.current,next:o})),n.current=o)},[o,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(vle(n.current)),n.current=null)},[e]),null}function zue(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=R.useRef(null),a=R.useRef(null),o=Ft(v4),l=Js(),c=Wr(),d="yAxis",f=Ft(x=>yre(x,e)),p=Ft(x=>vre(x,e)),y=Ft(x=>TB(x,d,e,l)),b=Ft(x=>Wz(x,e));if(R.useLayoutEffect(()=>{if(!(r!=="auto"||!f||Q2(i)||R.isValidElement(i)||b==null)){var x=s.current;if(x){var M=x.getCalculatedWidth();Math.round(f.width)!==Math.round(M)&&c(yle({id:e,width:M}))}}},[y,f,c,i,e,r,b]),f==null||p==null||b==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=UP(t,kue);b.id,b.scale;var w=UP(b,Oue);return R.createElement(rR,DP({},S,w,{ref:s,labelRef:a,x:p.x,y:p.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:f.width,height:f.height,className:tr("recharts-".concat(d," ").concat(d),n),viewBox:o,ticks:y,axisType:d,axisId:e}))}var Bue={allowDataOverflow:ni.allowDataOverflow,allowDecimals:ni.allowDecimals,allowDuplicatedCategory:ni.allowDuplicatedCategory,angle:ni.angle,axisLine:Hc.axisLine,hide:!1,includeHidden:ni.includeHidden,interval:ni.interval,label:!1,minTickGap:ni.minTickGap,mirror:ni.mirror,orientation:ni.orientation,padding:ni.padding,reversed:ni.reversed,scale:ni.scale,tick:ni.tick,tickCount:ni.tickCount,tickLine:Hc.tickLine,tickSize:Hc.tickSize,type:ni.type,niceTicks:ni.niceTicks,width:ni.width,yAxisId:0},Hue=t=>{var e=Za(t,Bue);return R.createElement(R.Fragment,null,R.createElement(Fue,{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(zue,e))},qH=R.memo(Hue,$H);qH.displayName="YAxis";var Vue=(t,e)=>e,oR=ke([Vue,hr,sz,wi,$B,iu,zie,Wi],Xie);function Gue(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function lR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(Gue(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 a=(o,l)=>({relativeX:Math.round((o-e.left)/n),relativeY:Math.round((l-e.top)/r)});return"touches"in t?Array.from(t.touches).map(o=>a(o.clientX,o.clientY)):a(t.clientX,t.clientY)}var KH=Ma("mouseClick"),YH=qy();YH.startListening({actionCreator:KH,effect:(t,e)=>{var n=t.payload,r=oR(e.getState(),lR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(kre({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var jP=Ma("mouseMove"),ZH=qy(),dm=null,Ef=null,GE=null;ZH.startListening({actionCreator:jP,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=r.eventSettings,s=i.throttleDelay,a=i.throttledEvents,o=a==="all"||(a==null?void 0:a.includes("mousemove"));dm!==null&&(cancelAnimationFrame(dm),dm=null),Ef!==null&&(typeof s!="number"||!o)&&(clearTimeout(Ef),Ef=null),GE=lR(n);var l=()=>{var c=e.getState(),d=ox(c,c.tooltip.settings.shared);if(!GE){dm=null,Ef=null;return}if(d==="axis"){var f=oR(c,GE);(f==null?void 0:f.activeIndex)!=null?e.dispatch(DB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(LB())}dm=null,Ef=null};if(!o){l();return}s==="raf"?dm=requestAnimationFrame(l):typeof s=="number"&&Ef===null&&(Ef=setTimeout(l,s))}});function Wue(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 b3={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},QH=cs({name:"rootProps",initialState:b3,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:b3.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}}}),$ue=QH.reducer,Xue=QH.actions.updateOptions,que=null,Kue={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)},JH=cs({name:"polarOptions",initialState:que,reducers:Kue});JH.actions.updatePolarOptions;var Yue=JH.reducer,eV=Ma("keyDown"),tV=Ma("focus"),nV=Ma("blur"),zS=qy(),fm=null,Af=null,Db=null;zS.startListening({actionCreator:eV,effect:(t,e)=>{Db=t.payload,fm!==null&&(cancelAnimationFrame(fm),fm=null);var n=e.getState(),r=n.eventSettings,i=r.throttleDelay,s=r.throttledEvents,a=s==="all"||s.includes("keydown");Af!==null&&(typeof i!="number"||!a)&&(clearTimeout(Af),Af=null);var o=()=>{try{var l=e.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var d=l.tooltip.keyboardInteraction,f=Db;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var p=X0(d,jh(l),Pg(l),Cg(l)),y=p==null?-1:Number(p),b=!Number.isFinite(y)||y<0,S=iu(l),w=jh(l),x=ox(l,l.tooltip.settings.shared);if(f==="Enter"){if(b)return;var M=Vw(l,x,"hover",String(d.index));e.dispatch(Hw({active:!d.active,activeIndex:d.index,activeCoordinate:M}));return}var T=Sre(l),P=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(b){var D=Pg(l),z=Cg(l),V=O*P,k=pe=>({active:!1,index:String(pe),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(N=-1,V>0){for(var j=0;j=0;X--)if(X0(k(X),w,D,z)!=null){N=X;break}if(N<0)return}else{N=y+O*P;var ee=(S==null?void 0:S.length)||w.length;if(ee===0||N>=ee||N<0)return}var ie=Vw(l,x,"hover",String(N));e.dispatch(Hw({active:!0,activeIndex:N.toString(),activeCoordinate:ie}))}finally{fm=null,Af=null}};if(!a){o();return}i==="raf"?fm=requestAnimationFrame(o):typeof i=="number"&&Af===null&&(o(),Db=null,Af=setTimeout(()=>{Db?o():(Af=null,fm=null)},i))}});zS.startListening({actionCreator:tV,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",a=ox(n,n.tooltip.settings.shared),o=Vw(n,a,"hover",String(s));e.dispatch(Hw({active:!0,activeIndex:s,activeCoordinate:o}))}}}});zS.startListening({actionCreator:nV,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 rV(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 za=Ma("externalEvent"),iV=qy(),Ub=new Map,f0=new Map,WE=new Map;iV.startListening({actionCreator:za,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,a=rV(i);WE.set(s,{handler:r,reactEvent:a});var o=Ub.get(s);o!==void 0&&(cancelAnimationFrame(o),Ub.delete(s));var l=e.getState(),c=l.eventSettings,d=c.throttleDelay,f=c.throttledEvents,p=f,y=p==="all"||(p==null?void 0:p.includes(s)),b=f0.get(s);b!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(b),f0.delete(s));var S=()=>{var M=WE.get(s);try{if(!M)return;var T=M.handler,P=M.reactEvent,O=e.getState(),N={activeCoordinate:Eie(O),activeDataKey:wie(O),activeIndex:Sy(O),activeLabel:KB(O),activeTooltipIndex:Sy(O),isTooltipActive:Aie(O)};T&&T(N,P)}finally{Ub.delete(s),f0.delete(s),WE.delete(s)}};if(!y){S();return}if(d==="raf"){var w=requestAnimationFrame(S);Ub.set(s,w)}else if(typeof d=="number"){if(!f0.has(s)){S();var x=setTimeout(S,d);f0.set(s,x)}}else S()}}});var Zue=ke([Zg],t=>t.tooltipItemPayloads),Que=ke([Zue,(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)}}}),sV=Ma("touchMove"),aV=qy(),Tf=null,Hu=null,_3=null,h0=null;aV.startListening({actionCreator:sV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){h0=rV(n);var r=e.getState(),i=r.eventSettings,s=i.throttleDelay,a=i.throttledEvents,o=a==="all"||a.includes("touchmove");Tf!==null&&(cancelAnimationFrame(Tf),Tf=null),Hu!==null&&(typeof s!="number"||!o)&&(clearTimeout(Hu),Hu=null),_3=Array.from(n.touches).map(c=>lR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(h0!=null){var c=e.getState(),d=ox(c,c.tooltip.settings.shared);if(d==="axis"){var f,p=(f=_3)===null||f===void 0?void 0:f[0];if(p==null){Tf=null,Hu=null;return}var y=oR(c,p);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(DB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var b,S=h0.touches[0];if(document.elementFromPoint==null||S==null)return;var w=document.elementFromPoint(S.clientX,S.clientY);if(!w||!w.getAttribute)return;var x=w.getAttribute(oY),M=(b=w.getAttribute(lY))!==null&&b!==void 0?b:void 0,T=Jh(c).find(N=>N.id===M);if(x==null||T==null||M==null)return;var P=T.dataKey,O=Que(c,x,M);e.dispatch(Ire({activeDataKey:P,activeIndex:x,activeCoordinate:O,activeGraphicalItemId:M}))}Tf=null,Hu=null}};if(!o){l();return}s==="raf"?Tf=requestAnimationFrame(l):typeof s=="number"&&Hu===null&&(l(),h0=null,Hu=setTimeout(()=>{h0?l():(Hu=null,Tf=null)},s))}}});var oV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},lV=cs({name:"eventSettings",initialState:oV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),Jue=lV.actions.setEventSettings,ede=lV.reducer,tde=j5({brush:Ple,cartesianAxis:xle,chartData:Mse,errorBars:Dce,eventSettings:ede,graphicalItems:Yoe,layout:WK,legend:sZ,options:xse,polarAxis:loe,polarOptions:Yue,referenceElements:Ile,renderedTicks:ece,rootProps:$ue,tooltip:Ore,zIndex:ase}),nde=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return gK({reducer:tde,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([YH.middleware,ZH.middleware,zS.middleware,iV.middleware,aV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(J5({type:"raf"}))},devTools:{serialize:{replacer:Wue},name:"recharts-".concat(n)}})};function rde(t){var e=t.preloadedState,n=t.children,r=t.reduxStoreName,i=Js(),s=R.useRef(null);if(i)return n;s.current==null&&(s.current=nde(e,r));var a=UC;return R.createElement(_Z,{context:a,store:s.current},n)}function ide(t){var e=t.layout,n=t.margin,r=Wr(),i=Js();return R.useEffect(()=>{i||(r(HK(e)),r(BK(n)))},[r,i,e,n]),null}var sde=R.memo(ide,bS);function ade(t){var e=Wr();return R.useEffect(()=>{e(Xue(t))},[e,t]),null}var ode=t=>{var e=Wr();return R.useEffect(()=>{e(Jue(t))},[e,t]),null},lde=R.memo(ode,bS);function w3(t){var e=t.zIndex,n=t.isPanorama,r=R.useRef(null),i=Wr();return R.useLayoutEffect(()=>(r.current&&i(ise({zIndex:e,element:r.current,isPanorama:n})),()=>{i(sse({zIndex:e,isPanorama:n}))}),[i,e,n]),R.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function S3(t){var e=t.children,n=t.isPanorama,r=Ft(Kie);if(!r||r.length===0)return e;var i=r.filter(a=>a<0),s=r.filter(a=>a>0);return R.createElement(R.Fragment,null,i.map(a=>R.createElement(w3,{key:a,zIndex:a,isPanorama:n})),e,s.map(a=>R.createElement(w3,{key:a,zIndex:a,isPanorama:n})))}var cde=["children"];function ude(t,e){if(t==null)return{};var n,r,i=dde(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=w4(),r=S4(),i=k4();if(!Il(n)||!Il(r))return null;var s=t.children,a=t.otherAttributes,o=t.title,l=t.desc,c,d;return a!=null&&(typeof a.tabIndex=="number"?c=a.tabIndex:c=i?0:void 0,typeof a.role=="string"?d=a.role:d=i?"application":void 0),R.createElement(n5,Yw({},a,{title:o,desc:l,role:d,tabIndex:c,width:n,height:r,style:fde,ref:e}),s)}),pde=t=>{var e=t.children,n=Ft(mS);if(!n)return null;var r=n.width,i=n.height,s=n.y,a=n.x;return R.createElement(n5,{width:r,height:i,x:a,y:s},e)},M3=R.forwardRef((t,e)=>{var n=t.children,r=ude(t,cde),i=Js();return i?R.createElement(pde,null,R.createElement(S3,{isPanorama:!0},n)):R.createElement(hde,Yw({ref:e},r),R.createElement(S3,{isPanorama:!1},n))});function mde(t,e){return xde(t)||yde(t,e)||vde(t,e)||gde()}function gde(){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 vde(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);n{if(r!=null){var a=r.getBoundingClientRect(),o=a.width/r.offsetWidth;wn(o)&&o!==s&&t(GK(o))}},[r,t,s]),i}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 _de(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n(kse(),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 Rde=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)}),a=Zw(s,2),o=a[0],l=a[1],c=R.useCallback((f,p)=>{l(y=>{var b=Math.round(f),S=Math.round(p);return y.containerWidth===b&&y.containerHeight===S?y:{containerWidth:b,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 p=f.getBoundingClientRect(),y=p.width,b=p.height;c(y,b);var S=x=>{var M=x[0];if(M!=null){var T=M.contentRect,P=T.width,O=T.height;c(P,O)}},w=new ResizeObserver(S);w.observe(f),i.current=w}},[e,c]);return R.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),R.createElement(R.Fragment,null,R.createElement(Yy,{width:o.containerWidth,height:o.containerHeight}),R.createElement("div",wd({ref:d},t)))}),Nde=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=R.useState({containerWidth:Qw(n),containerHeight:Qw(r)}),s=Zw(i,2),a=s[0],o=s[1],l=R.useCallback((d,f)=>{o(p=>{var y=Math.round(d),b=Math.round(f);return p.containerWidth===y&&p.containerHeight===b?p:{containerWidth:y,containerHeight:b}})},[]),c=R.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var f=d.getBoundingClientRect(),p=f.width,y=f.height;l(p,y)}},[e,l]);return R.createElement(R.Fragment,null,R.createElement(Yy,{width:a.containerWidth,height:a.containerHeight}),R.createElement("div",wd({ref:c},t)))}),Ide=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return R.createElement(R.Fragment,null,R.createElement(Yy,{width:n,height:r}),R.createElement("div",wd({ref:e},t)))}),kde=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?R.createElement(Nde,wd({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?R.createElement(Ide,wd({},t,{width:n,height:r,ref:e})):R.createElement(R.Fragment,null,R.createElement(Yy,{width:n,height:r}),R.createElement("div",wd({ref:e},t)))});function Ode(t){return t?Rde:kde}var Lde=R.forwardRef((t,e)=>{var n=t.children,r=t.className,i=t.height,s=t.onClick,a=t.onContextMenu,o=t.onDoubleClick,l=t.onMouseDown,c=t.onMouseEnter,d=t.onMouseLeave,f=t.onMouseMove,p=t.onMouseUp,y=t.onTouchEnd,b=t.onTouchMove,S=t.onTouchStart,w=t.style,x=t.width,M=t.responsive,T=t.dispatchTouchEvents,P=T===void 0?!0:T,O=R.useRef(null),N=Wr(),D=R.useState(null),z=Zw(D,2),V=z[0],k=z[1],j=R.useState(null),X=Zw(j,2),ee=X[0],ie=X[1],pe=bde(),ae=GC(),he=(ae==null?void 0:ae.width)>0?ae.width:x,B=(ae==null?void 0:ae.height)>0?ae.height:i,J=R.useCallback(Le=>{pe(Le),typeof e=="function"&&e(Le),k(Le),ie(Le),Le!=null&&(O.current=Le)},[pe,e,k,ie]),Y=R.useCallback(Le=>{N(KH(Le)),N(za({handler:s,reactEvent:Le}))},[N,s]),H=R.useCallback(Le=>{N(jP(Le)),N(za({handler:c,reactEvent:Le}))},[N,c]),G=R.useCallback(Le=>{N(LB()),N(za({handler:d,reactEvent:Le}))},[N,d]),le=R.useCallback(Le=>{N(jP(Le)),N(za({handler:f,reactEvent:Le}))},[N,f]),se=R.useCallback(()=>{N(tV())},[N]),ce=R.useCallback(()=>{N(nV())},[N]),Se=R.useCallback(Le=>{N(eV(Le.key))},[N]),we=R.useCallback(Le=>{N(za({handler:a,reactEvent:Le}))},[N,a]),We=R.useCallback(Le=>{N(za({handler:o,reactEvent:Le}))},[N,o]),Ee=R.useCallback(Le=>{N(za({handler:l,reactEvent:Le}))},[N,l]),Ge=R.useCallback(Le=>{N(za({handler:p,reactEvent:Le}))},[N,p]),$e=R.useCallback(Le=>{N(za({handler:S,reactEvent:Le}))},[N,S]),de=R.useCallback(Le=>{P&&N(sV(Le)),N(za({handler:b,reactEvent:Le}))},[N,P,b]),Z=R.useCallback(Le=>{N(za({handler:y,reactEvent:Le}))},[N,y]),Ve=Ode(M);return R.createElement(rH.Provider,{value:V},R.createElement(K7.Provider,{value:ee},R.createElement(Ve,{width:he??(w==null?void 0:w.width),height:B??(w==null?void 0:w.height),className:tr("recharts-wrapper",r),style:_de({position:"relative",cursor:"default",width:he,height:B},w),onClick:Y,onContextMenu:we,onDoubleClick:We,onFocus:se,onBlur:ce,onKeyDown:Se,onMouseDown:Ee,onMouseEnter:H,onMouseLeave:G,onMouseMove:le,onMouseUp:Ge,onTouchEnd:Z,onTouchMove:de,onTouchStart:$e,ref:J},R.createElement(Cde,null),n)))}),Dde=["width","height","responsive","children","className","style","compact","title","desc"];function Ude(t,e){if(t==null)return{};var n,r,i=jde(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,a=t.className,o=t.style,l=t.compact,c=t.title,d=t.desc,f=Ude(t,Dde),p=zo(f);return l?R.createElement(R.Fragment,null,R.createElement(Yy,{width:n,height:r}),R.createElement(M3,{otherAttributes:p,title:c,desc:d},s)):R.createElement(Lde,{className:a,style:o,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(M3,{otherAttributes:p,title:c,desc:d,ref:e},R.createElement(Fle,null,s)))});function FP(){return FP=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.createElement($de,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Xde,tooltipPayloadSearcher:vse,categoricalChartProps:t,ref:e}));const Kde="rgba(130,130,150,0.14)",C3="rgba(130,130,150,0.85)";function Yde(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 cV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function Zde({active:t,payload:e,unit:n}){return!t||!(e!=null&&e.length)?null:v.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:v.jsx("div",{className:"space-y-1",children:e.map(r=>v.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[v.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:r.color}}),v.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:r.name}),v.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:cV(r.value,n)})]},r.dataKey))})})}function uV({data:t,series:e,unit:n="%",yMode:r="percent",height:i=176}){const s=t.reduce((o,l)=>e.reduce((c,d)=>Math.max(c,Number(l[d.key])||0),o),0),a=r==="percent"?Math.min(100,Math.max(25,Math.ceil(s*1.2/25)*25)):Math.max(Yde(s*1.15),10);return v.jsx("div",{style:{height:i},className:"w-full",children:v.jsx(BY,{width:"100%",height:"100%",children:v.jsxs(qde,{data:t,margin:{top:8,right:6,bottom:0,left:-12},children:[v.jsx("defs",{children:e.map(o=>v.jsxs("linearGradient",{id:`grad-${o.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[v.jsx("stop",{offset:"0%",stopColor:o.color,stopOpacity:.22}),v.jsx("stop",{offset:"100%",stopColor:o.color,stopOpacity:0})]},o.key))}),v.jsx(OH,{vertical:!1,stroke:Kde}),v.jsx(XH,{dataKey:"t",hide:!0}),v.jsx(qH,{domain:[0,a],ticks:[0,a/2,a],tickFormatter:o=>cV(o,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:C3}}),v.jsx($se,{content:v.jsx(Zde,{unit:n}),cursor:{stroke:C3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(o=>v.jsx(WH,{type:"monotone",dataKey:o.key,name:o.label,stroke:o.color,strokeWidth:2,fill:`url(#grad-${o.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},o.key))]})})})}const Qde=[{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 Jde(){var a,o,l,c;const{sys:t,hist:e}=U7(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=Qde.filter(d=>d.key!=="gpu"||n),i={cpu:(a=t==null?void 0:t.cpu)==null?void 0:a.percent,ram:(o=t==null?void 0:t.ram)==null?void 0:o.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?`${sd(t.ram.used)}/${sd(t.ram.total)} GB`:"",gpu:n?`${sd(t.gpu.gtt_used)}/${sd(t.gpu.gtt_total)} GB`:"",disk:t!=null&&t.disk?`${sd(t.disk.used)}/${sd(t.disk.total)} GB`:""};return v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[v.jsx(Md,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:r.map(d=>v.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:d.color}}),v.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:d.label}),v.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]&&v.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:s[d.key]})]},d.key))}),v.jsx(uV,{data:e,series:r,unit:"%",yMode:"percent",height:176})]}):v.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)&&v.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&&v.jsxs("span",{children:["CPU Temp: ",t.temp.cpu," °C"]}),t.temp.gpu!=null&&v.jsxs("span",{children:["GPU Temp: ",t.temp.gpu," °C"]})]})]})}const cR="-",efe=t=>{const e=nfe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{const o=a.split(cR);return o[0]===""&&o.length!==1&&o.shift(),dV(o,e)||tfe(a)},getConflictingClassGroupIds:(a,o)=>{const l=n[a]||[];return o&&r[a]?[...l,...r[a]]:l}}},dV=(t,e)=>{var a;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?dV(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(cR);return(a=e.validators.find(({validator:o})=>o(s)))==null?void 0:a.classGroupId},R3=/^\[(.+)\]$/,tfe=t=>{if(R3.test(t)){const e=R3.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},nfe=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return ife(Object.entries(t.classGroups),n).forEach(([s,a])=>{zP(a,r,s,e)}),r},zP=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:N3(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(rfe(i)){zP(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,a])=>{zP(a,N3(e,s),n,r)})})},N3=(t,e)=>{let n=t;return e.split(cR).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},rfe=t=>t.isThemeGetter,ife=(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(([a,o])=>[e+a,o])):s);return[n,i]}):t,sfe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,a)=>{n.set(s,a),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=r.get(s))!==void 0)return i(s,a),a},set(s,a){n.has(s)?n.set(s,a):i(s,a)}}},fV="!",afe=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,a=o=>{const l=[];let c=0,d=0,f;for(let w=0;wd?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:S}};return n?o=>n({className:o,parseClassName:a}):a},ofe=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},lfe=t=>({cache:sfe(t.cacheSize),parseClassName:afe(t),...efe(t)}),cfe=/\s+/,ufe=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],a=t.trim().split(cfe);let o="";for(let l=a.length-1;l>=0;l-=1){const c=a[l],{modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:y}=n(c);let b=!!y,S=r(b?p.substring(0,y):p);if(!S){if(!b){o=c+(o.length>0?" "+o:o);continue}if(S=r(p),!S){o=c+(o.length>0?" "+o:o);continue}b=!1}const w=ofe(d).join(":"),x=f?w+fV:w,M=x+S;if(s.includes(M))continue;s.push(M);const T=i(S,b);for(let P=0;P0?" "+o:o)}return o};function dfe(){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=lfe(c),r=n.cache.get,i=n.cache.set,s=o,o(l)}function o(l){const c=r(l);if(c)return c;const d=ufe(l,n);return i(l,d),d}return function(){return s(dfe.apply(null,arguments))}}const ir=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},pV=/^\[(?:([a-z-]+):)?(.+)\]$/i,hfe=/^\d+\/\d+$/,pfe=new Set(["px","full","screen"]),mfe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gfe=/\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$/,vfe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,yfe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xfe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bc=t=>tg(t)||pfe.has(t)||hfe.test(t),Vu=t=>ev(t,"length",Tfe),tg=t=>!!t&&!Number.isNaN(Number(t)),$E=t=>ev(t,"number",tg),p0=t=>!!t&&Number.isInteger(Number(t)),bfe=t=>t.endsWith("%")&&tg(t.slice(0,-1)),dn=t=>pV.test(t),Gu=t=>mfe.test(t),_fe=new Set(["length","size","percentage"]),wfe=t=>ev(t,_fe,mV),Sfe=t=>ev(t,"position",mV),Mfe=new Set(["image","url"]),Efe=t=>ev(t,Mfe,Cfe),Afe=t=>ev(t,"",Pfe),m0=()=>!0,ev=(t,e,n)=>{const r=pV.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},Tfe=t=>gfe.test(t)&&!vfe.test(t),mV=()=>!1,Pfe=t=>yfe.test(t),Cfe=t=>xfe.test(t),Rfe=()=>{const t=ir("colors"),e=ir("spacing"),n=ir("blur"),r=ir("brightness"),i=ir("borderColor"),s=ir("borderRadius"),a=ir("borderSpacing"),o=ir("borderWidth"),l=ir("contrast"),c=ir("grayscale"),d=ir("hueRotate"),f=ir("invert"),p=ir("gap"),y=ir("gradientColorStops"),b=ir("gradientColorStopPositions"),S=ir("inset"),w=ir("margin"),x=ir("opacity"),M=ir("padding"),T=ir("saturate"),P=ir("scale"),O=ir("sepia"),N=ir("skew"),D=ir("space"),z=ir("translate"),V=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",dn,e],X=()=>[dn,e],ee=()=>["",bc,Vu],ie=()=>["auto",tg,dn],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ae=()=>["solid","dashed","dotted","double","none"],he=()=>["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"],J=()=>["","0",dn],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>[tg,dn];return{cacheSize:500,separator:":",theme:{colors:[m0],spacing:[bc,Vu],blur:["none","",Gu,dn],brightness:H(),borderColor:[t],borderRadius:["none","","full",Gu,dn],borderSpacing:X(),borderWidth:ee(),contrast:H(),grayscale:J(),hueRotate:H(),invert:J(),gap:X(),gradientColorStops:[t],gradientColorStopPositions:[bfe,Vu],inset:j(),margin:j(),opacity:H(),padding:X(),saturate:H(),scale:H(),sepia:J(),skew:H(),space:X(),translate:X()},classGroups:{aspect:[{aspect:["auto","square","video",dn]}],container:["container"],columns:[{columns:[Gu]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"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(),dn]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],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",p0,dn]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",dn]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",p0,dn]}],"grid-cols":[{"grid-cols":[m0]}],"col-start-end":[{col:["auto",{span:["full",p0,dn]},dn]}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":[m0]}],"row-start-end":[{row:["auto",{span:[p0,dn]},dn]}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",dn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dn]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"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":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",dn,e]}],"min-w":[{"min-w":[dn,e,"min","max","fit"]}],"max-w":[{"max-w":[dn,e,"none","full","min","max","fit","prose",{screen:[Gu]},Gu]}],h:[{h:[dn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[dn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[dn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[dn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Gu,Vu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",$E]}],"font-family":[{font:[m0]}],"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",dn]}],"line-clamp":[{"line-clamp":["none",tg,$E]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",bc,dn]}],"list-image":[{"list-image":["none",dn]}],"list-style-type":[{list:["none","disc","decimal",dn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",bc,Vu]}],"underline-offset":[{"underline-offset":["auto",bc,dn]}],"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:X()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dn]}],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",dn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...pe(),Sfe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",wfe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Efe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"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:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...ae(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:ae()}],"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:["",...ae()]}],"outline-offset":[{"outline-offset":[bc,dn]}],"outline-w":[{outline:[bc,Vu]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[bc,Vu]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Gu,Afe]}],"shadow-color":[{shadow:[m0]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...he(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":he()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Gu,dn]}],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":[x]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dn]}],duration:[{duration:H()}],ease:[{ease:["linear","in","out","in-out",dn]}],delay:[{delay:H()}],animate:[{animate:["none","spin","ping","pulse","bounce",dn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[p0,dn]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"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",dn]}],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",dn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":X()}],"scroll-mx":[{"scroll-mx":X()}],"scroll-my":[{"scroll-my":X()}],"scroll-ms":[{"scroll-ms":X()}],"scroll-me":[{"scroll-me":X()}],"scroll-mt":[{"scroll-mt":X()}],"scroll-mr":[{"scroll-mr":X()}],"scroll-mb":[{"scroll-mb":X()}],"scroll-ml":[{"scroll-ml":X()}],"scroll-p":[{"scroll-p":X()}],"scroll-px":[{"scroll-px":X()}],"scroll-py":[{"scroll-py":X()}],"scroll-ps":[{"scroll-ps":X()}],"scroll-pe":[{"scroll-pe":X()}],"scroll-pt":[{"scroll-pt":X()}],"scroll-pr":[{"scroll-pr":X()}],"scroll-pb":[{"scroll-pb":X()}],"scroll-pl":[{"scroll-pl":X()}],"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",dn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[bc,Vu,$E]}],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"]}}},Nfe=ffe(Rfe);function Je(...t){return Nfe(tr(t))}function Ng(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function g0({label:t,value:e,tone:n}){return v.jsxs("div",{className:Je("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:[v.jsx("span",{className:"flex items-center gap-1.5",children:t}),v.jsx("span",{className:"font-mono text-[10px]",children:e})]})}function Ife(){var n;const{data:t}=CC(3e3),e=()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}}));return v.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:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/20 pb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(a9,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Updates & Pflege"})]}),(t==null?void 0:t.last_check)&&v.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?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(g0,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),v.jsx(g0,{label:"Inferenz-Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),v.jsx(g0,{label:"Router (llama-swap)",tone:t.swap>0?"alert":"muted",value:t.swap>0?"Update verfügbar":"aktuell"}),v.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=>v.jsx(g0,{tone:r.update===!0?"alert":"muted",label:v.jsxs(v.Fragment,{children:[r.name,r.reachable===!1&&v.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))]}):v.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."})]}),v.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 ",v.jsx(lF,{className:"h-3.5 w-3.5"})]})]})}function gV({type:t,title:e,message:n,defaultValue:r,autoValue:i,autoLabel:s,onConfirm:a,onCancel:o}){const l=R.useRef(null);return v.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":e,children:v.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:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:e}),v.jsx("button",{onClick:o||(()=>a()),"aria-label":"Schließen",className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Ed,{className:"h-4 w-4","aria-hidden":"true"})})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:n}),t==="prompt"&&v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{ref:l,type:"text",defaultValue:r,"aria-label":e,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"&&a((d=l.current)==null?void 0:d.value)}}),i!==void 0&&v.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"})]}),v.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(t==="confirm"||t==="prompt")&&v.jsx("button",{onClick:o,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"}),v.jsx("button",{onClick:()=>{var d;const c=t==="prompt"?(d=l.current)==null?void 0:d.value:void 0;a(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((o,l,c)=>{e({type:"alert",title:o,message:l,onConfirm:()=>{e(null),c==null||c()}})},[]),i=R.useCallback((o,l,c,d)=>{e({type:"confirm",title:o,message:l,onConfirm:()=>{e(null),c()},onCancel:()=>{e(null),d==null||d()}})},[]),s=R.useCallback((o,l,c,d,f,p)=>{e({type:"prompt",title:o,message:l,defaultValue:c,autoValue:p==null?void 0:p.autoValue,autoLabel:p==null?void 0:p.autoLabel,onConfirm:y=>{e(null),d(y)},onCancel:()=>{e(null),f==null||f()}})},[]),a=t?v.jsx(gV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:a}}function kfe(){const t=Nd(),{data:e}=PC(3e3),{data:n}=Bg(),{showAlert:r,dialogElement:i}=tv(),[s,a]=R.useState(!1),o=(n==null?void 0:n.models)??[];async function l(c){try{await It("/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:qn.agentStatus}),a(!1)}catch(d){r("Fehler",`Fehler beim Wechseln des Gehirns: ${d.message}`)}}return v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx($c,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(e==null?void 0:e.terminal_url)&&v.jsxs("a",{href:Ng(e.terminal_url),target:"_blank",rel:"noopener",className:Je("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:[v.jsx(xg,{className:"h-3 w-3"})," Terminal öffnen"]})]}),e?v.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),v.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v.jsx("span",{className:Je("h-2 w-2 rounded-full",e.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-medium",children:e.gateway_reachable?"Online":"Offline"})]})]}),v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Terminal"}),v.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v.jsx("span",{className:Je("h-2 w-2 rounded-full",e.terminal_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-medium",children:e.terminal_reachable?"Online":"Offline"})]})]}),v.jsxs("div",{onClick:()=>a(!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:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),v.jsx(Md,{className:"h-3 w-3 text-primary"})]}),v.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[v.jsx(_C,{className:"h-3 w-3 shrink-0"}),e.brain_model||"auto"]})]}),v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),v.jsx(wC,{className:"h-3 w-3 text-primary"})]}),v.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[v.jsxs("div",{children:["Config: ",e.has_config?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),v.jsxs("div",{children:["Skills: ",e.has_skills?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),v.jsxs("div",{children:["Memory: ",e.has_memories?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):v.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),e&&v.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"Telegram"}),v.jsx("span",{className:Je("font-semibold",e.telegram_enabled?"text-emerald-400":""),children:e.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"MCP-Server"}),v.jsxs("span",{className:"font-semibold text-foreground",children:[e.mcp_server_count??0," verbunden"]})]}),v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"PC Executor"}),v.jsx("span",{className:Je("font-semibold",e.pc_executor_reachable?"text-emerald-400":""),children:e.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),e&&s&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.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:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(Md,{className:"h-4 w-4"}),v.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),v.jsx("button",{onClick:()=>a(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.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 (',v.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),v.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...o.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 v.jsxs("button",{onClick:()=>l(c),className:Je("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:[v.jsxs("div",{className:"flex flex-col text-left",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:c}),v.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")&&v.jsx(Sa,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function Ofe(){const t=Nd(),{data:e=[]}=BT({limit:3}),[n,r]=R.useState(""),[i,s]=R.useState("stable"),[a,o]=R.useState(!1);async function l(){if(!(!n.trim()||a)){o(!0);try{await It("/api/memory",{method:"POST",body:JSON.stringify({content:n,category:i,source:"dashboard"})}),r(""),t.invalidateQueries({queryKey:["memory"]})}catch(c){console.error(c)}finally{o(!1)}}}return v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[v.jsx(W1,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsx("textarea",{value:n,onChange:c=>r(c.target.value),"aria-label":"Fakt oder Regel im Gedächtnis speichern",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"}),v.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[v.jsxs("select",{value:i,onChange:c=>s(c.target.value),"aria-label":"Kategorie",className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[v.jsx("option",{value:"stable",children:"🔵 Fakt"}),v.jsx("option",{value:"instruction",children:"📋 Regel"}),v.jsx("option",{value:"user",children:"👤 User"}),v.jsx("option",{value:"versioned",children:"🟡 Version"})]}),v.jsxs("button",{onClick:l,disabled:!n.trim()||a,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:[v.jsx(OT,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),v.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[v.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),v.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:e.length===0?v.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):e.map(c=>v.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[v.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}),v.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:c.content,children:c.content})]},c.id))})]})]}),v.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 I3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Lfe(){const{data:t}=TC(3e3),e=L7(),n=e[e.length-1],r=n?Math.round(n.prompt+n.completion):0;return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(bC,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t&&v.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[v.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:r.toLocaleString("de-DE")}),v.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),t&&v.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[v.jsxs("div",{children:[t.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",v.jsxs("span",{className:"text-emerald-400/90",children:[t.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),v.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",t.prompt_tokens.toLocaleString("de-DE")," · Output ",t.completion_tokens.toLocaleString("de-DE")]})]})]}),v.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:I3.map(i=>v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),v.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),v.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?v.jsx(uV,{data:e,series:I3,unit:" tok/s",yMode:"auto",height:150}):v.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),v.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 Dfe(){const{data:t}=w7(3e3),{showAlert:e,dialogElement:n}=tv(),[r,i]=R.useState({});async function s(a){i(o=>({...o,[a]:!0}));try{const o=await It("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:a})});o.ok||e("Fehler",`Neustart fehlgeschlagen: ${o.err||"Unbekannt"}`)}catch(o){e("Fehler",`Fehler: ${o.message}`)}finally{i(o=>({...o,[a]:!1}))}}return v.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:[v.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(rw,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Dienste"})]}),v.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?v.jsxs("div",{className:"flex flex-1 flex-col",children:[v.jsx("div",{className:"space-y-1.5",children:t.services.map(a=>v.jsxs("div",{className:"group flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[v.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[v.jsx("span",{className:Je("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",a.ok?"bg-emerald-500":"bg-amber-500")}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"truncate text-xs font-bold text-foreground",children:a.name}),v.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:a.url})]})]}),v.jsx("button",{onClick:()=>s(a.name),disabled:r[a.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:v.jsx(Jf,{className:Je("h-3.5 w-3.5",r[a.name]&&"animate-spin")})})]},a.name))}),v.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:[v.jsxs("a",{href:Ng(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:[v.jsx(xg,{className:"h-3 w-3"})," Engine"]}),v.jsxs("a",{href:Ng(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:[v.jsx(xg,{className:"h-3 w-3"})," Gateway"]})]})]}):v.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Dienste…"}),n]})}const XE=[{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 Ufe({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 v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[v.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[v.jsx("span",{className:"text-xs font-semibold text-foreground",children:e}),v.jsx("span",{className:"truncate text-[10px] text-muted-foreground/60",children:n})]}),i?v.jsx("span",{className:"shrink-0 font-mono text-sm font-bold tabular-nums text-foreground",children:jb(t.p50_ms)}):v.jsx("span",{className:"shrink-0 text-[10px] italic text-muted-foreground/50",children:"noch keine Messungen"})]}),v.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-background/50 border border-border/30",children:v.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&&v.jsxs("div",{className:"flex items-center gap-3 font-mono text-[10px] text-muted-foreground/65",children:[v.jsxs("span",{children:["p50 ",jb(t.p50_ms)]}),v.jsxs("span",{children:["p95 ",jb(t.p95_ms)]}),v.jsxs("span",{children:["zuletzt ",jb(t.last_ms)]}),v.jsxs("span",{className:"text-muted-foreground/45",children:["· n=",t.count]})]})]})}function jfe(){const{data:t}=M7(5e3),e=Math.max(1,...XE.map(r=>{var i;return((i=t==null?void 0:t[r.key])==null?void 0:i.p95_ms)??0})),n=XE.some(r=>{var i;return(((i=t==null?void 0:t[r.key])==null?void 0:i.count)??0)>0});return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[v.jsx(dF,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Sprach-Latenz"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),v.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:XE.map(r=>v.jsx(Ufe,{stat:t==null?void 0:t[r.key],label:r.label,hint:r.hint,maxP95:e},r.key))}),v.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."})]})}const Ffe=["fast","heavy","coder","vision","scout"],zfe={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"},vV=t=>t&&zfe[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function Bfe({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 v.jsxs("span",{className:Je("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 k3(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 Hfe(){var y,b,S;const{data:t}=Bg(2e3),{data:e}=TC(2e3),{data:n}=$y(),r=(t==null?void 0:t.models)??[],i=(t==null?void 0:t.running)??[],s=((y=n==null?void 0:n.gpu)==null?void 0:y.gtt_total)||((b=n==null?void 0:n.gpu)==null?void 0:b.vram_total)||0,a=((S=n==null?void 0:n.gpu)==null?void 0:S.gtt_used)||0,o=s>0?Math.min(100,a/s*100):0,l=o>=88?"bg-red-500":o>=70?"bg-amber-500":"bg-teal-500",c=o>=88?"text-red-400":o>=70?"text-amber-400":"text-foreground",d=R.useRef(null),[f,p]=R.useState(!1);return R.useEffect(()=>{if(!e)return;const w=e.total_tokens;if(d.current!==null&&w>d.current){p(!0);const x=setTimeout(()=>p(!1),4e3);return d.current=w,()=>clearTimeout(x)}d.current=w},[e==null?void 0:e.total_tokens]),v.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",children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(nw,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Modelle"})]}),v.jsxs("span",{className:Je("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",f?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[f?v.jsx(wh,{className:"h-3 w-3 animate-pulse"}):v.jsx(Z8,{className:"h-3 w-3"}),f?"Inferenz aktiv":"Idle"]})]}),s>0&&v.jsxs("div",{className:"mb-4",children:[v.jsxs("div",{className:"flex items-center justify-between text-[10px] font-mono text-muted-foreground/80 mb-1",children:[v.jsx("span",{className:"uppercase tracking-wider font-semibold",children:"Speicher-Pool"}),v.jsxs("span",{children:[v.jsx("span",{className:Je("font-bold",c),children:sd(a)})," / ",sd(s)," GB belegt"]})]}),v.jsx("div",{className:"h-1.5 w-full rounded-full bg-background/50 border border-border/30 overflow-hidden",children:v.jsx("div",{className:Je("h-full rounded-full transition-all duration-500",l),style:{width:`${o}%`}})})]}),v.jsx("div",{className:"space-y-2 flex-1",children:Ffe.map(w=>{var T;const x=r.find(P=>P.role===w),M=x?i.includes(x.name):!1;return v.jsxs("div",{className:Je("flex items-center justify-between gap-2 p-2 rounded-xl border transition-all duration-300",M?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":x?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[v.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v.jsx("span",{className:Je("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",vV(w)),children:w}),v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:x?(T=x.name.split("/").pop())==null?void 0:T.replace(/\.gguf$/i,""):"nicht zugewiesen"}),x&&v.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap text-muted-foreground/70",children:[v.jsx("span",{className:"text-[9px] font-mono",children:Io(x.size_bytes)}),x.prompt_cache&&v.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"}),x.spec_active&&v.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: ${x.spec_draft_model})`,children:"SPEC"}),x.parallel_slots>1&&v.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:`${x.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",x.parallel_slots]}),x.incomplete&&v.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"})]})]})]}),v.jsx("span",{className:"shrink-0",children:x?M?v.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[v.jsx("span",{className:Je("h-1.5 w-1.5 rounded-full bg-emerald-500",f&&"animate-pulse")})," warm"]}):v.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):v.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},w)})}),v.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. Details & Routing im Modell-Manager."})]})}function O3({children:t}){return v.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t})}function Vfe(){return v.jsxs("div",{className:"space-y-7",children:[v.jsxs("div",{children:[v.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"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),v.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[v.jsx(Jde,{}),v.jsx(Lfe,{}),v.jsx(Hfe,{})]}),v.jsxs("section",{children:[v.jsx(O3,{children:"Stack & Telemetrie"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[v.jsx(Dfe,{}),v.jsx(jfe,{})]})]}),v.jsxs("section",{children:[v.jsx(O3,{children:"Betrieb & Wissen"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[v.jsx(Ife,{}),v.jsx(kfe,{}),v.jsx(Ofe,{})]})]})]})}function Gfe(){const t=Nd(),{data:e=[]}=A7(2e3),{showAlert:n,dialogElement:r}=tv();async function i(o){try{await It(`/api/jobs/${o}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:qn.jobs})}catch(l){n("Fehler",l.message)}}const s=e.filter(o=>o.state==="running"||o.state==="queued"),a=e.filter(o=>o.state!=="running"&&o.state!=="queued").slice(-3);return s.length===0&&a.length===0?null:v.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:[v.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),s.map(o=>v.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[v.jsxs("div",{className:"flex justify-between items-center text-xs",children:[v.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:o.label}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-muted-foreground font-mono",children:[o.progress??0,"% • ",WT(o.done_bytes),"/",WT(o.total_bytes),o.eta_s?` • ETA ${j7(o.eta_s)}`:""]}),v.jsx("button",{onClick:()=>i(o.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"})]})]}),v.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:v.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${o.progress??0}%`}})})]},o.id)),a.map(o=>v.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[v.jsx("span",{className:"truncate",children:o.label}),v.jsx("span",{className:Je("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",o.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:o.state})]},o.id)),r]})}function Pf({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 v.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${n[e]}`,children:t})}function L3({caps:t}){return t?v.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&v.jsx(Pf,{children:"💻 Code"}),t.vision&&v.jsx(Pf,{children:"👁 Bild"}),t.reasoning&&v.jsx(Pf,{children:"🧠 Reason"}),t.moe&&v.jsxs(Pf,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&v.jsx(Pf,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&v.jsx(Pf,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&v.jsx(Pf,{children:"🔢 Embed"})]}):null}function Wfe({model:t,onClose:e,onChanged:n}){var S,w;const{data:r,isLoading:i}=C7(t.gguf_path),[s,a]=R.useState(null),[o,l]=R.useState(""),c=r==null?void 0:r.target_vocab,d=(r==null?void 0:r.drafts)??[],f=d.filter(x=>x.compatible===!0),p=t.spec_draft_model;async function y(x){a(x??"__clear__"),l("");try{await It(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:x})}),n(),e()}catch(M){l(String((M==null?void 0:M.message)||M)),a(null)}}const b=x=>{var M;return x?`${x.pre??"?"} · ${((M=x.n_vocab)==null?void 0:M.toLocaleString())??"?"} Tokens`:"—"};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.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:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[v.jsx(wh,{className:"h-4 w-4"})," Speculative Draft"]}),v.jsx("button",{onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.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 ',v.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),v.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:[v.jsx("span",{className:"text-muted-foreground",children:(S=t.name.split("/").pop())==null?void 0:S.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-foreground",children:["Vocab: ",b(c)]})]}),t.spec_active&&p&&v.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:[v.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[v.jsx(Sa,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",p]}),v.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)&&v.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:[v.jsx(bg,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),v.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?v.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):d.length===0?v.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 ",v.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(x=>{var P,O;const M=x.filename===p,T=x.compatible===!0;return v.jsxs("div",{className:Je("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:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:x.filename}),v.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[Io(x.size_bytes)," · Vocab: ",b(x.vocab)]})]}),T?M?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[v.jsx(Sa,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("button",{onClick:()=>y(x.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"}):v.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:x.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(P=x.vocab)==null?void 0:P.pre}/${(O=x.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:[v.jsx(bg,{className:"h-3.5 w-3.5"})," ",x.compatible===!1?"Vocab ≠":"n/a"]})]},x.path)})}),!i&&(r==null?void 0:r.target_exists)&&d.length>0&&f.length===0&&v.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=",v.jsx("span",{className:"font-mono",children:c==null?void 0:c.pre}),", n_vocab=",v.jsx("span",{className:"font-mono",children:(w=c==null?void 0:c.n_vocab)==null?void 0:w.toLocaleString()}),")."]}),o&&v.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:o})]})})}const $fe=["fast","heavy","heavy_chars"],Xfe=["coder_lite","coder","coding_escalate_chars"];function qfe(){const t=Nd(),{data:e,isLoading:n}=E7(),[r,i]=R.useState(null),[s,a]=R.useState(!1),[o,l]=R.useState(""),[c,d]=R.useState(0);if(R.useEffect(()=>{e!=null&&e.policy&&!r&&i({...e.policy})},[e,r]),n||!e||!r)return v.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=x=>e.fields.find(M=>M.key===x),p=Object.keys(r).some(x=>r[x]!==e.policy[x]),y=(x,M)=>{i(T=>T&&{...T,[x]:M}),l("")},b=x=>y(x,e.defaults[x]);async function S(){if(!r)return;const x={};for(const M of Object.keys(r))r[M]!==e.policy[M]&&(x[M]=r[M]);if(Object.keys(x).length!==0){a(!0),l("");try{const{policy:M}=await x7(x);i({...M}),t.invalidateQueries({queryKey:qn.routingPolicy}),t.invalidateQueries({queryKey:qn.routing}),d(Date.now()),setTimeout(()=>d(0),2e3)}catch(M){l(M.message||String(M))}finally{a(!1)}}}function w({k:x}){const M=f(x),T=r[x],P=r[x]===e.defaults[x];return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsx("label",{className:"text-[10px] font-semibold text-muted-foreground",children:M.label}),!P&&v.jsxs("button",{onClick:()=>b(x),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[x])||"leer"})`,children:[v.jsx(hF,{className:"h-2.5 w-2.5"})," Default"]})]}),M.type==="bool"?v.jsxs("button",{onClick:()=>y(x,!T),className:Je("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:[v.jsx("span",{children:T?"An":"Aus"}),v.jsx("span",{className:Je("h-3.5 w-3.5 rounded-full transition-colors",T?"bg-emerald-400":"bg-muted-foreground/40")})]}):M.type==="int"?v.jsx("input",{type:"number",value:T,min:M.min,max:M.max,"aria-label":M.label,onChange:O=>y(x,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"}):v.jsx("input",{type:"text",value:T,"aria-label":M.label,spellCheck:!1,placeholder:x==="coder_lite"?"(leer = aus)":"",onChange:O=>y(x,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 v.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:[v.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(o9,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lane-Routing & Policy"}),v.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"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[o&&v.jsx("span",{className:"text-[10px] text-red-400 max-w-[280px] truncate",title:o,children:o}),c>0&&v.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-emerald-400",children:[v.jsx(Sa,{className:"h-3.5 w-3.5"})," gespeichert"]}),v.jsxs("button",{onClick:S,disabled:!p||s,className:Je("h-8 px-4 rounded-lg text-[10px] font-bold uppercase tracking-wide transition-all flex items-center gap-1.5",p&&!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?v.jsx($1,{className:"h-3.5 w-3.5 animate-spin"}):null,"Speichern"]})]})]}),v.jsxs("p",{className:"text-[10px] text-muted-foreground/70 leading-relaxed -mt-1",children:["Welches echte Modell hinter den virtuellen Lanes ",v.jsx("code",{className:"text-cyan-300",children:"chat"})," und"," ",v.jsx("code",{className:"text-cyan-300",children:"coding"})," steckt. Änderungen greifen sofort (kein Neustart). Die Keyword-Heuristiken bleiben im Code."]}),v.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[v.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[v.jsx(K8,{className:"h-4 w-4 text-teal-400"}),v.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"chat"}),v.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(= auto)"})]}),$fe.map(x=>v.jsx(w,{k:x},x))]}),v.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[v.jsx(I8,{className:"h-4 w-4 text-indigo-400"}),v.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"coding"}),v.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(agentisch → immer Coder)"})]}),Xfe.map(x=>v.jsx(w,{k:x},x))]})]}),v.jsx("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4",children:v.jsx("div",{className:"max-w-xs",children:v.jsx(w,{k:"fast_no_think"})})})]})}function Kfe(){var de,Z,Ve,Le;const t=Nd(),{data:e,isLoading:n,error:r}=Bg(4e3),{data:i}=CC(4e3),{data:s}=T7(),{data:a}=$y(),{data:o}=S7(),{showAlert:l,showConfirm:c,showPrompt:d,dialogElement:f}=tv(),p=(e==null?void 0:e.models)??[],y=(e==null?void 0:e.running)??[],b=r?String(r):"",S=()=>{t.invalidateQueries({queryKey:qn.models}),t.invalidateQueries({queryKey:qn.routing})},w=(de=o==null?void 0:o.groups)==null?void 0:de.brains,x=(w==null?void 0:w.members)??[],M=ne=>x.includes(ne),T=x.some(ne=>y.includes(ne));async function P(ne){if(!w){l("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 qe=x.includes(ne)?x.filter(Ze=>Ze!==ne):[...x,ne];try{await y7("brains",qe,w.swap??!1,w.persist??!0),t.invalidateQueries({queryKey:qn.groups}),S()}catch(Ze){l("Fehler",`Ko-Residenz konnte nicht geändert werden: ${Ze.message||Ze}`)}}const[O,N]=R.useState(null),[D,z]=R.useState(null),[V,k]=R.useState(null),[j,X]=R.useState("grid"),[ee,ie]=R.useState("all"),pe=p.filter(ne=>ee==="in_use"?!!ne.role||y.includes(ne.name):!0);async function ae(ne){try{await It(`/api/models/${encodeURIComponent(ne)}/load`,{method:"POST"}),S()}catch(Ce){l("Fehler",`Fehler beim Laden des Modells: ${Ce.message}`)}}async function he(ne){if(w&&T&&!M(ne)){const Ce=x.filter(qe=>y.includes(qe)).map(qe=>qe.split("/").pop()).join(", ");c("Verdrängt das Hirn?",`„${ne.split("/").pop()}“ ist nicht in der Ko-Residenz-Gruppe „brains“. Beim Laden wirft es das aktuell warme Hirn (${Ce}) raus — Lucy verliert Hirn bzw. Augen. + `).concat(P.x,",").concat(P.y),N=Vi(t.id)?uy("recharts-radial-line-"):t.id;return R.createElement("text",kc({},r,{dominantBaseline:"central",className:tr("recharts-radial-bar-label",a)}),R.createElement("defs",null,R.createElement("path",{id:N,d:O})),R.createElement("textPath",{xlinkHref:"#".concat(N)},n))},Yae=(t,e,n)=>{var r=t.cx,i=t.cy,s=t.innerRadius,a=t.outerRadius,o=t.startAngle,l=t.endAngle,c=(o+l)/2;if(n==="outside"){var d=Bi(r,i,a+e,c),f=d.x,p=d.y;return{x:f,y:p,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+a)/2,b=Bi(r,i,y,c),S=b.x,w=b.y;return{x:S,y:w,textAnchor:"middle",verticalAnchor:"middle"}},W_=t=>t!=null&&"cx"in t&&kt(t.cx),Zae={angle:0,offset:5,zIndex:Ms.label,position:"middle",textBreakAll:!1};function Qae(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 od(t){var e=Za(t,Zae),n=e.viewBox,r=e.parentViewBox,i=e.position,s=e.value,a=e.children,o=e.content,l=e.className,c=l===void 0?"":l,d=e.textBreakAll,f=e.labelRef,p=$ae(),y=gH(),b=i==="center"?y:p??y,S,w,x;n==null?S=b:W_(n)?S=n:S=WC(n);var M=Qae(S);if(!S||Vi(s)&&Vi(a)&&!R.isValidElement(o)&&typeof o!="function")return null;var T=V0(V0({},e),{},{viewBox:S});if(R.isValidElement(o)){T.labelRef;var P=$L(T,jae);return R.cloneElement(o,P)}if(typeof o=="function"){T.content;var O=$L(T,Fae);if(w=R.createElement(o,O),R.isValidElement(w))return w}else w=Xae(e);var N=Xa(e);if(W_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return Kae(e,i,w,N,S);x=Yae(S,e.offset,e.position)}else{if(!M)return null;var D=Uae({viewBox:M,position:i,offset:e.offset,parentViewBox:W_(r)?void 0:r});x=V0(V0({x:D.x,y:D.y,textAnchor:D.horizontalAnchor,verticalAnchor:D.verticalAnchor},D.width!==void 0?{width:D.width}:{}),D.height!==void 0?{height:D.height}:{})}return R.createElement(su,{zIndex:e.zIndex},R.createElement(Z2,kc({ref:f,className:tr("recharts-label",c)},N,x,{textAnchor:dH(N.textAnchor)?N.textAnchor:x.textAnchor,breakAll:d}),w))}od.displayName="Label";var Jae=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?R.createElement(od,kc({key:"label-implicit"},r)):Nl(t)?R.createElement(od,kc({key:"label-implicit",value:t},r)):R.isValidElement(t)?t.type===od?R.cloneElement(t,V0({key:"label-implicit"},r)):R.createElement(od,kc({key:"label-implicit",content:t},r)):Q2(t)?R.createElement(od,kc({key:"label-implicit",content:t},r)):t&&typeof t=="object"?R.createElement(od,kc({},t,{key:"label-implicit"},r)):null};function eoe(t){var e=t.label,n=t.labelRef,r=gH();return Jae(e,r,n)||null}var toe=["valueAccessor"],noe=["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(Cae(e))return e},vH=R.createContext(void 0),soe=vH.Provider,yH=R.createContext(void 0);yH.Provider;function aoe(){return R.useContext(vH)}function ooe(){return R.useContext(yH)}function $_(t){var e=t.valueAccessor,n=e===void 0?ioe:e,r=qL(t,toe),i=r.dataKey;r.clockWise;var s=r.id,a=r.textBreakAll,o=r.zIndex,l=qL(r,noe),c=aoe(),d=ooe(),f=c||d;return!f||!f.length?null:R.createElement(su,{zIndex:o??Ms.label},R.createElement(qa,{className:"recharts-label-list"},f.map((p,y)=>{var b,S=Vi(i)?n(p,y):yi(p.payload,i),w=Vi(s)?{}:{id:"".concat(s,"-").concat(y)};return R.createElement(od,Ww({key:"label-".concat(y)},Xa(p),l,w,{fill:(b=r.fill)!==null&&b!==void 0?b:p.fill,parentViewBox:p.parentViewBox,value:S,textBreakAll:a,viewBox:p.viewBox,index:y,zIndex:0}))})))}$_.displayName="LabelList";function loe(t){var e=t.label;return e?e===!0?R.createElement($_,{key:"labelList-implicit"}):R.isValidElement(e)||Q2(e)?R.createElement($_,{key:"labelList-implicit",content:e}):typeof e=="object"?R.createElement($_,Ww({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function IP(){return IP=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=tr("recharts-dot",i);return kt(e)&&kt(n)&&kt(r)?R.createElement("circle",IP({},zo(t),LC(t),{className:s,cx:e,cy:n,r})):null},coe={radiusAxis:{},angleAxis:{}},bH=cs({name:"polarAxis",initialState:coe,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]}}}),FS=bH.actions;FS.addRadiusAxis;FS.removeRadiusAxis;FS.addAngleAxis;FS.removeAngleAxis;var uoe=bH.reducer;function doe(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var _H=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;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 YL(t){for(var e=1;e{r||(i.current===null?n(Rre(e)):i.current!==e&&n(Nre({prev:i.current,next:e})),i.current=e)},[e,n,r]),R.useLayoutEffect(()=>()=>{i.current&&(n(Ire(i.current)),i.current=null)},[n]),null}function _oe(t){var e=t.legendPayload,n=Wr(),r=Js(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(iZ(e)):i.current!==e&&n(sZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),R.useLayoutEffect(()=>()=>{i.current&&(n(aZ(i.current)),i.current=null)},[n]),null}function woe(t,e){return Aoe(t)||Eoe(t,e)||Moe(t,e)||Soe()}function Soe(){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 Moe(t,e){if(t){if(typeof t=="string")return ZL(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)?ZL(t,e):void 0}}function ZL(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 eR(r,e)}function Coe(t,e){var n=e.map((r,i)=>t[i]);return eR(n,e)}function Roe(t,e){for(var n=new Map,r=0;r{var y=n(f,p);if(y!=null){var b=r.get(y);if(b!==void 0)return i.add(y),b}}),a=[];for(var o of r){var l=woe(o,2),c=l[0],d=l[1];i.has(c)||a.push(d)}return eR(s,e,a)}function kP(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===J2?Poe(t,e):n===Toe?Coe(t,e):Noe(t,e,n)}function SH(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(a,o){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(o===0){i.current=!0;return}o===1&&(r.current=a),o>0&&i.current&&l&&(e.current=a)},[e]);return{startValue:r.current,syncStepValue:s}}function Ioe(t,e){return Doe(t)||Loe(t,e)||Ooe(t,e)||koe()}function koe(){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 Ooe(t,e){if(t){if(typeof t=="string")return QL(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)?QL(t,e):void 0}}function QL(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]),o=R.useCallback(()=>{typeof e=="function"&&e(),s(!1)},[e]);return{isAnimating:i,handleAnimationStart:a,handleAnimationEnd:o}}function joe(t){var e,n=t.animationInput,r=t.animationIdPrefix,i=t.items,s=t.previousItemsRef,a=t.isAnimationActive,o=t.animationBegin,l=t.animationDuration,c=t.animationEasing,d=t.onAnimationStart,f=t.onAnimationEnd,p=t.animationInterpolateFn,y=t.animationMatchBy,b=t.shouldUpdatePreviousRef,S=t.children,w=t.layout,x=j4(n,r),M=SH(x,s),T=(e=M.startValue)!==null&&e!==void 0?e:null,P=kP(T,i,y??J2);return R.createElement(U4,{animationId:x,begin:o,duration:l,isActive:a,easing:c,onAnimationEnd:f,onAnimationStart:d,key:x},O=>{var N=T==null,D=i==null?i:p(P,O,w),z=b?b(O):O>0;return M.syncStepValue(D,O,z),D==null?null:S(D,O,N)})}var BE;function Foe(t,e){return Voe(t)||Hoe(t,e)||Boe(t,e)||zoe()}function zoe(){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 Boe(t,e){if(t){if(typeof t=="string")return JL(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)?JL(t,e):void 0}}function JL(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=Foe(t,1),n=e[0];return n},MH=(BE=G1.useId)!==null&&BE!==void 0?BE:Goe;function Woe(t,e){var n=MH();return e||(t?"".concat(t,"-").concat(n):n)}var $oe=R.createContext(void 0),Xoe=t=>{var e=t.id,n=t.type,r=t.children,i=Woe("recharts-".concat(n),e);return R.createElement($oe.Provider,{value:i},r(i))},qoe={cartesianItems:[],polarItems:[]},EH=cs({name:"graphicalItems",initialState:qoe,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=Ga(t).cartesianItems.indexOf(r);s>-1&&(t.cartesianItems[s]=i)},prepare:ar()},removeCartesianGraphicalItem:{reducer(t,e){var n=Ga(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=Ga(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=Ga(t).polarItems.indexOf(r);s>-1&&(t.polarItems[s]=i)},prepare:ar()}}}),Qg=EH.actions,Koe=Qg.addCartesianGraphicalItem,Yoe=Qg.replaceCartesianGraphicalItem,Zoe=Qg.removeCartesianGraphicalItem;Qg.addPolarGraphicalItem;Qg.removePolarGraphicalItem;Qg.replacePolarGraphicalItem;var Qoe=EH.reducer,Joe=t=>{var e=Wr(),n=R.useRef(null);return R.useLayoutEffect(()=>{n.current===null?e(Koe(t)):n.current!==t&&e(Yoe({prev:n.current,next:t})),n.current=t},[e,t]),R.useLayoutEffect(()=>()=>{n.current&&(e(Zoe(n.current)),n.current=null)},[e]),null},ele=R.memo(Joe),tle=["points"];function e3(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 HE(t){for(var e=1;e{var x,M,T=HE(HE(HE({r:3},a),p),{},{index:w,cx:(x=S.x)!==null&&x!==void 0?x:void 0,cy:(M=S.y)!==null&&M!==void 0?M:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return R.createElement(ole,{key:"dot-".concat(w),option:n,dotProps:T,className:i})}),b={};return o&&l!=null&&(b.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(l,")")),R.createElement(su,{zIndex:d},R.createElement(qa,$w({className:r},b),y))}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({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),Sle=ke([wle,Jc,eu],(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)}}),tR=()=>Ft(Sle),Mle=()=>Ft(Rie);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 VE(t){for(var e=1;e{var e=t.point,n=t.childIndex,r=t.mainColor,i=t.activeDot,s=t.dataKey,a=t.clipPath;if(i===!1||e.x==null||e.y==null)return null;var o={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=VE(VE(VE({},o),Q1(i)),LC(i)),c;return R.isValidElement(i)?c=R.cloneElement(i,l):typeof i=="function"?c=i(l):c=R.createElement(xH,l),R.createElement(qa,{className:"recharts-active-dot",clipPath:a},c)};function i3(t){var e=t.points,n=t.mainColor,r=t.activeDot,i=t.itemDataKey,s=t.clipPath,a=t.zIndex,o=a===void 0?Ms.activeDot:a,l=Ft(Sy),c=Mle();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return Vi(d)?null:R.createElement(su,{zIndex:o},R.createElement(Ple,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var Cle=t=>{var e=t.chartData,n=Wr(),r=Js();return R.useEffect(()=>r?()=>{}:(n(AL(e)),()=>{n(AL(void 0))}),[e,n,r]),null},s3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},PH=cs({name:"brush",initialState:s3,reducers:{setBrushSettings(t,e){return e.payload==null?s3:e.payload}}});PH.actions.setBrushSettings;var Rle=PH.reducer;function Nle(t){return(t%180+180)%180}var Ile=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=Nle(i),a=s*Math.PI/180,o=Math.atan(r/n),l=a>o&&a{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=Ga(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=Ga(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=Ga(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),Jg=CH.actions;Jg.addDot;Jg.removeDot;Jg.addArea;Jg.removeArea;Jg.addLine;Jg.removeLine;var Ole=CH.reducer;function Lle(t,e){return Fle(t)||jle(t,e)||Ule(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 Ule(t,e){if(t){if(typeof t=="string")return a3(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)?a3(t,e):void 0}}function a3(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=Lle(n,1),i=r[0],s=tR();if(s==null)return null;var a=s.x,o=s.y,l=s.width,c=s.height;return R.createElement(zle.Provider,{value:i},R.createElement("defs",null,R.createElement("clipPath",{id:i},R.createElement("rect",{x:a,y:o,height:c,width:l}))),e)};function RH(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 Gle(t,e){return RH(t,e+1)}function Wle(t,e,n,r,i){for(var s=(r||[]).slice(),a=e.start,o=e.end,l=0,c=1,d=a,f=function(){var b=r==null?void 0:r[l];if(b===void 0)return{v:RH(r,c)};var S=l,w,x=()=>(w===void 0&&(w=n(b,S)),w),M=b.coordinate,T=l===0||Ey(t,M,x,d,o);T||(l=0,d=a,c+=1),T&&(d=M+t*(x()/2+i),l+=c)},p;c<=s.length;)if(p=f(),p)return p.v;return[]}function $le(t,e,n,r,i){var s=(r||[]).slice(),a=s.length;if(a===0)return[];for(var o=e.start,l=e.end,c=1;c<=a;c++){for(var d=(a-1)%c,f=o,p=!0,y=function(){var P=r[S];if(P==null)return 0;var O=S,N,D=()=>(N===void 0&&(N=n(P,O)),N),z=P.coordinate,V=S===d||Ey(t,z,D,f,l);if(!V)return p=!1,1;V&&(f=z+t*(D()/2+i))},b,S=d;S(S===void 0&&(S=n(y,p)),S);if(p===a-1){var x=t*(b.coordinate+t*w()/2-l);s[p]=b=rs(rs({},b),{},{tickCoord:x>0?b.coordinate-x*t:b.coordinate})}else s[p]=b=rs(rs({},b),{},{tickCoord:b.coordinate});if(b.tickCoord!=null){var M=Ey(t,b.tickCoord,w,o,l);M&&(l=b.tickCoord-t*(w()/2+i),s[p]=rs(rs({},b),{},{isShow:!0}))}},d=a-1;d>=0;d--)c(d);return s}function Zle(t,e,n,r,i,s){var a=(r||[]).slice(),o=a.length,l=e.start,c=e.end;if(s){var d=r[o-1];if(d!=null){var f=n(d,o-1),p=t*(d.coordinate+t*f/2-c);if(a[o-1]=d=rs(rs({},d),{},{tickCoord:p>0?d.coordinate-p*t:d.coordinate}),d.tickCoord!=null){var y=Ey(t,d.tickCoord,()=>f,l,c);y&&(c=d.tickCoord-t*(f/2+i),a[o-1]=rs(rs({},d),{},{isShow:!0}))}}}for(var b=s?o-1:o,S=function(M){var T=a[M];if(T==null)return 1;var P=T,O,N=()=>(O===void 0&&(O=n(T,M)),O);if(M===0){var D=t*(P.coordinate-t*N()/2-l);a[M]=P=rs(rs({},P),{},{tickCoord:D<0?P.coordinate-D*t:P.coordinate})}else a[M]=P=rs(rs({},P),{},{tickCoord:P.coordinate});if(P.tickCoord!=null){var z=Ey(t,P.tickCoord,N,l,c);z&&(l=P.tickCoord+t*(N()/2+i),a[M]=rs(rs({},P),{},{isShow:!0}))}},w=0;w{var D=typeof c=="function"?c(O.value,N):O.value;return b==="width"?Hle(q0(D,{fontSize:e,letterSpacing:n}),S,f):q0(D,{fontSize:e,letterSpacing:n})[b]},x=i[0],M=i[1],T=i.length>=2&&x!=null&&M!=null?Va(M.coordinate-x.coordinate):1,P=Vle(s,T,b);return l==="equidistantPreserveStart"?Wle(T,P,w,i,a):l==="equidistantPreserveEnd"?$le(T,P,w,i,a):(l==="preserveStart"||l==="preserveStartEnd"?y=Zle(T,P,w,i,a,l==="preserveStartEnd"):y=Yle(T,P,w,i,a),y.filter(O=>O.isShow))}var Qle=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,i=r,s=t.tickSize,a=s===void 0?0:s,o=t.tickMargin,l=o===void 0?0:o,c=0;if(e){Array.from(e).forEach(y=>{if(y){var b=y.getBoundingClientRect();b.width>c&&(c=b.width)}});var d=n?n.getBoundingClientRect().width:0,f=a+l,p=c+f+d+(n?i:0);return Math.round(p)}return 0},Jle={xAxis:{},yAxis:{}},NH=cs({name:"renderedTicks",initialState:Jle,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]}}}),IH=NH.actions,ece=IH.setRenderedTicks,tce=IH.removeRenderedTicks,nce=NH.reducer,rce=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function l3(t,e){return oce(t)||ace(t,e)||sce(t,e)||ice()}function ice(){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 sce(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||n==null)return Hg;var s=e.map(a=>({value:a.value,coordinate:a.coordinate,offset:a.offset,index:a.index}));return i(ece({ticks:s,axisId:r,axisType:n})),()=>{i(tce({axisId:r,axisType:n}))}},[i,e,r,n]),null}var xce=R.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,i=t.tick,s=t.tickLine,a=t.stroke,o=t.tickFormatter,l=t.unit,c=t.padding,d=t.tickTextProps,f=t.orientation,p=t.mirror,y=t.x,b=t.y,S=t.width,w=t.height,x=t.tickSize,M=t.tickMargin,T=t.fontSize,P=t.letterSpacing,O=t.getTicksConfig,N=t.events,D=t.axisType,z=t.axisId,V=nR(Ar(Ar({},O),{},{ticks:r}),T,P),k=zo(O),j=Q1(i),X=dH(k.textAnchor)?k.textAnchor:mce(f,p),ee=gce(f,p),ie={};typeof s=="object"&&(ie=s);var pe=Ar(Ar({},k),{},{fill:"none"},ie),ae=V.map(J=>Ar({entry:J},pce(J,y,b,S,w,f,x,p,M))),he=ae.map(J=>{var Y=J.entry,H=J.line;return R.createElement(qa,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(Y.value,"-").concat(Y.coordinate,"-").concat(Y.tickCoord)},s&&R.createElement("line",Fh({},pe,H,{className:tr("recharts-cartesian-axis-tick-line",Yh(s,"className"))})))}),B=ae.map((J,Y)=>{var H,G,le=J.entry,se=J.tick,ce=Ar(Ar(Ar(Ar({verticalAnchor:ee},k),{},{textAnchor:X,stroke:"none",fill:a},se),{},{index:Y,payload:le,visibleTicksCount:V.length,tickFormatter:o,padding:c},d),{},{angle:(H=(G=d==null?void 0:d.angle)!==null&&G!==void 0?G:k.angle)!==null&&H!==void 0?H:0}),Se=Ar(Ar({},ce),j);return R.createElement(qa,Fh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(le.value,"-").concat(le.coordinate,"-").concat(le.tickCoord)},SX(N,le,Y)),i&&R.createElement(vce,{option:i,tickProps:Se,value:"".concat(typeof o=="function"?o(le.value,Y):le.value).concat(l||"")}))});return R.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(D,"-ticks")},R.createElement(yce,{ticks:V,axisId:z,axisType:D}),B.length>0&&R.createElement(su,{zIndex:Ms.label},R.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(D,"-tick-labels"),ref:e},B)),he.length>0&&R.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(D,"-tick-lines")},he))}),bce=R.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,i=t.height,s=t.className,a=t.hide,o=t.ticks,l=t.axisType,c=t.axisId,d=lce(t,rce),f=R.useState(""),p=l3(f,2),y=p[0],b=p[1],S=R.useState(""),w=l3(S,2),x=w[0],M=w[1],T=R.useRef(null);R.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return Qle({ticks:T.current,label:(O=t.labelRef)===null||O===void 0?void 0:O.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var P=R.useCallback(O=>{if(O){var N=O.getElementsByClassName("recharts-cartesian-axis-tick-value");T.current=N;var D=N[0];if(D){var z=window.getComputedStyle(D),V=z.fontSize,k=z.letterSpacing;(V!==y||k!==x)&&(b(V),M(k))}}},[y,x]);return a||r!=null&&r<=0||i!=null&&i<=0?null:R.createElement(su,{zIndex:t.zIndex},R.createElement(qa,{className:tr("recharts-cartesian-axis",s)},R.createElement(hce,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:zo(t)}),R.createElement(xce,{ref:P,axisType:l,events:d,fontSize:y,getTicksConfig:t,height:t.height,letterSpacing:x,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:o,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),R.createElement(Gae,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},R.createElement(eoe,{label:t.label,labelRef:t.labelRef}),t.children)))}),rR=R.forwardRef((t,e)=>{var n=Za(t,Hc);return R.createElement(bce,Fh({},n,{ref:e}))});rR.displayName="CartesianAxis";var _ce=["x1","y1","x2","y2","key"],wce=["offset"],Sce=["xAxisId","yAxisId"],Mce=["xAxisId","yAxisId"];function d3(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 is(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,a=t.height,o=t.ry;return R.createElement("rect",{x:r,y:i,ry:o,width:s,height:a,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function kH(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,a=n.y1,o=n.x2,l=n.y2,c=n.key,d=Xw(n,_ce),f=(i=zo(d))!==null&&i!==void 0?i:{};f.offset;var p=Xw(f,wce);r=R.createElement("line",ah({},p,{x1:s,y1:a,x2:o,y2:l,fill:"none",key:c}))}return r}function Rce(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 a=Xw(t,Sce),o=s.map((l,c)=>{var d=is(is({},a),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return R.createElement(kH,{key:"line-".concat(c),option:i,lineItemProps:d})});return R.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function Nce(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 a=Xw(t,Mce),o=s.map((l,c)=>{var d=is(is({},a),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return R.createElement(kH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return R.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function Ice(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,a=t.height,o=t.horizontalPoints,l=t.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length||o==null)return null;var d=o.map(p=>Math.round(p+i-i)).sort((p,y)=>p-y);i!==d[0]&&d.unshift(0);var f=d.map((p,y)=>{var b=d[y+1],S=b==null,w=S?i+a-p:b-p;if(w<=0)return null;var x=y%e.length;return R.createElement("rect",{key:"react-".concat(y),y:p,x:r,height:w,width:s,stroke:"none",fill:e[x],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function kce(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,a=t.y,o=t.width,l=t.height,c=t.verticalPoints;if(!n||!r||!r.length)return null;var d=c.map(p=>Math.round(p+s-s)).sort((p,y)=>p-y);s!==d[0]&&d.unshift(0);var f=d.map((p,y)=>{var b=d[y+1],S=b==null,w=S?s+o-p:b-p;if(w<=0)return null;var x=y%r.length;return R.createElement("rect",{key:"react-".concat(y),x:p,y:a,width:w,height:l,stroke:"none",fill:r[x],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var Oce=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return h4(nR(is(is(is({},Hc),n),{},{ticks:p4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},Lce=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return h4(nR(is(is(is({},Hc),n),{},{ticks:p4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},Dce={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ms.grid};function OH(t){var e=w4(),n=S4(),r=_4(),i=is(is({},Za(t,Dce)),{},{x:kt(t.x)?t.x:r.left,y:kt(t.y)?t.y:r.top,width:kt(t.width)?t.width:r.width,height:kt(t.height)?t.height:r.height}),s=i.xAxisId,a=i.yAxisId,o=i.x,l=i.y,c=i.width,d=i.height,f=i.syncWithTicks,p=i.horizontalValues,y=i.verticalValues,b=Js(),S=Ft(V=>hL(V,"xAxis",s,b)),w=Ft(V=>hL(V,"yAxis",a,b));if(!Il(c)||!Il(d)||!kt(o)||!kt(l))return null;var x=i.verticalCoordinatesGenerator||Oce,M=i.horizontalCoordinatesGenerator||Lce,T=i.horizontalPoints,P=i.verticalPoints;if((!T||!T.length)&&typeof M=="function"){var O=p&&p.length,N=M({yAxis:w?is(is({},w),{},{ticks:O?p:w.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((!P||!P.length)&&typeof x=="function"){var D=y&&y.length,z=x({xAxis:S?is(is({},S),{},{ticks:D?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},D?!0:f);xw(Array.isArray(z),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof z,"]")),Array.isArray(z)&&(P=z)}return R.createElement(su,{zIndex:i.zIndex},R.createElement("g",{className:"recharts-cartesian-grid"},R.createElement(Cce,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),R.createElement(Ice,ah({},i,{horizontalPoints:T})),R.createElement(kce,ah({},i,{verticalPoints:P})),R.createElement(Rce,ah({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:w})),R.createElement(Nce,ah({},i,{offset:r,verticalPoints:P,xAxis:S,yAxis:w}))))}OH.displayName="CartesianGrid";var Uce={},LH=cs({name:"errorBars",initialState:Uce,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(a=>a.dataKey===i.dataKey&&a.direction===i.direction?s:a))},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))}}}),iR=LH.actions;iR.addErrorBar;iR.replaceErrorBar;iR.removeErrorBar;var jce=LH.reducer;function DH(t,e){var n,r,i=Ft(c=>nu(c,t)),s=Ft(c=>ru(c,e)),a=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:ti.allowDataOverflow,o=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:ni.allowDataOverflow,l=a||o;return{needClip:l,needClipX:a,needClipY:o}}function Fce(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=tR(),s=DH(e,n),a=s.needClipX,o=s.needClipY,l=s.needClip,c=Ft(T=>bB(T,e,!1)),d=Ft(T=>_B(T,n,!1));if(!l||!i)return null;var f=i.x,p=i.y,y=i.width,b=i.height,S=a&&c?Math.min(c[0],c[1]):f-y/2,w=o&&d?Math.min(d[0],d[1]):p-b/2,x=a&&c?Math.abs(c[1]-c[0]):y*2,M=o&&d?Math.abs(d[1]-d[0]):b*2;return R.createElement("clipPath",{id:"clipPath-".concat(r)},R.createElement("rect",{x:S,y:w,width:x,height:M}))}function zce(t){var e=Q1(t),n=3,r=2;if(e!=null){var i=e.r,s=e.strokeWidth,a=Number(i),o=Number(s);return(Number.isNaN(a)||a<0)&&(a=n),(Number.isNaN(o)||o<0)&&(o=r),{r:a,strokeWidth:o}}return{r:n,strokeWidth:r}}function sR(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:AH}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.yAxisId)!==null&&n!==void 0?n:AH}var UH=(t,e,n)=>CB(t,"xAxis",sR(t,e),n),jH=(t,e,n)=>PB(t,"xAxis",sR(t,e),n),FH=(t,e,n)=>CB(t,"yAxis",aR(t,e),n),zH=(t,e,n)=>PB(t,"yAxis",aR(t,e),n),Bce=ke([hr,UH,FH,jH,zH],(t,e,n,r,i)=>jl(t,"xAxis")?yw(e,r,!1):yw(n,i,!1)),Hce=(t,e)=>e,BH=ke([qz,Hce],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),HH=t=>{var e=hr(t),n=jl(e,"xAxis");return n?"yAxis":"xAxis"},Vce=(t,e)=>{var n=HH(t);return n==="yAxis"?aR(t,e):sR(t,e)},Gce=(t,e,n)=>iB(t,HH(t),Vce(t,e),n),Wce=ke([BH,Gce],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=a2(t);if(!(r==null||i==null)){var s=(n=e[r])===null||n===void 0?void 0:n.stackedData,a=s==null?void 0:s.find(o=>o.key===i);if(a!=null)return a.map(o=>[o[0],o[1]])}}}),$ce=ke([hr,UH,FH,jH,zH,Wce,gJ,Bce,BH,kJ],(t,e,n,r,i,s,a,o,l,c)=>{var d=a.chartData,f=a.dataStartIndex,p=a.dataEndIndex;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null)){var y=l.data,b;if(y&&y.length>0?b=y:b=d==null?void 0:d.slice(f,p+1),b!=null)return yue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:b,chartBaseValue:c,bandSize:o})}}),Xce=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],qce=["id","baseLine"];function K0(){return K0=Object.assign?Object.assign.bind():function(t){for(var e=1;ef.y||0));return kt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),kt(d)?R.createElement("rect",{x:of.x||0));return kt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),kt(d)?R.createElement("rect",{x:0,y:ot==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Rg(Rg({},n.next),{},{x:Dc(n.prev.x,n.next.x,e),y:Dc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),GH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:J2,animationInterpolateFn:aue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:Jce,xAxisId:0,yAxisId:0,zIndex:Ms.area};function Kw(t,e){return t&&t!=="none"?t:e}var oue=t=>{var e=t.dataKey,n=t.name,r=t.stroke,i=t.fill,s=t.legendType,a=t.hide;return[{inactive:a,dataKey:e,type:s,color:Kw(r,i),value:m4(n,e),payload:t}]},lue=R.memo(t=>{var e=t.dataKey,n=t.data,r=t.stroke,i=t.strokeWidth,s=t.fill,a=t.name,o=t.hide,l=t.unit,c=t.tooltipType,d=t.id,f={dataDefinedOnItem:n,getPosition:Hg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:m4(a,e),hide:o,type:c,color:Kw(r,s),unit:l,graphicalItemId:d}};return R.createElement(boe,{tooltipEntrySettings:f})});function cue(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,a=r.dataKey,o=zo(r);return R.createElement(cle,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:a,baseProps:o,needClip:i,clipPathId:e})}function uue(t){var e=t.showLabels,n=t.children,r=t.points,i=r.map(s=>{var a,o,l={x:(a=s.x)!==null&&a!==void 0?a:0,y:(o=s.y)!==null&&o!==void 0?o:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Rg(Rg({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return R.createElement(soe,{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,a=t.animationElapsedTime,o=t.isAnimating,l=t.isEntrance,c=s.layout,d=s.type,f=s.stroke,p=s.connectNulls,y=s.isRange,b=s.shape,S=s.id,w=VH(s,eue),x=Xa(w),M=Rg(Rg({},x),{},{id:S,points:e,connectNulls:p,type:d,baseLine:n,layout:c,stroke:f,isRange:y,animationElapsedTime:a,isAnimating:o,isEntrance:l});return R.createElement(R.Fragment,null,(e==null?void 0:e.length)>1&&R.createElement(qa,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},R.createElement(xoe,{option:b,DefaultShape:GH.shape,shapeProps:M})),R.createElement(cue,{points:e,props:w,clipPathId:i}))}function fue(t,e,n){if(kt(t)){var r=kt(e)?e:void 0;return Dc(r,t,n)}if(Vi(t)||Rl(t)){var i=kt(e)?e:void 0;return Dc(i,0,n)}return t}function hue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=t.previousPointsRef,s=t.previousBaselineRef,a=r.points,o=r.baseLine,l=r.isAnimationActive,c=r.animationBegin,d=r.animationDuration,f=r.animationEasing,p=r.animationMatchBy,y=r.animationInterpolateFn,b=R.useMemo(()=>({points:a,baseLine:o}),[a,o]),S=SH(b,s),w=$C(),x=Uoe(r.onAnimationStart,r.onAnimationEnd),M=x.isAnimating,T=x.handleAnimationStart,P=x.handleAnimationEnd,O=S.startValue;if(w==null)return null;var N;return Array.isArray(o)&&Array.isArray(O)?N=kP(O,o,p):Array.isArray(o)?N=kP(null,o,p):N=null,R.createElement(joe,{animationInput:b,animationIdPrefix:"recharts-area-",items:a,previousItemsRef:i,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:T,onAnimationEnd:P,animationInterpolateFn:y,animationMatchBy:p,layout:w},(D,z,V)=>{var k;return z===1?k=o:Array.isArray(o)?k=y(N,z,w):k=V?o:fue(o,O,z),S.syncStepValue(k,z),R.createElement(uue,{showLabels:!M,points:a},r.children,R.createElement(due,{points:D,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:z,isAnimating:M||z<1,isEntrance:V}),R.createElement(loe,{label:r.label}))})}function pue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=R.useRef(null),s=R.useRef();return R.createElement(hue,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class mue extends R.PureComponent{render(){var e=this.props,n=e.hide,r=e.dot,i=e.points,s=e.className,a=e.top,o=e.left,l=e.needClip,c=e.xAxisId,d=e.yAxisId,f=e.width,p=e.height,y=e.id,b=e.baseLine,S=e.zIndex;if(n)return null;var w=tr("recharts-area",s),x=y,M=zce(r),T=M.r,P=M.strokeWidth,O=_H(r),N=T*2+P,D=l?"url(#clipPath-".concat(O?"":"dots-").concat(x,")"):void 0;return R.createElement(su,{zIndex:S},R.createElement(qa,{className:w},l&&R.createElement("defs",null,R.createElement(Fce,{clipPathId:x,xAxisId:c,yAxisId:d}),!O&&R.createElement("clipPath",{id:"clipPath-dots-".concat(x)},R.createElement("rect",{x:o-N/2,y:a-N/2,width:f+N,height:p+N}))),R.createElement(pue,{needClip:l,clipPathId:x,props:this.props})),R.createElement(i3,{points:i,mainColor:Kw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}),this.props.isRange&&Array.isArray(b)&&R.createElement(i3,{points:b,mainColor:Kw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}))}}function gue(t){var e,n=t.activeDot,r=t.animationBegin,i=t.animationDuration,s=t.animationEasing,a=t.connectNulls,o=t.dot,l=t.fill,c=t.fillOpacity,d=t.hide,f=t.isAnimationActive,p=t.legendType,y=t.stroke,b=t.xAxisId,S=t.yAxisId,w=VH(t,tue),x=Vg(),M=QB(),T=DH(b,S),P=T.needClip,O=Js(),N=(e=Ft(pe=>$ce(pe,t.id,O)))!==null&&e!==void 0?e:{},D=N.points,z=N.isRange,V=N.baseLine,k=tR();if(x!=="horizontal"&&x!=="vertical"||k==null||M!=="AreaChart"&&M!=="ComposedChart")return null;var j=k.height,X=k.width,ee=k.x,ie=k.y;return!D||!D.length?null:R.createElement(mue,qw({},w,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:V,connectNulls:a,dot:o,fill:l,fillOpacity:c,height:j,hide:d,layout:x,isAnimationActive:f,isRange:z,legendType:p,needClip:P,points:D,stroke:y,width:X,left:ee,top:ie,xAxisId:b,yAxisId:S}))}var vue=(t,e,n,r,i)=>{var s=n??e;if(kt(s))return s;var a=t==="horizontal"?i:r,o=a.scale.domain();if(a.type==="number"){var l=Math.max(o[0],o[1]),c=Math.min(o[0],o[1]);return s==="dataMin"?c:s==="dataMax"||l<0?l:Math.max(Math.min(o[0],o[1]),0)}return s==="dataMin"?o[0]:s==="dataMax"?o[1]:o[0]};function yue(t){var e=t.areaSettings,n=e.connectNulls,r=e.baseValue,i=e.dataKey,s=t.stackedData,a=t.layout,o=t.chartBaseValue,l=t.xAxis,c=t.yAxis,d=t.displayedData,f=t.dataStartIndex,p=t.xAxisTicks,y=t.yAxisTicks,b=t.bandSize,S=s&&s.length,w=vue(a,o,r,l,c),x=a==="horizontal",M=!1,T=d.map((O,N)=>{var D,z,V,k;if(S)k=s[f+N];else{var j=yi(O,i);Array.isArray(j)?(k=j,M=!0):k=[w,j]}var X=(D=(z=k)===null||z===void 0?void 0:z[1])!==null&&D!==void 0?D:null,ee=X==null||S&&!n&&yi(O,i)==null;if(x){var ie;return{x:lk({axis:l,ticks:p,bandSize:b,entry:O,index:N}),y:ee?null:(ie=c.scale.map(X))!==null&&ie!==void 0?ie:null,value:k,payload:O}}return{x:ee?null:(V=l.scale.map(X))!==null&&V!==void 0?V:null,y:lk({axis:c,ticks:y,bandSize:b,entry:O,index:N}),value:k,payload:O}}),P;return S||M?P=T.map(O=>{var N,D=Array.isArray(O.value)?O.value[0]:null;if(x){var z;return{x:O.x,y:D!=null&&O.y!=null&&(z=c.scale.map(D))!==null&&z!==void 0?z:null,payload:O.payload}}return{x:D!=null&&(N=l.scale.map(D))!==null&&N!==void 0?N:null,y:O.y,payload:O.payload}}):P=x?c.scale.map(w):l.scale.map(w),{points:T,baseLine:P??0,isRange:M}}function xue(t){var e=Za(t,GH),n=Js();return R.createElement(Xoe,{id:e.id,type:"area"},r=>R.createElement(R.Fragment,null,R.createElement(_oe,{legendPayload:oue(e)}),R.createElement(lue,{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:nY(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),R.createElement(gue,qw({},e,{id:r}))))}var WH=R.memo(xue,bS);WH.displayName="Area";var bue=["domain","range"],_ue=["domain","range"];function p3(t,e){if(t==null)return{};var n,r,i=wue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{if(a!=null)return v3(v3({},s),{},{type:a})},[s,a]);return R.useLayoutEffect(()=>{o!=null&&(n.current===null?e(ple(o)):n.current!==o&&e(mle({prev:n.current,next:o})),n.current=o)},[o,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(gle(n.current)),n.current=null)},[e]),null}var Nue=t=>{var e=t.xAxisId,n=t.className,r=Ft(v4),i=Js(),s="xAxis",a=Ft(p=>TB(p,s,e,i)),o=Ft(p=>dre(p,e)),l=Ft(p=>vre(p,e)),c=Ft(p=>Gz(p,e));if(o==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=LP(t,Mue);c.id,c.scale;var f=LP(c,Eue);return R.createElement(rR,OP({},d,f,{x:l.x,y:l.y,width:o.width,height:o.height,className:tr("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:a,axisType:s,axisId:e}))},Iue={allowDataOverflow:ti.allowDataOverflow,allowDecimals:ti.allowDecimals,allowDuplicatedCategory:ti.allowDuplicatedCategory,angle:ti.angle,axisLine:Hc.axisLine,height:ti.height,hide:!1,includeHidden:ti.includeHidden,interval:ti.interval,label:!1,minTickGap:ti.minTickGap,mirror:ti.mirror,orientation:ti.orientation,padding:ti.padding,reversed:ti.reversed,scale:ti.scale,tick:ti.tick,tickCount:ti.tickCount,tickLine:Hc.tickLine,tickSize:Hc.tickSize,type:ti.type,niceTicks:ti.niceTicks,xAxisId:0},kue=t=>{var e=Za(t,Iue);return R.createElement(R.Fragment,null,R.createElement(Rue,{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(Nue,e))},XH=R.memo(kue,$H);XH.displayName="XAxis";var Oue=["type"],Lue=["dangerouslySetInnerHTML","ticks","scale"],Due=["id","scale"];function DP(){return DP=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(a!=null)return x3(x3({},s),{},{type:a})},[a,s]);return R.useLayoutEffect(()=>{o!=null&&(n.current===null?e(vle(o)):n.current!==o&&e(yle({prev:n.current,next:o})),n.current=o)},[o,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(xle(n.current)),n.current=null)},[e]),null}function Hue(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=R.useRef(null),a=R.useRef(null),o=Ft(v4),l=Js(),c=Wr(),d="yAxis",f=Ft(x=>bre(x,e)),p=Ft(x=>xre(x,e)),y=Ft(x=>TB(x,d,e,l)),b=Ft(x=>Wz(x,e));if(R.useLayoutEffect(()=>{if(!(r!=="auto"||!f||Q2(i)||R.isValidElement(i)||b==null)){var x=s.current;if(x){var M=x.getCalculatedWidth();Math.round(f.width)!==Math.round(M)&&c(ble({id:e,width:M}))}}},[y,f,c,i,e,r,b]),f==null||p==null||b==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=UP(t,Lue);b.id,b.scale;var w=UP(b,Due);return R.createElement(rR,DP({},S,w,{ref:s,labelRef:a,x:p.x,y:p.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:f.width,height:f.height,className:tr("recharts-".concat(d," ").concat(d),n),viewBox:o,ticks:y,axisType:d,axisId:e}))}var Vue={allowDataOverflow:ni.allowDataOverflow,allowDecimals:ni.allowDecimals,allowDuplicatedCategory:ni.allowDuplicatedCategory,angle:ni.angle,axisLine:Hc.axisLine,hide:!1,includeHidden:ni.includeHidden,interval:ni.interval,label:!1,minTickGap:ni.minTickGap,mirror:ni.mirror,orientation:ni.orientation,padding:ni.padding,reversed:ni.reversed,scale:ni.scale,tick:ni.tick,tickCount:ni.tickCount,tickLine:Hc.tickLine,tickSize:Hc.tickSize,type:ni.type,niceTicks:ni.niceTicks,width:ni.width,yAxisId:0},Gue=t=>{var e=Za(t,Vue);return R.createElement(R.Fragment,null,R.createElement(Bue,{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(Hue,e))},qH=R.memo(Gue,$H);qH.displayName="YAxis";var Wue=(t,e)=>e,oR=ke([Wue,hr,sz,wi,$B,iu,Hie,Wi],Kie);function $ue(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function lR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if($ue(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 a=(o,l)=>({relativeX:Math.round((o-e.left)/n),relativeY:Math.round((l-e.top)/r)});return"touches"in t?Array.from(t.touches).map(o=>a(o.clientX,o.clientY)):a(t.clientX,t.clientY)}var KH=Ma("mouseClick"),YH=qy();YH.startListening({actionCreator:KH,effect:(t,e)=>{var n=t.payload,r=oR(e.getState(),lR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(Lre({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var jP=Ma("mouseMove"),ZH=qy(),dm=null,Ef=null,GE=null;ZH.startListening({actionCreator:jP,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=r.eventSettings,s=i.throttleDelay,a=i.throttledEvents,o=a==="all"||(a==null?void 0:a.includes("mousemove"));dm!==null&&(cancelAnimationFrame(dm),dm=null),Ef!==null&&(typeof s!="number"||!o)&&(clearTimeout(Ef),Ef=null),GE=lR(n);var l=()=>{var c=e.getState(),d=ox(c,c.tooltip.settings.shared);if(!GE){dm=null,Ef=null;return}if(d==="axis"){var f=oR(c,GE);(f==null?void 0:f.activeIndex)!=null?e.dispatch(DB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(LB())}dm=null,Ef=null};if(!o){l();return}s==="raf"?dm=requestAnimationFrame(l):typeof s=="number"&&Ef===null&&(Ef=setTimeout(l,s))}});function Xue(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 b3={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},QH=cs({name:"rootProps",initialState:b3,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:b3.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}}}),que=QH.reducer,Kue=QH.actions.updateOptions,Yue=null,Zue={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)},JH=cs({name:"polarOptions",initialState:Yue,reducers:Zue});JH.actions.updatePolarOptions;var Que=JH.reducer,eV=Ma("keyDown"),tV=Ma("focus"),nV=Ma("blur"),zS=qy(),fm=null,Af=null,Db=null;zS.startListening({actionCreator:eV,effect:(t,e)=>{Db=t.payload,fm!==null&&(cancelAnimationFrame(fm),fm=null);var n=e.getState(),r=n.eventSettings,i=r.throttleDelay,s=r.throttledEvents,a=s==="all"||s.includes("keydown");Af!==null&&(typeof i!="number"||!a)&&(clearTimeout(Af),Af=null);var o=()=>{try{var l=e.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var d=l.tooltip.keyboardInteraction,f=Db;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var p=X0(d,jh(l),Pg(l),Cg(l)),y=p==null?-1:Number(p),b=!Number.isFinite(y)||y<0,S=iu(l),w=jh(l),x=ox(l,l.tooltip.settings.shared);if(f==="Enter"){if(b)return;var M=Vw(l,x,"hover",String(d.index));e.dispatch(Hw({active:!d.active,activeIndex:d.index,activeCoordinate:M}));return}var T=Ere(l),P=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(b){var D=Pg(l),z=Cg(l),V=O*P,k=pe=>({active:!1,index:String(pe),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(N=-1,V>0){for(var j=0;j=0;X--)if(X0(k(X),w,D,z)!=null){N=X;break}if(N<0)return}else{N=y+O*P;var ee=(S==null?void 0:S.length)||w.length;if(ee===0||N>=ee||N<0)return}var ie=Vw(l,x,"hover",String(N));e.dispatch(Hw({active:!0,activeIndex:N.toString(),activeCoordinate:ie}))}finally{fm=null,Af=null}};if(!a){o();return}i==="raf"?fm=requestAnimationFrame(o):typeof i=="number"&&Af===null&&(o(),Db=null,Af=setTimeout(()=>{Db?o():(Af=null,fm=null)},i))}});zS.startListening({actionCreator:tV,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",a=ox(n,n.tooltip.settings.shared),o=Vw(n,a,"hover",String(s));e.dispatch(Hw({active:!0,activeIndex:s,activeCoordinate:o}))}}}});zS.startListening({actionCreator:nV,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 rV(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 za=Ma("externalEvent"),iV=qy(),Ub=new Map,f0=new Map,WE=new Map;iV.startListening({actionCreator:za,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,a=rV(i);WE.set(s,{handler:r,reactEvent:a});var o=Ub.get(s);o!==void 0&&(cancelAnimationFrame(o),Ub.delete(s));var l=e.getState(),c=l.eventSettings,d=c.throttleDelay,f=c.throttledEvents,p=f,y=p==="all"||(p==null?void 0:p.includes(s)),b=f0.get(s);b!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(b),f0.delete(s));var S=()=>{var M=WE.get(s);try{if(!M)return;var T=M.handler,P=M.reactEvent,O=e.getState(),N={activeCoordinate:Tie(O),activeDataKey:Mie(O),activeIndex:Sy(O),activeLabel:KB(O),activeTooltipIndex:Sy(O),isTooltipActive:Pie(O)};T&&T(N,P)}finally{Ub.delete(s),f0.delete(s),WE.delete(s)}};if(!y){S();return}if(d==="raf"){var w=requestAnimationFrame(S);Ub.set(s,w)}else if(typeof d=="number"){if(!f0.has(s)){S();var x=setTimeout(S,d);f0.set(s,x)}}else S()}}});var Jue=ke([Zg],t=>t.tooltipItemPayloads),ede=ke([Jue,(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)}}}),sV=Ma("touchMove"),aV=qy(),Tf=null,Hu=null,_3=null,h0=null;aV.startListening({actionCreator:sV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){h0=rV(n);var r=e.getState(),i=r.eventSettings,s=i.throttleDelay,a=i.throttledEvents,o=a==="all"||a.includes("touchmove");Tf!==null&&(cancelAnimationFrame(Tf),Tf=null),Hu!==null&&(typeof s!="number"||!o)&&(clearTimeout(Hu),Hu=null),_3=Array.from(n.touches).map(c=>lR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(h0!=null){var c=e.getState(),d=ox(c,c.tooltip.settings.shared);if(d==="axis"){var f,p=(f=_3)===null||f===void 0?void 0:f[0];if(p==null){Tf=null,Hu=null;return}var y=oR(c,p);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(DB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var b,S=h0.touches[0];if(document.elementFromPoint==null||S==null)return;var w=document.elementFromPoint(S.clientX,S.clientY);if(!w||!w.getAttribute)return;var x=w.getAttribute(cY),M=(b=w.getAttribute(uY))!==null&&b!==void 0?b:void 0,T=Jh(c).find(N=>N.id===M);if(x==null||T==null||M==null)return;var P=T.dataKey,O=ede(c,x,M);e.dispatch(Ore({activeDataKey:P,activeIndex:x,activeCoordinate:O,activeGraphicalItemId:M}))}Tf=null,Hu=null}};if(!o){l();return}s==="raf"?Tf=requestAnimationFrame(l):typeof s=="number"&&Hu===null&&(l(),h0=null,Hu=setTimeout(()=>{h0?l():(Hu=null,Tf=null)},s))}}});var oV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},lV=cs({name:"eventSettings",initialState:oV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),tde=lV.actions.setEventSettings,nde=lV.reducer,rde=j5({brush:Rle,cartesianAxis:_le,chartData:Ase,errorBars:jce,eventSettings:nde,graphicalItems:Qoe,layout:XK,legend:oZ,options:_se,polarAxis:uoe,polarOptions:Que,referenceElements:Ole,renderedTicks:nce,rootProps:que,tooltip:Dre,zIndex:lse}),ide=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return yK({reducer:rde,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([YH.middleware,ZH.middleware,zS.middleware,iV.middleware,aV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(J5({type:"raf"}))},devTools:{serialize:{replacer:Xue},name:"recharts-".concat(n)}})};function sde(t){var e=t.preloadedState,n=t.children,r=t.reduxStoreName,i=Js(),s=R.useRef(null);if(i)return n;s.current==null&&(s.current=ide(e,r));var a=UC;return R.createElement(SZ,{context:a,store:s.current},n)}function ade(t){var e=t.layout,n=t.margin,r=Wr(),i=Js();return R.useEffect(()=>{i||(r(GK(e)),r(VK(n)))},[r,i,e,n]),null}var ode=R.memo(ade,bS);function lde(t){var e=Wr();return R.useEffect(()=>{e(Kue(t))},[e,t]),null}var cde=t=>{var e=Wr();return R.useEffect(()=>{e(tde(t))},[e,t]),null},ude=R.memo(cde,bS);function w3(t){var e=t.zIndex,n=t.isPanorama,r=R.useRef(null),i=Wr();return R.useLayoutEffect(()=>(r.current&&i(ase({zIndex:e,element:r.current,isPanorama:n})),()=>{i(ose({zIndex:e,isPanorama:n}))}),[i,e,n]),R.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function S3(t){var e=t.children,n=t.isPanorama,r=Ft(Zie);if(!r||r.length===0)return e;var i=r.filter(a=>a<0),s=r.filter(a=>a>0);return R.createElement(R.Fragment,null,i.map(a=>R.createElement(w3,{key:a,zIndex:a,isPanorama:n})),e,s.map(a=>R.createElement(w3,{key:a,zIndex:a,isPanorama:n})))}var dde=["children"];function fde(t,e){if(t==null)return{};var n,r,i=hde(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=w4(),r=S4(),i=k4();if(!Il(n)||!Il(r))return null;var s=t.children,a=t.otherAttributes,o=t.title,l=t.desc,c,d;return a!=null&&(typeof a.tabIndex=="number"?c=a.tabIndex:c=i?0:void 0,typeof a.role=="string"?d=a.role:d=i?"application":void 0),R.createElement(n5,Yw({},a,{title:o,desc:l,role:d,tabIndex:c,width:n,height:r,style:pde,ref:e}),s)}),gde=t=>{var e=t.children,n=Ft(mS);if(!n)return null;var r=n.width,i=n.height,s=n.y,a=n.x;return R.createElement(n5,{width:r,height:i,x:a,y:s},e)},M3=R.forwardRef((t,e)=>{var n=t.children,r=fde(t,dde),i=Js();return i?R.createElement(gde,null,R.createElement(S3,{isPanorama:!0},n)):R.createElement(mde,Yw({ref:e},r),R.createElement(S3,{isPanorama:!1},n))});function vde(t,e){return _de(t)||bde(t,e)||xde(t,e)||yde()}function yde(){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 xde(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);n{if(r!=null){var a=r.getBoundingClientRect(),o=a.width/r.offsetWidth;wn(o)&&o!==s&&t($K(o))}},[r,t,s]),i}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 Sde(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n(Lse(),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 Ide=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)}),a=Zw(s,2),o=a[0],l=a[1],c=R.useCallback((f,p)=>{l(y=>{var b=Math.round(f),S=Math.round(p);return y.containerWidth===b&&y.containerHeight===S?y:{containerWidth:b,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 p=f.getBoundingClientRect(),y=p.width,b=p.height;c(y,b);var S=x=>{var M=x[0];if(M!=null){var T=M.contentRect,P=T.width,O=T.height;c(P,O)}},w=new ResizeObserver(S);w.observe(f),i.current=w}},[e,c]);return R.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),R.createElement(R.Fragment,null,R.createElement(Yy,{width:o.containerWidth,height:o.containerHeight}),R.createElement("div",wd({ref:d},t)))}),kde=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=R.useState({containerWidth:Qw(n),containerHeight:Qw(r)}),s=Zw(i,2),a=s[0],o=s[1],l=R.useCallback((d,f)=>{o(p=>{var y=Math.round(d),b=Math.round(f);return p.containerWidth===y&&p.containerHeight===b?p:{containerWidth:y,containerHeight:b}})},[]),c=R.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var f=d.getBoundingClientRect(),p=f.width,y=f.height;l(p,y)}},[e,l]);return R.createElement(R.Fragment,null,R.createElement(Yy,{width:a.containerWidth,height:a.containerHeight}),R.createElement("div",wd({ref:c},t)))}),Ode=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return R.createElement(R.Fragment,null,R.createElement(Yy,{width:n,height:r}),R.createElement("div",wd({ref:e},t)))}),Lde=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?R.createElement(kde,wd({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?R.createElement(Ode,wd({},t,{width:n,height:r,ref:e})):R.createElement(R.Fragment,null,R.createElement(Yy,{width:n,height:r}),R.createElement("div",wd({ref:e},t)))});function Dde(t){return t?Ide:Lde}var Ude=R.forwardRef((t,e)=>{var n=t.children,r=t.className,i=t.height,s=t.onClick,a=t.onContextMenu,o=t.onDoubleClick,l=t.onMouseDown,c=t.onMouseEnter,d=t.onMouseLeave,f=t.onMouseMove,p=t.onMouseUp,y=t.onTouchEnd,b=t.onTouchMove,S=t.onTouchStart,w=t.style,x=t.width,M=t.responsive,T=t.dispatchTouchEvents,P=T===void 0?!0:T,O=R.useRef(null),N=Wr(),D=R.useState(null),z=Zw(D,2),V=z[0],k=z[1],j=R.useState(null),X=Zw(j,2),ee=X[0],ie=X[1],pe=wde(),ae=GC(),he=(ae==null?void 0:ae.width)>0?ae.width:x,B=(ae==null?void 0:ae.height)>0?ae.height:i,J=R.useCallback(Le=>{pe(Le),typeof e=="function"&&e(Le),k(Le),ie(Le),Le!=null&&(O.current=Le)},[pe,e,k,ie]),Y=R.useCallback(Le=>{N(KH(Le)),N(za({handler:s,reactEvent:Le}))},[N,s]),H=R.useCallback(Le=>{N(jP(Le)),N(za({handler:c,reactEvent:Le}))},[N,c]),G=R.useCallback(Le=>{N(LB()),N(za({handler:d,reactEvent:Le}))},[N,d]),le=R.useCallback(Le=>{N(jP(Le)),N(za({handler:f,reactEvent:Le}))},[N,f]),se=R.useCallback(()=>{N(tV())},[N]),ce=R.useCallback(()=>{N(nV())},[N]),Se=R.useCallback(Le=>{N(eV(Le.key))},[N]),we=R.useCallback(Le=>{N(za({handler:a,reactEvent:Le}))},[N,a]),We=R.useCallback(Le=>{N(za({handler:o,reactEvent:Le}))},[N,o]),Ee=R.useCallback(Le=>{N(za({handler:l,reactEvent:Le}))},[N,l]),Ge=R.useCallback(Le=>{N(za({handler:p,reactEvent:Le}))},[N,p]),$e=R.useCallback(Le=>{N(za({handler:S,reactEvent:Le}))},[N,S]),de=R.useCallback(Le=>{P&&N(sV(Le)),N(za({handler:b,reactEvent:Le}))},[N,P,b]),Z=R.useCallback(Le=>{N(za({handler:y,reactEvent:Le}))},[N,y]),Ve=Dde(M);return R.createElement(rH.Provider,{value:V},R.createElement(Z7.Provider,{value:ee},R.createElement(Ve,{width:he??(w==null?void 0:w.width),height:B??(w==null?void 0:w.height),className:tr("recharts-wrapper",r),style:Sde({position:"relative",cursor:"default",width:he,height:B},w),onClick:Y,onContextMenu:we,onDoubleClick:We,onFocus:se,onBlur:ce,onKeyDown:Se,onMouseDown:Ee,onMouseEnter:H,onMouseLeave:G,onMouseMove:le,onMouseUp:Ge,onTouchEnd:Z,onTouchMove:de,onTouchStart:$e,ref:J},R.createElement(Nde,null),n)))}),jde=["width","height","responsive","children","className","style","compact","title","desc"];function Fde(t,e){if(t==null)return{};var n,r,i=zde(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,a=t.className,o=t.style,l=t.compact,c=t.title,d=t.desc,f=Fde(t,jde),p=zo(f);return l?R.createElement(R.Fragment,null,R.createElement(Yy,{width:n,height:r}),R.createElement(M3,{otherAttributes:p,title:c,desc:d},s)):R.createElement(Ude,{className:a,style:o,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(M3,{otherAttributes:p,title:c,desc:d,ref:e},R.createElement(Ble,null,s)))});function FP(){return FP=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.createElement(qde,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Kde,tooltipPayloadSearcher:xse,categoricalChartProps:t,ref:e}));const Zde="rgba(130,130,150,0.14)",C3="rgba(130,130,150,0.85)";function Qde(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 cV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function Jde({active:t,payload:e,unit:n}){return!t||!(e!=null&&e.length)?null:v.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:v.jsx("div",{className:"space-y-1",children:e.map(r=>v.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[v.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:r.color}}),v.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:r.name}),v.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:cV(r.value,n)})]},r.dataKey))})})}function uV({data:t,series:e,unit:n="%",yMode:r="percent",height:i=176}){const s=t.reduce((o,l)=>e.reduce((c,d)=>Math.max(c,Number(l[d.key])||0),o),0),a=r==="percent"?Math.min(100,Math.max(25,Math.ceil(s*1.2/25)*25)):Math.max(Qde(s*1.15),10);return v.jsx("div",{style:{height:i},className:"w-full",children:v.jsx(VY,{width:"100%",height:"100%",children:v.jsxs(Yde,{data:t,margin:{top:8,right:6,bottom:0,left:-12},children:[v.jsx("defs",{children:e.map(o=>v.jsxs("linearGradient",{id:`grad-${o.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[v.jsx("stop",{offset:"0%",stopColor:o.color,stopOpacity:.22}),v.jsx("stop",{offset:"100%",stopColor:o.color,stopOpacity:0})]},o.key))}),v.jsx(OH,{vertical:!1,stroke:Zde}),v.jsx(XH,{dataKey:"t",hide:!0}),v.jsx(qH,{domain:[0,a],ticks:[0,a/2,a],tickFormatter:o=>cV(o,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:C3}}),v.jsx(qse,{content:v.jsx(Jde,{unit:n}),cursor:{stroke:C3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(o=>v.jsx(WH,{type:"monotone",dataKey:o.key,name:o.label,stroke:o.color,strokeWidth:2,fill:`url(#grad-${o.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},o.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 tfe(){var a,o,l,c;const{sys:t,hist:e}=F7(),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:(a=t==null?void 0:t.cpu)==null?void 0:a.percent,ram:(o=t==null?void 0:t.ram)==null?void 0:o.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?`${sd(t.ram.used)}/${sd(t.ram.total)} GB`:"",gpu:n?`${sd(t.gpu.gtt_used)}/${sd(t.gpu.gtt_total)} GB`:"",disk:t!=null&&t.disk?`${sd(t.disk.used)}/${sd(t.disk.total)} GB`:""};return v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[v.jsx(Md,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:r.map(d=>v.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:d.color}}),v.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:d.label}),v.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]&&v.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:s[d.key]})]},d.key))}),v.jsx(uV,{data:e,series:r,unit:"%",yMode:"percent",height:176})]}):v.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)&&v.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&&v.jsxs("span",{children:["CPU Temp: ",t.temp.cpu," °C"]}),t.temp.gpu!=null&&v.jsxs("span",{children:["GPU Temp: ",t.temp.gpu," °C"]})]})]})}const cR="-",nfe=t=>{const e=ife(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{const o=a.split(cR);return o[0]===""&&o.length!==1&&o.shift(),dV(o,e)||rfe(a)},getConflictingClassGroupIds:(a,o)=>{const l=n[a]||[];return o&&r[a]?[...l,...r[a]]:l}}},dV=(t,e)=>{var a;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?dV(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(cR);return(a=e.validators.find(({validator:o})=>o(s)))==null?void 0:a.classGroupId},R3=/^\[(.+)\]$/,rfe=t=>{if(R3.test(t)){const e=R3.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},ife=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return afe(Object.entries(t.classGroups),n).forEach(([s,a])=>{zP(a,r,s,e)}),r},zP=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:N3(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(sfe(i)){zP(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,a])=>{zP(a,N3(e,s),n,r)})})},N3=(t,e)=>{let n=t;return e.split(cR).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},sfe=t=>t.isThemeGetter,afe=(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(([a,o])=>[e+a,o])):s);return[n,i]}):t,ofe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,a)=>{n.set(s,a),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let a=n.get(s);if(a!==void 0)return a;if((a=r.get(s))!==void 0)return i(s,a),a},set(s,a){n.has(s)?n.set(s,a):i(s,a)}}},fV="!",lfe=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,a=o=>{const l=[];let c=0,d=0,f;for(let w=0;wd?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:S}};return n?o=>n({className:o,parseClassName:a}):a},cfe=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},ufe=t=>({cache:ofe(t.cacheSize),parseClassName:lfe(t),...nfe(t)}),dfe=/\s+/,ffe=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],a=t.trim().split(dfe);let o="";for(let l=a.length-1;l>=0;l-=1){const c=a[l],{modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:y}=n(c);let b=!!y,S=r(b?p.substring(0,y):p);if(!S){if(!b){o=c+(o.length>0?" "+o:o);continue}if(S=r(p),!S){o=c+(o.length>0?" "+o:o);continue}b=!1}const w=cfe(d).join(":"),x=f?w+fV:w,M=x+S;if(s.includes(M))continue;s.push(M);const T=i(S,b);for(let P=0;P0?" "+o:o)}return o};function hfe(){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=ufe(c),r=n.cache.get,i=n.cache.set,s=o,o(l)}function o(l){const c=r(l);if(c)return c;const d=ffe(l,n);return i(l,d),d}return function(){return s(hfe.apply(null,arguments))}}const ir=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},pV=/^\[(?:([a-z-]+):)?(.+)\]$/i,mfe=/^\d+\/\d+$/,gfe=new Set(["px","full","screen"]),vfe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,yfe=/\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$/,xfe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bfe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_fe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bc=t=>tg(t)||gfe.has(t)||mfe.test(t),Vu=t=>ev(t,"length",Cfe),tg=t=>!!t&&!Number.isNaN(Number(t)),$E=t=>ev(t,"number",tg),p0=t=>!!t&&Number.isInteger(Number(t)),wfe=t=>t.endsWith("%")&&tg(t.slice(0,-1)),dn=t=>pV.test(t),Gu=t=>vfe.test(t),Sfe=new Set(["length","size","percentage"]),Mfe=t=>ev(t,Sfe,mV),Efe=t=>ev(t,"position",mV),Afe=new Set(["image","url"]),Tfe=t=>ev(t,Afe,Nfe),Pfe=t=>ev(t,"",Rfe),m0=()=>!0,ev=(t,e,n)=>{const r=pV.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},Cfe=t=>yfe.test(t)&&!xfe.test(t),mV=()=>!1,Rfe=t=>bfe.test(t),Nfe=t=>_fe.test(t),Ife=()=>{const t=ir("colors"),e=ir("spacing"),n=ir("blur"),r=ir("brightness"),i=ir("borderColor"),s=ir("borderRadius"),a=ir("borderSpacing"),o=ir("borderWidth"),l=ir("contrast"),c=ir("grayscale"),d=ir("hueRotate"),f=ir("invert"),p=ir("gap"),y=ir("gradientColorStops"),b=ir("gradientColorStopPositions"),S=ir("inset"),w=ir("margin"),x=ir("opacity"),M=ir("padding"),T=ir("saturate"),P=ir("scale"),O=ir("sepia"),N=ir("skew"),D=ir("space"),z=ir("translate"),V=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",dn,e],X=()=>[dn,e],ee=()=>["",bc,Vu],ie=()=>["auto",tg,dn],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ae=()=>["solid","dashed","dotted","double","none"],he=()=>["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"],J=()=>["","0",dn],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],H=()=>[tg,dn];return{cacheSize:500,separator:":",theme:{colors:[m0],spacing:[bc,Vu],blur:["none","",Gu,dn],brightness:H(),borderColor:[t],borderRadius:["none","","full",Gu,dn],borderSpacing:X(),borderWidth:ee(),contrast:H(),grayscale:J(),hueRotate:H(),invert:J(),gap:X(),gradientColorStops:[t],gradientColorStopPositions:[wfe,Vu],inset:j(),margin:j(),opacity:H(),padding:X(),saturate:H(),scale:H(),sepia:J(),skew:H(),space:X(),translate:X()},classGroups:{aspect:[{aspect:["auto","square","video",dn]}],container:["container"],columns:[{columns:[Gu]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"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(),dn]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],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",p0,dn]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",dn]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",p0,dn]}],"grid-cols":[{"grid-cols":[m0]}],"col-start-end":[{col:["auto",{span:["full",p0,dn]},dn]}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":[m0]}],"row-start-end":[{row:["auto",{span:[p0,dn]},dn]}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",dn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",dn]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"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":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",dn,e]}],"min-w":[{"min-w":[dn,e,"min","max","fit"]}],"max-w":[{"max-w":[dn,e,"none","full","min","max","fit","prose",{screen:[Gu]},Gu]}],h:[{h:[dn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[dn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[dn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[dn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Gu,Vu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",$E]}],"font-family":[{font:[m0]}],"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",dn]}],"line-clamp":[{"line-clamp":["none",tg,$E]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",bc,dn]}],"list-image":[{"list-image":["none",dn]}],"list-style-type":[{list:["none","disc","decimal",dn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[x]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[x]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",bc,Vu]}],"underline-offset":[{"underline-offset":["auto",bc,dn]}],"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:X()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",dn]}],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",dn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[x]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...pe(),Efe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Mfe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Tfe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[b]}],"gradient-via-pos":[{via:[b]}],"gradient-to-pos":[{to:[b]}],"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:[o]}],"border-w-x":[{"border-x":[o]}],"border-w-y":[{"border-y":[o]}],"border-w-s":[{"border-s":[o]}],"border-w-e":[{"border-e":[o]}],"border-w-t":[{"border-t":[o]}],"border-w-r":[{"border-r":[o]}],"border-w-b":[{"border-b":[o]}],"border-w-l":[{"border-l":[o]}],"border-opacity":[{"border-opacity":[x]}],"border-style":[{border:[...ae(),"hidden"]}],"divide-x":[{"divide-x":[o]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[o]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[x]}],"divide-style":[{divide:ae()}],"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:["",...ae()]}],"outline-offset":[{"outline-offset":[bc,dn]}],"outline-w":[{outline:[bc,Vu]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[x]}],"ring-offset-w":[{"ring-offset":[bc,Vu]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Gu,Pfe]}],"shadow-color":[{shadow:[m0]}],opacity:[{opacity:[x]}],"mix-blend":[{"mix-blend":[...he(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":he()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Gu,dn]}],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":[x]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",dn]}],duration:[{duration:H()}],ease:[{ease:["linear","in","out","in-out",dn]}],delay:[{delay:H()}],animate:[{animate:["none","spin","ping","pulse","bounce",dn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[p0,dn]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"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",dn]}],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",dn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":X()}],"scroll-mx":[{"scroll-mx":X()}],"scroll-my":[{"scroll-my":X()}],"scroll-ms":[{"scroll-ms":X()}],"scroll-me":[{"scroll-me":X()}],"scroll-mt":[{"scroll-mt":X()}],"scroll-mr":[{"scroll-mr":X()}],"scroll-mb":[{"scroll-mb":X()}],"scroll-ml":[{"scroll-ml":X()}],"scroll-p":[{"scroll-p":X()}],"scroll-px":[{"scroll-px":X()}],"scroll-py":[{"scroll-py":X()}],"scroll-ps":[{"scroll-ps":X()}],"scroll-pe":[{"scroll-pe":X()}],"scroll-pt":[{"scroll-pt":X()}],"scroll-pr":[{"scroll-pr":X()}],"scroll-pb":[{"scroll-pb":X()}],"scroll-pl":[{"scroll-pl":X()}],"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",dn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[bc,Vu,$E]}],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"]}}},kfe=pfe(Ife);function Je(...t){return kfe(tr(t))}function Ng(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}function g0({label:t,value:e,tone:n}){return v.jsxs("div",{className:Je("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:[v.jsx("span",{className:"flex items-center gap-1.5",children:t}),v.jsx("span",{className:"font-mono text-[10px]",children:e})]})}function Ofe(){var n;const{data:t}=CC(3e3),e=()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}}));return v.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:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/20 pb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(l9,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Updates & Pflege"})]}),(t==null?void 0:t.last_check)&&v.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?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(g0,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),v.jsx(g0,{label:"Inferenz-Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),v.jsx(g0,{label:"Router (llama-swap)",tone:t.swap>0?"alert":"muted",value:t.swap>0?"Update verfügbar":"aktuell"}),v.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=>v.jsx(g0,{tone:r.update===!0?"alert":"muted",label:v.jsxs(v.Fragment,{children:[r.name,r.reachable===!1&&v.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))]}):v.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."})]}),v.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 ",v.jsx(lF,{className:"h-3.5 w-3.5"})]})]})}function gV({type:t,title:e,message:n,defaultValue:r,autoValue:i,autoLabel:s,onConfirm:a,onCancel:o}){const l=R.useRef(null);return v.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":e,children:v.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:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:e}),v.jsx("button",{onClick:o||(()=>a()),"aria-label":"Schließen",className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Ed,{className:"h-4 w-4","aria-hidden":"true"})})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:n}),t==="prompt"&&v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{ref:l,type:"text",defaultValue:r,"aria-label":e,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"&&a((d=l.current)==null?void 0:d.value)}}),i!==void 0&&v.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"})]}),v.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(t==="confirm"||t==="prompt")&&v.jsx("button",{onClick:o,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"}),v.jsx("button",{onClick:()=>{var d;const c=t==="prompt"?(d=l.current)==null?void 0:d.value:void 0;a(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((o,l,c)=>{e({type:"alert",title:o,message:l,onConfirm:()=>{e(null),c==null||c()}})},[]),i=R.useCallback((o,l,c,d)=>{e({type:"confirm",title:o,message:l,onConfirm:()=>{e(null),c()},onCancel:()=>{e(null),d==null||d()}})},[]),s=R.useCallback((o,l,c,d,f,p)=>{e({type:"prompt",title:o,message:l,defaultValue:c,autoValue:p==null?void 0:p.autoValue,autoLabel:p==null?void 0:p.autoLabel,onConfirm:y=>{e(null),d(y)},onCancel:()=>{e(null),f==null||f()}})},[]),a=t?v.jsx(gV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:a}}function Lfe(){const t=Nd(),{data:e}=PC(3e3),{data:n}=Bg(),{showAlert:r,dialogElement:i}=tv(),[s,a]=R.useState(!1),o=(n==null?void 0:n.models)??[];async function l(c){try{await It("/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:qn.agentStatus}),a(!1)}catch(d){r("Fehler",`Fehler beim Wechseln des Gehirns: ${d.message}`)}}return v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx($c,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(e==null?void 0:e.terminal_url)&&v.jsxs("a",{href:Ng(e.terminal_url),target:"_blank",rel:"noopener",className:Je("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:[v.jsx(xg,{className:"h-3 w-3"})," Terminal öffnen"]})]}),e?v.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),v.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v.jsx("span",{className:Je("h-2 w-2 rounded-full",e.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-medium",children:e.gateway_reachable?"Online":"Offline"})]})]}),v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Terminal"}),v.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v.jsx("span",{className:Je("h-2 w-2 rounded-full",e.terminal_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-medium",children:e.terminal_reachable?"Online":"Offline"})]})]}),v.jsxs("div",{onClick:()=>a(!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:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),v.jsx(Md,{className:"h-3 w-3 text-primary"})]}),v.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[v.jsx(_C,{className:"h-3 w-3 shrink-0"}),e.brain_model||"auto"]})]}),v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),v.jsx(wC,{className:"h-3 w-3 text-primary"})]}),v.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[v.jsxs("div",{children:["Config: ",e.has_config?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),v.jsxs("div",{children:["Skills: ",e.has_skills?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),v.jsxs("div",{children:["Memory: ",e.has_memories?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):v.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),e&&v.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"Telegram"}),v.jsx("span",{className:Je("font-semibold",e.telegram_enabled?"text-emerald-400":""),children:e.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"MCP-Server"}),v.jsxs("span",{className:"font-semibold text-foreground",children:[e.mcp_server_count??0," verbunden"]})]}),v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"PC Executor"}),v.jsx("span",{className:Je("font-semibold",e.pc_executor_reachable?"text-emerald-400":""),children:e.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),e&&s&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.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:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(Md,{className:"h-4 w-4"}),v.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),v.jsx("button",{onClick:()=>a(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.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 (',v.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),v.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...o.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 v.jsxs("button",{onClick:()=>l(c),className:Je("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:[v.jsxs("div",{className:"flex flex-col text-left",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:c}),v.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")&&v.jsx(Sa,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function Dfe(){const t=Nd(),{data:e=[]}=BT({limit:3}),[n,r]=R.useState(""),[i,s]=R.useState("stable"),[a,o]=R.useState(!1);async function l(){if(!(!n.trim()||a)){o(!0);try{await It("/api/memory",{method:"POST",body:JSON.stringify({content:n,category:i,source:"dashboard"})}),r(""),t.invalidateQueries({queryKey:["memory"]})}catch(c){console.error(c)}finally{o(!1)}}}return v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[v.jsx(W1,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsx("textarea",{value:n,onChange:c=>r(c.target.value),"aria-label":"Fakt oder Regel im Gedächtnis speichern",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"}),v.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[v.jsxs("select",{value:i,onChange:c=>s(c.target.value),"aria-label":"Kategorie",className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[v.jsx("option",{value:"stable",children:"🔵 Fakt"}),v.jsx("option",{value:"instruction",children:"📋 Regel"}),v.jsx("option",{value:"user",children:"👤 User"}),v.jsx("option",{value:"versioned",children:"🟡 Version"})]}),v.jsxs("button",{onClick:l,disabled:!n.trim()||a,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:[v.jsx(OT,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),v.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[v.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),v.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:e.length===0?v.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):e.map(c=>v.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[v.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}),v.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:c.content,children:c.content})]},c.id))})]})]}),v.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 I3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Ufe(){const{data:t}=TC(3e3),e=U7(),n=e[e.length-1],r=n?Math.round(n.prompt+n.completion):0;return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(bC,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t&&v.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[v.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:r.toLocaleString("de-DE")}),v.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),t&&v.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[v.jsxs("div",{children:[t.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",v.jsxs("span",{className:"text-emerald-400/90",children:[t.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),v.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",t.prompt_tokens.toLocaleString("de-DE")," · Output ",t.completion_tokens.toLocaleString("de-DE")]})]})]}),v.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:I3.map(i=>v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),v.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),v.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?v.jsx(uV,{data:e,series:I3,unit:" tok/s",yMode:"auto",height:150}):v.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),v.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 jfe(){const{data:t}=M7(3e3),{showAlert:e,dialogElement:n}=tv(),[r,i]=R.useState({});async function s(a){i(o=>({...o,[a]:!0}));try{const o=await It("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:a})});o.ok||e("Fehler",`Neustart fehlgeschlagen: ${o.err||"Unbekannt"}`)}catch(o){e("Fehler",`Fehler: ${o.message}`)}finally{i(o=>({...o,[a]:!1}))}}return v.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:[v.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(rw,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Dienste"})]}),v.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?v.jsxs("div",{className:"flex flex-1 flex-col",children:[v.jsx("div",{className:"space-y-1.5",children:t.services.map(a=>v.jsxs("div",{className:"group flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[v.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[v.jsx("span",{className:Je("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",a.ok?"bg-emerald-500":"bg-amber-500")}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"truncate text-xs font-bold text-foreground",children:a.name}),v.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:a.url})]})]}),v.jsx("button",{onClick:()=>s(a.name),disabled:r[a.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:v.jsx(Jf,{className:Je("h-3.5 w-3.5",r[a.name]&&"animate-spin")})})]},a.name))}),v.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:[v.jsxs("a",{href:Ng(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:[v.jsx(xg,{className:"h-3 w-3"})," Engine"]}),v.jsxs("a",{href:Ng(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:[v.jsx(xg,{className:"h-3 w-3"})," Gateway"]})]})]}):v.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Dienste…"}),n]})}const XE=[{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 Ffe({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 v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[v.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[v.jsx("span",{className:"text-xs font-semibold text-foreground",children:e}),v.jsx("span",{className:"truncate text-[10px] text-muted-foreground/60",children:n})]}),i?v.jsx("span",{className:"shrink-0 font-mono text-sm font-bold tabular-nums text-foreground",children:jb(t.p50_ms)}):v.jsx("span",{className:"shrink-0 text-[10px] italic text-muted-foreground/50",children:"noch keine Messungen"})]}),v.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-background/50 border border-border/30",children:v.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&&v.jsxs("div",{className:"flex items-center gap-3 font-mono text-[10px] text-muted-foreground/65",children:[v.jsxs("span",{children:["p50 ",jb(t.p50_ms)]}),v.jsxs("span",{children:["p95 ",jb(t.p95_ms)]}),v.jsxs("span",{children:["zuletzt ",jb(t.last_ms)]}),v.jsxs("span",{className:"text-muted-foreground/45",children:["· n=",t.count]})]})]})}function zfe(){const{data:t}=A7(5e3),e=Math.max(1,...XE.map(r=>{var i;return((i=t==null?void 0:t[r.key])==null?void 0:i.p95_ms)??0})),n=XE.some(r=>{var i;return(((i=t==null?void 0:t[r.key])==null?void 0:i.count)??0)>0});return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[v.jsx(dF,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Sprach-Latenz"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),v.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:XE.map(r=>v.jsx(Ffe,{stat:t==null?void 0:t[r.key],label:r.label,hint:r.hint,maxP95:e},r.key))}),v.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."})]})}const vV=["fast","heavy","coder","vision","hermes","scout"],Bfe={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"},yV=t=>t&&Bfe[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function Hfe({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 v.jsxs("span",{className:Je("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 k3(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 Vfe(){var y,b,S;const{data:t}=Bg(2e3),{data:e}=TC(2e3),{data:n}=$y(),r=(t==null?void 0:t.models)??[],i=(t==null?void 0:t.running)??[],s=((y=n==null?void 0:n.gpu)==null?void 0:y.gtt_total)||((b=n==null?void 0:n.gpu)==null?void 0:b.vram_total)||0,a=((S=n==null?void 0:n.gpu)==null?void 0:S.gtt_used)||0,o=s>0?Math.min(100,a/s*100):0,l=o>=88?"bg-red-500":o>=70?"bg-amber-500":"bg-teal-500",c=o>=88?"text-red-400":o>=70?"text-amber-400":"text-foreground",d=R.useRef(null),[f,p]=R.useState(!1);return R.useEffect(()=>{if(!e)return;const w=e.total_tokens;if(d.current!==null&&w>d.current){p(!0);const x=setTimeout(()=>p(!1),4e3);return d.current=w,()=>clearTimeout(x)}d.current=w},[e==null?void 0:e.total_tokens]),v.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",children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(nw,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Modelle"})]}),v.jsxs("span",{className:Je("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",f?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[f?v.jsx(wh,{className:"h-3 w-3 animate-pulse"}):v.jsx(J8,{className:"h-3 w-3"}),f?"Inferenz aktiv":"Idle"]})]}),s>0&&v.jsxs("div",{className:"mb-4",children:[v.jsxs("div",{className:"flex items-center justify-between text-[10px] font-mono text-muted-foreground/80 mb-1",children:[v.jsx("span",{className:"uppercase tracking-wider font-semibold",children:"Speicher-Pool"}),v.jsxs("span",{children:[v.jsx("span",{className:Je("font-bold",c),children:sd(a)})," / ",sd(s)," GB belegt"]})]}),v.jsx("div",{className:"h-1.5 w-full rounded-full bg-background/50 border border-border/30 overflow-hidden",children:v.jsx("div",{className:Je("h-full rounded-full transition-all duration-500",l),style:{width:`${o}%`}})})]}),v.jsx("div",{className:"space-y-2 flex-1",children:vV.map(w=>{var T;const x=r.find(P=>P.role===w),M=x?i.includes(x.name):!1;return v.jsxs("div",{className:Je("flex items-center justify-between gap-2 p-2 rounded-xl border transition-all duration-300",M?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":x?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[v.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v.jsx("span",{className:Je("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",yV(w)),children:w}),v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:x?(T=x.name.split("/").pop())==null?void 0:T.replace(/\.gguf$/i,""):"nicht zugewiesen"}),x&&v.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap text-muted-foreground/70",children:[v.jsx("span",{className:"text-[9px] font-mono",children:Io(x.size_bytes)}),x.prompt_cache&&v.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"}),x.spec_active&&v.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: ${x.spec_draft_model})`,children:"SPEC"}),x.parallel_slots>1&&v.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:`${x.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",x.parallel_slots]}),x.incomplete&&v.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"})]})]})]}),v.jsx("span",{className:"shrink-0",children:x?M?v.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[v.jsx("span",{className:Je("h-1.5 w-1.5 rounded-full bg-emerald-500",f&&"animate-pulse")})," warm"]}):v.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):v.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},w)})}),v.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. Details & Routing im Modell-Manager."})]})}function O3({children:t}){return v.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t})}function Gfe(){return v.jsxs("div",{className:"space-y-7",children:[v.jsxs("div",{children:[v.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"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),v.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[v.jsx(tfe,{}),v.jsx(Ufe,{}),v.jsx(Vfe,{})]}),v.jsxs("section",{children:[v.jsx(O3,{children:"Stack & Telemetrie"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[v.jsx(jfe,{}),v.jsx(zfe,{})]})]}),v.jsxs("section",{children:[v.jsx(O3,{children:"Betrieb & Wissen"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[v.jsx(Ofe,{}),v.jsx(Lfe,{}),v.jsx(Dfe,{})]})]})]})}function Wfe(){const t=Nd(),{data:e=[]}=P7(2e3),{showAlert:n,dialogElement:r}=tv();async function i(o){try{await It(`/api/jobs/${o}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:qn.jobs})}catch(l){n("Fehler",l.message)}}const s=e.filter(o=>o.state==="running"||o.state==="queued"),a=e.filter(o=>o.state!=="running"&&o.state!=="queued").slice(-3);return s.length===0&&a.length===0?null:v.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:[v.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),s.map(o=>v.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[v.jsxs("div",{className:"flex justify-between items-center text-xs",children:[v.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:o.label}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-muted-foreground font-mono",children:[o.progress??0,"% • ",WT(o.done_bytes),"/",WT(o.total_bytes),o.eta_s?` • ETA ${z7(o.eta_s)}`:""]}),v.jsx("button",{onClick:()=>i(o.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"})]})]}),v.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:v.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${o.progress??0}%`}})})]},o.id)),a.map(o=>v.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[v.jsx("span",{className:"truncate",children:o.label}),v.jsx("span",{className:Je("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",o.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:o.state})]},o.id)),r]})}function Pf({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 v.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${n[e]}`,children:t})}function L3({caps:t}){return t?v.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&v.jsx(Pf,{children:"💻 Code"}),t.vision&&v.jsx(Pf,{children:"👁 Bild"}),t.reasoning&&v.jsx(Pf,{children:"🧠 Reason"}),t.moe&&v.jsxs(Pf,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&v.jsx(Pf,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&v.jsx(Pf,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&v.jsx(Pf,{children:"🔢 Embed"})]}):null}function $fe({model:t,onClose:e,onChanged:n}){var S,w;const{data:r,isLoading:i}=N7(t.gguf_path),[s,a]=R.useState(null),[o,l]=R.useState(""),c=r==null?void 0:r.target_vocab,d=(r==null?void 0:r.drafts)??[],f=d.filter(x=>x.compatible===!0),p=t.spec_draft_model;async function y(x){a(x??"__clear__"),l("");try{await It(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:x})}),n(),e()}catch(M){l(String((M==null?void 0:M.message)||M)),a(null)}}const b=x=>{var M;return x?`${x.pre??"?"} · ${((M=x.n_vocab)==null?void 0:M.toLocaleString())??"?"} Tokens`:"—"};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.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:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[v.jsx(wh,{className:"h-4 w-4"})," Speculative Draft"]}),v.jsx("button",{onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.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 ',v.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),v.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:[v.jsx("span",{className:"text-muted-foreground",children:(S=t.name.split("/").pop())==null?void 0:S.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-foreground",children:["Vocab: ",b(c)]})]}),t.spec_active&&p&&v.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:[v.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[v.jsx(Sa,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",p]}),v.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)&&v.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:[v.jsx(bg,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),v.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?v.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):d.length===0?v.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 ",v.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(x=>{var P,O;const M=x.filename===p,T=x.compatible===!0;return v.jsxs("div",{className:Je("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:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:x.filename}),v.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[Io(x.size_bytes)," · Vocab: ",b(x.vocab)]})]}),T?M?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[v.jsx(Sa,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("button",{onClick:()=>y(x.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"}):v.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:x.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(P=x.vocab)==null?void 0:P.pre}/${(O=x.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:[v.jsx(bg,{className:"h-3.5 w-3.5"})," ",x.compatible===!1?"Vocab ≠":"n/a"]})]},x.path)})}),!i&&(r==null?void 0:r.target_exists)&&d.length>0&&f.length===0&&v.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=",v.jsx("span",{className:"font-mono",children:c==null?void 0:c.pre}),", n_vocab=",v.jsx("span",{className:"font-mono",children:(w=c==null?void 0:c.n_vocab)==null?void 0:w.toLocaleString()}),")."]}),o&&v.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:o})]})})}const Xfe=["fast","heavy","heavy_chars"],qfe=["coder_lite","coder","coding_escalate_chars"];function Kfe(){const t=Nd(),{data:e,isLoading:n}=T7(),[r,i]=R.useState(null),[s,a]=R.useState(!1),[o,l]=R.useState(""),[c,d]=R.useState(0);if(R.useEffect(()=>{e!=null&&e.policy&&!r&&i({...e.policy})},[e,r]),n||!e||!r)return v.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=x=>e.fields.find(M=>M.key===x),p=Object.keys(r).some(x=>r[x]!==e.policy[x]),y=(x,M)=>{i(T=>T&&{...T,[x]:M}),l("")},b=x=>y(x,e.defaults[x]);async function S(){if(!r)return;const x={};for(const M of Object.keys(r))r[M]!==e.policy[M]&&(x[M]=r[M]);if(Object.keys(x).length!==0){a(!0),l("");try{const{policy:M}=await _7(x);i({...M}),t.invalidateQueries({queryKey:qn.routingPolicy}),t.invalidateQueries({queryKey:qn.routing}),d(Date.now()),setTimeout(()=>d(0),2e3)}catch(M){l(M.message||String(M))}finally{a(!1)}}}function w({k:x}){const M=f(x),T=r[x],P=r[x]===e.defaults[x];return v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsx("label",{className:"text-[10px] font-semibold text-muted-foreground",children:M.label}),!P&&v.jsxs("button",{onClick:()=>b(x),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[x])||"leer"})`,children:[v.jsx(hF,{className:"h-2.5 w-2.5"})," Default"]})]}),M.type==="bool"?v.jsxs("button",{onClick:()=>y(x,!T),className:Je("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:[v.jsx("span",{children:T?"An":"Aus"}),v.jsx("span",{className:Je("h-3.5 w-3.5 rounded-full transition-colors",T?"bg-emerald-400":"bg-muted-foreground/40")})]}):M.type==="int"?v.jsx("input",{type:"number",value:T,min:M.min,max:M.max,"aria-label":M.label,onChange:O=>y(x,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"}):v.jsx("input",{type:"text",value:T,"aria-label":M.label,spellCheck:!1,placeholder:x==="coder_lite"?"(leer = aus)":"",onChange:O=>y(x,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 v.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:[v.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(c9,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Lane-Routing & Policy"}),v.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"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[o&&v.jsx("span",{className:"text-[10px] text-red-400 max-w-[280px] truncate",title:o,children:o}),c>0&&v.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-emerald-400",children:[v.jsx(Sa,{className:"h-3.5 w-3.5"})," gespeichert"]}),v.jsxs("button",{onClick:S,disabled:!p||s,className:Je("h-8 px-4 rounded-lg text-[10px] font-bold uppercase tracking-wide transition-all flex items-center gap-1.5",p&&!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?v.jsx($1,{className:"h-3.5 w-3.5 animate-spin"}):null,"Speichern"]})]})]}),v.jsxs("p",{className:"text-[10px] text-muted-foreground/70 leading-relaxed -mt-1",children:["Welches echte Modell hinter den virtuellen Lanes ",v.jsx("code",{className:"text-cyan-300",children:"chat"})," und"," ",v.jsx("code",{className:"text-cyan-300",children:"coding"})," steckt. Änderungen greifen sofort (kein Neustart). Die Keyword-Heuristiken bleiben im Code."]}),v.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[v.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[v.jsx(Z8,{className:"h-4 w-4 text-teal-400"}),v.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"chat"}),v.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(= auto)"})]}),Xfe.map(x=>v.jsx(w,{k:x},x))]}),v.jsxs("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center gap-2 border-b border-border/30 pb-2",children:[v.jsx(O8,{className:"h-4 w-4 text-indigo-400"}),v.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wider text-foreground",children:"coding"}),v.jsx("span",{className:"text-[9px] text-muted-foreground/60 font-mono",children:"(agentisch → immer Coder)"})]}),qfe.map(x=>v.jsx(w,{k:x},x))]})]}),v.jsx("div",{className:"rounded-xl border border-border/40 bg-background/25 p-4",children:v.jsx("div",{className:"max-w-xs",children:v.jsx(w,{k:"fast_no_think"})})})]})}function Yfe(){var de,Z,Ve,Le;const t=Nd(),{data:e,isLoading:n,error:r}=Bg(4e3),{data:i}=CC(4e3),{data:s}=C7(),{data:a}=$y(),{data:o}=E7(),{showAlert:l,showConfirm:c,showPrompt:d,dialogElement:f}=tv(),p=(e==null?void 0:e.models)??[],y=(e==null?void 0:e.running)??[],b=r?String(r):"",S=()=>{t.invalidateQueries({queryKey:qn.models}),t.invalidateQueries({queryKey:qn.routing})},w=(de=o==null?void 0:o.groups)==null?void 0:de.brains,x=(w==null?void 0:w.members)??[],M=ne=>x.includes(ne),T=x.some(ne=>y.includes(ne));async function P(ne){if(!w){l("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 Xe=x.includes(ne)?x.filter(Ze=>Ze!==ne):[...x,ne];try{await b7("brains",Xe,w.swap??!1,w.persist??!0),t.invalidateQueries({queryKey:qn.groups}),S()}catch(Ze){l("Fehler",`Ko-Residenz konnte nicht geändert werden: ${Ze.message||Ze}`)}}const[O,N]=R.useState(null),[D,z]=R.useState(null),[V,k]=R.useState(null),[j,X]=R.useState("grid"),[ee,ie]=R.useState("all"),pe=p.filter(ne=>ee==="in_use"?!!ne.role||y.includes(ne.name):!0);async function ae(ne){try{await It(`/api/models/${encodeURIComponent(ne)}/load`,{method:"POST"}),S()}catch(Ce){l("Fehler",`Fehler beim Laden des Modells: ${Ce.message}`)}}async function he(ne){if(w&&T&&!M(ne)){const Ce=x.filter(Xe=>y.includes(Xe)).map(Xe=>Xe.split("/").pop()).join(", ");c("Verdrängt das Hirn?",`„${ne.split("/").pop()}“ ist nicht in der Ko-Residenz-Gruppe „brains“. Beim Laden wirft es das aktuell warme Hirn (${Ce}) raus — Lucy verliert Hirn bzw. Augen. -Trotzdem exklusiv laden? Tipp: Mit dem 🧠-Schalter machst du das Modell dauerhaft ko-resident, dann bleiben beide warm.`,()=>ae(ne));return}ae(ne)}async function B(ne){try{await It(`/api/models/${encodeURIComponent(ne)}/unload`,{method:"POST"}),S()}catch(Ce){l("Fehler",`Fehler beim Entladen des Modells: ${Ce.message}`)}}async function J(){try{await It("/api/models/unload",{method:"POST"}),S()}catch(ne){l("Fehler",`Fehler beim Entladen aller Modelle: ${ne.message}`)}}async function Y(ne,Ce){try{await It(`/api/models/${encodeURIComponent(Ce)}/role`,{method:"POST",body:JSON.stringify({role:ne||null})}),S()}catch(qe){l("Fehler",`Fehler beim Zuweisen der Rolle: ${qe.message||qe}`)}}function H(ne){N(ne),z(null),It(`/api/roles/${encodeURIComponent(ne)}/recommend`).then(Ce=>z(Ce)).catch(()=>{})}async function G(ne,Ce){let qe=null;try{qe=await It(`/api/models/${encodeURIComponent(ne)}/ctx/auto`)}catch{}const Ze=qe?`Optimal für dein Setup: ${(qe.ctx/1024).toFixed(0)}k (${qe.ctx}) — GTT ${qe.gtt_gb} GB − reserviert ${qe.reserved_gb} GB (${qe.mode}) → ${qe.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";d("Kontextlänge anpassen",Ze,String(Ce||32768),async Q=>{if(Q)try{await It(`/api/models/${encodeURIComponent(ne)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Q,10)})}),S()}catch(W){l("Fehler",`Fehler beim Setzen des Kontexts: ${W.message||W}`)}},void 0,qe?{autoValue:String(qe.ctx),autoLabel:`Auto (${(qe.ctx/1024).toFixed(0)}k)`}:void 0)}async function le(ne){c("Modell löschen?",`Modell '${ne}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await It(`/api/models/${encodeURIComponent(ne)}`,{method:"DELETE"}),S()}catch(Ce){l("Fehler",`Fehler beim Löschen: ${Ce.message||Ce}`)}})}async function se(ne,Ce,qe,Ze){try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:ne,role:Ce,quant:qe,jinja:Ze})}),l("Herunterladen gestartet",`Download für '${ne}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Q){l("Fehler",`Fehler beim Starten des Upgrades: ${Q.message||Q}`)}}async function ce(ne){const Ce=s==null?void 0:s.budget,qe=Ce&&!Ce.fits?` +Trotzdem exklusiv laden? Tipp: Mit dem 🧠-Schalter machst du das Modell dauerhaft ko-resident, dann bleiben beide warm.`,()=>ae(ne));return}ae(ne)}async function B(ne){try{await It(`/api/models/${encodeURIComponent(ne)}/unload`,{method:"POST"}),S()}catch(Ce){l("Fehler",`Fehler beim Entladen des Modells: ${Ce.message}`)}}async function J(){try{await It("/api/models/unload",{method:"POST"}),S()}catch(ne){l("Fehler",`Fehler beim Entladen aller Modelle: ${ne.message}`)}}async function Y(ne,Ce){try{const Xe=await It(`/api/models/${encodeURIComponent(Ce)}/role`,{method:"POST",body:JSON.stringify({role:ne||null})});S(),Xe!=null&&Xe.warning&&l("Hirn gesetzt — Hinweis",Xe.warning)}catch(Xe){l("Fehler",`Fehler beim Zuweisen der Rolle: ${Xe.message||Xe}`)}}function H(ne){N(ne),z(null),It(`/api/roles/${encodeURIComponent(ne)}/recommend`).then(Ce=>z(Ce)).catch(()=>{})}async function G(ne,Ce){let Xe=null;try{Xe=await It(`/api/models/${encodeURIComponent(ne)}/ctx/auto`)}catch{}const Ze=Xe?`Optimal für dein Setup: ${(Xe.ctx/1024).toFixed(0)}k (${Xe.ctx}) — GTT ${Xe.gtt_gb} GB − reserviert ${Xe.reserved_gb} GB (${Xe.mode}) → ${Xe.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";d("Kontextlänge anpassen",Ze,String(Ce||32768),async Q=>{if(Q)try{await It(`/api/models/${encodeURIComponent(ne)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Q,10)})}),S()}catch(W){l("Fehler",`Fehler beim Setzen des Kontexts: ${W.message||W}`)}},void 0,Xe?{autoValue:String(Xe.ctx),autoLabel:`Auto (${(Xe.ctx/1024).toFixed(0)}k)`}:void 0)}async function le(ne){c("Modell löschen?",`Modell '${ne}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await It(`/api/models/${encodeURIComponent(ne)}`,{method:"DELETE"}),S()}catch(Ce){l("Fehler",`Fehler beim Löschen: ${Ce.message||Ce}`)}})}async function se(ne,Ce,Xe,Ze){try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:ne,role:Ce,quant:Xe,jinja:Ze})}),l("Herunterladen gestartet",`Download für '${ne}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Q){l("Fehler",`Fehler beim Starten des Upgrades: ${Q.message||Q}`)}}async function ce(ne){const Ce=s==null?void 0:s.budget,Xe=Ce&&!Ce.fits?` -⚠ Speicher-Warnung: Dieses Brain (~${Ce.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${Ce.largest_ondemand_gb} GB) sprengt das das Budget (${Ce.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";c("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${ne.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${qe}`,async()=>{try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:ne,role:"hermes",quant:"Q4_K_M",jinja:!0})}),l("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),S()}catch(Ze){l("Fehler",`Update fehlgeschlagen: ${Ze.message||Ze}`)}})}if(n)return v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(b)return v.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 (",b,")."]});const Se=p.filter(ne=>y.includes(ne.name)),we=Se.reduce((ne,Ce)=>ne+(Ce.size_bytes||0),0),We=((Z=a==null?void 0:a.gpu)==null?void 0:Z.gtt_total)||((Ve=a==null?void 0:a.gpu)==null?void 0:Ve.vram_total)||0,Ee=((Le=a==null?void 0:a.gpu)==null?void 0:Le.gtt_used)||0,Ge=16*1024**3,$e=We>2*1024**3?We:we>Ge?we*1.2:Ge;return v.jsxs("div",{className:"space-y-8",children:[v.jsx("style",{children:` +⚠ Speicher-Warnung: Dieses Brain (~${Ce.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${Ce.largest_ondemand_gb} GB) sprengt das das Budget (${Ce.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";c("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${ne.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${Xe}`,async()=>{try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:ne,role:"hermes",quant:"Q4_K_M",jinja:!0})}),l("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),S()}catch(Ze){l("Fehler",`Update fehlgeschlagen: ${Ze.message||Ze}`)}})}if(n)return v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(b)return v.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 (",b,")."]});const Se=p.filter(ne=>y.includes(ne.name)),we=Se.reduce((ne,Ce)=>ne+(Ce.size_bytes||0),0),We=((Z=a==null?void 0:a.gpu)==null?void 0:Z.gtt_total)||((Ve=a==null?void 0:a.gpu)==null?void 0:Ve.vram_total)||0,Ee=((Le=a==null?void 0:a.gpu)==null?void 0:Le.gtt_used)||0,Ge=16*1024**3,$e=We>2*1024**3?We:we>Ge?we*1.2:Ge;return v.jsxs("div",{className:"space-y-8",children:[v.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -597,21 +602,21 @@ Trotzdem exklusiv laden? Tipp: Mit dem 🧠-Schalter machst du das Modell dauerh stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),v.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:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(rE,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",Io(we)," Gewichte",Ee>0?` · ${Io(Ee)} real belegt (inkl. KV)`:""," / ",Io($e)]}),y.length>0&&v.jsx("button",{onClick:J,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"})]})]}),v.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:Se.length===0?v.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"}):Se.map((ne,Ce)=>{var Q;const qe=(ne.size_bytes||0)/$e*100,Ze=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][Ce%4];return v.jsxs("div",{style:{width:`${qe}%`},className:Je("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",Ze),title:`${ne.name} (${Io(ne.size_bytes)})`,children:[v.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[ne.role?`[${ne.role}] `:"",(Q=ne.name.split("/").pop())==null?void 0:Q.replace(".gguf","")]}),v.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Io(ne.size_bytes)})]},ne.name)})})]}),v.jsx(qfe,{}),v.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:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),v.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(ne=>{var Ze;const Ce=p.find(Q=>Q.role===ne),qe=Ce?y.includes(Ce.name):!1;return v.jsxs("div",{onClick:()=>H(ne),className:Je("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]",qe?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":Ce?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:Je("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",vV(ne)),children:ne}),qe&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:Ce==null?void 0:Ce.name,children:Ce?(Ze=Ce.name.split("/").pop())==null?void 0:Ze.replace(/\.gguf$/i,""):"nicht zugewiesen"}),v.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},ne)})})]}),(s==null?void 0:s.current)&&v.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:[v.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx($c,{className:"h-4.5 w-4.5 text-indigo-400"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),s.current.version!=null&&v.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",s.current.version]})]}),v.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"agent"}})),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",title:"Hirn-Wechsel passiert jetzt zentral im Hermes-Tab",children:"Im Hermes-Tab wechseln →"})]}),v.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:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:s.current.name,children:s.current.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsx("span",{children:s.current.params_b?`${s.current.params_b}B`:"—"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:s.current.quant||"GGUF"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:Io(s.current.size_bytes||0)})]})]}),s.update_available&&s.recommended?v.jsxs("button",{onClick:()=>ce(s.recommended.repo),className:Je("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",s.budget&&!s.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:[v.jsx(yg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):v.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:[v.jsx(Sa,{className:"h-4 w-4"})," Neueste Generation"]})]}),s.update_available&&s.recommended&&v.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",v.jsx("span",{className:"font-mono font-bold",children:s.recommended.name.replace(/-GGUF$/i,"")}),"(v",s.recommended.version,", ",s.recommended.params_b,"B) — von NousResearch."]}),s.budget&&v.jsxs("div",{className:Je("text-[10px] flex items-start gap-1.5 leading-relaxed",s.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[v.jsx(rE,{className:"h-3 w-3 shrink-0 mt-0.5"}),v.jsxs("span",{children:["Always-On-Brain ~",s.budget.brain_gb," GB + größtes on-demand (~",s.budget.largest_ondemand_gb," GB) = ",(s.budget.brain_gb+s.budget.largest_ondemand_gb).toFixed(1)," / ",s.budget.gtt_gb," GB",s.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[v.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",pe.length," von ",p.length,")"]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>ie("all"),className:Je("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ee==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),v.jsx("button",{onClick:()=>ie("in_use"),className:Je("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ee==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>X("grid"),className:Je("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",j==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),v.jsx("button",{onClick:()=>X("list"),className:Je("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",j==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),j==="grid"?v.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:pe.length===0?v.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:ee==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):pe.map(ne=>{const Ce=y.includes(ne.name),qe=i==null?void 0:i.model_list.find(Q=>Q.role===ne.role),Ze=k3(ne.name);return v.jsxs("div",{className:Je("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",Ce?"border-primary/45 shadow-primary/5":ne.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[v.jsxs("div",{className:"space-y-3",children:[v.jsx("div",{className:"flex items-start justify-between gap-3",children:v.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[v.jsx("div",{className:Je("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ze.color),title:Ze.name,children:Ze.initial}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:ne.name,children:ne.name.split("/").pop()}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[v.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:ne.quant||"GGUF"}),Ce&&v.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[v.jsx(bC,{className:"h-3 w-3 animate-pulse"})," Warm"]}),ne.role&&v.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:ne.role}),M(ne.name)&&v.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"}),ne.prompt_cache&&v.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"}),ne.spec_active?v.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: ${ne.spec_draft_model})`,children:"SPEC"}):ne.spec_draft_model?v.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 (${ne.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,ne.parallel_slots>1&&v.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:`${ne.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ne.parallel_slots]}),ne.incomplete&&v.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"})]})]})]})}),v.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:v.jsx(L3,{caps:ne.capabilities})})]}),v.jsxs("div",{className:"space-y-3 pt-1",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(rE,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),v.jsx("div",{className:"text-foreground font-semibold",children:Io(ne.size_bytes)})]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(e9,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),v.jsx("div",{className:"text-foreground font-semibold",children:PI(ne.ctx)})]})]})]}),qe&&v.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:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),v.jsxs("span",{children:["Upgrade verfügbar: ",qe.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>se(qe.repo,ne.role,ne.quant||"Q4_K_M",ne.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:[v.jsx(yg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[v.jsx("button",{onClick:()=>Ce?B(ne.name):he(ne.name),disabled:ne.incomplete&&!Ce,className:Je("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",ne.incomplete&&!Ce?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":Ce?"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:Ce?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>G(ne.name,ne.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"}),w&&v.jsx("button",{onClick:()=>P(ne.name),className:Je("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",M(ne.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:M(ne.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:"🧠"}),v.jsxs("button",{onClick:()=>k(ne),className:Je("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",ne.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":ne.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:[v.jsx(wh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>le(ne.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","aria-label":"Modell löschen",title:"Modell löschen",children:v.jsx(LT,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})]},ne.name)})}):v.jsx("div",{className:"space-y-2",children:pe.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ee==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):pe.map(ne=>{const Ce=y.includes(ne.name),qe=k3(ne.name);return v.jsxs("div",{className:Je("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",Ce?"border-primary/45":ne.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[v.jsx("div",{className:Je("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",qe.color),title:qe.name,children:qe.initial}),v.jsxs("div",{className:"min-w-0 text-left",children:[v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:ne.name,children:ne.name.split("/").pop()}),ne.role&&v.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:ne.role}),M(ne.name)&&v.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"}),ne.prompt_cache&&v.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"}),ne.spec_active?v.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: ${ne.spec_draft_model})`,children:"SPEC"}):ne.spec_draft_model?v.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 (${ne.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,ne.parallel_slots>1&&v.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:`${ne.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ne.parallel_slots]}),ne.incomplete&&v.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"}),Ce&&v.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsxs("span",{children:["Größe: ",Io(ne.size_bytes)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Kontext: ",PI(ne.ctx)]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:"font-mono text-[9px]",children:ne.quant||"GGUF"})]})]})]}),v.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[v.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:v.jsx(L3,{caps:ne.capabilities})}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("button",{onClick:()=>Ce?B(ne.name):he(ne.name),disabled:ne.incomplete&&!Ce,className:Je("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",ne.incomplete&&!Ce?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":Ce?"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:Ce?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>G(ne.name,ne.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"}),w&&v.jsx("button",{onClick:()=>P(ne.name),className:Je("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",M(ne.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:M(ne.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:"🧠"}),v.jsxs("button",{onClick:()=>k(ne),className:Je("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",ne.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":ne.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:[v.jsx(wh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>le(ne.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","aria-label":"Modell löschen",title:"Modell löschen",children:v.jsx(LT,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})]},ne.name)})})]}),O&&(()=>{var Q,W;const ne=D&&D.role===O?D:null,Ce={};ne==null||ne.models.forEach(be=>{Ce[be.name]=be});const qe=ne?ne.models.map(be=>p.find(Ue=>Ue.name===be.name)).filter(Boolean):p,Ze=be=>{Y(O,be),N(null)};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":`Rolle ${O} konfigurieren`,children:v.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:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",O,"' konfigurieren"]}),v.jsx("button",{onClick:()=>N(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",v.jsx("strong",{className:"text-foreground",children:O}),":"]}),(ne==null?void 0:ne.recommended)&&v.jsxs("button",{onClick:()=>Ze(ne.recommended),title:(Q=Ce[ne.recommended])==null?void 0:Q.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:[v.jsx(wh,{className:"h-3 w-3"})," Auto: ",(W=ne.recommended.split("/").pop())==null?void 0:W.replace(/\.gguf$/i,"")]})]}),v.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[v.jsx("button",{onClick:()=>Ze(""),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:v.jsx("span",{children:"Zuweisung entfernen"})}),qe.map(be=>{var rt;const Ue=Ce[be.name],ze=be.role===O,Fe=!!(Ue!=null&&Ue.recommended),bt=!!Ue&&!Ue.suitable;return v.jsxs("button",{onClick:()=>Ze(be.name),className:Je("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",Fe?"border-primary/50 bg-primary/10":ze?"text-primary font-bold bg-primary/5 border-primary/30":bt?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[v.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[v.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(rt=be.name.split("/").pop())==null?void 0:rt.replace(/\.gguf$/i,""),Fe&&v.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Ue?`${Ue.params_b}B · ${be.quant} · ${Ue.reason}`:`${Io(be.size_bytes)} · ${be.quant}`})]}),ze&&v.jsx(Sa,{className:"h-4 w-4 shrink-0 text-primary"})]},be.name)})]})]})})})(),V&&v.jsx(Wfe,{model:V,onClose:()=>k(null),onChanged:S}),f]})}const Yfe=[{key:"popular",label:"Beliebt",q:""},{key:"coder",label:"Coder",q:"coder"},{key:"vision",label:"Vision",q:"vision"},{key:"reasoning",label:"Reasoning",q:"reasoning"},{key:"small",label:"Klein (≤4B)",q:"3B"}],Zfe=["fast","heavy","coder","vision","scout"],Qfe=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function D3(t){return Qfe.format(t)}function Jfe(){const{data:t}=Bg(),e=(t==null?void 0:t.models)??[],[n,r]=R.useState(""),[i,s]=R.useState([]),[a,o]=R.useState(!1),[l,c]=R.useState(""),[d,f]=R.useState("popular"),[p,y]=R.useState(""),[b,S]=R.useState(null),[w,x]=R.useState([]),[M,T]=R.useState("Q4_K_M"),[P,O]=R.useState(""),[N,D]=R.useState(null),[z,V]=R.useState(!1),[k,j]=R.useState({});async function X(G){o(!0),c("");try{const le=await It(`/api/hf/search?q=${encodeURIComponent(G)}`);s(le.results),le.results.length||c("Keine Ergebnisse.")}catch(le){c(`Suche fehlgeschlagen: ${le}`)}finally{o(!1)}}R.useEffect(()=>{X("")},[]);function ee(G){f(G.key),r(""),X(G.q)}function ie(){f(""),X(n)}async function pe(G,le,se){V(!1);try{const ce=await It(`/api/fit?params_b=0&quant=${encodeURIComponent(le)}&ctx=8192&name=${encodeURIComponent(G)}&role=${encodeURIComponent(se)}`);D(ce)}catch{D(null)}}async function ae(G){if(b===G){S(null);return}S(G),x([]),D(null),O(""),V(!1),c("Analysiere Repository…");try{const le=await It(`/api/hf/quants?repo=${encodeURIComponent(G)}`);x(le.quants);const se=le.quants.includes("Q4_K_M")?"Q4_K_M":le.quants[0]||"Q4_K_M";T(se),c(le.quants.length?"":"Keine GGUF-Dateien in diesem Repo gefunden."),le.quants.length&&pe(le.repo,se,"")}catch(le){c(`Fehler: ${le}`)}}function he(){const G=p.trim();G&&(s(le=>le.some(se=>se.repo===G)?le:[{repo:G,downloads:0,likes:0},...le]),y(""),ae(G))}const B=P?e.find(G=>(G.role||"").toLowerCase()===P):void 0;async function J(G){if((N==null?void 0:N.fit.level)==="too_tight"&&!z){V(!0);return}j(le=>({...le,[G]:"Starte…"}));try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:G,quant:M,role:P||void 0,jinja:!0})}),j(le=>({...le,[G]:"Download läuft"})),V(!1)}catch{j(se=>({...se,[G]:"Fehler"}))}}const Y=G=>{var se;const le=((se=G.split("/").pop())==null?void 0:se.toLowerCase().replace(/-gguf$/i,""))||"";return le.length>3&&e.some(ce=>ce.name.toLowerCase().includes(le))},H=G=>G==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":G==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return v.jsxs("div",{className:"space-y-5",children:[v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("div",{className:"relative flex-1",children:[v.jsx(pF,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),v.jsx("input",{value:n,onChange:G=>r(G.target.value),onKeyDown:G=>G.key==="Enter"&&ie(),"aria-label":"HuggingFace durchsuchen",type:"search",spellCheck:!1,placeholder:"HuggingFace durchsuchen (z.B. Qwen Coder, Llama-3.1, gemma)…",className:"w-full h-10 pl-9 pr-3 rounded-xl border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),v.jsx("button",{onClick:ie,className:"h-10 px-5 rounded-xl bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Suchen"})]}),v.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Yfe.map(G=>v.jsxs("button",{onClick:()=>ee(G),className:Je("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-semibold transition-all cursor-pointer border",d===G.key?"bg-primary/15 text-primary border-primary/30":"border-border/50 text-muted-foreground hover:text-foreground hover:border-border"),children:[G.key==="popular"&&v.jsx(U8,{className:"h-3 w-3"}),G.label]},G.key))}),a?v.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:"Lade GGUF-Modelle von HuggingFace…"}):v.jsxs("div",{className:"space-y-2",children:[i.map(G=>{const le=b===G.repo,se=Y(G.repo),ce=G.repo.includes("/")?G.repo.split("/")[0]:"—",Se=G.repo.split("/").pop();return v.jsxs("div",{className:Je("rounded-xl border bg-card/45 backdrop-blur-md transition-all",le?"border-primary/40 shadow-lg shadow-primary/5":"border-border/50 hover:border-primary/30"),children:[v.jsxs("button",{onClick:()=>ae(G.repo),className:"w-full flex items-center gap-3 p-3.5 text-left cursor-pointer",children:[v.jsxs("div",{className:"min-w-0 flex-1",children:[v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsx("span",{className:"text-xs font-bold font-mono text-foreground truncate max-w-[280px]",title:G.repo,children:Se}),se&&v.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded",children:[v.jsx(Sa,{className:"h-2.5 w-2.5"})," installiert"]})]}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-3 mt-0.5 font-mono",children:[v.jsx("span",{children:ce}),v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(yg,{className:"h-3 w-3"})," ",D3(G.downloads)]}),G.likes>0&&v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(B8,{className:"h-3 w-3"})," ",D3(G.likes)]})]})]}),le?v.jsx(cF,{className:"h-4 w-4 text-muted-foreground shrink-0"}):v.jsx(oF,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),le&&v.jsx("div",{className:"border-t border-border/30 p-3.5 space-y-3",children:w.length===0?v.jsx("div",{className:"text-[11px] text-muted-foreground font-mono",children:l||"Lade Quants…"}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Quant"}),v.jsx("select",{value:M,onChange:we=>{T(we.target.value),pe(G.repo,we.target.value,P)},"aria-label":"Quantisierung",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:w.map(we=>v.jsx("option",{value:we,className:"bg-popover text-foreground",children:we},we))}),v.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground ml-1",children:"Rolle"}),v.jsxs("select",{value:P,onChange:we=>{O(we.target.value),pe(G.repo,M,we.target.value)},"aria-label":"Rolle",title:"Optional — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:[v.jsx("option",{value:"",className:"bg-popover text-foreground",children:"keine"}),Zfe.map(we=>v.jsx("option",{value:we,className:"bg-popover text-foreground",children:we},we))]}),v.jsx("button",{onClick:()=>J(G.repo),disabled:!!k[G.repo]&&k[G.repo]==="Download läuft",className:Je("h-8 px-3.5 ml-auto rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5",z?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"),children:k[G.repo]?k[G.repo]:z?v.jsxs(v.Fragment,{children:[v.jsx(bg,{className:"h-3.5 w-3.5"})," OOM — trotzdem laden"]}):v.jsxs(v.Fragment,{children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]}),N&&v.jsxs("div",{className:Je("flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium",H(N.fit.level)),children:[v.jsx("span",{className:"font-bold uppercase tracking-wide",children:N.fit.text}),v.jsxs("span",{className:"font-mono opacity-90",children:["~",N.params_b,"B · ~",N.fit.req_gb," GB / ",N.sys_ram_gb," GB · ~",N.fit.tps," t/s"]}),N.fit.level!=="too_tight"?v.jsxs("span",{className:"font-mono opacity-80",children:["ctx → ",(N.assigned_ctx/1024).toFixed(0),"k"]}):v.jsx("span",{className:"opacity-90",children:"— passt nicht, würde beim Laden abstürzen (OOM)."})]}),B&&v.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] text-amber-400",children:[v.jsx(bg,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),v.jsxs("span",{children:["Rolle ",v.jsxs("strong",{children:["„",P,'"']})," hält aktuell ",v.jsx("strong",{children:B.name.split("/").pop()})," — wird beim Download übernommen."]})]})]})})]},G.repo)}),!i.length&&!a&&v.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:l||"Keine Ergebnisse."})]}),v.jsxs("div",{className:"border-t border-border/30 pt-4 flex flex-col sm:flex-row gap-2 items-stretch sm:items-center",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground shrink-0",children:"Direkt:"}),v.jsx("input",{value:p,onChange:G=>y(G.target.value),onKeyDown:G=>G.key==="Enter"&&he(),"aria-label":"Repository oder URL direkt eingeben",spellCheck:!1,placeholder:"org/repo oder HF-URL (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 font-mono"}),v.jsx("button",{onClick:he,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:"Laden"})]})]})}const ehe={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:wh},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:uF},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:RT}};function the(){const{data:t,isLoading:e,error:n}=P7(),{data:r}=Bg(),{data:i}=CC(),s=(r==null?void 0:r.models)??[],a=n?String(n):"",[o,l]=R.useState({}),[c,d]=R.useState({}),[f,p]=R.useState("recommended");async function y(b,S,w,x){l(M=>({...M,[b]:"Starte..."}));try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:b,role:S,quant:w,jinja:x})}),l(M=>({...M,[b]:"Download läuft"}))}catch{l(T=>({...T,[b]:"Fehler"}))}}return v.jsxs("div",{className:"space-y-6",children:[v.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 w-fit",children:[["recommended","Empfohlen"],["browse","Stöbern & Suchen"]].map(([b,S])=>v.jsx("button",{onClick:()=>p(b),className:Je("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide transition-all cursor-pointer",f===b?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:S},b))}),f==="browse"?v.jsx(Jfe,{}):e?v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):a||!t?v.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 (",a,")."]}):v.jsxs("div",{className:"space-y-8",children:[v.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:[v.jsxs("div",{children:["Modell-Registry geladen für ",v.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx(l9,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),v.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),v.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(b=>{const S=ehe[b.role]||{title:b.title||b.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:_C},w=S.icon,x=s.find(D=>D.role===b.role),M=i==null?void 0:i.model_list.find(D=>D.role===b.role),T=b.models.find(D=>D.repo===b.recommended)||b.models[0];if(!T)return null;const P=o[T.repo],O=b.models.filter(D=>D.repo!==b.recommended),N=!!c[b.role];return v.jsxs("div",{className:Je("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",x?"border-border/60":"border-primary/20 shadow-primary/5"),children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.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:v.jsx(w,{className:"h-5.5 w-5.5"})}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),v.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: ",b.role]})]})]}),x?v.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:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):v.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"})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),v.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:x?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:x.name,children:x.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[v.jsxs("span",{children:["Größe: ",WT(x.size_bytes||0)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",x.quant||"GGUF"]})]})]}):v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[v.jsxs("span",{children:["Ersteller: ",T.author]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",T.quant]})]}),v.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:v.jsx(Bfe,{fit:T.fit})})]})}),v.jsx("div",{className:"pt-1",children:x?M?v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),v.jsxs("span",{children:["Bessere Version in der Registry: ",M.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>y(M.repo,b.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!o[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:[v.jsx(yg,{className:"h-3.5 w-3.5"}),o[M.repo]||"Auf neue Version aktualisieren"]})]}):v.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:[v.jsx(Sa,{className:"h-4 w-4"})," Auf neuestem Stand"]}):v.jsxs("button",{onClick:()=>y(T.repo,b.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!P,className:Je("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",P?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[v.jsx(yg,{className:"h-3.5 w-3.5"}),P||"Optimales Modell einsetzen"]})})]}),O.length>0&&v.jsxs("div",{className:"border-t border-border/20 pt-3",children:[v.jsxs("button",{onClick:()=>d(D=>({...D,[b.role]:!N})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[N?v.jsx(cF,{className:"h-3 w-3"}):v.jsx(oF,{className:"h-3 w-3"}),v.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&v.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(D=>v.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),v.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[v.jsxs("span",{children:["Quant: ",D.quant]}),v.jsx("span",{children:"•"}),v.jsx("span",{children:D.fit.text})]})]}),v.jsx("button",{onClick:()=>y(D.repo,b.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!o[D.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:o[D.repo]||"Installieren"})]},D.repo))})]})]},b.role)})})]})]})}function nhe(){const[t,e]=R.useState("cockpit");return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.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"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),v.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=>v.jsx("button",{onClick:()=>e(n),className:Je("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))})]}),v.jsx(Gfe,{}),v.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?v.jsx(Kfe,{}):v.jsx(the,{})})]})}const rhe={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?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[v.jsx($1,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[v.jsx(P8,{className:"h-3 w-3"})," ",t.detail]}):v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[v.jsx(R8,{className:"h-3 w-3"})," ",t.detail]})}function j3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return v.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[v.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),v.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:v.jsx("span",{children:e})}),v.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?v.jsx(Sa,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(NT,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:Je("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:v.jsx("code",{children:t.snippet})})]})}function ihe(){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"),[a,o]=R.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=R7(l.toString()),{data:f,isLoading:p}=N7(),y=d?String(d):"";function b(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 x(M,T){T&&(await navigator.clipboard.writeText(T),o(M),setTimeout(()=>o(null),1500))}return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{children:[v.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"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",v.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),v.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[v.jsx(V8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),v.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),v.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),v.jsxs("div",{className:"flex flex-col gap-2.5",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(tw,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[v.jsx(Md,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),v.jsx(U3,{line:f==null?void 0:f.gateway,loading:p})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · Lanes chat / coding"})]})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(tw,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[v.jsx(W1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),v.jsx(U3,{line:f==null?void 0:f.memory,loading:p})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),v.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",v.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",v.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),v.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:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(z8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),v.jsx("input",{value:t,onChange:M=>b(M.target.value),"aria-label":"Box LAN IP-Adresse",spellCheck:!1,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"})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(j8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",v.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),v.jsx("input",{value:n,onChange:M=>S(M.target.value),"aria-label":"Lokaler MCP-Scriptpfad",spellCheck:!1,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&&v.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&&v.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.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"]}),v.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([M,T])=>v.jsx("button",{onClick:()=>s(M),className:Je("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&&v.jsxs(v.Fragment,{children:[w.note&&v.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:[v.jsx(oI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),v.jsx("span",{children:w.note})]}),v.jsx(j3,{tool:w,fileName:rhe[i]||"config.json",accent:"teal",copied:a==="model",onCopy:()=>x("model",w.snippet)})]})]}),v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.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",v.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",v.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),v.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:[v.jsx(oI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),v.jsx("span",{children:c.memory.note})]}),v.jsx(j3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:a==="memory",onCopy:()=>x("memory",c.memory.snippet)})]})]})]})}const she="modulepreload",ahe=function(t){return"/"+t},F3={},ohe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=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 o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=a(n.map(c=>{if(c=ahe(c),c in F3)return;F3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":she,d||(p.as="script"),p.crossOrigin="",p.href=c,l&&p.setAttribute("nonce",l),document.head.appendChild(p),d)return new Promise((y,b)=>{p.addEventListener("load",y),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})};class lhe extends R.Component{constructor(){super(...arguments);Gs(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?v.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:[v.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),v.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const che=R.lazy(()=>ohe(()=>import("./GraphView-Z2wUzCOt.js"),[]).then(t=>({default:t.GraphView}))),Fb=["identity","knowledge","rules","events"],z3=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:Ym,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:N8,bg:"bg-amber-500/10",text:"text-amber-400"}},B3={label:"Gedächtnis",icon:CT,text:"text-muted-foreground"},uhe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},H3=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: + `}),v.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:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(rE,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",Io(we)," Gewichte",Ee>0?` · ${Io(Ee)} real belegt (inkl. KV)`:""," / ",Io($e)]}),y.length>0&&v.jsx("button",{onClick:J,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"})]})]}),v.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:Se.length===0?v.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"}):Se.map((ne,Ce)=>{var Q;const Xe=(ne.size_bytes||0)/$e*100,Ze=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][Ce%4];return v.jsxs("div",{style:{width:`${Xe}%`},className:Je("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",Ze),title:`${ne.name} (${Io(ne.size_bytes)})`,children:[v.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[ne.role?`[${ne.role}] `:"",(Q=ne.name.split("/").pop())==null?void 0:Q.replace(".gguf","")]}),v.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Io(ne.size_bytes)})]},ne.name)})})]}),v.jsx(Kfe,{}),v.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:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),v.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:vV.map(ne=>{var Ze;const Ce=p.find(Q=>Q.role===ne),Xe=Ce?y.includes(Ce.name):!1;return v.jsxs("div",{onClick:()=>H(ne),className:Je("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]",Xe?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":Ce?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:Je("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",yV(ne)),children:ne}),Xe&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:Ce==null?void 0:Ce.name,children:Ce?(Ze=Ce.name.split("/").pop())==null?void 0:Ze.replace(/\.gguf$/i,""):"nicht zugewiesen"}),v.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},ne)})})]}),(s==null?void 0:s.current)&&v.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:[v.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx($c,{className:"h-4.5 w-4.5 text-indigo-400"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),s.current.version!=null&&v.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",s.current.version]})]}),v.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"agent"}})),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",title:"Hirn-Wechsel passiert jetzt zentral im Hermes-Tab",children:"Im Hermes-Tab wechseln →"})]}),v.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:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:s.current.name,children:s.current.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsx("span",{children:s.current.params_b?`${s.current.params_b}B`:"—"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:s.current.quant||"GGUF"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:Io(s.current.size_bytes||0)})]})]}),s.update_available&&s.recommended?v.jsxs("button",{onClick:()=>ce(s.recommended.repo),className:Je("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",s.budget&&!s.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:[v.jsx(yg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):v.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:[v.jsx(Sa,{className:"h-4 w-4"})," Neueste Generation"]})]}),s.update_available&&s.recommended&&v.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",v.jsx("span",{className:"font-mono font-bold",children:s.recommended.name.replace(/-GGUF$/i,"")}),"(v",s.recommended.version,", ",s.recommended.params_b,"B) — von NousResearch."]}),s.budget&&v.jsxs("div",{className:Je("text-[10px] flex items-start gap-1.5 leading-relaxed",s.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[v.jsx(rE,{className:"h-3 w-3 shrink-0 mt-0.5"}),v.jsxs("span",{children:["Always-On-Brain ~",s.budget.brain_gb," GB + größtes on-demand (~",s.budget.largest_ondemand_gb," GB) = ",(s.budget.brain_gb+s.budget.largest_ondemand_gb).toFixed(1)," / ",s.budget.gtt_gb," GB",s.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[v.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",pe.length," von ",p.length,")"]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>ie("all"),className:Je("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ee==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),v.jsx("button",{onClick:()=>ie("in_use"),className:Je("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",ee==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>X("grid"),className:Je("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",j==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),v.jsx("button",{onClick:()=>X("list"),className:Je("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",j==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),j==="grid"?v.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:pe.length===0?v.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:ee==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):pe.map(ne=>{const Ce=y.includes(ne.name),Xe=i==null?void 0:i.model_list.find(Q=>Q.role===ne.role),Ze=k3(ne.name);return v.jsxs("div",{className:Je("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",Ce?"border-primary/45 shadow-primary/5":ne.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[v.jsxs("div",{className:"space-y-3",children:[v.jsx("div",{className:"flex items-start justify-between gap-3",children:v.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[v.jsx("div",{className:Je("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ze.color),title:Ze.name,children:Ze.initial}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:ne.name,children:ne.name.split("/").pop()}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[v.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:ne.quant||"GGUF"}),Ce&&v.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[v.jsx(bC,{className:"h-3 w-3 animate-pulse"})," Warm"]}),ne.role&&v.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:ne.role}),M(ne.name)&&v.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"}),ne.prompt_cache&&v.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"}),ne.spec_active?v.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: ${ne.spec_draft_model})`,children:"SPEC"}):ne.spec_draft_model?v.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 (${ne.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,ne.parallel_slots>1&&v.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:`${ne.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ne.parallel_slots]}),ne.incomplete&&v.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"})]})]})]})}),v.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:v.jsx(L3,{caps:ne.capabilities})})]}),v.jsxs("div",{className:"space-y-3 pt-1",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(rE,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),v.jsx("div",{className:"text-foreground font-semibold",children:Io(ne.size_bytes)})]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(n9,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),v.jsx("div",{className:"text-foreground font-semibold",children:PI(ne.ctx)})]})]})]}),Xe&&v.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:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),v.jsxs("span",{children:["Upgrade verfügbar: ",Xe.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>se(Xe.repo,ne.role,ne.quant||"Q4_K_M",ne.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:[v.jsx(yg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[v.jsx("button",{onClick:()=>Ce?B(ne.name):he(ne.name),disabled:ne.incomplete&&!Ce,className:Je("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",ne.incomplete&&!Ce?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":Ce?"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:Ce?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>G(ne.name,ne.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"}),w&&v.jsx("button",{onClick:()=>P(ne.name),className:Je("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",M(ne.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:M(ne.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:"🧠"}),v.jsxs("button",{onClick:()=>k(ne),className:Je("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",ne.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":ne.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:[v.jsx(wh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>le(ne.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","aria-label":"Modell löschen",title:"Modell löschen",children:v.jsx(LT,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})]},ne.name)})}):v.jsx("div",{className:"space-y-2",children:pe.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:ee==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):pe.map(ne=>{const Ce=y.includes(ne.name),Xe=k3(ne.name);return v.jsxs("div",{className:Je("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",Ce?"border-primary/45":ne.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[v.jsx("div",{className:Je("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Xe.color),title:Xe.name,children:Xe.initial}),v.jsxs("div",{className:"min-w-0 text-left",children:[v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:ne.name,children:ne.name.split("/").pop()}),ne.role&&v.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:ne.role}),M(ne.name)&&v.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"}),ne.prompt_cache&&v.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"}),ne.spec_active?v.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: ${ne.spec_draft_model})`,children:"SPEC"}):ne.spec_draft_model?v.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 (${ne.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,ne.parallel_slots>1&&v.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:`${ne.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ne.parallel_slots]}),ne.incomplete&&v.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"}),Ce&&v.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsxs("span",{children:["Größe: ",Io(ne.size_bytes)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Kontext: ",PI(ne.ctx)]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:"font-mono text-[9px]",children:ne.quant||"GGUF"})]})]})]}),v.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[v.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:v.jsx(L3,{caps:ne.capabilities})}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("button",{onClick:()=>Ce?B(ne.name):he(ne.name),disabled:ne.incomplete&&!Ce,className:Je("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",ne.incomplete&&!Ce?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":Ce?"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:Ce?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>G(ne.name,ne.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"}),w&&v.jsx("button",{onClick:()=>P(ne.name),className:Je("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer",M(ne.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:M(ne.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:"🧠"}),v.jsxs("button",{onClick:()=>k(ne),className:Je("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",ne.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":ne.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:[v.jsx(wh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>le(ne.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","aria-label":"Modell löschen",title:"Modell löschen",children:v.jsx(LT,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]})]},ne.name)})})]}),O&&(()=>{var Q,W;const ne=D&&D.role===O?D:null,Ce={};ne==null||ne.models.forEach(be=>{Ce[be.name]=be});const Xe=ne?ne.models.map(be=>p.find(Ue=>Ue.name===be.name)).filter(Boolean):p,Ze=be=>{Y(O,be),N(null)};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":`Rolle ${O} konfigurieren`,children:v.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:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",O,"' konfigurieren"]}),v.jsx("button",{onClick:()=>N(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",v.jsx("strong",{className:"text-foreground",children:O}),":"]}),(ne==null?void 0:ne.recommended)&&v.jsxs("button",{onClick:()=>Ze(ne.recommended),title:(Q=Ce[ne.recommended])==null?void 0:Q.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:[v.jsx(wh,{className:"h-3 w-3"})," Auto: ",(W=ne.recommended.split("/").pop())==null?void 0:W.replace(/\.gguf$/i,"")]})]}),v.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[v.jsx("button",{onClick:()=>Ze(""),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:v.jsx("span",{children:"Zuweisung entfernen"})}),Xe.map(be=>{var rt;const Ue=Ce[be.name],ze=be.role===O,Fe=!!(Ue!=null&&Ue.recommended),bt=!!Ue&&!Ue.suitable;return v.jsxs("button",{onClick:()=>Ze(be.name),className:Je("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",Fe?"border-primary/50 bg-primary/10":ze?"text-primary font-bold bg-primary/5 border-primary/30":bt?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[v.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[v.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(rt=be.name.split("/").pop())==null?void 0:rt.replace(/\.gguf$/i,""),Fe&&v.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Ue?`${Ue.params_b}B · ${be.quant} · ${Ue.reason}`:`${Io(be.size_bytes)} · ${be.quant}`})]}),ze&&v.jsx(Sa,{className:"h-4 w-4 shrink-0 text-primary"})]},be.name)})]})]})})})(),V&&v.jsx($fe,{model:V,onClose:()=>k(null),onChanged:S}),f]})}const Zfe=[{key:"popular",label:"Beliebt",q:""},{key:"coder",label:"Coder",q:"coder"},{key:"vision",label:"Vision",q:"vision"},{key:"reasoning",label:"Reasoning",q:"reasoning"},{key:"small",label:"Klein (≤4B)",q:"3B"}],Qfe=["fast","heavy","coder","vision","hermes","scout"],Jfe=new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1});function D3(t){return Jfe.format(t)}function ehe(){const{data:t}=Bg(),e=(t==null?void 0:t.models)??[],[n,r]=R.useState(""),[i,s]=R.useState([]),[a,o]=R.useState(!1),[l,c]=R.useState(""),[d,f]=R.useState("popular"),[p,y]=R.useState(""),[b,S]=R.useState(null),[w,x]=R.useState([]),[M,T]=R.useState("Q4_K_M"),[P,O]=R.useState(""),[N,D]=R.useState(null),[z,V]=R.useState(!1),[k,j]=R.useState({});async function X(G){o(!0),c("");try{const le=await It(`/api/hf/search?q=${encodeURIComponent(G)}`);s(le.results),le.results.length||c("Keine Ergebnisse.")}catch(le){c(`Suche fehlgeschlagen: ${le}`)}finally{o(!1)}}R.useEffect(()=>{X("")},[]);function ee(G){f(G.key),r(""),X(G.q)}function ie(){f(""),X(n)}async function pe(G,le,se){V(!1);try{const ce=await It(`/api/fit?params_b=0&quant=${encodeURIComponent(le)}&ctx=8192&name=${encodeURIComponent(G)}&role=${encodeURIComponent(se)}`);D(ce)}catch{D(null)}}async function ae(G){if(b===G){S(null);return}S(G),x([]),D(null),O(""),V(!1),c("Analysiere Repository…");try{const le=await It(`/api/hf/quants?repo=${encodeURIComponent(G)}`);x(le.quants);const se=le.quants.includes("Q4_K_M")?"Q4_K_M":le.quants[0]||"Q4_K_M";T(se),c(le.quants.length?"":"Keine GGUF-Dateien in diesem Repo gefunden."),le.quants.length&&pe(le.repo,se,"")}catch(le){c(`Fehler: ${le}`)}}function he(){const G=p.trim();G&&(s(le=>le.some(se=>se.repo===G)?le:[{repo:G,downloads:0,likes:0},...le]),y(""),ae(G))}const B=P?e.find(G=>(G.role||"").toLowerCase()===P):void 0;async function J(G){if((N==null?void 0:N.fit.level)==="too_tight"&&!z){V(!0);return}j(le=>({...le,[G]:"Starte…"}));try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:G,quant:M,role:P||void 0,jinja:!0})}),j(le=>({...le,[G]:"Download läuft"})),V(!1)}catch{j(se=>({...se,[G]:"Fehler"}))}}const Y=G=>{var se;const le=((se=G.split("/").pop())==null?void 0:se.toLowerCase().replace(/-gguf$/i,""))||"";return le.length>3&&e.some(ce=>ce.name.toLowerCase().includes(le))},H=G=>G==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":G==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return v.jsxs("div",{className:"space-y-5",children:[v.jsxs("div",{className:"flex gap-2",children:[v.jsxs("div",{className:"relative flex-1",children:[v.jsx(pF,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),v.jsx("input",{value:n,onChange:G=>r(G.target.value),onKeyDown:G=>G.key==="Enter"&&ie(),"aria-label":"HuggingFace durchsuchen",type:"search",spellCheck:!1,placeholder:"HuggingFace durchsuchen (z.B. Qwen Coder, Llama-3.1, gemma)…",className:"w-full h-10 pl-9 pr-3 rounded-xl border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),v.jsx("button",{onClick:ie,className:"h-10 px-5 rounded-xl bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all cursor-pointer",children:"Suchen"})]}),v.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:Zfe.map(G=>v.jsxs("button",{onClick:()=>ee(G),className:Je("flex items-center gap-1.5 rounded-full px-3 py-1.5 text-[11px] font-semibold transition-all cursor-pointer border",d===G.key?"bg-primary/15 text-primary border-primary/30":"border-border/50 text-muted-foreground hover:text-foreground hover:border-border"),children:[G.key==="popular"&&v.jsx(F8,{className:"h-3 w-3"}),G.label]},G.key))}),a?v.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:"Lade GGUF-Modelle von HuggingFace…"}):v.jsxs("div",{className:"space-y-2",children:[i.map(G=>{const le=b===G.repo,se=Y(G.repo),ce=G.repo.includes("/")?G.repo.split("/")[0]:"—",Se=G.repo.split("/").pop();return v.jsxs("div",{className:Je("rounded-xl border bg-card/45 backdrop-blur-md transition-all",le?"border-primary/40 shadow-lg shadow-primary/5":"border-border/50 hover:border-primary/30"),children:[v.jsxs("button",{onClick:()=>ae(G.repo),className:"w-full flex items-center gap-3 p-3.5 text-left cursor-pointer",children:[v.jsxs("div",{className:"min-w-0 flex-1",children:[v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsx("span",{className:"text-xs font-bold font-mono text-foreground truncate max-w-[280px]",title:G.repo,children:Se}),se&&v.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-1.5 py-0.5 rounded",children:[v.jsx(Sa,{className:"h-2.5 w-2.5"})," installiert"]})]}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-3 mt-0.5 font-mono",children:[v.jsx("span",{children:ce}),v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(yg,{className:"h-3 w-3"})," ",D3(G.downloads)]}),G.likes>0&&v.jsxs("span",{className:"flex items-center gap-1",children:[v.jsx(V8,{className:"h-3 w-3"})," ",D3(G.likes)]})]})]}),le?v.jsx(cF,{className:"h-4 w-4 text-muted-foreground shrink-0"}):v.jsx(oF,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),le&&v.jsx("div",{className:"border-t border-border/30 p-3.5 space-y-3",children:w.length===0?v.jsx("div",{className:"text-[11px] text-muted-foreground font-mono",children:l||"Lade Quants…"}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Quant"}),v.jsx("select",{value:M,onChange:we=>{T(we.target.value),pe(G.repo,we.target.value,P)},"aria-label":"Quantisierung",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:w.map(we=>v.jsx("option",{value:we,className:"bg-popover text-foreground",children:we},we))}),v.jsx("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground ml-1",children:"Rolle"}),v.jsxs("select",{value:P,onChange:we=>{O(we.target.value),pe(G.repo,M,we.target.value)},"aria-label":"Rolle",title:"Optional — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-8 rounded-lg border border-border/60 bg-background/40 px-2 text-xs text-foreground font-semibold outline-none",children:[v.jsx("option",{value:"",className:"bg-popover text-foreground",children:"keine"}),Qfe.map(we=>v.jsx("option",{value:we,className:"bg-popover text-foreground",children:we},we))]}),v.jsx("button",{onClick:()=>J(G.repo),disabled:!!k[G.repo]&&k[G.repo]==="Download läuft",className:Je("h-8 px-3.5 ml-auto rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5",z?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"),children:k[G.repo]?k[G.repo]:z?v.jsxs(v.Fragment,{children:[v.jsx(bg,{className:"h-3.5 w-3.5"})," OOM — trotzdem laden"]}):v.jsxs(v.Fragment,{children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]}),N&&v.jsxs("div",{className:Je("flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium",H(N.fit.level)),children:[v.jsx("span",{className:"font-bold uppercase tracking-wide",children:N.fit.text}),v.jsxs("span",{className:"font-mono opacity-90",children:["~",N.params_b,"B · ~",N.fit.req_gb," GB / ",N.sys_ram_gb," GB · ~",N.fit.tps," t/s"]}),N.fit.level!=="too_tight"?v.jsxs("span",{className:"font-mono opacity-80",children:["ctx → ",(N.assigned_ctx/1024).toFixed(0),"k"]}):v.jsx("span",{className:"opacity-90",children:"— passt nicht, würde beim Laden abstürzen (OOM)."})]}),B&&v.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] text-amber-400",children:[v.jsx(bg,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),v.jsxs("span",{children:["Rolle ",v.jsxs("strong",{children:["„",P,'"']})," hält aktuell ",v.jsx("strong",{children:B.name.split("/").pop()})," — wird beim Download übernommen."]})]})]})})]},G.repo)}),!i.length&&!a&&v.jsx("div",{className:"text-xs text-muted-foreground py-10 text-center",children:l||"Keine Ergebnisse."})]}),v.jsxs("div",{className:"border-t border-border/30 pt-4 flex flex-col sm:flex-row gap-2 items-stretch sm:items-center",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground shrink-0",children:"Direkt:"}),v.jsx("input",{value:p,onChange:G=>y(G.target.value),onKeyDown:G=>G.key==="Enter"&&he(),"aria-label":"Repository oder URL direkt eingeben",spellCheck:!1,placeholder:"org/repo oder HF-URL (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 font-mono"}),v.jsx("button",{onClick:he,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:"Laden"})]})]})}const the={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:wh},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:uF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:IT},hermes:{title:"Lucys Hirn (Agent)",desc:"Lucys dauer-warmes Agent-Hirn mit Tool-Calling — bleibt ko-resident, lädt nie kalt nach.",icon:T8},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:RT}};function nhe(){const{data:t,isLoading:e,error:n}=R7(),{data:r}=Bg(),{data:i}=CC(),s=(r==null?void 0:r.models)??[],a=n?String(n):"",[o,l]=R.useState({}),[c,d]=R.useState({}),[f,p]=R.useState("recommended");async function y(b,S,w,x){l(M=>({...M,[b]:"Starte..."}));try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:b,role:S,quant:w,jinja:x})}),l(M=>({...M,[b]:"Download läuft"}))}catch{l(T=>({...T,[b]:"Fehler"}))}}return v.jsxs("div",{className:"space-y-6",children:[v.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 w-fit",children:[["recommended","Empfohlen"],["browse","Stöbern & Suchen"]].map(([b,S])=>v.jsx("button",{onClick:()=>p(b),className:Je("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide transition-all cursor-pointer",f===b?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:S},b))}),f==="browse"?v.jsx(ehe,{}):e?v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):a||!t?v.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 (",a,")."]}):v.jsxs("div",{className:"space-y-8",children:[v.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:[v.jsxs("div",{children:["Modell-Registry geladen für ",v.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx(u9,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),v.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),v.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(b=>{const S=the[b.role]||{title:b.title||b.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:_C},w=S.icon,x=s.find(D=>D.role===b.role),M=i==null?void 0:i.model_list.find(D=>D.role===b.role),T=b.models.find(D=>D.repo===b.recommended)||b.models[0];if(!T)return null;const P=o[T.repo],O=b.models.filter(D=>D.repo!==b.recommended),N=!!c[b.role];return v.jsxs("div",{className:Je("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",x?"border-border/60":"border-primary/20 shadow-primary/5"),children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.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:v.jsx(w,{className:"h-5.5 w-5.5"})}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),v.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: ",b.role]})]})]}),x?v.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:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):v.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"})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),v.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:x?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:x.name,children:x.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[v.jsxs("span",{children:["Größe: ",WT(x.size_bytes||0)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",x.quant||"GGUF"]})]})]}):v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[v.jsxs("span",{children:["Ersteller: ",T.author]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",T.quant]})]}),v.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:v.jsx(Hfe,{fit:T.fit})})]})}),v.jsx("div",{className:"pt-1",children:x?M?v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),v.jsxs("span",{children:["Bessere Version in der Registry: ",M.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>y(M.repo,b.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!o[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:[v.jsx(yg,{className:"h-3.5 w-3.5"}),o[M.repo]||"Auf neue Version aktualisieren"]})]}):v.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:[v.jsx(Sa,{className:"h-4 w-4"})," Auf neuestem Stand"]}):v.jsxs("button",{onClick:()=>y(T.repo,b.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!P,className:Je("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",P?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[v.jsx(yg,{className:"h-3.5 w-3.5"}),P||"Optimales Modell einsetzen"]})})]}),O.length>0&&v.jsxs("div",{className:"border-t border-border/20 pt-3",children:[v.jsxs("button",{onClick:()=>d(D=>({...D,[b.role]:!N})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[N?v.jsx(cF,{className:"h-3 w-3"}):v.jsx(oF,{className:"h-3 w-3"}),v.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&v.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(D=>v.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),v.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[v.jsxs("span",{children:["Quant: ",D.quant]}),v.jsx("span",{children:"•"}),v.jsx("span",{children:D.fit.text})]})]}),v.jsx("button",{onClick:()=>y(D.repo,b.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!o[D.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:o[D.repo]||"Installieren"})]},D.repo))})]})]},b.role)})})]})]})}function rhe(){const[t,e]=R.useState("cockpit");return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.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"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),v.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=>v.jsx("button",{onClick:()=>e(n),className:Je("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))})]}),v.jsx(Wfe,{}),v.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?v.jsx(Yfe,{}):v.jsx(nhe,{})})]})}const ihe={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?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[v.jsx($1,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[v.jsx(R8,{className:"h-3 w-3"})," ",t.detail]}):v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[v.jsx(I8,{className:"h-3 w-3"})," ",t.detail]})}function j3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return v.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[v.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),v.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:v.jsx("span",{children:e})}),v.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?v.jsx(Sa,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(NT,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:Je("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:v.jsx("code",{children:t.snippet})})]})}function she(){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"),[a,o]=R.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=I7(l.toString()),{data:f,isLoading:p}=k7(),y=d?String(d):"";function b(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 x(M,T){T&&(await navigator.clipboard.writeText(T),o(M),setTimeout(()=>o(null),1500))}return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{children:[v.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"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",v.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),v.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[v.jsx(W8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),v.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),v.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),v.jsxs("div",{className:"flex flex-col gap-2.5",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(tw,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[v.jsx(Md,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),v.jsx(U3,{line:f==null?void 0:f.gateway,loading:p})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · Lanes chat / coding"})]})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(tw,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[v.jsx(W1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),v.jsx(U3,{line:f==null?void 0:f.memory,loading:p})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),v.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",v.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",v.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),v.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:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(H8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),v.jsx("input",{value:t,onChange:M=>b(M.target.value),"aria-label":"Box LAN IP-Adresse",spellCheck:!1,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"})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(z8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",v.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),v.jsx("input",{value:n,onChange:M=>S(M.target.value),"aria-label":"Lokaler MCP-Scriptpfad",spellCheck:!1,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&&v.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&&v.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.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"]}),v.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([M,T])=>v.jsx("button",{onClick:()=>s(M),className:Je("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&&v.jsxs(v.Fragment,{children:[w.note&&v.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:[v.jsx(oI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),v.jsx("span",{children:w.note})]}),v.jsx(j3,{tool:w,fileName:ihe[i]||"config.json",accent:"teal",copied:a==="model",onCopy:()=>x("model",w.snippet)})]})]}),v.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:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.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",v.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",v.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),v.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:[v.jsx(oI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),v.jsx("span",{children:c.memory.note})]}),v.jsx(j3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:a==="memory",onCopy:()=>x("memory",c.memory.snippet)})]})]})]})}const ahe="modulepreload",ohe=function(t){return"/"+t},F3={},lhe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let a=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 o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=a(n.map(c=>{if(c=ohe(c),c in F3)return;F3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":ahe,d||(p.as="script"),p.crossOrigin="",p.href=c,l&&p.setAttribute("nonce",l),document.head.appendChild(p),d)return new Promise((y,b)=>{p.addEventListener("load",y),p.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})};class che extends R.Component{constructor(){super(...arguments);Gs(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?v.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:[v.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),v.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const uhe=R.lazy(()=>lhe(()=>import("./GraphView-BUrM8vHT.js"),[]).then(t=>({default:t.GraphView}))),Fb=["identity","knowledge","rules","events"],z3=new Set(["auto","agent","hermes"]),qE={identity:{label:"Identität",icon:d9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:Ym,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:s9,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:k8,bg:"bg-amber-500/10",text:"text-amber-400"}},B3={label:"Gedächtnis",icon:CT,text:"text-muted-foreground"},dhe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},H3=`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 dhe(){const[t,e]=R.useState(""),[n,r]=R.useState(""),[i,s]=R.useState(""),[a,o]=R.useState("knowledge"),[l,c]=R.useState(!1),[d,f]=R.useState(!1),[p,y]=R.useState("liste"),[b,S]=R.useState(!1),w=Nd(),{showAlert:x,showConfirm:M,dialogElement:T}=tv(),{data:P=[]}=BT({}),{data:O=[],error:N}=BT({q:n,category:t}),{data:D}=b7(p==="graph"),z=N?String(N):"",V=()=>{w.invalidateQueries({queryKey:["memory"]}),w.invalidateQueries({queryKey:["memory-graph"]})},k=R.useMemo(()=>{const H=P.length,G=P.filter(le=>z3.has(le.source)).length;return{total:H,auto:G,manual:H-G,cats:new Set(P.map(le=>le.category)).size}},[P]),j=P.length===0,X=R.useMemo(()=>{const H=D??{nodes:[],edges:[]};if(!n.trim())return H;const G=n.toLowerCase(),le=H.nodes.filter(ce=>ce.content.toLowerCase().includes(G)),se=new Set(le.map(ce=>ce.id));return{nodes:le,edges:H.edges.filter(ce=>se.has(ce.source)&&se.has(ce.target))}},[D,n]),ee=R.useMemo(()=>{const H={};return O.forEach(G=>{var le;(H[le=G.category]??(H[le]=[])).push(G)}),H},[O]),ie=R.useMemo(()=>O.filter(H=>!Fb.includes(H.category)),[O]);async function pe(){i.trim()&&(await It("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:a,source:"ui"})}),s(""),S(!1),V())}function ae(H){M("Eintrag löschen?","Diesen Gedächtnis-Eintrag dauerhaft entfernen?",async()=>{try{await It(`/api/memory/${H}`,{method:"DELETE"}),V()}catch(G){x("Fehler",`Löschen fehlgeschlagen: ${G.message||G}`)}})}async function he(){try{await navigator.clipboard.writeText(H3),f(!0),setTimeout(()=>f(!1),1800)}catch{x("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function B(){he(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function J(){c(!0);try{const H=await It("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(H.duplicate_count===0){x("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}M("Deduplizierung bestätigen",`${H.duplicate_count} Dublette(n) in ${H.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await It("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),V()}catch(G){x("Fehler",`Fehler beim Löschen: ${G.message}`)}})}catch(H){x("Fehler",`Fehler bei der Deduplizierung: ${H.message}`)}finally{c(!1)}}const Y=({value:H,label:G,accent:le})=>v.jsxs("span",{className:Je("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",le==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[le==="auto"&&v.jsx(Vm,{className:"h-3 w-3"}),v.jsx("b",{className:Je("font-semibold",le==="auto"?"":"text-foreground"),children:H})," ",G]});return v.jsxs("div",{className:"space-y-5",children:[v.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[v.jsxs("div",{children:[v.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"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Geteilte Konstitution — Hermes, IDEs & Gateway lesen und lernen hier per MCP."})]}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsxs("div",{className:"relative",children:[v.jsx("input",{value:n,onChange:H=>r(H.target.value),"aria-label":"Gedächtnis durchsuchen",type:"search",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"}),v.jsx(pF,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),v.jsxs("button",{onClick:()=>S(H=>!H),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:[v.jsx(OT,{className:"h-4 w-4"})," Eintrag"]}),v.jsx("div",{className:"flex items-center gap-1 p-1 bg-card/30 border border-border/40 rounded-lg",children:[["liste",X8,"Liste"],["graph",s9,"Graph"]].map(([H,G,le])=>v.jsxs("button",{onClick:()=>y(H),className:Je("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",p===H?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[v.jsx(G,{className:"h-3.5 w-3.5"})," ",le]},H))}),v.jsx("button",{onClick:J,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","aria-label":"Duplikate bereinigen",title:"Deduplizieren",children:v.jsx(Vm,{className:"h-4 w-4 text-primary","aria-hidden":"true"})})]})]}),!j&&v.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v.jsx(Y,{value:k.total,label:"Fakten"}),v.jsx(Y,{value:k.auto,label:"auto gelernt",accent:"auto"}),v.jsx(Y,{value:k.manual,label:"manuell"}),v.jsx(Y,{value:k.cats,label:"Kategorien"}),v.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[v.jsx(Vm,{className:"h-3 w-3 text-emerald-400"})," lernt automatisch aus Hermes-Gesprächen"]})]}),b&&v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),v.jsx("button",{onClick:()=>S(!1),"aria-label":"Schließen",className:"text-muted-foreground hover:text-foreground",children:v.jsx(Ed,{className:"h-4 w-4","aria-hidden":"true"})})]}),v.jsx("textarea",{value:i,onChange:H=>s(H.target.value),rows:2,"aria-label":"Eintragstext",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"}),v.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[v.jsx("select",{value:a,onChange:H=>o(H.target.value),"aria-label":"Kategorie",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:Fb.map(H=>{var G;return v.jsx("option",{value:H,className:"bg-popover text-foreground",children:((G=qE[H])==null?void 0:G.label)||H},H)})}),v.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:[v.jsx(OT,{className:"h-4 w-4"})," Speichern"]})]})]}),z&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler: ",z]}),j?v.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:[v.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:v.jsx(Y8,{className:"h-7 w-7 text-primary"})}),v.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[v.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),v.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."})]}),v.jsxs("div",{className:"w-full max-w-lg text-left",children:[v.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),v.jsx("button",{onClick:he,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:d?v.jsxs(v.Fragment,{children:[v.jsx(Sa,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):v.jsxs(v.Fragment,{children:[v.jsx(NT,{className:"h-3 w-3"})," Kopieren"]})})]}),v.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:H3})]}),v.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[v.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:[v.jsx(gF,{className:"h-4 w-4"})," Im Terminal starten"]}),v.jsxs("button",{onClick:he,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?v.jsx(Sa,{className:"h-4 w-4 text-emerald-400"}):v.jsx(NT,{className:"h-4 w-4"})," Prompt kopieren"]})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[v.jsx(i9,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",v.jsx("button",{onClick:()=>S(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):p==="graph"?v.jsx(lhe,{children:v.jsx(R.Suspense,{fallback:v.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:v.jsx(che,{data:X,onDelete:ae})})}):v.jsxs(v.Fragment,{children:[v.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:[v.jsx("button",{onClick:()=>e(""),className:Je("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"}),Fb.map(H=>{const G=qE[H]||B3,le=G.icon;return v.jsxs("button",{onClick:()=>e(H),className:Je("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",t===H?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[v.jsx(le,{className:"h-3 w-3"})," ",G.label]},H)})]}),O.length===0?v.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."}):v.jsx("div",{className:"space-y-5",children:[...Fb,"__other"].map(H=>{const G=H==="__other"?ie:ee[H]||[];if(!G.length)return null;const le=qE[H]||B3,se=le.icon;return v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 mb-2 px-1",children:[v.jsx(se,{className:Je("h-3.5 w-3.5",le.text)}),v.jsx("span",{className:Je("text-[11px] font-bold uppercase tracking-wider",le.text),children:le.label}),v.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 bg-card/50 rounded px-1.5 py-0.5",children:G.length}),v.jsx("div",{className:"ml-1 h-px flex-1 bg-border/30"})]}),v.jsx("div",{className:"space-y-2",children:G.map(ce=>{const Se=z3.has(ce.source);return v.jsxs("div",{className:Je("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",uhe[ce.category]||"border-l-muted"),children:[v.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1 min-w-0",children:ce.content}),v.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[typeof ce.score=="number"&&v.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),"%"]}),v.jsxs("span",{className:Je("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded",Se?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:Se?"Automatisch gelernt":"Manuell angelegt",children:[Se&&v.jsx(Vm,{className:"h-2.5 w-2.5"}),ce.source]}),v.jsx("button",{onClick:()=>ae(ce.id),"aria-label":"Eintrag löschen",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:v.jsx(LT,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]},ce.id)})})]},H)})})]}),T]})}const fhe=["chat","coding","fast","heavy"];function hhe(){const{data:t,error:e}=PC(5e3),{data:n}=Bg(),{showAlert:r,dialogElement:i}=tv(),s=Nd(),a=e?String(e):"",[o,l]=R.useState(!1),c=(n==null?void 0:n.models)??[];async function d(p){try{await It("/api/agent/brain",{method:"POST",body:JSON.stringify({model:p})}),r("Erledigt",`Hermes-Hirn zeigt jetzt auf das Alias '${p}'. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:qn.agentStatus}),l(!1)}catch(y){r("Fehler",`Wechsel fehlgeschlagen: ${y.message||y}`)}}async function f(p){try{await It("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:p})}),r("Erledigt","Agent-Hirn gewechselt (warm gehalten). Gateway wurde neugestartet."),s.invalidateQueries({queryKey:qn.agentStatus}),s.invalidateQueries({queryKey:qn.models}),l(!1)}catch(y){r("Fehler",`Wechsel fehlgeschlagen: ${y.message||y}`)}}return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.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"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",v.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(t==null?void 0:t.terminal_url)&&v.jsxs("a",{href:Ng(t.terminal_url),target:"_blank",rel:"noopener",className:Je("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:[v.jsx(xg,{className:"h-4 w-4"}),v.jsx("span",{children:"Terminal öffnen"})]})]}),a&&v.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 (",a,")."]}),t&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[v.jsx($c,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Fluss"})]}),v.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-stretch gap-3",children:[v.jsxs("button",{onClick:()=>t.terminal_reachable&&window.open(Ng(t.terminal_url),"_blank"),title:t.terminal_reachable?"Hermes-Terminal öffnen":"Terminal offline",className:"lg:w-40 shrink-0 rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/40 transition-all cursor-pointer flex flex-col justify-center",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx(bC,{className:Je("h-3.5 w-3.5",t.terminal_reachable?"text-emerald-400":"text-amber-500")}),v.jsx("span",{className:"text-xs font-semibold text-foreground",children:"Terminal"}),v.jsx("span",{className:Je("ml-auto h-1.5 w-1.5 rounded-full animate-pulse",t.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),v.jsx("span",{className:"text-[10px] text-muted-foreground font-mono mt-0.5",children:"hermes chat · Clients"})]}),v.jsx("div",{className:"hidden lg:flex items-center text-muted-foreground text-lg select-none",children:"→"}),v.jsxs("div",{className:"flex-1 flex flex-col gap-2.5",children:[v.jsxs("div",{className:"rounded-xl border border-primary/40 bg-primary/5 px-3.5 py-2.5 flex items-center gap-2",children:[v.jsx($c,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-xs font-semibold text-primary",children:"Agent Gateway"}),v.jsx("span",{className:"text-[11px] font-mono text-muted-foreground",children:":8642"}),v.jsxs("span",{className:Je("ml-auto inline-flex items-center gap-1.5 text-[10px] font-bold uppercase font-mono px-2 py-0.5 rounded-full border",t.gateway_reachable?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-400 border-red-500/20"),children:[v.jsx("span",{className:Je("h-1.5 w-1.5 rounded-full",t.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-red-500")}),t.gateway_reachable?"online":"offline"]})]}),v.jsxs("div",{className:"grid gap-2.5 sm:grid-cols-3",children:[v.jsxs("button",{onClick:()=>l(!0),className:"rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/45 transition-all cursor-pointer",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[v.jsx(Md,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Hirn"}),v.jsx("span",{className:"ml-auto text-[9px] text-primary/70 font-bold uppercase",children:"wechseln →"})]}),v.jsx("div",{className:"text-[11px] font-mono font-medium text-foreground truncate mt-1",title:t.brain_model,children:t.brain_model||"chat"})]}),v.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[v.jsx(wC,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),v.jsxs("div",{className:"text-[10px] font-mono mt-1 flex flex-wrap gap-x-2 text-muted-foreground",children:[v.jsxs("span",{children:["Config: ",t.has_config?"✓":"—"]}),v.jsxs("span",{children:["Skills: ",t.has_skills?"✓":"—"]}),v.jsxs("span",{children:["Memory: ",t.has_memories?"✓":"—"]})]})]}),v.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[v.jsx(lI,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"PC"}),v.jsx("span",{className:Je("ml-auto h-1.5 w-1.5 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")})]}),v.jsxs("div",{className:Je("text-[11px] font-mono mt-1",t.pc_executor_reachable?"text-emerald-400":"text-muted-foreground"),children:[":7777 ",t.pc_executor_reachable?"verbunden":"offline"]})]})]})]})]})]}),v.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:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(lI,{className:"h-5 w-5 text-primary"}),v.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:Je("h-2 w-2 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[v.jsxs("div",{className:"space-y-3",children:[v.jsxs("p",{children:["Der ",v.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",v.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."]}),v.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",v.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."]})]}),v.jsx("div",{className:"space-y-3",children:t.pc_executor_reachable?v.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[v.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),v.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",v.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",v.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",v.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),v.jsxs("p",{children:["Starte ",v.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",v.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),v.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&&v.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:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Ym,{className:"h-5 w-5 text-amber-500"}),v.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),v.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[v.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),v.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",v.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),v.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[v.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),v.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),v.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-terminal"})]}),v.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",v.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&&o&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":"Hermes-Hirn konfigurieren",children:v.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:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(Md,{className:"h-4 w-4"}),v.jsx("span",{children:"Hermes-Hirn konfigurieren"})]}),v.jsx("button",{onClick:()=>l(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Lane / Gateway-Alias"}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:fhe.map(p=>{const y=t.brain_model===p;return v.jsxs("button",{onClick:()=>d(p),className:Je("px-3 py-1.5 rounded-lg text-xs font-mono font-semibold border transition-all cursor-pointer flex items-center gap-1.5",y?"border-primary/40 bg-primary/10 text-primary":"border-border/30 bg-background/20 text-foreground hover:bg-accent"),children:[p,y&&v.jsx(Sa,{className:"h-3.5 w-3.5"})]},p)})}),v.jsxs("p",{className:"text-[10px] text-muted-foreground/70",children:["Schlank & flexibel: das Hirn folgt dem Lane-Routing (z.B. ",v.jsx("code",{className:"text-primary",children:"chat"})," = fast↔heavy)."]})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Installiertes Modell (warm gehalten)"}),v.jsx("div",{className:"space-y-1.5 max-h-56 overflow-y-auto pr-1",children:c.map(p=>{var b;const y=p.role==="hermes";return v.jsxs("button",{onClick:()=>!y&&f(p.name),disabled:y||p.incomplete,className:Je("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",y?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":p.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:[v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(b=p.name.split("/").pop())==null?void 0:b.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[p.capabilities.params_b?`${p.capabilities.params_b}B`:"?"," · ",p.capabilities.tools!=="no"?"Tools ✓":"ohne Tools",p.role&&` · Rolle: ${p.role}`]})]}),y?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[v.jsx(Sa,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Warm setzen →"})]},p.name)})})]}),v.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[v.jsx("span",{children:"💡"}),v.jsxs("span",{children:["Für einen ",v.jsx("strong",{children:"Agenten"}),' sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl. Neues Modell? Erst über „Modell-Manager → Modelle finden" laden.']})]})]})}),i]})}function phe(){const{data:t}=PC(5e3),e=t!=null&&t.terminal_url?Ng(t.terminal_url):void 0,n=t==null?void 0:t.terminal_reachable;return v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[v.jsxs("div",{children:[v.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"}),v.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Interaktiver Agent (",v.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".']})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[v.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),n?"online":"offline"]}),e&&v.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:[v.jsx(xg,{className:"h-3.5 w-3.5"})," In neuem Tab"]})]})]}),e?v.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&&v.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/70 text-center",children:[v.jsx(bg,{className:"h-8 w-8 text-amber-400"}),v.jsx("div",{className:"text-sm font-semibold text-amber-300",children:"Terminal nicht erreichbar"}),v.jsxs("p",{className:"max-w-sm text-[11px] leading-normal text-muted-foreground",children:["Der ",v.jsx("code",{className:"font-mono text-primary",children:"hermes-terminal"}),"-Dienst (ttyd) läuft nicht. Auf der Box: ",v.jsx("code",{className:"font-mono",children:"systemctl --user restart hermes-terminal"}),"."]})]}),v.jsx("iframe",{src:e,title:"Hermes Terminal",className:"h-full w-full border-0",style:{minHeight:"68vh"}})]}):v.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:[v.jsx(mF,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}/** +Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemerkt hast.`;function fhe(){const[t,e]=R.useState(""),[n,r]=R.useState(""),[i,s]=R.useState(""),[a,o]=R.useState("knowledge"),[l,c]=R.useState(!1),[d,f]=R.useState(!1),[p,y]=R.useState("liste"),[b,S]=R.useState(!1),w=Nd(),{showAlert:x,showConfirm:M,dialogElement:T}=tv(),{data:P=[]}=BT({}),{data:O=[],error:N}=BT({q:n,category:t}),{data:D}=w7(p==="graph"),z=N?String(N):"",V=()=>{w.invalidateQueries({queryKey:["memory"]}),w.invalidateQueries({queryKey:["memory-graph"]})},k=R.useMemo(()=>{const H=P.length,G=P.filter(le=>z3.has(le.source)).length;return{total:H,auto:G,manual:H-G,cats:new Set(P.map(le=>le.category)).size}},[P]),j=P.length===0,X=R.useMemo(()=>{const H=D??{nodes:[],edges:[]};if(!n.trim())return H;const G=n.toLowerCase(),le=H.nodes.filter(ce=>ce.content.toLowerCase().includes(G)),se=new Set(le.map(ce=>ce.id));return{nodes:le,edges:H.edges.filter(ce=>se.has(ce.source)&&se.has(ce.target))}},[D,n]),ee=R.useMemo(()=>{const H={};return O.forEach(G=>{var le;(H[le=G.category]??(H[le]=[])).push(G)}),H},[O]),ie=R.useMemo(()=>O.filter(H=>!Fb.includes(H.category)),[O]);async function pe(){i.trim()&&(await It("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:a,source:"ui"})}),s(""),S(!1),V())}function ae(H){M("Eintrag löschen?","Diesen Gedächtnis-Eintrag dauerhaft entfernen?",async()=>{try{await It(`/api/memory/${H}`,{method:"DELETE"}),V()}catch(G){x("Fehler",`Löschen fehlgeschlagen: ${G.message||G}`)}})}async function he(){try{await navigator.clipboard.writeText(H3),f(!0),setTimeout(()=>f(!1),1800)}catch{x("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function B(){he(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function J(){c(!0);try{const H=await It("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(H.duplicate_count===0){x("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}M("Deduplizierung bestätigen",`${H.duplicate_count} Dublette(n) in ${H.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await It("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),V()}catch(G){x("Fehler",`Fehler beim Löschen: ${G.message}`)}})}catch(H){x("Fehler",`Fehler bei der Deduplizierung: ${H.message}`)}finally{c(!1)}}const Y=({value:H,label:G,accent:le})=>v.jsxs("span",{className:Je("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",le==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[le==="auto"&&v.jsx(Vm,{className:"h-3 w-3"}),v.jsx("b",{className:Je("font-semibold",le==="auto"?"":"text-foreground"),children:H})," ",G]});return v.jsxs("div",{className:"space-y-5",children:[v.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[v.jsxs("div",{children:[v.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"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Geteilte Konstitution — Hermes, IDEs & Gateway lesen und lernen hier per MCP."})]}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsxs("div",{className:"relative",children:[v.jsx("input",{value:n,onChange:H=>r(H.target.value),"aria-label":"Gedächtnis durchsuchen",type:"search",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"}),v.jsx(pF,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),v.jsxs("button",{onClick:()=>S(H=>!H),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:[v.jsx(OT,{className:"h-4 w-4"})," Eintrag"]}),v.jsx("div",{className:"flex items-center gap-1 p-1 bg-card/30 border border-border/40 rounded-lg",children:[["liste",K8,"Liste"],["graph",o9,"Graph"]].map(([H,G,le])=>v.jsxs("button",{onClick:()=>y(H),className:Je("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",p===H?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[v.jsx(G,{className:"h-3.5 w-3.5"})," ",le]},H))}),v.jsx("button",{onClick:J,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","aria-label":"Duplikate bereinigen",title:"Deduplizieren",children:v.jsx(Vm,{className:"h-4 w-4 text-primary","aria-hidden":"true"})})]})]}),!j&&v.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v.jsx(Y,{value:k.total,label:"Fakten"}),v.jsx(Y,{value:k.auto,label:"auto gelernt",accent:"auto"}),v.jsx(Y,{value:k.manual,label:"manuell"}),v.jsx(Y,{value:k.cats,label:"Kategorien"}),v.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[v.jsx(Vm,{className:"h-3 w-3 text-emerald-400"})," lernt automatisch aus Hermes-Gesprächen"]})]}),b&&v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),v.jsx("button",{onClick:()=>S(!1),"aria-label":"Schließen",className:"text-muted-foreground hover:text-foreground",children:v.jsx(Ed,{className:"h-4 w-4","aria-hidden":"true"})})]}),v.jsx("textarea",{value:i,onChange:H=>s(H.target.value),rows:2,"aria-label":"Eintragstext",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"}),v.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[v.jsx("select",{value:a,onChange:H=>o(H.target.value),"aria-label":"Kategorie",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:Fb.map(H=>{var G;return v.jsx("option",{value:H,className:"bg-popover text-foreground",children:((G=qE[H])==null?void 0:G.label)||H},H)})}),v.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:[v.jsx(OT,{className:"h-4 w-4"})," Speichern"]})]})]}),z&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler: ",z]}),j?v.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:[v.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:v.jsx(Q8,{className:"h-7 w-7 text-primary"})}),v.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[v.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),v.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."})]}),v.jsxs("div",{className:"w-full max-w-lg text-left",children:[v.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),v.jsx("button",{onClick:he,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:d?v.jsxs(v.Fragment,{children:[v.jsx(Sa,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):v.jsxs(v.Fragment,{children:[v.jsx(NT,{className:"h-3 w-3"})," Kopieren"]})})]}),v.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:H3})]}),v.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[v.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:[v.jsx(gF,{className:"h-4 w-4"})," Im Terminal starten"]}),v.jsxs("button",{onClick:he,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?v.jsx(Sa,{className:"h-4 w-4 text-emerald-400"}):v.jsx(NT,{className:"h-4 w-4"})," Prompt kopieren"]})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[v.jsx(a9,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",v.jsx("button",{onClick:()=>S(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):p==="graph"?v.jsx(che,{children:v.jsx(R.Suspense,{fallback:v.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:v.jsx(uhe,{data:X,onDelete:ae})})}):v.jsxs(v.Fragment,{children:[v.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:[v.jsx("button",{onClick:()=>e(""),className:Je("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"}),Fb.map(H=>{const G=qE[H]||B3,le=G.icon;return v.jsxs("button",{onClick:()=>e(H),className:Je("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",t===H?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[v.jsx(le,{className:"h-3 w-3"})," ",G.label]},H)})]}),O.length===0?v.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."}):v.jsx("div",{className:"space-y-5",children:[...Fb,"__other"].map(H=>{const G=H==="__other"?ie:ee[H]||[];if(!G.length)return null;const le=qE[H]||B3,se=le.icon;return v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 mb-2 px-1",children:[v.jsx(se,{className:Je("h-3.5 w-3.5",le.text)}),v.jsx("span",{className:Je("text-[11px] font-bold uppercase tracking-wider",le.text),children:le.label}),v.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 bg-card/50 rounded px-1.5 py-0.5",children:G.length}),v.jsx("div",{className:"ml-1 h-px flex-1 bg-border/30"})]}),v.jsx("div",{className:"space-y-2",children:G.map(ce=>{const Se=z3.has(ce.source);return v.jsxs("div",{className:Je("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",dhe[ce.category]||"border-l-muted"),children:[v.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1 min-w-0",children:ce.content}),v.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[typeof ce.score=="number"&&v.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),"%"]}),v.jsxs("span",{className:Je("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded",Se?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:Se?"Automatisch gelernt":"Manuell angelegt",children:[Se&&v.jsx(Vm,{className:"h-2.5 w-2.5"}),ce.source]}),v.jsx("button",{onClick:()=>ae(ce.id),"aria-label":"Eintrag löschen",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:v.jsx(LT,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]},ce.id)})})]},H)})})]}),T]})}const hhe=["chat","coding","fast","heavy"];function phe(){const{data:t,error:e}=PC(5e3),{data:n}=Bg(),{showAlert:r,dialogElement:i}=tv(),s=Nd(),a=e?String(e):"",[o,l]=R.useState(!1),c=(n==null?void 0:n.models)??[];async function d(p){try{await It("/api/agent/brain",{method:"POST",body:JSON.stringify({model:p})}),r("Erledigt",`Hermes-Hirn zeigt jetzt auf das Alias '${p}'. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:qn.agentStatus}),l(!1)}catch(y){r("Fehler",`Wechsel fehlgeschlagen: ${y.message||y}`)}}async function f(p){try{await It("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:p})}),r("Erledigt","Agent-Hirn gewechselt (warm gehalten). Gateway wurde neugestartet."),s.invalidateQueries({queryKey:qn.agentStatus}),s.invalidateQueries({queryKey:qn.models}),l(!1)}catch(y){r("Fehler",`Wechsel fehlgeschlagen: ${y.message||y}`)}}return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.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"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",v.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(t==null?void 0:t.terminal_url)&&v.jsxs("a",{href:Ng(t.terminal_url),target:"_blank",rel:"noopener",className:Je("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:[v.jsx(xg,{className:"h-4 w-4"}),v.jsx("span",{children:"Terminal öffnen"})]})]}),a&&v.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 (",a,")."]}),t&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[v.jsx($c,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Fluss"})]}),v.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-stretch gap-3",children:[v.jsxs("button",{onClick:()=>t.terminal_reachable&&window.open(Ng(t.terminal_url),"_blank"),title:t.terminal_reachable?"Hermes-Terminal öffnen":"Terminal offline",className:"lg:w-40 shrink-0 rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/40 transition-all cursor-pointer flex flex-col justify-center",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx(bC,{className:Je("h-3.5 w-3.5",t.terminal_reachable?"text-emerald-400":"text-amber-500")}),v.jsx("span",{className:"text-xs font-semibold text-foreground",children:"Terminal"}),v.jsx("span",{className:Je("ml-auto h-1.5 w-1.5 rounded-full animate-pulse",t.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),v.jsx("span",{className:"text-[10px] text-muted-foreground font-mono mt-0.5",children:"hermes chat · Clients"})]}),v.jsx("div",{className:"hidden lg:flex items-center text-muted-foreground text-lg select-none",children:"→"}),v.jsxs("div",{className:"flex-1 flex flex-col gap-2.5",children:[v.jsxs("div",{className:"rounded-xl border border-primary/40 bg-primary/5 px-3.5 py-2.5 flex items-center gap-2",children:[v.jsx($c,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-xs font-semibold text-primary",children:"Agent Gateway"}),v.jsx("span",{className:"text-[11px] font-mono text-muted-foreground",children:":8642"}),v.jsxs("span",{className:Je("ml-auto inline-flex items-center gap-1.5 text-[10px] font-bold uppercase font-mono px-2 py-0.5 rounded-full border",t.gateway_reachable?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":"bg-red-500/10 text-red-400 border-red-500/20"),children:[v.jsx("span",{className:Je("h-1.5 w-1.5 rounded-full",t.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-red-500")}),t.gateway_reachable?"online":"offline"]})]}),v.jsxs("div",{className:"grid gap-2.5 sm:grid-cols-3",children:[v.jsxs("button",{onClick:()=>l(!0),className:"rounded-xl border border-border/60 bg-background/30 p-3 text-left hover:border-primary/45 transition-all cursor-pointer",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[v.jsx(Md,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Hirn"}),v.jsx("span",{className:"ml-auto text-[9px] text-primary/70 font-bold uppercase",children:"wechseln →"})]}),v.jsx("div",{className:"text-[11px] font-mono font-medium text-foreground truncate mt-1",title:t.brain_model,children:t.brain_model||"chat"})]}),v.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[v.jsx(wC,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),v.jsxs("div",{className:"text-[10px] font-mono mt-1 flex flex-wrap gap-x-2 text-muted-foreground",children:[v.jsxs("span",{children:["Config: ",t.has_config?"✓":"—"]}),v.jsxs("span",{children:["Skills: ",t.has_skills?"✓":"—"]}),v.jsxs("span",{children:["Memory: ",t.has_memories?"✓":"—"]})]})]}),v.jsxs("div",{className:"rounded-xl border border-border/60 bg-background/30 p-3",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-muted-foreground",children:[v.jsx(lI,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"PC"}),v.jsx("span",{className:Je("ml-auto h-1.5 w-1.5 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")})]}),v.jsxs("div",{className:Je("text-[11px] font-mono mt-1",t.pc_executor_reachable?"text-emerald-400":"text-muted-foreground"),children:[":7777 ",t.pc_executor_reachable?"verbunden":"offline"]})]})]})]})]})]}),v.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:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(lI,{className:"h-5 w-5 text-primary"}),v.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:Je("h-2 w-2 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[v.jsxs("div",{className:"space-y-3",children:[v.jsxs("p",{children:["Der ",v.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",v.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."]}),v.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",v.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."]})]}),v.jsx("div",{className:"space-y-3",children:t.pc_executor_reachable?v.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[v.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),v.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",v.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",v.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",v.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),v.jsxs("p",{children:["Starte ",v.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",v.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),v.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&&v.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:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Ym,{className:"h-5 w-5 text-amber-500"}),v.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),v.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[v.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),v.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",v.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),v.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[v.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),v.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),v.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-terminal"})]}),v.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",v.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&&o&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4 overscroll-contain",role:"dialog","aria-modal":"true","aria-label":"Hermes-Hirn konfigurieren",children:v.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:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(Md,{className:"h-4 w-4"}),v.jsx("span",{children:"Hermes-Hirn konfigurieren"})]}),v.jsx("button",{onClick:()=>l(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Lane / Gateway-Alias"}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:hhe.map(p=>{const y=t.brain_model===p;return v.jsxs("button",{onClick:()=>d(p),className:Je("px-3 py-1.5 rounded-lg text-xs font-mono font-semibold border transition-all cursor-pointer flex items-center gap-1.5",y?"border-primary/40 bg-primary/10 text-primary":"border-border/30 bg-background/20 text-foreground hover:bg-accent"),children:[p,y&&v.jsx(Sa,{className:"h-3.5 w-3.5"})]},p)})}),v.jsxs("p",{className:"text-[10px] text-muted-foreground/70",children:["Schlank & flexibel: das Hirn folgt dem Lane-Routing (z.B. ",v.jsx("code",{className:"text-primary",children:"chat"})," = fast↔heavy)."]})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"Installiertes Modell (warm gehalten)"}),v.jsx("div",{className:"space-y-1.5 max-h-56 overflow-y-auto pr-1",children:c.map(p=>{var b;const y=p.role==="hermes";return v.jsxs("button",{onClick:()=>!y&&f(p.name),disabled:y||p.incomplete,className:Je("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",y?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":p.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:[v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(b=p.name.split("/").pop())==null?void 0:b.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[p.capabilities.params_b?`${p.capabilities.params_b}B`:"?"," · ",p.capabilities.tools!=="no"?"Tools ✓":"ohne Tools",p.role&&` · Rolle: ${p.role}`]})]}),y?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[v.jsx(Sa,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Warm setzen →"})]},p.name)})})]}),v.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[v.jsx("span",{children:"💡"}),v.jsxs("span",{children:["Für einen ",v.jsx("strong",{children:"Agenten"}),' sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl. Neues Modell? Erst über „Modell-Manager → Modelle finden" laden.']})]})]})}),i]})}function mhe(){const{data:t}=PC(5e3),e=t!=null&&t.terminal_url?Ng(t.terminal_url):void 0,n=t==null?void 0:t.terminal_reachable;return v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[v.jsxs("div",{children:[v.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"}),v.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Interaktiver Agent (",v.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".']})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[v.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),n?"online":"offline"]}),e&&v.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:[v.jsx(xg,{className:"h-3.5 w-3.5"})," In neuem Tab"]})]})]}),e?v.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&&v.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/70 text-center",children:[v.jsx(bg,{className:"h-8 w-8 text-amber-400"}),v.jsx("div",{className:"text-sm font-semibold text-amber-300",children:"Terminal nicht erreichbar"}),v.jsxs("p",{className:"max-w-sm text-[11px] leading-normal text-muted-foreground",children:["Der ",v.jsx("code",{className:"font-mono text-primary",children:"hermes-terminal"}),"-Dienst (ttyd) läuft nicht. Auf der Box: ",v.jsx("code",{className:"font-mono",children:"systemctl --user restart hermes-terminal"}),"."]})]}),v.jsx("iframe",{src:e,title:"Hermes Terminal",className:"h-full w-full border-0",style:{minHeight:"68vh"}})]}):v.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:[v.jsx(mF,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}/** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */const Pd="169",Kf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Yf={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},yV=0,BP=1,xV=2,mhe=3,bV=0,BS=1,Y0=2,Oo=3,Ll=0,as=1,ya=2,Vc=0,Ah=1,HP=2,VP=3,GP=4,_V=5,cd=100,wV=101,SV=102,MV=103,EV=104,AV=200,TV=201,PV=202,CV=203,Jw=204,e1=205,RV=206,NV=207,IV=208,kV=209,OV=210,LV=211,DV=212,UV=213,jV=214,t1=0,n1=1,r1=2,zh=3,i1=4,s1=5,a1=6,o1=7,cx=0,FV=1,zV=2,Tl=0,BV=1,HV=2,VV=3,uR=4,GV=5,WV=6,$V=7,WP="attached",XV="detached",HS=300,Zc=301,Cd=302,Ay=303,Ty=304,nv=306,Rd=1e3,ba=1001,Ig=1002,ri=1003,VS=1004,ghe=1004,oh=1005,vhe=1005,Cr=1006,ng=1007,yhe=1007,$a=1008,xhe=1008,Ho=1009,dR=1010,fR=1011,kg=1012,GS=1013,Qc=1014,Qs=1015,rv=1016,WS=1017,$S=1018,Bh=1020,hR=35902,pR=1021,mR=1022,ss=1023,gR=1024,vR=1025,Th=1026,Hh=1027,XS=1028,ux=1029,yR=1030,qS=1031,bhe=1032,KS=1033,Z0=33776,Q0=33777,J0=33778,ey=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,P1=37821,ty=36492,C1=36494,R1=36495,xR=36283,N1=36284,I1=36285,k1=36286,qV=2200,KV=2201,YV=2202,Og=2300,Lg=2301,X_=2302,lh=2400,ch=2401,Py=2402,YS=2500,bR=2501,ZV=0,_R=1,O1=2,QV=3200,JV=3201,_he=3202,whe=3203,au=0,e6=1,Oc="",Fi="srgb",xi="srgb-linear",ZS="display-p3",dx="display-p3-linear",Cy="linear",er="srgb",Ry="rec709",Ny="p3",She=0,Zf=7680,Mhe=7681,Ehe=7682,Ahe=7683,The=34055,Phe=34056,Che=5386,Rhe=512,Nhe=513,Ihe=514,khe=515,Ohe=516,Lhe=517,Dhe=518,$P=519,t6=512,n6=513,r6=514,wR=515,i6=516,s6=517,a6=518,o6=519,Iy=35044,l6=35048,Uhe=35040,jhe=35045,Fhe=35049,zhe=35041,Bhe=35046,Hhe=35050,Vhe=35042,Ghe="100",XP="300 es",Ml=2e3,ky=2001;let zl=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,a=i.length;s>8&255]+Ji[t>>16&255]+Ji[t>>24&255]+"-"+Ji[e&255]+Ji[e>>8&255]+"-"+Ji[e>>16&15|64]+Ji[e>>24&255]+"-"+Ji[n&63|128]+Ji[n>>8&255]+"-"+Ji[n>>16&255]+Ji[n>>24&255]+Ji[r&255]+Ji[r>>8&255]+Ji[r>>16&255]+Ji[r>>24&255]).toLowerCase()}function Tr(t,e,n){return Math.max(e,Math.min(n,t))}function SR(t,e){return(t%e+e)%e}function Whe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function $he(t,e,n){return t!==e?(n-t)/(e-t):0}function ny(t,e,n){return(1-n)*t+n*e}function Xhe(t,e,n,r){return ny(t,e,1-Math.exp(-n*r))}function qhe(t,e=1){return e-Math.abs(SR(t,e*2)-e)}function Khe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Yhe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Zhe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Qhe(t,e){return t+Math.random()*(e-t)}function Jhe(t){return t*(.5-Math.random())}function epe(t){t!==void 0&&(V3=t);let e=V3+=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 tpe(t){return t*Ph}function npe(t){return t*Dg}function rpe(t){return(t&t-1)===0&&t!==0}function ipe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function spe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function ape(t,e,n,r,i){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((e+r)/2),d=a((e+r)/2),f=s((e-r)/2),p=a((e-r)/2),y=s((r-e)/2),b=a((r-e)/2);switch(i){case"XYX":t.set(o*d,l*f,l*p,o*c);break;case"YZY":t.set(l*p,o*d,l*f,o*c);break;case"ZXZ":t.set(l*f,l*p,o*d,o*c);break;case"XZX":t.set(o*d,l*b,l*y,o*c);break;case"YXY":t.set(l*y,o*d,l*b,o*c);break;case"ZYZ":t.set(l*b,l*y,o*d,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ss(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 cn(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:Ph,RAD2DEG:Dg,generateUUID:wa,clamp:Tr,euclideanModulo:SR,mapLinear:Whe,inverseLerp:$he,lerp:ny,damp:Xhe,pingpong:qhe,smoothstep:Khe,smootherstep:Yhe,randInt:Zhe,randFloat:Qhe,randFloatSpread:Jhe,seededRandom:epe,degToRad:tpe,radToDeg:npe,isPowerOfTwo:rpe,ceilPowerOfTwo:ipe,floorPowerOfTwo:spe,setQuaternionFromProperEuler:ape,normalize:cn,denormalize:Ss};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(Tr(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,a=this.y-e.y;return this.x=s*r-a*i+e.x,this.y=s*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class $t{constructor(e,n,r,i,s,a,o,l,c){$t.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,o,l,c)}set(e,n,r,i,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=o,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=a,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,a=r[0],o=r[3],l=r[6],c=r[1],d=r[4],f=r[7],p=r[2],y=r[5],b=r[8],S=i[0],w=i[3],x=i[6],M=i[1],T=i[4],P=i[7],O=i[2],N=i[5],D=i[8];return s[0]=a*S+o*M+l*O,s[3]=a*w+o*T+l*N,s[6]=a*x+o*P+l*D,s[1]=c*S+d*M+f*O,s[4]=c*w+d*T+f*N,s[7]=c*x+d*P+f*D,s[2]=p*S+y*M+b*O,s[5]=p*w+y*T+b*N,s[8]=p*x+y*P+b*D,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],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return n*a*d-n*o*c-r*s*d+r*o*l+i*s*c-i*a*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=d*a-o*c,p=o*l-d*s,y=c*s-a*l,b=n*f+r*p+i*y;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/b;return e[0]=f*S,e[1]=(i*c-d*r)*S,e[2]=(o*r-i*a)*S,e[3]=p*S,e[4]=(d*n-i*l)*S,e[5]=(i*s-o*n)*S,e[6]=y*S,e[7]=(r*l-c*n)*S,e[8]=(a*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,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+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 $t;function c6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const ope={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $m(t,e){return new ope[t](e)}function Oy(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function u6(){const t=Oy("canvas");return t.style.display="block",t}const G3={};function q_(t){t in G3||(G3[t]=!0,console.warn(t))}function lpe(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 cpe(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 upe(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 W3=new $t().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),$3=new $t().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),v0={[xi]:{transfer:Cy,primaries:Ry,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Fi]:{transfer:er,primaries:Ry,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[dx]:{transfer:Cy,primaries:Ny,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3($3),fromReference:t=>t.applyMatrix3(W3)},[ZS]:{transfer:er,primaries:Ny,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3($3),fromReference:t=>t.applyMatrix3(W3).convertLinearToSRGB()}},dpe=new Set([xi,dx]),Nn={enabled:!0,_workingColorSpace:xi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!dpe.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===Oc?Cy:v0[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(v0[e].luminanceCoefficients)}};function rg(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 hm;class d6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{hm===void 0&&(hm=Oy("canvas")),hm.width=e.width,hm.height=e.height;const r=hm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=hm}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 a=0;a0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==HS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Rd:e.x=e.x-Math.floor(e.x);break;case ba:e.x=e.x<0?0:1;break;case Ig: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 Rd:e.y=e.y-Math.floor(e.y);break;case ba:e.y=e.y<0?0:1;break;case Ig: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++}}fr.DEFAULT_IMAGE=null;fr.DEFAULT_MAPPING=HS;fr.DEFAULT_ANISOTROPY=1;class On{constructor(e=0,n=0,r=0,i=1){On.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,a=e.elements;return this.x=a[0]*n+a[4]*r+a[8]*i+a[12]*s,this.y=a[1]*n+a[5]*r+a[9]*i+a[13]*s,this.z=a[2]*n+a[6]*r+a[10]*i+a[14]*s,this.w=a[3]*n+a[7]*r+a[11]*i+a[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],p=l[1],y=l[5],b=l[9],S=l[2],w=l[6],x=l[10];if(Math.abs(d-p)<.01&&Math.abs(f-S)<.01&&Math.abs(b-w)<.01){if(Math.abs(d+p)<.1&&Math.abs(f+S)<.1&&Math.abs(b+w)<.1&&Math.abs(c+y+x-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const T=(c+1)/2,P=(y+1)/2,O=(x+1)/2,N=(d+p)/4,D=(f+S)/4,z=(b+w)/4;return T>P&&T>O?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=N/r,s=D/r):P>O?P<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(P),r=N/i,s=z/i):O<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(O),r=D/s,i=z/s),this.set(r,i,s,n),this}let M=Math.sqrt((w-b)*(w-b)+(f-S)*(f-S)+(p-d)*(p-d));return Math.abs(M)<.001&&(M=1),this.x=(w-b)/M,this.y=(f-S)/M,this.z=(p-d)/M,this.w=Math.acos((c+y+x-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 f6 extends zl{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new On(0,0,e,n),this.scissorTest=!1,this.viewport=new On(0,0,e,n);const i={width:e,height:n,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Cr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new fr(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 a=r.count;for(let o=0;o=0?1:-1,T=1-x*x;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,x*M);w=Math.sin(w*N)/O,o=Math.sin(o*N)/O}const P=o*M;if(l=l*w+p*P,c=c*w+y*P,d=d*w+b*P,f=f*w+S*P,w===1-o){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,a){const o=r[i],l=r[i+1],c=r[i+2],d=r[i+3],f=s[a],p=s[a+1],y=s[a+2],b=s[a+3];return e[n]=o*b+d*f+l*y-c*p,e[n+1]=l*b+d*p+c*f-o*y,e[n+2]=c*b+d*y+o*p-l*f,e[n+3]=d*b-o*f-l*p-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,a=e._order,o=Math.cos,l=Math.sin,c=o(r/2),d=o(i/2),f=o(s/2),p=l(r/2),y=l(i/2),b=l(s/2);switch(a){case"XYZ":this._x=p*d*f+c*y*b,this._y=c*y*f-p*d*b,this._z=c*d*b+p*y*f,this._w=c*d*f-p*y*b;break;case"YXZ":this._x=p*d*f+c*y*b,this._y=c*y*f-p*d*b,this._z=c*d*b-p*y*f,this._w=c*d*f+p*y*b;break;case"ZXY":this._x=p*d*f-c*y*b,this._y=c*y*f+p*d*b,this._z=c*d*b+p*y*f,this._w=c*d*f-p*y*b;break;case"ZYX":this._x=p*d*f-c*y*b,this._y=c*y*f+p*d*b,this._z=c*d*b-p*y*f,this._w=c*d*f+p*y*b;break;case"YZX":this._x=p*d*f+c*y*b,this._y=c*y*f+p*d*b,this._z=c*d*b-p*y*f,this._w=c*d*f-p*y*b;break;case"XZY":this._x=p*d*f-c*y*b,this._y=c*y*f-p*d*b,this._z=c*d*b+p*y*f,this._w=c*d*f+p*y*b;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}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],a=n[1],o=n[5],l=n[9],c=n[2],d=n[6],f=n[10],p=r+o+f;if(p>0){const y=.5/Math.sqrt(p+1);this._w=.25/y,this._x=(d-l)*y,this._y=(s-c)*y,this._z=(a-i)*y}else if(r>o&&r>f){const y=2*Math.sqrt(1+r-o-f);this._w=(d-l)/y,this._x=.25*y,this._y=(i+a)/y,this._z=(s+c)/y}else if(o>f){const y=2*Math.sqrt(1+o-r-f);this._w=(s-c)/y,this._x=(i+a)/y,this._y=.25*y,this._z=(l+d)/y}else{const y=2*Math.sqrt(1+f-r-o);this._w=(a-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(Tr(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,a=e._w,o=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+a*o+i*c-s*l,this._y=i*d+a*l+s*o-r*c,this._z=s*d+a*c+r*l-i*o,this._w=a*d-r*o-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,a=this._w;let o=a*e._w+r*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=r,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const y=1-n;return this._w=y*a+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,o),f=Math.sin((1-n)*d)/c,p=Math.sin(n*d)/c;return this._w=a*f+this._w*p,this._x=r*f+this._x*p,this._y=i*f+this._y*p,this._z=s*f+this._z*p,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 q{constructor(e=0,n=0,r=0){q.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(X3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(X3.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,a=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])*a,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*a,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*a,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*r),d=2*(o*n-s*i),f=2*(s*r-a*n);return this.x=n+l*c+a*f-o*d,this.y=r+l*d+o*c-s*f,this.z=i+l*f+s*d-a*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,a=n.x,o=n.y,l=n.z;return this.x=i*l-s*o,this.y=s*a-r*l,this.z=r*o-i*a,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(Tr(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 q,X3=new qt;class os{constructor(e=new q(1/0,1/0,1/0),n=new q(-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,Po),Po.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),pm.subVectors(e.a,y0),mm.subVectors(e.b,y0),gm.subVectors(e.c,y0),Wu.subVectors(mm,pm),$u.subVectors(gm,mm),Cf.subVectors(pm,gm);let n=[0,-Wu.z,Wu.y,0,-$u.z,$u.y,0,-Cf.z,Cf.y,Wu.z,0,-Wu.x,$u.z,0,-$u.x,Cf.z,0,-Cf.x,-Wu.y,Wu.x,0,-$u.y,$u.x,0,-Cf.y,Cf.x,0];return!JE(n,pm,mm,gm,Bb)||(n=[1,0,0,0,1,0,0,0,1],!JE(n,pm,mm,gm,Bb))?!1:(Hb.crossVectors(Wu,$u),n=[Hb.x,Hb.y,Hb.z],JE(n,pm,mm,gm,Bb))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Po).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Po).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:(_c[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_c[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_c[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_c[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_c[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_c[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_c[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_c[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_c),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 _c=[new q,new q,new q,new q,new q,new q,new q,new q],Po=new q,zb=new os,pm=new q,mm=new q,gm=new q,Wu=new q,$u=new q,Cf=new q,y0=new q,Bb=new q,Hb=new q,Rf=new q;function JE(t,e,n,r,i){for(let s=0,a=t.length-3;s<=a;s+=3){Rf.fromArray(t,s);const o=i.x*Math.abs(Rf.x)+i.y*Math.abs(Rf.y)+i.z*Math.abs(Rf.z),l=e.dot(Rf),c=n.dot(Rf),d=r.dot(Rf);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const gpe=new os,x0=new q,eA=new q;class Hi{constructor(e=new q,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):gpe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,a=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 wc=new q,tA=new q,Vb=new q,Xu=new q,nA=new q,Gb=new q,rA=new q;class ep{constructor(e=new q,n=new q(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,wc)),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=wc.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(wc.copy(this.origin).addScaledVector(this.direction,n),wc.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){tA.copy(e).add(n).multiplyScalar(.5),Vb.copy(n).sub(e).normalize(),Xu.copy(this.origin).sub(tA);const s=e.distanceTo(n)*.5,a=-this.direction.dot(Vb),o=Xu.dot(this.direction),l=-Xu.dot(Vb),c=Xu.lengthSq(),d=Math.abs(1-a*a);let f,p,y,b;if(d>0)if(f=a*l-o,p=a*o-l,b=s*d,f>=0)if(p>=-b)if(p<=b){const S=1/d;f*=S,p*=S,y=f*(f+a*p+2*o)+p*(a*f+p+2*l)+c}else p=s,f=Math.max(0,-(a*p+o)),y=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(a*p+o)),y=-f*f+p*(p+2*l)+c;else p<=-b?(f=Math.max(0,-(-a*s+o)),p=f>0?-s:Math.min(Math.max(-s,-l),s),y=-f*f+p*(p+2*l)+c):p<=b?(f=0,p=Math.min(Math.max(-s,-l),s),y=p*(p+2*l)+c):(f=Math.max(0,-(a*s+o)),p=f>0?s:Math.min(Math.max(-s,-l),s),y=-f*f+p*(p+2*l)+c);else p=a>0?-s:s,f=Math.max(0,-(a*p+o)),y=-f*f+p*(p+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(tA).addScaledVector(Vb,p),y}intersectSphere(e,n){wc.subVectors(e.center,this.origin);const r=wc.dot(this.direction),i=wc.dot(wc)-r*r,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=r-a,l=r+a;return l<0?null:o<0?this.at(l,n):this.at(o,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,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(r=(e.min.x-p.x)*c,i=(e.max.x-p.x)*c):(r=(e.max.x-p.x)*c,i=(e.min.x-p.x)*c),d>=0?(s=(e.min.y-p.y)*d,a=(e.max.y-p.y)*d):(s=(e.max.y-p.y)*d,a=(e.min.y-p.y)*d),r>a||s>i||((s>r||isNaN(r))&&(r=s),(a=0?(o=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(o=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),r>l||o>i)||((o>r||r!==r)&&(r=o),(l=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,wc)!==null}intersectTriangle(e,n,r,i,s){nA.subVectors(n,e),Gb.subVectors(r,e),rA.crossVectors(nA,Gb);let a=this.direction.dot(rA),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Xu.subVectors(this.origin,e);const l=o*this.direction.dot(Gb.crossVectors(Xu,Gb));if(l<0)return null;const c=o*this.direction.dot(nA.cross(Xu));if(c<0||l+c>a)return null;const d=-o*Xu.dot(rA);return d<0?null:this.at(d/a,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 Ct{constructor(e,n,r,i,s,a,o,l,c,d,f,p,y,b,S,w){Ct.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,a,o,l,c,d,f,p,y,b,S,w)}set(e,n,r,i,s,a,o,l,c,d,f,p,y,b,S,w){const x=this.elements;return x[0]=e,x[4]=n,x[8]=r,x[12]=i,x[1]=s,x[5]=a,x[9]=o,x[13]=l,x[2]=c,x[6]=d,x[10]=f,x[14]=p,x[3]=y,x[7]=b,x[11]=S,x[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 Ct().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/vm.setFromMatrixColumn(e,0).length(),s=1/vm.setFromMatrixColumn(e,1).length(),a=1/vm.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]*a,n[9]=r[9]*a,n[10]=r[10]*a,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,a=Math.cos(r),o=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=a*d,y=a*f,b=o*d,S=o*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=y+b*c,n[5]=p-S*c,n[9]=-o*l,n[2]=S-p*c,n[6]=b+y*c,n[10]=a*l}else if(e.order==="YXZ"){const p=l*d,y=l*f,b=c*d,S=c*f;n[0]=p+S*o,n[4]=b*o-y,n[8]=a*c,n[1]=a*f,n[5]=a*d,n[9]=-o,n[2]=y*o-b,n[6]=S+p*o,n[10]=a*l}else if(e.order==="ZXY"){const p=l*d,y=l*f,b=c*d,S=c*f;n[0]=p-S*o,n[4]=-a*f,n[8]=b+y*o,n[1]=y+b*o,n[5]=a*d,n[9]=S-p*o,n[2]=-a*c,n[6]=o,n[10]=a*l}else if(e.order==="ZYX"){const p=a*d,y=a*f,b=o*d,S=o*f;n[0]=l*d,n[4]=b*c-y,n[8]=p*c+S,n[1]=l*f,n[5]=S*c+p,n[9]=y*c-b,n[2]=-c,n[6]=o*l,n[10]=a*l}else if(e.order==="YZX"){const p=a*l,y=a*c,b=o*l,S=o*c;n[0]=l*d,n[4]=S-p*f,n[8]=b*f+y,n[1]=f,n[5]=a*d,n[9]=-o*d,n[2]=-c*d,n[6]=y*f+b,n[10]=p-S*f}else if(e.order==="XZY"){const p=a*l,y=a*c,b=o*l,S=o*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=p*f+S,n[5]=a*d,n[9]=y*f-b,n[2]=b*f-y,n[6]=o*d,n[10]=S*f+p}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(vpe,e,ype)}lookAt(e,n,r){const i=this.elements;return fa.subVectors(e,n),fa.lengthSq()===0&&(fa.z=1),fa.normalize(),qu.crossVectors(r,fa),qu.lengthSq()===0&&(Math.abs(r.z)===1?fa.x+=1e-4:fa.z+=1e-4,fa.normalize(),qu.crossVectors(r,fa)),qu.normalize(),Wb.crossVectors(fa,qu),i[0]=qu.x,i[4]=Wb.x,i[8]=fa.x,i[1]=qu.y,i[5]=Wb.y,i[9]=fa.y,i[2]=qu.z,i[6]=Wb.z,i[10]=fa.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,a=r[0],o=r[4],l=r[8],c=r[12],d=r[1],f=r[5],p=r[9],y=r[13],b=r[2],S=r[6],w=r[10],x=r[14],M=r[3],T=r[7],P=r[11],O=r[15],N=i[0],D=i[4],z=i[8],V=i[12],k=i[1],j=i[5],X=i[9],ee=i[13],ie=i[2],pe=i[6],ae=i[10],he=i[14],B=i[3],J=i[7],Y=i[11],H=i[15];return s[0]=a*N+o*k+l*ie+c*B,s[4]=a*D+o*j+l*pe+c*J,s[8]=a*z+o*X+l*ae+c*Y,s[12]=a*V+o*ee+l*he+c*H,s[1]=d*N+f*k+p*ie+y*B,s[5]=d*D+f*j+p*pe+y*J,s[9]=d*z+f*X+p*ae+y*Y,s[13]=d*V+f*ee+p*he+y*H,s[2]=b*N+S*k+w*ie+x*B,s[6]=b*D+S*j+w*pe+x*J,s[10]=b*z+S*X+w*ae+x*Y,s[14]=b*V+S*ee+w*he+x*H,s[3]=M*N+T*k+P*ie+O*B,s[7]=M*D+T*j+P*pe+O*J,s[11]=M*z+T*X+P*ae+O*Y,s[15]=M*V+T*ee+P*he+O*H,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],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],p=e[10],y=e[14],b=e[3],S=e[7],w=e[11],x=e[15];return b*(+s*l*f-i*c*f-s*o*p+r*c*p+i*o*y-r*l*y)+S*(+n*l*y-n*c*p+s*a*p-i*a*y+i*c*d-s*l*d)+w*(+n*c*f-n*o*y-s*a*f+r*a*y+s*o*d-r*c*d)+x*(-i*o*d-n*l*f+n*o*p+i*a*f-r*a*p+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],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=e[9],p=e[10],y=e[11],b=e[12],S=e[13],w=e[14],x=e[15],M=f*w*c-S*p*c+S*l*y-o*w*y-f*l*x+o*p*x,T=b*p*c-d*w*c-b*l*y+a*w*y+d*l*x-a*p*x,P=d*S*c-b*f*c+b*o*y-a*S*y-d*o*x+a*f*x,O=b*f*l-d*S*l-b*o*p+a*S*p+d*o*w-a*f*w,N=n*M+r*T+i*P+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 D=1/N;return e[0]=M*D,e[1]=(S*p*s-f*w*s-S*i*y+r*w*y+f*i*x-r*p*x)*D,e[2]=(o*w*s-S*l*s+S*i*c-r*w*c-o*i*x+r*l*x)*D,e[3]=(f*l*s-o*p*s-f*i*c+r*p*c+o*i*y-r*l*y)*D,e[4]=T*D,e[5]=(d*w*s-b*p*s+b*i*y-n*w*y-d*i*x+n*p*x)*D,e[6]=(b*l*s-a*w*s-b*i*c+n*w*c+a*i*x-n*l*x)*D,e[7]=(a*p*s-d*l*s+d*i*c-n*p*c-a*i*y+n*l*y)*D,e[8]=P*D,e[9]=(b*f*s-d*S*s-b*r*y+n*S*y+d*r*x-n*f*x)*D,e[10]=(a*S*s-b*o*s+b*r*c-n*S*c-a*r*x+n*o*x)*D,e[11]=(d*o*s-a*f*s-d*r*c+n*f*c+a*r*y-n*o*y)*D,e[12]=O*D,e[13]=(d*S*i-b*f*i+b*r*p-n*S*p-d*r*w+n*f*w)*D,e[14]=(b*o*i-a*S*i-b*r*l+n*S*l+a*r*w-n*o*w)*D,e[15]=(a*f*i-d*o*i+d*r*l-n*f*l-a*r*p+n*o*p)*D,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,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+r,c*o-i*l,c*l+i*o,0,c*o+i*l,d*o+r,d*l-i*a,0,c*l-i*o,d*l+i*a,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,a){return this.set(1,r,s,0,e,1,a,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,a=n._y,o=n._z,l=n._w,c=s+s,d=a+a,f=o+o,p=s*c,y=s*d,b=s*f,S=a*d,w=a*f,x=o*f,M=l*c,T=l*d,P=l*f,O=r.x,N=r.y,D=r.z;return i[0]=(1-(S+x))*O,i[1]=(y+P)*O,i[2]=(b-T)*O,i[3]=0,i[4]=(y-P)*N,i[5]=(1-(p+x))*N,i[6]=(w+M)*N,i[7]=0,i[8]=(b+T)*D,i[9]=(w-M)*D,i[10]=(1-(p+S))*D,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=vm.set(i[0],i[1],i[2]).length();const a=vm.set(i[4],i[5],i[6]).length(),o=vm.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],Co.copy(this);const c=1/s,d=1/a,f=1/o;return Co.elements[0]*=c,Co.elements[1]*=c,Co.elements[2]*=c,Co.elements[4]*=d,Co.elements[5]*=d,Co.elements[6]*=d,Co.elements[8]*=f,Co.elements[9]*=f,Co.elements[10]*=f,n.setFromRotationMatrix(Co),r.x=s,r.y=a,r.z=o,this}makePerspective(e,n,r,i,s,a,o=Ml){const l=this.elements,c=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),p=(r+i)/(r-i);let y,b;if(o===Ml)y=-(a+s)/(a-s),b=-2*a*s/(a-s);else if(o===ky)y=-a/(a-s),b=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=y,l[14]=b,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,s,a,o=Ml){const l=this.elements,c=1/(n-e),d=1/(r-i),f=1/(a-s),p=(n+e)*c,y=(r+i)*d;let b,S;if(o===Ml)b=(a+s)*f,S=-2*f;else if(o===ky)b=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-y,l[2]=0,l[6]=0,l[10]=S,l[14]=-b,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 vm=new q,Co=new Ct,vpe=new q(0,0,0),ype=new q(1,1,1),qu=new q,Wb=new q,fa=new q,q3=new Ct,K3=new qt;class ls{constructor(e=0,n=0,r=0,i=ls.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],a=i[4],o=i[8],l=i[1],c=i[5],d=i[9],f=i[2],p=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Tr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Tr(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,y),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Tr(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,y),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Tr(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,y),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Tr(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(o,y));break;case"XZY":this._z=Math.asin(-Tr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,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 q3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(q3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return K3.setFromEuler(this),this.setFromQuaternion(K3,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}}ls.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(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.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(o,l){return o[l.uuid]===void 0&&(o[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 o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c0){i.children=[];for(let o=0;o0){i.animations=[];for(let o=0;o0&&(r.geometries=o),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),p.length>0&&(r.skeletons=p),y.length>0&&(r.animations=y),b.length>0&&(r.nodes=b)}return r.object=i,r;function a(o){const l=[];for(const c in o){const d=o[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){Ro.subVectors(i,n),Mc.subVectors(r,n),sA.subVectors(e,n);const a=Ro.dot(Ro),o=Ro.dot(Mc),l=Ro.dot(sA),c=Mc.dot(Mc),d=Mc.dot(sA),f=a*c-o*o;if(f===0)return s.set(0,0,0),null;const p=1/f,y=(c*l-o*d)*p,b=(a*d-o*l)*p;return s.set(1-y-b,b,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Ec)===null?!1:Ec.x>=0&&Ec.y>=0&&Ec.x+Ec.y<=1}static getInterpolation(e,n,r,i,s,a,o,l){return this.getBarycoord(e,n,r,i,Ec)===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,Ec.x),l.addScaledVector(a,Ec.y),l.addScaledVector(o,Ec.z),l)}static getInterpolatedAttribute(e,n,r,i,s,a){return cA.setScalar(0),uA.setScalar(0),dA.setScalar(0),cA.fromBufferAttribute(e,n),uA.fromBufferAttribute(e,r),dA.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(cA,s.x),a.addScaledVector(uA,s.y),a.addScaledVector(dA,s.z),a}static isFrontFacing(e,n,r,i){return Ro.subVectors(r,n),Mc.subVectors(e,n),Ro.cross(Mc).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 Ro.subVectors(this.c,this.b),Mc.subVectors(this.a,this.b),Ro.cross(Mc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ks.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Ks.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Ks.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Ks.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ks.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 a,o;bm.subVectors(i,r),_m.subVectors(s,r),aA.subVectors(e,r);const l=bm.dot(aA),c=_m.dot(aA);if(l<=0&&c<=0)return n.copy(r);oA.subVectors(e,i);const d=bm.dot(oA),f=_m.dot(oA);if(d>=0&&f<=d)return n.copy(i);const p=l*f-d*c;if(p<=0&&l>=0&&d<=0)return a=l/(l-d),n.copy(r).addScaledVector(bm,a);lA.subVectors(e,s);const y=bm.dot(lA),b=_m.dot(lA);if(b>=0&&y<=b)return n.copy(s);const S=y*c-l*b;if(S<=0&&c>=0&&b<=0)return o=c/(c-b),n.copy(r).addScaledVector(_m,o);const w=d*b-y*f;if(w<=0&&f-d>=0&&y-b>=0)return tD.subVectors(s,i),o=(f-d)/(f-d+(y-b)),n.copy(i).addScaledVector(tD,o);const x=1/(w+S+p);return a=S*x,o=p*x,n.copy(r).addScaledVector(bm,a).addScaledVector(_m,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const h6={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},Ku={h:0,s:0,l:0},Xb={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 ct{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,Nn.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=Nn.workingColorSpace){return this.r=e,this.g=n,this.b=r,Nn.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=Nn.workingColorSpace){if(e=SR(e,1),n=Tr(n,0,1),r=Tr(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,a=2*r-s;this.r=fA(a,s,e+1/3),this.g=fA(a,s,e),this.b=fA(a,s,e-1/3)}return Nn.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 a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))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(o))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(o))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],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(a===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=h6[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=rg(e.r),this.g=rg(e.g),this.b=rg(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 Nn.fromWorkingColorSpace(es.copy(this),e),Math.round(Tr(es.r*255,0,255))*65536+Math.round(Tr(es.g*255,0,255))*256+Math.round(Tr(es.b*255,0,255))}getHexString(e=Fi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Nn.workingColorSpace){Nn.fromWorkingColorSpace(es.copy(this),n);const r=es.r,i=es.g,s=es.b,a=Math.max(r,i,s),o=Math.min(r,i,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=d<=.5?f/(a+o):f/(2-a-o),a){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!==Ah&&(r.blending=this.blending),this.side!==Ll&&(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!==cd&&(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!==zh&&(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!==$P&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Zf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Zf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Zf&&(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 a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(n){const s=i(e.textures),a=i(e.images);s.length>0&&(r.textures=s),a.length>0&&(r.images=a)}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 As extends Gr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ct(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 ls,this.combine=cx,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 Lc=Mpe();function Mpe(){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),a=new Uint32Array(64),o=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)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function $s(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Tr(t,-65504,65504),Lc.floatView[0]=t;const e=Lc.uint32View[0],n=e>>23&511;return Lc.baseTable[n]+((e&8388607)>>Lc.shiftTable[n])}function G0(t){const e=t>>10;return Lc.uint32View[0]=Lc.mantissaTable[Lc.offsetTable[e]+(t&1023)]+Lc.exponentTable[e],Lc.floatView[0]}const Epe={toHalfFloat:$s,fromHalfFloat:G0},Hr=new q,qb=new He;class Qt{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=Qs,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,p=c.length;f0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.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 p=0,y=f.length;p0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s(e.far-e.near)**2))&&(nD.copy(s).invert(),Nf.copy(e.ray).applyMatrix4(nD),!(r.boundingBox!==null&&Nf.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Nf)))}_computeIntersections(e,n,r){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,p=s.groups,y=s.drawRange;if(o!==null)if(Array.isArray(a))for(let b=0,S=p.length;bn.far?null:{distance:c,point:e_.clone(),object:t}}function t_(t,e,n,r,i,s,a,o,l,c){t.getVertexPosition(o,Yb),t.getVertexPosition(l,Zb),t.getVertexPosition(c,Qb);const d=kpe(t,e,n,r,Yb,Zb,Qb,iD);if(d){const f=new q;Ks.getBarycoord(iD,Yb,Zb,Qb,f),i&&(d.uv=Ks.getInterpolatedAttribute(i,o,l,c,f,new He)),s&&(d.uv1=Ks.getInterpolatedAttribute(s,o,l,c,f,new He)),a&&(d.normal=Ks.getInterpolatedAttribute(a,o,l,c,f,new q),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const p={a:o,b:l,c,normal:new q,materialIndex:0};Ks.getNormal(Yb,Zb,Qb,p.normal),d.face=p,d.barycoord=f}return d}class tp extends Yt{constructor(e=1,n=1,r=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],f=[];let p=0,y=0;b("z","y","x",-1,-1,r,n,e,a,s,0),b("z","y","x",1,-1,r,n,-e,a,s,1),b("x","z","y",1,1,e,r,n,i,a,2),b("x","z","y",1,-1,e,r,-n,i,a,3),b("x","y","z",1,-1,e,n,r,i,s,4),b("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new Lt(c,3)),this.setAttribute("normal",new Lt(d,3)),this.setAttribute("uv",new Lt(f,2));function b(S,w,x,M,T,P,O,N,D,z,V){const k=P/D,j=O/z,X=P/2,ee=O/2,ie=N/2,pe=D+1,ae=z+1;let he=0,B=0;const J=new q;for(let Y=0;Y0?1:-1,d.push(J.x,J.y,J.z),f.push(G/D),f.push(1-Y/z),he+=1}}for(let Y=0;Y>8&255]+Ji[t>>16&255]+Ji[t>>24&255]+"-"+Ji[e&255]+Ji[e>>8&255]+"-"+Ji[e>>16&15|64]+Ji[e>>24&255]+"-"+Ji[n&63|128]+Ji[n>>8&255]+"-"+Ji[n>>16&255]+Ji[n>>24&255]+Ji[r&255]+Ji[r>>8&255]+Ji[r>>16&255]+Ji[r>>24&255]).toLowerCase()}function Tr(t,e,n){return Math.max(e,Math.min(n,t))}function SR(t,e){return(t%e+e)%e}function $he(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function Xhe(t,e,n){return t!==e?(n-t)/(e-t):0}function ny(t,e,n){return(1-n)*t+n*e}function qhe(t,e,n,r){return ny(t,e,1-Math.exp(-n*r))}function Khe(t,e=1){return e-Math.abs(SR(t,e*2)-e)}function Yhe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Zhe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Qhe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Jhe(t,e){return t+Math.random()*(e-t)}function epe(t){return t*(.5-Math.random())}function tpe(t){t!==void 0&&(V3=t);let e=V3+=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 npe(t){return t*Ph}function rpe(t){return t*Dg}function ipe(t){return(t&t-1)===0&&t!==0}function spe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function ape(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function ope(t,e,n,r,i){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((e+r)/2),d=a((e+r)/2),f=s((e-r)/2),p=a((e-r)/2),y=s((r-e)/2),b=a((r-e)/2);switch(i){case"XYX":t.set(o*d,l*f,l*p,o*c);break;case"YZY":t.set(l*p,o*d,l*f,o*c);break;case"ZXZ":t.set(l*f,l*p,o*d,o*c);break;case"XZX":t.set(o*d,l*b,l*y,o*c);break;case"YXY":t.set(l*y,o*d,l*b,o*c);break;case"ZYZ":t.set(l*b,l*y,o*d,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ss(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 cn(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:Ph,RAD2DEG:Dg,generateUUID:wa,clamp:Tr,euclideanModulo:SR,mapLinear:$he,inverseLerp:Xhe,lerp:ny,damp:qhe,pingpong:Khe,smoothstep:Yhe,smootherstep:Zhe,randInt:Qhe,randFloat:Jhe,randFloatSpread:epe,seededRandom:tpe,degToRad:npe,radToDeg:rpe,isPowerOfTwo:ipe,ceilPowerOfTwo:spe,floorPowerOfTwo:ape,setQuaternionFromProperEuler:ope,normalize:cn,denormalize:Ss};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(Tr(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,a=this.y-e.y;return this.x=s*r-a*i+e.x,this.y=s*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class $t{constructor(e,n,r,i,s,a,o,l,c){$t.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,o,l,c)}set(e,n,r,i,s,a,o,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=o,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=a,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,a=r[0],o=r[3],l=r[6],c=r[1],d=r[4],f=r[7],p=r[2],y=r[5],b=r[8],S=i[0],w=i[3],x=i[6],M=i[1],T=i[4],P=i[7],O=i[2],N=i[5],D=i[8];return s[0]=a*S+o*M+l*O,s[3]=a*w+o*T+l*N,s[6]=a*x+o*P+l*D,s[1]=c*S+d*M+f*O,s[4]=c*w+d*T+f*N,s[7]=c*x+d*P+f*D,s[2]=p*S+y*M+b*O,s[5]=p*w+y*T+b*N,s[8]=p*x+y*P+b*D,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],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8];return n*a*d-n*o*c-r*s*d+r*o*l+i*s*c-i*a*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=d*a-o*c,p=o*l-d*s,y=c*s-a*l,b=n*f+r*p+i*y;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/b;return e[0]=f*S,e[1]=(i*c-d*r)*S,e[2]=(o*r-i*a)*S,e[3]=p*S,e[4]=(d*n-i*l)*S,e[5]=(i*s-o*n)*S,e[6]=y*S,e[7]=(r*l-c*n)*S,e[8]=(a*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,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+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 $t;function u6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const lpe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $m(t,e){return new lpe[t](e)}function Oy(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function d6(){const t=Oy("canvas");return t.style.display="block",t}const G3={};function q_(t){t in G3||(G3[t]=!0,console.warn(t))}function cpe(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 upe(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 dpe(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 W3=new $t().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),$3=new $t().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),v0={[xi]:{transfer:Cy,primaries:Ry,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Fi]:{transfer:er,primaries:Ry,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[dx]:{transfer:Cy,primaries:Ny,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3($3),fromReference:t=>t.applyMatrix3(W3)},[ZS]:{transfer:er,primaries:Ny,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3($3),fromReference:t=>t.applyMatrix3(W3).convertLinearToSRGB()}},fpe=new Set([xi,dx]),Nn={enabled:!0,_workingColorSpace:xi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!fpe.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===Oc?Cy:v0[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(v0[e].luminanceCoefficients)}};function rg(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 hm;class f6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{hm===void 0&&(hm=Oy("canvas")),hm.width=e.width,hm.height=e.height;const r=hm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=hm}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 a=0;a0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==HS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Rd:e.x=e.x-Math.floor(e.x);break;case ba:e.x=e.x<0?0:1;break;case Ig: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 Rd:e.y=e.y-Math.floor(e.y);break;case ba:e.y=e.y<0?0:1;break;case Ig: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++}}fr.DEFAULT_IMAGE=null;fr.DEFAULT_MAPPING=HS;fr.DEFAULT_ANISOTROPY=1;class On{constructor(e=0,n=0,r=0,i=1){On.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,a=e.elements;return this.x=a[0]*n+a[4]*r+a[8]*i+a[12]*s,this.y=a[1]*n+a[5]*r+a[9]*i+a[13]*s,this.z=a[2]*n+a[6]*r+a[10]*i+a[14]*s,this.w=a[3]*n+a[7]*r+a[11]*i+a[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],p=l[1],y=l[5],b=l[9],S=l[2],w=l[6],x=l[10];if(Math.abs(d-p)<.01&&Math.abs(f-S)<.01&&Math.abs(b-w)<.01){if(Math.abs(d+p)<.1&&Math.abs(f+S)<.1&&Math.abs(b+w)<.1&&Math.abs(c+y+x-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const T=(c+1)/2,P=(y+1)/2,O=(x+1)/2,N=(d+p)/4,D=(f+S)/4,z=(b+w)/4;return T>P&&T>O?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=N/r,s=D/r):P>O?P<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(P),r=N/i,s=z/i):O<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(O),r=D/s,i=z/s),this.set(r,i,s,n),this}let M=Math.sqrt((w-b)*(w-b)+(f-S)*(f-S)+(p-d)*(p-d));return Math.abs(M)<.001&&(M=1),this.x=(w-b)/M,this.y=(f-S)/M,this.z=(p-d)/M,this.w=Math.acos((c+y+x-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 h6 extends zl{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new On(0,0,e,n),this.scissorTest=!1,this.viewport=new On(0,0,e,n);const i={width:e,height:n,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Cr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new fr(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 a=r.count;for(let o=0;o=0?1:-1,T=1-x*x;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,x*M);w=Math.sin(w*N)/O,o=Math.sin(o*N)/O}const P=o*M;if(l=l*w+p*P,c=c*w+y*P,d=d*w+b*P,f=f*w+S*P,w===1-o){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,a){const o=r[i],l=r[i+1],c=r[i+2],d=r[i+3],f=s[a],p=s[a+1],y=s[a+2],b=s[a+3];return e[n]=o*b+d*f+l*y-c*p,e[n+1]=l*b+d*p+c*f-o*y,e[n+2]=c*b+d*y+o*p-l*f,e[n+3]=d*b-o*f-l*p-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,a=e._order,o=Math.cos,l=Math.sin,c=o(r/2),d=o(i/2),f=o(s/2),p=l(r/2),y=l(i/2),b=l(s/2);switch(a){case"XYZ":this._x=p*d*f+c*y*b,this._y=c*y*f-p*d*b,this._z=c*d*b+p*y*f,this._w=c*d*f-p*y*b;break;case"YXZ":this._x=p*d*f+c*y*b,this._y=c*y*f-p*d*b,this._z=c*d*b-p*y*f,this._w=c*d*f+p*y*b;break;case"ZXY":this._x=p*d*f-c*y*b,this._y=c*y*f+p*d*b,this._z=c*d*b+p*y*f,this._w=c*d*f-p*y*b;break;case"ZYX":this._x=p*d*f-c*y*b,this._y=c*y*f+p*d*b,this._z=c*d*b-p*y*f,this._w=c*d*f+p*y*b;break;case"YZX":this._x=p*d*f+c*y*b,this._y=c*y*f+p*d*b,this._z=c*d*b-p*y*f,this._w=c*d*f-p*y*b;break;case"XZY":this._x=p*d*f-c*y*b,this._y=c*y*f-p*d*b,this._z=c*d*b+p*y*f,this._w=c*d*f+p*y*b;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}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],a=n[1],o=n[5],l=n[9],c=n[2],d=n[6],f=n[10],p=r+o+f;if(p>0){const y=.5/Math.sqrt(p+1);this._w=.25/y,this._x=(d-l)*y,this._y=(s-c)*y,this._z=(a-i)*y}else if(r>o&&r>f){const y=2*Math.sqrt(1+r-o-f);this._w=(d-l)/y,this._x=.25*y,this._y=(i+a)/y,this._z=(s+c)/y}else if(o>f){const y=2*Math.sqrt(1+o-r-f);this._w=(s-c)/y,this._x=(i+a)/y,this._y=.25*y,this._z=(l+d)/y}else{const y=2*Math.sqrt(1+f-r-o);this._w=(a-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(Tr(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,a=e._w,o=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+a*o+i*c-s*l,this._y=i*d+a*l+s*o-r*c,this._z=s*d+a*c+r*l-i*o,this._w=a*d-r*o-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,a=this._w;let o=a*e._w+r*e._x+i*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=r,this._y=i,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const y=1-n;return this._w=y*a+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,o),f=Math.sin((1-n)*d)/c,p=Math.sin(n*d)/c;return this._w=a*f+this._w*p,this._x=r*f+this._x*p,this._y=i*f+this._y*p,this._z=s*f+this._z*p,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 q{constructor(e=0,n=0,r=0){q.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(X3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(X3.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,a=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])*a,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*a,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*a,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*r),d=2*(o*n-s*i),f=2*(s*r-a*n);return this.x=n+l*c+a*f-o*d,this.y=r+l*d+o*c-s*f,this.z=i+l*f+s*d-a*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,a=n.x,o=n.y,l=n.z;return this.x=i*l-s*o,this.y=s*a-r*l,this.z=r*o-i*a,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(Tr(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 q,X3=new qt;class os{constructor(e=new q(1/0,1/0,1/0),n=new q(-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,Po),Po.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),pm.subVectors(e.a,y0),mm.subVectors(e.b,y0),gm.subVectors(e.c,y0),Wu.subVectors(mm,pm),$u.subVectors(gm,mm),Cf.subVectors(pm,gm);let n=[0,-Wu.z,Wu.y,0,-$u.z,$u.y,0,-Cf.z,Cf.y,Wu.z,0,-Wu.x,$u.z,0,-$u.x,Cf.z,0,-Cf.x,-Wu.y,Wu.x,0,-$u.y,$u.x,0,-Cf.y,Cf.x,0];return!JE(n,pm,mm,gm,Bb)||(n=[1,0,0,0,1,0,0,0,1],!JE(n,pm,mm,gm,Bb))?!1:(Hb.crossVectors(Wu,$u),n=[Hb.x,Hb.y,Hb.z],JE(n,pm,mm,gm,Bb))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Po).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Po).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:(_c[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_c[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_c[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_c[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_c[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_c[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_c[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_c[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_c),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 _c=[new q,new q,new q,new q,new q,new q,new q,new q],Po=new q,zb=new os,pm=new q,mm=new q,gm=new q,Wu=new q,$u=new q,Cf=new q,y0=new q,Bb=new q,Hb=new q,Rf=new q;function JE(t,e,n,r,i){for(let s=0,a=t.length-3;s<=a;s+=3){Rf.fromArray(t,s);const o=i.x*Math.abs(Rf.x)+i.y*Math.abs(Rf.y)+i.z*Math.abs(Rf.z),l=e.dot(Rf),c=n.dot(Rf),d=r.dot(Rf);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>o)return!1}return!0}const vpe=new os,x0=new q,eA=new q;class Hi{constructor(e=new q,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):vpe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,a=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 wc=new q,tA=new q,Vb=new q,Xu=new q,nA=new q,Gb=new q,rA=new q;class ep{constructor(e=new q,n=new q(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,wc)),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=wc.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(wc.copy(this.origin).addScaledVector(this.direction,n),wc.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){tA.copy(e).add(n).multiplyScalar(.5),Vb.copy(n).sub(e).normalize(),Xu.copy(this.origin).sub(tA);const s=e.distanceTo(n)*.5,a=-this.direction.dot(Vb),o=Xu.dot(this.direction),l=-Xu.dot(Vb),c=Xu.lengthSq(),d=Math.abs(1-a*a);let f,p,y,b;if(d>0)if(f=a*l-o,p=a*o-l,b=s*d,f>=0)if(p>=-b)if(p<=b){const S=1/d;f*=S,p*=S,y=f*(f+a*p+2*o)+p*(a*f+p+2*l)+c}else p=s,f=Math.max(0,-(a*p+o)),y=-f*f+p*(p+2*l)+c;else p=-s,f=Math.max(0,-(a*p+o)),y=-f*f+p*(p+2*l)+c;else p<=-b?(f=Math.max(0,-(-a*s+o)),p=f>0?-s:Math.min(Math.max(-s,-l),s),y=-f*f+p*(p+2*l)+c):p<=b?(f=0,p=Math.min(Math.max(-s,-l),s),y=p*(p+2*l)+c):(f=Math.max(0,-(a*s+o)),p=f>0?s:Math.min(Math.max(-s,-l),s),y=-f*f+p*(p+2*l)+c);else p=a>0?-s:s,f=Math.max(0,-(a*p+o)),y=-f*f+p*(p+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(tA).addScaledVector(Vb,p),y}intersectSphere(e,n){wc.subVectors(e.center,this.origin);const r=wc.dot(this.direction),i=wc.dot(wc)-r*r,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=r-a,l=r+a;return l<0?null:o<0?this.at(l,n):this.at(o,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,a,o,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,p=this.origin;return c>=0?(r=(e.min.x-p.x)*c,i=(e.max.x-p.x)*c):(r=(e.max.x-p.x)*c,i=(e.min.x-p.x)*c),d>=0?(s=(e.min.y-p.y)*d,a=(e.max.y-p.y)*d):(s=(e.max.y-p.y)*d,a=(e.min.y-p.y)*d),r>a||s>i||((s>r||isNaN(r))&&(r=s),(a=0?(o=(e.min.z-p.z)*f,l=(e.max.z-p.z)*f):(o=(e.max.z-p.z)*f,l=(e.min.z-p.z)*f),r>l||o>i)||((o>r||r!==r)&&(r=o),(l=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,wc)!==null}intersectTriangle(e,n,r,i,s){nA.subVectors(n,e),Gb.subVectors(r,e),rA.crossVectors(nA,Gb);let a=this.direction.dot(rA),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Xu.subVectors(this.origin,e);const l=o*this.direction.dot(Gb.crossVectors(Xu,Gb));if(l<0)return null;const c=o*this.direction.dot(nA.cross(Xu));if(c<0||l+c>a)return null;const d=-o*Xu.dot(rA);return d<0?null:this.at(d/a,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 Ct{constructor(e,n,r,i,s,a,o,l,c,d,f,p,y,b,S,w){Ct.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,a,o,l,c,d,f,p,y,b,S,w)}set(e,n,r,i,s,a,o,l,c,d,f,p,y,b,S,w){const x=this.elements;return x[0]=e,x[4]=n,x[8]=r,x[12]=i,x[1]=s,x[5]=a,x[9]=o,x[13]=l,x[2]=c,x[6]=d,x[10]=f,x[14]=p,x[3]=y,x[7]=b,x[11]=S,x[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 Ct().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/vm.setFromMatrixColumn(e,0).length(),s=1/vm.setFromMatrixColumn(e,1).length(),a=1/vm.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]*a,n[9]=r[9]*a,n[10]=r[10]*a,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,a=Math.cos(r),o=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const p=a*d,y=a*f,b=o*d,S=o*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=y+b*c,n[5]=p-S*c,n[9]=-o*l,n[2]=S-p*c,n[6]=b+y*c,n[10]=a*l}else if(e.order==="YXZ"){const p=l*d,y=l*f,b=c*d,S=c*f;n[0]=p+S*o,n[4]=b*o-y,n[8]=a*c,n[1]=a*f,n[5]=a*d,n[9]=-o,n[2]=y*o-b,n[6]=S+p*o,n[10]=a*l}else if(e.order==="ZXY"){const p=l*d,y=l*f,b=c*d,S=c*f;n[0]=p-S*o,n[4]=-a*f,n[8]=b+y*o,n[1]=y+b*o,n[5]=a*d,n[9]=S-p*o,n[2]=-a*c,n[6]=o,n[10]=a*l}else if(e.order==="ZYX"){const p=a*d,y=a*f,b=o*d,S=o*f;n[0]=l*d,n[4]=b*c-y,n[8]=p*c+S,n[1]=l*f,n[5]=S*c+p,n[9]=y*c-b,n[2]=-c,n[6]=o*l,n[10]=a*l}else if(e.order==="YZX"){const p=a*l,y=a*c,b=o*l,S=o*c;n[0]=l*d,n[4]=S-p*f,n[8]=b*f+y,n[1]=f,n[5]=a*d,n[9]=-o*d,n[2]=-c*d,n[6]=y*f+b,n[10]=p-S*f}else if(e.order==="XZY"){const p=a*l,y=a*c,b=o*l,S=o*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=p*f+S,n[5]=a*d,n[9]=y*f-b,n[2]=b*f-y,n[6]=o*d,n[10]=S*f+p}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(ype,e,xpe)}lookAt(e,n,r){const i=this.elements;return fa.subVectors(e,n),fa.lengthSq()===0&&(fa.z=1),fa.normalize(),qu.crossVectors(r,fa),qu.lengthSq()===0&&(Math.abs(r.z)===1?fa.x+=1e-4:fa.z+=1e-4,fa.normalize(),qu.crossVectors(r,fa)),qu.normalize(),Wb.crossVectors(fa,qu),i[0]=qu.x,i[4]=Wb.x,i[8]=fa.x,i[1]=qu.y,i[5]=Wb.y,i[9]=fa.y,i[2]=qu.z,i[6]=Wb.z,i[10]=fa.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,a=r[0],o=r[4],l=r[8],c=r[12],d=r[1],f=r[5],p=r[9],y=r[13],b=r[2],S=r[6],w=r[10],x=r[14],M=r[3],T=r[7],P=r[11],O=r[15],N=i[0],D=i[4],z=i[8],V=i[12],k=i[1],j=i[5],X=i[9],ee=i[13],ie=i[2],pe=i[6],ae=i[10],he=i[14],B=i[3],J=i[7],Y=i[11],H=i[15];return s[0]=a*N+o*k+l*ie+c*B,s[4]=a*D+o*j+l*pe+c*J,s[8]=a*z+o*X+l*ae+c*Y,s[12]=a*V+o*ee+l*he+c*H,s[1]=d*N+f*k+p*ie+y*B,s[5]=d*D+f*j+p*pe+y*J,s[9]=d*z+f*X+p*ae+y*Y,s[13]=d*V+f*ee+p*he+y*H,s[2]=b*N+S*k+w*ie+x*B,s[6]=b*D+S*j+w*pe+x*J,s[10]=b*z+S*X+w*ae+x*Y,s[14]=b*V+S*ee+w*he+x*H,s[3]=M*N+T*k+P*ie+O*B,s[7]=M*D+T*j+P*pe+O*J,s[11]=M*z+T*X+P*ae+O*Y,s[15]=M*V+T*ee+P*he+O*H,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],a=e[1],o=e[5],l=e[9],c=e[13],d=e[2],f=e[6],p=e[10],y=e[14],b=e[3],S=e[7],w=e[11],x=e[15];return b*(+s*l*f-i*c*f-s*o*p+r*c*p+i*o*y-r*l*y)+S*(+n*l*y-n*c*p+s*a*p-i*a*y+i*c*d-s*l*d)+w*(+n*c*f-n*o*y-s*a*f+r*a*y+s*o*d-r*c*d)+x*(-i*o*d-n*l*f+n*o*p+i*a*f-r*a*p+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],a=e[4],o=e[5],l=e[6],c=e[7],d=e[8],f=e[9],p=e[10],y=e[11],b=e[12],S=e[13],w=e[14],x=e[15],M=f*w*c-S*p*c+S*l*y-o*w*y-f*l*x+o*p*x,T=b*p*c-d*w*c-b*l*y+a*w*y+d*l*x-a*p*x,P=d*S*c-b*f*c+b*o*y-a*S*y-d*o*x+a*f*x,O=b*f*l-d*S*l-b*o*p+a*S*p+d*o*w-a*f*w,N=n*M+r*T+i*P+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 D=1/N;return e[0]=M*D,e[1]=(S*p*s-f*w*s-S*i*y+r*w*y+f*i*x-r*p*x)*D,e[2]=(o*w*s-S*l*s+S*i*c-r*w*c-o*i*x+r*l*x)*D,e[3]=(f*l*s-o*p*s-f*i*c+r*p*c+o*i*y-r*l*y)*D,e[4]=T*D,e[5]=(d*w*s-b*p*s+b*i*y-n*w*y-d*i*x+n*p*x)*D,e[6]=(b*l*s-a*w*s-b*i*c+n*w*c+a*i*x-n*l*x)*D,e[7]=(a*p*s-d*l*s+d*i*c-n*p*c-a*i*y+n*l*y)*D,e[8]=P*D,e[9]=(b*f*s-d*S*s-b*r*y+n*S*y+d*r*x-n*f*x)*D,e[10]=(a*S*s-b*o*s+b*r*c-n*S*c-a*r*x+n*o*x)*D,e[11]=(d*o*s-a*f*s-d*r*c+n*f*c+a*r*y-n*o*y)*D,e[12]=O*D,e[13]=(d*S*i-b*f*i+b*r*p-n*S*p-d*r*w+n*f*w)*D,e[14]=(b*o*i-a*S*i-b*r*l+n*S*l+a*r*w-n*o*w)*D,e[15]=(a*f*i-d*o*i+d*r*l-n*f*l-a*r*p+n*o*p)*D,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,a=e.x,o=e.y,l=e.z,c=s*a,d=s*o;return this.set(c*a+r,c*o-i*l,c*l+i*o,0,c*o+i*l,d*o+r,d*l-i*a,0,c*l-i*o,d*l+i*a,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,a){return this.set(1,r,s,0,e,1,a,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,a=n._y,o=n._z,l=n._w,c=s+s,d=a+a,f=o+o,p=s*c,y=s*d,b=s*f,S=a*d,w=a*f,x=o*f,M=l*c,T=l*d,P=l*f,O=r.x,N=r.y,D=r.z;return i[0]=(1-(S+x))*O,i[1]=(y+P)*O,i[2]=(b-T)*O,i[3]=0,i[4]=(y-P)*N,i[5]=(1-(p+x))*N,i[6]=(w+M)*N,i[7]=0,i[8]=(b+T)*D,i[9]=(w-M)*D,i[10]=(1-(p+S))*D,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=vm.set(i[0],i[1],i[2]).length();const a=vm.set(i[4],i[5],i[6]).length(),o=vm.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],Co.copy(this);const c=1/s,d=1/a,f=1/o;return Co.elements[0]*=c,Co.elements[1]*=c,Co.elements[2]*=c,Co.elements[4]*=d,Co.elements[5]*=d,Co.elements[6]*=d,Co.elements[8]*=f,Co.elements[9]*=f,Co.elements[10]*=f,n.setFromRotationMatrix(Co),r.x=s,r.y=a,r.z=o,this}makePerspective(e,n,r,i,s,a,o=Ml){const l=this.elements,c=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),p=(r+i)/(r-i);let y,b;if(o===Ml)y=-(a+s)/(a-s),b=-2*a*s/(a-s);else if(o===ky)y=-a/(a-s),b=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=y,l[14]=b,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,s,a,o=Ml){const l=this.elements,c=1/(n-e),d=1/(r-i),f=1/(a-s),p=(n+e)*c,y=(r+i)*d;let b,S;if(o===Ml)b=(a+s)*f,S=-2*f;else if(o===ky)b=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-y,l[2]=0,l[6]=0,l[10]=S,l[14]=-b,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 vm=new q,Co=new Ct,ype=new q(0,0,0),xpe=new q(1,1,1),qu=new q,Wb=new q,fa=new q,q3=new Ct,K3=new qt;class ls{constructor(e=0,n=0,r=0,i=ls.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],a=i[4],o=i[8],l=i[1],c=i[5],d=i[9],f=i[2],p=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Tr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Tr(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(o,y),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Tr(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-f,y),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Tr(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(p,y),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Tr(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(o,y));break;case"XZY":this._z=Math.asin(-Tr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(o,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 q3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(q3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return K3.setFromEuler(this),this.setFromQuaternion(K3,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}}ls.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(o=>({boxInitialized:o.boxInitialized,boxMin:o.box.min.toArray(),boxMax:o.box.max.toArray(),sphereInitialized:o.sphereInitialized,sphereRadius:o.sphere.radius,sphereCenter:o.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(o,l){return o[l.uuid]===void 0&&(o[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 o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c0){i.children=[];for(let o=0;o0){i.animations=[];for(let o=0;o0&&(r.geometries=o),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),p.length>0&&(r.skeletons=p),y.length>0&&(r.animations=y),b.length>0&&(r.nodes=b)}return r.object=i,r;function a(o){const l=[];for(const c in o){const d=o[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){Ro.subVectors(i,n),Mc.subVectors(r,n),sA.subVectors(e,n);const a=Ro.dot(Ro),o=Ro.dot(Mc),l=Ro.dot(sA),c=Mc.dot(Mc),d=Mc.dot(sA),f=a*c-o*o;if(f===0)return s.set(0,0,0),null;const p=1/f,y=(c*l-o*d)*p,b=(a*d-o*l)*p;return s.set(1-y-b,b,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Ec)===null?!1:Ec.x>=0&&Ec.y>=0&&Ec.x+Ec.y<=1}static getInterpolation(e,n,r,i,s,a,o,l){return this.getBarycoord(e,n,r,i,Ec)===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,Ec.x),l.addScaledVector(a,Ec.y),l.addScaledVector(o,Ec.z),l)}static getInterpolatedAttribute(e,n,r,i,s,a){return cA.setScalar(0),uA.setScalar(0),dA.setScalar(0),cA.fromBufferAttribute(e,n),uA.fromBufferAttribute(e,r),dA.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(cA,s.x),a.addScaledVector(uA,s.y),a.addScaledVector(dA,s.z),a}static isFrontFacing(e,n,r,i){return Ro.subVectors(r,n),Mc.subVectors(e,n),Ro.cross(Mc).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 Ro.subVectors(this.c,this.b),Mc.subVectors(this.a,this.b),Ro.cross(Mc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ks.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Ks.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return Ks.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return Ks.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ks.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 a,o;bm.subVectors(i,r),_m.subVectors(s,r),aA.subVectors(e,r);const l=bm.dot(aA),c=_m.dot(aA);if(l<=0&&c<=0)return n.copy(r);oA.subVectors(e,i);const d=bm.dot(oA),f=_m.dot(oA);if(d>=0&&f<=d)return n.copy(i);const p=l*f-d*c;if(p<=0&&l>=0&&d<=0)return a=l/(l-d),n.copy(r).addScaledVector(bm,a);lA.subVectors(e,s);const y=bm.dot(lA),b=_m.dot(lA);if(b>=0&&y<=b)return n.copy(s);const S=y*c-l*b;if(S<=0&&c>=0&&b<=0)return o=c/(c-b),n.copy(r).addScaledVector(_m,o);const w=d*b-y*f;if(w<=0&&f-d>=0&&y-b>=0)return tD.subVectors(s,i),o=(f-d)/(f-d+(y-b)),n.copy(i).addScaledVector(tD,o);const x=1/(w+S+p);return a=S*x,o=p*x,n.copy(r).addScaledVector(bm,a).addScaledVector(_m,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const p6={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},Ku={h:0,s:0,l:0},Xb={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 ct{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,Nn.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=Nn.workingColorSpace){return this.r=e,this.g=n,this.b=r,Nn.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=Nn.workingColorSpace){if(e=SR(e,1),n=Tr(n,0,1),r=Tr(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,a=2*r-s;this.r=fA(a,s,e+1/3),this.g=fA(a,s,e),this.b=fA(a,s,e-1/3)}return Nn.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 a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))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(o))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(o))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],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(a===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=p6[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=rg(e.r),this.g=rg(e.g),this.b=rg(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 Nn.fromWorkingColorSpace(es.copy(this),e),Math.round(Tr(es.r*255,0,255))*65536+Math.round(Tr(es.g*255,0,255))*256+Math.round(Tr(es.b*255,0,255))}getHexString(e=Fi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=Nn.workingColorSpace){Nn.fromWorkingColorSpace(es.copy(this),n);const r=es.r,i=es.g,s=es.b,a=Math.max(r,i,s),o=Math.min(r,i,s);let l,c;const d=(o+a)/2;if(o===a)l=0,c=0;else{const f=a-o;switch(c=d<=.5?f/(a+o):f/(2-a-o),a){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!==Ah&&(r.blending=this.blending),this.side!==Ll&&(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!==cd&&(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!==zh&&(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!==$P&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Zf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Zf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Zf&&(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 a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(n){const s=i(e.textures),a=i(e.images);s.length>0&&(r.textures=s),a.length>0&&(r.images=a)}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 As extends Gr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ct(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 ls,this.combine=cx,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 Lc=Epe();function Epe(){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),a=new Uint32Array(64),o=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)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function $s(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Tr(t,-65504,65504),Lc.floatView[0]=t;const e=Lc.uint32View[0],n=e>>23&511;return Lc.baseTable[n]+((e&8388607)>>Lc.shiftTable[n])}function G0(t){const e=t>>10;return Lc.uint32View[0]=Lc.mantissaTable[Lc.offsetTable[e]+(t&1023)]+Lc.exponentTable[e],Lc.floatView[0]}const Ape={toHalfFloat:$s,fromHalfFloat:G0},Hr=new q,qb=new He;class Qt{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=Qs,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,p=c.length;f0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.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 p=0,y=f.length;p0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s(e.far-e.near)**2))&&(nD.copy(s).invert(),Nf.copy(e.ray).applyMatrix4(nD),!(r.boundingBox!==null&&Nf.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Nf)))}_computeIntersections(e,n,r){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,p=s.groups,y=s.drawRange;if(o!==null)if(Array.isArray(a))for(let b=0,S=p.length;bn.far?null:{distance:c,point:e_.clone(),object:t}}function t_(t,e,n,r,i,s,a,o,l,c){t.getVertexPosition(o,Yb),t.getVertexPosition(l,Zb),t.getVertexPosition(c,Qb);const d=Ope(t,e,n,r,Yb,Zb,Qb,iD);if(d){const f=new q;Ks.getBarycoord(iD,Yb,Zb,Qb,f),i&&(d.uv=Ks.getInterpolatedAttribute(i,o,l,c,f,new He)),s&&(d.uv1=Ks.getInterpolatedAttribute(s,o,l,c,f,new He)),a&&(d.normal=Ks.getInterpolatedAttribute(a,o,l,c,f,new q),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const p={a:o,b:l,c,normal:new q,materialIndex:0};Ks.getNormal(Yb,Zb,Qb,p.normal),d.face=p,d.barycoord=f}return d}class tp extends Yt{constructor(e=1,n=1,r=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],d=[],f=[];let p=0,y=0;b("z","y","x",-1,-1,r,n,e,a,s,0),b("z","y","x",1,-1,r,n,-e,a,s,1),b("x","z","y",1,1,e,r,n,i,a,2),b("x","z","y",1,-1,e,r,-n,i,a,3),b("x","y","z",1,-1,e,n,r,i,s,4),b("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new Lt(c,3)),this.setAttribute("normal",new Lt(d,3)),this.setAttribute("uv",new Lt(f,2));function b(S,w,x,M,T,P,O,N,D,z,V){const k=P/D,j=O/z,X=P/2,ee=O/2,ie=N/2,pe=D+1,ae=z+1;let he=0,B=0;const J=new q;for(let Y=0;Y0?1:-1,d.push(J.x,J.y,J.z),f.push(G/D),f.push(1-Y/z),he+=1}}for(let Y=0;Y0&&(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 fx extends mn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ct,this.projectionMatrix=new Ct,this.projectionMatrixInverse=new Ct,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 Yu=new q,sD=new He,aD=new He;class Pr extends fx{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=Dg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ph*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Dg*2*Math.atan(Math.tan(Ph*.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){Yu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Yu.x,Yu.y).multiplyScalar(-e/Yu.z),Yu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Yu.x,Yu.y).multiplyScalar(-e/Yu.z)}getViewSize(e,n){return this.getViewBounds(e,sD,aD),n.subVectors(aD,sD)}setViewOffset(e,n,r,i,s,a){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=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Ph*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,n-=a.offsetY*r/c,i*=a.width/l,r*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/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 Sm=-90,Mm=1;class m6 extends mn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Pr(Sm,Mm,e,n);i.layers=this.layers,this.add(i);const s=new Pr(Sm,Mm,e,n);s.layers=this.layers,this.add(s);const a=new Pr(Sm,Mm,e,n);a.layers=this.layers,this.add(a);const o=new Pr(Sm,Mm,e,n);o.layers=this.layers,this.add(o);const l=new Pr(Sm,Mm,e,n);l.layers=this.layers,this.add(l);const c=new Pr(Sm,Mm,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,a,o,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),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.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),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.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,a,o,l,c,d]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),b=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,a),e.setRenderTarget(r,2,i),e.render(n,o),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,p,y),e.xr.enabled=b,r.texture.needsPMREMUpdate=!0}}class hx extends fr{constructor(e,n,r,i,s,a,o,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Zc,super(e,n,r,i,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class g6 extends Vo{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 hx(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:Cr}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 Ya extends Gr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Dpe,this.fragmentShader=Upe,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=Lpe(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 a=this.uniforms[i].value;a&&a.isTexture?n.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?n.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?n.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?n.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?n.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?n.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?n.uniforms[i]={type:"m4",value:a.toArray()}:n.uniforms[i]={value:a}}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 fx extends mn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ct,this.projectionMatrix=new Ct,this.projectionMatrixInverse=new Ct,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 Yu=new q,sD=new He,aD=new He;class Pr extends fx{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=Dg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ph*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Dg*2*Math.atan(Math.tan(Ph*.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){Yu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Yu.x,Yu.y).multiplyScalar(-e/Yu.z),Yu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Yu.x,Yu.y).multiplyScalar(-e/Yu.z)}getViewSize(e,n){return this.getViewBounds(e,sD,aD),n.subVectors(aD,sD)}setViewOffset(e,n,r,i,s,a){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=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Ph*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,n-=a.offsetY*r/c,i*=a.width/l,r*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/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 Sm=-90,Mm=1;class g6 extends mn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Pr(Sm,Mm,e,n);i.layers=this.layers,this.add(i);const s=new Pr(Sm,Mm,e,n);s.layers=this.layers,this.add(s);const a=new Pr(Sm,Mm,e,n);a.layers=this.layers,this.add(a);const o=new Pr(Sm,Mm,e,n);o.layers=this.layers,this.add(o);const l=new Pr(Sm,Mm,e,n);l.layers=this.layers,this.add(l);const c=new Pr(Sm,Mm,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,a,o,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),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.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),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.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,a,o,l,c,d]=this.children,f=e.getRenderTarget(),p=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),b=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,a),e.setRenderTarget(r,2,i),e.render(n,o),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,p,y),e.xr.enabled=b,r.texture.needsPMREMUpdate=!0}}class hx extends fr{constructor(e,n,r,i,s,a,o,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Zc,super(e,n,r,i,s,a,o,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class v6 extends Vo{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 hx(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:Cr}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; @@ -646,9 +651,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 Ya({name:"CubemapFromEquirect",uniforms:Ug(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:as,blending:Vc});s.uniforms.tEquirect.value=n;const a=new xr(i,s),o=n.minFilter;return n.minFilter===$a&&(n.minFilter=Cr),new m6(1,10,this).update(e,a),n.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,n,r,i){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(n,r,i);e.setRenderTarget(s)}}const mA=new q,Upe=new q,jpe=new $t;class Rc{constructor(e=new q(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(Upe.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||jpe.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 If=new Hi,n_=new q;class px{constructor(e=new Rc,n=new Rc,r=new Rc,i=new Rc,s=new Rc,a=new Rc){this.planes=[e,n,r,i,s,a]}set(e,n,r,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(r),o[3].copy(i),o[4].copy(s),o[5].copy(a),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],a=i[1],o=i[2],l=i[3],c=i[4],d=i[5],f=i[6],p=i[7],y=i[8],b=i[9],S=i[10],w=i[11],x=i[12],M=i[13],T=i[14],P=i[15];if(r[0].setComponents(l-s,p-c,w-y,P-x).normalize(),r[1].setComponents(l+s,p+c,w+y,P+x).normalize(),r[2].setComponents(l+a,p+d,w+b,P+M).normalize(),r[3].setComponents(l-a,p-d,w-b,P-M).normalize(),r[4].setComponents(l-o,p-f,w-S,P-T).normalize(),n===Ml)r[5].setComponents(l+o,p+f,w+S,P+T).normalize();else if(n===ky)r[5].setComponents(o,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(),If.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),If.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(If)}intersectsSprite(e){return If.center.set(0,0,0),If.radius=.7071067811865476,If.applyMatrix4(e.matrixWorld),this.intersectsSphere(If)}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 v6(){let t=null,e=!1,n=null,r=null;function i(s,a){n(s,a),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 Fpe(t){const e=new WeakMap;function n(o,l){const c=o.array,d=o.usage,f=c.byteLength,p=t.createBuffer();t.bindBuffer(l,p),t.bufferData(l,c,d),o.onUploadCallback();let y;if(c instanceof Float32Array)y=t.FLOAT;else if(c instanceof Uint16Array)o.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:p,type:y,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:f}}function r(o,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,o),f.length===0)t.bufferSubData(c,0,d);else{f.sort((y,b)=>y.start-b.start);let p=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||Fpe.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 If=new Hi,n_=new q;class px{constructor(e=new Rc,n=new Rc,r=new Rc,i=new Rc,s=new Rc,a=new Rc){this.planes=[e,n,r,i,s,a]}set(e,n,r,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(r),o[3].copy(i),o[4].copy(s),o[5].copy(a),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],a=i[1],o=i[2],l=i[3],c=i[4],d=i[5],f=i[6],p=i[7],y=i[8],b=i[9],S=i[10],w=i[11],x=i[12],M=i[13],T=i[14],P=i[15];if(r[0].setComponents(l-s,p-c,w-y,P-x).normalize(),r[1].setComponents(l+s,p+c,w+y,P+x).normalize(),r[2].setComponents(l+a,p+d,w+b,P+M).normalize(),r[3].setComponents(l-a,p-d,w-b,P-M).normalize(),r[4].setComponents(l-o,p-f,w-S,P-T).normalize(),n===Ml)r[5].setComponents(l+o,p+f,w+S,P+T).normalize();else if(n===ky)r[5].setComponents(o,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(),If.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),If.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(If)}intersectsSprite(e){return If.center.set(0,0,0),If.radius=.7071067811865476,If.applyMatrix4(e.matrixWorld),this.intersectsSphere(If)}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 y6(){let t=null,e=!1,n=null,r=null;function i(s,a){n(s,a),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 zpe(t){const e=new WeakMap;function n(o,l){const c=o.array,d=o.usage,f=c.byteLength,p=t.createBuffer();t.bindBuffer(l,p),t.bufferData(l,c,d),o.onUploadCallback();let y;if(c instanceof Float32Array)y=t.FLOAT;else if(c instanceof Uint16Array)o.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:p,type:y,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:f}}function r(o,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,o),f.length===0)t.bufferSubData(c,0,d);else{f.sort((y,b)=>y.start-b.start);let p=0;for(let y=1;y 0 +#endif`,nme=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; @@ -898,26 +903,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve if ( clipped ) discard; #endif #endif -#endif`,nme=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,rme=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,ime=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,sme=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,sme=`#if defined( USE_COLOR_ALPHA ) +#endif`,ame=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,ame=`#if defined( USE_COLOR_ALPHA ) +#endif`,ome=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,ome=`#if defined( USE_COLOR_ALPHA ) +#endif`,lme=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; -#endif`,lme=`#if defined( USE_COLOR_ALPHA ) +#endif`,cme=`#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 ); @@ -931,7 +936,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`,cme=`#define PI 3.141592653589793 +#endif`,ume=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -1005,7 +1010,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`,ume=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,dme=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -1098,7 +1103,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`,dme=`vec3 transformedNormal = objectNormal; +#endif`,fme=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -1127,18 +1132,18 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,fme=`#ifdef USE_DISPLACEMENTMAP +#endif`,hme=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,hme=`#ifdef USE_DISPLACEMENTMAP +#endif`,pme=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,pme=`#ifdef USE_EMISSIVEMAP +#endif`,mme=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,mme=`#ifdef USE_EMISSIVEMAP +#endif`,gme=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,gme="gl_FragColor = linearToOutputTexel( gl_FragColor );",vme=` +#endif`,vme="gl_FragColor = linearToOutputTexel( gl_FragColor );",yme=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), @@ -1160,7 +1165,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 ); -}`,yme=`#ifdef USE_ENVMAP +}`,xme=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -1189,7 +1194,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,xme=`#ifdef USE_ENVMAP +#endif`,bme=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; @@ -1199,7 +1204,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,bme=`#ifdef USE_ENVMAP +#endif`,_me=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -1210,7 +1215,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,_me=`#ifdef USE_ENVMAP +#endif`,wme=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -1221,7 +1226,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,wme=`#ifdef USE_ENVMAP +#endif`,Sme=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -1238,18 +1243,18 @@ vec4 sRGBTransferOETF( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,Sme=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; #endif`,Mme=`#ifdef USE_FOG - varying float vFogDepth; + vFogDepth = - mvPosition.z; #endif`,Eme=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,Ame=`#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`,Ame=`#ifdef USE_FOG +#endif`,Tme=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -1258,7 +1263,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,Tme=`#ifdef USE_GRADIENTMAP +#endif`,Pme=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -1270,12 +1275,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 -}`,Pme=`#ifdef USE_LIGHTMAP +}`,Cme=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,Cme=`LambertMaterial material; +#endif`,Rme=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,Rme=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Nme=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -1289,7 +1294,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`,Nme=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Ime=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -1405,7 +1410,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,Ime=`#ifdef USE_ENVMAP +#endif`,kme=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -1438,8 +1443,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,kme=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,Ome=`varying vec3 vViewPosition; +#endif`,Ome=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,Lme=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -1451,11 +1456,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`,Lme=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Dme=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,Dme=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Ume=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -1472,7 +1477,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`,Ume=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,jme=`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 ); @@ -1558,7 +1563,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`,jme=`struct PhysicalMaterial { +#endif`,Fme=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1859,7 +1864,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 ); -}`,Fme=` +}`,zme=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1974,7 +1979,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,zme=`#if defined( RE_IndirectDiffuse ) +#endif`,Bme=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1993,33 +1998,33 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,Bme=`#if defined( RE_IndirectDiffuse ) +#endif`,Hme=`#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`,Hme=`#if defined( USE_LOGDEPTHBUF ) - gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,Vme=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,Gme=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,Gme=`#ifdef USE_LOGDEPTHBUF +#endif`,Wme=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; -#endif`,Wme=`#ifdef USE_LOGDEPTHBUF +#endif`,$me=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,$me=`#ifdef USE_MAP +#endif`,Xme=`#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`,Xme=`#ifdef USE_MAP +#endif`,qme=`#ifdef USE_MAP uniform sampler2D map; -#endif`,qme=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,Kme=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -2031,7 +2036,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,Kme=`#if defined( USE_POINTS_UV ) +#endif`,Yme=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -2043,19 +2048,19 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,Yme=`float metalnessFactor = metalness; +#endif`,Zme=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,Zme=`#ifdef USE_METALNESSMAP +#endif`,Qme=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,Qme=`#ifdef USE_INSTANCING_MORPH +#endif`,Jme=`#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`,Jme=`#if defined( USE_MORPHCOLORS ) +#endif`,ege=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -2064,12 +2069,12 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,ege=`#ifdef USE_MORPHNORMALS +#endif`,tge=`#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`,tge=`#ifdef USE_MORPHTARGETS +#endif`,nge=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -2083,12 +2088,12 @@ IncidentLight directLight; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } -#endif`,nge=`#ifdef USE_MORPHTARGETS +#endif`,rge=`#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`,rge=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,ige=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -2129,7 +2134,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,ige=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,sge=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -2144,12 +2149,6 @@ vec3 nonPerturbedNormal = normal;`,ige=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,sge=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif #endif`,age=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT @@ -2157,12 +2156,18 @@ vec3 nonPerturbedNormal = normal;`,ige=`#ifdef USE_NORMALMAP_OBJECTSPACE varying vec3 vBitangent; #endif #endif`,oge=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,lge=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,lge=`#ifdef USE_NORMALMAP +#endif`,cge=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -2184,13 +2189,13 @@ vec3 nonPerturbedNormal = normal;`,ige=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,cge=`#ifdef USE_CLEARCOAT +#endif`,uge=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,uge=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,dge=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,dge=`#ifdef USE_CLEARCOATMAP +#endif`,fge=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -2199,18 +2204,18 @@ vec3 nonPerturbedNormal = normal;`,ige=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,fge=`#ifdef USE_IRIDESCENCEMAP +#endif`,hge=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,hge=`#ifdef OPAQUE +#endif`,pge=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,pge=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,mge=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -2279,9 +2284,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 ); -}`,mge=`#ifdef PREMULTIPLIED_ALPHA +}`,gge=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,gge=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,vge=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -2289,22 +2294,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,vge=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,yge=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,yge=`#ifdef DITHERING +#endif`,xge=`#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`,xge=`float roughnessFactor = roughness; +#endif`,bge=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,bge=`#ifdef USE_ROUGHNESSMAP +#endif`,_ge=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,_ge=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,wge=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -2490,7 +2495,7 @@ gl_Position = projectionMatrix * mvPosition;`,vge=`#ifdef DITHERING } return mix( 1.0, shadow, shadowIntensity ); } -#endif`,wge=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Sge=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -2531,7 +2536,7 @@ gl_Position = projectionMatrix * mvPosition;`,vge=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,Sge=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,Mge=`#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 @@ -2563,7 +2568,7 @@ gl_Position = projectionMatrix * mvPosition;`,vge=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,Mge=`float getShadowMask() { +#endif`,Ege=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -2595,12 +2600,12 @@ gl_Position = projectionMatrix * mvPosition;`,vge=`#ifdef DITHERING #endif #endif return shadow; -}`,Ege=`#ifdef USE_SKINNING +}`,Age=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,Age=`#ifdef USE_SKINNING +#endif`,Tge=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2615,7 +2620,7 @@ gl_Position = projectionMatrix * mvPosition;`,vge=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,Tge=`#ifdef USE_SKINNING +#endif`,Pge=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2623,7 +2628,7 @@ gl_Position = projectionMatrix * mvPosition;`,vge=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,Pge=`#ifdef USE_SKINNING +#endif`,Cge=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2634,17 +2639,17 @@ gl_Position = projectionMatrix * mvPosition;`,vge=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,Cge=`float specularStrength; +#endif`,Rge=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,Rge=`#ifdef USE_SPECULARMAP +#endif`,Nge=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,Nge=`#if defined( TONE_MAPPING ) +#endif`,Ige=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,Ige=`#ifndef saturate +#endif`,kge=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2741,7 +2746,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; }`,kge=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,Oge=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2762,7 +2767,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kge=`#ifdef USE_TRANSMIS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,Oge=`#ifdef USE_TRANSMISSION +#endif`,Lge=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2893,7 +2898,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kge=`#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`,Lge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Dge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2963,7 +2968,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kge=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,Dge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Uge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -3057,7 +3062,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kge=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,Uge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,jge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -3128,7 +3133,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kge=`#ifdef USE_TRANSMIS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,jge=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Fge=`#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; @@ -3137,12 +3142,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kge=`#ifdef USE_TRANSMIS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const Fge=`varying vec2 vUv; +#endif`;const zge=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,zge=`uniform sampler2D t2D; +}`,Bge=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -3154,14 +3159,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,Bge=`varying vec3 vWorldDirection; +}`,Hge=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Hge=`#ifdef ENVMAP_TYPE_CUBE +}`,Vge=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -3184,14 +3189,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,Vge=`varying vec3 vWorldDirection; +}`,Gge=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Gge=`uniform samplerCube tCube; +}`,Wge=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -3201,7 +3206,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,Wge=`#include +}`,$ge=`#include #include #include #include @@ -3228,7 +3233,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,$ge=`#if DEPTH_PACKING == 3200 +}`,Xge=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -3262,7 +3267,7 @@ void main() { #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif -}`,Xge=`#define DISTANCE +}`,qge=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -3289,7 +3294,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,qge=`#define DISTANCE +}`,Kge=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -3313,13 +3318,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,Kge=`varying vec3 vWorldDirection; +}`,Yge=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,Yge=`uniform sampler2D tEquirect; +}`,Zge=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -3328,7 +3333,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,Zge=`uniform float scale; +}`,Qge=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -3350,7 +3355,7 @@ void main() { #include #include #include -}`,Qge=`uniform vec3 diffuse; +}`,Jge=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -3378,7 +3383,7 @@ void main() { #include #include #include -}`,Jge=`#include +}`,eve=`#include #include #include #include @@ -3410,7 +3415,7 @@ void main() { #include #include #include -}`,eve=`uniform vec3 diffuse; +}`,tve=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -3458,7 +3463,7 @@ void main() { #include #include #include -}`,tve=`#define LAMBERT +}`,nve=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -3497,7 +3502,7 @@ void main() { #include #include #include -}`,nve=`#define LAMBERT +}`,rve=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3554,7 +3559,7 @@ void main() { #include #include #include -}`,rve=`#define MATCAP +}`,ive=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3588,7 +3593,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,ive=`#define MATCAP +}`,sve=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3634,7 +3639,7 @@ void main() { #include #include #include -}`,sve=`#define NORMAL +}`,ave=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3667,7 +3672,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,ave=`#define NORMAL +}`,ove=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3689,7 +3694,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,ove=`#define PHONG +}`,lve=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3728,7 +3733,7 @@ void main() { #include #include #include -}`,lve=`#define PHONG +}`,cve=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3787,7 +3792,7 @@ void main() { #include #include #include -}`,cve=`#define STANDARD +}`,uve=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3830,7 +3835,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,uve=`#define STANDARD +}`,dve=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3955,7 +3960,7 @@ void main() { #include #include #include -}`,dve=`#define TOON +}`,fve=`#define TOON varying vec3 vViewPosition; #include #include @@ -3992,7 +3997,7 @@ void main() { #include #include #include -}`,fve=`#define TOON +}`,hve=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -4045,7 +4050,7 @@ void main() { #include #include #include -}`,hve=`uniform float size; +}`,pve=`uniform float size; uniform float scale; #include #include @@ -4076,7 +4081,7 @@ void main() { #include #include #include -}`,pve=`uniform vec3 diffuse; +}`,mve=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -4101,7 +4106,7 @@ void main() { #include #include #include -}`,mve=`#include +}`,gve=`#include #include #include #include @@ -4124,7 +4129,7 @@ void main() { #include #include #include -}`,gve=`uniform vec3 color; +}`,vve=`uniform vec3 color; uniform float opacity; #include #include @@ -4140,7 +4145,7 @@ void main() { #include #include #include -}`,vve=`uniform float rotation; +}`,yve=`uniform float rotation; uniform vec2 center; #include #include @@ -4164,7 +4169,7 @@ void main() { #include #include #include -}`,yve=`uniform vec3 diffuse; +}`,xve=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -4189,7 +4194,7 @@ void main() { #include #include #include -}`,fn={alphahash_fragment:zpe,alphahash_pars_fragment:Bpe,alphamap_fragment:Hpe,alphamap_pars_fragment:Vpe,alphatest_fragment:Gpe,alphatest_pars_fragment:Wpe,aomap_fragment:$pe,aomap_pars_fragment:Xpe,batching_pars_vertex:qpe,batching_vertex:Kpe,begin_vertex:Ype,beginnormal_vertex:Zpe,bsdfs:Qpe,iridescence_fragment:Jpe,bumpmap_pars_fragment:eme,clipping_planes_fragment:tme,clipping_planes_pars_fragment:nme,clipping_planes_pars_vertex:rme,clipping_planes_vertex:ime,color_fragment:sme,color_pars_fragment:ame,color_pars_vertex:ome,color_vertex:lme,common:cme,cube_uv_reflection_fragment:ume,defaultnormal_vertex:dme,displacementmap_pars_vertex:fme,displacementmap_vertex:hme,emissivemap_fragment:pme,emissivemap_pars_fragment:mme,colorspace_fragment:gme,colorspace_pars_fragment:vme,envmap_fragment:yme,envmap_common_pars_fragment:xme,envmap_pars_fragment:bme,envmap_pars_vertex:_me,envmap_physical_pars_fragment:Ime,envmap_vertex:wme,fog_vertex:Sme,fog_pars_vertex:Mme,fog_fragment:Eme,fog_pars_fragment:Ame,gradientmap_pars_fragment:Tme,lightmap_pars_fragment:Pme,lights_lambert_fragment:Cme,lights_lambert_pars_fragment:Rme,lights_pars_begin:Nme,lights_toon_fragment:kme,lights_toon_pars_fragment:Ome,lights_phong_fragment:Lme,lights_phong_pars_fragment:Dme,lights_physical_fragment:Ume,lights_physical_pars_fragment:jme,lights_fragment_begin:Fme,lights_fragment_maps:zme,lights_fragment_end:Bme,logdepthbuf_fragment:Hme,logdepthbuf_pars_fragment:Vme,logdepthbuf_pars_vertex:Gme,logdepthbuf_vertex:Wme,map_fragment:$me,map_pars_fragment:Xme,map_particle_fragment:qme,map_particle_pars_fragment:Kme,metalnessmap_fragment:Yme,metalnessmap_pars_fragment:Zme,morphinstance_vertex:Qme,morphcolor_vertex:Jme,morphnormal_vertex:ege,morphtarget_pars_vertex:tge,morphtarget_vertex:nge,normal_fragment_begin:rge,normal_fragment_maps:ige,normal_pars_fragment:sge,normal_pars_vertex:age,normal_vertex:oge,normalmap_pars_fragment:lge,clearcoat_normal_fragment_begin:cge,clearcoat_normal_fragment_maps:uge,clearcoat_pars_fragment:dge,iridescence_pars_fragment:fge,opaque_fragment:hge,packing:pge,premultiplied_alpha_fragment:mge,project_vertex:gge,dithering_fragment:vge,dithering_pars_fragment:yge,roughnessmap_fragment:xge,roughnessmap_pars_fragment:bge,shadowmap_pars_fragment:_ge,shadowmap_pars_vertex:wge,shadowmap_vertex:Sge,shadowmask_pars_fragment:Mge,skinbase_vertex:Ege,skinning_pars_vertex:Age,skinning_vertex:Tge,skinnormal_vertex:Pge,specularmap_fragment:Cge,specularmap_pars_fragment:Rge,tonemapping_fragment:Nge,tonemapping_pars_fragment:Ige,transmission_fragment:kge,transmission_pars_fragment:Oge,uv_pars_fragment:Lge,uv_pars_vertex:Dge,uv_vertex:Uge,worldpos_vertex:jge,background_vert:Fge,background_frag:zge,backgroundCube_vert:Bge,backgroundCube_frag:Hge,cube_vert:Vge,cube_frag:Gge,depth_vert:Wge,depth_frag:$ge,distanceRGBA_vert:Xge,distanceRGBA_frag:qge,equirect_vert:Kge,equirect_frag:Yge,linedashed_vert:Zge,linedashed_frag:Qge,meshbasic_vert:Jge,meshbasic_frag:eve,meshlambert_vert:tve,meshlambert_frag:nve,meshmatcap_vert:rve,meshmatcap_frag:ive,meshnormal_vert:sve,meshnormal_frag:ave,meshphong_vert:ove,meshphong_frag:lve,meshphysical_vert:cve,meshphysical_frag:uve,meshtoon_vert:dve,meshtoon_frag:fve,points_vert:hve,points_frag:pve,shadow_vert:mve,shadow_frag:gve,sprite_vert:vve,sprite_frag:yve},ft={common:{diffuse:{value:new ct(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new $t},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new $t}},envmap:{envMap:{value:null},envMapRotation:{value:new $t},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new $t}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new $t}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new $t},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new $t},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new $t},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new $t}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new $t}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new $t}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ct(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 ct(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0},uvTransform:{value:new $t}},sprite:{diffuse:{value:new ct(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new $t},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0}}},Do={basic:{uniforms:_s([ft.common,ft.specularmap,ft.envmap,ft.aomap,ft.lightmap,ft.fog]),vertexShader:fn.meshbasic_vert,fragmentShader:fn.meshbasic_frag},lambert:{uniforms:_s([ft.common,ft.specularmap,ft.envmap,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.fog,ft.lights,{emissive:{value:new ct(0)}}]),vertexShader:fn.meshlambert_vert,fragmentShader:fn.meshlambert_frag},phong:{uniforms:_s([ft.common,ft.specularmap,ft.envmap,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.fog,ft.lights,{emissive:{value:new ct(0)},specular:{value:new ct(1118481)},shininess:{value:30}}]),vertexShader:fn.meshphong_vert,fragmentShader:fn.meshphong_frag},standard:{uniforms:_s([ft.common,ft.envmap,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.roughnessmap,ft.metalnessmap,ft.fog,ft.lights,{emissive:{value:new ct(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:fn.meshphysical_vert,fragmentShader:fn.meshphysical_frag},toon:{uniforms:_s([ft.common,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.gradientmap,ft.fog,ft.lights,{emissive:{value:new ct(0)}}]),vertexShader:fn.meshtoon_vert,fragmentShader:fn.meshtoon_frag},matcap:{uniforms:_s([ft.common,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.fog,{matcap:{value:null}}]),vertexShader:fn.meshmatcap_vert,fragmentShader:fn.meshmatcap_frag},points:{uniforms:_s([ft.points,ft.fog]),vertexShader:fn.points_vert,fragmentShader:fn.points_frag},dashed:{uniforms:_s([ft.common,ft.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:fn.linedashed_vert,fragmentShader:fn.linedashed_frag},depth:{uniforms:_s([ft.common,ft.displacementmap]),vertexShader:fn.depth_vert,fragmentShader:fn.depth_frag},normal:{uniforms:_s([ft.common,ft.bumpmap,ft.normalmap,ft.displacementmap,{opacity:{value:1}}]),vertexShader:fn.meshnormal_vert,fragmentShader:fn.meshnormal_frag},sprite:{uniforms:_s([ft.sprite,ft.fog]),vertexShader:fn.sprite_vert,fragmentShader:fn.sprite_frag},background:{uniforms:{uvTransform:{value:new $t},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:fn.background_vert,fragmentShader:fn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new $t}},vertexShader:fn.backgroundCube_vert,fragmentShader:fn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:fn.cube_vert,fragmentShader:fn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:fn.equirect_vert,fragmentShader:fn.equirect_frag},distanceRGBA:{uniforms:_s([ft.common,ft.displacementmap,{referencePosition:{value:new q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:fn.distanceRGBA_vert,fragmentShader:fn.distanceRGBA_frag},shadow:{uniforms:_s([ft.lights,ft.fog,{color:{value:new ct(0)},opacity:{value:1}}]),vertexShader:fn.shadow_vert,fragmentShader:fn.shadow_frag}};Do.physical={uniforms:_s([Do.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new $t},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new $t},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new $t},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new $t},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new $t},sheen:{value:0},sheenColor:{value:new ct(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new $t},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new $t},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new $t},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new $t},attenuationDistance:{value:0},attenuationColor:{value:new ct(0)},specularColor:{value:new ct(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new $t},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new $t},anisotropyVector:{value:new He},anisotropyMap:{value:null},anisotropyMapTransform:{value:new $t}}]),vertexShader:fn.meshphysical_vert,fragmentShader:fn.meshphysical_frag};const r_={r:0,b:0,g:0},kf=new ls,xve=new Ct;function bve(t,e,n,r,i,s,a){const o=new ct(0);let l=s===!0?0:1,c,d,f=null,p=0,y=null;function b(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 P=b(M);P===null?x(o,l):P&&P.isColor&&(x(P,1),T=!0);const O=t.xr.getEnvironmentBlendMode();O==="additive"?r.buffers.color.setClear(0,0,0,1,a):O==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,a),(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 P=b(T);P&&(P.isCubeTexture||P.mapping===nv)?(d===void 0&&(d=new xr(new tp(1,1,1),new Ya({name:"BackgroundCubeMaterial",uniforms:Ug(Do.backgroundCube.uniforms),vertexShader:Do.backgroundCube.vertexShader,fragmentShader:Do.backgroundCube.fragmentShader,side:as,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(O,N,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),kf.copy(T.backgroundRotation),kf.x*=-1,kf.y*=-1,kf.z*=-1,P.isCubeTexture&&P.isRenderTargetTexture===!1&&(kf.y*=-1,kf.z*=-1),d.material.uniforms.envMap.value=P,d.material.uniforms.flipEnvMap.value=P.isCubeTexture&&P.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(xve.makeRotationFromEuler(kf)),d.material.toneMapped=Nn.getTransfer(P.colorSpace)!==er,(f!==P||p!==P.version||y!==t.toneMapping)&&(d.material.needsUpdate=!0,f=P,p=P.version,y=t.toneMapping),d.layers.enableAll(),M.unshift(d,d.geometry,d.material,0,0,null)):P&&P.isTexture&&(c===void 0&&(c=new xr(new iv(2,2),new Ya({name:"BackgroundMaterial",uniforms:Ug(Do.background.uniforms),vertexShader:Do.background.vertexShader,fragmentShader:Do.background.fragmentShader,side:Ll,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=P,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=Nn.getTransfer(P.colorSpace)!==er,P.matrixAutoUpdate===!0&&P.updateMatrix(),c.material.uniforms.uvTransform.value.copy(P.matrix),(f!==P||p!==P.version||y!==t.toneMapping)&&(c.material.needsUpdate=!0,f=P,p=P.version,y=t.toneMapping),c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null))}function x(M,T){M.getRGB(r_,p6(t)),r.buffers.color.setClear(r_.r,r_.g,r_.b,T,a)}return{getClearColor:function(){return o},setClearColor:function(M,T=1){o.set(M),l=T,x(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(M){l=M,x(o,l)},render:S,addToRenderList:w}}function _ve(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=p(null);let s=i,a=!1;function o(k,j,X,ee,ie){let pe=!1;const ae=f(ee,X,j);s!==ae&&(s=ae,c(s.object)),pe=y(k,ee,X,ie),pe&&b(k,ee,X,ie),ie!==null&&e.update(ie,t.ELEMENT_ARRAY_BUFFER),(pe||a)&&(a=!1,P(k,j,X,ee),ie!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(ie).buffer))}function l(){return t.createVertexArray()}function c(k){return t.bindVertexArray(k)}function d(k){return t.deleteVertexArray(k)}function f(k,j,X){const ee=X.wireframe===!0;let ie=r[k.id];ie===void 0&&(ie={},r[k.id]=ie);let pe=ie[j.id];pe===void 0&&(pe={},ie[j.id]=pe);let ae=pe[ee];return ae===void 0&&(ae=p(l()),pe[ee]=ae),ae}function p(k){const j=[],X=[],ee=[];for(let ie=0;ie=0){const Y=ie[B];let H=pe[B];if(H===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(H=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(H=k.instanceColor)),Y===void 0||Y.attribute!==H||H&&Y.data!==H.data)return!0;ae++}return s.attributesNum!==ae||s.index!==ee}function b(k,j,X,ee){const ie={},pe=j.attributes;let ae=0;const he=X.getAttributes();for(const B in he)if(he[B].location>=0){let Y=pe[B];Y===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(Y=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(Y=k.instanceColor));const H={};H.attribute=Y,Y&&Y.data&&(H.data=Y.data),ie[B]=H,ae++}s.attributes=ie,s.attributesNum=ae,s.index=ee}function S(){const k=s.newAttributes;for(let j=0,X=k.length;j=0){let J=ie[he];if(J===void 0&&(he==="instanceMatrix"&&k.instanceMatrix&&(J=k.instanceMatrix),he==="instanceColor"&&k.instanceColor&&(J=k.instanceColor)),J!==void 0){const Y=J.normalized,H=J.itemSize,G=e.get(J);if(G===void 0)continue;const le=G.buffer,se=G.type,ce=G.bytesPerElement,Se=se===t.INT||se===t.UNSIGNED_INT||J.gpuType===GS;if(J.isInterleavedBufferAttribute){const we=J.data,We=we.stride,Ee=J.offset;if(we.isInstancedInterleavedBuffer){for(let Ge=0;Ge0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="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,p=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(p===!0){const D=e.get("EXT_clip_control");D.clipControlEXT(D.LOWER_LEFT_EXT,D.ZERO_TO_ONE_EXT)}const y=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=t.getParameter(t.MAX_TEXTURE_SIZE),w=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),x=t.getParameter(t.MAX_VERTEX_ATTRIBS),M=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),T=t.getParameter(t.MAX_VARYING_VECTORS),P=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),O=b>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:p,maxTextures:y,maxVertexTextures:b,maxTextureSize:S,maxCubemapSize:w,maxAttributes:x,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:P,vertexTextures:O,maxSamples:N}}function Mve(t){const e=this;let n=null,r=0,i=!1,s=!1;const a=new Rc,o=new $t,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const y=f.length!==0||p||r!==0||i;return i=p,r=f.length,y},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){n=d(f,p,0)},this.setState=function(f,p,y){const b=f.clippingPlanes,S=f.clipIntersection,w=f.clipShadows,x=t.get(f);if(!i||b===null||b.length===0||s&&!w)s?d(null):c();else{const M=s?0:r,T=M*4;let P=x.clippingState||null;l.value=P,P=d(b,p,T,y);for(let O=0;O!==T;++O)P[O]=n[O];x.clippingState=P,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,p,y,b){const S=f!==null?f.length:0;let w=null;if(S!==0){if(w=l.value,b!==!0||w===null){const x=y+S*4,M=p.matrixWorldInverse;o.getNormalMatrix(M),(w===null||w.length0){const c=new g6(l.height);return c.fromEquirectangularTexture(t,a),e.set(a,c),a.addEventListener("dispose",i),n(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Gc extends fx{constructor(e=-1,n=1,r=1,i=-1,s=.1,a=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=a,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,a){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=a,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,a=r+e,o=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,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,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 Xm=4,oD=[.125,.215,.35,.446,.526,.582],eh=20,gA=new Gc,lD=new ct;let vA=null,yA=0,xA=0,bA=!1;const Qf=(1+Math.sqrt(5))/2,Em=1/Qf,cD=[new q(-Qf,Em,0),new q(Qf,Em,0),new q(-Em,0,Qf),new q(Em,0,Qf),new q(0,Qf,-Em),new q(0,Qf,Em),new q(-1,1,-1),new q(1,1,-1),new q(-1,1,1),new q(1,1,1)];class qP{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=fD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=dD(),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(b,o),d.render(e,o)}b.geometry.dispose(),b.material.dispose(),d.toneMapping=p,d.autoClear=f,e.background=w}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===Zc||e.mapping===Cd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=fD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=dD());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new xr(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;i_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(a,gA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;seh&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${eh}`);const x=[];let M=0;for(let D=0;DT-Xm?i-T+Xm:0),N=4*(this._cubeSize-P);i_(n,O,N,3*P,2*P),l.setRenderTarget(n),l.render(f,gA)}}function Ave(t){const e=[],n=[],r=[];let i=t;const s=t-Xm+1+oD.length;for(let a=0;at-Xm?l=oD[a-t+Xm-1]:a===0&&(l=0),r.push(l);const c=1/(o-2),d=-c,f=1+c,p=[d,d,f,d,f,f,d,d,f,f,d,f],y=6,b=6,S=3,w=2,x=1,M=new Float32Array(S*b*y),T=new Float32Array(w*b*y),P=new Float32Array(x*b*y);for(let N=0;N2?0:-1,V=[D,z,0,D+2/3,z,0,D+2/3,z+1,0,D,z,0,D+2/3,z+1,0,D,z+1,0];M.set(V,S*b*N),T.set(p,w*b*N);const k=[N,N,N,N,N,N];P.set(k,x*b*N)}const O=new Yt;O.setAttribute("position",new Qt(M,S)),O.setAttribute("uv",new Qt(T,w)),O.setAttribute("faceIndex",new Qt(P,x)),e.push(O),i>Xm&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function uD(t,e,n){const r=new Vo(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 Tve(t,e,n){const r=new Float32Array(eh),i=new q(0,1,0);return new Ya({name:"SphericalGaussianBlur",defines:{n:eh,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:` +}`,fn={alphahash_fragment:Bpe,alphahash_pars_fragment:Hpe,alphamap_fragment:Vpe,alphamap_pars_fragment:Gpe,alphatest_fragment:Wpe,alphatest_pars_fragment:$pe,aomap_fragment:Xpe,aomap_pars_fragment:qpe,batching_pars_vertex:Kpe,batching_vertex:Ype,begin_vertex:Zpe,beginnormal_vertex:Qpe,bsdfs:Jpe,iridescence_fragment:eme,bumpmap_pars_fragment:tme,clipping_planes_fragment:nme,clipping_planes_pars_fragment:rme,clipping_planes_pars_vertex:ime,clipping_planes_vertex:sme,color_fragment:ame,color_pars_fragment:ome,color_pars_vertex:lme,color_vertex:cme,common:ume,cube_uv_reflection_fragment:dme,defaultnormal_vertex:fme,displacementmap_pars_vertex:hme,displacementmap_vertex:pme,emissivemap_fragment:mme,emissivemap_pars_fragment:gme,colorspace_fragment:vme,colorspace_pars_fragment:yme,envmap_fragment:xme,envmap_common_pars_fragment:bme,envmap_pars_fragment:_me,envmap_pars_vertex:wme,envmap_physical_pars_fragment:kme,envmap_vertex:Sme,fog_vertex:Mme,fog_pars_vertex:Eme,fog_fragment:Ame,fog_pars_fragment:Tme,gradientmap_pars_fragment:Pme,lightmap_pars_fragment:Cme,lights_lambert_fragment:Rme,lights_lambert_pars_fragment:Nme,lights_pars_begin:Ime,lights_toon_fragment:Ome,lights_toon_pars_fragment:Lme,lights_phong_fragment:Dme,lights_phong_pars_fragment:Ume,lights_physical_fragment:jme,lights_physical_pars_fragment:Fme,lights_fragment_begin:zme,lights_fragment_maps:Bme,lights_fragment_end:Hme,logdepthbuf_fragment:Vme,logdepthbuf_pars_fragment:Gme,logdepthbuf_pars_vertex:Wme,logdepthbuf_vertex:$me,map_fragment:Xme,map_pars_fragment:qme,map_particle_fragment:Kme,map_particle_pars_fragment:Yme,metalnessmap_fragment:Zme,metalnessmap_pars_fragment:Qme,morphinstance_vertex:Jme,morphcolor_vertex:ege,morphnormal_vertex:tge,morphtarget_pars_vertex:nge,morphtarget_vertex:rge,normal_fragment_begin:ige,normal_fragment_maps:sge,normal_pars_fragment:age,normal_pars_vertex:oge,normal_vertex:lge,normalmap_pars_fragment:cge,clearcoat_normal_fragment_begin:uge,clearcoat_normal_fragment_maps:dge,clearcoat_pars_fragment:fge,iridescence_pars_fragment:hge,opaque_fragment:pge,packing:mge,premultiplied_alpha_fragment:gge,project_vertex:vge,dithering_fragment:yge,dithering_pars_fragment:xge,roughnessmap_fragment:bge,roughnessmap_pars_fragment:_ge,shadowmap_pars_fragment:wge,shadowmap_pars_vertex:Sge,shadowmap_vertex:Mge,shadowmask_pars_fragment:Ege,skinbase_vertex:Age,skinning_pars_vertex:Tge,skinning_vertex:Pge,skinnormal_vertex:Cge,specularmap_fragment:Rge,specularmap_pars_fragment:Nge,tonemapping_fragment:Ige,tonemapping_pars_fragment:kge,transmission_fragment:Oge,transmission_pars_fragment:Lge,uv_pars_fragment:Dge,uv_pars_vertex:Uge,uv_vertex:jge,worldpos_vertex:Fge,background_vert:zge,background_frag:Bge,backgroundCube_vert:Hge,backgroundCube_frag:Vge,cube_vert:Gge,cube_frag:Wge,depth_vert:$ge,depth_frag:Xge,distanceRGBA_vert:qge,distanceRGBA_frag:Kge,equirect_vert:Yge,equirect_frag:Zge,linedashed_vert:Qge,linedashed_frag:Jge,meshbasic_vert:eve,meshbasic_frag:tve,meshlambert_vert:nve,meshlambert_frag:rve,meshmatcap_vert:ive,meshmatcap_frag:sve,meshnormal_vert:ave,meshnormal_frag:ove,meshphong_vert:lve,meshphong_frag:cve,meshphysical_vert:uve,meshphysical_frag:dve,meshtoon_vert:fve,meshtoon_frag:hve,points_vert:pve,points_frag:mve,shadow_vert:gve,shadow_frag:vve,sprite_vert:yve,sprite_frag:xve},ft={common:{diffuse:{value:new ct(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new $t},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new $t}},envmap:{envMap:{value:null},envMapRotation:{value:new $t},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new $t}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new $t}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new $t},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new $t},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new $t},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new $t}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new $t}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new $t}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ct(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 ct(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0},uvTransform:{value:new $t}},sprite:{diffuse:{value:new ct(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new $t},alphaMap:{value:null},alphaMapTransform:{value:new $t},alphaTest:{value:0}}},Do={basic:{uniforms:_s([ft.common,ft.specularmap,ft.envmap,ft.aomap,ft.lightmap,ft.fog]),vertexShader:fn.meshbasic_vert,fragmentShader:fn.meshbasic_frag},lambert:{uniforms:_s([ft.common,ft.specularmap,ft.envmap,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.fog,ft.lights,{emissive:{value:new ct(0)}}]),vertexShader:fn.meshlambert_vert,fragmentShader:fn.meshlambert_frag},phong:{uniforms:_s([ft.common,ft.specularmap,ft.envmap,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.fog,ft.lights,{emissive:{value:new ct(0)},specular:{value:new ct(1118481)},shininess:{value:30}}]),vertexShader:fn.meshphong_vert,fragmentShader:fn.meshphong_frag},standard:{uniforms:_s([ft.common,ft.envmap,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.roughnessmap,ft.metalnessmap,ft.fog,ft.lights,{emissive:{value:new ct(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:fn.meshphysical_vert,fragmentShader:fn.meshphysical_frag},toon:{uniforms:_s([ft.common,ft.aomap,ft.lightmap,ft.emissivemap,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.gradientmap,ft.fog,ft.lights,{emissive:{value:new ct(0)}}]),vertexShader:fn.meshtoon_vert,fragmentShader:fn.meshtoon_frag},matcap:{uniforms:_s([ft.common,ft.bumpmap,ft.normalmap,ft.displacementmap,ft.fog,{matcap:{value:null}}]),vertexShader:fn.meshmatcap_vert,fragmentShader:fn.meshmatcap_frag},points:{uniforms:_s([ft.points,ft.fog]),vertexShader:fn.points_vert,fragmentShader:fn.points_frag},dashed:{uniforms:_s([ft.common,ft.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:fn.linedashed_vert,fragmentShader:fn.linedashed_frag},depth:{uniforms:_s([ft.common,ft.displacementmap]),vertexShader:fn.depth_vert,fragmentShader:fn.depth_frag},normal:{uniforms:_s([ft.common,ft.bumpmap,ft.normalmap,ft.displacementmap,{opacity:{value:1}}]),vertexShader:fn.meshnormal_vert,fragmentShader:fn.meshnormal_frag},sprite:{uniforms:_s([ft.sprite,ft.fog]),vertexShader:fn.sprite_vert,fragmentShader:fn.sprite_frag},background:{uniforms:{uvTransform:{value:new $t},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:fn.background_vert,fragmentShader:fn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new $t}},vertexShader:fn.backgroundCube_vert,fragmentShader:fn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:fn.cube_vert,fragmentShader:fn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:fn.equirect_vert,fragmentShader:fn.equirect_frag},distanceRGBA:{uniforms:_s([ft.common,ft.displacementmap,{referencePosition:{value:new q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:fn.distanceRGBA_vert,fragmentShader:fn.distanceRGBA_frag},shadow:{uniforms:_s([ft.lights,ft.fog,{color:{value:new ct(0)},opacity:{value:1}}]),vertexShader:fn.shadow_vert,fragmentShader:fn.shadow_frag}};Do.physical={uniforms:_s([Do.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new $t},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new $t},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new $t},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new $t},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new $t},sheen:{value:0},sheenColor:{value:new ct(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new $t},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new $t},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new $t},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new $t},attenuationDistance:{value:0},attenuationColor:{value:new ct(0)},specularColor:{value:new ct(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new $t},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new $t},anisotropyVector:{value:new He},anisotropyMap:{value:null},anisotropyMapTransform:{value:new $t}}]),vertexShader:fn.meshphysical_vert,fragmentShader:fn.meshphysical_frag};const r_={r:0,b:0,g:0},kf=new ls,bve=new Ct;function _ve(t,e,n,r,i,s,a){const o=new ct(0);let l=s===!0?0:1,c,d,f=null,p=0,y=null;function b(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 P=b(M);P===null?x(o,l):P&&P.isColor&&(x(P,1),T=!0);const O=t.xr.getEnvironmentBlendMode();O==="additive"?r.buffers.color.setClear(0,0,0,1,a):O==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,a),(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 P=b(T);P&&(P.isCubeTexture||P.mapping===nv)?(d===void 0&&(d=new xr(new tp(1,1,1),new Ya({name:"BackgroundCubeMaterial",uniforms:Ug(Do.backgroundCube.uniforms),vertexShader:Do.backgroundCube.vertexShader,fragmentShader:Do.backgroundCube.fragmentShader,side:as,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(O,N,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),kf.copy(T.backgroundRotation),kf.x*=-1,kf.y*=-1,kf.z*=-1,P.isCubeTexture&&P.isRenderTargetTexture===!1&&(kf.y*=-1,kf.z*=-1),d.material.uniforms.envMap.value=P,d.material.uniforms.flipEnvMap.value=P.isCubeTexture&&P.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(bve.makeRotationFromEuler(kf)),d.material.toneMapped=Nn.getTransfer(P.colorSpace)!==er,(f!==P||p!==P.version||y!==t.toneMapping)&&(d.material.needsUpdate=!0,f=P,p=P.version,y=t.toneMapping),d.layers.enableAll(),M.unshift(d,d.geometry,d.material,0,0,null)):P&&P.isTexture&&(c===void 0&&(c=new xr(new iv(2,2),new Ya({name:"BackgroundMaterial",uniforms:Ug(Do.background.uniforms),vertexShader:Do.background.vertexShader,fragmentShader:Do.background.fragmentShader,side:Ll,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=P,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=Nn.getTransfer(P.colorSpace)!==er,P.matrixAutoUpdate===!0&&P.updateMatrix(),c.material.uniforms.uvTransform.value.copy(P.matrix),(f!==P||p!==P.version||y!==t.toneMapping)&&(c.material.needsUpdate=!0,f=P,p=P.version,y=t.toneMapping),c.layers.enableAll(),M.unshift(c,c.geometry,c.material,0,0,null))}function x(M,T){M.getRGB(r_,m6(t)),r.buffers.color.setClear(r_.r,r_.g,r_.b,T,a)}return{getClearColor:function(){return o},setClearColor:function(M,T=1){o.set(M),l=T,x(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(M){l=M,x(o,l)},render:S,addToRenderList:w}}function wve(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=p(null);let s=i,a=!1;function o(k,j,X,ee,ie){let pe=!1;const ae=f(ee,X,j);s!==ae&&(s=ae,c(s.object)),pe=y(k,ee,X,ie),pe&&b(k,ee,X,ie),ie!==null&&e.update(ie,t.ELEMENT_ARRAY_BUFFER),(pe||a)&&(a=!1,P(k,j,X,ee),ie!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(ie).buffer))}function l(){return t.createVertexArray()}function c(k){return t.bindVertexArray(k)}function d(k){return t.deleteVertexArray(k)}function f(k,j,X){const ee=X.wireframe===!0;let ie=r[k.id];ie===void 0&&(ie={},r[k.id]=ie);let pe=ie[j.id];pe===void 0&&(pe={},ie[j.id]=pe);let ae=pe[ee];return ae===void 0&&(ae=p(l()),pe[ee]=ae),ae}function p(k){const j=[],X=[],ee=[];for(let ie=0;ie=0){const Y=ie[B];let H=pe[B];if(H===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(H=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(H=k.instanceColor)),Y===void 0||Y.attribute!==H||H&&Y.data!==H.data)return!0;ae++}return s.attributesNum!==ae||s.index!==ee}function b(k,j,X,ee){const ie={},pe=j.attributes;let ae=0;const he=X.getAttributes();for(const B in he)if(he[B].location>=0){let Y=pe[B];Y===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(Y=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(Y=k.instanceColor));const H={};H.attribute=Y,Y&&Y.data&&(H.data=Y.data),ie[B]=H,ae++}s.attributes=ie,s.attributesNum=ae,s.index=ee}function S(){const k=s.newAttributes;for(let j=0,X=k.length;j=0){let J=ie[he];if(J===void 0&&(he==="instanceMatrix"&&k.instanceMatrix&&(J=k.instanceMatrix),he==="instanceColor"&&k.instanceColor&&(J=k.instanceColor)),J!==void 0){const Y=J.normalized,H=J.itemSize,G=e.get(J);if(G===void 0)continue;const le=G.buffer,se=G.type,ce=G.bytesPerElement,Se=se===t.INT||se===t.UNSIGNED_INT||J.gpuType===GS;if(J.isInterleavedBufferAttribute){const we=J.data,We=we.stride,Ee=J.offset;if(we.isInstancedInterleavedBuffer){for(let Ge=0;Ge0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="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,p=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(p===!0){const D=e.get("EXT_clip_control");D.clipControlEXT(D.LOWER_LEFT_EXT,D.ZERO_TO_ONE_EXT)}const y=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),b=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=t.getParameter(t.MAX_TEXTURE_SIZE),w=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),x=t.getParameter(t.MAX_VERTEX_ATTRIBS),M=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),T=t.getParameter(t.MAX_VARYING_VECTORS),P=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),O=b>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:p,maxTextures:y,maxVertexTextures:b,maxTextureSize:S,maxCubemapSize:w,maxAttributes:x,maxVertexUniforms:M,maxVaryings:T,maxFragmentUniforms:P,vertexTextures:O,maxSamples:N}}function Eve(t){const e=this;let n=null,r=0,i=!1,s=!1;const a=new Rc,o=new $t,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,p){const y=f.length!==0||p||r!==0||i;return i=p,r=f.length,y},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,p){n=d(f,p,0)},this.setState=function(f,p,y){const b=f.clippingPlanes,S=f.clipIntersection,w=f.clipShadows,x=t.get(f);if(!i||b===null||b.length===0||s&&!w)s?d(null):c();else{const M=s?0:r,T=M*4;let P=x.clippingState||null;l.value=P,P=d(b,p,T,y);for(let O=0;O!==T;++O)P[O]=n[O];x.clippingState=P,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,p,y,b){const S=f!==null?f.length:0;let w=null;if(S!==0){if(w=l.value,b!==!0||w===null){const x=y+S*4,M=p.matrixWorldInverse;o.getNormalMatrix(M),(w===null||w.length0){const c=new v6(l.height);return c.fromEquirectangularTexture(t,a),e.set(a,c),a.addEventListener("dispose",i),n(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Gc extends fx{constructor(e=-1,n=1,r=1,i=-1,s=.1,a=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=a,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,a){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=a,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,a=r+e,o=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,a=s+c*this.view.width,o-=d*this.view.offsetY,l=o-d*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,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 Xm=4,oD=[.125,.215,.35,.446,.526,.582],eh=20,gA=new Gc,lD=new ct;let vA=null,yA=0,xA=0,bA=!1;const Qf=(1+Math.sqrt(5))/2,Em=1/Qf,cD=[new q(-Qf,Em,0),new q(Qf,Em,0),new q(-Em,0,Qf),new q(Em,0,Qf),new q(0,Qf,-Em),new q(0,Qf,Em),new q(-1,1,-1),new q(1,1,-1),new q(-1,1,1),new q(1,1,1)];class qP{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=fD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=dD(),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(b,o),d.render(e,o)}b.geometry.dispose(),b.material.dispose(),d.toneMapping=p,d.autoClear=f,e.background=w}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===Zc||e.mapping===Cd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=fD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=dD());const s=i?this._cubemapMaterial:this._equirectMaterial,a=new xr(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;i_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(a,gA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;seh&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${eh}`);const x=[];let M=0;for(let D=0;DT-Xm?i-T+Xm:0),N=4*(this._cubeSize-P);i_(n,O,N,3*P,2*P),l.setRenderTarget(n),l.render(f,gA)}}function Tve(t){const e=[],n=[],r=[];let i=t;const s=t-Xm+1+oD.length;for(let a=0;at-Xm?l=oD[a-t+Xm-1]:a===0&&(l=0),r.push(l);const c=1/(o-2),d=-c,f=1+c,p=[d,d,f,d,f,f,d,d,f,f,d,f],y=6,b=6,S=3,w=2,x=1,M=new Float32Array(S*b*y),T=new Float32Array(w*b*y),P=new Float32Array(x*b*y);for(let N=0;N2?0:-1,V=[D,z,0,D+2/3,z,0,D+2/3,z+1,0,D,z,0,D+2/3,z+1,0,D,z+1,0];M.set(V,S*b*N),T.set(p,w*b*N);const k=[N,N,N,N,N,N];P.set(k,x*b*N)}const O=new Yt;O.setAttribute("position",new Qt(M,S)),O.setAttribute("uv",new Qt(T,w)),O.setAttribute("faceIndex",new Qt(P,x)),e.push(O),i>Xm&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function uD(t,e,n){const r=new Vo(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 Pve(t,e,n){const r=new Float32Array(eh),i=new q(0,1,0);return new Ya({name:"SphericalGaussianBlur",defines:{n:eh,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:` precision mediump float; precision mediump int; @@ -4339,16 +4344,16 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function Pve(t){let e=new WeakMap,n=null;function r(o){if(o&&o.isTexture){const l=o.mapping,c=l===Ay||l===Ty,d=l===Zc||l===Cd;if(c||d){let f=e.get(o);const p=f!==void 0?f.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==p)return n===null&&(n=new qP(t)),f=c?n.fromEquirectangular(o,f):n.fromCubemap(o,f),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),f.texture;if(f!==void 0)return f.texture;{const y=o.image;return c&&y&&y.height>0||d&&y&&i(y)?(n===null&&(n=new qP(t)),f=c?n.fromEquirectangular(o):n.fromCubemap(o),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),o.addEventListener("dispose",s),f.texture):null}}}return o}function i(o){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(O=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);const N=new Float32Array(P*O*4*f),D=new QS(N,P,O,f);D.type=Qs,D.needsUpdate=!0;const z=T*4;for(let k=0;k0)return t;const i=e*n;let s=pD[i];if(s===void 0&&(s=new Float32Array(i),pD[i]=s),e!==0){r.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=n,t[a].toArray(s,o)}return s}function ii(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 qP(t)),f=c?n.fromEquirectangular(o):n.fromCubemap(o),f.texture.pmremVersion=o.pmremVersion,e.set(o,f),o.addEventListener("dispose",s),f.texture):null}}}return o}function i(o){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(O=Math.ceil(P/e.maxTextureSize),P=e.maxTextureSize);const N=new Float32Array(P*O*4*f),D=new QS(N,P,O,f);D.type=Qs,D.needsUpdate=!0;const z=T*4;for(let k=0;k0)return t;const i=e*n;let s=pD[i];if(s===void 0&&(s=new Float32Array(i),pD[i]=s),e!==0){r.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=n,t[a].toArray(s,o)}return s}function ii(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n":" "} ${o}: ${n[a]}`)}return r.join(` -`)}function P0e(t){const e=Nn.getPrimaries(Nn.workingColorSpace),n=Nn.getPrimaries(t);let r;switch(e===n?r="":e===Ny&&n===Ry?r="LinearDisplayP3ToLinearSRGB":e===Ry&&n===Ny&&(r="LinearSRGBToLinearDisplayP3"),t){case xi:case dx:return[r,"LinearTransferOETF"];case Fi:case ZS:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function _D(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 a=parseInt(s[1]);return n.toUpperCase()+` +`)}function C0e(t){const e=Nn.getPrimaries(Nn.workingColorSpace),n=Nn.getPrimaries(t);let r;switch(e===n?r="":e===Ny&&n===Ry?r="LinearDisplayP3ToLinearSRGB":e===Ry&&n===Ny&&(r="LinearSRGBToLinearDisplayP3"),t){case xi:case dx:return[r,"LinearTransferOETF"];case Fi:case ZS:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function _D(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 a=parseInt(s[1]);return n.toUpperCase()+` `+i+` -`+T0e(t.getShaderSource(e),a)}else return i}function C0e(t,e){const n=P0e(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function R0e(t,e){let n;switch(e){case BV:n="Linear";break;case HV:n="Reinhard";break;case VV:n="Cineon";break;case uR:n="ACESFilmic";break;case WV:n="AgX";break;case $V:n="Neutral";break;case GV:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const s_=new q;function N0e(){Nn.getLuminanceCoefficients(s_);const t=s_.x.toFixed(4),e=s_.y.toFixed(4),n=s_.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(` -`)}function I0e(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(W0).join(` -`)}function k0e(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(` -`)}function O0e(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function KP(t){return t.replace(L0e,U0e)}const D0e=new Map;function U0e(t,e){let n=fn[e];if(n===void 0){const r=D0e.get(e);if(r!==void 0)n=fn[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 KP(n)}const j0e=/#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 MD(t){return t.replace(j0e,F0e)}function F0e(t,e,n,r){let i="";for(let s=parseInt(e);s/gm;function KP(t){return t.replace(D0e,j0e)}const U0e=new Map;function j0e(t,e){let n=fn[e];if(n===void 0){const r=U0e.get(e);if(r!==void 0)n=fn[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 KP(n)}const F0e=/#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 MD(t){return t.replace(F0e,z0e)}function z0e(t,e,n,r){let i="";for(let s=parseInt(e);s0&&(w+=` `),x=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(W0).join(` `),x.length>0&&(x+=` `)):(w=[ED(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,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(W0).join(` -`),x=[ED(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,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:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.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!==Tl?"#define TONE_MAPPING":"",n.toneMapping!==Tl?fn.tonemapping_pars_fragment:"",n.toneMapping!==Tl?R0e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",fn.colorspace_pars_fragment,C0e("linearToOutputTexel",n.outputColorSpace),N0e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` +`),x=[ED(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,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:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.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!==Tl?"#define TONE_MAPPING":"",n.toneMapping!==Tl?fn.tonemapping_pars_fragment:"",n.toneMapping!==Tl?N0e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",fn.colorspace_pars_fragment,R0e("linearToOutputTexel",n.outputColorSpace),I0e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` `].filter(W0).join(` `)),a=KP(a),a=wD(a,n),a=SD(a,n),o=KP(o),o=wD(o,n),o=SD(o,n),a=MD(a),o=MD(o),n.isRawShaderMaterial!==!0&&(M=`#version 300 es `,w=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(` @@ -4389,9 +4394,9 @@ Material Type: `+j.type+` Program Info Log: `+X+` `+he+` -`+B)}else X!==""?console.warn("THREE.WebGLProgram: Program Info Log:",X):(ee===""||ie==="")&&(ae=!1);ae&&(j.diagnostics={runnable:pe,programLog:X,vertexShader:{log:ee,prefix:w},fragmentShader:{log:ie,prefix:x}})}i.deleteShader(O),i.deleteShader(N),z=new K_(i,S),V=O0e(i,S)}let z;this.getUniforms=function(){return z===void 0&&D(this),z};let V;this.getAttributes=function(){return V===void 0&&D(this),V};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(S,E0e)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=A0e++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=O,this.fragmentShader=N,this}let $0e=0;class X0e{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),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.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 q0e(e),n.set(e,r)),r}}class q0e{constructor(e){this.id=$0e++,this.code=e,this.usedTimes=0}}function K0e(t,e,n,r,i,s,a){const o=new Ch,l=new X0e,c=new Set,d=[],f=i.logarithmicDepthBuffer,p=i.reverseDepthBuffer,y=i.vertexTextures;let b=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 x(k,j,X,ee,ie){const pe=ee.fog,ae=ie.geometry,he=k.isMeshStandardMaterial?ee.environment:null,B=(k.isMeshStandardMaterial?n:e).get(k.envMap||he),J=B&&B.mapping===nv?B.image.height:null,Y=S[k.type];k.precision!==null&&(b=i.getMaxPrecision(k.precision),b!==k.precision&&console.warn("THREE.WebGLProgram.getParameters:",k.precision,"not supported, using",b,"instead."));const H=ae.morphAttributes.position||ae.morphAttributes.normal||ae.morphAttributes.color,G=H!==void 0?H.length:0;let le=0;ae.morphAttributes.position!==void 0&&(le=1),ae.morphAttributes.normal!==void 0&&(le=2),ae.morphAttributes.color!==void 0&&(le=3);let se,ce,Se,we;if(Y){const Hn=Do[Y];se=Hn.vertexShader,ce=Hn.fragmentShader}else se=k.vertexShader,ce=k.fragmentShader,l.update(k),Se=l.getVertexShaderID(k),we=l.getFragmentShaderID(k);const We=t.getRenderTarget(),Ee=ie.isInstancedMesh===!0,Ge=ie.isBatchedMesh===!0,$e=!!k.map,de=!!k.matcap,Z=!!B,Ve=!!k.aoMap,Le=!!k.lightMap,ne=!!k.bumpMap,Ce=!!k.normalMap,qe=!!k.displacementMap,Ze=!!k.emissiveMap,Q=!!k.metalnessMap,W=!!k.roughnessMap,be=k.anisotropy>0,Ue=k.clearcoat>0,ze=k.dispersion>0,Fe=k.iridescence>0,bt=k.sheen>0,rt=k.transmission>0,ht=be&&!!k.anisotropyMap,Xt=Ue&&!!k.clearcoatMap,Ke=Ue&&!!k.clearcoatNormalMap,te=Ue&&!!k.clearcoatRoughnessMap,tt=Fe&&!!k.iridescenceMap,Mt=Fe&&!!k.iridescenceThicknessMap,vt=bt&&!!k.sheenColorMap,Zt=bt&&!!k.sheenRoughnessMap,fe=!!k.specularMap,Xe=!!k.specularColorMap,ue=!!k.specularIntensityMap,Ye=rt&&!!k.transmissionMap,Re=rt&&!!k.thicknessMap,Be=!!k.gradientMap,at=!!k.alphaMap,pt=k.alphaTest>0,Jt=!!k.alphaHash,pn=!!k.extensions;let jn=Tl;k.toneMapped&&(We===null||We.isXRRenderTarget===!0)&&(jn=t.toneMapping);const en={shaderID:Y,shaderType:k.type,shaderName:k.name,vertexShader:se,fragmentShader:ce,defines:k.defines,customVertexShaderID:Se,customFragmentShaderID:we,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:b,batching:Ge,batchingColor:Ge&&ie._colorsTexture!==null,instancing:Ee,instancingColor:Ee&&ie.instanceColor!==null,instancingMorph:Ee&&ie.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:We===null?t.outputColorSpace:We.isXRRenderTarget===!0?We.texture.colorSpace:xi,alphaToCoverage:!!k.alphaToCoverage,map:$e,matcap:de,envMap:Z,envMapMode:Z&&B.mapping,envMapCubeUVHeight:J,aoMap:Ve,lightMap:Le,bumpMap:ne,normalMap:Ce,displacementMap:y&&qe,emissiveMap:Ze,normalMapObjectSpace:Ce&&k.normalMapType===e6,normalMapTangentSpace:Ce&&k.normalMapType===au,metalnessMap:Q,roughnessMap:W,anisotropy:be,anisotropyMap:ht,clearcoat:Ue,clearcoatMap:Xt,clearcoatNormalMap:Ke,clearcoatRoughnessMap:te,dispersion:ze,iridescence:Fe,iridescenceMap:tt,iridescenceThicknessMap:Mt,sheen:bt,sheenColorMap:vt,sheenRoughnessMap:Zt,specularMap:fe,specularColorMap:Xe,specularIntensityMap:ue,transmission:rt,transmissionMap:Ye,thicknessMap:Re,gradientMap:Be,opaque:k.transparent===!1&&k.blending===Ah&&k.alphaToCoverage===!1,alphaMap:at,alphaTest:pt,alphaHash:Jt,combine:k.combine,mapUv:$e&&w(k.map.channel),aoMapUv:Ve&&w(k.aoMap.channel),lightMapUv:Le&&w(k.lightMap.channel),bumpMapUv:ne&&w(k.bumpMap.channel),normalMapUv:Ce&&w(k.normalMap.channel),displacementMapUv:qe&&w(k.displacementMap.channel),emissiveMapUv:Ze&&w(k.emissiveMap.channel),metalnessMapUv:Q&&w(k.metalnessMap.channel),roughnessMapUv:W&&w(k.roughnessMap.channel),anisotropyMapUv:ht&&w(k.anisotropyMap.channel),clearcoatMapUv:Xt&&w(k.clearcoatMap.channel),clearcoatNormalMapUv:Ke&&w(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:te&&w(k.clearcoatRoughnessMap.channel),iridescenceMapUv:tt&&w(k.iridescenceMap.channel),iridescenceThicknessMapUv:Mt&&w(k.iridescenceThicknessMap.channel),sheenColorMapUv:vt&&w(k.sheenColorMap.channel),sheenRoughnessMapUv:Zt&&w(k.sheenRoughnessMap.channel),specularMapUv:fe&&w(k.specularMap.channel),specularColorMapUv:Xe&&w(k.specularColorMap.channel),specularIntensityMapUv:ue&&w(k.specularIntensityMap.channel),transmissionMapUv:Ye&&w(k.transmissionMap.channel),thicknessMapUv:Re&&w(k.thicknessMap.channel),alphaMapUv:at&&w(k.alphaMap.channel),vertexTangents:!!ae.attributes.tangent&&(Ce||be),vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!ae.attributes.color&&ae.attributes.color.itemSize===4,pointsUvs:ie.isPoints===!0&&!!ae.attributes.uv&&($e||at),fog:!!pe,useFog:k.fog===!0,fogExp2:!!pe&&pe.isFogExp2,flatShading:k.flatShading===!0,sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:p,skinning:ie.isSkinnedMesh===!0,morphTargets:ae.morphAttributes.position!==void 0,morphNormals:ae.morphAttributes.normal!==void 0,morphColors:ae.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:le,numDirLights:j.directional.length,numPointLights:j.point.length,numSpotLights:j.spot.length,numSpotLightMaps:j.spotLightMap.length,numRectAreaLights:j.rectArea.length,numHemiLights:j.hemi.length,numDirLightShadows:j.directionalShadowMap.length,numPointLightShadows:j.pointShadowMap.length,numSpotLightShadows:j.spotShadowMap.length,numSpotLightShadowsWithMaps:j.numSpotLightShadowsWithMaps,numLightProbes:j.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:k.dithering,shadowMapEnabled:t.shadowMap.enabled&&X.length>0,shadowMapType:t.shadowMap.type,toneMapping:jn,decodeVideoTexture:$e&&k.map.isVideoTexture===!0&&Nn.getTransfer(k.map.colorSpace)===er,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===ya,flipSided:k.side===as,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:pn&&k.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(pn&&k.extensions.multiDraw===!0||Ge)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:k.customProgramCacheKey()};return en.vertexUv1s=c.has(1),en.vertexUv2s=c.has(2),en.vertexUv3s=c.has(3),c.clear(),en}function M(k){const j=[];if(k.shaderID?j.push(k.shaderID):(j.push(k.customVertexShaderID),j.push(k.customFragmentShaderID)),k.defines!==void 0)for(const X in k.defines)j.push(X),j.push(k.defines[X]);return k.isRawShaderMaterial===!1&&(T(j,k),P(j,k),j.push(t.outputColorSpace)),j.push(k.customProgramCacheKey),j.join()}function T(k,j){k.push(j.precision),k.push(j.outputColorSpace),k.push(j.envMapMode),k.push(j.envMapCubeUVHeight),k.push(j.mapUv),k.push(j.alphaMapUv),k.push(j.lightMapUv),k.push(j.aoMapUv),k.push(j.bumpMapUv),k.push(j.normalMapUv),k.push(j.displacementMapUv),k.push(j.emissiveMapUv),k.push(j.metalnessMapUv),k.push(j.roughnessMapUv),k.push(j.anisotropyMapUv),k.push(j.clearcoatMapUv),k.push(j.clearcoatNormalMapUv),k.push(j.clearcoatRoughnessMapUv),k.push(j.iridescenceMapUv),k.push(j.iridescenceThicknessMapUv),k.push(j.sheenColorMapUv),k.push(j.sheenRoughnessMapUv),k.push(j.specularMapUv),k.push(j.specularColorMapUv),k.push(j.specularIntensityMapUv),k.push(j.transmissionMapUv),k.push(j.thicknessMapUv),k.push(j.combine),k.push(j.fogExp2),k.push(j.sizeAttenuation),k.push(j.morphTargetsCount),k.push(j.morphAttributeCount),k.push(j.numDirLights),k.push(j.numPointLights),k.push(j.numSpotLights),k.push(j.numSpotLightMaps),k.push(j.numHemiLights),k.push(j.numRectAreaLights),k.push(j.numDirLightShadows),k.push(j.numPointLightShadows),k.push(j.numSpotLightShadows),k.push(j.numSpotLightShadowsWithMaps),k.push(j.numLightProbes),k.push(j.shadowMapType),k.push(j.toneMapping),k.push(j.numClippingPlanes),k.push(j.numClipIntersection),k.push(j.depthPacking)}function P(k,j){o.disableAll(),j.supportsVertexTextures&&o.enable(0),j.instancing&&o.enable(1),j.instancingColor&&o.enable(2),j.instancingMorph&&o.enable(3),j.matcap&&o.enable(4),j.envMap&&o.enable(5),j.normalMapObjectSpace&&o.enable(6),j.normalMapTangentSpace&&o.enable(7),j.clearcoat&&o.enable(8),j.iridescence&&o.enable(9),j.alphaTest&&o.enable(10),j.vertexColors&&o.enable(11),j.vertexAlphas&&o.enable(12),j.vertexUv1s&&o.enable(13),j.vertexUv2s&&o.enable(14),j.vertexUv3s&&o.enable(15),j.vertexTangents&&o.enable(16),j.anisotropy&&o.enable(17),j.alphaHash&&o.enable(18),j.batching&&o.enable(19),j.dispersion&&o.enable(20),j.batchingColor&&o.enable(21),k.push(o.mask),o.disableAll(),j.fog&&o.enable(0),j.useFog&&o.enable(1),j.flatShading&&o.enable(2),j.logarithmicDepthBuffer&&o.enable(3),j.reverseDepthBuffer&&o.enable(4),j.skinning&&o.enable(5),j.morphTargets&&o.enable(6),j.morphNormals&&o.enable(7),j.morphColors&&o.enable(8),j.premultipliedAlpha&&o.enable(9),j.shadowMapEnabled&&o.enable(10),j.doubleSided&&o.enable(11),j.flipSided&&o.enable(12),j.useDepthPacking&&o.enable(13),j.dithering&&o.enable(14),j.transmission&&o.enable(15),j.sheen&&o.enable(16),j.opaque&&o.enable(17),j.pointsUvs&&o.enable(18),j.decodeVideoTexture&&o.enable(19),j.alphaToCoverage&&o.enable(20),k.push(o.mask)}function O(k){const j=S[k.type];let X;if(j){const ee=Do[j];X=TR.clone(ee.uniforms)}else X=k.uniforms;return X}function N(k,j){let X;for(let ee=0,ie=d.length;ee0?r.push(x):y.transparent===!0?i.push(x):n.push(x)}function l(f,p,y,b,S,w){const x=a(f,p,y,b,S,w);y.transmission>0?r.unshift(x):y.transparent===!0?i.unshift(x):n.unshift(x)}function c(f,p){n.length>1&&n.sort(f||Z0e),r.length>1&&r.sort(p||AD),i.length>1&&i.sort(p||AD)}function d(){for(let f=e,p=t.length;f=s.length?(a=new TD,s.push(a)):a=s[i],a}function n(){t=new WeakMap}return{get:e,dispose: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={direction:new q,color:new ct};break;case"SpotLight":n={position:new q,direction:new q,color:new ct,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new q,color:new ct,distance:0,decay:0};break;case"HemisphereLight":n={direction:new q,skyColor:new ct,groundColor:new ct};break;case"RectAreaLight":n={color:new ct,position:new q,halfWidth:new q,halfHeight:new q};break}return t[e.id]=n,n}}}function eye(){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 tye=0;function nye(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function rye(t){const e=new J0e,n=eye(),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 q);const i=new q,s=new Ct,a=new Ct;function o(c){let d=0,f=0,p=0;for(let V=0;V<9;V++)r.probe[V].set(0,0,0);let y=0,b=0,S=0,w=0,x=0,M=0,T=0,P=0,O=0,N=0,D=0;c.sort(nye);for(let V=0,k=c.length;V0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ft.LTC_FLOAT_1,r.rectAreaLTC2=ft.LTC_FLOAT_2):(r.rectAreaLTC1=ft.LTC_HALF_1,r.rectAreaLTC2=ft.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=p;const z=r.hash;(z.directionalLength!==y||z.pointLength!==b||z.spotLength!==S||z.rectAreaLength!==w||z.hemiLength!==x||z.numDirectionalShadows!==M||z.numPointShadows!==T||z.numSpotShadows!==P||z.numSpotMaps!==O||z.numLightProbes!==D)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=w,r.point.length=b,r.hemi.length=x,r.directionalShadow.length=M,r.directionalShadowMap.length=M,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=P,r.spotShadowMap.length=P,r.directionalShadowMatrix.length=M,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=P+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=D,z.directionalLength=y,z.pointLength=b,z.spotLength=S,z.rectAreaLength=w,z.hemiLength=x,z.numDirectionalShadows=M,z.numPointShadows=T,z.numSpotShadows=P,z.numSpotMaps=O,z.numLightProbes=D,r.version=tye++)}function l(c,d){let f=0,p=0,y=0,b=0,S=0;const w=d.matrixWorldInverse;for(let x=0,M=c.length;x=a.length?(o=new PD(t),a.push(o)):o=a[s],o}function r(){e=new WeakMap}return{get:n,dispose:r}}class RR extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=QV,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 NR extends Gr{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 sye=`void main() { +`+B)}else X!==""?console.warn("THREE.WebGLProgram: Program Info Log:",X):(ee===""||ie==="")&&(ae=!1);ae&&(j.diagnostics={runnable:pe,programLog:X,vertexShader:{log:ee,prefix:w},fragmentShader:{log:ie,prefix:x}})}i.deleteShader(O),i.deleteShader(N),z=new K_(i,S),V=L0e(i,S)}let z;this.getUniforms=function(){return z===void 0&&D(this),z};let V;this.getAttributes=function(){return V===void 0&&D(this),V};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(S,A0e)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=T0e++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=O,this.fragmentShader=N,this}let X0e=0;class q0e{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),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.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 K0e(e),n.set(e,r)),r}}class K0e{constructor(e){this.id=X0e++,this.code=e,this.usedTimes=0}}function Y0e(t,e,n,r,i,s,a){const o=new Ch,l=new q0e,c=new Set,d=[],f=i.logarithmicDepthBuffer,p=i.reverseDepthBuffer,y=i.vertexTextures;let b=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 x(k,j,X,ee,ie){const pe=ee.fog,ae=ie.geometry,he=k.isMeshStandardMaterial?ee.environment:null,B=(k.isMeshStandardMaterial?n:e).get(k.envMap||he),J=B&&B.mapping===nv?B.image.height:null,Y=S[k.type];k.precision!==null&&(b=i.getMaxPrecision(k.precision),b!==k.precision&&console.warn("THREE.WebGLProgram.getParameters:",k.precision,"not supported, using",b,"instead."));const H=ae.morphAttributes.position||ae.morphAttributes.normal||ae.morphAttributes.color,G=H!==void 0?H.length:0;let le=0;ae.morphAttributes.position!==void 0&&(le=1),ae.morphAttributes.normal!==void 0&&(le=2),ae.morphAttributes.color!==void 0&&(le=3);let se,ce,Se,we;if(Y){const Hn=Do[Y];se=Hn.vertexShader,ce=Hn.fragmentShader}else se=k.vertexShader,ce=k.fragmentShader,l.update(k),Se=l.getVertexShaderID(k),we=l.getFragmentShaderID(k);const We=t.getRenderTarget(),Ee=ie.isInstancedMesh===!0,Ge=ie.isBatchedMesh===!0,$e=!!k.map,de=!!k.matcap,Z=!!B,Ve=!!k.aoMap,Le=!!k.lightMap,ne=!!k.bumpMap,Ce=!!k.normalMap,Xe=!!k.displacementMap,Ze=!!k.emissiveMap,Q=!!k.metalnessMap,W=!!k.roughnessMap,be=k.anisotropy>0,Ue=k.clearcoat>0,ze=k.dispersion>0,Fe=k.iridescence>0,bt=k.sheen>0,rt=k.transmission>0,ht=be&&!!k.anisotropyMap,Xt=Ue&&!!k.clearcoatMap,Ke=Ue&&!!k.clearcoatNormalMap,te=Ue&&!!k.clearcoatRoughnessMap,tt=Fe&&!!k.iridescenceMap,Mt=Fe&&!!k.iridescenceThicknessMap,vt=bt&&!!k.sheenColorMap,Zt=bt&&!!k.sheenRoughnessMap,fe=!!k.specularMap,qe=!!k.specularColorMap,ue=!!k.specularIntensityMap,Ye=rt&&!!k.transmissionMap,Re=rt&&!!k.thicknessMap,Be=!!k.gradientMap,at=!!k.alphaMap,pt=k.alphaTest>0,Jt=!!k.alphaHash,pn=!!k.extensions;let jn=Tl;k.toneMapped&&(We===null||We.isXRRenderTarget===!0)&&(jn=t.toneMapping);const en={shaderID:Y,shaderType:k.type,shaderName:k.name,vertexShader:se,fragmentShader:ce,defines:k.defines,customVertexShaderID:Se,customFragmentShaderID:we,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:b,batching:Ge,batchingColor:Ge&&ie._colorsTexture!==null,instancing:Ee,instancingColor:Ee&&ie.instanceColor!==null,instancingMorph:Ee&&ie.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:We===null?t.outputColorSpace:We.isXRRenderTarget===!0?We.texture.colorSpace:xi,alphaToCoverage:!!k.alphaToCoverage,map:$e,matcap:de,envMap:Z,envMapMode:Z&&B.mapping,envMapCubeUVHeight:J,aoMap:Ve,lightMap:Le,bumpMap:ne,normalMap:Ce,displacementMap:y&&Xe,emissiveMap:Ze,normalMapObjectSpace:Ce&&k.normalMapType===t6,normalMapTangentSpace:Ce&&k.normalMapType===au,metalnessMap:Q,roughnessMap:W,anisotropy:be,anisotropyMap:ht,clearcoat:Ue,clearcoatMap:Xt,clearcoatNormalMap:Ke,clearcoatRoughnessMap:te,dispersion:ze,iridescence:Fe,iridescenceMap:tt,iridescenceThicknessMap:Mt,sheen:bt,sheenColorMap:vt,sheenRoughnessMap:Zt,specularMap:fe,specularColorMap:qe,specularIntensityMap:ue,transmission:rt,transmissionMap:Ye,thicknessMap:Re,gradientMap:Be,opaque:k.transparent===!1&&k.blending===Ah&&k.alphaToCoverage===!1,alphaMap:at,alphaTest:pt,alphaHash:Jt,combine:k.combine,mapUv:$e&&w(k.map.channel),aoMapUv:Ve&&w(k.aoMap.channel),lightMapUv:Le&&w(k.lightMap.channel),bumpMapUv:ne&&w(k.bumpMap.channel),normalMapUv:Ce&&w(k.normalMap.channel),displacementMapUv:Xe&&w(k.displacementMap.channel),emissiveMapUv:Ze&&w(k.emissiveMap.channel),metalnessMapUv:Q&&w(k.metalnessMap.channel),roughnessMapUv:W&&w(k.roughnessMap.channel),anisotropyMapUv:ht&&w(k.anisotropyMap.channel),clearcoatMapUv:Xt&&w(k.clearcoatMap.channel),clearcoatNormalMapUv:Ke&&w(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:te&&w(k.clearcoatRoughnessMap.channel),iridescenceMapUv:tt&&w(k.iridescenceMap.channel),iridescenceThicknessMapUv:Mt&&w(k.iridescenceThicknessMap.channel),sheenColorMapUv:vt&&w(k.sheenColorMap.channel),sheenRoughnessMapUv:Zt&&w(k.sheenRoughnessMap.channel),specularMapUv:fe&&w(k.specularMap.channel),specularColorMapUv:qe&&w(k.specularColorMap.channel),specularIntensityMapUv:ue&&w(k.specularIntensityMap.channel),transmissionMapUv:Ye&&w(k.transmissionMap.channel),thicknessMapUv:Re&&w(k.thicknessMap.channel),alphaMapUv:at&&w(k.alphaMap.channel),vertexTangents:!!ae.attributes.tangent&&(Ce||be),vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!ae.attributes.color&&ae.attributes.color.itemSize===4,pointsUvs:ie.isPoints===!0&&!!ae.attributes.uv&&($e||at),fog:!!pe,useFog:k.fog===!0,fogExp2:!!pe&&pe.isFogExp2,flatShading:k.flatShading===!0,sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:p,skinning:ie.isSkinnedMesh===!0,morphTargets:ae.morphAttributes.position!==void 0,morphNormals:ae.morphAttributes.normal!==void 0,morphColors:ae.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:le,numDirLights:j.directional.length,numPointLights:j.point.length,numSpotLights:j.spot.length,numSpotLightMaps:j.spotLightMap.length,numRectAreaLights:j.rectArea.length,numHemiLights:j.hemi.length,numDirLightShadows:j.directionalShadowMap.length,numPointLightShadows:j.pointShadowMap.length,numSpotLightShadows:j.spotShadowMap.length,numSpotLightShadowsWithMaps:j.numSpotLightShadowsWithMaps,numLightProbes:j.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:k.dithering,shadowMapEnabled:t.shadowMap.enabled&&X.length>0,shadowMapType:t.shadowMap.type,toneMapping:jn,decodeVideoTexture:$e&&k.map.isVideoTexture===!0&&Nn.getTransfer(k.map.colorSpace)===er,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===ya,flipSided:k.side===as,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:pn&&k.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(pn&&k.extensions.multiDraw===!0||Ge)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:k.customProgramCacheKey()};return en.vertexUv1s=c.has(1),en.vertexUv2s=c.has(2),en.vertexUv3s=c.has(3),c.clear(),en}function M(k){const j=[];if(k.shaderID?j.push(k.shaderID):(j.push(k.customVertexShaderID),j.push(k.customFragmentShaderID)),k.defines!==void 0)for(const X in k.defines)j.push(X),j.push(k.defines[X]);return k.isRawShaderMaterial===!1&&(T(j,k),P(j,k),j.push(t.outputColorSpace)),j.push(k.customProgramCacheKey),j.join()}function T(k,j){k.push(j.precision),k.push(j.outputColorSpace),k.push(j.envMapMode),k.push(j.envMapCubeUVHeight),k.push(j.mapUv),k.push(j.alphaMapUv),k.push(j.lightMapUv),k.push(j.aoMapUv),k.push(j.bumpMapUv),k.push(j.normalMapUv),k.push(j.displacementMapUv),k.push(j.emissiveMapUv),k.push(j.metalnessMapUv),k.push(j.roughnessMapUv),k.push(j.anisotropyMapUv),k.push(j.clearcoatMapUv),k.push(j.clearcoatNormalMapUv),k.push(j.clearcoatRoughnessMapUv),k.push(j.iridescenceMapUv),k.push(j.iridescenceThicknessMapUv),k.push(j.sheenColorMapUv),k.push(j.sheenRoughnessMapUv),k.push(j.specularMapUv),k.push(j.specularColorMapUv),k.push(j.specularIntensityMapUv),k.push(j.transmissionMapUv),k.push(j.thicknessMapUv),k.push(j.combine),k.push(j.fogExp2),k.push(j.sizeAttenuation),k.push(j.morphTargetsCount),k.push(j.morphAttributeCount),k.push(j.numDirLights),k.push(j.numPointLights),k.push(j.numSpotLights),k.push(j.numSpotLightMaps),k.push(j.numHemiLights),k.push(j.numRectAreaLights),k.push(j.numDirLightShadows),k.push(j.numPointLightShadows),k.push(j.numSpotLightShadows),k.push(j.numSpotLightShadowsWithMaps),k.push(j.numLightProbes),k.push(j.shadowMapType),k.push(j.toneMapping),k.push(j.numClippingPlanes),k.push(j.numClipIntersection),k.push(j.depthPacking)}function P(k,j){o.disableAll(),j.supportsVertexTextures&&o.enable(0),j.instancing&&o.enable(1),j.instancingColor&&o.enable(2),j.instancingMorph&&o.enable(3),j.matcap&&o.enable(4),j.envMap&&o.enable(5),j.normalMapObjectSpace&&o.enable(6),j.normalMapTangentSpace&&o.enable(7),j.clearcoat&&o.enable(8),j.iridescence&&o.enable(9),j.alphaTest&&o.enable(10),j.vertexColors&&o.enable(11),j.vertexAlphas&&o.enable(12),j.vertexUv1s&&o.enable(13),j.vertexUv2s&&o.enable(14),j.vertexUv3s&&o.enable(15),j.vertexTangents&&o.enable(16),j.anisotropy&&o.enable(17),j.alphaHash&&o.enable(18),j.batching&&o.enable(19),j.dispersion&&o.enable(20),j.batchingColor&&o.enable(21),k.push(o.mask),o.disableAll(),j.fog&&o.enable(0),j.useFog&&o.enable(1),j.flatShading&&o.enable(2),j.logarithmicDepthBuffer&&o.enable(3),j.reverseDepthBuffer&&o.enable(4),j.skinning&&o.enable(5),j.morphTargets&&o.enable(6),j.morphNormals&&o.enable(7),j.morphColors&&o.enable(8),j.premultipliedAlpha&&o.enable(9),j.shadowMapEnabled&&o.enable(10),j.doubleSided&&o.enable(11),j.flipSided&&o.enable(12),j.useDepthPacking&&o.enable(13),j.dithering&&o.enable(14),j.transmission&&o.enable(15),j.sheen&&o.enable(16),j.opaque&&o.enable(17),j.pointsUvs&&o.enable(18),j.decodeVideoTexture&&o.enable(19),j.alphaToCoverage&&o.enable(20),k.push(o.mask)}function O(k){const j=S[k.type];let X;if(j){const ee=Do[j];X=TR.clone(ee.uniforms)}else X=k.uniforms;return X}function N(k,j){let X;for(let ee=0,ie=d.length;ee0?r.push(x):y.transparent===!0?i.push(x):n.push(x)}function l(f,p,y,b,S,w){const x=a(f,p,y,b,S,w);y.transmission>0?r.unshift(x):y.transparent===!0?i.unshift(x):n.unshift(x)}function c(f,p){n.length>1&&n.sort(f||Q0e),r.length>1&&r.sort(p||AD),i.length>1&&i.sort(p||AD)}function d(){for(let f=e,p=t.length;f=s.length?(a=new TD,s.push(a)):a=s[i],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function eye(){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 q,color:new ct};break;case"SpotLight":n={position:new q,direction:new q,color:new ct,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new q,color:new ct,distance:0,decay:0};break;case"HemisphereLight":n={direction:new q,skyColor:new ct,groundColor:new ct};break;case"RectAreaLight":n={color:new ct,position:new q,halfWidth:new q,halfHeight:new q};break}return t[e.id]=n,n}}}function tye(){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 nye=0;function rye(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function iye(t){const e=new eye,n=tye(),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 q);const i=new q,s=new Ct,a=new Ct;function o(c){let d=0,f=0,p=0;for(let V=0;V<9;V++)r.probe[V].set(0,0,0);let y=0,b=0,S=0,w=0,x=0,M=0,T=0,P=0,O=0,N=0,D=0;c.sort(rye);for(let V=0,k=c.length;V0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ft.LTC_FLOAT_1,r.rectAreaLTC2=ft.LTC_FLOAT_2):(r.rectAreaLTC1=ft.LTC_HALF_1,r.rectAreaLTC2=ft.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=p;const z=r.hash;(z.directionalLength!==y||z.pointLength!==b||z.spotLength!==S||z.rectAreaLength!==w||z.hemiLength!==x||z.numDirectionalShadows!==M||z.numPointShadows!==T||z.numSpotShadows!==P||z.numSpotMaps!==O||z.numLightProbes!==D)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=w,r.point.length=b,r.hemi.length=x,r.directionalShadow.length=M,r.directionalShadowMap.length=M,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=P,r.spotShadowMap.length=P,r.directionalShadowMatrix.length=M,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=P+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=D,z.directionalLength=y,z.pointLength=b,z.spotLength=S,z.rectAreaLength=w,z.hemiLength=x,z.numDirectionalShadows=M,z.numPointShadows=T,z.numSpotShadows=P,z.numSpotMaps=O,z.numLightProbes=D,r.version=nye++)}function l(c,d){let f=0,p=0,y=0,b=0,S=0;const w=d.matrixWorldInverse;for(let x=0,M=c.length;x=a.length?(o=new PD(t),a.push(o)):o=a[s],o}function r(){e=new WeakMap}return{get:n,dispose:r}}class RR extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=JV,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 NR extends Gr{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 aye=`void main() { gl_Position = vec4( position, 1.0 ); -}`,aye=`uniform sampler2D shadow_pass; +}`,oye=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -4417,12 +4422,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function oye(t,e,n){let r=new px;const i=new He,s=new He,a=new On,o=new RR({depthPacking:JV}),l=new NR,c={},d=n.maxTextureSize,f={[Ll]:as,[as]:Ll,[ya]:ya},p=new Ya({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new He},radius:{value:4}},vertexShader:sye,fragmentShader:aye}),y=p.clone();y.defines.HORIZONTAL_PASS=1;const b=new Yt;b.setAttribute("position",new Qt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new xr(b,p),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=BS;let x=this.type;this.render=function(N,D,z){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||N.length===0)return;const V=t.getRenderTarget(),k=t.getActiveCubeFace(),j=t.getActiveMipmapLevel(),X=t.state;X.setBlending(Vc),X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const ee=x!==Oo&&this.type===Oo,ie=x===Oo&&this.type!==Oo;for(let pe=0,ae=N.length;ped||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/J.x),i.x=s.x*J.x,B.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/J.y),i.y=s.y*J.y,B.mapSize.y=s.y)),B.map===null||ee===!0||ie===!0){const H=this.type!==Oo?{minFilter:ri,magFilter:ri}:{};B.map!==null&&B.map.dispose(),B.map=new Vo(i.x,i.y,H),B.map.texture.name=he.name+".shadowMap",B.camera.updateProjectionMatrix()}t.setRenderTarget(B.map),t.clear();const Y=B.getViewportCount();for(let H=0;H0||D.map&&D.alphaTest>0){const X=k.uuid,ee=D.uuid;let ie=c[X];ie===void 0&&(ie={},c[X]=ie);let pe=ie[ee];pe===void 0&&(pe=k.clone(),ie[ee]=pe,D.addEventListener("dispose",O)),k=pe}if(k.visible=D.visible,k.wireframe=D.wireframe,V===Oo?k.side=D.shadowSide!==null?D.shadowSide:D.side:k.side=D.shadowSide!==null?D.shadowSide:f[D.side],k.alphaMap=D.alphaMap,k.alphaTest=D.alphaTest,k.map=D.map,k.clipShadows=D.clipShadows,k.clippingPlanes=D.clippingPlanes,k.clipIntersection=D.clipIntersection,k.displacementMap=D.displacementMap,k.displacementScale=D.displacementScale,k.displacementBias=D.displacementBias,k.wireframeLinewidth=D.wireframeLinewidth,k.linewidth=D.linewidth,z.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const X=t.properties.get(k);X.light=z}return k}function P(N,D,z,V,k){if(N.visible===!1)return;if(N.layers.test(D.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&k===Oo)&&(!N.frustumCulled||r.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,N.matrixWorld);const ee=e.update(N),ie=N.material;if(Array.isArray(ie)){const pe=ee.groups;for(let ae=0,he=pe.length;ae=1):he.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(he)[1]),pe=ae>=2);let B=null,J={};const Y=t.getParameter(t.SCISSOR_BOX),H=t.getParameter(t.VIEWPORT),G=new On().fromArray(Y),le=new On().fromArray(H);function se(ue,Ye,Re,Be){const at=new Uint8Array(4),pt=t.createTexture();t.bindTexture(ue,pt),t.texParameteri(ue,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(ue,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Jt=0;Jte?(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 dye(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 fye(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function YP(t,e,n,r){const i=hye(r);switch(n){case pR:return t*e;case gR:return t*e;case vR:return t*e*2;case XS:return t*e/i.components*i.byteLength;case ux:return t*e/i.components*i.byteLength;case yR:return t*e*2/i.components*i.byteLength;case qS:return t*e*2/i.components*i.byteLength;case mR:return t*e*3/i.components*i.byteLength;case ss:return t*e*4/i.components*i.byteLength;case KS:return t*e*4/i.components*i.byteLength;case Z0:case Q0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case J0:case ey: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 P1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case ty:case C1:case R1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case xR: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 hye(t){switch(t){case Ho:case dR:return{byteLength:1,components:1};case kg:case fR:case rv:return{byteLength:2,components:1};case WS:case $S:return{byteLength:2,components:4};case Qc:case GS:case Qs:return{byteLength:4,components:1};case hR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const pye={contain:uye,cover:dye,fill:fye,getByteLength:YP};function mye(t,e,n,r,i,s,a){const o=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 p=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(Q,W){return y?new OffscreenCanvas(Q,W):Oy("canvas")}function S(Q,W,be){let Ue=1;const ze=Ze(Q);if((ze.width>be||ze.height>be)&&(Ue=be/Math.max(ze.width,ze.height)),Ue<1)if(typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Q instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Q instanceof ImageBitmap||typeof VideoFrame<"u"&&Q instanceof VideoFrame){const Fe=Math.floor(Ue*ze.width),bt=Math.floor(Ue*ze.height);f===void 0&&(f=b(Fe,bt));const rt=W?b(Fe,bt):f;return rt.width=Fe,rt.height=bt,rt.getContext("2d").drawImage(Q,0,0,Fe,bt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ze.width+"x"+ze.height+") to ("+Fe+"x"+bt+")."),rt}else return"data"in Q&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ze.width+"x"+ze.height+")."),Q;return Q}function w(Q){return Q.generateMipmaps&&Q.minFilter!==ri&&Q.minFilter!==Cr}function x(Q){t.generateMipmap(Q)}function M(Q,W,be,Ue,ze=!1){if(Q!==null){if(t[Q]!==void 0)return t[Q];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Q+"'")}let Fe=W;if(W===t.RED&&(be===t.FLOAT&&(Fe=t.R32F),be===t.HALF_FLOAT&&(Fe=t.R16F),be===t.UNSIGNED_BYTE&&(Fe=t.R8)),W===t.RED_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.R8UI),be===t.UNSIGNED_SHORT&&(Fe=t.R16UI),be===t.UNSIGNED_INT&&(Fe=t.R32UI),be===t.BYTE&&(Fe=t.R8I),be===t.SHORT&&(Fe=t.R16I),be===t.INT&&(Fe=t.R32I)),W===t.RG&&(be===t.FLOAT&&(Fe=t.RG32F),be===t.HALF_FLOAT&&(Fe=t.RG16F),be===t.UNSIGNED_BYTE&&(Fe=t.RG8)),W===t.RG_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.RG8UI),be===t.UNSIGNED_SHORT&&(Fe=t.RG16UI),be===t.UNSIGNED_INT&&(Fe=t.RG32UI),be===t.BYTE&&(Fe=t.RG8I),be===t.SHORT&&(Fe=t.RG16I),be===t.INT&&(Fe=t.RG32I)),W===t.RGB_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.RGB8UI),be===t.UNSIGNED_SHORT&&(Fe=t.RGB16UI),be===t.UNSIGNED_INT&&(Fe=t.RGB32UI),be===t.BYTE&&(Fe=t.RGB8I),be===t.SHORT&&(Fe=t.RGB16I),be===t.INT&&(Fe=t.RGB32I)),W===t.RGBA_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.RGBA8UI),be===t.UNSIGNED_SHORT&&(Fe=t.RGBA16UI),be===t.UNSIGNED_INT&&(Fe=t.RGBA32UI),be===t.BYTE&&(Fe=t.RGBA8I),be===t.SHORT&&(Fe=t.RGBA16I),be===t.INT&&(Fe=t.RGBA32I)),W===t.RGB&&be===t.UNSIGNED_INT_5_9_9_9_REV&&(Fe=t.RGB9_E5),W===t.RGBA){const bt=ze?Cy:Nn.getTransfer(Ue);be===t.FLOAT&&(Fe=t.RGBA32F),be===t.HALF_FLOAT&&(Fe=t.RGBA16F),be===t.UNSIGNED_BYTE&&(Fe=bt===er?t.SRGB8_ALPHA8:t.RGBA8),be===t.UNSIGNED_SHORT_4_4_4_4&&(Fe=t.RGBA4),be===t.UNSIGNED_SHORT_5_5_5_1&&(Fe=t.RGB5_A1)}return(Fe===t.R16F||Fe===t.R32F||Fe===t.RG16F||Fe===t.RG32F||Fe===t.RGBA16F||Fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Fe}function T(Q,W){let be;return Q?W===null||W===Qc||W===Bh?be=t.DEPTH24_STENCIL8:W===Qs?be=t.DEPTH32F_STENCIL8:W===kg&&(be=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):W===null||W===Qc||W===Bh?be=t.DEPTH_COMPONENT24:W===Qs?be=t.DEPTH_COMPONENT32F:W===kg&&(be=t.DEPTH_COMPONENT16),be}function P(Q,W){return w(Q)===!0||Q.isFramebufferTexture&&Q.minFilter!==ri&&Q.minFilter!==Cr?Math.log2(Math.max(W.width,W.height))+1:Q.mipmaps!==void 0&&Q.mipmaps.length>0?Q.mipmaps.length:Q.isCompressedTexture&&Array.isArray(Q.image)?W.mipmaps.length:1}function O(Q){const W=Q.target;W.removeEventListener("dispose",O),D(W),W.isVideoTexture&&d.delete(W)}function N(Q){const W=Q.target;W.removeEventListener("dispose",N),V(W)}function D(Q){const W=r.get(Q);if(W.__webglInit===void 0)return;const be=Q.source,Ue=p.get(be);if(Ue){const ze=Ue[W.__cacheKey];ze.usedTimes--,ze.usedTimes===0&&z(Q),Object.keys(Ue).length===0&&p.delete(be)}r.remove(Q)}function z(Q){const W=r.get(Q);t.deleteTexture(W.__webglTexture);const be=Q.source,Ue=p.get(be);delete Ue[W.__cacheKey],a.memory.textures--}function V(Q){const W=r.get(Q);if(Q.depthTexture&&Q.depthTexture.dispose(),Q.isWebGLCubeRenderTarget)for(let Ue=0;Ue<6;Ue++){if(Array.isArray(W.__webglFramebuffer[Ue]))for(let ze=0;ze=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Q+" texture units while this GPU supports only "+i.maxTextures),k+=1,Q}function ee(Q){const W=[];return W.push(Q.wrapS),W.push(Q.wrapT),W.push(Q.wrapR||0),W.push(Q.magFilter),W.push(Q.minFilter),W.push(Q.anisotropy),W.push(Q.internalFormat),W.push(Q.format),W.push(Q.type),W.push(Q.generateMipmaps),W.push(Q.premultiplyAlpha),W.push(Q.flipY),W.push(Q.unpackAlignment),W.push(Q.colorSpace),W.join()}function ie(Q,W){const be=r.get(Q);if(Q.isVideoTexture&&Ce(Q),Q.isRenderTargetTexture===!1&&Q.version>0&&be.__version!==Q.version){const Ue=Q.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{le(be,Q,W);return}}n.bindTexture(t.TEXTURE_2D,be.__webglTexture,t.TEXTURE0+W)}function pe(Q,W){const be=r.get(Q);if(Q.version>0&&be.__version!==Q.version){le(be,Q,W);return}n.bindTexture(t.TEXTURE_2D_ARRAY,be.__webglTexture,t.TEXTURE0+W)}function ae(Q,W){const be=r.get(Q);if(Q.version>0&&be.__version!==Q.version){le(be,Q,W);return}n.bindTexture(t.TEXTURE_3D,be.__webglTexture,t.TEXTURE0+W)}function he(Q,W){const be=r.get(Q);if(Q.version>0&&be.__version!==Q.version){se(be,Q,W);return}n.bindTexture(t.TEXTURE_CUBE_MAP,be.__webglTexture,t.TEXTURE0+W)}const B={[Rd]:t.REPEAT,[ba]:t.CLAMP_TO_EDGE,[Ig]:t.MIRRORED_REPEAT},J={[ri]:t.NEAREST,[VS]:t.NEAREST_MIPMAP_NEAREST,[oh]:t.NEAREST_MIPMAP_LINEAR,[Cr]:t.LINEAR,[ng]:t.LINEAR_MIPMAP_NEAREST,[$a]:t.LINEAR_MIPMAP_LINEAR},Y={[t6]:t.NEVER,[o6]:t.ALWAYS,[n6]:t.LESS,[wR]:t.LEQUAL,[r6]:t.EQUAL,[a6]:t.GEQUAL,[i6]:t.GREATER,[s6]:t.NOTEQUAL};function H(Q,W){if(W.type===Qs&&e.has("OES_texture_float_linear")===!1&&(W.magFilter===Cr||W.magFilter===ng||W.magFilter===oh||W.magFilter===$a||W.minFilter===Cr||W.minFilter===ng||W.minFilter===oh||W.minFilter===$a)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(Q,t.TEXTURE_WRAP_S,B[W.wrapS]),t.texParameteri(Q,t.TEXTURE_WRAP_T,B[W.wrapT]),(Q===t.TEXTURE_3D||Q===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Q,t.TEXTURE_WRAP_R,B[W.wrapR]),t.texParameteri(Q,t.TEXTURE_MAG_FILTER,J[W.magFilter]),t.texParameteri(Q,t.TEXTURE_MIN_FILTER,J[W.minFilter]),W.compareFunction&&(t.texParameteri(Q,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(Q,t.TEXTURE_COMPARE_FUNC,Y[W.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(W.magFilter===ri||W.minFilter!==oh&&W.minFilter!==$a||W.type===Qs&&e.has("OES_texture_float_linear")===!1)return;if(W.anisotropy>1||r.get(W).__currentAnisotropy){const be=e.get("EXT_texture_filter_anisotropic");t.texParameterf(Q,be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(W.anisotropy,i.getMaxAnisotropy())),r.get(W).__currentAnisotropy=W.anisotropy}}}function G(Q,W){let be=!1;Q.__webglInit===void 0&&(Q.__webglInit=!0,W.addEventListener("dispose",O));const Ue=W.source;let ze=p.get(Ue);ze===void 0&&(ze={},p.set(Ue,ze));const Fe=ee(W);if(Fe!==Q.__cacheKey){ze[Fe]===void 0&&(ze[Fe]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,be=!0),ze[Fe].usedTimes++;const bt=ze[Q.__cacheKey];bt!==void 0&&(ze[Q.__cacheKey].usedTimes--,bt.usedTimes===0&&z(W)),Q.__cacheKey=Fe,Q.__webglTexture=ze[Fe].texture}return be}function le(Q,W,be){let Ue=t.TEXTURE_2D;(W.isDataArrayTexture||W.isCompressedArrayTexture)&&(Ue=t.TEXTURE_2D_ARRAY),W.isData3DTexture&&(Ue=t.TEXTURE_3D);const ze=G(Q,W),Fe=W.source;n.bindTexture(Ue,Q.__webglTexture,t.TEXTURE0+be);const bt=r.get(Fe);if(Fe.version!==bt.__version||ze===!0){n.activeTexture(t.TEXTURE0+be);const rt=Nn.getPrimaries(Nn.workingColorSpace),ht=W.colorSpace===Oc?null:Nn.getPrimaries(W.colorSpace),Xt=W.colorSpace===Oc||rt===ht?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,W.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,W.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Xt);let Ke=S(W.image,!1,i.maxTextureSize);Ke=qe(W,Ke);const te=s.convert(W.format,W.colorSpace),tt=s.convert(W.type);let Mt=M(W.internalFormat,te,tt,W.colorSpace,W.isVideoTexture);H(Ue,W);let vt;const Zt=W.mipmaps,fe=W.isVideoTexture!==!0,Xe=bt.__version===void 0||ze===!0,ue=Fe.dataReady,Ye=P(W,Ke);if(W.isDepthTexture)Mt=T(W.format===Hh,W.type),Xe&&(fe?n.texStorage2D(t.TEXTURE_2D,1,Mt,Ke.width,Ke.height):n.texImage2D(t.TEXTURE_2D,0,Mt,Ke.width,Ke.height,0,te,tt,null));else if(W.isDataTexture)if(Zt.length>0){fe&&Xe&&n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Zt[0].width,Zt[0].height);for(let Re=0,Be=Zt.length;Re0){const at=YP(vt.width,vt.height,W.format,W.type);for(const pt of W.layerUpdates){const Jt=vt.data.subarray(pt*at/vt.data.BYTES_PER_ELEMENT,(pt+1)*at/vt.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,pt,vt.width,vt.height,1,te,Jt,0,0)}W.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,vt.width,vt.height,Ke.depth,te,vt.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Re,Mt,vt.width,vt.height,Ke.depth,0,vt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else fe?ue&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,vt.width,vt.height,Ke.depth,te,tt,vt.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Re,Mt,vt.width,vt.height,Ke.depth,0,te,tt,vt.data)}else{fe&&Xe&&n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Zt[0].width,Zt[0].height);for(let Re=0,Be=Zt.length;Re0){const Re=YP(Ke.width,Ke.height,W.format,W.type);for(const Be of W.layerUpdates){const at=Ke.data.subarray(Be*Re/Ke.data.BYTES_PER_ELEMENT,(Be+1)*Re/Ke.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Be,Ke.width,Ke.height,1,te,tt,at)}W.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ke.width,Ke.height,Ke.depth,te,tt,Ke.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Mt,Ke.width,Ke.height,Ke.depth,0,te,tt,Ke.data);else if(W.isData3DTexture)fe?(Xe&&n.texStorage3D(t.TEXTURE_3D,Ye,Mt,Ke.width,Ke.height,Ke.depth),ue&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ke.width,Ke.height,Ke.depth,te,tt,Ke.data)):n.texImage3D(t.TEXTURE_3D,0,Mt,Ke.width,Ke.height,Ke.depth,0,te,tt,Ke.data);else if(W.isFramebufferTexture){if(Xe)if(fe)n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Ke.width,Ke.height);else{let Re=Ke.width,Be=Ke.height;for(let at=0;at>=1,Be>>=1}}else if(Zt.length>0){if(fe&&Xe){const Re=Ze(Zt[0]);n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Re.width,Re.height)}for(let Re=0,Be=Zt.length;Re0&&Ye++;const Be=Ze(te[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Ye,Zt,Be.width,Be.height)}for(let Be=0;Be<6;Be++)if(Ke){fe?ue&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,0,0,te[Be].width,te[Be].height,Mt,vt,te[Be].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,Zt,te[Be].width,te[Be].height,0,Mt,vt,te[Be].data);for(let at=0;at>Fe),te=Math.max(1,W.height>>Fe);ze===t.TEXTURE_3D||ze===t.TEXTURE_2D_ARRAY?n.texImage3D(ze,Fe,ht,Ke,te,W.depth,0,bt,rt,null):n.texImage2D(ze,Fe,ht,Ke,te,0,bt,rt,null)}n.bindFramebuffer(t.FRAMEBUFFER,Q),ne(W)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Ue,ze,r.get(be).__webglTexture,0,Le(W)):(ze===t.TEXTURE_2D||ze>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&ze<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Ue,ze,r.get(be).__webglTexture,Fe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Se(Q,W,be){if(t.bindRenderbuffer(t.RENDERBUFFER,Q),W.depthBuffer){const Ue=W.depthTexture,ze=Ue&&Ue.isDepthTexture?Ue.type:null,Fe=T(W.stencilBuffer,ze),bt=W.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,rt=Le(W);ne(W)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,Fe,W.width,W.height):be?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,Fe,W.width,W.height):t.renderbufferStorage(t.RENDERBUFFER,Fe,W.width,W.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,bt,t.RENDERBUFFER,Q)}else{const Ue=W.textures;for(let ze=0;ze{delete W.__boundDepthTexture,delete W.__depthDisposeCallback,Ue.removeEventListener("dispose",ze)};Ue.addEventListener("dispose",ze),W.__depthDisposeCallback=ze}W.__boundDepthTexture=Ue}if(Q.depthTexture&&!W.__autoAllocateDepthBuffer){if(be)throw new Error("target.depthTexture not supported in Cube render targets");we(W.__webglFramebuffer,Q)}else if(be){W.__webglDepthbuffer=[];for(let Ue=0;Ue<6;Ue++)if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer[Ue]),W.__webglDepthbuffer[Ue]===void 0)W.__webglDepthbuffer[Ue]=t.createRenderbuffer(),Se(W.__webglDepthbuffer[Ue],Q,!1);else{const ze=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Fe=W.__webglDepthbuffer[Ue];t.bindRenderbuffer(t.RENDERBUFFER,Fe),t.framebufferRenderbuffer(t.FRAMEBUFFER,ze,t.RENDERBUFFER,Fe)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer),W.__webglDepthbuffer===void 0)W.__webglDepthbuffer=t.createRenderbuffer(),Se(W.__webglDepthbuffer,Q,!1);else{const Ue=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ze=W.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ze),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ue,t.RENDERBUFFER,ze)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Ee(Q,W,be){const Ue=r.get(Q);W!==void 0&&ce(Ue.__webglFramebuffer,Q,Q.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),be!==void 0&&We(Q)}function Ge(Q){const W=Q.texture,be=r.get(Q),Ue=r.get(W);Q.addEventListener("dispose",N);const ze=Q.textures,Fe=Q.isWebGLCubeRenderTarget===!0,bt=ze.length>1;if(bt||(Ue.__webglTexture===void 0&&(Ue.__webglTexture=t.createTexture()),Ue.__version=W.version,a.memory.textures++),Fe){be.__webglFramebuffer=[];for(let rt=0;rt<6;rt++)if(W.mipmaps&&W.mipmaps.length>0){be.__webglFramebuffer[rt]=[];for(let ht=0;ht0){be.__webglFramebuffer=[];for(let rt=0;rt0&&ne(Q)===!1){be.__webglMultisampledFramebuffer=t.createFramebuffer(),be.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,be.__webglMultisampledFramebuffer);for(let rt=0;rt0)for(let ht=0;ht0)for(let ht=0;ht0){if(ne(Q)===!1){const W=Q.textures,be=Q.width,Ue=Q.height;let ze=t.COLOR_BUFFER_BIT;const Fe=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,bt=r.get(Q),rt=W.length>1;if(rt)for(let ht=0;ht0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&W.__useRenderToTexture!==!1}function Ce(Q){const W=a.render.frame;d.get(Q)!==W&&(d.set(Q,W),Q.update())}function qe(Q,W){const be=Q.colorSpace,Ue=Q.format,ze=Q.type;return Q.isCompressedTexture===!0||Q.isVideoTexture===!0||be!==xi&&be!==Oc&&(Nn.getTransfer(be)===er?(Ue!==ss||ze!==Ho)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",be)),W}function Ze(Q){return typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement?(c.width=Q.naturalWidth||Q.width,c.height=Q.naturalHeight||Q.height):typeof VideoFrame<"u"&&Q instanceof VideoFrame?(c.width=Q.displayWidth,c.height=Q.displayHeight):(c.width=Q.width,c.height=Q.height),c}this.allocateTextureUnit=X,this.resetTextureUnits=j,this.setTexture2D=ie,this.setTexture2DArray=pe,this.setTexture3D=ae,this.setTextureCube=he,this.rebindTextures=Ee,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=$e,this.updateMultisampleRenderTarget=Ve,this.setupDepthRenderbuffer=We,this.setupFrameBufferTexture=ce,this.useMultisampledRTT=ne}function w6(t,e){function n(r,i=Oc){let s;const a=Nn.getTransfer(i);if(r===Ho)return t.UNSIGNED_BYTE;if(r===WS)return t.UNSIGNED_SHORT_4_4_4_4;if(r===$S)return t.UNSIGNED_SHORT_5_5_5_1;if(r===hR)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===dR)return t.BYTE;if(r===fR)return t.SHORT;if(r===kg)return t.UNSIGNED_SHORT;if(r===GS)return t.INT;if(r===Qc)return t.UNSIGNED_INT;if(r===Qs)return t.FLOAT;if(r===rv)return t.HALF_FLOAT;if(r===pR)return t.ALPHA;if(r===mR)return t.RGB;if(r===ss)return t.RGBA;if(r===gR)return t.LUMINANCE;if(r===vR)return t.LUMINANCE_ALPHA;if(r===Th)return t.DEPTH_COMPONENT;if(r===Hh)return t.DEPTH_STENCIL;if(r===XS)return t.RED;if(r===ux)return t.RED_INTEGER;if(r===yR)return t.RG;if(r===qS)return t.RG_INTEGER;if(r===KS)return t.RGBA_INTEGER;if(r===Z0||r===Q0||r===J0||r===ey)if(a===er)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Z0)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===J0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===ey)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Z0)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===J0)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===ey)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 a===er?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===p1)return a===er?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===P1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===m1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===g1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===v1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===y1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===x1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===b1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===_1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===w1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===S1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===M1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===E1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===A1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===T1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===P1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===ty||r===C1||r===R1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===ty)return a===er?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===C1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===R1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===xR||r===N1||r===I1||r===k1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===ty)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===Bh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class S6 extends Pr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends mn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const gye={type:"move"};class wA{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ts,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 Ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new q),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,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const S of e.hand.values()){const w=n.getJointPose(S,r),x=this._getHandJoint(c,S);w!==null&&(x.matrix.fromArray(w.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=w.radius),x.visible=w!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=d.position.distanceTo(f.position),y=.02,b=.005;c.inputState.pinching&&p>y+b?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=y-b&&(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));o!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(gye)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Ts;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const vye=` +}`;function lye(t,e,n){let r=new px;const i=new He,s=new He,a=new On,o=new RR({depthPacking:e6}),l=new NR,c={},d=n.maxTextureSize,f={[Ll]:as,[as]:Ll,[ya]:ya},p=new Ya({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new He},radius:{value:4}},vertexShader:aye,fragmentShader:oye}),y=p.clone();y.defines.HORIZONTAL_PASS=1;const b=new Yt;b.setAttribute("position",new Qt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new xr(b,p),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=BS;let x=this.type;this.render=function(N,D,z){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||N.length===0)return;const V=t.getRenderTarget(),k=t.getActiveCubeFace(),j=t.getActiveMipmapLevel(),X=t.state;X.setBlending(Vc),X.buffers.color.setClear(1,1,1,1),X.buffers.depth.setTest(!0),X.setScissorTest(!1);const ee=x!==Oo&&this.type===Oo,ie=x===Oo&&this.type!==Oo;for(let pe=0,ae=N.length;ped||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/J.x),i.x=s.x*J.x,B.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/J.y),i.y=s.y*J.y,B.mapSize.y=s.y)),B.map===null||ee===!0||ie===!0){const H=this.type!==Oo?{minFilter:ri,magFilter:ri}:{};B.map!==null&&B.map.dispose(),B.map=new Vo(i.x,i.y,H),B.map.texture.name=he.name+".shadowMap",B.camera.updateProjectionMatrix()}t.setRenderTarget(B.map),t.clear();const Y=B.getViewportCount();for(let H=0;H0||D.map&&D.alphaTest>0){const X=k.uuid,ee=D.uuid;let ie=c[X];ie===void 0&&(ie={},c[X]=ie);let pe=ie[ee];pe===void 0&&(pe=k.clone(),ie[ee]=pe,D.addEventListener("dispose",O)),k=pe}if(k.visible=D.visible,k.wireframe=D.wireframe,V===Oo?k.side=D.shadowSide!==null?D.shadowSide:D.side:k.side=D.shadowSide!==null?D.shadowSide:f[D.side],k.alphaMap=D.alphaMap,k.alphaTest=D.alphaTest,k.map=D.map,k.clipShadows=D.clipShadows,k.clippingPlanes=D.clippingPlanes,k.clipIntersection=D.clipIntersection,k.displacementMap=D.displacementMap,k.displacementScale=D.displacementScale,k.displacementBias=D.displacementBias,k.wireframeLinewidth=D.wireframeLinewidth,k.linewidth=D.linewidth,z.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const X=t.properties.get(k);X.light=z}return k}function P(N,D,z,V,k){if(N.visible===!1)return;if(N.layers.test(D.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&k===Oo)&&(!N.frustumCulled||r.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(z.matrixWorldInverse,N.matrixWorld);const ee=e.update(N),ie=N.material;if(Array.isArray(ie)){const pe=ee.groups;for(let ae=0,he=pe.length;ae=1):he.indexOf("OpenGL ES")!==-1&&(ae=parseFloat(/^OpenGL ES (\d)/.exec(he)[1]),pe=ae>=2);let B=null,J={};const Y=t.getParameter(t.SCISSOR_BOX),H=t.getParameter(t.VIEWPORT),G=new On().fromArray(Y),le=new On().fromArray(H);function se(ue,Ye,Re,Be){const at=new Uint8Array(4),pt=t.createTexture();t.bindTexture(ue,pt),t.texParameteri(ue,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(ue,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Jt=0;Jte?(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 fye(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 hye(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function YP(t,e,n,r){const i=pye(r);switch(n){case pR:return t*e;case gR:return t*e;case vR:return t*e*2;case XS:return t*e/i.components*i.byteLength;case ux:return t*e/i.components*i.byteLength;case yR:return t*e*2/i.components*i.byteLength;case qS:return t*e*2/i.components*i.byteLength;case mR:return t*e*3/i.components*i.byteLength;case ss:return t*e*4/i.components*i.byteLength;case KS:return t*e*4/i.components*i.byteLength;case Z0:case Q0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case J0:case ey: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 P1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case ty:case C1:case R1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case xR: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 pye(t){switch(t){case Ho:case dR:return{byteLength:1,components:1};case kg:case fR:case rv:return{byteLength:2,components:1};case WS:case $S:return{byteLength:2,components:4};case Qc:case GS:case Qs:return{byteLength:4,components:1};case hR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const mye={contain:dye,cover:fye,fill:hye,getByteLength:YP};function gye(t,e,n,r,i,s,a){const o=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 p=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(Q,W){return y?new OffscreenCanvas(Q,W):Oy("canvas")}function S(Q,W,be){let Ue=1;const ze=Ze(Q);if((ze.width>be||ze.height>be)&&(Ue=be/Math.max(ze.width,ze.height)),Ue<1)if(typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Q instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Q instanceof ImageBitmap||typeof VideoFrame<"u"&&Q instanceof VideoFrame){const Fe=Math.floor(Ue*ze.width),bt=Math.floor(Ue*ze.height);f===void 0&&(f=b(Fe,bt));const rt=W?b(Fe,bt):f;return rt.width=Fe,rt.height=bt,rt.getContext("2d").drawImage(Q,0,0,Fe,bt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+ze.width+"x"+ze.height+") to ("+Fe+"x"+bt+")."),rt}else return"data"in Q&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+ze.width+"x"+ze.height+")."),Q;return Q}function w(Q){return Q.generateMipmaps&&Q.minFilter!==ri&&Q.minFilter!==Cr}function x(Q){t.generateMipmap(Q)}function M(Q,W,be,Ue,ze=!1){if(Q!==null){if(t[Q]!==void 0)return t[Q];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Q+"'")}let Fe=W;if(W===t.RED&&(be===t.FLOAT&&(Fe=t.R32F),be===t.HALF_FLOAT&&(Fe=t.R16F),be===t.UNSIGNED_BYTE&&(Fe=t.R8)),W===t.RED_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.R8UI),be===t.UNSIGNED_SHORT&&(Fe=t.R16UI),be===t.UNSIGNED_INT&&(Fe=t.R32UI),be===t.BYTE&&(Fe=t.R8I),be===t.SHORT&&(Fe=t.R16I),be===t.INT&&(Fe=t.R32I)),W===t.RG&&(be===t.FLOAT&&(Fe=t.RG32F),be===t.HALF_FLOAT&&(Fe=t.RG16F),be===t.UNSIGNED_BYTE&&(Fe=t.RG8)),W===t.RG_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.RG8UI),be===t.UNSIGNED_SHORT&&(Fe=t.RG16UI),be===t.UNSIGNED_INT&&(Fe=t.RG32UI),be===t.BYTE&&(Fe=t.RG8I),be===t.SHORT&&(Fe=t.RG16I),be===t.INT&&(Fe=t.RG32I)),W===t.RGB_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.RGB8UI),be===t.UNSIGNED_SHORT&&(Fe=t.RGB16UI),be===t.UNSIGNED_INT&&(Fe=t.RGB32UI),be===t.BYTE&&(Fe=t.RGB8I),be===t.SHORT&&(Fe=t.RGB16I),be===t.INT&&(Fe=t.RGB32I)),W===t.RGBA_INTEGER&&(be===t.UNSIGNED_BYTE&&(Fe=t.RGBA8UI),be===t.UNSIGNED_SHORT&&(Fe=t.RGBA16UI),be===t.UNSIGNED_INT&&(Fe=t.RGBA32UI),be===t.BYTE&&(Fe=t.RGBA8I),be===t.SHORT&&(Fe=t.RGBA16I),be===t.INT&&(Fe=t.RGBA32I)),W===t.RGB&&be===t.UNSIGNED_INT_5_9_9_9_REV&&(Fe=t.RGB9_E5),W===t.RGBA){const bt=ze?Cy:Nn.getTransfer(Ue);be===t.FLOAT&&(Fe=t.RGBA32F),be===t.HALF_FLOAT&&(Fe=t.RGBA16F),be===t.UNSIGNED_BYTE&&(Fe=bt===er?t.SRGB8_ALPHA8:t.RGBA8),be===t.UNSIGNED_SHORT_4_4_4_4&&(Fe=t.RGBA4),be===t.UNSIGNED_SHORT_5_5_5_1&&(Fe=t.RGB5_A1)}return(Fe===t.R16F||Fe===t.R32F||Fe===t.RG16F||Fe===t.RG32F||Fe===t.RGBA16F||Fe===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Fe}function T(Q,W){let be;return Q?W===null||W===Qc||W===Bh?be=t.DEPTH24_STENCIL8:W===Qs?be=t.DEPTH32F_STENCIL8:W===kg&&(be=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):W===null||W===Qc||W===Bh?be=t.DEPTH_COMPONENT24:W===Qs?be=t.DEPTH_COMPONENT32F:W===kg&&(be=t.DEPTH_COMPONENT16),be}function P(Q,W){return w(Q)===!0||Q.isFramebufferTexture&&Q.minFilter!==ri&&Q.minFilter!==Cr?Math.log2(Math.max(W.width,W.height))+1:Q.mipmaps!==void 0&&Q.mipmaps.length>0?Q.mipmaps.length:Q.isCompressedTexture&&Array.isArray(Q.image)?W.mipmaps.length:1}function O(Q){const W=Q.target;W.removeEventListener("dispose",O),D(W),W.isVideoTexture&&d.delete(W)}function N(Q){const W=Q.target;W.removeEventListener("dispose",N),V(W)}function D(Q){const W=r.get(Q);if(W.__webglInit===void 0)return;const be=Q.source,Ue=p.get(be);if(Ue){const ze=Ue[W.__cacheKey];ze.usedTimes--,ze.usedTimes===0&&z(Q),Object.keys(Ue).length===0&&p.delete(be)}r.remove(Q)}function z(Q){const W=r.get(Q);t.deleteTexture(W.__webglTexture);const be=Q.source,Ue=p.get(be);delete Ue[W.__cacheKey],a.memory.textures--}function V(Q){const W=r.get(Q);if(Q.depthTexture&&Q.depthTexture.dispose(),Q.isWebGLCubeRenderTarget)for(let Ue=0;Ue<6;Ue++){if(Array.isArray(W.__webglFramebuffer[Ue]))for(let ze=0;ze=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Q+" texture units while this GPU supports only "+i.maxTextures),k+=1,Q}function ee(Q){const W=[];return W.push(Q.wrapS),W.push(Q.wrapT),W.push(Q.wrapR||0),W.push(Q.magFilter),W.push(Q.minFilter),W.push(Q.anisotropy),W.push(Q.internalFormat),W.push(Q.format),W.push(Q.type),W.push(Q.generateMipmaps),W.push(Q.premultiplyAlpha),W.push(Q.flipY),W.push(Q.unpackAlignment),W.push(Q.colorSpace),W.join()}function ie(Q,W){const be=r.get(Q);if(Q.isVideoTexture&&Ce(Q),Q.isRenderTargetTexture===!1&&Q.version>0&&be.__version!==Q.version){const Ue=Q.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{le(be,Q,W);return}}n.bindTexture(t.TEXTURE_2D,be.__webglTexture,t.TEXTURE0+W)}function pe(Q,W){const be=r.get(Q);if(Q.version>0&&be.__version!==Q.version){le(be,Q,W);return}n.bindTexture(t.TEXTURE_2D_ARRAY,be.__webglTexture,t.TEXTURE0+W)}function ae(Q,W){const be=r.get(Q);if(Q.version>0&&be.__version!==Q.version){le(be,Q,W);return}n.bindTexture(t.TEXTURE_3D,be.__webglTexture,t.TEXTURE0+W)}function he(Q,W){const be=r.get(Q);if(Q.version>0&&be.__version!==Q.version){se(be,Q,W);return}n.bindTexture(t.TEXTURE_CUBE_MAP,be.__webglTexture,t.TEXTURE0+W)}const B={[Rd]:t.REPEAT,[ba]:t.CLAMP_TO_EDGE,[Ig]:t.MIRRORED_REPEAT},J={[ri]:t.NEAREST,[VS]:t.NEAREST_MIPMAP_NEAREST,[oh]:t.NEAREST_MIPMAP_LINEAR,[Cr]:t.LINEAR,[ng]:t.LINEAR_MIPMAP_NEAREST,[$a]:t.LINEAR_MIPMAP_LINEAR},Y={[n6]:t.NEVER,[l6]:t.ALWAYS,[r6]:t.LESS,[wR]:t.LEQUAL,[i6]:t.EQUAL,[o6]:t.GEQUAL,[s6]:t.GREATER,[a6]:t.NOTEQUAL};function H(Q,W){if(W.type===Qs&&e.has("OES_texture_float_linear")===!1&&(W.magFilter===Cr||W.magFilter===ng||W.magFilter===oh||W.magFilter===$a||W.minFilter===Cr||W.minFilter===ng||W.minFilter===oh||W.minFilter===$a)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(Q,t.TEXTURE_WRAP_S,B[W.wrapS]),t.texParameteri(Q,t.TEXTURE_WRAP_T,B[W.wrapT]),(Q===t.TEXTURE_3D||Q===t.TEXTURE_2D_ARRAY)&&t.texParameteri(Q,t.TEXTURE_WRAP_R,B[W.wrapR]),t.texParameteri(Q,t.TEXTURE_MAG_FILTER,J[W.magFilter]),t.texParameteri(Q,t.TEXTURE_MIN_FILTER,J[W.minFilter]),W.compareFunction&&(t.texParameteri(Q,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(Q,t.TEXTURE_COMPARE_FUNC,Y[W.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(W.magFilter===ri||W.minFilter!==oh&&W.minFilter!==$a||W.type===Qs&&e.has("OES_texture_float_linear")===!1)return;if(W.anisotropy>1||r.get(W).__currentAnisotropy){const be=e.get("EXT_texture_filter_anisotropic");t.texParameterf(Q,be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(W.anisotropy,i.getMaxAnisotropy())),r.get(W).__currentAnisotropy=W.anisotropy}}}function G(Q,W){let be=!1;Q.__webglInit===void 0&&(Q.__webglInit=!0,W.addEventListener("dispose",O));const Ue=W.source;let ze=p.get(Ue);ze===void 0&&(ze={},p.set(Ue,ze));const Fe=ee(W);if(Fe!==Q.__cacheKey){ze[Fe]===void 0&&(ze[Fe]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,be=!0),ze[Fe].usedTimes++;const bt=ze[Q.__cacheKey];bt!==void 0&&(ze[Q.__cacheKey].usedTimes--,bt.usedTimes===0&&z(W)),Q.__cacheKey=Fe,Q.__webglTexture=ze[Fe].texture}return be}function le(Q,W,be){let Ue=t.TEXTURE_2D;(W.isDataArrayTexture||W.isCompressedArrayTexture)&&(Ue=t.TEXTURE_2D_ARRAY),W.isData3DTexture&&(Ue=t.TEXTURE_3D);const ze=G(Q,W),Fe=W.source;n.bindTexture(Ue,Q.__webglTexture,t.TEXTURE0+be);const bt=r.get(Fe);if(Fe.version!==bt.__version||ze===!0){n.activeTexture(t.TEXTURE0+be);const rt=Nn.getPrimaries(Nn.workingColorSpace),ht=W.colorSpace===Oc?null:Nn.getPrimaries(W.colorSpace),Xt=W.colorSpace===Oc||rt===ht?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,W.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,W.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Xt);let Ke=S(W.image,!1,i.maxTextureSize);Ke=Xe(W,Ke);const te=s.convert(W.format,W.colorSpace),tt=s.convert(W.type);let Mt=M(W.internalFormat,te,tt,W.colorSpace,W.isVideoTexture);H(Ue,W);let vt;const Zt=W.mipmaps,fe=W.isVideoTexture!==!0,qe=bt.__version===void 0||ze===!0,ue=Fe.dataReady,Ye=P(W,Ke);if(W.isDepthTexture)Mt=T(W.format===Hh,W.type),qe&&(fe?n.texStorage2D(t.TEXTURE_2D,1,Mt,Ke.width,Ke.height):n.texImage2D(t.TEXTURE_2D,0,Mt,Ke.width,Ke.height,0,te,tt,null));else if(W.isDataTexture)if(Zt.length>0){fe&&qe&&n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Zt[0].width,Zt[0].height);for(let Re=0,Be=Zt.length;Re0){const at=YP(vt.width,vt.height,W.format,W.type);for(const pt of W.layerUpdates){const Jt=vt.data.subarray(pt*at/vt.data.BYTES_PER_ELEMENT,(pt+1)*at/vt.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,pt,vt.width,vt.height,1,te,Jt,0,0)}W.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,vt.width,vt.height,Ke.depth,te,vt.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Re,Mt,vt.width,vt.height,Ke.depth,0,vt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else fe?ue&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Re,0,0,0,vt.width,vt.height,Ke.depth,te,tt,vt.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Re,Mt,vt.width,vt.height,Ke.depth,0,te,tt,vt.data)}else{fe&&qe&&n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Zt[0].width,Zt[0].height);for(let Re=0,Be=Zt.length;Re0){const Re=YP(Ke.width,Ke.height,W.format,W.type);for(const Be of W.layerUpdates){const at=Ke.data.subarray(Be*Re/Ke.data.BYTES_PER_ELEMENT,(Be+1)*Re/Ke.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Be,Ke.width,Ke.height,1,te,tt,at)}W.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ke.width,Ke.height,Ke.depth,te,tt,Ke.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Mt,Ke.width,Ke.height,Ke.depth,0,te,tt,Ke.data);else if(W.isData3DTexture)fe?(qe&&n.texStorage3D(t.TEXTURE_3D,Ye,Mt,Ke.width,Ke.height,Ke.depth),ue&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ke.width,Ke.height,Ke.depth,te,tt,Ke.data)):n.texImage3D(t.TEXTURE_3D,0,Mt,Ke.width,Ke.height,Ke.depth,0,te,tt,Ke.data);else if(W.isFramebufferTexture){if(qe)if(fe)n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Ke.width,Ke.height);else{let Re=Ke.width,Be=Ke.height;for(let at=0;at>=1,Be>>=1}}else if(Zt.length>0){if(fe&&qe){const Re=Ze(Zt[0]);n.texStorage2D(t.TEXTURE_2D,Ye,Mt,Re.width,Re.height)}for(let Re=0,Be=Zt.length;Re0&&Ye++;const Be=Ze(te[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Ye,Zt,Be.width,Be.height)}for(let Be=0;Be<6;Be++)if(Ke){fe?ue&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,0,0,te[Be].width,te[Be].height,Mt,vt,te[Be].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Be,0,Zt,te[Be].width,te[Be].height,0,Mt,vt,te[Be].data);for(let at=0;at>Fe),te=Math.max(1,W.height>>Fe);ze===t.TEXTURE_3D||ze===t.TEXTURE_2D_ARRAY?n.texImage3D(ze,Fe,ht,Ke,te,W.depth,0,bt,rt,null):n.texImage2D(ze,Fe,ht,Ke,te,0,bt,rt,null)}n.bindFramebuffer(t.FRAMEBUFFER,Q),ne(W)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Ue,ze,r.get(be).__webglTexture,0,Le(W)):(ze===t.TEXTURE_2D||ze>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&ze<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Ue,ze,r.get(be).__webglTexture,Fe),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Se(Q,W,be){if(t.bindRenderbuffer(t.RENDERBUFFER,Q),W.depthBuffer){const Ue=W.depthTexture,ze=Ue&&Ue.isDepthTexture?Ue.type:null,Fe=T(W.stencilBuffer,ze),bt=W.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,rt=Le(W);ne(W)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,Fe,W.width,W.height):be?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,Fe,W.width,W.height):t.renderbufferStorage(t.RENDERBUFFER,Fe,W.width,W.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,bt,t.RENDERBUFFER,Q)}else{const Ue=W.textures;for(let ze=0;ze{delete W.__boundDepthTexture,delete W.__depthDisposeCallback,Ue.removeEventListener("dispose",ze)};Ue.addEventListener("dispose",ze),W.__depthDisposeCallback=ze}W.__boundDepthTexture=Ue}if(Q.depthTexture&&!W.__autoAllocateDepthBuffer){if(be)throw new Error("target.depthTexture not supported in Cube render targets");we(W.__webglFramebuffer,Q)}else if(be){W.__webglDepthbuffer=[];for(let Ue=0;Ue<6;Ue++)if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer[Ue]),W.__webglDepthbuffer[Ue]===void 0)W.__webglDepthbuffer[Ue]=t.createRenderbuffer(),Se(W.__webglDepthbuffer[Ue],Q,!1);else{const ze=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Fe=W.__webglDepthbuffer[Ue];t.bindRenderbuffer(t.RENDERBUFFER,Fe),t.framebufferRenderbuffer(t.FRAMEBUFFER,ze,t.RENDERBUFFER,Fe)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer),W.__webglDepthbuffer===void 0)W.__webglDepthbuffer=t.createRenderbuffer(),Se(W.__webglDepthbuffer,Q,!1);else{const Ue=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ze=W.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ze),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ue,t.RENDERBUFFER,ze)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Ee(Q,W,be){const Ue=r.get(Q);W!==void 0&&ce(Ue.__webglFramebuffer,Q,Q.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),be!==void 0&&We(Q)}function Ge(Q){const W=Q.texture,be=r.get(Q),Ue=r.get(W);Q.addEventListener("dispose",N);const ze=Q.textures,Fe=Q.isWebGLCubeRenderTarget===!0,bt=ze.length>1;if(bt||(Ue.__webglTexture===void 0&&(Ue.__webglTexture=t.createTexture()),Ue.__version=W.version,a.memory.textures++),Fe){be.__webglFramebuffer=[];for(let rt=0;rt<6;rt++)if(W.mipmaps&&W.mipmaps.length>0){be.__webglFramebuffer[rt]=[];for(let ht=0;ht0){be.__webglFramebuffer=[];for(let rt=0;rt0&&ne(Q)===!1){be.__webglMultisampledFramebuffer=t.createFramebuffer(),be.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,be.__webglMultisampledFramebuffer);for(let rt=0;rt0)for(let ht=0;ht0)for(let ht=0;ht0){if(ne(Q)===!1){const W=Q.textures,be=Q.width,Ue=Q.height;let ze=t.COLOR_BUFFER_BIT;const Fe=Q.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,bt=r.get(Q),rt=W.length>1;if(rt)for(let ht=0;ht0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&W.__useRenderToTexture!==!1}function Ce(Q){const W=a.render.frame;d.get(Q)!==W&&(d.set(Q,W),Q.update())}function Xe(Q,W){const be=Q.colorSpace,Ue=Q.format,ze=Q.type;return Q.isCompressedTexture===!0||Q.isVideoTexture===!0||be!==xi&&be!==Oc&&(Nn.getTransfer(be)===er?(Ue!==ss||ze!==Ho)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",be)),W}function Ze(Q){return typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement?(c.width=Q.naturalWidth||Q.width,c.height=Q.naturalHeight||Q.height):typeof VideoFrame<"u"&&Q instanceof VideoFrame?(c.width=Q.displayWidth,c.height=Q.displayHeight):(c.width=Q.width,c.height=Q.height),c}this.allocateTextureUnit=X,this.resetTextureUnits=j,this.setTexture2D=ie,this.setTexture2DArray=pe,this.setTexture3D=ae,this.setTextureCube=he,this.rebindTextures=Ee,this.setupRenderTarget=Ge,this.updateRenderTargetMipmap=$e,this.updateMultisampleRenderTarget=Ve,this.setupDepthRenderbuffer=We,this.setupFrameBufferTexture=ce,this.useMultisampledRTT=ne}function S6(t,e){function n(r,i=Oc){let s;const a=Nn.getTransfer(i);if(r===Ho)return t.UNSIGNED_BYTE;if(r===WS)return t.UNSIGNED_SHORT_4_4_4_4;if(r===$S)return t.UNSIGNED_SHORT_5_5_5_1;if(r===hR)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===dR)return t.BYTE;if(r===fR)return t.SHORT;if(r===kg)return t.UNSIGNED_SHORT;if(r===GS)return t.INT;if(r===Qc)return t.UNSIGNED_INT;if(r===Qs)return t.FLOAT;if(r===rv)return t.HALF_FLOAT;if(r===pR)return t.ALPHA;if(r===mR)return t.RGB;if(r===ss)return t.RGBA;if(r===gR)return t.LUMINANCE;if(r===vR)return t.LUMINANCE_ALPHA;if(r===Th)return t.DEPTH_COMPONENT;if(r===Hh)return t.DEPTH_STENCIL;if(r===XS)return t.RED;if(r===ux)return t.RED_INTEGER;if(r===yR)return t.RG;if(r===qS)return t.RG_INTEGER;if(r===KS)return t.RGBA_INTEGER;if(r===Z0||r===Q0||r===J0||r===ey)if(a===er)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Z0)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===J0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===ey)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Z0)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===J0)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===ey)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 a===er?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===p1)return a===er?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===P1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===m1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===g1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===v1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===y1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===x1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===b1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===_1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===w1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===S1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===M1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===E1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===A1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===T1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===P1)return a===er?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===ty||r===C1||r===R1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===ty)return a===er?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===C1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===R1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===xR||r===N1||r===I1||r===k1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===ty)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===Bh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class M6 extends Pr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends mn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vye={type:"move"};class wA{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ts,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 Ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new q),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,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const S of e.hand.values()){const w=n.getJointPose(S,r),x=this._getHandJoint(c,S);w!==null&&(x.matrix.fromArray(w.transform.matrix),x.matrix.decompose(x.position,x.rotation,x.scale),x.matrixWorldNeedsUpdate=!0,x.jointRadius=w.radius),x.visible=w!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],p=d.position.distanceTo(f.position),y=.02,b=.005;c.inputState.pinching&&p>y+b?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=y-b&&(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));o!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(vye)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Ts;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const yye=` void main() { gl_Position = vec4( position, 1.0 ); -}`,yye=` +}`,xye=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -4441,7 +4446,7 @@ void main() { } -}`;class xye{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,r){if(this.texture===null){const i=new fr,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 Ya({vertexShader:vye,fragmentShader:yye,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 bye extends zl{constructor(e,n){super();const r=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,d=null,f=null,p=null,y=null,b=null;const S=new xye,w=n.getContextAttributes();let x=null,M=null;const T=[],P=[],O=new He;let N=null;const D=new Pr;D.layers.enable(1),D.viewport=new On;const z=new Pr;z.layers.enable(2),z.viewport=new On;const V=[D,z],k=new S6;k.layers.enable(1),k.layers.enable(2);let j=null,X=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(se){let ce=T[se];return ce===void 0&&(ce=new wA,T[se]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(se){let ce=T[se];return ce===void 0&&(ce=new wA,T[se]=ce),ce.getGripSpace()},this.getHand=function(se){let ce=T[se];return ce===void 0&&(ce=new wA,T[se]=ce),ce.getHandSpace()};function ee(se){const ce=P.indexOf(se.inputSource);if(ce===-1)return;const Se=T[ce];Se!==void 0&&(Se.update(se.inputSource,se.frame,c||a),Se.dispatchEvent({type:se.type,data:se.inputSource}))}function ie(){i.removeEventListener("select",ee),i.removeEventListener("selectstart",ee),i.removeEventListener("selectend",ee),i.removeEventListener("squeeze",ee),i.removeEventListener("squeezestart",ee),i.removeEventListener("squeezeend",ee),i.removeEventListener("end",ie),i.removeEventListener("inputsourceschange",pe);for(let se=0;se=0&&(P[we]=null,T[we].disconnect(Se))}for(let ce=0;ce=P.length){P.push(Se),we=Ee;break}else if(P[Ee]===null){P[Ee]=Se,we=Ee;break}if(we===-1)break}const We=T[we];We&&We.connect(Se)}}const ae=new q,he=new q;function B(se,ce,Se){ae.setFromMatrixPosition(ce.matrixWorld),he.setFromMatrixPosition(Se.matrixWorld);const we=ae.distanceTo(he),We=ce.projectionMatrix.elements,Ee=Se.projectionMatrix.elements,Ge=We[14]/(We[10]-1),$e=We[14]/(We[10]+1),de=(We[9]+1)/We[5],Z=(We[9]-1)/We[5],Ve=(We[8]-1)/We[0],Le=(Ee[8]+1)/Ee[0],ne=Ge*Ve,Ce=Ge*Le,qe=we/(-Ve+Le),Ze=qe*-Ve;if(ce.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(Ze),se.translateZ(qe),se.matrixWorld.compose(se.position,se.quaternion,se.scale),se.matrixWorldInverse.copy(se.matrixWorld).invert(),We[10]===-1)se.projectionMatrix.copy(ce.projectionMatrix),se.projectionMatrixInverse.copy(ce.projectionMatrixInverse);else{const Q=Ge+qe,W=$e+qe,be=ne-Ze,Ue=Ce+(we-Ze),ze=de*$e/W*Q,Fe=Z*$e/W*Q;se.projectionMatrix.makePerspective(be,Ue,ze,Fe,Q,W),se.projectionMatrixInverse.copy(se.projectionMatrix).invert()}}function J(se,ce){ce===null?se.matrixWorld.copy(se.matrix):se.matrixWorld.multiplyMatrices(ce.matrixWorld,se.matrix),se.matrixWorldInverse.copy(se.matrixWorld).invert()}this.updateCamera=function(se){if(i===null)return;let ce=se.near,Se=se.far;S.texture!==null&&(S.depthNear>0&&(ce=S.depthNear),S.depthFar>0&&(Se=S.depthFar)),k.near=z.near=D.near=ce,k.far=z.far=D.far=Se,(j!==k.near||X!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),j=k.near,X=k.far);const we=se.parent,We=k.cameras;J(k,we);for(let Ee=0;Ee0&&(w.alphaTest.value=x.alphaTest);const M=e.get(x),T=M.envMap,P=M.envMapRotation;T&&(w.envMap.value=T,Of.copy(P),Of.x*=-1,Of.y*=-1,Of.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Of.y*=-1,Of.z*=-1),w.envMapRotation.value.setFromMatrix4(_ye.makeRotationFromEuler(Of)),w.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=x.reflectivity,w.ior.value=x.ior,w.refractionRatio.value=x.refractionRatio),x.lightMap&&(w.lightMap.value=x.lightMap,w.lightMapIntensity.value=x.lightMapIntensity,n(x.lightMap,w.lightMapTransform)),x.aoMap&&(w.aoMap.value=x.aoMap,w.aoMapIntensity.value=x.aoMapIntensity,n(x.aoMap,w.aoMapTransform))}function a(w,x){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,x.map&&(w.map.value=x.map,n(x.map,w.mapTransform))}function o(w,x){w.dashSize.value=x.dashSize,w.totalSize.value=x.dashSize+x.gapSize,w.scale.value=x.scale}function l(w,x,M,T){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,w.size.value=x.size*M,w.scale.value=T*.5,x.map&&(w.map.value=x.map,n(x.map,w.uvTransform)),x.alphaMap&&(w.alphaMap.value=x.alphaMap,n(x.alphaMap,w.alphaMapTransform)),x.alphaTest>0&&(w.alphaTest.value=x.alphaTest)}function c(w,x){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,w.rotation.value=x.rotation,x.map&&(w.map.value=x.map,n(x.map,w.mapTransform)),x.alphaMap&&(w.alphaMap.value=x.alphaMap,n(x.alphaMap,w.alphaMapTransform)),x.alphaTest>0&&(w.alphaTest.value=x.alphaTest)}function d(w,x){w.specular.value.copy(x.specular),w.shininess.value=Math.max(x.shininess,1e-4)}function f(w,x){x.gradientMap&&(w.gradientMap.value=x.gradientMap)}function p(w,x){w.metalness.value=x.metalness,x.metalnessMap&&(w.metalnessMap.value=x.metalnessMap,n(x.metalnessMap,w.metalnessMapTransform)),w.roughness.value=x.roughness,x.roughnessMap&&(w.roughnessMap.value=x.roughnessMap,n(x.roughnessMap,w.roughnessMapTransform)),x.envMap&&(w.envMapIntensity.value=x.envMapIntensity)}function y(w,x,M){w.ior.value=x.ior,x.sheen>0&&(w.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),w.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(w.sheenColorMap.value=x.sheenColorMap,n(x.sheenColorMap,w.sheenColorMapTransform)),x.sheenRoughnessMap&&(w.sheenRoughnessMap.value=x.sheenRoughnessMap,n(x.sheenRoughnessMap,w.sheenRoughnessMapTransform))),x.clearcoat>0&&(w.clearcoat.value=x.clearcoat,w.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(w.clearcoatMap.value=x.clearcoatMap,n(x.clearcoatMap,w.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,n(x.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(w.clearcoatNormalMap.value=x.clearcoatNormalMap,n(x.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===as&&w.clearcoatNormalScale.value.negate())),x.dispersion>0&&(w.dispersion.value=x.dispersion),x.iridescence>0&&(w.iridescence.value=x.iridescence,w.iridescenceIOR.value=x.iridescenceIOR,w.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(w.iridescenceMap.value=x.iridescenceMap,n(x.iridescenceMap,w.iridescenceMapTransform)),x.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=x.iridescenceThicknessMap,n(x.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),x.transmission>0&&(w.transmission.value=x.transmission,w.transmissionSamplerMap.value=M.texture,w.transmissionSamplerSize.value.set(M.width,M.height),x.transmissionMap&&(w.transmissionMap.value=x.transmissionMap,n(x.transmissionMap,w.transmissionMapTransform)),w.thickness.value=x.thickness,x.thicknessMap&&(w.thicknessMap.value=x.thicknessMap,n(x.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=x.attenuationDistance,w.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(w.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(w.anisotropyMap.value=x.anisotropyMap,n(x.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=x.specularIntensity,w.specularColor.value.copy(x.specularColor),x.specularColorMap&&(w.specularColorMap.value=x.specularColorMap,n(x.specularColorMap,w.specularColorMapTransform)),x.specularIntensityMap&&(w.specularIntensityMap.value=x.specularIntensityMap,n(x.specularIntensityMap,w.specularIntensityMapTransform))}function b(w,x){x.matcap&&(w.matcap.value=x.matcap)}function S(w,x){const M=e.get(x).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 Sye(t,e,n,r){let i={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,T){const P=T.program;r.uniformBlockBinding(M,P)}function c(M,T){let P=i[M.id];P===void 0&&(b(M),P=d(M),i[M.id]=P,M.addEventListener("dispose",w));const O=T.program;r.updateUBOMapping(M,O);const N=e.render.frame;s[M.id]!==N&&(p(M),s[M.id]=N)}function d(M){const T=f();M.__bindingPointIndex=T;const P=t.createBuffer(),O=M.__size,N=M.usage;return t.bindBuffer(t.UNIFORM_BUFFER,P),t.bufferData(t.UNIFORM_BUFFER,O,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,T,P),P}function f(){for(let M=0;M0&&(P+=O-N),M.__size=P,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 P=a.indexOf(T.__bindingPointIndex);a.splice(P,1),t.deleteBuffer(i[T.id]),delete i[T.id],delete s[T.id]}function x(){for(const M in i)t.deleteBuffer(i[M]);a=[],i={},s={}}return{bind:l,update:c,dispose:x}}class M6{constructor(e={}){const{canvas:n=u6(),context:r=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let p;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=r.getContextAttributes().alpha}else p=a;const y=new Uint32Array(4),b=new Int32Array(4);let S=null,w=null;const x=[],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=Fi,this.toneMapping=Tl,this.toneMappingExposure=1;const T=this;let P=!1,O=0,N=0,D=null,z=-1,V=null;const k=new On,j=new On;let X=null;const ee=new ct(0);let ie=0,pe=n.width,ae=n.height,he=1,B=null,J=null;const Y=new On(0,0,pe,ae),H=new On(0,0,pe,ae);let G=!1;const le=new px;let se=!1,ce=!1;const Se=new Ct,we=new Ct,We=new q,Ee=new On,Ge={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let $e=!1;function de(){return D===null?he:1}let Z=r;function Ve(K,xe){return n.getContext(K,xe)}try{const K={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Pd}`),n.addEventListener("webglcontextlost",Be,!1),n.addEventListener("webglcontextrestored",at,!1),n.addEventListener("webglcontextcreationerror",pt,!1),Z===null){const xe="webgl2";if(Z=Ve(xe,K),Z===null)throw Ve(xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(K){throw console.error("THREE.WebGLRenderer: "+K.message),K}let Le,ne,Ce,qe,Ze,Q,W,be,Ue,ze,Fe,bt,rt,ht,Xt,Ke,te,tt,Mt,vt,Zt,fe,Xe,ue;function Ye(){Le=new Cve(Z),Le.init(),fe=new w6(Z,Le),ne=new Sve(Z,Le,e,fe),Ce=new cye(Z),ne.reverseDepthBuffer&&Ce.buffers.depth.setReversed(!0),qe=new Ive(Z),Ze=new Y0e,Q=new mye(Z,Le,Ce,Ze,ne,fe,qe),W=new Eve(T),be=new Pve(T),Ue=new Fpe(Z),Xe=new _ve(Z,Ue),ze=new Rve(Z,Ue,qe,Xe),Fe=new Ove(Z,ze,Ue,qe),Mt=new kve(Z,ne,Q),Ke=new Mve(Ze),bt=new K0e(T,W,be,Le,ne,Xe,Ke),rt=new wye(T,Ze),ht=new Q0e,Xt=new iye(Le),tt=new bve(T,W,be,Ce,Fe,p,l),te=new oye(T,Fe,ne),ue=new Sye(Z,qe,ne,Ce),vt=new wve(Z,Le,qe),Zt=new Nve(Z,Le,qe),qe.programs=bt.programs,T.capabilities=ne,T.extensions=Le,T.properties=Ze,T.renderLists=ht,T.shadowMap=te,T.state=Ce,T.info=qe}Ye();const Re=new bye(T,Z);this.xr=Re,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){const K=Le.get("WEBGL_lose_context");K&&K.loseContext()},this.forceContextRestore=function(){const K=Le.get("WEBGL_lose_context");K&&K.restoreContext()},this.getPixelRatio=function(){return he},this.setPixelRatio=function(K){K!==void 0&&(he=K,this.setSize(pe,ae,!1))},this.getSize=function(K){return K.set(pe,ae)},this.setSize=function(K,xe,Te=!0){if(Re.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}pe=K,ae=xe,n.width=Math.floor(K*he),n.height=Math.floor(xe*he),Te===!0&&(n.style.width=K+"px",n.style.height=xe+"px"),this.setViewport(0,0,K,xe)},this.getDrawingBufferSize=function(K){return K.set(pe*he,ae*he).floor()},this.setDrawingBufferSize=function(K,xe,Te){pe=K,ae=xe,he=Te,n.width=Math.floor(K*Te),n.height=Math.floor(xe*Te),this.setViewport(0,0,K,xe)},this.getCurrentViewport=function(K){return K.copy(k)},this.getViewport=function(K){return K.copy(Y)},this.setViewport=function(K,xe,Te,Ie){K.isVector4?Y.set(K.x,K.y,K.z,K.w):Y.set(K,xe,Te,Ie),Ce.viewport(k.copy(Y).multiplyScalar(he).round())},this.getScissor=function(K){return K.copy(H)},this.setScissor=function(K,xe,Te,Ie){K.isVector4?H.set(K.x,K.y,K.z,K.w):H.set(K,xe,Te,Ie),Ce.scissor(j.copy(H).multiplyScalar(he).round())},this.getScissorTest=function(){return G},this.setScissorTest=function(K){Ce.setScissorTest(G=K)},this.setOpaqueSort=function(K){B=K},this.setTransparentSort=function(K){J=K},this.getClearColor=function(K){return K.copy(tt.getClearColor())},this.setClearColor=function(){tt.setClearColor.apply(tt,arguments)},this.getClearAlpha=function(){return tt.getClearAlpha()},this.setClearAlpha=function(){tt.setClearAlpha.apply(tt,arguments)},this.clear=function(K=!0,xe=!0,Te=!0){let Ie=0;if(K){let Me=!1;if(D!==null){const it=D.texture.format;Me=it===KS||it===qS||it===ux}if(Me){const it=D.texture.type,yt=it===Ho||it===Qc||it===kg||it===Bh||it===WS||it===$S,lt=tt.getClearColor(),Et=tt.getClearAlpha(),jt=lt.r,Bt=lt.g,Rt=lt.b;yt?(y[0]=jt,y[1]=Bt,y[2]=Rt,y[3]=Et,Z.clearBufferuiv(Z.COLOR,0,y)):(b[0]=jt,b[1]=Bt,b[2]=Rt,b[3]=Et,Z.clearBufferiv(Z.COLOR,0,b))}else Ie|=Z.COLOR_BUFFER_BIT}xe&&(Ie|=Z.DEPTH_BUFFER_BIT,Z.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Te&&(Ie|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(Ie)},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",Be,!1),n.removeEventListener("webglcontextrestored",at,!1),n.removeEventListener("webglcontextcreationerror",pt,!1),ht.dispose(),Xt.dispose(),Ze.dispose(),W.dispose(),be.dispose(),Fe.dispose(),Xe.dispose(),ue.dispose(),bt.dispose(),Re.dispose(),Re.removeEventListener("sessionstart",Mi),Re.removeEventListener("sessionend",to),Ei.stop()};function Be(K){K.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function at(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;const K=qe.autoReset,xe=te.enabled,Te=te.autoUpdate,Ie=te.needsUpdate,Me=te.type;Ye(),qe.autoReset=K,te.enabled=xe,te.autoUpdate=Te,te.needsUpdate=Ie,te.type=Me}function pt(K){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",K.statusMessage)}function Jt(K){const xe=K.target;xe.removeEventListener("dispose",Jt),pn(xe)}function pn(K){jn(K),Ze.remove(K)}function jn(K){const xe=Ze.get(K).programs;xe!==void 0&&(xe.forEach(function(Te){bt.releaseProgram(Te)}),K.isShaderMaterial&&bt.releaseShaderCache(K))}this.renderBufferDirect=function(K,xe,Te,Ie,Me,it){xe===null&&(xe=Ge);const yt=Me.isMesh&&Me.matrixWorld.determinant()<0,lt=Ta(K,xe,Te,Ie,Me);Ce.setMaterial(Ie,yt);let Et=Te.index,jt=1;if(Ie.wireframe===!0){if(Et=ze.getWireframeAttribute(Te),Et===void 0)return;jt=2}const Bt=Te.drawRange,Rt=Te.attributes.position;let Sn=Bt.start*jt,Mn=(Bt.start+Bt.count)*jt;it!==null&&(Sn=Math.max(Sn,it.start*jt),Mn=Math.min(Mn,(it.start+it.count)*jt)),Et!==null?(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Et.count)):Rt!=null&&(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Rt.count));const yn=Mn-Sn;if(yn<0||yn===1/0)return;Xe.setup(Me,Ie,lt,Te,Et);let Kt,Ut=vt;if(Et!==null&&(Kt=Ue.get(Et),Ut=Zt,Ut.setIndex(Kt)),Me.isMesh)Ie.wireframe===!0?(Ce.setLineWidth(Ie.wireframeLinewidth*de()),Ut.setMode(Z.LINES)):Ut.setMode(Z.TRIANGLES);else if(Me.isLine){let mt=Ie.linewidth;mt===void 0&&(mt=1),Ce.setLineWidth(mt*de()),Me.isLineSegments?Ut.setMode(Z.LINES):Me.isLineLoop?Ut.setMode(Z.LINE_LOOP):Ut.setMode(Z.LINE_STRIP)}else Me.isPoints?Ut.setMode(Z.POINTS):Me.isSprite&&Ut.setMode(Z.TRIANGLES);if(Me.isBatchedMesh)if(Me._multiDrawInstances!==null)Ut.renderMultiDrawInstances(Me._multiDrawStarts,Me._multiDrawCounts,Me._multiDrawCount,Me._multiDrawInstances);else if(Le.get("WEBGL_multi_draw"))Ut.renderMultiDraw(Me._multiDrawStarts,Me._multiDrawCounts,Me._multiDrawCount);else{const mt=Me._multiDrawStarts,xn=Me._multiDrawCounts,tn=Me._multiDrawCount,Rr=Et?Ue.get(Et).bytesPerElement:1,li=Ze.get(Ie).currentProgram.getUniforms();for(let In=0;In{function it(){if(Ie.forEach(function(yt){Ze.get(yt).currentProgram.isReady()&&Ie.delete(yt)}),Ie.size===0){Me(K);return}setTimeout(it,10)}Le.get("KHR_parallel_shader_compile")!==null?it():setTimeout(it,10)})};let Hn=null;function pr(K){Hn&&Hn(K)}function Mi(){Ei.stop()}function to(){Ei.start()}const Ei=new v6;Ei.setAnimationLoop(pr),typeof self<"u"&&Ei.setContext(self),this.setAnimationLoop=function(K){Hn=K,Re.setAnimationLoop(K),K===null?Ei.stop():Ei.start()},Re.addEventListener("sessionstart",Mi),Re.addEventListener("sessionend",to),this.render=function(K,xe){if(xe!==void 0&&xe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;if(K.matrixWorldAutoUpdate===!0&&K.updateMatrixWorld(),xe.parent===null&&xe.matrixWorldAutoUpdate===!0&&xe.updateMatrixWorld(),Re.enabled===!0&&Re.isPresenting===!0&&(Re.cameraAutoUpdate===!0&&Re.updateCamera(xe),xe=Re.getCamera()),K.isScene===!0&&K.onBeforeRender(T,K,xe,D),w=Xt.get(K,M.length),w.init(xe),M.push(w),we.multiplyMatrices(xe.projectionMatrix,xe.matrixWorldInverse),le.setFromProjectionMatrix(we),ce=this.localClippingEnabled,se=Ke.init(this.clippingPlanes,ce),S=ht.get(K,x.length),S.init(),x.push(S),Re.enabled===!0&&Re.isPresenting===!0){const it=T.xr.getDepthSensingMesh();it!==null&&Ko(it,xe,-1/0,T.sortObjects)}Ko(K,xe,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(B,J),$e=Re.enabled===!1||Re.isPresenting===!1||Re.hasDepthSensing()===!1,$e&&tt.addToRenderList(S,K),this.info.render.frame++,se===!0&&Ke.beginShadows();const Te=w.state.shadowsArray;te.render(Te,K,xe),se===!0&&Ke.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ie=S.opaque,Me=S.transmissive;if(w.setupLights(),xe.isArrayCamera){const it=xe.cameras;if(Me.length>0)for(let yt=0,lt=it.length;yt0&&no(Ie,Me,K,xe),$e&&tt.render(K),Ns(S,K,xe);D!==null&&(Q.updateMultisampleRenderTarget(D),Q.updateRenderTargetMipmap(D)),K.isScene===!0&&K.onAfterRender(T,K,xe),Xe.resetDefaultState(),z=-1,V=null,M.pop(),M.length>0?(w=M[M.length-1],se===!0&&Ke.setGlobalState(T.clippingPlanes,w.state.camera)):w=null,x.pop(),x.length>0?S=x[x.length-1]:S=null};function Ko(K,xe,Te,Ie){if(K.visible===!1)return;if(K.layers.test(xe.layers)){if(K.isGroup)Te=K.renderOrder;else if(K.isLOD)K.autoUpdate===!0&&K.update(xe);else if(K.isLight)w.pushLight(K),K.castShadow&&w.pushShadow(K);else if(K.isSprite){if(!K.frustumCulled||le.intersectsSprite(K)){Ie&&Ee.setFromMatrixPosition(K.matrixWorld).applyMatrix4(we);const yt=Fe.update(K),lt=K.material;lt.visible&&S.push(K,yt,lt,Te,Ee.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||le.intersectsObject(K))){const yt=Fe.update(K),lt=K.material;if(Ie&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),Ee.copy(K.boundingSphere.center)):(yt.boundingSphere===null&&yt.computeBoundingSphere(),Ee.copy(yt.boundingSphere.center)),Ee.applyMatrix4(K.matrixWorld).applyMatrix4(we)),Array.isArray(lt)){const Et=yt.groups;for(let jt=0,Bt=Et.length;jt0&&Ai(Me,xe,Te),it.length>0&&Ai(it,xe,Te),yt.length>0&&Ai(yt,xe,Te),Ce.buffers.depth.setTest(!0),Ce.buffers.depth.setMask(!0),Ce.buffers.color.setMask(!0),Ce.setPolygonOffset(!1)}function no(K,xe,Te,Ie){if((Te.isScene===!0?Te.overrideMaterial:null)!==null)return;w.state.transmissionRenderTarget[Ie.id]===void 0&&(w.state.transmissionRenderTarget[Ie.id]=new Vo(1,1,{generateMipmaps:!0,type:Le.has("EXT_color_buffer_half_float")||Le.has("EXT_color_buffer_float")?rv:Ho,minFilter:$a,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Nn.workingColorSpace}));const it=w.state.transmissionRenderTarget[Ie.id],yt=Ie.viewport||k;it.setSize(yt.z,yt.w);const lt=T.getRenderTarget();T.setRenderTarget(it),T.getClearColor(ee),ie=T.getClearAlpha(),ie<1&&T.setClearColor(16777215,.5),T.clear(),$e&&tt.render(Te);const Et=T.toneMapping;T.toneMapping=Tl;const jt=Ie.viewport;if(Ie.viewport!==void 0&&(Ie.viewport=void 0),w.setupLightsView(Ie),se===!0&&Ke.setGlobalState(T.clippingPlanes,Ie),Ai(K,Te,Ie),Q.updateMultisampleRenderTarget(it),Q.updateRenderTargetMipmap(it),Le.has("WEBGL_multisampled_render_to_texture")===!1){let Bt=!1;for(let Rt=0,Sn=xe.length;Rt0),Rt=!!Te.morphAttributes.position,Sn=!!Te.morphAttributes.normal,Mn=!!Te.morphAttributes.color;let yn=Tl;Ie.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(yn=T.toneMapping);const Kt=Te.morphAttributes.position||Te.morphAttributes.normal||Te.morphAttributes.color,Ut=Kt!==void 0?Kt.length:0,mt=Ze.get(Ie),xn=w.state.lights;if(se===!0&&(ce===!0||K!==V)){const Xr=K===V&&Ie.id===z;Ke.setState(Ie,K,Xr)}let tn=!1;Ie.version===mt.__version?(mt.needsLights&&mt.lightsStateVersion!==xn.state.version||mt.outputColorSpace!==lt||Me.isBatchedMesh&&mt.batching===!1||!Me.isBatchedMesh&&mt.batching===!0||Me.isBatchedMesh&&mt.batchingColor===!0&&Me.colorTexture===null||Me.isBatchedMesh&&mt.batchingColor===!1&&Me.colorTexture!==null||Me.isInstancedMesh&&mt.instancing===!1||!Me.isInstancedMesh&&mt.instancing===!0||Me.isSkinnedMesh&&mt.skinning===!1||!Me.isSkinnedMesh&&mt.skinning===!0||Me.isInstancedMesh&&mt.instancingColor===!0&&Me.instanceColor===null||Me.isInstancedMesh&&mt.instancingColor===!1&&Me.instanceColor!==null||Me.isInstancedMesh&&mt.instancingMorph===!0&&Me.morphTexture===null||Me.isInstancedMesh&&mt.instancingMorph===!1&&Me.morphTexture!==null||mt.envMap!==Et||Ie.fog===!0&&mt.fog!==it||mt.numClippingPlanes!==void 0&&(mt.numClippingPlanes!==Ke.numPlanes||mt.numIntersection!==Ke.numIntersection)||mt.vertexAlphas!==jt||mt.vertexTangents!==Bt||mt.morphTargets!==Rt||mt.morphNormals!==Sn||mt.morphColors!==Mn||mt.toneMapping!==yn||mt.morphTargetsCount!==Ut)&&(tn=!0):(tn=!0,mt.__version=Ie.version);let Rr=mt.currentProgram;tn===!0&&(Rr=ro(Ie,xe,Me));let li=!1,In=!1,Is=!1;const Vn=Rr.getUniforms(),ta=mt.uniforms;if(Ce.useProgram(Rr.program)&&(li=!0,In=!0,Is=!0),Ie.id!==z&&(z=Ie.id,In=!0),li||V!==K){ne.reverseDepthBuffer?(Se.copy(K.projectionMatrix),cpe(Se),upe(Se),Vn.setValue(Z,"projectionMatrix",Se)):Vn.setValue(Z,"projectionMatrix",K.projectionMatrix),Vn.setValue(Z,"viewMatrix",K.matrixWorldInverse);const Xr=Vn.map.cameraPosition;Xr!==void 0&&Xr.setValue(Z,We.setFromMatrixPosition(K.matrixWorld)),ne.logarithmicDepthBuffer&&Vn.setValue(Z,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),(Ie.isMeshPhongMaterial||Ie.isMeshToonMaterial||Ie.isMeshLambertMaterial||Ie.isMeshBasicMaterial||Ie.isMeshStandardMaterial||Ie.isShaderMaterial)&&Vn.setValue(Z,"isOrthographic",K.isOrthographicCamera===!0),V!==K&&(V=K,In=!0,Is=!0)}if(Me.isSkinnedMesh){Vn.setOptional(Z,Me,"bindMatrix"),Vn.setOptional(Z,Me,"bindMatrixInverse");const Xr=Me.skeleton;Xr&&(Xr.boneTexture===null&&Xr.computeBoneTexture(),Vn.setValue(Z,"boneTexture",Xr.boneTexture,Q))}Me.isBatchedMesh&&(Vn.setOptional(Z,Me,"batchingTexture"),Vn.setValue(Z,"batchingTexture",Me._matricesTexture,Q),Vn.setOptional(Z,Me,"batchingIdTexture"),Vn.setValue(Z,"batchingIdTexture",Me._indirectTexture,Q),Vn.setOptional(Z,Me,"batchingColorTexture"),Me._colorsTexture!==null&&Vn.setValue(Z,"batchingColorTexture",Me._colorsTexture,Q));const Yo=Te.morphAttributes;if((Yo.position!==void 0||Yo.normal!==void 0||Yo.color!==void 0)&&Mt.update(Me,Te,Rr),(In||mt.receiveShadow!==Me.receiveShadow)&&(mt.receiveShadow=Me.receiveShadow,Vn.setValue(Z,"receiveShadow",Me.receiveShadow)),Ie.isMeshGouraudMaterial&&Ie.envMap!==null&&(ta.envMap.value=Et,ta.flipEnvMap.value=Et.isCubeTexture&&Et.isRenderTargetTexture===!1?-1:1),Ie.isMeshStandardMaterial&&Ie.envMap===null&&xe.environment!==null&&(ta.envMapIntensity.value=xe.environmentIntensity),In&&(Vn.setValue(Z,"toneMappingExposure",T.toneMappingExposure),mt.needsLights&&cu(ta,Is),it&&Ie.fog===!0&&rt.refreshFogUniforms(ta,it),rt.refreshMaterialUniforms(ta,Ie,he,ae,w.state.transmissionRenderTarget[K.id]),K_.upload(Z,ou(mt),ta,Q)),Ie.isShaderMaterial&&Ie.uniformsNeedUpdate===!0&&(K_.upload(Z,ou(mt),ta,Q),Ie.uniformsNeedUpdate=!1),Ie.isSpriteMaterial&&Vn.setValue(Z,"center",Me.center),Vn.setValue(Z,"modelViewMatrix",Me.modelViewMatrix),Vn.setValue(Z,"normalMatrix",Me.normalMatrix),Vn.setValue(Z,"modelMatrix",Me.matrixWorld),Ie.isShaderMaterial||Ie.isRawShaderMaterial){const Xr=Ie.uniformsGroups;for(let ci=0,Ud=Xr.length;ci0&&Q.useMultisampledRTT(K)===!1?Me=Ze.get(K).__webglMultisampledFramebuffer:Array.isArray(Bt)?Me=Bt[Te]:Me=Bt,k.copy(K.viewport),j.copy(K.scissor),X=K.scissorTest}else k.copy(Y).multiplyScalar(he).floor(),j.copy(H).multiplyScalar(he).floor(),X=G;if(Ce.bindFramebuffer(Z.FRAMEBUFFER,Me)&&Ie&&Ce.drawBuffers(K,Me),Ce.viewport(k),Ce.scissor(j),Ce.setScissorTest(X),it){const Et=Ze.get(K.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Et.__webglTexture,Te)}else if(yt){const Et=Ze.get(K.texture),jt=xe||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Et.__webglTexture,Te||0,jt)}z=-1},this.readRenderTargetPixels=function(K,xe,Te,Ie,Me,it,yt){if(!(K&&K.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let lt=Ze.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&yt!==void 0&&(lt=lt[yt]),lt){Ce.bindFramebuffer(Z.FRAMEBUFFER,lt);try{const Et=K.texture,jt=Et.format,Bt=Et.type;if(!ne.textureFormatReadable(jt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ne.textureTypeReadable(Bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}xe>=0&&xe<=K.width-Ie&&Te>=0&&Te<=K.height-Me&&Z.readPixels(xe,Te,Ie,Me,fe.convert(jt),fe.convert(Bt),it)}finally{const Et=D!==null?Ze.get(D).__webglFramebuffer:null;Ce.bindFramebuffer(Z.FRAMEBUFFER,Et)}}},this.readRenderTargetPixelsAsync=async function(K,xe,Te,Ie,Me,it,yt){if(!(K&&K.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let lt=Ze.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&yt!==void 0&&(lt=lt[yt]),lt){const Et=K.texture,jt=Et.format,Bt=Et.type;if(!ne.textureFormatReadable(jt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ne.textureTypeReadable(Bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(xe>=0&&xe<=K.width-Ie&&Te>=0&&Te<=K.height-Me){Ce.bindFramebuffer(Z.FRAMEBUFFER,lt);const Rt=Z.createBuffer();Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Rt),Z.bufferData(Z.PIXEL_PACK_BUFFER,it.byteLength,Z.STREAM_READ),Z.readPixels(xe,Te,Ie,Me,fe.convert(jt),fe.convert(Bt),0);const Sn=D!==null?Ze.get(D).__webglFramebuffer:null;Ce.bindFramebuffer(Z.FRAMEBUFFER,Sn);const Mn=Z.fenceSync(Z.SYNC_GPU_COMMANDS_COMPLETE,0);return Z.flush(),await lpe(Z,Mn,4),Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Rt),Z.getBufferSubData(Z.PIXEL_PACK_BUFFER,0,it),Z.deleteBuffer(Rt),Z.deleteSync(Mn),it}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(K,xe=null,Te=0){K.isTexture!==!0&&(q_("WebGLRenderer: copyFramebufferToTexture function signature has changed."),xe=arguments[0]||null,K=arguments[1]);const Ie=Math.pow(2,-Te),Me=Math.floor(K.image.width*Ie),it=Math.floor(K.image.height*Ie),yt=xe!==null?xe.x:0,lt=xe!==null?xe.y:0;Q.setTexture2D(K,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,Te,0,0,yt,lt,Me,it),Ce.unbindTexture()},this.copyTextureToTexture=function(K,xe,Te=null,Ie=null,Me=0){K.isTexture!==!0&&(q_("WebGLRenderer: copyTextureToTexture function signature has changed."),Ie=arguments[0]||null,K=arguments[1],xe=arguments[2],Me=arguments[3]||0,Te=null);let it,yt,lt,Et,jt,Bt;Te!==null?(it=Te.max.x-Te.min.x,yt=Te.max.y-Te.min.y,lt=Te.min.x,Et=Te.min.y):(it=K.image.width,yt=K.image.height,lt=0,Et=0),Ie!==null?(jt=Ie.x,Bt=Ie.y):(jt=0,Bt=0);const Rt=fe.convert(xe.format),Sn=fe.convert(xe.type);Q.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 Mn=Z.getParameter(Z.UNPACK_ROW_LENGTH),yn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Kt=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Ut=Z.getParameter(Z.UNPACK_SKIP_ROWS),mt=Z.getParameter(Z.UNPACK_SKIP_IMAGES),xn=K.isCompressedTexture?K.mipmaps[Me]:K.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,xn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,xn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,lt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Et),K.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,Me,jt,Bt,it,yt,Rt,Sn,xn.data):K.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,Me,jt,Bt,xn.width,xn.height,Rt,xn.data):Z.texSubImage2D(Z.TEXTURE_2D,Me,jt,Bt,it,yt,Rt,Sn,xn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Mn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,yn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Kt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Ut),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,mt),Me===0&&xe.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),Ce.unbindTexture()},this.copyTextureToTexture3D=function(K,xe,Te=null,Ie=null,Me=0){K.isTexture!==!0&&(q_("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Te=arguments[0]||null,Ie=arguments[1]||null,K=arguments[2],xe=arguments[3],Me=arguments[4]||0);let it,yt,lt,Et,jt,Bt,Rt,Sn,Mn;const yn=K.isCompressedTexture?K.mipmaps[Me]:K.image;Te!==null?(it=Te.max.x-Te.min.x,yt=Te.max.y-Te.min.y,lt=Te.max.z-Te.min.z,Et=Te.min.x,jt=Te.min.y,Bt=Te.min.z):(it=yn.width,yt=yn.height,lt=yn.depth,Et=0,jt=0,Bt=0),Ie!==null?(Rt=Ie.x,Sn=Ie.y,Mn=Ie.z):(Rt=0,Sn=0,Mn=0);const Kt=fe.convert(xe.format),Ut=fe.convert(xe.type);let mt;if(xe.isData3DTexture)Q.setTexture3D(xe,0),mt=Z.TEXTURE_3D;else if(xe.isDataArrayTexture||xe.isCompressedArrayTexture)Q.setTexture2DArray(xe,0),mt=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 xn=Z.getParameter(Z.UNPACK_ROW_LENGTH),tn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Rr=Z.getParameter(Z.UNPACK_SKIP_PIXELS),li=Z.getParameter(Z.UNPACK_SKIP_ROWS),In=Z.getParameter(Z.UNPACK_SKIP_IMAGES);Z.pixelStorei(Z.UNPACK_ROW_LENGTH,yn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,yn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Et),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,jt),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,Bt),K.isDataTexture||K.isData3DTexture?Z.texSubImage3D(mt,Me,Rt,Sn,Mn,it,yt,lt,Kt,Ut,yn.data):xe.isCompressedArrayTexture?Z.compressedTexSubImage3D(mt,Me,Rt,Sn,Mn,it,yt,lt,Kt,yn.data):Z.texSubImage3D(mt,Me,Rt,Sn,Mn,it,yt,lt,Kt,Ut,yn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,xn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,tn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Rr),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,li),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,In),Me===0&&xe.generateMipmaps&&Z.generateMipmap(mt),Ce.unbindTexture()},this.initRenderTarget=function(K){Ze.get(K).__webglFramebuffer===void 0&&Q.setupRenderTarget(K)},this.initTexture=function(K){K.isCubeTexture?Q.setTextureCube(K,0):K.isData3DTexture?Q.setTexture3D(K,0):K.isDataArrayTexture||K.isCompressedArrayTexture?Q.setTexture2DArray(K,0):Q.setTexture2D(K,0),Ce.unbindTexture()},this.resetState=function(){O=0,N=0,D=null,Ce.reset(),Xe.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===ZS?"display-p3":"srgb",n.unpackColorSpace=Nn.workingColorSpace===dx?"display-p3":"srgb"}}class eM{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ct(e),this.density=n}clone(){return new eM(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class tM{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new ct(e),this.near=n,this.far=r}clone(){return new tM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class IR extends mn{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 ls,this.environmentIntensity=1,this.environmentRotation=new ls,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=wa()}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:Ks.getInterpolation(w0,a_,M0,o_,CD,SA,RD,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){Cm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(S0.x=s*Cm.x-i*Cm.y,S0.y=i*Cm.x+s*Cm.y):S0.copy(Cm),t.copy(e),t.x+=S0.x,t.y+=S0.y,t.applyMatrix4(E6)}const c_=new q,ND=new q;class T6 extends mn{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),ND.setFromMatrixPosition(this.matrixWorld);const r=c_.distanceTo(ND)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i=a)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 a=i[this.index];s.push(a),this.index++,a.start=e.start,a.count=e.count,a.z=n,a.index=r}reset(){this.list.length=0,this.index=0}}const Zu=new Ct,AA=new Ct,Rye=new Ct,Nye=new ct(1,1,1),zD=new Ct,TA=new px,f_=new os,Lf=new Hi,T0=new q,BD=new q,Iye=new q,PA=new Cye,ts=new xr,h_=[];function kye(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 Qt(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 os);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,a=s.image.data;Rye.toArray(a,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(Nye.toArray(o.image.data,i*4),o.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 a=this._reservedRanges,o=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=a[a.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++,a.push(i),o.push({start:d?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new os,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(),a=n.getIndex(),o=this._reservedRanges[e];if(i&&a.count>o.indexCount||n.attributes.position.count>o.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.vertexCount;for(const y in r.attributes){const b=n.getAttribute(y),S=r.getAttribute(y);kye(b,S,l);const w=b.itemSize;for(let x=b.count,M=c;x=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 a=s.index,o=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 a=s.index,o=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,a=this.geometry;ts.material=this.material,ts.geometry.index=a.index,ts.geometry.attributes=a.attributes,ts.geometry.boundingBox===null&&(ts.geometry.boundingBox=new os),ts.geometry.boundingSphere===null&&(ts.geometry.boundingSphere=new Hi);for(let o=0,l=r.length;o({...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 a=i.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,p=this.perObjectFrustumCulled,y=this._indirectTexture,b=y.image.data;p&&(zD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),TA.setFromProjectionMatrix(zD,e.coordinateSystem));let S=0;if(this.sortObjects){AA.copy(this.matrixWorld).invert(),T0.setFromMatrixPosition(r.matrixWorld).applyMatrix4(AA),BD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(AA);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,a=i.length;sr)return;CA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(CA);if(!(le.far))return{distance:l,point:VD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const GD=new q,WD=new q;class ea extends Ul{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,a=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Oye extends fr{constructor(e,n,r,i,s,a,o,l,c){super(e,n,r,i,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:Cr,this.magFilter=s!==void 0?s:Cr,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 Lye extends fr{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=ri,this.minFilter=ri,this.generateMipmaps=!1,this.needsUpdate=!0}}class sM extends fr{constructor(e,n,r,i,s,a,o,l,c,d,f,p){super(null,a,o,l,c,d,i,s,f,p),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Dye extends sM{constructor(e,n,r,i,s,a){super(e,n,r,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ba,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Uye extends sM{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,Zc),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class jye extends fr{constructor(e,n,r,i,s,a,o,l,c){super(e,n,r,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Xo{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 a=1;a<=e;a++)r=this.getPoint(a/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 a;n?a=n:a=e*r[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=r[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===a)return i/(s-1);const d=r[i],p=r[i+1]-d,y=(a-d)/p;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 a=this.getPoint(i),o=this.getPoint(s),l=n||(a.isVector2?new He:new q);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new q,i=[],s=[],a=[],o=new q,l=new Ct;for(let y=0;y<=e;y++){const b=y/e;i[y]=this.getTangentAt(b,new q)}s[0]=new q,a[0]=new q;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),p=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),p<=c&&r.set(0,0,1),o.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let y=1;y<=e;y++){if(s[y]=s[y-1].clone(),a[y]=a[y-1].clone(),o.crossVectors(i[y-1],i[y]),o.length()>Number.EPSILON){o.normalize();const b=Math.acos(Tr(i[y-1].dot(i[y]),-1,1));s[y].applyMatrix4(l.makeRotationAxis(o,b))}a[y].crossVectors(i[y],s[y])}if(n===!0){let y=Math.acos(Tr(s[0].dot(s[e]),-1,1));y/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(y=-y);for(let b=1;b<=e;b++)s[b].applyMatrix4(l.makeRotationAxis(i[b],y*b)),a[b].crossVectors(i[b],s[b])}return{tangents:i,normals:s,binormals:a}}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 Xo{constructor(e=0,n=0,r=1,i=1,s=0,a=Math.PI*2,o=!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=a,this.aClockwise=o,this.aRotation=l}getPoint(e,n=new He){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,d;this.closed||o>0?c=i[(o-1)%s]:(y_.subVectors(i[0],i[1]).add(i[0]),c=y_);const f=i[o%s],p=i[(o+1)%s];if(this.closed||o+2i.length-2?i.length-1:a+1],f=i[a>i.length-3?i.length-1:a+2];return r.set(qD(o,l.x,c.x,d.x,f.x),qD(o,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 a=i[s]-r,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.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 mx extends Yt{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=Tr(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],d=1/n,f=new q,p=new He,y=new q,b=new q,S=new q;let w=0,x=0;for(let M=0;M<=e.length-1;M++)switch(M){case 0:w=e[M+1].x-e[M].x,x=e[M+1].y-e[M].y,y.x=x*1,y.y=-w,y.z=x*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,x=e[M+1].y-e[M].y,y.x=x*1,y.y=-w,y.z=x*0,b.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(b)}for(let M=0;M<=n;M++){const T=r+M*d*i,P=Math.sin(T),O=Math.cos(T);for(let N=0;N<=e.length-1;N++){f.x=e[N].x*P,f.y=e[N].y,f.z=e[N].x*O,a.push(f.x,f.y,f.z),p.x=M/n,p.y=N/(e.length-1),o.push(p.x,p.y);const D=l[3*N+0]*P,z=l[3*N+1],V=l[3*N+0]*O;c.push(D,z,V)}}for(let M=0;M0&&T(!0),n>0&&T(!1)),this.setIndex(d),this.setAttribute("position",new Lt(f,3)),this.setAttribute("normal",new Lt(p,3)),this.setAttribute("uv",new Lt(y,2));function M(){const P=new q,O=new q;let N=0;const D=(n-e)/r;for(let z=0;z<=s;z++){const V=[],k=z/s,j=k*(n-e)+e;for(let X=0;X<=i;X++){const ee=X/i,ie=ee*l+o,pe=Math.sin(ie),ae=Math.cos(ie);O.x=j*pe,O.y=-k*r+w,O.z=j*ae,f.push(O.x,O.y,O.z),P.set(pe,D,ae).normalize(),p.push(P.x,P.y,P.z),y.push(ee,1-k),V.push(b++)}S.push(V)}for(let z=0;z0&&(d.push(k,j,ee),N+=3),n>0&&(d.push(j,X,ee),N+=3)}c.addGroup(x,N,0),x+=N}function T(P){const O=b,N=new He,D=new q;let z=0;const V=P===!0?e:n,k=P===!0?1:-1;for(let X=1;X<=i;X++)f.push(0,w*k,0),p.push(0,k,0),y.push(.5,.5),b++;const j=b;for(let X=0;X<=i;X++){const ie=X/i*l+o,pe=Math.cos(ie),ae=Math.sin(ie);D.x=V*ae,D.y=w*k,D.z=V*pe,f.push(D.x,D.y,D.z),p.push(0,k,0),N.x=pe*.5+.5,N.y=ae*.5*k+.5,y.push(N.x,N.y),b++}for(let X=0;X.9&&D<.1&&(T<.2&&(a[M+0]+=1),P<.2&&(a[M+2]+=1),O<.2&&(a[M+4]+=1))}}function p(M){s.push(M.x,M.y,M.z)}function y(M,T){const P=M*3;T.x=e[P+0],T.y=e[P+1],T.z=e[P+2]}function b(){const M=new q,T=new q,P=new q,O=new q,N=new He,D=new He,z=new He;for(let V=0,k=0;V80*n){o=c=t[0],l=d=t[1];for(let b=n;bc&&(c=f),p>d&&(d=p);y=Math.max(c-o,d-l),y=y!==0?32767/y:0}return Dy(s,a,n,o,l,y,0),a}};function L6(t,e,n,r,i){let s,a;if(i===lxe(t,e,n,r)>0)for(s=e;s=e;s-=r)a=KD(s,t[s],t[s+1],a);return a&&dM(a,a.next)&&(jy(a),a=a.next),a}function Gh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(dM(n,n.next)||yr(n.prev,n,n.next)===0)){if(jy(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,a){if(!t)return;!a&&s&&nxe(t,r,i,s);let o=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?qye(t,r,i,s):Xye(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),jy(t),t=c.next,o=c.next;continue}if(t=c,t===o){a?a===1?(t=Kye(Gh(t),e,n),Dy(t,e,n,r,i,s,2)):a===2&&Yye(t,e,n,r,i,s):Dy(Gh(t),e,n,r,i,s,1);break}}}function Xye(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,a=r.x,o=e.y,l=n.y,c=r.y,d=is?i>a?i:a:s>a?s:a,y=o>l?o>c?o:c:l>c?l:c;let b=r.next;for(;b!==e;){if(b.x>=d&&b.x<=p&&b.y>=f&&b.y<=y&&qm(i,o,s,l,a,c,b.x,b.y)&&yr(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function qye(t,e,n,r){const i=t.prev,s=t,a=t.next;if(yr(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,d=i.y,f=s.y,p=a.y,y=ol?o>c?o:c:l>c?l:c,w=d>f?d>p?d:p:f>p?f:p,x=QP(y,b,e,n,r),M=QP(S,w,e,n,r);let T=t.prevZ,P=t.nextZ;for(;T&&T.z>=x&&P&&P.z<=M;){if(T.x>=y&&T.x<=S&&T.y>=b&&T.y<=w&&T!==i&&T!==a&&qm(o,d,l,f,c,p,T.x,T.y)&&yr(T.prev,T,T.next)>=0||(T=T.prevZ,P.x>=y&&P.x<=S&&P.y>=b&&P.y<=w&&P!==i&&P!==a&&qm(o,d,l,f,c,p,P.x,P.y)&&yr(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;T&&T.z>=x;){if(T.x>=y&&T.x<=S&&T.y>=b&&T.y<=w&&T!==i&&T!==a&&qm(o,d,l,f,c,p,T.x,T.y)&&yr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;P&&P.z<=M;){if(P.x>=y&&P.x<=S&&P.y>=b&&P.y<=w&&P!==i&&P!==a&&qm(o,d,l,f,c,p,P.x,P.y)&&yr(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function Kye(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!dM(i,s)&&D6(i,r,r.next,s)&&Uy(i,s)&&Uy(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),jy(r),jy(r.next),r=t=s),r=r.next}while(r!==t);return Gh(r)}function Yye(t,e,n,r,i,s){let a=t;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&sxe(a,o)){let l=U6(a,o);a=Gh(a,a.next),l=Gh(l,l.next),Dy(a,e,n,r,i,s,0),Dy(l,e,n,r,i,s,0);return}o=o.next}a=a.next}while(a!==t)}function Zye(t,e,n,r){const i=[];let s,a,o,l,c;for(s=0,a=e.length;s=n.next.y&&n.next.y!==n.y){const p=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=s&&p>r&&(r=p,i=n.x=n.x&&n.x>=l&&s!==n.x&&qm(ai.x||n.x===i.x&&txe(i,n)))&&(i=n,d=f)),n=n.next;while(n!==o);return i}function txe(t,e){return yr(t.prev,t,e.prev)<0&&yr(e.next,t,t.next)<0}function nxe(t,e,n,r){let i=t;do i.z===0&&(i.z=QP(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,rxe(i)}function rxe(t){let e,n,r,i,s,a,o,l,c=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,r=n,o=0,e=0;e0||l>0&&r;)o!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,o--):(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(a>1);return t}function QP(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 ixe(t){let e=t,n=t;do(e.x=(t-a)*(s-o)&&(t-a)*(r-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(i-a)*(r-o)}function sxe(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!axe(t,e)&&(Uy(t,e)&&Uy(e,t)&&oxe(t,e)&&(yr(t.prev,t,e.prev)||yr(t,e.prev,e))||dM(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 dM(t,e){return t.x===e.x&&t.y===e.y}function D6(t,e,n,r){const i=S_(yr(t,e,n)),s=S_(yr(t,e,r)),a=S_(yr(n,r,t)),o=S_(yr(n,r,e));return!!(i!==s&&a!==o||i===0&&w_(t,n,e)||s===0&&w_(t,r,e)||a===0&&w_(n,t,r)||o===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 axe(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&&D6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Uy(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 oxe(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 U6(t,e){const n=new JP(t.i,t.x,t.y),r=new JP(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 KD(t,e,n,r){const i=new JP(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 jy(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 JP(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 lxe(t,e,n,r){let i=0;for(let s=e,a=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function ZD(t,e){for(let n=0;nNumber.EPSILON){const ze=Math.sqrt(be),Fe=Math.sqrt(Q*Q+W*W),bt=Z.x-Ze/ze,rt=Z.y+qe/ze,ht=Ve.x-W/Fe,Xt=Ve.y+Q/Fe,Ke=((ht-bt)*W-(Xt-rt)*Q)/(qe*W-Ze*Q);Le=bt+qe*Ke-de.x,ne=rt+Ze*Ke-de.y;const te=Le*Le+ne*ne;if(te<=2)return new He(Le,ne);Ce=Math.sqrt(te/2)}else{let ze=!1;qe>Number.EPSILON?Q>Number.EPSILON&&(ze=!0):qe<-Number.EPSILON?Q<-Number.EPSILON&&(ze=!0):Math.sign(Ze)===Math.sign(W)&&(ze=!0),ze?(Le=-Ze,ne=qe,Ce=Math.sqrt(be)):(Le=qe,ne=Ze,Ce=Math.sqrt(be/2))}return new He(Le/Ce,ne/Ce)}const J=[];for(let de=0,Z=ie.length,Ve=Z-1,Le=de+1;de=0;de--){const Z=de/w,Ve=y*Math.cos(Z*Math.PI/2),Le=b*Math.sin(Z*Math.PI/2)+S;for(let ne=0,Ce=ie.length;ne=0;){const Le=Ve;let ne=Ve-1;ne<0&&(ne=de.length-1);for(let Ce=0,qe=d+w*2;Ce0)&&y.push(T,P,N),(x!==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 B6 extends Gr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ct(16777215),this.specular=new ct(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=au,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 ls,this.combine=cx,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 H6 extends Gr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ct(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=au,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 V6 extends Gr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=au,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 G6 extends Gr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ct(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=au,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 ls,this.combine=cx,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 W6 extends Gr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ct(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=au,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 $6 extends $r{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 dh(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 X6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function q6(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 eC(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,a=0;a!==r;++s){const o=n[s]*e;for(let l=0;l!==e;++l)i[a++]=t[o+l]}return i}function VR(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 a=s[r];if(a!==void 0)if(Array.isArray(a))do a=s[r],a!==void 0&&(e.push(s.time),n.push.apply(n,a)),s=t[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[r],a!==void 0&&(e.push(s.time),a.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do a=s[r],a!==void 0&&(e.push(s.time),n.push(a)),s=t[i++];while(s!==void 0)}function fxe(t,e,n,r,i=30){const s=t.clone();s.name=e;const a=[];for(let l=0;l=r)){f.push(c.times[y]);for(let S=0;Ss.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l=o.times[b]){const x=b*f+d,M=x+f-d;S=o.values.slice(x,M)}else{const x=o.createInterpolant(),M=d,T=f-d;x.evaluate(s),S=x.resultBuffer.slice(M,T)}l==="quaternion"&&new qt().fromArray(S).normalize().conjugate().toArray(S);const w=c.times.length;for(let x=0;x=s)){const o=n[1];e=s)break t}a=r,r=0;break n}break e}for(;r>>1;en;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=r.slice(s,a),this.values=this.values.slice(s*o,a*o)}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 a=null;for(let o=0;o!==s;o++){const l=r[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&X6(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,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 a=1;for(let o=1;o0){e[a]=e[s];for(let o=s*r,l=a*r,c=0;c!==r;++c)n[l+c]=n[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=n.slice(0,a*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}}qo.prototype.TimeBufferType=Float32Array;qo.prototype.ValueBufferType=Float32Array;qo.prototype.DefaultInterpolation=Lg;class rp extends qo{constructor(e,n,r){super(e,n,r)}}rp.prototype.ValueTypeName="bool";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=Og;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class WR extends qo{}WR.prototype.ValueTypeName="color";class Wh extends qo{}Wh.prototype.ValueTypeName="number";class Z6 extends ov{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(r-n)/(i-n);let c=e*o;for(let d=c+o;c!==d;c+=4)qt.slerpFlat(s,0,a,c-o,a,c,l);return s}}class $h extends qo{InterpolantFactoryMethodLinear(e){return new Z6(this.times,this.values,this.getValueSize(),e)}}$h.prototype.ValueTypeName="quaternion";$h.prototype.InterpolantFactoryMethodSmooth=void 0;class ip extends qo{constructor(e,n,r){super(e,n,r)}}ip.prototype.ValueTypeName="string";ip.prototype.ValueBufferType=Array;ip.prototype.DefaultInterpolation=Og;ip.prototype.InterpolantFactoryMethodLinear=void 0;ip.prototype.InterpolantFactoryMethodSmooth=void 0;class Xh extends qo{}Xh.prototype.ValueTypeName="vector";class jg{constructor(e="",n=-1,r=[],i=YS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=wa(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let a=0,o=r.length;a!==o;++a)n.push(gxe(r[a]).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,a=r.length;s!==a;++s)n.push(qo.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,a=[];for(let o=0;o1){const f=d[1];let p=i[f];p||(i[f]=p=[]),p.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],n,r));return a}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(f,p,y,b,S){if(y.length!==0){const w=[],x=[];VR(y,w,x,b),w.length!==0&&S.push(new f(p,w,x))}},i=[],s=e.name||"default",a=e.fps||30,o=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(Ac[e]!==void 0){Ac[e].push({onLoad:n,onProgress:r,onError:i});return}Ac[e]=[],Ac[e].push({onLoad:n,onProgress:r,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).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=Ac[e],f=c.body.getReader(),p=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),y=p?parseInt(p):0,b=y!==0;let S=0;const w=new ReadableStream({start(x){M();function M(){f.read().then(({done:T,value:P})=>{if(T)x.close();else{S+=P.byteLength;const O=new ProgressEvent("progress",{lengthComputable:b,loaded:S,total:y});for(let N=0,D=d.length;N{x.error(T)})}}});return new Response(w)}else throw new vxe(`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,o));case"json":return c.json();default:if(o===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(o),p=f&&f[1]?f[1].toLowerCase():void 0,y=new TextDecoder(p);return c.arrayBuffer().then(b=>y.decode(b))}}}).then(c=>{Fc.add(e,c);const d=Ac[e];delete Ac[e];for(let f=0,p=d.length;f{const d=Ac[e];if(d===void 0)throw this.manager.itemError(e),c;delete Ac[e];for(let f=0,p=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 yxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new Go(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}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 a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=r(a.value);break;case"c":i.uniforms[s].value=new ct().setHex(a.value);break;case"v2":i.uniforms[s].value=new He().fromArray(a.value);break;case"v3":i.uniforms[s].value=new q().fromArray(a.value);break;case"v4":i.uniforms[s].value=new On().fromArray(a.value);break;case"m3":i.uniforms[s].value=new $t().fromArray(a.value);break;case"m4":i.uniforms[s].value=new Ct().fromArray(a.value);break;default:i.uniforms[s].value=a.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 bM.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:F6,SpriteMaterial:kR,RawShaderMaterial:z6,ShaderMaterial:Ya,PointsMaterial:iM,MeshPhysicalMaterial:eo,MeshStandardMaterial:yx,MeshPhongMaterial:B6,MeshToonMaterial:H6,MeshNormalMaterial:V6,MeshLambertMaterial:G6,MeshDepthMaterial:RR,MeshDistanceMaterial:NR,MeshBasicMaterial:As,MeshMatcapMaterial:W6,LineDashedMaterial:$6,LineBasicMaterial:$r,Material:Gr};return new n[e]}}class Sd{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 $R(n);s=new Fg(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){i=new Fg(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a{const w=new os;w.min.fromArray(S.boxMin),w.max.fromArray(S.boxMax);const x=new Hi;return x.radius=S.sphereRadius,x.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:w,sphereInitialized:S.sphereInitialized,sphere:x}}),a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._geometryCount=e.geometryCount,a._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":a=new T6;break;case"Line":a=new Ul(o(e.geometry),l(e.material));break;case"LineLoop":a=new LR(o(e.geometry),l(e.material));break;case"LineSegments":a=new ea(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new DR(o(e.geometry),l(e.material));break;case"Sprite":a=new A6(l(e.material));break;case"Group":a=new Ts;break;case"Bone":a=new rM;break;default:a=new mn}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const p=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,a=Fc.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){n&&n(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Fc.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Fc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Fc.add(e,l),s.manager.itemStart(e)}}let M_;class ZR{static getContext(){return M_===void 0&&(M_=new(window.AudioContext||window.webkitAudioContext)),M_}static setContext(e){M_=e}}class Txe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new Go(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);ZR.getContext().decodeAudioData(c,function(f){n(f)}).catch(o)}catch(c){o(c)}},r,i);function o(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const sU=new Ct,aU=new Ct,Df=new Ct;class Pxe{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,Df.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,a=n.near*Math.tan(Ph*n.fov*.5)/n.zoom;let o,l;aU.elements[12]=-i,sU.elements[12]=i,o=-a*n.aspect+s,l=a*n.aspect+s,Df.elements[0]=2*n.near/(l-o),Df.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(Df),o=-a*n.aspect-s,l=a*n.aspect-s,Df.elements[0]=2*n.near/(l-o),Df.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(Df)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(aU),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(sU)}}class QR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=oU(),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=oU();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function oU(){return performance.now()}const Uf=new q,lU=new qt,Cxe=new q,jf=new q;class Rxe extends mn{constructor(){super(),this.type="AudioListener",this.context=ZR.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new QR}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(Uf,lU,Cxe),jf.set(0,0,-1).applyQuaternion(lU),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Uf.x,i),n.positionY.linearRampToValueAtTime(Uf.y,i),n.positionZ.linearRampToValueAtTime(Uf.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(Uf.x,Uf.y,Uf.z),n.setOrientation(jf.x,jf.y,jf.z,r.x,r.y,r.z)}}let lG=class extends mn{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]){o.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,a=i;s!==a;++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 a=0;a!==s;++a)e[n+a]=e[r+a]}_slerp(e,n,r,i){qt.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const a=this._workIndex*s;qt.multiplyQuaternionsFlat(e,a,e,n,e,r),qt.slerpFlat(e,n,e,n,e,a,i)}_lerp(e,n,r,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=n+o;e[l]=e[l]*a+e[r+o]*i}}_lerpAdditive(e,n,r,i,s){for(let a=0;a!==s;++a){const o=n+a;e[o]=e[o]+e[r+a]*i}}}const JR="\\[\\]\\.:\\/",Oxe=new RegExp("["+JR+"]","g"),eN="[^"+JR+"]",Lxe="[^"+JR.replace("\\.","")+"]",Dxe=/((?:WC+[\/:])*)/.source.replace("WC",eN),Uxe=/(WCOD+)?/.source.replace("WCOD",Lxe),jxe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",eN),Fxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",eN),zxe=new RegExp("^"+Dxe+Uxe+jxe+Fxe+"$"),Bxe=["material","materials","bones","map"];class Hxe{constructor(e,n,r){const i=r||Rn.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 Rn{constructor(e,n,r){this.path=n,this.parsedPath=r||Rn.parseTrackName(n),this.node=Rn.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 Rn.Composite(e,n,r):new Rn(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Oxe,"")}static parseTrackName(e){const n=zxe.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);Bxe.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 a=0;a=s){const f=s++,p=e[f];n[p.uuid]=d,e[d]=p,n[c]=f,e[f]=l;for(let y=0,b=i;y!==b;++y){const S=r[y],w=S[f],x=S[d];S[d]=w,S[f]=x}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],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 b=0,S=i;b!==S;++b){const w=r[b];w[f]=w[p],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 a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,f=new Array(c);i=s.length,r[e]=i,a.push(e),o.push(n),s.push(f);for(let p=d,y=l.length;p!==y;++p){const b=l[p];f[p]=new Rn(b,e,n)}return f}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];n[c]=r,a[r]=l,a.pop(),s[r]=s[o],s.pop(),i[r]=i[o],i.pop()}}}class uG{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,a=s.length,o=new Array(a),l={endingStart:lh,endingEnd:lh};for(let c=0;c!==a;++c){const d=s[c].createInterpolant(null);o[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=KV,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,a=s/i,o=i/s;e.warp(1,a,n),this.warp(o,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,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/a,c[1]=n/a,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 a=this._updateTime(n),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case bR:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(a),c[d].accumulateAdditive(o);break;case YS:default:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(a),c[d].accumulate(i,o)}}}_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 a=r===YV;if(e===0)return s===-1?i:a&&(s&1)===1?n-i:i;if(r===qV){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,a)):this._setEndings(this.repetitions===0,!0,a)),i>=n||i<0){const o=Math.floor(i/n);i-=n*o,s+=Math.abs(o);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,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=ch,i.endingEnd=ch):(e?i.endingStart=this.zeroSlopeAtStart?ch:lh:i.endingStart=Py,n?i.endingEnd=this.zeroSlopeAtEnd?ch:lh:i.endingEnd=Py)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=n,o[1]=s+e,l[1]=r,this}}const Gxe=new Float32Array(1);class Wxe extends zl{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,a=e._propertyBindings,o=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 p=i[f],y=p.name;let b=d[y];if(b!==void 0)++b.referenceCount,a[f]=b;else{if(b=a[f],b!==void 0){b._cacheIndex===null&&(++b.referenceCount,this._addInactiveBinding(b,l,y));continue}const S=n&&n._propertyBindings[f].binding.parsedPath;b=new cG(Rn.create(r,y,S),p.ValueTypeName,p.getValueSize()),++b.referenceCount,this._addInactiveBinding(b,l,y),a[f]=b}o[f].resultBuffer=b.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),a=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);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,fU).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 hU=new q,E_=new q;class Zxe{constructor(e=new q,n=new q){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){hU.subVectors(e,this.start),E_.subVectors(this.end,this.start);const r=E_.dot(E_);let s=E_.dot(hU)/r;return n&&(s=Tr(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 pU=new q;class Qxe extends mn{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new Yt,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 a=0,o=1,l=32;a1)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{xU.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(xU,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 hG extends ea{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 Yt;i.setAttribute("position",new Lt(n,3)),i.setAttribute("color",new Lt(r,3));const s=new $r({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new ct,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 dbe{constructor(){this.type="ShapePath",this.color=new ct,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,a){return this.currentPath.bezierCurveTo(e,n,r,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(x){const M=[];for(let T=0,P=x.length;TNumber.EPSILON){if(k<0&&(D=M[N],V=-V,z=M[O],k=-k),x.yz.y)continue;if(x.y===D.y){if(x.x===D.x)return!0}else{const j=k*(x.x-D.x)-V*(x.y-D.y);if(j===0)return!0;if(j<0)continue;P=!P}}else{if(x.y!==D.y)continue;if(z.x<=x.x&&x.x<=D.x||D.x<=x.x&&x.x<=z.x)return!0}}return P}const i=Cl.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new Rh,l.curves=o.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],p=[];let y=[],b=0,S;p[b]=void 0,y[b]=[];for(let x=0,M=s.length;x1){let x=!1,M=0;for(let T=0,P=p.length;T0&&x===!1&&(y=f)}let w;for(let x=0,M=p.length;x=0&&(P[we]=null,T[we].disconnect(Se))}for(let ce=0;ce=P.length){P.push(Se),we=Ee;break}else if(P[Ee]===null){P[Ee]=Se,we=Ee;break}if(we===-1)break}const We=T[we];We&&We.connect(Se)}}const ae=new q,he=new q;function B(se,ce,Se){ae.setFromMatrixPosition(ce.matrixWorld),he.setFromMatrixPosition(Se.matrixWorld);const we=ae.distanceTo(he),We=ce.projectionMatrix.elements,Ee=Se.projectionMatrix.elements,Ge=We[14]/(We[10]-1),$e=We[14]/(We[10]+1),de=(We[9]+1)/We[5],Z=(We[9]-1)/We[5],Ve=(We[8]-1)/We[0],Le=(Ee[8]+1)/Ee[0],ne=Ge*Ve,Ce=Ge*Le,Xe=we/(-Ve+Le),Ze=Xe*-Ve;if(ce.matrixWorld.decompose(se.position,se.quaternion,se.scale),se.translateX(Ze),se.translateZ(Xe),se.matrixWorld.compose(se.position,se.quaternion,se.scale),se.matrixWorldInverse.copy(se.matrixWorld).invert(),We[10]===-1)se.projectionMatrix.copy(ce.projectionMatrix),se.projectionMatrixInverse.copy(ce.projectionMatrixInverse);else{const Q=Ge+Xe,W=$e+Xe,be=ne-Ze,Ue=Ce+(we-Ze),ze=de*$e/W*Q,Fe=Z*$e/W*Q;se.projectionMatrix.makePerspective(be,Ue,ze,Fe,Q,W),se.projectionMatrixInverse.copy(se.projectionMatrix).invert()}}function J(se,ce){ce===null?se.matrixWorld.copy(se.matrix):se.matrixWorld.multiplyMatrices(ce.matrixWorld,se.matrix),se.matrixWorldInverse.copy(se.matrixWorld).invert()}this.updateCamera=function(se){if(i===null)return;let ce=se.near,Se=se.far;S.texture!==null&&(S.depthNear>0&&(ce=S.depthNear),S.depthFar>0&&(Se=S.depthFar)),k.near=z.near=D.near=ce,k.far=z.far=D.far=Se,(j!==k.near||X!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),j=k.near,X=k.far);const we=se.parent,We=k.cameras;J(k,we);for(let Ee=0;Ee0&&(w.alphaTest.value=x.alphaTest);const M=e.get(x),T=M.envMap,P=M.envMapRotation;T&&(w.envMap.value=T,Of.copy(P),Of.x*=-1,Of.y*=-1,Of.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Of.y*=-1,Of.z*=-1),w.envMapRotation.value.setFromMatrix4(wye.makeRotationFromEuler(Of)),w.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=x.reflectivity,w.ior.value=x.ior,w.refractionRatio.value=x.refractionRatio),x.lightMap&&(w.lightMap.value=x.lightMap,w.lightMapIntensity.value=x.lightMapIntensity,n(x.lightMap,w.lightMapTransform)),x.aoMap&&(w.aoMap.value=x.aoMap,w.aoMapIntensity.value=x.aoMapIntensity,n(x.aoMap,w.aoMapTransform))}function a(w,x){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,x.map&&(w.map.value=x.map,n(x.map,w.mapTransform))}function o(w,x){w.dashSize.value=x.dashSize,w.totalSize.value=x.dashSize+x.gapSize,w.scale.value=x.scale}function l(w,x,M,T){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,w.size.value=x.size*M,w.scale.value=T*.5,x.map&&(w.map.value=x.map,n(x.map,w.uvTransform)),x.alphaMap&&(w.alphaMap.value=x.alphaMap,n(x.alphaMap,w.alphaMapTransform)),x.alphaTest>0&&(w.alphaTest.value=x.alphaTest)}function c(w,x){w.diffuse.value.copy(x.color),w.opacity.value=x.opacity,w.rotation.value=x.rotation,x.map&&(w.map.value=x.map,n(x.map,w.mapTransform)),x.alphaMap&&(w.alphaMap.value=x.alphaMap,n(x.alphaMap,w.alphaMapTransform)),x.alphaTest>0&&(w.alphaTest.value=x.alphaTest)}function d(w,x){w.specular.value.copy(x.specular),w.shininess.value=Math.max(x.shininess,1e-4)}function f(w,x){x.gradientMap&&(w.gradientMap.value=x.gradientMap)}function p(w,x){w.metalness.value=x.metalness,x.metalnessMap&&(w.metalnessMap.value=x.metalnessMap,n(x.metalnessMap,w.metalnessMapTransform)),w.roughness.value=x.roughness,x.roughnessMap&&(w.roughnessMap.value=x.roughnessMap,n(x.roughnessMap,w.roughnessMapTransform)),x.envMap&&(w.envMapIntensity.value=x.envMapIntensity)}function y(w,x,M){w.ior.value=x.ior,x.sheen>0&&(w.sheenColor.value.copy(x.sheenColor).multiplyScalar(x.sheen),w.sheenRoughness.value=x.sheenRoughness,x.sheenColorMap&&(w.sheenColorMap.value=x.sheenColorMap,n(x.sheenColorMap,w.sheenColorMapTransform)),x.sheenRoughnessMap&&(w.sheenRoughnessMap.value=x.sheenRoughnessMap,n(x.sheenRoughnessMap,w.sheenRoughnessMapTransform))),x.clearcoat>0&&(w.clearcoat.value=x.clearcoat,w.clearcoatRoughness.value=x.clearcoatRoughness,x.clearcoatMap&&(w.clearcoatMap.value=x.clearcoatMap,n(x.clearcoatMap,w.clearcoatMapTransform)),x.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap,n(x.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),x.clearcoatNormalMap&&(w.clearcoatNormalMap.value=x.clearcoatNormalMap,n(x.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),x.side===as&&w.clearcoatNormalScale.value.negate())),x.dispersion>0&&(w.dispersion.value=x.dispersion),x.iridescence>0&&(w.iridescence.value=x.iridescence,w.iridescenceIOR.value=x.iridescenceIOR,w.iridescenceThicknessMinimum.value=x.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=x.iridescenceThicknessRange[1],x.iridescenceMap&&(w.iridescenceMap.value=x.iridescenceMap,n(x.iridescenceMap,w.iridescenceMapTransform)),x.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=x.iridescenceThicknessMap,n(x.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),x.transmission>0&&(w.transmission.value=x.transmission,w.transmissionSamplerMap.value=M.texture,w.transmissionSamplerSize.value.set(M.width,M.height),x.transmissionMap&&(w.transmissionMap.value=x.transmissionMap,n(x.transmissionMap,w.transmissionMapTransform)),w.thickness.value=x.thickness,x.thicknessMap&&(w.thicknessMap.value=x.thicknessMap,n(x.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=x.attenuationDistance,w.attenuationColor.value.copy(x.attenuationColor)),x.anisotropy>0&&(w.anisotropyVector.value.set(x.anisotropy*Math.cos(x.anisotropyRotation),x.anisotropy*Math.sin(x.anisotropyRotation)),x.anisotropyMap&&(w.anisotropyMap.value=x.anisotropyMap,n(x.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=x.specularIntensity,w.specularColor.value.copy(x.specularColor),x.specularColorMap&&(w.specularColorMap.value=x.specularColorMap,n(x.specularColorMap,w.specularColorMapTransform)),x.specularIntensityMap&&(w.specularIntensityMap.value=x.specularIntensityMap,n(x.specularIntensityMap,w.specularIntensityMapTransform))}function b(w,x){x.matcap&&(w.matcap.value=x.matcap)}function S(w,x){const M=e.get(x).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 Mye(t,e,n,r){let i={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(M,T){const P=T.program;r.uniformBlockBinding(M,P)}function c(M,T){let P=i[M.id];P===void 0&&(b(M),P=d(M),i[M.id]=P,M.addEventListener("dispose",w));const O=T.program;r.updateUBOMapping(M,O);const N=e.render.frame;s[M.id]!==N&&(p(M),s[M.id]=N)}function d(M){const T=f();M.__bindingPointIndex=T;const P=t.createBuffer(),O=M.__size,N=M.usage;return t.bindBuffer(t.UNIFORM_BUFFER,P),t.bufferData(t.UNIFORM_BUFFER,O,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,T,P),P}function f(){for(let M=0;M0&&(P+=O-N),M.__size=P,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 P=a.indexOf(T.__bindingPointIndex);a.splice(P,1),t.deleteBuffer(i[T.id]),delete i[T.id],delete s[T.id]}function x(){for(const M in i)t.deleteBuffer(i[M]);a=[],i={},s={}}return{bind:l,update:c,dispose:x}}class E6{constructor(e={}){const{canvas:n=d6(),context:r=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let p;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=r.getContextAttributes().alpha}else p=a;const y=new Uint32Array(4),b=new Int32Array(4);let S=null,w=null;const x=[],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=Fi,this.toneMapping=Tl,this.toneMappingExposure=1;const T=this;let P=!1,O=0,N=0,D=null,z=-1,V=null;const k=new On,j=new On;let X=null;const ee=new ct(0);let ie=0,pe=n.width,ae=n.height,he=1,B=null,J=null;const Y=new On(0,0,pe,ae),H=new On(0,0,pe,ae);let G=!1;const le=new px;let se=!1,ce=!1;const Se=new Ct,we=new Ct,We=new q,Ee=new On,Ge={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let $e=!1;function de(){return D===null?he:1}let Z=r;function Ve(K,xe){return n.getContext(K,xe)}try{const K={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Pd}`),n.addEventListener("webglcontextlost",Be,!1),n.addEventListener("webglcontextrestored",at,!1),n.addEventListener("webglcontextcreationerror",pt,!1),Z===null){const xe="webgl2";if(Z=Ve(xe,K),Z===null)throw Ve(xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(K){throw console.error("THREE.WebGLRenderer: "+K.message),K}let Le,ne,Ce,Xe,Ze,Q,W,be,Ue,ze,Fe,bt,rt,ht,Xt,Ke,te,tt,Mt,vt,Zt,fe,qe,ue;function Ye(){Le=new Rve(Z),Le.init(),fe=new S6(Z,Le),ne=new Mve(Z,Le,e,fe),Ce=new uye(Z),ne.reverseDepthBuffer&&Ce.buffers.depth.setReversed(!0),Xe=new kve(Z),Ze=new Z0e,Q=new gye(Z,Le,Ce,Ze,ne,fe,Xe),W=new Ave(T),be=new Cve(T),Ue=new zpe(Z),qe=new wve(Z,Ue),ze=new Nve(Z,Ue,Xe,qe),Fe=new Lve(Z,ze,Ue,Xe),Mt=new Ove(Z,ne,Q),Ke=new Eve(Ze),bt=new Y0e(T,W,be,Le,ne,qe,Ke),rt=new Sye(T,Ze),ht=new J0e,Xt=new sye(Le),tt=new _ve(T,W,be,Ce,Fe,p,l),te=new lye(T,Fe,ne),ue=new Mye(Z,Xe,ne,Ce),vt=new Sve(Z,Le,Xe),Zt=new Ive(Z,Le,Xe),Xe.programs=bt.programs,T.capabilities=ne,T.extensions=Le,T.properties=Ze,T.renderLists=ht,T.shadowMap=te,T.state=Ce,T.info=Xe}Ye();const Re=new _ye(T,Z);this.xr=Re,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){const K=Le.get("WEBGL_lose_context");K&&K.loseContext()},this.forceContextRestore=function(){const K=Le.get("WEBGL_lose_context");K&&K.restoreContext()},this.getPixelRatio=function(){return he},this.setPixelRatio=function(K){K!==void 0&&(he=K,this.setSize(pe,ae,!1))},this.getSize=function(K){return K.set(pe,ae)},this.setSize=function(K,xe,Te=!0){if(Re.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}pe=K,ae=xe,n.width=Math.floor(K*he),n.height=Math.floor(xe*he),Te===!0&&(n.style.width=K+"px",n.style.height=xe+"px"),this.setViewport(0,0,K,xe)},this.getDrawingBufferSize=function(K){return K.set(pe*he,ae*he).floor()},this.setDrawingBufferSize=function(K,xe,Te){pe=K,ae=xe,he=Te,n.width=Math.floor(K*Te),n.height=Math.floor(xe*Te),this.setViewport(0,0,K,xe)},this.getCurrentViewport=function(K){return K.copy(k)},this.getViewport=function(K){return K.copy(Y)},this.setViewport=function(K,xe,Te,Ie){K.isVector4?Y.set(K.x,K.y,K.z,K.w):Y.set(K,xe,Te,Ie),Ce.viewport(k.copy(Y).multiplyScalar(he).round())},this.getScissor=function(K){return K.copy(H)},this.setScissor=function(K,xe,Te,Ie){K.isVector4?H.set(K.x,K.y,K.z,K.w):H.set(K,xe,Te,Ie),Ce.scissor(j.copy(H).multiplyScalar(he).round())},this.getScissorTest=function(){return G},this.setScissorTest=function(K){Ce.setScissorTest(G=K)},this.setOpaqueSort=function(K){B=K},this.setTransparentSort=function(K){J=K},this.getClearColor=function(K){return K.copy(tt.getClearColor())},this.setClearColor=function(){tt.setClearColor.apply(tt,arguments)},this.getClearAlpha=function(){return tt.getClearAlpha()},this.setClearAlpha=function(){tt.setClearAlpha.apply(tt,arguments)},this.clear=function(K=!0,xe=!0,Te=!0){let Ie=0;if(K){let Me=!1;if(D!==null){const it=D.texture.format;Me=it===KS||it===qS||it===ux}if(Me){const it=D.texture.type,yt=it===Ho||it===Qc||it===kg||it===Bh||it===WS||it===$S,lt=tt.getClearColor(),Et=tt.getClearAlpha(),jt=lt.r,Bt=lt.g,Rt=lt.b;yt?(y[0]=jt,y[1]=Bt,y[2]=Rt,y[3]=Et,Z.clearBufferuiv(Z.COLOR,0,y)):(b[0]=jt,b[1]=Bt,b[2]=Rt,b[3]=Et,Z.clearBufferiv(Z.COLOR,0,b))}else Ie|=Z.COLOR_BUFFER_BIT}xe&&(Ie|=Z.DEPTH_BUFFER_BIT,Z.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Te&&(Ie|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(Ie)},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",Be,!1),n.removeEventListener("webglcontextrestored",at,!1),n.removeEventListener("webglcontextcreationerror",pt,!1),ht.dispose(),Xt.dispose(),Ze.dispose(),W.dispose(),be.dispose(),Fe.dispose(),qe.dispose(),ue.dispose(),bt.dispose(),Re.dispose(),Re.removeEventListener("sessionstart",Mi),Re.removeEventListener("sessionend",to),Ei.stop()};function Be(K){K.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),P=!0}function at(){console.log("THREE.WebGLRenderer: Context Restored."),P=!1;const K=Xe.autoReset,xe=te.enabled,Te=te.autoUpdate,Ie=te.needsUpdate,Me=te.type;Ye(),Xe.autoReset=K,te.enabled=xe,te.autoUpdate=Te,te.needsUpdate=Ie,te.type=Me}function pt(K){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",K.statusMessage)}function Jt(K){const xe=K.target;xe.removeEventListener("dispose",Jt),pn(xe)}function pn(K){jn(K),Ze.remove(K)}function jn(K){const xe=Ze.get(K).programs;xe!==void 0&&(xe.forEach(function(Te){bt.releaseProgram(Te)}),K.isShaderMaterial&&bt.releaseShaderCache(K))}this.renderBufferDirect=function(K,xe,Te,Ie,Me,it){xe===null&&(xe=Ge);const yt=Me.isMesh&&Me.matrixWorld.determinant()<0,lt=Ta(K,xe,Te,Ie,Me);Ce.setMaterial(Ie,yt);let Et=Te.index,jt=1;if(Ie.wireframe===!0){if(Et=ze.getWireframeAttribute(Te),Et===void 0)return;jt=2}const Bt=Te.drawRange,Rt=Te.attributes.position;let Sn=Bt.start*jt,Mn=(Bt.start+Bt.count)*jt;it!==null&&(Sn=Math.max(Sn,it.start*jt),Mn=Math.min(Mn,(it.start+it.count)*jt)),Et!==null?(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Et.count)):Rt!=null&&(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Rt.count));const yn=Mn-Sn;if(yn<0||yn===1/0)return;qe.setup(Me,Ie,lt,Te,Et);let Kt,Ut=vt;if(Et!==null&&(Kt=Ue.get(Et),Ut=Zt,Ut.setIndex(Kt)),Me.isMesh)Ie.wireframe===!0?(Ce.setLineWidth(Ie.wireframeLinewidth*de()),Ut.setMode(Z.LINES)):Ut.setMode(Z.TRIANGLES);else if(Me.isLine){let mt=Ie.linewidth;mt===void 0&&(mt=1),Ce.setLineWidth(mt*de()),Me.isLineSegments?Ut.setMode(Z.LINES):Me.isLineLoop?Ut.setMode(Z.LINE_LOOP):Ut.setMode(Z.LINE_STRIP)}else Me.isPoints?Ut.setMode(Z.POINTS):Me.isSprite&&Ut.setMode(Z.TRIANGLES);if(Me.isBatchedMesh)if(Me._multiDrawInstances!==null)Ut.renderMultiDrawInstances(Me._multiDrawStarts,Me._multiDrawCounts,Me._multiDrawCount,Me._multiDrawInstances);else if(Le.get("WEBGL_multi_draw"))Ut.renderMultiDraw(Me._multiDrawStarts,Me._multiDrawCounts,Me._multiDrawCount);else{const mt=Me._multiDrawStarts,xn=Me._multiDrawCounts,tn=Me._multiDrawCount,Rr=Et?Ue.get(Et).bytesPerElement:1,li=Ze.get(Ie).currentProgram.getUniforms();for(let In=0;In{function it(){if(Ie.forEach(function(yt){Ze.get(yt).currentProgram.isReady()&&Ie.delete(yt)}),Ie.size===0){Me(K);return}setTimeout(it,10)}Le.get("KHR_parallel_shader_compile")!==null?it():setTimeout(it,10)})};let Hn=null;function pr(K){Hn&&Hn(K)}function Mi(){Ei.stop()}function to(){Ei.start()}const Ei=new y6;Ei.setAnimationLoop(pr),typeof self<"u"&&Ei.setContext(self),this.setAnimationLoop=function(K){Hn=K,Re.setAnimationLoop(K),K===null?Ei.stop():Ei.start()},Re.addEventListener("sessionstart",Mi),Re.addEventListener("sessionend",to),this.render=function(K,xe){if(xe!==void 0&&xe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;if(K.matrixWorldAutoUpdate===!0&&K.updateMatrixWorld(),xe.parent===null&&xe.matrixWorldAutoUpdate===!0&&xe.updateMatrixWorld(),Re.enabled===!0&&Re.isPresenting===!0&&(Re.cameraAutoUpdate===!0&&Re.updateCamera(xe),xe=Re.getCamera()),K.isScene===!0&&K.onBeforeRender(T,K,xe,D),w=Xt.get(K,M.length),w.init(xe),M.push(w),we.multiplyMatrices(xe.projectionMatrix,xe.matrixWorldInverse),le.setFromProjectionMatrix(we),ce=this.localClippingEnabled,se=Ke.init(this.clippingPlanes,ce),S=ht.get(K,x.length),S.init(),x.push(S),Re.enabled===!0&&Re.isPresenting===!0){const it=T.xr.getDepthSensingMesh();it!==null&&Ko(it,xe,-1/0,T.sortObjects)}Ko(K,xe,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(B,J),$e=Re.enabled===!1||Re.isPresenting===!1||Re.hasDepthSensing()===!1,$e&&tt.addToRenderList(S,K),this.info.render.frame++,se===!0&&Ke.beginShadows();const Te=w.state.shadowsArray;te.render(Te,K,xe),se===!0&&Ke.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ie=S.opaque,Me=S.transmissive;if(w.setupLights(),xe.isArrayCamera){const it=xe.cameras;if(Me.length>0)for(let yt=0,lt=it.length;yt0&&no(Ie,Me,K,xe),$e&&tt.render(K),Ns(S,K,xe);D!==null&&(Q.updateMultisampleRenderTarget(D),Q.updateRenderTargetMipmap(D)),K.isScene===!0&&K.onAfterRender(T,K,xe),qe.resetDefaultState(),z=-1,V=null,M.pop(),M.length>0?(w=M[M.length-1],se===!0&&Ke.setGlobalState(T.clippingPlanes,w.state.camera)):w=null,x.pop(),x.length>0?S=x[x.length-1]:S=null};function Ko(K,xe,Te,Ie){if(K.visible===!1)return;if(K.layers.test(xe.layers)){if(K.isGroup)Te=K.renderOrder;else if(K.isLOD)K.autoUpdate===!0&&K.update(xe);else if(K.isLight)w.pushLight(K),K.castShadow&&w.pushShadow(K);else if(K.isSprite){if(!K.frustumCulled||le.intersectsSprite(K)){Ie&&Ee.setFromMatrixPosition(K.matrixWorld).applyMatrix4(we);const yt=Fe.update(K),lt=K.material;lt.visible&&S.push(K,yt,lt,Te,Ee.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||le.intersectsObject(K))){const yt=Fe.update(K),lt=K.material;if(Ie&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),Ee.copy(K.boundingSphere.center)):(yt.boundingSphere===null&&yt.computeBoundingSphere(),Ee.copy(yt.boundingSphere.center)),Ee.applyMatrix4(K.matrixWorld).applyMatrix4(we)),Array.isArray(lt)){const Et=yt.groups;for(let jt=0,Bt=Et.length;jt0&&Ai(Me,xe,Te),it.length>0&&Ai(it,xe,Te),yt.length>0&&Ai(yt,xe,Te),Ce.buffers.depth.setTest(!0),Ce.buffers.depth.setMask(!0),Ce.buffers.color.setMask(!0),Ce.setPolygonOffset(!1)}function no(K,xe,Te,Ie){if((Te.isScene===!0?Te.overrideMaterial:null)!==null)return;w.state.transmissionRenderTarget[Ie.id]===void 0&&(w.state.transmissionRenderTarget[Ie.id]=new Vo(1,1,{generateMipmaps:!0,type:Le.has("EXT_color_buffer_half_float")||Le.has("EXT_color_buffer_float")?rv:Ho,minFilter:$a,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Nn.workingColorSpace}));const it=w.state.transmissionRenderTarget[Ie.id],yt=Ie.viewport||k;it.setSize(yt.z,yt.w);const lt=T.getRenderTarget();T.setRenderTarget(it),T.getClearColor(ee),ie=T.getClearAlpha(),ie<1&&T.setClearColor(16777215,.5),T.clear(),$e&&tt.render(Te);const Et=T.toneMapping;T.toneMapping=Tl;const jt=Ie.viewport;if(Ie.viewport!==void 0&&(Ie.viewport=void 0),w.setupLightsView(Ie),se===!0&&Ke.setGlobalState(T.clippingPlanes,Ie),Ai(K,Te,Ie),Q.updateMultisampleRenderTarget(it),Q.updateRenderTargetMipmap(it),Le.has("WEBGL_multisampled_render_to_texture")===!1){let Bt=!1;for(let Rt=0,Sn=xe.length;Rt0),Rt=!!Te.morphAttributes.position,Sn=!!Te.morphAttributes.normal,Mn=!!Te.morphAttributes.color;let yn=Tl;Ie.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(yn=T.toneMapping);const Kt=Te.morphAttributes.position||Te.morphAttributes.normal||Te.morphAttributes.color,Ut=Kt!==void 0?Kt.length:0,mt=Ze.get(Ie),xn=w.state.lights;if(se===!0&&(ce===!0||K!==V)){const Xr=K===V&&Ie.id===z;Ke.setState(Ie,K,Xr)}let tn=!1;Ie.version===mt.__version?(mt.needsLights&&mt.lightsStateVersion!==xn.state.version||mt.outputColorSpace!==lt||Me.isBatchedMesh&&mt.batching===!1||!Me.isBatchedMesh&&mt.batching===!0||Me.isBatchedMesh&&mt.batchingColor===!0&&Me.colorTexture===null||Me.isBatchedMesh&&mt.batchingColor===!1&&Me.colorTexture!==null||Me.isInstancedMesh&&mt.instancing===!1||!Me.isInstancedMesh&&mt.instancing===!0||Me.isSkinnedMesh&&mt.skinning===!1||!Me.isSkinnedMesh&&mt.skinning===!0||Me.isInstancedMesh&&mt.instancingColor===!0&&Me.instanceColor===null||Me.isInstancedMesh&&mt.instancingColor===!1&&Me.instanceColor!==null||Me.isInstancedMesh&&mt.instancingMorph===!0&&Me.morphTexture===null||Me.isInstancedMesh&&mt.instancingMorph===!1&&Me.morphTexture!==null||mt.envMap!==Et||Ie.fog===!0&&mt.fog!==it||mt.numClippingPlanes!==void 0&&(mt.numClippingPlanes!==Ke.numPlanes||mt.numIntersection!==Ke.numIntersection)||mt.vertexAlphas!==jt||mt.vertexTangents!==Bt||mt.morphTargets!==Rt||mt.morphNormals!==Sn||mt.morphColors!==Mn||mt.toneMapping!==yn||mt.morphTargetsCount!==Ut)&&(tn=!0):(tn=!0,mt.__version=Ie.version);let Rr=mt.currentProgram;tn===!0&&(Rr=ro(Ie,xe,Me));let li=!1,In=!1,Is=!1;const Vn=Rr.getUniforms(),ta=mt.uniforms;if(Ce.useProgram(Rr.program)&&(li=!0,In=!0,Is=!0),Ie.id!==z&&(z=Ie.id,In=!0),li||V!==K){ne.reverseDepthBuffer?(Se.copy(K.projectionMatrix),upe(Se),dpe(Se),Vn.setValue(Z,"projectionMatrix",Se)):Vn.setValue(Z,"projectionMatrix",K.projectionMatrix),Vn.setValue(Z,"viewMatrix",K.matrixWorldInverse);const Xr=Vn.map.cameraPosition;Xr!==void 0&&Xr.setValue(Z,We.setFromMatrixPosition(K.matrixWorld)),ne.logarithmicDepthBuffer&&Vn.setValue(Z,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),(Ie.isMeshPhongMaterial||Ie.isMeshToonMaterial||Ie.isMeshLambertMaterial||Ie.isMeshBasicMaterial||Ie.isMeshStandardMaterial||Ie.isShaderMaterial)&&Vn.setValue(Z,"isOrthographic",K.isOrthographicCamera===!0),V!==K&&(V=K,In=!0,Is=!0)}if(Me.isSkinnedMesh){Vn.setOptional(Z,Me,"bindMatrix"),Vn.setOptional(Z,Me,"bindMatrixInverse");const Xr=Me.skeleton;Xr&&(Xr.boneTexture===null&&Xr.computeBoneTexture(),Vn.setValue(Z,"boneTexture",Xr.boneTexture,Q))}Me.isBatchedMesh&&(Vn.setOptional(Z,Me,"batchingTexture"),Vn.setValue(Z,"batchingTexture",Me._matricesTexture,Q),Vn.setOptional(Z,Me,"batchingIdTexture"),Vn.setValue(Z,"batchingIdTexture",Me._indirectTexture,Q),Vn.setOptional(Z,Me,"batchingColorTexture"),Me._colorsTexture!==null&&Vn.setValue(Z,"batchingColorTexture",Me._colorsTexture,Q));const Yo=Te.morphAttributes;if((Yo.position!==void 0||Yo.normal!==void 0||Yo.color!==void 0)&&Mt.update(Me,Te,Rr),(In||mt.receiveShadow!==Me.receiveShadow)&&(mt.receiveShadow=Me.receiveShadow,Vn.setValue(Z,"receiveShadow",Me.receiveShadow)),Ie.isMeshGouraudMaterial&&Ie.envMap!==null&&(ta.envMap.value=Et,ta.flipEnvMap.value=Et.isCubeTexture&&Et.isRenderTargetTexture===!1?-1:1),Ie.isMeshStandardMaterial&&Ie.envMap===null&&xe.environment!==null&&(ta.envMapIntensity.value=xe.environmentIntensity),In&&(Vn.setValue(Z,"toneMappingExposure",T.toneMappingExposure),mt.needsLights&&cu(ta,Is),it&&Ie.fog===!0&&rt.refreshFogUniforms(ta,it),rt.refreshMaterialUniforms(ta,Ie,he,ae,w.state.transmissionRenderTarget[K.id]),K_.upload(Z,ou(mt),ta,Q)),Ie.isShaderMaterial&&Ie.uniformsNeedUpdate===!0&&(K_.upload(Z,ou(mt),ta,Q),Ie.uniformsNeedUpdate=!1),Ie.isSpriteMaterial&&Vn.setValue(Z,"center",Me.center),Vn.setValue(Z,"modelViewMatrix",Me.modelViewMatrix),Vn.setValue(Z,"normalMatrix",Me.normalMatrix),Vn.setValue(Z,"modelMatrix",Me.matrixWorld),Ie.isShaderMaterial||Ie.isRawShaderMaterial){const Xr=Ie.uniformsGroups;for(let ci=0,Ud=Xr.length;ci0&&Q.useMultisampledRTT(K)===!1?Me=Ze.get(K).__webglMultisampledFramebuffer:Array.isArray(Bt)?Me=Bt[Te]:Me=Bt,k.copy(K.viewport),j.copy(K.scissor),X=K.scissorTest}else k.copy(Y).multiplyScalar(he).floor(),j.copy(H).multiplyScalar(he).floor(),X=G;if(Ce.bindFramebuffer(Z.FRAMEBUFFER,Me)&&Ie&&Ce.drawBuffers(K,Me),Ce.viewport(k),Ce.scissor(j),Ce.setScissorTest(X),it){const Et=Ze.get(K.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Et.__webglTexture,Te)}else if(yt){const Et=Ze.get(K.texture),jt=xe||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Et.__webglTexture,Te||0,jt)}z=-1},this.readRenderTargetPixels=function(K,xe,Te,Ie,Me,it,yt){if(!(K&&K.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let lt=Ze.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&yt!==void 0&&(lt=lt[yt]),lt){Ce.bindFramebuffer(Z.FRAMEBUFFER,lt);try{const Et=K.texture,jt=Et.format,Bt=Et.type;if(!ne.textureFormatReadable(jt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ne.textureTypeReadable(Bt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}xe>=0&&xe<=K.width-Ie&&Te>=0&&Te<=K.height-Me&&Z.readPixels(xe,Te,Ie,Me,fe.convert(jt),fe.convert(Bt),it)}finally{const Et=D!==null?Ze.get(D).__webglFramebuffer:null;Ce.bindFramebuffer(Z.FRAMEBUFFER,Et)}}},this.readRenderTargetPixelsAsync=async function(K,xe,Te,Ie,Me,it,yt){if(!(K&&K.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let lt=Ze.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&yt!==void 0&&(lt=lt[yt]),lt){const Et=K.texture,jt=Et.format,Bt=Et.type;if(!ne.textureFormatReadable(jt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ne.textureTypeReadable(Bt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(xe>=0&&xe<=K.width-Ie&&Te>=0&&Te<=K.height-Me){Ce.bindFramebuffer(Z.FRAMEBUFFER,lt);const Rt=Z.createBuffer();Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Rt),Z.bufferData(Z.PIXEL_PACK_BUFFER,it.byteLength,Z.STREAM_READ),Z.readPixels(xe,Te,Ie,Me,fe.convert(jt),fe.convert(Bt),0);const Sn=D!==null?Ze.get(D).__webglFramebuffer:null;Ce.bindFramebuffer(Z.FRAMEBUFFER,Sn);const Mn=Z.fenceSync(Z.SYNC_GPU_COMMANDS_COMPLETE,0);return Z.flush(),await cpe(Z,Mn,4),Z.bindBuffer(Z.PIXEL_PACK_BUFFER,Rt),Z.getBufferSubData(Z.PIXEL_PACK_BUFFER,0,it),Z.deleteBuffer(Rt),Z.deleteSync(Mn),it}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(K,xe=null,Te=0){K.isTexture!==!0&&(q_("WebGLRenderer: copyFramebufferToTexture function signature has changed."),xe=arguments[0]||null,K=arguments[1]);const Ie=Math.pow(2,-Te),Me=Math.floor(K.image.width*Ie),it=Math.floor(K.image.height*Ie),yt=xe!==null?xe.x:0,lt=xe!==null?xe.y:0;Q.setTexture2D(K,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,Te,0,0,yt,lt,Me,it),Ce.unbindTexture()},this.copyTextureToTexture=function(K,xe,Te=null,Ie=null,Me=0){K.isTexture!==!0&&(q_("WebGLRenderer: copyTextureToTexture function signature has changed."),Ie=arguments[0]||null,K=arguments[1],xe=arguments[2],Me=arguments[3]||0,Te=null);let it,yt,lt,Et,jt,Bt;Te!==null?(it=Te.max.x-Te.min.x,yt=Te.max.y-Te.min.y,lt=Te.min.x,Et=Te.min.y):(it=K.image.width,yt=K.image.height,lt=0,Et=0),Ie!==null?(jt=Ie.x,Bt=Ie.y):(jt=0,Bt=0);const Rt=fe.convert(xe.format),Sn=fe.convert(xe.type);Q.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 Mn=Z.getParameter(Z.UNPACK_ROW_LENGTH),yn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Kt=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Ut=Z.getParameter(Z.UNPACK_SKIP_ROWS),mt=Z.getParameter(Z.UNPACK_SKIP_IMAGES),xn=K.isCompressedTexture?K.mipmaps[Me]:K.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,xn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,xn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,lt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Et),K.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,Me,jt,Bt,it,yt,Rt,Sn,xn.data):K.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,Me,jt,Bt,xn.width,xn.height,Rt,xn.data):Z.texSubImage2D(Z.TEXTURE_2D,Me,jt,Bt,it,yt,Rt,Sn,xn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Mn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,yn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Kt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Ut),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,mt),Me===0&&xe.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),Ce.unbindTexture()},this.copyTextureToTexture3D=function(K,xe,Te=null,Ie=null,Me=0){K.isTexture!==!0&&(q_("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Te=arguments[0]||null,Ie=arguments[1]||null,K=arguments[2],xe=arguments[3],Me=arguments[4]||0);let it,yt,lt,Et,jt,Bt,Rt,Sn,Mn;const yn=K.isCompressedTexture?K.mipmaps[Me]:K.image;Te!==null?(it=Te.max.x-Te.min.x,yt=Te.max.y-Te.min.y,lt=Te.max.z-Te.min.z,Et=Te.min.x,jt=Te.min.y,Bt=Te.min.z):(it=yn.width,yt=yn.height,lt=yn.depth,Et=0,jt=0,Bt=0),Ie!==null?(Rt=Ie.x,Sn=Ie.y,Mn=Ie.z):(Rt=0,Sn=0,Mn=0);const Kt=fe.convert(xe.format),Ut=fe.convert(xe.type);let mt;if(xe.isData3DTexture)Q.setTexture3D(xe,0),mt=Z.TEXTURE_3D;else if(xe.isDataArrayTexture||xe.isCompressedArrayTexture)Q.setTexture2DArray(xe,0),mt=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 xn=Z.getParameter(Z.UNPACK_ROW_LENGTH),tn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Rr=Z.getParameter(Z.UNPACK_SKIP_PIXELS),li=Z.getParameter(Z.UNPACK_SKIP_ROWS),In=Z.getParameter(Z.UNPACK_SKIP_IMAGES);Z.pixelStorei(Z.UNPACK_ROW_LENGTH,yn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,yn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Et),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,jt),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,Bt),K.isDataTexture||K.isData3DTexture?Z.texSubImage3D(mt,Me,Rt,Sn,Mn,it,yt,lt,Kt,Ut,yn.data):xe.isCompressedArrayTexture?Z.compressedTexSubImage3D(mt,Me,Rt,Sn,Mn,it,yt,lt,Kt,yn.data):Z.texSubImage3D(mt,Me,Rt,Sn,Mn,it,yt,lt,Kt,Ut,yn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,xn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,tn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Rr),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,li),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,In),Me===0&&xe.generateMipmaps&&Z.generateMipmap(mt),Ce.unbindTexture()},this.initRenderTarget=function(K){Ze.get(K).__webglFramebuffer===void 0&&Q.setupRenderTarget(K)},this.initTexture=function(K){K.isCubeTexture?Q.setTextureCube(K,0):K.isData3DTexture?Q.setTexture3D(K,0):K.isDataArrayTexture||K.isCompressedArrayTexture?Q.setTexture2DArray(K,0):Q.setTexture2D(K,0),Ce.unbindTexture()},this.resetState=function(){O=0,N=0,D=null,Ce.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===ZS?"display-p3":"srgb",n.unpackColorSpace=Nn.workingColorSpace===dx?"display-p3":"srgb"}}class eM{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ct(e),this.density=n}clone(){return new eM(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class tM{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new ct(e),this.near=n,this.far=r}clone(){return new tM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class IR extends mn{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 ls,this.environmentIntensity=1,this.environmentRotation=new ls,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=wa()}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:Ks.getInterpolation(w0,a_,M0,o_,CD,SA,RD,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){Cm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(S0.x=s*Cm.x-i*Cm.y,S0.y=i*Cm.x+s*Cm.y):S0.copy(Cm),t.copy(e),t.x+=S0.x,t.y+=S0.y,t.applyMatrix4(A6)}const c_=new q,ND=new q;class P6 extends mn{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),ND.setFromMatrixPosition(this.matrixWorld);const r=c_.distanceTo(ND)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i=a)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 a=i[this.index];s.push(a),this.index++,a.start=e.start,a.count=e.count,a.z=n,a.index=r}reset(){this.list.length=0,this.index=0}}const Zu=new Ct,AA=new Ct,Nye=new Ct,Iye=new ct(1,1,1),zD=new Ct,TA=new px,f_=new os,Lf=new Hi,T0=new q,BD=new q,kye=new q,PA=new Rye,ts=new xr,h_=[];function Oye(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 Qt(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 os);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,a=s.image.data;Nye.toArray(a,i*16),s.needsUpdate=!0;const o=this._colorsTexture;return o&&(Iye.toArray(o.image.data,i*4),o.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 a=this._reservedRanges,o=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=a[a.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++,a.push(i),o.push({start:d?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new os,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(),a=n.getIndex(),o=this._reservedRanges[e];if(i&&a.count>o.indexCount||n.attributes.position.count>o.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.vertexCount;for(const y in r.attributes){const b=n.getAttribute(y),S=r.getAttribute(y);Oye(b,S,l);const w=b.itemSize;for(let x=b.count,M=c;x=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 a=s.index,o=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 a=s.index,o=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,a=this.geometry;ts.material=this.material,ts.geometry.index=a.index,ts.geometry.attributes=a.attributes,ts.geometry.boundingBox===null&&(ts.geometry.boundingBox=new os),ts.geometry.boundingSphere===null&&(ts.geometry.boundingSphere=new Hi);for(let o=0,l=r.length;o({...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 a=i.getIndex(),o=a===null?1:a.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,p=this.perObjectFrustumCulled,y=this._indirectTexture,b=y.image.data;p&&(zD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),TA.setFromProjectionMatrix(zD,e.coordinateSystem));let S=0;if(this.sortObjects){AA.copy(this.matrixWorld).invert(),T0.setFromMatrixPosition(r.matrixWorld).applyMatrix4(AA),BD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(AA);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,a=i.length;sr)return;CA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(CA);if(!(le.far))return{distance:l,point:VD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const GD=new q,WD=new q;class ea extends Ul{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,a=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Lye extends fr{constructor(e,n,r,i,s,a,o,l,c){super(e,n,r,i,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:Cr,this.magFilter=s!==void 0?s:Cr,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 Dye extends fr{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=ri,this.minFilter=ri,this.generateMipmaps=!1,this.needsUpdate=!0}}class sM extends fr{constructor(e,n,r,i,s,a,o,l,c,d,f,p){super(null,a,o,l,c,d,i,s,f,p),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Uye extends sM{constructor(e,n,r,i,s,a){super(e,n,r,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ba,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class jye extends sM{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,Zc),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Fye extends fr{constructor(e,n,r,i,s,a,o,l,c){super(e,n,r,i,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Xo{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 a=1;a<=e;a++)r=this.getPoint(a/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 a;n?a=n:a=e*r[s-1];let o=0,l=s-1,c;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),c=r[i]-a,c<0)o=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===a)return i/(s-1);const d=r[i],p=r[i+1]-d,y=(a-d)/p;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 a=this.getPoint(i),o=this.getPoint(s),l=n||(a.isVector2?new He:new q);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new q,i=[],s=[],a=[],o=new q,l=new Ct;for(let y=0;y<=e;y++){const b=y/e;i[y]=this.getTangentAt(b,new q)}s[0]=new q,a[0]=new q;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),p=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),p<=c&&r.set(0,0,1),o.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let y=1;y<=e;y++){if(s[y]=s[y-1].clone(),a[y]=a[y-1].clone(),o.crossVectors(i[y-1],i[y]),o.length()>Number.EPSILON){o.normalize();const b=Math.acos(Tr(i[y-1].dot(i[y]),-1,1));s[y].applyMatrix4(l.makeRotationAxis(o,b))}a[y].crossVectors(i[y],s[y])}if(n===!0){let y=Math.acos(Tr(s[0].dot(s[e]),-1,1));y/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(y=-y);for(let b=1;b<=e;b++)s[b].applyMatrix4(l.makeRotationAxis(i[b],y*b)),a[b].crossVectors(i[b],s[b])}return{tangents:i,normals:s,binormals:a}}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 Xo{constructor(e=0,n=0,r=1,i=1,s=0,a=Math.PI*2,o=!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=a,this.aClockwise=o,this.aRotation=l}getPoint(e,n=new He){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,d;this.closed||o>0?c=i[(o-1)%s]:(y_.subVectors(i[0],i[1]).add(i[0]),c=y_);const f=i[o%s],p=i[(o+1)%s];if(this.closed||o+2i.length-2?i.length-1:a+1],f=i[a>i.length-3?i.length-1:a+2];return r.set(qD(o,l.x,c.x,d.x,f.x),qD(o,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 a=i[s]-r,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.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 mx extends Yt{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=Tr(i,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],d=1/n,f=new q,p=new He,y=new q,b=new q,S=new q;let w=0,x=0;for(let M=0;M<=e.length-1;M++)switch(M){case 0:w=e[M+1].x-e[M].x,x=e[M+1].y-e[M].y,y.x=x*1,y.y=-w,y.z=x*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,x=e[M+1].y-e[M].y,y.x=x*1,y.y=-w,y.z=x*0,b.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(b)}for(let M=0;M<=n;M++){const T=r+M*d*i,P=Math.sin(T),O=Math.cos(T);for(let N=0;N<=e.length-1;N++){f.x=e[N].x*P,f.y=e[N].y,f.z=e[N].x*O,a.push(f.x,f.y,f.z),p.x=M/n,p.y=N/(e.length-1),o.push(p.x,p.y);const D=l[3*N+0]*P,z=l[3*N+1],V=l[3*N+0]*O;c.push(D,z,V)}}for(let M=0;M0&&T(!0),n>0&&T(!1)),this.setIndex(d),this.setAttribute("position",new Lt(f,3)),this.setAttribute("normal",new Lt(p,3)),this.setAttribute("uv",new Lt(y,2));function M(){const P=new q,O=new q;let N=0;const D=(n-e)/r;for(let z=0;z<=s;z++){const V=[],k=z/s,j=k*(n-e)+e;for(let X=0;X<=i;X++){const ee=X/i,ie=ee*l+o,pe=Math.sin(ie),ae=Math.cos(ie);O.x=j*pe,O.y=-k*r+w,O.z=j*ae,f.push(O.x,O.y,O.z),P.set(pe,D,ae).normalize(),p.push(P.x,P.y,P.z),y.push(ee,1-k),V.push(b++)}S.push(V)}for(let z=0;z0&&(d.push(k,j,ee),N+=3),n>0&&(d.push(j,X,ee),N+=3)}c.addGroup(x,N,0),x+=N}function T(P){const O=b,N=new He,D=new q;let z=0;const V=P===!0?e:n,k=P===!0?1:-1;for(let X=1;X<=i;X++)f.push(0,w*k,0),p.push(0,k,0),y.push(.5,.5),b++;const j=b;for(let X=0;X<=i;X++){const ie=X/i*l+o,pe=Math.cos(ie),ae=Math.sin(ie);D.x=V*ae,D.y=w*k,D.z=V*pe,f.push(D.x,D.y,D.z),p.push(0,k,0),N.x=pe*.5+.5,N.y=ae*.5*k+.5,y.push(N.x,N.y),b++}for(let X=0;X.9&&D<.1&&(T<.2&&(a[M+0]+=1),P<.2&&(a[M+2]+=1),O<.2&&(a[M+4]+=1))}}function p(M){s.push(M.x,M.y,M.z)}function y(M,T){const P=M*3;T.x=e[P+0],T.y=e[P+1],T.z=e[P+2]}function b(){const M=new q,T=new q,P=new q,O=new q,N=new He,D=new He,z=new He;for(let V=0,k=0;V80*n){o=c=t[0],l=d=t[1];for(let b=n;bc&&(c=f),p>d&&(d=p);y=Math.max(c-o,d-l),y=y!==0?32767/y:0}return Dy(s,a,n,o,l,y,0),a}};function D6(t,e,n,r,i){let s,a;if(i===cxe(t,e,n,r)>0)for(s=e;s=e;s-=r)a=KD(s,t[s],t[s+1],a);return a&&dM(a,a.next)&&(jy(a),a=a.next),a}function Gh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(dM(n,n.next)||yr(n.prev,n,n.next)===0)){if(jy(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,a){if(!t)return;!a&&s&&rxe(t,r,i,s);let o=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Kye(t,r,i,s):qye(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),jy(t),t=c.next,o=c.next;continue}if(t=c,t===o){a?a===1?(t=Yye(Gh(t),e,n),Dy(t,e,n,r,i,s,2)):a===2&&Zye(t,e,n,r,i,s):Dy(Gh(t),e,n,r,i,s,1);break}}}function qye(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,a=r.x,o=e.y,l=n.y,c=r.y,d=is?i>a?i:a:s>a?s:a,y=o>l?o>c?o:c:l>c?l:c;let b=r.next;for(;b!==e;){if(b.x>=d&&b.x<=p&&b.y>=f&&b.y<=y&&qm(i,o,s,l,a,c,b.x,b.y)&&yr(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function Kye(t,e,n,r){const i=t.prev,s=t,a=t.next;if(yr(i,s,a)>=0)return!1;const o=i.x,l=s.x,c=a.x,d=i.y,f=s.y,p=a.y,y=ol?o>c?o:c:l>c?l:c,w=d>f?d>p?d:p:f>p?f:p,x=QP(y,b,e,n,r),M=QP(S,w,e,n,r);let T=t.prevZ,P=t.nextZ;for(;T&&T.z>=x&&P&&P.z<=M;){if(T.x>=y&&T.x<=S&&T.y>=b&&T.y<=w&&T!==i&&T!==a&&qm(o,d,l,f,c,p,T.x,T.y)&&yr(T.prev,T,T.next)>=0||(T=T.prevZ,P.x>=y&&P.x<=S&&P.y>=b&&P.y<=w&&P!==i&&P!==a&&qm(o,d,l,f,c,p,P.x,P.y)&&yr(P.prev,P,P.next)>=0))return!1;P=P.nextZ}for(;T&&T.z>=x;){if(T.x>=y&&T.x<=S&&T.y>=b&&T.y<=w&&T!==i&&T!==a&&qm(o,d,l,f,c,p,T.x,T.y)&&yr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;P&&P.z<=M;){if(P.x>=y&&P.x<=S&&P.y>=b&&P.y<=w&&P!==i&&P!==a&&qm(o,d,l,f,c,p,P.x,P.y)&&yr(P.prev,P,P.next)>=0)return!1;P=P.nextZ}return!0}function Yye(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!dM(i,s)&&U6(i,r,r.next,s)&&Uy(i,s)&&Uy(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),jy(r),jy(r.next),r=t=s),r=r.next}while(r!==t);return Gh(r)}function Zye(t,e,n,r,i,s){let a=t;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&axe(a,o)){let l=j6(a,o);a=Gh(a,a.next),l=Gh(l,l.next),Dy(a,e,n,r,i,s,0),Dy(l,e,n,r,i,s,0);return}o=o.next}a=a.next}while(a!==t)}function Qye(t,e,n,r){const i=[];let s,a,o,l,c;for(s=0,a=e.length;s=n.next.y&&n.next.y!==n.y){const p=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=s&&p>r&&(r=p,i=n.x=n.x&&n.x>=l&&s!==n.x&&qm(ai.x||n.x===i.x&&nxe(i,n)))&&(i=n,d=f)),n=n.next;while(n!==o);return i}function nxe(t,e){return yr(t.prev,t,e.prev)<0&&yr(e.next,t,t.next)<0}function rxe(t,e,n,r){let i=t;do i.z===0&&(i.z=QP(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,ixe(i)}function ixe(t){let e,n,r,i,s,a,o,l,c=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,r=n,o=0,e=0;e0||l>0&&r;)o!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,o--):(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(a>1);return t}function QP(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 sxe(t){let e=t,n=t;do(e.x=(t-a)*(s-o)&&(t-a)*(r-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(i-a)*(r-o)}function axe(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!oxe(t,e)&&(Uy(t,e)&&Uy(e,t)&&lxe(t,e)&&(yr(t.prev,t,e.prev)||yr(t,e.prev,e))||dM(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 dM(t,e){return t.x===e.x&&t.y===e.y}function U6(t,e,n,r){const i=S_(yr(t,e,n)),s=S_(yr(t,e,r)),a=S_(yr(n,r,t)),o=S_(yr(n,r,e));return!!(i!==s&&a!==o||i===0&&w_(t,n,e)||s===0&&w_(t,r,e)||a===0&&w_(n,t,r)||o===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 oxe(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&&U6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Uy(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 lxe(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 j6(t,e){const n=new JP(t.i,t.x,t.y),r=new JP(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 KD(t,e,n,r){const i=new JP(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 jy(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 JP(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 cxe(t,e,n,r){let i=0;for(let s=e,a=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function ZD(t,e){for(let n=0;nNumber.EPSILON){const ze=Math.sqrt(be),Fe=Math.sqrt(Q*Q+W*W),bt=Z.x-Ze/ze,rt=Z.y+Xe/ze,ht=Ve.x-W/Fe,Xt=Ve.y+Q/Fe,Ke=((ht-bt)*W-(Xt-rt)*Q)/(Xe*W-Ze*Q);Le=bt+Xe*Ke-de.x,ne=rt+Ze*Ke-de.y;const te=Le*Le+ne*ne;if(te<=2)return new He(Le,ne);Ce=Math.sqrt(te/2)}else{let ze=!1;Xe>Number.EPSILON?Q>Number.EPSILON&&(ze=!0):Xe<-Number.EPSILON?Q<-Number.EPSILON&&(ze=!0):Math.sign(Ze)===Math.sign(W)&&(ze=!0),ze?(Le=-Ze,ne=Xe,Ce=Math.sqrt(be)):(Le=Xe,ne=Ze,Ce=Math.sqrt(be/2))}return new He(Le/Ce,ne/Ce)}const J=[];for(let de=0,Z=ie.length,Ve=Z-1,Le=de+1;de=0;de--){const Z=de/w,Ve=y*Math.cos(Z*Math.PI/2),Le=b*Math.sin(Z*Math.PI/2)+S;for(let ne=0,Ce=ie.length;ne=0;){const Le=Ve;let ne=Ve-1;ne<0&&(ne=de.length-1);for(let Ce=0,Xe=d+w*2;Ce0)&&y.push(T,P,N),(x!==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 H6 extends Gr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ct(16777215),this.specular=new ct(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=au,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 ls,this.combine=cx,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 V6 extends Gr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ct(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=au,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 G6 extends Gr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=au,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 W6 extends Gr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ct(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ct(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=au,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 ls,this.combine=cx,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 $6 extends Gr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ct(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=au,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 X6 extends $r{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 dh(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 q6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function K6(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 eC(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,a=0;a!==r;++s){const o=n[s]*e;for(let l=0;l!==e;++l)i[a++]=t[o+l]}return i}function VR(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 a=s[r];if(a!==void 0)if(Array.isArray(a))do a=s[r],a!==void 0&&(e.push(s.time),n.push.apply(n,a)),s=t[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[r],a!==void 0&&(e.push(s.time),a.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do a=s[r],a!==void 0&&(e.push(s.time),n.push(a)),s=t[i++];while(s!==void 0)}function hxe(t,e,n,r,i=30){const s=t.clone();s.name=e;const a=[];for(let l=0;l=r)){f.push(c.times[y]);for(let S=0;Ss.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l=o.times[b]){const x=b*f+d,M=x+f-d;S=o.values.slice(x,M)}else{const x=o.createInterpolant(),M=d,T=f-d;x.evaluate(s),S=x.resultBuffer.slice(M,T)}l==="quaternion"&&new qt().fromArray(S).normalize().conjugate().toArray(S);const w=c.times.length;for(let x=0;x=s)){const o=n[1];e=s)break t}a=r,r=0;break n}break e}for(;r>>1;en;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=r.slice(s,a),this.values=this.values.slice(s*o,a*o)}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 a=null;for(let o=0;o!==s;o++){const l=r[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(i!==void 0&&q6(i))for(let o=0,l=i.length;o!==l;++o){const c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,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 a=1;for(let o=1;o0){e[a]=e[s];for(let o=s*r,l=a*r,c=0;c!==r;++c)n[l+c]=n[o+c];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=n.slice(0,a*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}}qo.prototype.TimeBufferType=Float32Array;qo.prototype.ValueBufferType=Float32Array;qo.prototype.DefaultInterpolation=Lg;class rp extends qo{constructor(e,n,r){super(e,n,r)}}rp.prototype.ValueTypeName="bool";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=Og;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class WR extends qo{}WR.prototype.ValueTypeName="color";class Wh extends qo{}Wh.prototype.ValueTypeName="number";class Q6 extends ov{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(r-n)/(i-n);let c=e*o;for(let d=c+o;c!==d;c+=4)qt.slerpFlat(s,0,a,c-o,a,c,l);return s}}class $h extends qo{InterpolantFactoryMethodLinear(e){return new Q6(this.times,this.values,this.getValueSize(),e)}}$h.prototype.ValueTypeName="quaternion";$h.prototype.InterpolantFactoryMethodSmooth=void 0;class ip extends qo{constructor(e,n,r){super(e,n,r)}}ip.prototype.ValueTypeName="string";ip.prototype.ValueBufferType=Array;ip.prototype.DefaultInterpolation=Og;ip.prototype.InterpolantFactoryMethodLinear=void 0;ip.prototype.InterpolantFactoryMethodSmooth=void 0;class Xh extends qo{}Xh.prototype.ValueTypeName="vector";class jg{constructor(e="",n=-1,r=[],i=YS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=wa(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let a=0,o=r.length;a!==o;++a)n.push(vxe(r[a]).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,a=r.length;s!==a;++s)n.push(qo.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,a=[];for(let o=0;o1){const f=d[1];let p=i[f];p||(i[f]=p=[]),p.push(c)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],n,r));return a}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(f,p,y,b,S){if(y.length!==0){const w=[],x=[];VR(y,w,x,b),w.length!==0&&S.push(new f(p,w,x))}},i=[],s=e.name||"default",a=e.fps||30,o=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(Ac[e]!==void 0){Ac[e].push({onLoad:n,onProgress:r,onError:i});return}Ac[e]=[],Ac[e].push({onLoad:n,onProgress:r,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).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=Ac[e],f=c.body.getReader(),p=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),y=p?parseInt(p):0,b=y!==0;let S=0;const w=new ReadableStream({start(x){M();function M(){f.read().then(({done:T,value:P})=>{if(T)x.close();else{S+=P.byteLength;const O=new ProgressEvent("progress",{lengthComputable:b,loaded:S,total:y});for(let N=0,D=d.length;N{x.error(T)})}}});return new Response(w)}else throw new yxe(`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,o));case"json":return c.json();default:if(o===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(o),p=f&&f[1]?f[1].toLowerCase():void 0,y=new TextDecoder(p);return c.arrayBuffer().then(b=>y.decode(b))}}}).then(c=>{Fc.add(e,c);const d=Ac[e];delete Ac[e];for(let f=0,p=d.length;f{const d=Ac[e];if(d===void 0)throw this.manager.itemError(e),c;delete Ac[e];for(let f=0,p=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 xxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new Go(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{n(s.parse(JSON.parse(o)))}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 a=e.uniforms[s];switch(i.uniforms[s]={},a.type){case"t":i.uniforms[s].value=r(a.value);break;case"c":i.uniforms[s].value=new ct().setHex(a.value);break;case"v2":i.uniforms[s].value=new He().fromArray(a.value);break;case"v3":i.uniforms[s].value=new q().fromArray(a.value);break;case"v4":i.uniforms[s].value=new On().fromArray(a.value);break;case"m3":i.uniforms[s].value=new $t().fromArray(a.value);break;case"m4":i.uniforms[s].value=new Ct().fromArray(a.value);break;default:i.uniforms[s].value=a.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 bM.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:z6,SpriteMaterial:kR,RawShaderMaterial:B6,ShaderMaterial:Ya,PointsMaterial:iM,MeshPhysicalMaterial:eo,MeshStandardMaterial:yx,MeshPhongMaterial:H6,MeshToonMaterial:V6,MeshNormalMaterial:G6,MeshLambertMaterial:W6,MeshDepthMaterial:RR,MeshDistanceMaterial:NR,MeshBasicMaterial:As,MeshMatcapMaterial:$6,LineDashedMaterial:X6,LineBasicMaterial:$r,Material:Gr};return new n[e]}}class Sd{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 $R(n);s=new Fg(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){i=new Fg(this.manager),i.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a{const w=new os;w.min.fromArray(S.boxMin),w.max.fromArray(S.boxMax);const x=new Hi;return x.radius=S.sphereRadius,x.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:w,sphereInitialized:S.sphereInitialized,sphere:x}}),a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._geometryCount=e.geometryCount,a._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":a=new P6;break;case"Line":a=new Ul(o(e.geometry),l(e.material));break;case"LineLoop":a=new LR(o(e.geometry),l(e.material));break;case"LineSegments":a=new ea(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new DR(o(e.geometry),l(e.material));break;case"Sprite":a=new T6(l(e.material));break;case"Group":a=new Ts;break;case"Bone":a=new rM;break;default:a=new mn}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const p=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,a=Fc.get(e);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){n&&n(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Fc.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Fc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Fc.add(e,l),s.manager.itemStart(e)}}let M_;class ZR{static getContext(){return M_===void 0&&(M_=new(window.AudioContext||window.webkitAudioContext)),M_}static setContext(e){M_=e}}class Pxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,a=new Go(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);ZR.getContext().decodeAudioData(c,function(f){n(f)}).catch(o)}catch(c){o(c)}},r,i);function o(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const sU=new Ct,aU=new Ct,Df=new Ct;class Cxe{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,Df.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,a=n.near*Math.tan(Ph*n.fov*.5)/n.zoom;let o,l;aU.elements[12]=-i,sU.elements[12]=i,o=-a*n.aspect+s,l=a*n.aspect+s,Df.elements[0]=2*n.near/(l-o),Df.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(Df),o=-a*n.aspect-s,l=a*n.aspect-s,Df.elements[0]=2*n.near/(l-o),Df.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(Df)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(aU),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(sU)}}class QR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=oU(),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=oU();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function oU(){return performance.now()}const Uf=new q,lU=new qt,Rxe=new q,jf=new q;class Nxe extends mn{constructor(){super(),this.type="AudioListener",this.context=ZR.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new QR}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(Uf,lU,Rxe),jf.set(0,0,-1).applyQuaternion(lU),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Uf.x,i),n.positionY.linearRampToValueAtTime(Uf.y,i),n.positionZ.linearRampToValueAtTime(Uf.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(Uf.x,Uf.y,Uf.z),n.setOrientation(jf.x,jf.y,jf.z,r.x,r.y,r.z)}}let cG=class extends mn{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]){o.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,a=i;s!==a;++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 a=0;a!==s;++a)e[n+a]=e[r+a]}_slerp(e,n,r,i){qt.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const a=this._workIndex*s;qt.multiplyQuaternionsFlat(e,a,e,n,e,r),qt.slerpFlat(e,n,e,n,e,a,i)}_lerp(e,n,r,i,s){const a=1-i;for(let o=0;o!==s;++o){const l=n+o;e[l]=e[l]*a+e[r+o]*i}}_lerpAdditive(e,n,r,i,s){for(let a=0;a!==s;++a){const o=n+a;e[o]=e[o]+e[r+a]*i}}}const JR="\\[\\]\\.:\\/",Lxe=new RegExp("["+JR+"]","g"),eN="[^"+JR+"]",Dxe="[^"+JR.replace("\\.","")+"]",Uxe=/((?:WC+[\/:])*)/.source.replace("WC",eN),jxe=/(WCOD+)?/.source.replace("WCOD",Dxe),Fxe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",eN),zxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",eN),Bxe=new RegExp("^"+Uxe+jxe+Fxe+zxe+"$"),Hxe=["material","materials","bones","map"];class Vxe{constructor(e,n,r){const i=r||Rn.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 Rn{constructor(e,n,r){this.path=n,this.parsedPath=r||Rn.parseTrackName(n),this.node=Rn.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 Rn.Composite(e,n,r):new Rn(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Lxe,"")}static parseTrackName(e){const n=Bxe.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);Hxe.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 a=0;a=s){const f=s++,p=e[f];n[p.uuid]=d,e[d]=p,n[c]=f,e[f]=l;for(let y=0,b=i;y!==b;++y){const S=r[y],w=S[f],x=S[d];S[d]=w,S[f]=x}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],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 b=0,S=i;b!==S;++b){const w=r[b];w[f]=w[p],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 a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,f=new Array(c);i=s.length,r[e]=i,a.push(e),o.push(n),s.push(f);for(let p=d,y=l.length;p!==y;++p){const b=l[p];f[p]=new Rn(b,e,n)}return f}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];n[c]=r,a[r]=l,a.pop(),s[r]=s[o],s.pop(),i[r]=i[o],i.pop()}}}class dG{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,a=s.length,o=new Array(a),l={endingStart:lh,endingEnd:lh};for(let c=0;c!==a;++c){const d=s[c].createInterpolant(null);o[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=YV,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,a=s/i,o=i/s;e.warp(1,a,n),this.warp(o,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,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/a,c[1]=n/a,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 a=this._updateTime(n),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case bR:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(a),c[d].accumulateAdditive(o);break;case YS:default:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(a),c[d].accumulate(i,o)}}}_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 a=r===ZV;if(e===0)return s===-1?i:a&&(s&1)===1?n-i:i;if(r===KV){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,a)):this._setEndings(this.repetitions===0,!0,a)),i>=n||i<0){const o=Math.floor(i/n);i-=n*o,s+=Math.abs(o);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,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;if(a&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=ch,i.endingEnd=ch):(e?i.endingStart=this.zeroSlopeAtStart?ch:lh:i.endingStart=Py,n?i.endingEnd=this.zeroSlopeAtEnd?ch:lh:i.endingEnd=Py)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=n,o[1]=s+e,l[1]=r,this}}const Wxe=new Float32Array(1);class $xe extends zl{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,a=e._propertyBindings,o=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 p=i[f],y=p.name;let b=d[y];if(b!==void 0)++b.referenceCount,a[f]=b;else{if(b=a[f],b!==void 0){b._cacheIndex===null&&(++b.referenceCount,this._addInactiveBinding(b,l,y));continue}const S=n&&n._propertyBindings[f].binding.parsedPath;b=new uG(Rn.create(r,y,S),p.ValueTypeName,p.getValueSize()),++b.referenceCount,this._addInactiveBinding(b,l,y),a[f]=b}o[f].resultBuffer=b.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),a=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);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,fU).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 hU=new q,E_=new q;class Qxe{constructor(e=new q,n=new q){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){hU.subVectors(e,this.start),E_.subVectors(this.end,this.start);const r=E_.dot(E_);let s=E_.dot(hU)/r;return n&&(s=Tr(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 pU=new q;class Jxe extends mn{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new Yt,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 a=0,o=1,l=32;a1)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{xU.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(xU,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 pG extends ea{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 Yt;i.setAttribute("position",new Lt(n,3)),i.setAttribute("color",new Lt(r,3));const s=new $r({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new ct,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 fbe{constructor(){this.type="ShapePath",this.color=new ct,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,a){return this.currentPath.bezierCurveTo(e,n,r,i,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(x){const M=[];for(let T=0,P=x.length;TNumber.EPSILON){if(k<0&&(D=M[N],V=-V,z=M[O],k=-k),x.yz.y)continue;if(x.y===D.y){if(x.x===D.x)return!0}else{const j=k*(x.x-D.x)-V*(x.y-D.y);if(j===0)return!0;if(j<0)continue;P=!P}}else{if(x.y!==D.y)continue;if(z.x<=x.x&&x.x<=D.x||D.x<=x.x&&x.x<=z.x)return!0}}return P}const i=Cl.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new Rh,l.curves=o.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],p=[];let y=[],b=0,S;p[b]=void 0,y[b]=[];for(let x=0,M=s.length;x1){let x=!1,M=0;for(let T=0,P=p.length;T0&&x===!1&&(y=f)}let w;for(let x=0,M=p.length;x{const f=typeof c=="function"?c(e):c;if(f!==e){const p=e;e=d?f:Object.assign({},e,f),n.forEach(y=>y(e,p))}},i=()=>e,s=(c,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=d(e);function y(){const b=d(e);if(!f(p,b)){const S=p;c(p=b,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 ybe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),wU=ybe?R.useEffect:R.useLayoutEffect;function xbe(t){const e=typeof t=="function"?vbe(t):t,n=(r=e.getState,i=Object.is)=>{const[,s]=R.useReducer(w=>w+1,0),a=e.getState(),o=R.useRef(a),l=R.useRef(r),c=R.useRef(i),d=R.useRef(!1),f=R.useRef();f.current===void 0&&(f.current=r(a));let p,y=!1;(o.current!==a||l.current!==r||c.current!==i||d.current)&&(p=r(a),y=!i(f.current,p)),wU(()=>{y&&(f.current=p),o.current=a,l.current=r,c.current=i,d.current=!1});const b=R.useRef(a);wU(()=>{const w=()=>{try{const M=e.getState(),T=l.current(M);c.current(f.current,T)||(o.current=M,f.current=T,s())}catch{d.current=!0,s()}},x=e.subscribe(w);return e.getState()!==b.current&&w(),x},[]);const S=y?p: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 bU;function gbe(){return bU||(bU=1,Ju.ConcurrentRoot=1,Ju.ContinuousEventPriority=4,Ju.DefaultEventPriority=16,Ju.DiscreteEventPriority=1,Ju.IdleEventPriority=536870912,Ju.LegacyRoot=0),Ju}var _U;function vbe(){return _U||(_U=1,jA.exports=gbe()),jA.exports}var Km=vbe();function ybe(t){let e;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(e):c;if(f!==e){const p=e;e=d?f:Object.assign({},e,f),n.forEach(y=>y(e,p))}},i=()=>e,s=(c,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=d(e);function y(){const b=d(e);if(!f(p,b)){const S=p;c(p=b,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 xbe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),wU=xbe?R.useEffect:R.useLayoutEffect;function bbe(t){const e=typeof t=="function"?ybe(t):t,n=(r=e.getState,i=Object.is)=>{const[,s]=R.useReducer(w=>w+1,0),a=e.getState(),o=R.useRef(a),l=R.useRef(r),c=R.useRef(i),d=R.useRef(!1),f=R.useRef();f.current===void 0&&(f.current=r(a));let p,y=!1;(o.current!==a||l.current!==r||c.current!==i||d.current)&&(p=r(a),y=!i(f.current,p)),wU(()=>{y&&(f.current=p),o.current=a,l.current=r,c.current=i,d.current=!1});const b=R.useRef(a);wU(()=>{const w=()=>{try{const M=e.getState(),T=l.current(M);c.current(f.current,T)||(o.current=M,f.current=T,s())}catch{d.current=!0,s()}},x=e.subscribe(w);return e.getState()!==b.current&&w(),x},[]);const S=y?p: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={};/** * @license React * scheduler.production.min.js * @@ -4457,7 +4462,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 SU;function bbe(){return SU||(SU=1,(function(t){function e(B,J){var Y=B.length;B.push(J);e:for(;0>>1,G=B[H];if(0>>1;Hi(ce,Y))Sei(we,ce)?(B[H]=we,B[Se]=Y,H=Se):(B[H]=ce,B[se]=Y,H=se);else if(Sei(we,Y))B[H]=we,B[Se]=Y,H=Se;else break e}}return J}function i(B,J){var Y=B.sortIndex-J.sortIndex;return Y!==0?Y:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,f=null,p=3,y=!1,b=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,x=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 J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=B)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function P(B){if(S=!1,T(B),!b)if(n(l)!==null)b=!0,ae(O);else{var J=n(c);J!==null&&he(P,J.startTime-B)}}function O(B,J){b=!1,S&&(S=!1,x(z),z=-1),y=!0;var Y=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!j());){var H=f.callback;if(typeof H=="function"){f.callback=null,p=f.priorityLevel;var G=H(f.expirationTime<=J);J=t.unstable_now(),typeof G=="function"?f.callback=G:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var le=!0;else{var se=n(c);se!==null&&he(P,se.startTime-J),le=!1}return le}finally{f=null,p=Y,y=!1}}var N=!1,D=null,z=-1,V=5,k=-1;function j(){return!(t.unstable_now()-kB||125H?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(x(z),z=-1):S=!0,he(P,Y-H))):(B.sortIndex=G,e(l,B),b||y||(b=!0,ae(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var J=p;return function(){var Y=p;p=J;try{return B.apply(this,arguments)}finally{p=Y}}}})(BA)),BA}var MU;function _be(){return MU||(MU=1,zA.exports=bbe()),zA.exports}/** + */var SU;function _be(){return SU||(SU=1,(function(t){function e(B,J){var Y=B.length;B.push(J);e:for(;0>>1,G=B[H];if(0>>1;Hi(ce,Y))Sei(we,ce)?(B[H]=we,B[Se]=Y,H=Se):(B[H]=ce,B[se]=Y,H=se);else if(Sei(we,Y))B[H]=we,B[Se]=Y,H=Se;else break e}}return J}function i(B,J){var Y=B.sortIndex-J.sortIndex;return Y!==0?Y:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,f=null,p=3,y=!1,b=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,x=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 J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=B)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function P(B){if(S=!1,T(B),!b)if(n(l)!==null)b=!0,ae(O);else{var J=n(c);J!==null&&he(P,J.startTime-B)}}function O(B,J){b=!1,S&&(S=!1,x(z),z=-1),y=!0;var Y=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!j());){var H=f.callback;if(typeof H=="function"){f.callback=null,p=f.priorityLevel;var G=H(f.expirationTime<=J);J=t.unstable_now(),typeof G=="function"?f.callback=G:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var le=!0;else{var se=n(c);se!==null&&he(P,se.startTime-J),le=!1}return le}finally{f=null,p=Y,y=!1}}var N=!1,D=null,z=-1,V=5,k=-1;function j(){return!(t.unstable_now()-kB||125H?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(x(z),z=-1):S=!0,he(P,Y-H))):(B.sortIndex=G,e(l,B),b||y||(b=!0,ae(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var J=p;return function(){var Y=p;p=J;try{return B.apply(this,arguments)}finally{p=Y}}}})(BA)),BA}var MU;function wbe(){return MU||(MU=1,zA.exports=_be()),zA.exports}/** * @license React * react-reconciler.production.min.js * @@ -4465,17 +4470,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,EU;function wbe(){return EU||(EU=1,HA=function(e){var n={},r=qh(),i=_be(),s=Object.assign;function a(m){for(var g="https://reactjs.org/docs/error-decoder.html?invariant="+m,E=1;Eye||L[re]!==F[ye]){var je=` `+L[re].replace(" at new "," at ");return m.displayName&&je.includes("")&&(je=je.replace("",m.displayName)),je}while(1<=re&&0<=ye);break}}}finally{jt=!1,Error.prepareStackTrace=E}return(m=m?m.displayName||m.name:"")?Et(m):""}var Rt=Object.prototype.hasOwnProperty,Sn=[],Mn=-1;function yn(m){return{current:m}}function Kt(m){0>Mn||(m.current=Sn[Mn],Sn[Mn]=null,Mn--)}function Ut(m,g){Mn++,Sn[Mn]=m.current,m.current=g}var mt={},xn=yn(mt),tn=yn(!1),Rr=mt;function li(m,g){var E=m.type.contextTypes;if(!E)return mt;var C=m.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===g)return C.__reactInternalMemoizedMaskedChildContext;var L={},F;for(F in E)L[F]=g[F];return C&&(m=m.stateNode,m.__reactInternalMemoizedUnmaskedChildContext=g,m.__reactInternalMemoizedMaskedChildContext=L),L}function In(m){return m=m.childContextTypes,m!=null}function Is(){Kt(tn),Kt(xn)}function Vn(m,g,E){if(xn.current!==mt)throw Error(a(168));Ut(xn,g),Ut(tn,E)}function ta(m,g,E){var C=m.stateNode;if(g=g.childContextTypes,typeof C.getChildContext!="function")return E;C=C.getChildContext();for(var L in C)if(!(L in g))throw Error(a(108,z(m)||"Unknown",L));return s({},E,C)}function Yo(m){return m=(m=m.stateNode)&&m.__reactInternalMemoizedMergedChildContext||mt,Rr=xn.current,Ut(xn,m),Ut(tn,tn.current),!0}function Xr(m,g,E){var C=m.stateNode;if(!C)throw Error(a(169));E?(m=ta(m,g,Rr),C.__reactInternalMemoizedMergedChildContext=m,Kt(tn),Kt(xn),Ut(xn,m)):Kt(tn),Ut(tn,E)}var ci=Math.clz32?Math.clz32:_M,Ud=Math.log,Zo=Math.LN2;function _M(m){return m>>>=0,m===0?32:31-(Ud(m)/Zo|0)|0}var uu=64,Pn=4194304;function du(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,g){var E=m.pendingLanes;if(E===0)return 0;var C=0,L=m.suspendedLanes,F=m.pingedLanes,re=E&268435455;if(re!==0){var ye=re&~L;ye!==0?C=du(ye):(F&=re,F!==0&&(C=du(F)))}else re=E&~L,re!==0?C=du(re):F!==0&&(C=du(F));if(C===0)return 0;if(g!==0&&g!==C&&(g&L)===0&&(L=C&-C,F=g&-g,L>=F||L===16&&(F&4194240)!==0))return g;if((C&4)!==0&&(C|=E&16),g=m.entangledLanes,g!==0)for(m=m.entanglements,g&=C;0E;E++)g.push(m);return g}function Hl(m,g,E){m.pendingLanes|=g,g!==536870912&&(m.suspendedLanes=0,m.pingedLanes=0),m=m.eventTimes,g=31-ci(g),m[g]=E}function op(m,g){var E=m.pendingLanes&~g;m.pendingLanes=g,m.suspendedLanes=0,m.pingedLanes=0,m.expiredLanes&=g,m.mutableReadLanes&=g,m.entangledLanes&=g,g=m.entanglements;var C=m.eventTimes;for(m=m.expirationTimes;0>=re,L-=re,oo=1<<32-ci(g)+L|E<En?(_r=sn,sn=null):_r=sn.sibling;var bn=zt(Ne,sn,De[En],gt);if(bn===null){sn===null&&(sn=_r);break}m&&sn&&bn.alternate===null&&g(Ne,sn),_e=F(bn,_e,En),an===null?Ot=bn:an.sibling=bn,an=bn,sn=_r}if(En===De.length)return E(Ne,sn),Qn&&Kl(Ne,En),Ot;if(sn===null){for(;EnEn?(_r=sn,sn=null):_r=sn.sibling;var Mo=zt(Ne,sn,bn.value,gt);if(Mo===null){sn===null&&(sn=_r);break}m&&sn&&Mo.alternate===null&&g(Ne,sn),_e=F(Mo,_e,En),an===null?Ot=Mo:an.sibling=Mo,an=Mo,sn=_r}if(bn.done)return E(Ne,sn),Qn&&Kl(Ne,En),Ot;if(sn===null){for(;!bn.done;En++,bn=De.next())bn=rn(Ne,bn.value,gt),bn!==null&&(_e=F(bn,_e,En),an===null?Ot=bn:an.sibling=bn,an=bn);return Qn&&Kl(Ne,En),Ot}for(sn=C(Ne,sn);!bn.done;En++,bn=De.next())bn=ln(sn,Ne,En,bn.value,gt),bn!==null&&(m&&bn.alternate!==null&&sn.delete(bn.key===null?En:bn.key),_e=F(bn,_e,En),an===null?Ot=bn:an.sibling=bn,an=bn);return m&&sn.forEach(function(Kv){return g(Ne,Kv)}),Qn&&Kl(Ne,En),Ot}function ys(Ne,_e,De,gt){if(typeof De=="object"&&De!==null&&De.type===d&&De.key===null&&(De=De.props.children),typeof De=="object"&&De!==null){switch(De.$$typeof){case l:e:{for(var Ot=De.key,an=_e;an!==null;){if(an.key===Ot){if(Ot=De.type,Ot===d){if(an.tag===7){E(Ne,an.sibling),_e=L(an,De.props.children),_e.return=Ne,Ne=_e;break e}}else if(an.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===T&&xu(Ot)===an.type){E(Ne,an.sibling),_e=L(an,De.props),_e.ref=yu(Ne,an,De),_e.return=Ne,Ne=_e;break e}E(Ne,an);break}else g(Ne,an);an=an.sibling}De.type===d?(_e=vc(De.props.children,Ne.mode,gt,De.key),_e.return=Ne,Ne=_e):(gt=Xp(De.type,De.key,De.props,null,Ne.mode,gt),gt.ref=yu(Ne,_e,De),gt.return=Ne,Ne=gt)}return re(Ne);case c:e:{for(an=De.key;_e!==null;){if(_e.key===an)if(_e.tag===4&&_e.stateNode.containerInfo===De.containerInfo&&_e.stateNode.implementation===De.implementation){E(Ne,_e.sibling),_e=L(_e,De.children||[]),_e.return=Ne,Ne=_e;break e}else{E(Ne,_e);break}else g(Ne,_e);_e=_e.sibling}_e=Kp(De,Ne.mode,gt),_e.return=Ne,Ne=_e}return re(Ne);case T:return an=De._init,ys(Ne,_e,an(De._payload),gt)}if(pe(De))return xt(Ne,_e,De,gt);if(N(De))return Jr(Ne,_e,De,gt);nl(Ne,De)}return typeof De=="string"&&De!==""||typeof De=="number"?(De=""+De,_e!==null&&_e.tag===6?(E(Ne,_e.sibling),_e=L(_e,De),_e.return=Ne,Ne=_e):(E(Ne,_e),_e=qp(De,Ne.mode,gt),_e.return=Ne,Ne=_e),re(Ne)):E(Ne,_e)}return ys}var co=Px(!0),Cx=Px(!1),bu={},qi=yn(bu),Yl=yn(bu),Zl=yn(bu);function ra(m){if(m===bu)throw Error(a(174));return m}function wp(m,g){Ut(Zl,g),Ut(Yl,m),Ut(qi,bu),m=he(g),Kt(qi),Ut(qi,m)}function _u(){Kt(qi),Kt(Yl),Kt(Zl)}function Rx(m){var g=ra(Zl.current),E=ra(qi.current);g=B(E,m.type,g),E!==g&&(Ut(Yl,m),Ut(qi,g))}function xv(m){Yl.current===m&&(Kt(qi),Kt(Yl))}var nr=yn(0);function Sp(m){for(var g=m;g!==null;){if(g.tag===13){var E=g.memoizedState;if(E!==null&&(E=E.dehydrated,E===null||Ko(E)||Ns(E)))return g}else if(g.tag===19&&g.memoizedProps.revealOrder!==void 0){if((g.flags&128)!==0)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===m)break;for(;g.sibling===null;){if(g.return===null||g.return===m)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var ds=[];function Ql(){for(var m=0;mE?E:4,m(!0);var C=fs.transition;fs.transition={};try{m(!1),g()}finally{un=E,fs.transition=C}}function tc(){return sa().memoizedState}function Ix(m,g,E){var C=ca(m);E={lane:C,action:E,hasEagerState:!1,eagerState:null,next:null},kx(m)?Mv(g,E):(Qd(m,g,E),E=Cn(),m=fi(m,C,E),m!==null&&Jd(m,g,C))}function MM(m,g,E){var C=ca(m),L={lane:C,action:E,hasEagerState:!1,eagerState:null,next:null};if(kx(m))Mv(g,L);else{Qd(m,g,L);var F=m.alternate;if(m.lanes===0&&(F===null||F.lanes===0)&&(F=g.lastRenderedReducer,F!==null))try{var re=g.lastRenderedState,ye=F(re,E);if(L.hasEagerState=!0,L.eagerState=ye,Ti(ye,re))return}catch{}finally{}E=Cn(),m=fi(m,C,E),m!==null&&Jd(m,g,C)}}function kx(m){var g=m.alternate;return m===rr||g!==null&&g===rr}function Mv(m,g){Ra=Mp=!0;var E=m.pending;E===null?g.next=g:(g.next=E.next,E.next=g),m.pending=g}function Qd(m,g,E){gr!==null&&(m.mode&1)!==0&&(on&2)===0?(m=g.interleaved,m===null?(E.next=E,Ls===null?Ls=[g]:Ls.push(g)):(E.next=m.next,m.next=E),g.interleaved=E):(m=g.pending,m===null?E.next=E:(E.next=m.next,m.next=E),g.pending=E)}function Jd(m,g,E){if((E&4194240)!==0){var C=g.lanes;C&=m.pendingLanes,E|=C,g.lanes=E,Pa(m,E)}}var Au={readContext:Xi,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},Ev={readContext:Xi,useCallback:function(m,g){return ia().memoizedState=[m,g===void 0?null:g],m},useContext:Xi,useEffect:Pp,useImperativeHandle:function(m,g,E){return E=E!=null?E.concat([m]):null,il(4194308,4,Zd.bind(null,g,m),E)},useLayoutEffect:function(m,g){return il(4194308,4,m,g)},useInsertionEffect:function(m,g){return il(4,2,m,g)},useMemo:function(m,g){var E=ia();return g=g===void 0?null:g,m=m(),E.memoizedState=[m,g],m},useReducer:function(m,g,E){var C=ia();return g=E!==void 0?E(g):g,C.memoizedState=C.baseState=g,m={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:m,lastRenderedState:g},C.queue=m,m=m.dispatch=Ix.bind(null,rr,m),[C.memoizedState,m]},useRef:function(m){var g=ia();return m={current:m},g.memoizedState=m},useState:Kd,useDebugValue:Rp,useDeferredValue:function(m){var g=Kd(m),E=g[0],C=g[1];return Pp(function(){var L=fs.transition;fs.transition={};try{C(m)}finally{fs.transition=L}},[m]),E},useTransition:function(){var m=Kd(!1),g=m[0];return m=Ip.bind(null,m[1]),ia().memoizedState=m,[g,m]},useMutableSource:function(){},useSyncExternalStore:function(m,g,E){var C=rr,L=ia();if(Qn){if(E===void 0)throw Error(a(407));E=E()}else{if(E=g(),gr===null)throw Error(a(349));(Jl&30)!==0||wv(C,g,E)}L.memoizedState=E;var F={value:E,getSnapshot:g};return L.queue=F,Pp(uo.bind(null,C,F,m),[m]),C.flags|=2048,Yd(9,Sv.bind(null,C,F,E,g),void 0,null),E},useId:function(){var m=ia(),g=gr.identifierPrefix;if(Qn){var E=lo,C=oo;E=(C&~(1<<32-ci(C)-1)).toString(32)+E,g=":"+g+"R"+E,E=ec++,0ll&&(g.flags|=128,C=!0,ho(L,!1),g.lanes=4194304)}else{if(!C)if(m=Sp(F),m!==null){if(g.flags|=128,C=!0,m=m.updateQueue,m!==null&&(g.updateQueue=m,g.flags|=4),ho(L,!0),L.tail===null&&L.tailMode==="hidden"&&!F.alternate&&!Qn)return mr(g),null}else 2*Nr()-L.renderingStartTime>ll&&E!==1073741824&&(g.flags|=128,C=!0,ho(L,!1),g.lanes=4194304);L.isBackwards?(F.sibling=g.child,g.child=F):(m=L.last,m!==null?m.sibling=F:g.child=F,L.last=F)}return L.tail!==null?(g=L.tail,L.rendering=g,L.tail=g.sibling,L.renderingStartTime=Nr(),g.sibling=null,m=nr.current,Ut(nr,C?m&1|2:m&1),g):(mr(g),null);case 22:case 23:return pf(),C=g.memoizedState!==null,m!==null&&m.memoizedState!==null!==C&&(g.flags|=8192),C&&(g.mode&1)!==0?(di&1073741824)!==0&&(mr(g),$e&&g.subtreeFlags&6&&(g.flags|=8192)):mr(g),null;case 24:return null;case 25:return null}throw Error(a(156,g.tag))}var Rv=o.ReactCurrentOwner,Fr=!1;function lr(m,g,E,C){g.child=m===null?Cx(g,null,E,C):co(g,m.child,E,C)}function $n(m,g,E,C,L){E=E.render;var F=g.ref;return hu(g,L),C=wu(m,g,E,C,F,L),E=rl(),m!==null&&!Fr?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~L,Ki(m,g,L)):(Qn&&E&&mv(g),g.flags|=1,lr(m,g,C,L),g.child)}function Gn(m,g,E,C,L){if(m===null){var F=E.type;return typeof F=="function"&&!$p(F)&&F.defaultProps===void 0&&E.compare===null&&E.defaultProps===void 0?(g.tag=15,g.type=F,po(m,g,F,C,L)):(m=Xp(E.type,null,C,g,g.mode,L),m.ref=g.ref,m.return=g,g.child=m)}if(F=m.child,(m.lanes&L)===0){var re=F.memoizedProps;if(E=E.compare,E=E!==null?E:na,E(re,C)&&m.ref===g.ref)return Ki(m,g,L)}return g.flags|=1,m=So(F,C),m.ref=g.ref,m.return=g,g.child=m}function po(m,g,E,C,L){if(m!==null&&na(m.memoizedProps,C)&&m.ref===g.ref)if(Fr=!1,(m.lanes&L)!==0)(m.flags&131072)!==0&&(Fr=!0);else return g.lanes=m.lanes,Ki(m,g,L);return mo(m,g,E,C,L)}function Kr(m,g,E){var C=g.pendingProps,L=C.children,F=m!==null?m.memoizedState:null;if(C.mode==="hidden")if((g.mode&1)===0)g.memoizedState={baseLanes:0,cachePool:null},Ut(fc,di),di|=E;else if((E&1073741824)!==0)g.memoizedState={baseLanes:0,cachePool:null},C=F!==null?F.baseLanes:E,Ut(fc,di),di|=C;else return m=F!==null?F.baseLanes|E:E,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:m,cachePool:null},g.updateQueue=null,Ut(fc,di),di|=m,null;else F!==null?(C=F.baseLanes|E,g.memoizedState=null):C=E,Ut(fc,di),di|=C;return lr(m,g,L,E),g.child}function Ri(m,g){var E=g.ref;(m===null&&E!==null||m!==null&&m.ref!==E)&&(g.flags|=512,g.flags|=2097152)}function mo(m,g,E,C,L){var F=In(E)?Rr:xn.current;return F=li(g,F),hu(g,L),E=wu(m,g,E,C,F,L),C=rl(),m!==null&&!Fr?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~L,Ki(m,g,L)):(Qn&&C&&mv(g),g.flags|=1,lr(m,g,E,L),g.child)}function ic(m,g,E,C,L){if(In(E)){var F=!0;Yo(g)}else F=!1;if(hu(g,L),g.stateNode===null)m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),Mx(g,E,C),pv(g,E,C,L),C=!0;else if(m===null){var re=g.stateNode,ye=g.memoizedProps;re.props=ye;var je=re.context,st=E.contextType;typeof st=="object"&&st!==null?st=Xi(st):(st=In(E)?Rr:xn.current,st=li(g,st));var St=E.getDerivedStateFromProps,rn=typeof St=="function"||typeof re.getSnapshotBeforeUpdate=="function";rn||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ye!==C||je!==st)&&Ex(g,re,C,st),Ds=!1;var zt=g.memoizedState;re.state=zt,gp(g,C,re,L),je=g.memoizedState,ye!==C||zt!==je||tn.current||Ds?(typeof St=="function"&&(fv(g,E,St,C),je=g.memoizedState),(ye=Ds||hv(g,E,ye,C,zt,je,st))?(rn||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"&&(g.flags|=4194308)):(typeof re.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=C,g.memoizedState=je),re.props=C,re.state=je,re.context=st,C=ye):(typeof re.componentDidMount=="function"&&(g.flags|=4194308),C=!1)}else{re=g.stateNode,dv(m,g),ye=g.memoizedProps,st=g.type===g.elementType?ye:$i(g.type,ye),re.props=st,rn=g.pendingProps,zt=re.context,je=E.contextType,typeof je=="object"&&je!==null?je=Xi(je):(je=In(E)?Rr:xn.current,je=li(g,je));var ln=E.getDerivedStateFromProps;(St=typeof ln=="function"||typeof re.getSnapshotBeforeUpdate=="function")||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ye!==rn||zt!==je)&&Ex(g,re,C,je),Ds=!1,zt=g.memoizedState,re.state=zt,gp(g,C,re,L);var xt=g.memoizedState;ye!==rn||zt!==xt||tn.current||Ds?(typeof ln=="function"&&(fv(g,E,ln,C),xt=g.memoizedState),(st=Ds||hv(g,E,st,C,zt,xt,je)||!1)?(St||typeof re.UNSAFE_componentWillUpdate!="function"&&typeof re.componentWillUpdate!="function"||(typeof re.componentWillUpdate=="function"&&re.componentWillUpdate(C,xt,je),typeof re.UNSAFE_componentWillUpdate=="function"&&re.UNSAFE_componentWillUpdate(C,xt,je)),typeof re.componentDidUpdate=="function"&&(g.flags|=4),typeof re.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof re.componentDidUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=1024),g.memoizedProps=C,g.memoizedState=xt),re.props=C,re.state=xt,re.context=je,C=st):(typeof re.componentDidUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=1024),C=!1)}return ui(m,g,E,C,F,L)}function ui(m,g,E,C,L,F){Ri(m,g);var re=(g.flags&128)!==0;if(!C&&!re)return L&&Xr(g,E,!1),Ki(m,g,F);C=g.stateNode,Rv.current=g;var ye=re&&typeof E.getDerivedStateFromError!="function"?null:C.render();return g.flags|=1,m!==null&&re?(g.child=co(g,m.child,null,F),g.child=co(g,null,ye,F)):lr(m,g,ye,F),g.memoizedState=C.state,L&&Xr(g,E,!0),g.child}function ef(m){var g=m.stateNode;g.pendingContext?Vn(m,g.pendingContext,g.pendingContext!==g.context):g.context&&Vn(m,g.context,!1),wp(m,g.containerInfo)}function Nv(m,g,E,C,L){return vu(),_p(L),g.flags|=256,lr(m,g,E,C),g.child}var tf={dehydrated:null,treeContext:null,retryLane:0};function sc(m){return{baseLanes:m,cachePool:null}}function Iv(m,g,E){var C=g.pendingProps,L=nr.current,F=!1,re=(g.flags&128)!==0,ye;if((ye=re)||(ye=m!==null&&m.memoizedState===null?!1:(L&2)!==0),ye?(F=!0,g.flags&=-129):(m===null||m.memoizedState!==null)&&(L|=1),Ut(nr,L&1),m===null)return tl(g),m=g.memoizedState,m!==null&&(m=m.dehydrated,m!==null)?((g.mode&1)===0?g.lanes=1:Ns(m)?g.lanes=8:g.lanes=1073741824,null):(L=C.children,m=C.fallback,F?(C=g.mode,F=g.child,L={mode:"hidden",children:L},(C&1)===0&&F!==null?(F.childLanes=0,F.pendingProps=L):F=vf(L,C,0,null),m=vc(m,C,E,null),F.return=g,m.return=g,F.sibling=m,g.child=F,g.child.memoizedState=sc(E),g.memoizedState=tf,m):aa(g,L));if(L=m.memoizedState,L!==null){if(ye=L.dehydrated,ye!==null){if(re)return g.flags&256?(g.flags&=-257,rf(m,g,E,Error(a(422)))):g.memoizedState!==null?(g.child=m.child,g.flags|=128,null):(F=C.fallback,L=g.mode,C=vf({mode:"visible",children:C.children},L,0,null),F=vc(F,L,E,null),F.flags|=2,C.return=g,F.return=g,C.sibling=F,g.child=C,(g.mode&1)!==0&&co(g,m.child,null,E),g.child.memoizedState=sc(E),g.memoizedState=tf,F);if((g.mode&1)===0)g=rf(m,g,E,null);else if(Ns(ye))g=rf(m,g,E,Error(a(419)));else if(C=(E&m.childLanes)!==0,Fr||C){if(C=gr,C!==null){switch(E&-E){case 4:F=2;break;case 16:F=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:F=32;break;case 536870912:F=268435456;break;default:F=0}C=(F&(C.suspendedLanes|E))!==0?0:F,C!==0&&C!==L.retryLane&&(L.retryLane=C,fi(m,C,-1))}Gp(),g=rf(m,g,E,Error(a(421)))}else Ko(ye)?(g.flags|=128,g.child=m.child,g=Fx.bind(null,m),no(ye,g),g=null):(E=L.treeContext,Z&&(qr=ou(ye),Ci=g,Qn=!0,js=null,gu=!1,E!==null&&(Us[us++]=oo,Us[us++]=lo,Us[us++]=ql,oo=E.id,lo=E.overflow,ql=g)),g=aa(g,g.pendingProps.children),g.flags|=4096);return g}return F?(C=jp(m,g,C.children,C.fallback,E),F=g.child,L=m.child.memoizedState,F.memoizedState=L===null?sc(E):{baseLanes:L.baseLanes|E,cachePool:null},F.childLanes=m.childLanes&~E,g.memoizedState=tf,C):(E=nf(m,g,C.children,E),g.memoizedState=null,E)}return F?(C=jp(m,g,C.children,C.fallback,E),F=g.child,L=m.child.memoizedState,F.memoizedState=L===null?sc(E):{baseLanes:L.baseLanes|E,cachePool:null},F.childLanes=m.childLanes&~E,g.memoizedState=tf,C):(E=nf(m,g,C.children,E),g.memoizedState=null,E)}function aa(m,g){return g=vf({mode:"visible",children:g},m.mode,0,null),g.return=m,m.child=g}function nf(m,g,E,C){var L=m.child;return m=L.sibling,E=So(L,{mode:"visible",children:E}),(g.mode&1)===0&&(E.lanes=C),E.return=g,E.sibling=null,m!==null&&(C=g.deletions,C===null?(g.deletions=[m],g.flags|=16):C.push(m)),g.child=E}function jp(m,g,E,C,L){var F=g.mode;m=m.child;var re=m.sibling,ye={mode:"hidden",children:E};return(F&1)===0&&g.child!==m?(E=g.child,E.childLanes=0,E.pendingProps=ye,g.deletions=null):(E=So(m,ye),E.subtreeFlags=m.subtreeFlags&14680064),re!==null?C=So(re,C):(C=vc(C,F,L,null),C.flags|=2),C.return=g,E.return=g,E.sibling=C,g.child=E,C}function rf(m,g,E,C){return C!==null&&_p(C),co(g,m.child,null,E),m=aa(g,g.pendingProps.children),m.flags|=2,g.memoizedState=null,m}function Lx(m,g,E){m.lanes|=g;var C=m.alternate;C!==null&&(C.lanes|=g),Xl(m.return,g,E)}function Ia(m,g,E,C,L){var F=m.memoizedState;F===null?m.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:C,tail:E,tailMode:L}:(F.isBackwards=g,F.rendering=null,F.renderingStartTime=0,F.last=C,F.tail=E,F.tailMode=L)}function ac(m,g,E){var C=g.pendingProps,L=C.revealOrder,F=C.tail;if(lr(m,g,C.children,E),C=nr.current,(C&2)!==0)C=C&1|2,g.flags|=128;else{if(m!==null&&(m.flags&128)!==0)e:for(m=g.child;m!==null;){if(m.tag===13)m.memoizedState!==null&&Lx(m,E,g);else if(m.tag===19)Lx(m,E,g);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===g)break e;for(;m.sibling===null;){if(m.return===null||m.return===g)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}C&=1}if(Ut(nr,C),(g.mode&1)===0)g.memoizedState=null;else switch(L){case"forwards":for(E=g.child,L=null;E!==null;)m=E.alternate,m!==null&&Sp(m)===null&&(L=E),E=E.sibling;E=L,E===null?(L=g.child,g.child=null):(L=E.sibling,E.sibling=null),Ia(g,!1,L,E,F);break;case"backwards":for(E=null,L=g.child,g.child=null;L!==null;){if(m=L.alternate,m!==null&&Sp(m)===null){g.child=L;break}m=L.sibling,L.sibling=E,E=L,L=m}Ia(g,!0,E,null,F);break;case"together":Ia(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function Ki(m,g,E){if(m!==null&&(g.dependencies=m.dependencies),ka|=g.lanes,(E&g.childLanes)===0)return null;if(m!==null&&g.child!==m.child)throw Error(a(153));if(g.child!==null){for(m=g.child,E=So(m,m.pendingProps),g.child=E,E.return=g;m.sibling!==null;)m=m.sibling,E=E.sibling=So(m,m.pendingProps),E.return=g;E.sibling=null}return g.child}function Fp(m,g,E){switch(g.tag){case 3:ef(g),vu();break;case 5:Rx(g);break;case 1:In(g.type)&&Yo(g);break;case 4:wp(g,g.stateNode.containerInfo);break;case 10:$l(g,g.type._context,g.memoizedProps.value);break;case 13:var C=g.memoizedState;if(C!==null)return C.dehydrated!==null?(Ut(nr,nr.current&1),g.flags|=128,null):(E&g.child.childLanes)!==0?Iv(m,g,E):(Ut(nr,nr.current&1),m=Ki(m,g,E),m!==null?m.sibling:null);Ut(nr,nr.current&1);break;case 19:if(C=(E&g.childLanes)!==0,(m.flags&128)!==0){if(C)return ac(m,g,E);g.flags|=128}var L=g.memoizedState;if(L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),Ut(nr,nr.current),C)break;return null;case 22:case 23:return g.lanes=0,Kr(m,g,E)}return Ki(m,g,E)}function zp(m,g){switch(gv(g),g.tag){case 1:return In(g.type)&&Is(),m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 3:return _u(),Kt(tn),Kt(xn),Ql(),m=g.flags,(m&65536)!==0&&(m&128)===0?(g.flags=m&-65537|128,g):null;case 5:return xv(g),null;case 13:if(Kt(nr),m=g.memoizedState,m!==null&&m.dehydrated!==null){if(g.alternate===null)throw Error(a(340));vu()}return m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 19:return Kt(nr),null;case 4:return _u(),null;case 10:return Vd(g.type._context),null;case 22:case 23:return pf(),null;case 24:return null;default:return null}}var Ni=!1,zr=!1,oc=typeof WeakSet=="function"?WeakSet:Set,ut=null;function Fs(m,g){var E=m.ref;if(E!==null)if(typeof E=="function")try{E(null)}catch(C){ki(m,g,C)}else E.current=null}function go(m,g,E){try{E()}catch(C){ki(m,g,C)}}var kv=!1;function Ov(m,g){for(J(m.containerInfo),ut=g;ut!==null;)if(m=ut,g=m.child,(m.subtreeFlags&1028)!==0&&g!==null)g.return=m,ut=g;else for(;ut!==null;){m=ut;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 C=E.memoizedProps,L=E.memoizedState,F=m.stateNode,re=F.getSnapshotBeforeUpdate(m.elementType===m.type?C:$i(m.type,C),L);F.__reactInternalSnapshotBeforeUpdate=re}break;case 3:$e&&at(m.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(ye){ki(m,m.return,ye)}if(g=m.sibling,g!==null){g.return=m.return,ut=g;break}ut=m.return}return E=kv,kv=!1,E}function vo(m,g,E){var C=g.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var L=C=C.next;do{if((L.tag&m)===m){var F=L.destroy;L.destroy=void 0,F!==void 0&&go(g,E,F)}L=L.next}while(L!==C)}}function Yr(m,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var E=g=g.next;do{if((E.tag&m)===m){var C=E.create;E.destroy=C()}E=E.next}while(E!==g)}}function Ii(m){var g=m.ref;if(g!==null){var E=m.stateNode;switch(m.tag){case 5:m=ae(E);break;default:m=E}typeof g=="function"?g(m):g.current=m}}function Kn(m,g,E){if(Ca&&typeof Ca.onCommitFiberUnmount=="function")try{Ca.onCommitFiberUnmount(Fd,g)}catch{}switch(g.tag){case 0:case 11:case 14:case 15:if(m=g.updateQueue,m!==null&&(m=m.lastEffect,m!==null)){var C=m=m.next;do{var L=C,F=L.destroy;L=L.tag,F!==void 0&&((L&2)!==0||(L&4)!==0)&&go(g,E,F),C=C.next}while(C!==m)}break;case 1:if(Fs(g,E),m=g.stateNode,typeof m.componentWillUnmount=="function")try{m.props=g.memoizedProps,m.state=g.memoizedState,m.componentWillUnmount()}catch(re){ki(g,E,re)}break;case 5:Fs(g,E);break;case 4:$e?Uv(m,g,E):de&&de&&(g=g.stateNode.containerInfo,E=Jt(g),en(g,E))}}function zs(m,g,E){for(var C=g;;)if(Kn(m,C,E),C.child===null||$e&&C.tag===4){if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return}C.sibling.return=C.return,C=C.sibling}else C.child.return=C,C=C.child}function Lv(m){var g=m.alternate;g!==null&&(m.alternate=null,Lv(g)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(g=m.stateNode,g!==null&&Ce(g)),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 g=m.return;g!==null;){if(Dv(g))break e;g=g.return}throw Error(a(160))}var E=g;switch(E.tag){case 5:g=E.stateNode,E.flags&32&&(Xe(g),E.flags&=-33),E=Bp(m),Pu(m,E,g);break;case 3:case 4:g=E.stateNode.containerInfo,E=Bp(m),Vp(m,E,g);break;default:throw Error(a(161))}}}function Vp(m,g,E){var C=m.tag;if(C===5||C===6)m=m.stateNode,g?vt(E,m,g):Xt(E,m);else if(C!==4&&(m=m.child,m!==null))for(Vp(m,g,E),m=m.sibling;m!==null;)Vp(m,g,E),m=m.sibling}function Pu(m,g,E){var C=m.tag;if(C===5||C===6)m=m.stateNode,g?Mt(E,m,g):ht(E,m);else if(C!==4&&(m=m.child,m!==null))for(Pu(m,g,E),m=m.sibling;m!==null;)Pu(m,g,E),m=m.sibling}function Uv(m,g,E){for(var C=g,L=!1,F,re;;){if(!L){L=C.return;e:for(;;){if(L===null)throw Error(a(160));switch(F=L.stateNode,L.tag){case 5:re=!1;break e;case 3:F=F.containerInfo,re=!0;break e;case 4:F=F.containerInfo,re=!0;break e}L=L.return}L=!0}if(C.tag===5||C.tag===6)zs(m,C,E),re?fe(F,C.stateNode):Zt(F,C.stateNode);else if(C.tag===18)re?Ie(F,C.stateNode):Te(F,C.stateNode);else if(C.tag===4){if(C.child!==null){F=C.stateNode.containerInfo,re=!0,C.child.return=C,C=C.child;continue}}else if(Kn(m,C,E),C.child!==null){C.child.return=C,C=C.child;continue}if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return,C.tag===4&&(L=!1)}C.sibling.return=C.return,C=C.sibling}}function al(m,g){if($e){switch(g.tag){case 0:case 11:case 14:case 15:vo(3,g,g.return),Yr(3,g),vo(5,g,g.return);return;case 1:return;case 5:var E=g.stateNode;if(E!=null){var C=g.memoizedProps;m=m!==null?m.memoizedProps:C;var L=g.type,F=g.updateQueue;g.updateQueue=null,F!==null&&tt(E,F,L,m,C,g)}return;case 6:if(g.stateNode===null)throw Error(a(162));E=g.memoizedProps,Ke(g.stateNode,m!==null?m.memoizedProps:E,E);return;case 3:Z&&m!==null&&m.memoizedState.isDehydrated&&K(g.stateNode.containerInfo);return;case 12:return;case 13:Cu(g);return;case 19:Cu(g);return;case 17:return}throw Error(a(163))}switch(g.tag){case 0:case 11:case 14:case 15:vo(3,g,g.return),Yr(3,g),vo(5,g,g.return);return;case 12:return;case 13:Cu(g);return;case 19:Cu(g);return;case 3:Z&&m!==null&&m.memoizedState.isDehydrated&&K(g.stateNode.containerInfo);break;case 22:case 23:return}e:if(de){switch(g.tag){case 1:case 5:case 6:break e;case 3:case 4:g=g.stateNode,en(g.containerInfo,g.pendingChildren);break e}throw Error(a(163))}}function Cu(m){var g=m.updateQueue;if(g!==null){m.updateQueue=null;var E=m.stateNode;E===null&&(E=m.stateNode=new oc),g.forEach(function(C){var L=zx.bind(null,m,C);E.has(C)||(E.add(C),C.then(L,L))})}}function AM(m,g){for(ut=g;ut!==null;){g=ut;var E=g.deletions;if(E!==null)for(var C=0;C";case cc:return":has("+(ol(m)||"")+")";case uc:return'[role="'+m.value+'"]';case Ru:return'"'+m.value+'"';case yo:return'[data-testname="'+m.value+'"]';default:throw Error(a(365))}}function ps(m,g){var E=[];m=[m,0];for(var C=0;CL&&(L=re),C&=~F}if(C=L,C=Nr()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*zv(C/1960))-C,10m?16:m,Oa===null)var C=!1;else{if(m=Oa,Oa=null,mc=0,(on&6)!==0)throw Error(a(331));var L=on;for(on|=4,ut=m.current;ut!==null;){var F=ut,re=F.child;if((ut.flags&16)!==0){var ye=F.deletions;if(ye!==null){for(var je=0;jeNr()-df?wo(m,0):hc|=E),Yi(m,g)}function Xv(m,g){g===0&&((m.mode&1)===0?g=1:(g=Pn,Pn<<=1,(Pn&130023424)===0&&(Pn=4194304)));var E=Cn();m=cl(m,g),m!==null&&(Hl(m,g,E),Yi(m,E))}function Fx(m){var g=m.memoizedState,E=0;g!==null&&(E=g.retryLane),Xv(m,E)}function zx(m,g){var E=0;switch(m.tag){case 13:var C=m.stateNode,L=m.memoizedState;L!==null&&(E=L.retryLane);break;case 19:C=m.stateNode;break;default:throw Error(a(314))}C!==null&&C.delete(g),Xv(m,E)}var qv;qv=function(m,g,E){if(m!==null)if(m.memoizedProps!==g.pendingProps||tn.current)Fr=!0;else{if((m.lanes&E)===0&&(g.flags&128)===0)return Fr=!1,Fp(m,g,E);Fr=(m.flags&131072)!==0}else Fr=!1,Qn&&(g.flags&1048576)!==0&&Ax(g,xp,g.index);switch(g.lanes=0,g.tag){case 2:var C=g.type;m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),m=g.pendingProps;var L=li(g,xn.current);hu(g,E),L=wu(null,g,C,m,L,E);var F=rl();return g.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,In(C)?(F=!0,Yo(g)):F=!1,g.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,pu(g),L.updater=vp,g.stateNode=L,L._reactInternals=g,pv(g,C,m,E),g=ui(null,g,C,!0,F,E)):(g.tag=0,Qn&&F&&mv(g),lr(null,g,L,E),g=g.child),g;case 16:C=g.elementType;e:{switch(m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),m=g.pendingProps,L=C._init,C=L(C._payload),g.type=C,L=g.tag=TM(C),m=$i(C,m),L){case 0:g=mo(null,g,C,m,E);break e;case 1:g=ic(null,g,C,m,E);break e;case 11:g=$n(null,g,C,m,E);break e;case 14:g=Gn(null,g,C,$i(C.type,m),E);break e}throw Error(a(306,C,""))}return g;case 0:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),mo(m,g,C,L,E);case 1:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),ic(m,g,C,L,E);case 3:e:{if(ef(g),m===null)throw Error(a(387));C=g.pendingProps,F=g.memoizedState,L=F.element,dv(m,g),gp(g,C,null,E);var re=g.memoizedState;if(C=re.element,Z&&F.isDehydrated)if(F={element:C,isDehydrated:!1,cache:re.cache,transitions:re.transitions},g.updateQueue.baseState=F,g.memoizedState=F,g.flags&256){L=Error(a(423)),g=Nv(m,g,C,E,L);break e}else if(C!==L){L=Error(a(424)),g=Nv(m,g,C,E,L);break e}else for(Z&&(qr=ro(g.stateNode.containerInfo),Ci=g,Qn=!0,js=null,gu=!1),E=Cx(g,null,C,E),g.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(vu(),C===L){g=Ki(m,g,E);break e}lr(m,g,C,E)}g=g.child}return g;case 5:return Rx(g),m===null&&tl(g),C=g.type,L=g.pendingProps,F=m!==null?m.memoizedProps:null,re=L.children,ce(C,L)?re=null:F!==null&&ce(C,F)&&(g.flags|=32),Ri(m,g),lr(m,g,re,E),g.child;case 6:return m===null&&tl(g),null;case 13:return Iv(m,g,E);case 4:return wp(g,g.stateNode.containerInfo),C=g.pendingProps,m===null?g.child=co(g,null,C,E):lr(m,g,C,E),g.child;case 11:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),$n(m,g,C,L,E);case 7:return lr(m,g,g.pendingProps,E),g.child;case 8:return lr(m,g,g.pendingProps.children,E),g.child;case 12:return lr(m,g,g.pendingProps.children,E),g.child;case 10:e:{if(C=g.type._context,L=g.pendingProps,F=g.memoizedProps,re=L.value,$l(g,C,re),F!==null)if(Ti(F.value,re)){if(F.children===L.children&&!tn.current){g=Ki(m,g,E);break e}}else for(F=g.child,F!==null&&(F.return=g);F!==null;){var ye=F.dependencies;if(ye!==null){re=F.child;for(var je=ye.firstContext;je!==null;){if(je.context===C){if(F.tag===1){je=ao(-1,E&-E),je.tag=2;var st=F.updateQueue;if(st!==null){st=st.shared;var St=st.pending;St===null?je.next=je:(je.next=St.next,St.next=je),st.pending=je}}F.lanes|=E,je=F.alternate,je!==null&&(je.lanes|=E),Xl(F.return,E,g),ye.lanes|=E;break}je=je.next}}else if(F.tag===10)re=F.type===g.type?null:F.child;else if(F.tag===18){if(re=F.return,re===null)throw Error(a(341));re.lanes|=E,ye=re.alternate,ye!==null&&(ye.lanes|=E),Xl(re,E,g),re=F.sibling}else re=F.child;if(re!==null)re.return=F;else for(re=F;re!==null;){if(re===g){re=null;break}if(F=re.sibling,F!==null){F.return=re.return,re=F;break}re=re.return}F=re}lr(m,g,L.children,E),g=g.child}return g;case 9:return L=g.type,C=g.pendingProps.children,hu(g,E),L=Xi(L),C=C(L),g.flags|=1,lr(m,g,C,E),g.child;case 14:return C=g.type,L=$i(C,g.pendingProps),L=$i(C.type,L),Gn(m,g,C,L,E);case 15:return po(m,g,g.type,g.pendingProps,E);case 17:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),g.tag=1,In(C)?(m=!0,Yo(g)):m=!1,hu(g,E),Mx(g,C,L),pv(g,C,L,E),ui(null,g,C,!0,m,E);case 19:return ac(m,g,E);case 22:return Kr(m,g,E)}throw Error(a(156,g.tag))};function Wp(m,g){return Vl(m,g)}function Bx(m,g,E,C){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=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(m,g,E,C){return new Bx(m,g,E,C)}function $p(m){return m=m.prototype,!(!m||!m.isReactComponent)}function TM(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 So(m,g){var E=m.alternate;return E===null?(E=vs(m.tag,g,m.key,m.mode),E.elementType=m.elementType,E.type=m.type,E.stateNode=m.stateNode,E.alternate=m,m.alternate=E):(E.pendingProps=g,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,g=m.dependencies,E.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},E.sibling=m.sibling,E.index=m.index,E.ref=m.ref,E}function Xp(m,g,E,C,L,F){var re=2;if(C=m,typeof m=="function")$p(m)&&(re=1);else if(typeof m=="string")re=5;else e:switch(m){case d:return vc(E.children,L,F,g);case f:re=8,L|=8;break;case p:return m=vs(12,E,g,L|2),m.elementType=p,m.lanes=F,m;case w:return m=vs(13,E,g,L),m.elementType=w,m.lanes=F,m;case x:return m=vs(19,E,g,L),m.elementType=x,m.lanes=F,m;case P:return vf(E,L,F,g);default:if(typeof m=="object"&&m!==null)switch(m.$$typeof){case y:re=10;break e;case b:re=9;break e;case S:re=11;break e;case M:re=14;break e;case T:re=16,C=null;break e}throw Error(a(130,m==null?m:typeof m,""))}return g=vs(re,E,g,L),g.elementType=m,g.type=C,g.lanes=F,g}function vc(m,g,E,C){return m=vs(7,m,C,g),m.lanes=E,m}function vf(m,g,E,C){return m=vs(22,m,C,g),m.elementType=P,m.lanes=E,m.stateNode={},m}function qp(m,g,E){return m=vs(6,m,null,g),m.lanes=E,m}function Kp(m,g,E){return g=vs(4,m.children!==null?m.children:[],m.key,g),g.lanes=E,g.stateNode={containerInfo:m.containerInfo,pendingChildren:null,implementation:m.implementation},g}function Yp(m,g,E,C,L){this.tag=g,this.containerInfo=m,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ee,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ap(0),this.expirationTimes=ap(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ap(0),this.identifierPrefix=C,this.onRecoverableError=L,Z&&(this.mutableSourceEagerHydrationData=null)}function Hx(m,g,E,C,L,F,re,ye,je){return m=new Yp(m,g,E,ye,je),g===1?(g=1,F===!0&&(g|=8)):g=0,F=vs(3,null,null,g),m.current=F,F.stateNode=m,F.memoizedState={element:C,isDehydrated:E,cache:null,transitions:null},pu(F),m}function Vx(m){if(!m)return mt;m=m._reactInternals;e:{if(V(m)!==m||m.tag!==1)throw Error(a(170));var g=m;do{switch(g.tag){case 3:g=g.stateNode.context;break e;case 1:if(In(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break e}}g=g.return}while(g!==null);throw Error(a(171))}if(m.tag===1){var E=m.type;if(In(E))return ta(m,E,g)}return g}function Gx(m){var g=m._reactInternals;if(g===void 0)throw typeof m.render=="function"?Error(a(188)):(m=Object.keys(m).join(","),Error(a(268,m)));return m=X(g),m===null?null:m.stateNode}function Bs(m,g){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var E=m.retryLane;m.retryLane=E!==0&&E=st&&F>=rn&&L<=St&&re<=zt){m.splice(g,1);break}else if(C!==st||E.width!==je.width||ztre){if(!(F!==rn||E.height!==je.height||StL)){st>C&&(je.width+=st-C,je.x=C),StF&&(je.height+=rn-F,je.y=F),ztE&&(E=re)),rell&&(g.flags|=128,C=!0,ho(L,!1),g.lanes=4194304)}else{if(!C)if(m=Sp(F),m!==null){if(g.flags|=128,C=!0,m=m.updateQueue,m!==null&&(g.updateQueue=m,g.flags|=4),ho(L,!0),L.tail===null&&L.tailMode==="hidden"&&!F.alternate&&!Qn)return mr(g),null}else 2*Nr()-L.renderingStartTime>ll&&E!==1073741824&&(g.flags|=128,C=!0,ho(L,!1),g.lanes=4194304);L.isBackwards?(F.sibling=g.child,g.child=F):(m=L.last,m!==null?m.sibling=F:g.child=F,L.last=F)}return L.tail!==null?(g=L.tail,L.rendering=g,L.tail=g.sibling,L.renderingStartTime=Nr(),g.sibling=null,m=nr.current,Ut(nr,C?m&1|2:m&1),g):(mr(g),null);case 22:case 23:return pf(),C=g.memoizedState!==null,m!==null&&m.memoizedState!==null!==C&&(g.flags|=8192),C&&(g.mode&1)!==0?(di&1073741824)!==0&&(mr(g),$e&&g.subtreeFlags&6&&(g.flags|=8192)):mr(g),null;case 24:return null;case 25:return null}throw Error(a(156,g.tag))}var Rv=o.ReactCurrentOwner,Fr=!1;function lr(m,g,E,C){g.child=m===null?Cx(g,null,E,C):co(g,m.child,E,C)}function $n(m,g,E,C,L){E=E.render;var F=g.ref;return hu(g,L),C=wu(m,g,E,C,F,L),E=rl(),m!==null&&!Fr?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~L,Ki(m,g,L)):(Qn&&E&&mv(g),g.flags|=1,lr(m,g,C,L),g.child)}function Gn(m,g,E,C,L){if(m===null){var F=E.type;return typeof F=="function"&&!$p(F)&&F.defaultProps===void 0&&E.compare===null&&E.defaultProps===void 0?(g.tag=15,g.type=F,po(m,g,F,C,L)):(m=Xp(E.type,null,C,g,g.mode,L),m.ref=g.ref,m.return=g,g.child=m)}if(F=m.child,(m.lanes&L)===0){var re=F.memoizedProps;if(E=E.compare,E=E!==null?E:na,E(re,C)&&m.ref===g.ref)return Ki(m,g,L)}return g.flags|=1,m=So(F,C),m.ref=g.ref,m.return=g,g.child=m}function po(m,g,E,C,L){if(m!==null&&na(m.memoizedProps,C)&&m.ref===g.ref)if(Fr=!1,(m.lanes&L)!==0)(m.flags&131072)!==0&&(Fr=!0);else return g.lanes=m.lanes,Ki(m,g,L);return mo(m,g,E,C,L)}function Kr(m,g,E){var C=g.pendingProps,L=C.children,F=m!==null?m.memoizedState:null;if(C.mode==="hidden")if((g.mode&1)===0)g.memoizedState={baseLanes:0,cachePool:null},Ut(fc,di),di|=E;else if((E&1073741824)!==0)g.memoizedState={baseLanes:0,cachePool:null},C=F!==null?F.baseLanes:E,Ut(fc,di),di|=C;else return m=F!==null?F.baseLanes|E:E,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:m,cachePool:null},g.updateQueue=null,Ut(fc,di),di|=m,null;else F!==null?(C=F.baseLanes|E,g.memoizedState=null):C=E,Ut(fc,di),di|=C;return lr(m,g,L,E),g.child}function Ri(m,g){var E=g.ref;(m===null&&E!==null||m!==null&&m.ref!==E)&&(g.flags|=512,g.flags|=2097152)}function mo(m,g,E,C,L){var F=In(E)?Rr:xn.current;return F=li(g,F),hu(g,L),E=wu(m,g,E,C,F,L),C=rl(),m!==null&&!Fr?(g.updateQueue=m.updateQueue,g.flags&=-2053,m.lanes&=~L,Ki(m,g,L)):(Qn&&C&&mv(g),g.flags|=1,lr(m,g,E,L),g.child)}function ic(m,g,E,C,L){if(In(E)){var F=!0;Yo(g)}else F=!1;if(hu(g,L),g.stateNode===null)m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),Mx(g,E,C),pv(g,E,C,L),C=!0;else if(m===null){var re=g.stateNode,ye=g.memoizedProps;re.props=ye;var je=re.context,st=E.contextType;typeof st=="object"&&st!==null?st=Xi(st):(st=In(E)?Rr:xn.current,st=li(g,st));var St=E.getDerivedStateFromProps,rn=typeof St=="function"||typeof re.getSnapshotBeforeUpdate=="function";rn||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ye!==C||je!==st)&&Ex(g,re,C,st),Ds=!1;var zt=g.memoizedState;re.state=zt,gp(g,C,re,L),je=g.memoizedState,ye!==C||zt!==je||tn.current||Ds?(typeof St=="function"&&(fv(g,E,St,C),je=g.memoizedState),(ye=Ds||hv(g,E,ye,C,zt,je,st))?(rn||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"&&(g.flags|=4194308)):(typeof re.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=C,g.memoizedState=je),re.props=C,re.state=je,re.context=st,C=ye):(typeof re.componentDidMount=="function"&&(g.flags|=4194308),C=!1)}else{re=g.stateNode,dv(m,g),ye=g.memoizedProps,st=g.type===g.elementType?ye:$i(g.type,ye),re.props=st,rn=g.pendingProps,zt=re.context,je=E.contextType,typeof je=="object"&&je!==null?je=Xi(je):(je=In(E)?Rr:xn.current,je=li(g,je));var ln=E.getDerivedStateFromProps;(St=typeof ln=="function"||typeof re.getSnapshotBeforeUpdate=="function")||typeof re.UNSAFE_componentWillReceiveProps!="function"&&typeof re.componentWillReceiveProps!="function"||(ye!==rn||zt!==je)&&Ex(g,re,C,je),Ds=!1,zt=g.memoizedState,re.state=zt,gp(g,C,re,L);var xt=g.memoizedState;ye!==rn||zt!==xt||tn.current||Ds?(typeof ln=="function"&&(fv(g,E,ln,C),xt=g.memoizedState),(st=Ds||hv(g,E,st,C,zt,xt,je)||!1)?(St||typeof re.UNSAFE_componentWillUpdate!="function"&&typeof re.componentWillUpdate!="function"||(typeof re.componentWillUpdate=="function"&&re.componentWillUpdate(C,xt,je),typeof re.UNSAFE_componentWillUpdate=="function"&&re.UNSAFE_componentWillUpdate(C,xt,je)),typeof re.componentDidUpdate=="function"&&(g.flags|=4),typeof re.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof re.componentDidUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=1024),g.memoizedProps=C,g.memoizedState=xt),re.props=C,re.state=xt,re.context=je,C=st):(typeof re.componentDidUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=4),typeof re.getSnapshotBeforeUpdate!="function"||ye===m.memoizedProps&&zt===m.memoizedState||(g.flags|=1024),C=!1)}return ui(m,g,E,C,F,L)}function ui(m,g,E,C,L,F){Ri(m,g);var re=(g.flags&128)!==0;if(!C&&!re)return L&&Xr(g,E,!1),Ki(m,g,F);C=g.stateNode,Rv.current=g;var ye=re&&typeof E.getDerivedStateFromError!="function"?null:C.render();return g.flags|=1,m!==null&&re?(g.child=co(g,m.child,null,F),g.child=co(g,null,ye,F)):lr(m,g,ye,F),g.memoizedState=C.state,L&&Xr(g,E,!0),g.child}function ef(m){var g=m.stateNode;g.pendingContext?Vn(m,g.pendingContext,g.pendingContext!==g.context):g.context&&Vn(m,g.context,!1),wp(m,g.containerInfo)}function Nv(m,g,E,C,L){return vu(),_p(L),g.flags|=256,lr(m,g,E,C),g.child}var tf={dehydrated:null,treeContext:null,retryLane:0};function sc(m){return{baseLanes:m,cachePool:null}}function Iv(m,g,E){var C=g.pendingProps,L=nr.current,F=!1,re=(g.flags&128)!==0,ye;if((ye=re)||(ye=m!==null&&m.memoizedState===null?!1:(L&2)!==0),ye?(F=!0,g.flags&=-129):(m===null||m.memoizedState!==null)&&(L|=1),Ut(nr,L&1),m===null)return tl(g),m=g.memoizedState,m!==null&&(m=m.dehydrated,m!==null)?((g.mode&1)===0?g.lanes=1:Ns(m)?g.lanes=8:g.lanes=1073741824,null):(L=C.children,m=C.fallback,F?(C=g.mode,F=g.child,L={mode:"hidden",children:L},(C&1)===0&&F!==null?(F.childLanes=0,F.pendingProps=L):F=vf(L,C,0,null),m=vc(m,C,E,null),F.return=g,m.return=g,F.sibling=m,g.child=F,g.child.memoizedState=sc(E),g.memoizedState=tf,m):aa(g,L));if(L=m.memoizedState,L!==null){if(ye=L.dehydrated,ye!==null){if(re)return g.flags&256?(g.flags&=-257,rf(m,g,E,Error(a(422)))):g.memoizedState!==null?(g.child=m.child,g.flags|=128,null):(F=C.fallback,L=g.mode,C=vf({mode:"visible",children:C.children},L,0,null),F=vc(F,L,E,null),F.flags|=2,C.return=g,F.return=g,C.sibling=F,g.child=C,(g.mode&1)!==0&&co(g,m.child,null,E),g.child.memoizedState=sc(E),g.memoizedState=tf,F);if((g.mode&1)===0)g=rf(m,g,E,null);else if(Ns(ye))g=rf(m,g,E,Error(a(419)));else if(C=(E&m.childLanes)!==0,Fr||C){if(C=gr,C!==null){switch(E&-E){case 4:F=2;break;case 16:F=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:F=32;break;case 536870912:F=268435456;break;default:F=0}C=(F&(C.suspendedLanes|E))!==0?0:F,C!==0&&C!==L.retryLane&&(L.retryLane=C,fi(m,C,-1))}Gp(),g=rf(m,g,E,Error(a(421)))}else Ko(ye)?(g.flags|=128,g.child=m.child,g=Fx.bind(null,m),no(ye,g),g=null):(E=L.treeContext,Z&&(qr=ou(ye),Ci=g,Qn=!0,js=null,gu=!1,E!==null&&(Us[us++]=oo,Us[us++]=lo,Us[us++]=ql,oo=E.id,lo=E.overflow,ql=g)),g=aa(g,g.pendingProps.children),g.flags|=4096);return g}return F?(C=jp(m,g,C.children,C.fallback,E),F=g.child,L=m.child.memoizedState,F.memoizedState=L===null?sc(E):{baseLanes:L.baseLanes|E,cachePool:null},F.childLanes=m.childLanes&~E,g.memoizedState=tf,C):(E=nf(m,g,C.children,E),g.memoizedState=null,E)}return F?(C=jp(m,g,C.children,C.fallback,E),F=g.child,L=m.child.memoizedState,F.memoizedState=L===null?sc(E):{baseLanes:L.baseLanes|E,cachePool:null},F.childLanes=m.childLanes&~E,g.memoizedState=tf,C):(E=nf(m,g,C.children,E),g.memoizedState=null,E)}function aa(m,g){return g=vf({mode:"visible",children:g},m.mode,0,null),g.return=m,m.child=g}function nf(m,g,E,C){var L=m.child;return m=L.sibling,E=So(L,{mode:"visible",children:E}),(g.mode&1)===0&&(E.lanes=C),E.return=g,E.sibling=null,m!==null&&(C=g.deletions,C===null?(g.deletions=[m],g.flags|=16):C.push(m)),g.child=E}function jp(m,g,E,C,L){var F=g.mode;m=m.child;var re=m.sibling,ye={mode:"hidden",children:E};return(F&1)===0&&g.child!==m?(E=g.child,E.childLanes=0,E.pendingProps=ye,g.deletions=null):(E=So(m,ye),E.subtreeFlags=m.subtreeFlags&14680064),re!==null?C=So(re,C):(C=vc(C,F,L,null),C.flags|=2),C.return=g,E.return=g,E.sibling=C,g.child=E,C}function rf(m,g,E,C){return C!==null&&_p(C),co(g,m.child,null,E),m=aa(g,g.pendingProps.children),m.flags|=2,g.memoizedState=null,m}function Lx(m,g,E){m.lanes|=g;var C=m.alternate;C!==null&&(C.lanes|=g),Xl(m.return,g,E)}function Ia(m,g,E,C,L){var F=m.memoizedState;F===null?m.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:C,tail:E,tailMode:L}:(F.isBackwards=g,F.rendering=null,F.renderingStartTime=0,F.last=C,F.tail=E,F.tailMode=L)}function ac(m,g,E){var C=g.pendingProps,L=C.revealOrder,F=C.tail;if(lr(m,g,C.children,E),C=nr.current,(C&2)!==0)C=C&1|2,g.flags|=128;else{if(m!==null&&(m.flags&128)!==0)e:for(m=g.child;m!==null;){if(m.tag===13)m.memoizedState!==null&&Lx(m,E,g);else if(m.tag===19)Lx(m,E,g);else if(m.child!==null){m.child.return=m,m=m.child;continue}if(m===g)break e;for(;m.sibling===null;){if(m.return===null||m.return===g)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}C&=1}if(Ut(nr,C),(g.mode&1)===0)g.memoizedState=null;else switch(L){case"forwards":for(E=g.child,L=null;E!==null;)m=E.alternate,m!==null&&Sp(m)===null&&(L=E),E=E.sibling;E=L,E===null?(L=g.child,g.child=null):(L=E.sibling,E.sibling=null),Ia(g,!1,L,E,F);break;case"backwards":for(E=null,L=g.child,g.child=null;L!==null;){if(m=L.alternate,m!==null&&Sp(m)===null){g.child=L;break}m=L.sibling,L.sibling=E,E=L,L=m}Ia(g,!0,E,null,F);break;case"together":Ia(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function Ki(m,g,E){if(m!==null&&(g.dependencies=m.dependencies),ka|=g.lanes,(E&g.childLanes)===0)return null;if(m!==null&&g.child!==m.child)throw Error(a(153));if(g.child!==null){for(m=g.child,E=So(m,m.pendingProps),g.child=E,E.return=g;m.sibling!==null;)m=m.sibling,E=E.sibling=So(m,m.pendingProps),E.return=g;E.sibling=null}return g.child}function Fp(m,g,E){switch(g.tag){case 3:ef(g),vu();break;case 5:Rx(g);break;case 1:In(g.type)&&Yo(g);break;case 4:wp(g,g.stateNode.containerInfo);break;case 10:$l(g,g.type._context,g.memoizedProps.value);break;case 13:var C=g.memoizedState;if(C!==null)return C.dehydrated!==null?(Ut(nr,nr.current&1),g.flags|=128,null):(E&g.child.childLanes)!==0?Iv(m,g,E):(Ut(nr,nr.current&1),m=Ki(m,g,E),m!==null?m.sibling:null);Ut(nr,nr.current&1);break;case 19:if(C=(E&g.childLanes)!==0,(m.flags&128)!==0){if(C)return ac(m,g,E);g.flags|=128}var L=g.memoizedState;if(L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),Ut(nr,nr.current),C)break;return null;case 22:case 23:return g.lanes=0,Kr(m,g,E)}return Ki(m,g,E)}function zp(m,g){switch(gv(g),g.tag){case 1:return In(g.type)&&Is(),m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 3:return _u(),Kt(tn),Kt(xn),Ql(),m=g.flags,(m&65536)!==0&&(m&128)===0?(g.flags=m&-65537|128,g):null;case 5:return xv(g),null;case 13:if(Kt(nr),m=g.memoizedState,m!==null&&m.dehydrated!==null){if(g.alternate===null)throw Error(a(340));vu()}return m=g.flags,m&65536?(g.flags=m&-65537|128,g):null;case 19:return Kt(nr),null;case 4:return _u(),null;case 10:return Vd(g.type._context),null;case 22:case 23:return pf(),null;case 24:return null;default:return null}}var Ni=!1,zr=!1,oc=typeof WeakSet=="function"?WeakSet:Set,ut=null;function Fs(m,g){var E=m.ref;if(E!==null)if(typeof E=="function")try{E(null)}catch(C){ki(m,g,C)}else E.current=null}function go(m,g,E){try{E()}catch(C){ki(m,g,C)}}var kv=!1;function Ov(m,g){for(J(m.containerInfo),ut=g;ut!==null;)if(m=ut,g=m.child,(m.subtreeFlags&1028)!==0&&g!==null)g.return=m,ut=g;else for(;ut!==null;){m=ut;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 C=E.memoizedProps,L=E.memoizedState,F=m.stateNode,re=F.getSnapshotBeforeUpdate(m.elementType===m.type?C:$i(m.type,C),L);F.__reactInternalSnapshotBeforeUpdate=re}break;case 3:$e&&at(m.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(ye){ki(m,m.return,ye)}if(g=m.sibling,g!==null){g.return=m.return,ut=g;break}ut=m.return}return E=kv,kv=!1,E}function vo(m,g,E){var C=g.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var L=C=C.next;do{if((L.tag&m)===m){var F=L.destroy;L.destroy=void 0,F!==void 0&&go(g,E,F)}L=L.next}while(L!==C)}}function Yr(m,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var E=g=g.next;do{if((E.tag&m)===m){var C=E.create;E.destroy=C()}E=E.next}while(E!==g)}}function Ii(m){var g=m.ref;if(g!==null){var E=m.stateNode;switch(m.tag){case 5:m=ae(E);break;default:m=E}typeof g=="function"?g(m):g.current=m}}function Kn(m,g,E){if(Ca&&typeof Ca.onCommitFiberUnmount=="function")try{Ca.onCommitFiberUnmount(Fd,g)}catch{}switch(g.tag){case 0:case 11:case 14:case 15:if(m=g.updateQueue,m!==null&&(m=m.lastEffect,m!==null)){var C=m=m.next;do{var L=C,F=L.destroy;L=L.tag,F!==void 0&&((L&2)!==0||(L&4)!==0)&&go(g,E,F),C=C.next}while(C!==m)}break;case 1:if(Fs(g,E),m=g.stateNode,typeof m.componentWillUnmount=="function")try{m.props=g.memoizedProps,m.state=g.memoizedState,m.componentWillUnmount()}catch(re){ki(g,E,re)}break;case 5:Fs(g,E);break;case 4:$e?Uv(m,g,E):de&&de&&(g=g.stateNode.containerInfo,E=Jt(g),en(g,E))}}function zs(m,g,E){for(var C=g;;)if(Kn(m,C,E),C.child===null||$e&&C.tag===4){if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return}C.sibling.return=C.return,C=C.sibling}else C.child.return=C,C=C.child}function Lv(m){var g=m.alternate;g!==null&&(m.alternate=null,Lv(g)),m.child=null,m.deletions=null,m.sibling=null,m.tag===5&&(g=m.stateNode,g!==null&&Ce(g)),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 g=m.return;g!==null;){if(Dv(g))break e;g=g.return}throw Error(a(160))}var E=g;switch(E.tag){case 5:g=E.stateNode,E.flags&32&&(qe(g),E.flags&=-33),E=Bp(m),Pu(m,E,g);break;case 3:case 4:g=E.stateNode.containerInfo,E=Bp(m),Vp(m,E,g);break;default:throw Error(a(161))}}}function Vp(m,g,E){var C=m.tag;if(C===5||C===6)m=m.stateNode,g?vt(E,m,g):Xt(E,m);else if(C!==4&&(m=m.child,m!==null))for(Vp(m,g,E),m=m.sibling;m!==null;)Vp(m,g,E),m=m.sibling}function Pu(m,g,E){var C=m.tag;if(C===5||C===6)m=m.stateNode,g?Mt(E,m,g):ht(E,m);else if(C!==4&&(m=m.child,m!==null))for(Pu(m,g,E),m=m.sibling;m!==null;)Pu(m,g,E),m=m.sibling}function Uv(m,g,E){for(var C=g,L=!1,F,re;;){if(!L){L=C.return;e:for(;;){if(L===null)throw Error(a(160));switch(F=L.stateNode,L.tag){case 5:re=!1;break e;case 3:F=F.containerInfo,re=!0;break e;case 4:F=F.containerInfo,re=!0;break e}L=L.return}L=!0}if(C.tag===5||C.tag===6)zs(m,C,E),re?fe(F,C.stateNode):Zt(F,C.stateNode);else if(C.tag===18)re?Ie(F,C.stateNode):Te(F,C.stateNode);else if(C.tag===4){if(C.child!==null){F=C.stateNode.containerInfo,re=!0,C.child.return=C,C=C.child;continue}}else if(Kn(m,C,E),C.child!==null){C.child.return=C,C=C.child;continue}if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return,C.tag===4&&(L=!1)}C.sibling.return=C.return,C=C.sibling}}function al(m,g){if($e){switch(g.tag){case 0:case 11:case 14:case 15:vo(3,g,g.return),Yr(3,g),vo(5,g,g.return);return;case 1:return;case 5:var E=g.stateNode;if(E!=null){var C=g.memoizedProps;m=m!==null?m.memoizedProps:C;var L=g.type,F=g.updateQueue;g.updateQueue=null,F!==null&&tt(E,F,L,m,C,g)}return;case 6:if(g.stateNode===null)throw Error(a(162));E=g.memoizedProps,Ke(g.stateNode,m!==null?m.memoizedProps:E,E);return;case 3:Z&&m!==null&&m.memoizedState.isDehydrated&&K(g.stateNode.containerInfo);return;case 12:return;case 13:Cu(g);return;case 19:Cu(g);return;case 17:return}throw Error(a(163))}switch(g.tag){case 0:case 11:case 14:case 15:vo(3,g,g.return),Yr(3,g),vo(5,g,g.return);return;case 12:return;case 13:Cu(g);return;case 19:Cu(g);return;case 3:Z&&m!==null&&m.memoizedState.isDehydrated&&K(g.stateNode.containerInfo);break;case 22:case 23:return}e:if(de){switch(g.tag){case 1:case 5:case 6:break e;case 3:case 4:g=g.stateNode,en(g.containerInfo,g.pendingChildren);break e}throw Error(a(163))}}function Cu(m){var g=m.updateQueue;if(g!==null){m.updateQueue=null;var E=m.stateNode;E===null&&(E=m.stateNode=new oc),g.forEach(function(C){var L=zx.bind(null,m,C);E.has(C)||(E.add(C),C.then(L,L))})}}function AM(m,g){for(ut=g;ut!==null;){g=ut;var E=g.deletions;if(E!==null)for(var C=0;C";case cc:return":has("+(ol(m)||"")+")";case uc:return'[role="'+m.value+'"]';case Ru:return'"'+m.value+'"';case yo:return'[data-testname="'+m.value+'"]';default:throw Error(a(365))}}function ps(m,g){var E=[];m=[m,0];for(var C=0;CL&&(L=re),C&=~F}if(C=L,C=Nr()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*zv(C/1960))-C,10m?16:m,Oa===null)var C=!1;else{if(m=Oa,Oa=null,mc=0,(on&6)!==0)throw Error(a(331));var L=on;for(on|=4,ut=m.current;ut!==null;){var F=ut,re=F.child;if((ut.flags&16)!==0){var ye=F.deletions;if(ye!==null){for(var je=0;jeNr()-df?wo(m,0):hc|=E),Yi(m,g)}function Xv(m,g){g===0&&((m.mode&1)===0?g=1:(g=Pn,Pn<<=1,(Pn&130023424)===0&&(Pn=4194304)));var E=Cn();m=cl(m,g),m!==null&&(Hl(m,g,E),Yi(m,E))}function Fx(m){var g=m.memoizedState,E=0;g!==null&&(E=g.retryLane),Xv(m,E)}function zx(m,g){var E=0;switch(m.tag){case 13:var C=m.stateNode,L=m.memoizedState;L!==null&&(E=L.retryLane);break;case 19:C=m.stateNode;break;default:throw Error(a(314))}C!==null&&C.delete(g),Xv(m,E)}var qv;qv=function(m,g,E){if(m!==null)if(m.memoizedProps!==g.pendingProps||tn.current)Fr=!0;else{if((m.lanes&E)===0&&(g.flags&128)===0)return Fr=!1,Fp(m,g,E);Fr=(m.flags&131072)!==0}else Fr=!1,Qn&&(g.flags&1048576)!==0&&Ax(g,xp,g.index);switch(g.lanes=0,g.tag){case 2:var C=g.type;m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),m=g.pendingProps;var L=li(g,xn.current);hu(g,E),L=wu(null,g,C,m,L,E);var F=rl();return g.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,In(C)?(F=!0,Yo(g)):F=!1,g.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,pu(g),L.updater=vp,g.stateNode=L,L._reactInternals=g,pv(g,C,m,E),g=ui(null,g,C,!0,F,E)):(g.tag=0,Qn&&F&&mv(g),lr(null,g,L,E),g=g.child),g;case 16:C=g.elementType;e:{switch(m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),m=g.pendingProps,L=C._init,C=L(C._payload),g.type=C,L=g.tag=TM(C),m=$i(C,m),L){case 0:g=mo(null,g,C,m,E);break e;case 1:g=ic(null,g,C,m,E);break e;case 11:g=$n(null,g,C,m,E);break e;case 14:g=Gn(null,g,C,$i(C.type,m),E);break e}throw Error(a(306,C,""))}return g;case 0:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),mo(m,g,C,L,E);case 1:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),ic(m,g,C,L,E);case 3:e:{if(ef(g),m===null)throw Error(a(387));C=g.pendingProps,F=g.memoizedState,L=F.element,dv(m,g),gp(g,C,null,E);var re=g.memoizedState;if(C=re.element,Z&&F.isDehydrated)if(F={element:C,isDehydrated:!1,cache:re.cache,transitions:re.transitions},g.updateQueue.baseState=F,g.memoizedState=F,g.flags&256){L=Error(a(423)),g=Nv(m,g,C,E,L);break e}else if(C!==L){L=Error(a(424)),g=Nv(m,g,C,E,L);break e}else for(Z&&(qr=ro(g.stateNode.containerInfo),Ci=g,Qn=!0,js=null,gu=!1),E=Cx(g,null,C,E),g.child=E;E;)E.flags=E.flags&-3|4096,E=E.sibling;else{if(vu(),C===L){g=Ki(m,g,E);break e}lr(m,g,C,E)}g=g.child}return g;case 5:return Rx(g),m===null&&tl(g),C=g.type,L=g.pendingProps,F=m!==null?m.memoizedProps:null,re=L.children,ce(C,L)?re=null:F!==null&&ce(C,F)&&(g.flags|=32),Ri(m,g),lr(m,g,re,E),g.child;case 6:return m===null&&tl(g),null;case 13:return Iv(m,g,E);case 4:return wp(g,g.stateNode.containerInfo),C=g.pendingProps,m===null?g.child=co(g,null,C,E):lr(m,g,C,E),g.child;case 11:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),$n(m,g,C,L,E);case 7:return lr(m,g,g.pendingProps,E),g.child;case 8:return lr(m,g,g.pendingProps.children,E),g.child;case 12:return lr(m,g,g.pendingProps.children,E),g.child;case 10:e:{if(C=g.type._context,L=g.pendingProps,F=g.memoizedProps,re=L.value,$l(g,C,re),F!==null)if(Ti(F.value,re)){if(F.children===L.children&&!tn.current){g=Ki(m,g,E);break e}}else for(F=g.child,F!==null&&(F.return=g);F!==null;){var ye=F.dependencies;if(ye!==null){re=F.child;for(var je=ye.firstContext;je!==null;){if(je.context===C){if(F.tag===1){je=ao(-1,E&-E),je.tag=2;var st=F.updateQueue;if(st!==null){st=st.shared;var St=st.pending;St===null?je.next=je:(je.next=St.next,St.next=je),st.pending=je}}F.lanes|=E,je=F.alternate,je!==null&&(je.lanes|=E),Xl(F.return,E,g),ye.lanes|=E;break}je=je.next}}else if(F.tag===10)re=F.type===g.type?null:F.child;else if(F.tag===18){if(re=F.return,re===null)throw Error(a(341));re.lanes|=E,ye=re.alternate,ye!==null&&(ye.lanes|=E),Xl(re,E,g),re=F.sibling}else re=F.child;if(re!==null)re.return=F;else for(re=F;re!==null;){if(re===g){re=null;break}if(F=re.sibling,F!==null){F.return=re.return,re=F;break}re=re.return}F=re}lr(m,g,L.children,E),g=g.child}return g;case 9:return L=g.type,C=g.pendingProps.children,hu(g,E),L=Xi(L),C=C(L),g.flags|=1,lr(m,g,C,E),g.child;case 14:return C=g.type,L=$i(C,g.pendingProps),L=$i(C.type,L),Gn(m,g,C,L,E);case 15:return po(m,g,g.type,g.pendingProps,E);case 17:return C=g.type,L=g.pendingProps,L=g.elementType===C?L:$i(C,L),m!==null&&(m.alternate=null,g.alternate=null,g.flags|=2),g.tag=1,In(C)?(m=!0,Yo(g)):m=!1,hu(g,E),Mx(g,C,L),pv(g,C,L,E),ui(null,g,C,!0,m,E);case 19:return ac(m,g,E);case 22:return Kr(m,g,E)}throw Error(a(156,g.tag))};function Wp(m,g){return Vl(m,g)}function Bx(m,g,E,C){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=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(m,g,E,C){return new Bx(m,g,E,C)}function $p(m){return m=m.prototype,!(!m||!m.isReactComponent)}function TM(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 So(m,g){var E=m.alternate;return E===null?(E=vs(m.tag,g,m.key,m.mode),E.elementType=m.elementType,E.type=m.type,E.stateNode=m.stateNode,E.alternate=m,m.alternate=E):(E.pendingProps=g,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,g=m.dependencies,E.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},E.sibling=m.sibling,E.index=m.index,E.ref=m.ref,E}function Xp(m,g,E,C,L,F){var re=2;if(C=m,typeof m=="function")$p(m)&&(re=1);else if(typeof m=="string")re=5;else e:switch(m){case d:return vc(E.children,L,F,g);case f:re=8,L|=8;break;case p:return m=vs(12,E,g,L|2),m.elementType=p,m.lanes=F,m;case w:return m=vs(13,E,g,L),m.elementType=w,m.lanes=F,m;case x:return m=vs(19,E,g,L),m.elementType=x,m.lanes=F,m;case P:return vf(E,L,F,g);default:if(typeof m=="object"&&m!==null)switch(m.$$typeof){case y:re=10;break e;case b:re=9;break e;case S:re=11;break e;case M:re=14;break e;case T:re=16,C=null;break e}throw Error(a(130,m==null?m:typeof m,""))}return g=vs(re,E,g,L),g.elementType=m,g.type=C,g.lanes=F,g}function vc(m,g,E,C){return m=vs(7,m,C,g),m.lanes=E,m}function vf(m,g,E,C){return m=vs(22,m,C,g),m.elementType=P,m.lanes=E,m.stateNode={},m}function qp(m,g,E){return m=vs(6,m,null,g),m.lanes=E,m}function Kp(m,g,E){return g=vs(4,m.children!==null?m.children:[],m.key,g),g.lanes=E,g.stateNode={containerInfo:m.containerInfo,pendingChildren:null,implementation:m.implementation},g}function Yp(m,g,E,C,L){this.tag=g,this.containerInfo=m,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ee,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ap(0),this.expirationTimes=ap(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ap(0),this.identifierPrefix=C,this.onRecoverableError=L,Z&&(this.mutableSourceEagerHydrationData=null)}function Hx(m,g,E,C,L,F,re,ye,je){return m=new Yp(m,g,E,ye,je),g===1?(g=1,F===!0&&(g|=8)):g=0,F=vs(3,null,null,g),m.current=F,F.stateNode=m,F.memoizedState={element:C,isDehydrated:E,cache:null,transitions:null},pu(F),m}function Vx(m){if(!m)return mt;m=m._reactInternals;e:{if(V(m)!==m||m.tag!==1)throw Error(a(170));var g=m;do{switch(g.tag){case 3:g=g.stateNode.context;break e;case 1:if(In(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break e}}g=g.return}while(g!==null);throw Error(a(171))}if(m.tag===1){var E=m.type;if(In(E))return ta(m,E,g)}return g}function Gx(m){var g=m._reactInternals;if(g===void 0)throw typeof m.render=="function"?Error(a(188)):(m=Object.keys(m).join(","),Error(a(268,m)));return m=X(g),m===null?null:m.stateNode}function Bs(m,g){if(m=m.memoizedState,m!==null&&m.dehydrated!==null){var E=m.retryLane;m.retryLane=E!==0&&E=st&&F>=rn&&L<=St&&re<=zt){m.splice(g,1);break}else if(C!==st||E.width!==je.width||ztre){if(!(F!==rn||E.height!==je.height||StL)){st>C&&(je.width+=st-C,je.x=C),StF&&(je.height+=rn-F,je.y=F),ztE&&(E=re)),re ")+` No matching component was found for: - `)+m.join(" > ")}return null},n.getPublicRootInstance=function(m){if(m=m.current,!m.child)return null;switch(m.child.tag){case 5:return ae(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:o.ReactCurrentDispatcher,findHostInstanceByFiber:Zp,findFiberByHostInstance:m.findFiberByHostInstance||Wx,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 g=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g.isDisabled||!g.supportsFiber)m=!0;else{try{Fd=g.inject(m),Ca=g}catch{}m=!!g.checkDCE}}return m},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(m,g,E,C){if(!Q)throw Error(a(363));m=xo(m,g);var L=rt(m,E,C).disconnect;return{disconnect:function(){L()}}},n.registerMutableSourceForHydration=function(m,g){var E=g._getVersion;E=E(g._source),m.mutableSourceEagerHydrationData==null?m.mutableSourceEagerHydrationData=[g,E]:m.mutableSourceEagerHydrationData.push(g,E)},n.runWithPriority=function(m,g){var E=un;try{return un=m,g()}finally{un=E}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(m,g,E,C){var L=g.current,F=Cn(),re=ca(L);return E=Vx(E),g.context===null?g.context=E:g.pendingContext=E,g=ao(F,re),g.payload={element:m},C=C===void 0?null:C,C!==null&&(g.callback=C),Jo(L,g),m=fi(L,re,F),m!==null&&pp(m,L,re),re},n}),HA}var AU;function Sbe(){return AU||(AU=1,FA.exports=wbe()),FA.exports}var Mbe=Sbe();const Ebe=V1(Mbe);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 ae(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:o.ReactCurrentDispatcher,findHostInstanceByFiber:Zp,findFiberByHostInstance:m.findFiberByHostInstance||Wx,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 g=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g.isDisabled||!g.supportsFiber)m=!0;else{try{Fd=g.inject(m),Ca=g}catch{}m=!!g.checkDCE}}return m},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(m,g,E,C){if(!Q)throw Error(a(363));m=xo(m,g);var L=rt(m,E,C).disconnect;return{disconnect:function(){L()}}},n.registerMutableSourceForHydration=function(m,g){var E=g._getVersion;E=E(g._source),m.mutableSourceEagerHydrationData==null?m.mutableSourceEagerHydrationData=[g,E]:m.mutableSourceEagerHydrationData.push(g,E)},n.runWithPriority=function(m,g){var E=un;try{return un=m,g()}finally{un=E}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(m,g,E,C){var L=g.current,F=Cn(),re=ca(L);return E=Vx(E),g.context===null?g.context=E:g.pendingContext=E,g=ao(F,re),g.payload={element:m},C=C===void 0?null:C,C!==null&&(g.callback=C),Jo(L,g),m=fi(L,re,F),m!==null&&pp(m,L,re),re},n}),HA}var AU;function Mbe(){return AU||(AU=1,FA.exports=Sbe()),FA.exports}var Ebe=Mbe();const Abe=V1(Ebe);var VA={exports:{}},GA={};/** * @license React * scheduler.production.min.js * @@ -4483,14 +4488,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 TU;function Abe(){return TU||(TU=1,(function(t){function e(B,J){var Y=B.length;B.push(J);e:for(;0>>1,G=B[H];if(0>>1;Hi(ce,Y))Sei(we,ce)?(B[H]=we,B[Se]=Y,H=Se):(B[H]=ce,B[se]=Y,H=se);else if(Sei(we,Y))B[H]=we,B[Se]=Y,H=Se;else break e}}return J}function i(B,J){var Y=B.sortIndex-J.sortIndex;return Y!==0?Y:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,f=null,p=3,y=!1,b=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,x=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 J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=B)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function P(B){if(S=!1,T(B),!b)if(n(l)!==null)b=!0,ae(O);else{var J=n(c);J!==null&&he(P,J.startTime-B)}}function O(B,J){b=!1,S&&(S=!1,x(z),z=-1),y=!0;var Y=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!j());){var H=f.callback;if(typeof H=="function"){f.callback=null,p=f.priorityLevel;var G=H(f.expirationTime<=J);J=t.unstable_now(),typeof G=="function"?f.callback=G:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var le=!0;else{var se=n(c);se!==null&&he(P,se.startTime-J),le=!1}return le}finally{f=null,p=Y,y=!1}}var N=!1,D=null,z=-1,V=5,k=-1;function j(){return!(t.unstable_now()-kB||125H?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(x(z),z=-1):S=!0,he(P,Y-H))):(B.sortIndex=G,e(l,B),b||y||(b=!0,ae(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var J=p;return function(){var Y=p;p=J;try{return B.apply(this,arguments)}finally{p=Y}}}})(GA)),GA}var PU;function Tbe(){return PU||(PU=1,VA.exports=Abe()),VA.exports}var CU=Tbe();const rN={},Pbe=t=>void Object.assign(rN,t);function Cbe(t,e){function n(d,{args:f=[],attach:p,...y},b){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 x=y.object;w=Fm(x,{type:d,root:b,attach:p,primitive:!0})}else{const x=rN[S];if(!x)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=Fm(new x(...f),{type:d,root:b,attach:p,memoizedProps:{args:f}})}return w.__r3f.attach===void 0&&(w.isBufferGeometry?w.__r3f.attach="geometry":w.isMaterial&&(w.__r3f.attach="material")),S!=="inject"&&XA(w,y),w}function r(d,f){let p=!1;if(f){var y,b;(y=f.__r3f)!=null&&y.attach?$A(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),p=!0),p||(b=d.__r3f)==null||b.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,sC(f),zm(f)}}function i(d,f,p){let y=!1;if(f){var b,S;if((b=f.__r3f)!=null&&b.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 w=d.children.filter(M=>M!==f),x=w.indexOf(p);d.children=[...w.slice(0,x),f,...w.slice(x)],y=!0}y||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,sC(f),zm(f)}}function s(d,f,p=!1){d&&[...d].forEach(y=>a(f,y,p))}function a(d,f,p){if(f){var y,b,S;if(f.__r3f&&(f.__r3f.parent=null),(y=d.__r3f)!=null&&y.objects&&(d.__r3f.objects=d.__r3f.objects.filter(P=>P!==f)),(b=f.__r3f)!=null&&b.attach)OU(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var w;d.remove(f),(w=f.__r3f)!=null&&w.root&&Dbe(Y_(f),f)}const M=(S=f.__r3f)==null?void 0:S.primitive,T=!M&&(p===void 0?f.dispose!==null:p);if(!M){var x;s((x=f.__r3f)==null?void 0:x.objects,f,T),s(f.children,f,T)}if(delete f.__r3f,T&&f.dispose&&f.type!=="Scene"){const P=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?CU.unstable_scheduleCallback(CU.unstable_IdlePriority,P):P()}zm(d)}}function o(d,f,p,y){var b;const S=(b=d.__r3f)==null?void 0:b.parent;if(!S)return;const w=n(f,p,d.__r3f.root);if(d.children){for(const x of d.children)x.__r3f&&r(w,x);d.children=d.children.filter(x=>!x.__r3f)}d.__r3f.objects.forEach(x=>r(w,x)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||a(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(x=>{x!==null&&(x.stateNode=w,x.ref&&(typeof x.ref=="function"?x.ref(w):x.ref.current=w))})}const l=()=>{};return{reconciler:Ebe({createInstance:n,removeChild:a,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const p=d.getState().scene;p.__r3f&&(p.__r3f.root=d,r(p,f))},removeChildFromContainer:(d,f)=>{f&&a(d.getState().scene,f)},insertInContainerBefore:(d,f,p)=>{if(!f||!p)return;const y=d.getState().scene;y.__r3f&&i(y,f,p)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,p,y){var b;if(((b=d==null?void 0:d.__r3f)!=null?b:{}).primitive&&y.object&&y.object!==d)return[!0];{const{args:w=[],children:x,...M}=y,{args:T=[],children:P,...O}=p;if(!Array.isArray(w))throw new Error("R3F: the args prop must be an array!");if(w.some((D,z)=>D!==T[z]))return[!0];const N=bG(d,M,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,p],y,b,S,w){f?o(d,y,S,w):XA(d,p)},commitMount(d,f,p,y){var b;const S=(b=d.__r3f)!=null?b:{};d.raycast&&S.handlers&&S.eventCount&&Y_(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Fm(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:p,parent:y}=(f=d.__r3f)!=null?f:{};p&&y&&OU(y,d,p),d.isObject3D&&(d.visible=!1),zm(d)},unhideInstance(d,f){var p;const{attach:y,parent:b}=(p=d.__r3f)!=null?p:{};y&&b&&$A(b,d,y),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),zm(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Km.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&sr.fun(performance.now)?performance.now:sr.fun(Date.now)?Date.now:()=>0,scheduleTimeout:sr.fun(setTimeout)?setTimeout:void 0,cancelTimeout:sr.fun(clearTimeout)?clearTimeout:void 0}),applyProps:XA}}var RU,NU;const WA=t=>"colorSpace"in t||"outputColorSpace"in t,pG=()=>{var t;return(t=rN.ColorManagement)!=null?t:null},mG=t=>t&&t.isOrthographicCamera,Rbe=t=>t&&t.hasOwnProperty("current"),xx=typeof window<"u"&&((RU=window.document)!=null&&RU.createElement||((NU=window.navigator)==null?void 0:NU.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function gG(t){const e=R.useRef(t);return xx(()=>void(e.current=t),[t]),e}function Nbe({set:t}){return xx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class vG 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}}vG.getDerivedStateFromError=()=>({error:!0});const yG="__default",IU=new Map,Ibe=t=>t&&!!t.memoized&&!!t.changes;function xG(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 sr={obj:t=>t===Object(t)&&!sr.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(sr.str(t)||sr.num(t)||sr.boo(t))return t===e;const s=sr.obj(t);if(s&&r==="reference")return t===e;const a=sr.arr(t);if(a&&n==="reference")return t===e;if((a||s)&&t===e)return!0;let o;for(o in t)if(!(o in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(o in i?e:t)if(!sr.equ(t[o],e[o],{strict:i,objects:"reference"}))return!1}else for(o in i?e:t)if(t[o]!==e[o])return!1;if(sr.und(o)){if(a&&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 kbe(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function Fm(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function iC(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((s,a)=>s[a],t),{target:n,key:i}}else return{target:n,key:e}}const kU=/-\d+$/;function $A(t,e,n){if(sr.str(n)){if(kU.test(n)){const s=n.replace(kU,""),{target:a,key:o}=iC(t,s);Array.isArray(a[o])||(a[o]=[])}const{target:r,key:i}=iC(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function OU(t,e,n){var r,i;if(sr.str(n)){const{target:s,key:a}=iC(t,n),o=e.__r3f.previousAttach;o===void 0?delete s[a]:s[a]=o}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function bG(t,{children:e,key:n,ref:r,...i},{children:s,key:a,ref:o,...l}={},c=!1){const d=t.__r3f,f=Object.entries(i),p=[];if(c){const b=Object.keys(l);for(let S=0;S{var w;if((w=t.__r3f)!=null&&w.primitive&&b==="object"||sr.equ(S,l[b]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(b))return p.push([b,S,!0,[]]);let x=[];b.includes("-")&&(x=b.split("-")),p.push([b,S,!1,x]);for(const M in i){const T=i[M];M.startsWith(`${b}-`)&&p.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:p}}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:a,changes:o}=Ibe(e)?e:bG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=a);for(let p=0;pT[P],t),!(M&&M.set))){const[T,...P]=w.reverse();x=P.reverse().reduce((O,N)=>O[N],t),y=T}if(b===yG+"remove")if(x.constructor){let T=IU.get(x.constructor);T||(T=new x.constructor,IU.set(x.constructor,T)),b=T[y]}else b=0;if(S&&r)b?r.handlers[y]=b:delete r.handlers[y],r.eventCount=Object.keys(r.handlers).length;else if(M&&M.set&&(M.copy||M instanceof Ch)){if(Array.isArray(b))M.fromArray?M.fromArray(b):M.set(...b);else if(M.copy&&b&&b.constructor&&M.constructor===b.constructor)M.copy(b);else if(b!==void 0){var c;const T=(c=M)==null?void 0:c.isColor;!T&&M.setScalar?M.setScalar(b):M instanceof Ch&&b instanceof Ch?M.mask=b.mask:M.set(b),!pG()&&s&&!s.linear&&T&&M.convertSRGBToLinear()}}else{var d;if(x[y]=b,(d=x[y])!=null&&d.isTexture&&x[y].format===ss&&x[y].type===Ho&&s){const T=x[y];WA(T)&&WA(s.gl)?T.colorSpace=s.gl.outputColorSpace:T.encoding=s.gl.outputEncoding}}zm(t)}if(r&&r.parent&&t.raycast&&l!==r.eventCount){const p=Y_(t).getState().internal,y=p.interaction.indexOf(t);y>-1&&p.interaction.splice(y,1),r.eventCount&&p.interaction.push(t)}return!(o.length===1&&o[0][0]==="onUpdate")&&o.length&&(n=t.__r3f)!=null&&n.parent&&sC(t),t}function zm(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 sC(t){t.onUpdate==null||t.onUpdate(t)}function Obe(t,e){t.manual||(mG(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 Lbe(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Km.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Km.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Km.ContinuousEventPriority;default:return Km.DefaultEventPriority}}function _G(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function Dbe(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)=>{_G(n.capturedMap,e,r,i)})}function Ube(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,p=[],y=c?c(d.internal.interaction):d.internal.interaction;for(let x=0;x{const T=R0(x.object),P=R0(M.object);return!T||!P?x.distance-M.distance:P.events.priority-T.events.priority||x.distance-M.distance}).filter(x=>{const M=N_(x);return f.has(M)?!1:(f.add(M),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const x of S){let M=x.object;for(;M;){var w;(w=M.__r3f)!=null&&w.eventCount&&p.push({...x,eventObject:M}),M=M.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let x of d.internal.capturedMap.get(l.pointerId).values())f.has(N_(x.intersection))||p.push(x.intersection);return p}function i(l,c,d,f){const p=t.getState();if(l.length){const y={stopped:!1};for(const b of l){const S=R0(b.object)||p,{raycaster:w,pointer:x,camera:M,internal:T}=S,P=new q(x.x,x.y,0).unproject(M),O=k=>{var j,X;return(j=(X=T.capturedMap.get(k))==null?void 0:X.has(b.eventObject))!=null?j:!1},N=k=>{const j={intersection:b,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(b.eventObject,j):T.capturedMap.set(k,new Map([[b.eventObject,j]])),c.target.setPointerCapture(k)},D=k=>{const j=T.capturedMap.get(k);j&&_G(T.capturedMap,b.eventObject,j,k)};let z={};for(let k in c){let j=c[k];typeof j!="function"&&(z[k]=j)}let V={...b,...z,pointer:x,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:P,ray:w.ray,camera:M,stopPropagation(){const k="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!k||k.has(b.eventObject))&&(V.stopped=y.stopped=!0,T.hovered.size&&Array.from(T.hovered.values()).find(j=>j.eventObject===b.eventObject))){const j=l.slice(0,l.indexOf(b));s([...j,b])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},currentTarget:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},nativeEvent:c};if(f(V),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 p=d.eventObject.__r3f,y=p==null?void 0:p.handlers;if(c.hovered.delete(N_(d)),p!=null&&p.eventCount){const b={...d,intersections:l};y.onPointerOut==null||y.onPointerOut(b),y.onPointerLeave==null||y.onPointerLeave(b)}}}function a(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:p}=t.getState();p.lastEvent.current=d;const y=l==="onPointerMove",b=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",w=r(d,y?n:void 0),x=b?e(d):0;l==="onPointerDown"&&(p.initialClick=[d.offsetX,d.offsetY],p.initialHits=w.map(T=>T.eventObject)),b&&!w.length&&x<=2&&(a(d,p.interaction),f&&f(d)),y&&s(w);function M(T){const P=T.eventObject,O=P.__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 D=N_(T),z=p.hovered.get(D);z?z.stopped&&T.stopPropagation():(p.hovered.set(D,T),N.onPointerOver==null||N.onPointerOver(T),N.onPointerEnter==null||N.onPointerEnter(T))}N.onPointerMove==null||N.onPointerMove(T)}else{const D=N[l];D?(!b||p.initialHits.includes(P))&&(a(d,p.interaction.filter(z=>!p.initialHits.includes(z))),D(T)):b&&p.initialHits.includes(P)&&a(d,p.interaction.filter(z=>!p.initialHits.includes(z)))}}i(w,d,x,M)}}return{handlePointer:o}}const wG=t=>!!(t!=null&&t.render),SG=R.createContext(null),jbe=(t,e)=>{const n=xbe((o,l)=>{const c=new q,d=new q,f=new q;function p(x=l().camera,M=d,T=l().size){const{width:P,height:O,top:N,left:D}=T,z=P/O;M.isVector3?f.copy(M):f.set(...M);const V=x.getWorldPosition(c).distanceTo(f);if(mG(x))return{width:P/x.zoom,height:O/x.zoom,top:N,left:D,factor:1,distance:V,aspect:z};{const k=x.fov*Math.PI/180,j=2*Math.tan(k/2)*V,X=j*(P/O);return{width:X,height:j,top:N,left:D,factor:P/X,distance:V,aspect:z}}}let y;const b=x=>o(M=>({performance:{...M.performance,current:x}})),S=new He;return{set:o,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(x=1)=>t(l(),x),advance:(x,M)=>e(x,M,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new QR,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const x=l();y&&clearTimeout(y),x.performance.current!==x.performance.min&&b(x.performance.min),y=setTimeout(()=>b(l().performance.max),x.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:p},setEvents:x=>o(M=>({...M,events:{...M.events,...x}})),setSize:(x,M,T,P,O)=>{const N=l().camera,D={width:x,height:M,top:P||0,left:O||0,updateStyle:T};o(z=>({size:D,viewport:{...z.viewport,...p(N,d,D)}}))},setDpr:x=>o(M=>{const T=xG(x);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(x="always")=>{const M=l().clock;M.stop(),M.elapsedTime=0,x!=="never"&&(M.start(),M.elapsedTime=0),o(()=>({frameloop:x}))},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:(x,M,T)=>{const P=l().internal;return P.priority=P.priority+(M>0?1:0),P.subscribers.push({ref:x,priority:M,store:T}),P.subscribers=P.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!==x))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,a=r.camera;return n.subscribe(()=>{const{camera:o,size:l,viewport:c,gl:d,set:f}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){var p;i=l,s=c.dpr,Obe(o,l),d.setPixelRatio(c.dpr);const y=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,y)}o!==a&&(a=o,f(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(o)}})))}),n.subscribe(o=>t(o)),n};let I_,Fbe=new Set,zbe=new Set,Bbe=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(Fbe,e);case"after":return qA(zbe,e);case"tail":return qA(Bbe,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,I_=0;I_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 o(c,d=1){var f;if(!c)return t.forEach(p=>o(p.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(a)))}function l(c,d=!0,f,p){if(d&&N0("before",c),f)ZA(c,f,p);else for(const y of t.values())ZA(c,y.store.getState());d&&N0("after",c)}return{loop:a,invalidate:o,advance:l}}function MG(){const t=R.useContext(SG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function ed(t=n=>n,e){return MG()(t,e)}function EG(t,e=0){const n=MG(),r=n.getState().internal.subscribe,i=gG(t);return xx(()=>r(i,e,n),[e,r,n]),null}const zg=new Map,{invalidate:LU,advance:DU}=Hbe(zg),{reconciler:j1,applyProps:Nm}=Cbe(zg,Lbe),Im={objects:"shallow",strict:!1},Vbe=(t,e)=>{const n=typeof t=="function"?t(e):t;return wG(n)?n:new M6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Gbe(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:a,updateStyle:o=n}=e;return{width:r,height:i,top:s,left:a,updateStyle:o}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:s,left:a}=t.parentElement.getBoundingClientRect();return{width:r,height:i,top:s,left:a,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 Wbe(t){const e=zg.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||jbe(LU,DU),a=n||j1.createContainer(s,Km.ConcurrentRoot,null,!1,null,"",i,null);e||zg.set(t,{fiber:a,store:s});let o,l=!1,c;return{configure(d={}){let{gl:f,size:p,scene:y,events:b,onCreated:S,shadows:w=!1,linear:x=!1,flat:M=!1,legacy:T=!1,orthographic:P=!1,frameloop:O="always",dpr:N=[1,2],performance:D,raycaster:z,camera:V,onPointerMissed:k}=d,j=s.getState(),X=j.gl;j.gl||j.set({gl:X=Vbe(f,t)});let ee=j.raycaster;ee||j.set({raycaster:ee=new dG});const{params:ie,...pe}=z||{};if(sr.equ(pe,ee,Im)||Nm(ee,{...pe}),sr.equ(ie,ee.params,Im)||Nm(ee,{params:{...ee.params,...ie}}),!j.camera||j.camera===c&&!sr.equ(c,V,Im)){c=V;const Y=V instanceof fx,H=Y?V:P?new Gc(0,0,0,0,.1,1e3):new Pr(75,0,.1,1e3);Y||(H.position.z=5,V&&(Nm(H,V),("aspect"in V||"left"in V||"right"in V||"bottom"in V||"top"in V)&&(H.manual=!0,H.updateProjectionMatrix())),!j.camera&&!(V!=null&&V.rotation)&&H.lookAt(0,0,0)),j.set({camera:H}),ee.camera=H}if(!j.scene){let Y;y!=null&&y.isScene?Y=y:(Y=new IR,y&&Nm(Y,y)),j.set({scene:Fm(Y)})}if(!j.xr){var ae;const Y=(le,se)=>{const ce=s.getState();ce.frameloop!=="never"&&DU(le,!0,ce,se)},H=()=>{const le=s.getState();le.gl.xr.enabled=le.gl.xr.isPresenting,le.gl.xr.setAnimationLoop(le.gl.xr.isPresenting?Y:null),le.gl.xr.isPresenting||LU(le)},G={connect(){const le=s.getState().gl;le.xr.addEventListener("sessionstart",H),le.xr.addEventListener("sessionend",H)},disconnect(){const le=s.getState().gl;le.xr.removeEventListener("sessionstart",H),le.xr.removeEventListener("sessionend",H)}};typeof((ae=X.xr)==null?void 0:ae.addEventListener)=="function"&&G.connect(),j.set({xr:G})}if(X.shadowMap){const Y=X.shadowMap.enabled,H=X.shadowMap.type;if(X.shadowMap.enabled=!!w,sr.boo(w))X.shadowMap.type=Y0;else if(sr.str(w)){var he;const G={basic:bV,percentage:BS,soft:Y0,variance:Oo};X.shadowMap.type=(he=G[w])!=null?he:Y0}else sr.obj(w)&&Object.assign(X.shadowMap,w);(Y!==X.shadowMap.enabled||H!==X.shadowMap.type)&&(X.shadowMap.needsUpdate=!0)}const B=pG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Nm(X,{outputEncoding:x?3e3:3001,toneMapping:M?Tl:uR}),j.legacy!==T&&j.set(()=>({legacy:T})),j.linear!==x&&j.set(()=>({linear:x})),j.flat!==M&&j.set(()=>({flat:M})),f&&!sr.fun(f)&&!wG(f)&&!sr.equ(f,X,Im)&&Nm(X,f),b&&!j.events.handlers&&j.set({events:b(s)});const J=Gbe(t,p);return sr.equ(J,j.size,Im)||j.setSize(J.width,J.height,J.updateStyle,J.top,J.left),N&&j.viewport.dpr!==xG(N)&&j.setDpr(N),j.frameloop!==O&&j.setFrameloop(O),j.onPointerMissed||j.set({onPointerMissed:k}),D&&!sr.equ(D,j.performance,Im)&&j.set(Y=>({performance:{...Y.performance,...D}})),o=S,l=!0,this},render(d){return l||this.configure(),j1.updateContainer(v.jsx($be,{store:s,children:d,onCreated:o,rootElement:t}),a,null,()=>{}),s},unmount(){AG(t)}}}function $be({store:t,children:e,onCreated:n,rootElement:r}){return xx(()=>{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)},[]),v.jsx(SG.Provider,{value:t,children:e})}function AG(t,e){const n=zg.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),j1.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,a,o,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(o=i.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),kbe(i),zg.delete(t)}catch{}},500)})}}j1.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 Xbe(t){const{handlePointer:e}=Ube(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(a=>({events:{...a.events,connected:n}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([a,o])=>{const[l,c]=QA[a];n.addEventListener(l,o,{passive:c})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,a])=>{if(r&&r.connected instanceof HTMLElement){const[o]=QA[s];r.connected.removeEventListener(o,a)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function UU(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function qbe({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,a]=R.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),o=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,p,y]=R.useMemo(()=>{const x=()=>{if(!o.current.element)return;const{left:M,top:T,width:P,height:O,bottom:N,right:D,x:z,y:V}=o.current.element.getBoundingClientRect(),k={left:M,top:T,width:P,height:O,bottom:N,right:D,x:z,y:V};o.current.element instanceof HTMLElement&&r&&(k.height=o.current.element.offsetHeight,k.width=o.current.element.offsetWidth),Object.freeze(k),d.current&&!Qbe(o.current.lastBounds,k)&&a(o.current.lastBounds=k)};return[x,c?UU(x,c):x,l?UU(x,l):x]},[a,r,l,c]);function b(){o.current.scrollContainers&&(o.current.scrollContainers.forEach(x=>x.removeEventListener("scroll",y,!0)),o.current.scrollContainers=null),o.current.resizeObserver&&(o.current.resizeObserver.disconnect(),o.current.resizeObserver=null),o.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",o.current.orientationHandler))}function S(){o.current.element&&(o.current.resizeObserver=new i(y),o.current.resizeObserver.observe(o.current.element),e&&o.current.scrollContainers&&o.current.scrollContainers.forEach(x=>x.addEventListener("scroll",y,{capture:!0,passive:!0})),o.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",o.current.orientationHandler))}const w=x=>{!x||x===o.current.element||(b(),o.current.element=x,o.current.scrollContainers=TG(x),S())};return Ybe(y,!!e),Kbe(p),R.useEffect(()=>{b(),S()},[e,y,p]),R.useEffect(()=>b,[]),[w,s,f]}function Kbe(t){R.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function Ybe(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 TG(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,...TG(t.parentElement)]}const Zbe=["x","y","top","bottom","left","right","width","height"],Qbe=(t,e)=>Zbe.every(n=>t[n]===e[n]);var Jbe=Object.defineProperty,e_e=Object.defineProperties,t_e=Object.getOwnPropertyDescriptors,jU=Object.getOwnPropertySymbols,n_e=Object.prototype.hasOwnProperty,r_e=Object.prototype.propertyIsEnumerable,FU=(t,e,n)=>e in t?Jbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zU=(t,e)=>{for(var n in e||(e={}))n_e.call(e,n)&&FU(t,n,e[n]);if(jU)for(var n of jU(e))r_e.call(e,n)&&FU(t,n,e[n]);return t},i_e=(t,e)=>e_e(t,t_e(e)),BU,HU;typeof window<"u"&&((BU=window.document)!=null&&BU.createElement||((HU=window.navigator)==null?void 0:HU.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function PG(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=PG(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 VU=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=VU;return}return VU.apply(this,arguments)};const iN=CG(R.createContext(null));class RG extends R.Component{render(){return R.createElement(iN.Provider,{value:this._reactInternals},this.props.children)}}function s_e(){const t=R.useContext(iN);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=PG(r,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[t,e])}function a_e(){const t=s_e(),[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!==iN&&!e.has(i)&&e.set(i,R.useContext(CG(i)))}n=n.return}return e}function o_e(){const t=a_e();return R.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>R.createElement(e,null,R.createElement(n.Provider,i_e(zU({},r),{value:t.get(n)}))),e=>R.createElement(RG,zU({},e))),[t])}const l_e=R.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:a=Xbe,eventSource:o,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:p,orthographic:y,frameloop:b,dpr:S,performance:w,raycaster:x,camera:M,scene:T,onPointerMissed:P,onCreated:O,...N},D){R.useMemo(()=>Pbe(pbe),[]);const z=o_e(),[V,k]=qbe({scroll:!0,debounce:{scroll:50,resize:0},...r}),j=R.useRef(null),X=R.useRef(null);R.useImperativeHandle(D,()=>j.current);const ee=gG(P),[ie,pe]=R.useState(!1),[ae,he]=R.useState(!1);if(ie)throw ie;if(ae)throw ae;const B=R.useRef(null);xx(()=>{const Y=j.current;k.width>0&&k.height>0&&Y&&(B.current||(B.current=Wbe(Y)),B.current.configure({gl:s,events:a,shadows:c,linear:d,flat:f,legacy:p,orthographic:y,frameloop:b,dpr:S,performance:w,raycaster:x,camera:M,scene:T,size:k,onPointerMissed:(...H)=>ee.current==null?void 0:ee.current(...H),onCreated:H=>{H.events.connect==null||H.events.connect(o?Rbe(o)?o.current:o:X.current),l&&H.setEvents({compute:(G,le)=>{const se=G[l+"X"],ce=G[l+"Y"];le.pointer.set(se/le.size.width*2-1,-(ce/le.size.height)*2+1),le.raycaster.setFromCamera(le.pointer,le.camera)}}),O==null||O(H)}}),B.current.render(v.jsx(z,{children:v.jsx(vG,{set:he,children:v.jsx(R.Suspense,{fallback:v.jsx(Nbe,{set:pe}),children:e??null})})})))}),R.useEffect(()=>{const Y=j.current;if(Y)return()=>AG(Y)},[]);const J=o?"none":"auto";return v.jsx("div",{ref:X,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:J,...i},...N,children:v.jsx("div",{ref:V,style:{width:"100%",height:"100%"},children:v.jsx("canvas",{ref:j,style:{display:"block"},children:n})})})}),c_e=R.forwardRef(function(e,n){return v.jsx(RG,{children:v.jsx(l_e,{...e,ref:n})})});function aC(){return aC=Object.assign?Object.assign.bind():function(t){for(var e=1;ee in t?u_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,f_e=(t,e,n)=>(d_e(t,e+"",n),n);class h_e{constructor(){f_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,a=i.length;se in t?p_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wt=(t,e,n)=>(m_e(t,typeof e!="symbol"?e+"":e,n),n);const k_=new ep,GU=new Rc,g_e=Math.cos(70*(Math.PI/180)),WU=(t,e)=>(t%e+e)%e;let v_e=class extends h_e{constructor(e,n){super(),Wt(this,"object"),Wt(this,"domElement"),Wt(this,"enabled",!0),Wt(this,"target",new q),Wt(this,"minDistance",0),Wt(this,"maxDistance",1/0),Wt(this,"minZoom",0),Wt(this,"maxZoom",1/0),Wt(this,"minPolarAngle",0),Wt(this,"maxPolarAngle",Math.PI),Wt(this,"minAzimuthAngle",-1/0),Wt(this,"maxAzimuthAngle",1/0),Wt(this,"enableDamping",!1),Wt(this,"dampingFactor",.05),Wt(this,"enableZoom",!0),Wt(this,"zoomSpeed",1),Wt(this,"enableRotate",!0),Wt(this,"rotateSpeed",1),Wt(this,"enablePan",!0),Wt(this,"panSpeed",1),Wt(this,"screenSpacePanning",!0),Wt(this,"keyPanSpeed",7),Wt(this,"zoomToCursor",!1),Wt(this,"autoRotate",!1),Wt(this,"autoRotateSpeed",2),Wt(this,"reverseOrbit",!1),Wt(this,"reverseHorizontalOrbit",!1),Wt(this,"reverseVerticalOrbit",!1),Wt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Wt(this,"mouseButtons",{LEFT:Kf.ROTATE,MIDDLE:Kf.DOLLY,RIGHT:Kf.PAN}),Wt(this,"touches",{ONE:Yf.ROTATE,TWO:Yf.DOLLY_PAN}),Wt(this,"target0"),Wt(this,"position0"),Wt(this,"zoom0"),Wt(this,"_domElementKeyEvents",null),Wt(this,"getPolarAngle"),Wt(this,"getAzimuthalAngle"),Wt(this,"setPolarAngle"),Wt(this,"setAzimuthalAngle"),Wt(this,"getDistance"),Wt(this,"getZoomScale"),Wt(this,"listenToKeyEvents"),Wt(this,"stopListenToKeyEvents"),Wt(this,"saveState"),Wt(this,"reset"),Wt(this,"update"),Wt(this,"connect"),Wt(this,"dispose"),Wt(this,"dollyIn"),Wt(this,"dollyOut"),Wt(this,"getScale"),Wt(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=fe=>{let Xe=WU(fe,2*Math.PI),ue=d.phi;ue<0&&(ue+=2*Math.PI),Xe<0&&(Xe+=2*Math.PI);let Ye=Math.abs(Xe-ue);2*Math.PI-Ye{let Xe=WU(fe,2*Math.PI),ue=d.theta;ue<0&&(ue+=2*Math.PI),Xe<0&&(Xe+=2*Math.PI);let Ye=Math.abs(Xe-ue);2*Math.PI-Yer.object.position.distanceTo(r.target),this.listenToKeyEvents=fe=>{fe.addEventListener("keydown",ht),this._domElementKeyEvents=fe},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=o.NONE},this.update=(()=>{const fe=new q,Xe=new q(0,1,0),ue=new qt().setFromUnitVectors(e.up,Xe),Ye=ue.clone().invert(),Re=new q,Be=new qt,at=2*Math.PI;return function(){const Jt=r.object.position;ue.setFromUnitVectors(e.up,Xe),Ye.copy(ue).invert(),fe.copy(Jt).sub(r.target),fe.applyQuaternion(ue),d.setFromVector3(fe),r.autoRotate&&l===o.NONE&&ie(X()),r.enableDamping?(d.theta+=f.theta*r.dampingFactor,d.phi+=f.phi*r.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let pn=r.minAzimuthAngle,jn=r.maxAzimuthAngle;isFinite(pn)&&isFinite(jn)&&(pn<-Math.PI?pn+=at:pn>Math.PI&&(pn-=at),jn<-Math.PI?jn+=at:jn>Math.PI&&(jn-=at),pn<=jn?d.theta=Math.max(pn,Math.min(jn,d.theta)):d.theta=d.theta>(pn+jn)/2?Math.max(pn,d.theta):Math.min(jn,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&&V||r.object.isOrthographicCamera?d.radius=le(d.radius):d.radius=le(d.radius*p),fe.setFromSpherical(d),fe.applyQuaternion(Ye),Jt.copy(r.target).add(fe),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 en=!1;if(r.zoomToCursor&&V){let Hn=null;if(r.object instanceof Pr&&r.object.isPerspectiveCamera){const pr=fe.length();Hn=le(pr*p);const Mi=pr-Hn;r.object.position.addScaledVector(D,Mi),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const pr=new q(z.x,z.y,0);pr.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),en=!0;const Mi=new q(z.x,z.y,0);Mi.unproject(r.object),r.object.position.sub(Mi).add(pr),r.object.updateMatrixWorld(),Hn=fe.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Hn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Hn).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-Be.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Re.copy(r.object.position),Be.copy(r.object.quaternion),en=!1,!0):!1}})(),this.connect=fe=>{r.domElement=fe,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",te),r.domElement.addEventListener("pointerdown",be),r.domElement.addEventListener("pointercancel",ze),r.domElement.addEventListener("wheel",rt)},this.dispose=()=>{var fe,Xe,ue,Ye,Re,Be;r.domElement&&(r.domElement.style.touchAction="auto"),(fe=r.domElement)==null||fe.removeEventListener("contextmenu",te),(Xe=r.domElement)==null||Xe.removeEventListener("pointerdown",be),(ue=r.domElement)==null||ue.removeEventListener("pointercancel",ze),(Ye=r.domElement)==null||Ye.removeEventListener("wheel",rt),(Re=r.domElement)==null||Re.ownerDocument.removeEventListener("pointermove",Ue),(Be=r.domElement)==null||Be.ownerDocument.removeEventListener("pointerup",ze),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ht)};const r=this,i={type:"change"},s={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=o.NONE;const c=1e-6,d=new rC,f=new rC;let p=1;const y=new q,b=new He,S=new He,w=new He,x=new He,M=new He,T=new He,P=new He,O=new He,N=new He,D=new q,z=new He;let V=!1;const k=[],j={};function X(){return 2*Math.PI/60/60*r.autoRotateSpeed}function ee(){return Math.pow(.95,r.zoomSpeed)}function ie(fe){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=fe:f.theta-=fe}function pe(fe){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=fe:f.phi-=fe}const ae=(()=>{const fe=new q;return function(ue,Ye){fe.setFromMatrixColumn(Ye,0),fe.multiplyScalar(-ue),y.add(fe)}})(),he=(()=>{const fe=new q;return function(ue,Ye){r.screenSpacePanning===!0?fe.setFromMatrixColumn(Ye,1):(fe.setFromMatrixColumn(Ye,0),fe.crossVectors(r.object.up,fe)),fe.multiplyScalar(ue),y.add(fe)}})(),B=(()=>{const fe=new q;return function(ue,Ye){const Re=r.domElement;if(Re&&r.object instanceof Pr&&r.object.isPerspectiveCamera){const Be=r.object.position;fe.copy(Be).sub(r.target);let at=fe.length();at*=Math.tan(r.object.fov/2*Math.PI/180),ae(2*ue*at/Re.clientHeight,r.object.matrix),he(2*Ye*at/Re.clientHeight,r.object.matrix)}else Re&&r.object instanceof Gc&&r.object.isOrthographicCamera?(ae(ue*(r.object.right-r.object.left)/r.object.zoom/Re.clientWidth,r.object.matrix),he(Ye*(r.object.top-r.object.bottom)/r.object.zoom/Re.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function J(fe){r.object instanceof Pr&&r.object.isPerspectiveCamera||r.object instanceof Gc&&r.object.isOrthographicCamera?p=fe:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function Y(fe){J(p/fe)}function H(fe){J(p*fe)}function G(fe){if(!r.zoomToCursor||!r.domElement)return;V=!0;const Xe=r.domElement.getBoundingClientRect(),ue=fe.clientX-Xe.left,Ye=fe.clientY-Xe.top,Re=Xe.width,Be=Xe.height;z.x=ue/Re*2-1,z.y=-(Ye/Be)*2+1,D.set(z.x,z.y,1).unproject(r.object).sub(r.object.position).normalize()}function le(fe){return Math.max(r.minDistance,Math.min(r.maxDistance,fe))}function se(fe){b.set(fe.clientX,fe.clientY)}function ce(fe){G(fe),P.set(fe.clientX,fe.clientY)}function Se(fe){x.set(fe.clientX,fe.clientY)}function we(fe){S.set(fe.clientX,fe.clientY),w.subVectors(S,b).multiplyScalar(r.rotateSpeed);const Xe=r.domElement;Xe&&(ie(2*Math.PI*w.x/Xe.clientHeight),pe(2*Math.PI*w.y/Xe.clientHeight)),b.copy(S),r.update()}function We(fe){O.set(fe.clientX,fe.clientY),N.subVectors(O,P),N.y>0?Y(ee()):N.y<0&&H(ee()),P.copy(O),r.update()}function Ee(fe){M.set(fe.clientX,fe.clientY),T.subVectors(M,x).multiplyScalar(r.panSpeed),B(T.x,T.y),x.copy(M),r.update()}function Ge(fe){G(fe),fe.deltaY<0?H(ee()):fe.deltaY>0&&Y(ee()),r.update()}function $e(fe){let Xe=!1;switch(fe.code){case r.keys.UP:B(0,r.keyPanSpeed),Xe=!0;break;case r.keys.BOTTOM:B(0,-r.keyPanSpeed),Xe=!0;break;case r.keys.LEFT:B(r.keyPanSpeed,0),Xe=!0;break;case r.keys.RIGHT:B(-r.keyPanSpeed,0),Xe=!0;break}Xe&&(fe.preventDefault(),r.update())}function de(){if(k.length==1)b.set(k[0].pageX,k[0].pageY);else{const fe=.5*(k[0].pageX+k[1].pageX),Xe=.5*(k[0].pageY+k[1].pageY);b.set(fe,Xe)}}function Z(){if(k.length==1)x.set(k[0].pageX,k[0].pageY);else{const fe=.5*(k[0].pageX+k[1].pageX),Xe=.5*(k[0].pageY+k[1].pageY);x.set(fe,Xe)}}function Ve(){const fe=k[0].pageX-k[1].pageX,Xe=k[0].pageY-k[1].pageY,ue=Math.sqrt(fe*fe+Xe*Xe);P.set(0,ue)}function Le(){r.enableZoom&&Ve(),r.enablePan&&Z()}function ne(){r.enableZoom&&Ve(),r.enableRotate&&de()}function Ce(fe){if(k.length==1)S.set(fe.pageX,fe.pageY);else{const ue=Zt(fe),Ye=.5*(fe.pageX+ue.x),Re=.5*(fe.pageY+ue.y);S.set(Ye,Re)}w.subVectors(S,b).multiplyScalar(r.rotateSpeed);const Xe=r.domElement;Xe&&(ie(2*Math.PI*w.x/Xe.clientHeight),pe(2*Math.PI*w.y/Xe.clientHeight)),b.copy(S)}function qe(fe){if(k.length==1)M.set(fe.pageX,fe.pageY);else{const Xe=Zt(fe),ue=.5*(fe.pageX+Xe.x),Ye=.5*(fe.pageY+Xe.y);M.set(ue,Ye)}T.subVectors(M,x).multiplyScalar(r.panSpeed),B(T.x,T.y),x.copy(M)}function Ze(fe){const Xe=Zt(fe),ue=fe.pageX-Xe.x,Ye=fe.pageY-Xe.y,Re=Math.sqrt(ue*ue+Ye*Ye);O.set(0,Re),N.set(0,Math.pow(O.y/P.y,r.zoomSpeed)),Y(N.y),P.copy(O)}function Q(fe){r.enableZoom&&Ze(fe),r.enablePan&&qe(fe)}function W(fe){r.enableZoom&&Ze(fe),r.enableRotate&&Ce(fe)}function be(fe){var Xe,ue;r.enabled!==!1&&(k.length===0&&((Xe=r.domElement)==null||Xe.ownerDocument.addEventListener("pointermove",Ue),(ue=r.domElement)==null||ue.ownerDocument.addEventListener("pointerup",ze)),tt(fe),fe.pointerType==="touch"?Xt(fe):Fe(fe))}function Ue(fe){r.enabled!==!1&&(fe.pointerType==="touch"?Ke(fe):bt(fe))}function ze(fe){var Xe,ue,Ye;Mt(fe),k.length===0&&((Xe=r.domElement)==null||Xe.releasePointerCapture(fe.pointerId),(ue=r.domElement)==null||ue.ownerDocument.removeEventListener("pointermove",Ue),(Ye=r.domElement)==null||Ye.ownerDocument.removeEventListener("pointerup",ze)),r.dispatchEvent(a),l=o.NONE}function Fe(fe){let Xe;switch(fe.button){case 0:Xe=r.mouseButtons.LEFT;break;case 1:Xe=r.mouseButtons.MIDDLE;break;case 2:Xe=r.mouseButtons.RIGHT;break;default:Xe=-1}switch(Xe){case Kf.DOLLY:if(r.enableZoom===!1)return;ce(fe),l=o.DOLLY;break;case Kf.ROTATE:if(fe.ctrlKey||fe.metaKey||fe.shiftKey){if(r.enablePan===!1)return;Se(fe),l=o.PAN}else{if(r.enableRotate===!1)return;se(fe),l=o.ROTATE}break;case Kf.PAN:if(fe.ctrlKey||fe.metaKey||fe.shiftKey){if(r.enableRotate===!1)return;se(fe),l=o.ROTATE}else{if(r.enablePan===!1)return;Se(fe),l=o.PAN}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function bt(fe){if(r.enabled!==!1)switch(l){case o.ROTATE:if(r.enableRotate===!1)return;we(fe);break;case o.DOLLY:if(r.enableZoom===!1)return;We(fe);break;case o.PAN:if(r.enablePan===!1)return;Ee(fe);break}}function rt(fe){r.enabled===!1||r.enableZoom===!1||l!==o.NONE&&l!==o.ROTATE||(fe.preventDefault(),r.dispatchEvent(s),Ge(fe),r.dispatchEvent(a))}function ht(fe){r.enabled===!1||r.enablePan===!1||$e(fe)}function Xt(fe){switch(vt(fe),k.length){case 1:switch(r.touches.ONE){case Yf.ROTATE:if(r.enableRotate===!1)return;de(),l=o.TOUCH_ROTATE;break;case Yf.PAN:if(r.enablePan===!1)return;Z(),l=o.TOUCH_PAN;break;default:l=o.NONE}break;case 2:switch(r.touches.TWO){case Yf.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Le(),l=o.TOUCH_DOLLY_PAN;break;case Yf.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;ne(),l=o.TOUCH_DOLLY_ROTATE;break;default:l=o.NONE}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function Ke(fe){switch(vt(fe),l){case o.TOUCH_ROTATE:if(r.enableRotate===!1)return;Ce(fe),r.update();break;case o.TOUCH_PAN:if(r.enablePan===!1)return;qe(fe),r.update();break;case o.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Q(fe),r.update();break;case o.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;W(fe),r.update();break;default:l=o.NONE}}function te(fe){r.enabled!==!1&&fe.preventDefault()}function tt(fe){k.push(fe)}function Mt(fe){delete j[fe.pointerId];for(let Xe=0;Xe{H(fe),r.update()},this.dollyOut=(fe=ee())=>{Y(fe),r.update()},this.getScale=()=>p,this.setScale=fe=>{J(fe),r.update()},this.getZoomScale=()=>ee(),n!==void 0&&this.connect(n),this.update()}};const y_e=R.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:a,onStart:o,onEnd:l,...c},d)=>{const f=ed(N=>N.invalidate),p=ed(N=>N.camera),y=ed(N=>N.gl),b=ed(N=>N.events),S=ed(N=>N.setEvents),w=ed(N=>N.set),x=ed(N=>N.get),M=ed(N=>N.performance),T=e||p,P=r||b.connected||y.domElement,O=R.useMemo(()=>new v_e(T),[T]);return EG(()=>{O.enabled&&O.update()},-1),R.useEffect(()=>(s&&O.connect(s===!0?P:s),O.connect(P),()=>void O.dispose()),[s,P,n,O,f]),R.useEffect(()=>{const N=V=>{f(),n&&M.regress(),a&&a(V)},D=V=>{o&&o(V)},z=V=>{l&&l(V)};return O.addEventListener("change",N),O.addEventListener("start",D),O.addEventListener("end",z),()=>{O.removeEventListener("start",D),O.removeEventListener("end",z),O.removeEventListener("change",N)}},[a,o,l,O,f,S]),R.useEffect(()=>{if(t){const N=x().controls;return w({controls:O}),()=>w({controls:N})}},[t,O]),R.createElement("primitive",aC({ref:d,object:O,enableDamping:i},c))});function $U(t,e){if(e===ZV)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===O1||e===_R){let n=t.getIndex();if(n===null){const a=[],o=t.getAttribute("position");if(o!==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&&o[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(a),c.setPlugins(o),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function b_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 vn={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 __e{constructor(e){this.parser=e,this.name=vn.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,a)}}class L_e{constructor(e){this.parser=e,this.name=vn.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 a=s.extensions[n],o=i.images[a.source];let l=r.textureLoader;if(o.uri){const c=r.options.manager.getHandler(o.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,a.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 D_e{constructor(e){this.parser=e,this.name=vn.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 a=s.extensions[n],o=i.images[a.source];let l=r.textureLoader;if(o.uri){const c=r.options.manager.getHandler(o.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,a.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 U_e{constructor(e){this.name=vn.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),a=this.parser.options.meshoptDecoder;if(!a||!a.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(o){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,f=i.byteStride,p=new Uint8Array(o,l,c);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(d,f,p,i.mode,i.filter).then(function(y){return y.buffer}):a.ready.then(function(){const y=new ArrayBuffer(d*f);return a.decodeGltfBuffer(new Uint8Array(y),d,f,p,i.mode,i.filter),y})})}else return null}}class j_e{constructor(e){this.name=vn.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!==Ba.TRIANGLES&&c.mode!==Ba.TRIANGLE_STRIP&&c.mode!==Ba.TRIANGLE_FAN&&c.mode!==void 0)return null;const a=r.extensions[this.name].attributes,o=[],l={};for(const c in a)o.push(this.parser.getDependency("accessor",a[c]).then(d=>(l[c]=d,l[c])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(c=>{const d=c.pop(),f=d.isGroup?d.children:[d],p=c[0].count,y=[];for(const b of f){const S=new Ct,w=new q,x=new qt,M=new q(1,1,1),T=new OR(b.geometry,b.material,p);for(let P=0;P0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Z_e=new Ct;class Q_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new b_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,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(o)===!0;const l=o.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=o.indexOf("Firefox")>-1,a=s?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&a<98?this.textureLoader=new J6(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 Go(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(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:r,userData:{}};return Bf(s,o,i),Pc(o,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(o)})).then(function(){for(const l of o.scenes)l.updateMatrixWorld();e(o)})}).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(a);l!=null&&this.associations.set(o,l);for(const[c,d]of a.children.entries())s(d,o.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(V,N[D*l+1]),l>=3&&w.setZ(V,N[D*l+2]),l>=4&&w.setW(V,N[D*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}w.normalized=b}return w})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,a=n.images[s];let o=this.textureLoader;if(a.uri){const l=r.manager.getHandler(a.uri);l!==null&&(o=l)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,n,r){const i=this,s=this.json,a=s.textures[e],o=s.images[n],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(d){d.flipY=!1,d.name=a.name||o.name||"",d.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(d.name=o.uri);const p=(s.samplers||{})[a.sampler]||{};return d.magFilter=qU[p.magFilter]||Cr,d.minFilter=qU[p.minFilter]||$a,d.wrapS=KU[p.wrapS]||Rd,d.wrapT=KU[p.wrapT]||Rd,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 a=i.images[e],o=self.URL||self.webkitURL;let l=a.uri||"",c=!1;if(a.bufferView!==void 0)l=r.getDependency("bufferView",a.bufferView).then(function(f){c=!0;const p=new Blob([f],{type:a.mimeType});return l=o.createObjectURL(p),l});else if(a.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(p,y){let b=p;n.isImageBitmapLoader===!0&&(b=function(S){const w=new fr(S);w.needsUpdate=!0,p(w)}),n.load(Sd.resolveURL(f,s.path),b,void 0,y)})}).then(function(f){return c===!0&&o.revokeObjectURL(l),Pc(f,a),f.userData.mimeType=a.mimeType||Y_e(a.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(a){if(!a)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(a=a.clone(),a.channel=r.texCoord),s.extensions[vn.KHR_TEXTURE_TRANSFORM]){const o=r.extensions!==void 0?r.extensions[vn.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const l=s.associations.get(a);a=s.extensions[vn.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,l)}}return i!==void 0&&(a.colorSpace=i),e[n]=a,a})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,a=n.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+r.uuid;let l=this.cache.get(o);l||(l=new iM,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(o,l)),r=l}else if(e.isLine){const o="LineBasicMaterial:"+r.uuid;let l=this.cache.get(o);l||(l=new $r,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(o,l)),r=l}if(i||s||a){let o="ClonedMaterial:"+r.uuid+":";i&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let l=this.cache.get(o);l||(l=r.clone(),s&&(l.vertexColors=!0),a&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(o,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return yx}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let a;const o={},l=s.extensions||{},c=[];if(l[vn.KHR_MATERIALS_UNLIT]){const f=i[vn.KHR_MATERIALS_UNLIT];a=f.getMaterialType(),c.push(f.extendParams(o,s,n))}else{const f=s.pbrMetallicRoughness||{};if(o.color=new ct(1,1,1),o.opacity=1,Array.isArray(f.baseColorFactor)){const p=f.baseColorFactor;o.color.setRGB(p[0],p[1],p[2],xi),o.opacity=p[3]}f.baseColorTexture!==void 0&&c.push(n.assignTexture(o,"map",f.baseColorTexture,Fi)),o.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,o.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(o,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(o,"roughnessMap",f.metallicRoughnessTexture))),a=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=ya);const d=s.alphaMode||eT.OPAQUE;if(d===eT.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,d===eT.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==As&&(c.push(n.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new He(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;o.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&a!==As&&(c.push(n.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==As){const f=s.emissiveFactor;o.emissive=new ct().setRGB(f[0],f[1],f[2],xi)}return s.emissiveTexture!==void 0&&a!==As&&c.push(n.assignTexture(o,"emissiveMap",s.emissiveTexture,Fi)),Promise.all(c).then(function(){const f=new a(o);return s.name&&(f.name=s.name),Pc(f,s),n.associations.set(f,{materials:e}),s.extensions&&Bf(i,f,s),f})}createUniqueName(e){const n=Rn.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(o){return r[vn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,n).then(function(l){return YU(l,o,n)})}const a=[];for(let o=0,l=e.length;o0&&q_e(x,s),x.name=n.createUniqueName(s.name||"mesh_"+e),Pc(x,s),w.extensions&&Bf(i,x,w),n.assignFinalMaterial(x),f.push(x)}for(let y=0,b=f.length;y1?d=new Ts:c.length===1?d=c[0]:d=new mn,d!==c[0])for(let f=0,p=c.length;f{const f=new Map;for(const[p,y]of i.associations)(p instanceof Gr||p instanceof fr)&&f.set(p,y);return d.traverse(p=>{const y=i.associations.get(p);y!=null&&f.set(p,y)}),f};return i.associations=c(s),s})}_createAnimationTracks(e,n,r,i,s){const a=[],o=e.name?e.name:e.uuid,l=[];td[s.path]===td.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(o);let c;switch(td[s.path]){case td.weights:c=Wh;break;case td.rotation:c=$h;break;case td.position:case td.scale:c=Xh;break;default:switch(r.itemSize){case 1:c=Wh;break;case 2:case 3:default:c=Xh;break}break}const d=i.interpolation!==void 0?W_e[i.interpolation]:Lg,f=this._getArrayFromAccessor(r);for(let p=0,y=l.length;p>>1,G=B[H];if(0>>1;Hi(ce,Y))Sei(we,ce)?(B[H]=we,B[Se]=Y,H=Se):(B[H]=ce,B[se]=Y,H=se);else if(Sei(we,Y))B[H]=we,B[Se]=Y,H=Se;else break e}}return J}function i(B,J){var Y=B.sortIndex-J.sortIndex;return Y!==0?Y:B.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],d=1,f=null,p=3,y=!1,b=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,x=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 J=n(c);J!==null;){if(J.callback===null)r(c);else if(J.startTime<=B)r(c),J.sortIndex=J.expirationTime,e(l,J);else break;J=n(c)}}function P(B){if(S=!1,T(B),!b)if(n(l)!==null)b=!0,ae(O);else{var J=n(c);J!==null&&he(P,J.startTime-B)}}function O(B,J){b=!1,S&&(S=!1,x(z),z=-1),y=!0;var Y=p;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!j());){var H=f.callback;if(typeof H=="function"){f.callback=null,p=f.priorityLevel;var G=H(f.expirationTime<=J);J=t.unstable_now(),typeof G=="function"?f.callback=G:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var le=!0;else{var se=n(c);se!==null&&he(P,se.startTime-J),le=!1}return le}finally{f=null,p=Y,y=!1}}var N=!1,D=null,z=-1,V=5,k=-1;function j(){return!(t.unstable_now()-kB||125H?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(x(z),z=-1):S=!0,he(P,Y-H))):(B.sortIndex=G,e(l,B),b||y||(b=!0,ae(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var J=p;return function(){var Y=p;p=J;try{return B.apply(this,arguments)}finally{p=Y}}}})(GA)),GA}var PU;function Pbe(){return PU||(PU=1,VA.exports=Tbe()),VA.exports}var CU=Pbe();const rN={},Cbe=t=>void Object.assign(rN,t);function Rbe(t,e){function n(d,{args:f=[],attach:p,...y},b){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 x=y.object;w=Fm(x,{type:d,root:b,attach:p,primitive:!0})}else{const x=rN[S];if(!x)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=Fm(new x(...f),{type:d,root:b,attach:p,memoizedProps:{args:f}})}return w.__r3f.attach===void 0&&(w.isBufferGeometry?w.__r3f.attach="geometry":w.isMaterial&&(w.__r3f.attach="material")),S!=="inject"&&XA(w,y),w}function r(d,f){let p=!1;if(f){var y,b;(y=f.__r3f)!=null&&y.attach?$A(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),p=!0),p||(b=d.__r3f)==null||b.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,sC(f),zm(f)}}function i(d,f,p){let y=!1;if(f){var b,S;if((b=f.__r3f)!=null&&b.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 w=d.children.filter(M=>M!==f),x=w.indexOf(p);d.children=[...w.slice(0,x),f,...w.slice(x)],y=!0}y||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,sC(f),zm(f)}}function s(d,f,p=!1){d&&[...d].forEach(y=>a(f,y,p))}function a(d,f,p){if(f){var y,b,S;if(f.__r3f&&(f.__r3f.parent=null),(y=d.__r3f)!=null&&y.objects&&(d.__r3f.objects=d.__r3f.objects.filter(P=>P!==f)),(b=f.__r3f)!=null&&b.attach)OU(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var w;d.remove(f),(w=f.__r3f)!=null&&w.root&&Ube(Y_(f),f)}const M=(S=f.__r3f)==null?void 0:S.primitive,T=!M&&(p===void 0?f.dispose!==null:p);if(!M){var x;s((x=f.__r3f)==null?void 0:x.objects,f,T),s(f.children,f,T)}if(delete f.__r3f,T&&f.dispose&&f.type!=="Scene"){const P=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?CU.unstable_scheduleCallback(CU.unstable_IdlePriority,P):P()}zm(d)}}function o(d,f,p,y){var b;const S=(b=d.__r3f)==null?void 0:b.parent;if(!S)return;const w=n(f,p,d.__r3f.root);if(d.children){for(const x of d.children)x.__r3f&&r(w,x);d.children=d.children.filter(x=>!x.__r3f)}d.__r3f.objects.forEach(x=>r(w,x)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||a(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(x=>{x!==null&&(x.stateNode=w,x.ref&&(typeof x.ref=="function"?x.ref(w):x.ref.current=w))})}const l=()=>{};return{reconciler:Abe({createInstance:n,removeChild:a,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const p=d.getState().scene;p.__r3f&&(p.__r3f.root=d,r(p,f))},removeChildFromContainer:(d,f)=>{f&&a(d.getState().scene,f)},insertInContainerBefore:(d,f,p)=>{if(!f||!p)return;const y=d.getState().scene;y.__r3f&&i(y,f,p)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,p,y){var b;if(((b=d==null?void 0:d.__r3f)!=null?b:{}).primitive&&y.object&&y.object!==d)return[!0];{const{args:w=[],children:x,...M}=y,{args:T=[],children:P,...O}=p;if(!Array.isArray(w))throw new Error("R3F: the args prop must be an array!");if(w.some((D,z)=>D!==T[z]))return[!0];const N=_G(d,M,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,p],y,b,S,w){f?o(d,y,S,w):XA(d,p)},commitMount(d,f,p,y){var b;const S=(b=d.__r3f)!=null?b:{};d.raycast&&S.handlers&&S.eventCount&&Y_(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Fm(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:p,parent:y}=(f=d.__r3f)!=null?f:{};p&&y&&OU(y,d,p),d.isObject3D&&(d.visible=!1),zm(d)},unhideInstance(d,f){var p;const{attach:y,parent:b}=(p=d.__r3f)!=null?p:{};y&&b&&$A(b,d,y),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),zm(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Km.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&sr.fun(performance.now)?performance.now:sr.fun(Date.now)?Date.now:()=>0,scheduleTimeout:sr.fun(setTimeout)?setTimeout:void 0,cancelTimeout:sr.fun(clearTimeout)?clearTimeout:void 0}),applyProps:XA}}var RU,NU;const WA=t=>"colorSpace"in t||"outputColorSpace"in t,mG=()=>{var t;return(t=rN.ColorManagement)!=null?t:null},gG=t=>t&&t.isOrthographicCamera,Nbe=t=>t&&t.hasOwnProperty("current"),xx=typeof window<"u"&&((RU=window.document)!=null&&RU.createElement||((NU=window.navigator)==null?void 0:NU.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function vG(t){const e=R.useRef(t);return xx(()=>void(e.current=t),[t]),e}function Ibe({set:t}){return xx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class yG 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}}yG.getDerivedStateFromError=()=>({error:!0});const xG="__default",IU=new Map,kbe=t=>t&&!!t.memoized&&!!t.changes;function bG(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 sr={obj:t=>t===Object(t)&&!sr.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(sr.str(t)||sr.num(t)||sr.boo(t))return t===e;const s=sr.obj(t);if(s&&r==="reference")return t===e;const a=sr.arr(t);if(a&&n==="reference")return t===e;if((a||s)&&t===e)return!0;let o;for(o in t)if(!(o in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(o in i?e:t)if(!sr.equ(t[o],e[o],{strict:i,objects:"reference"}))return!1}else for(o in i?e:t)if(t[o]!==e[o])return!1;if(sr.und(o)){if(a&&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 Obe(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function Fm(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function iC(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((s,a)=>s[a],t),{target:n,key:i}}else return{target:n,key:e}}const kU=/-\d+$/;function $A(t,e,n){if(sr.str(n)){if(kU.test(n)){const s=n.replace(kU,""),{target:a,key:o}=iC(t,s);Array.isArray(a[o])||(a[o]=[])}const{target:r,key:i}=iC(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function OU(t,e,n){var r,i;if(sr.str(n)){const{target:s,key:a}=iC(t,n),o=e.__r3f.previousAttach;o===void 0?delete s[a]:s[a]=o}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function _G(t,{children:e,key:n,ref:r,...i},{children:s,key:a,ref:o,...l}={},c=!1){const d=t.__r3f,f=Object.entries(i),p=[];if(c){const b=Object.keys(l);for(let S=0;S{var w;if((w=t.__r3f)!=null&&w.primitive&&b==="object"||sr.equ(S,l[b]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(b))return p.push([b,S,!0,[]]);let x=[];b.includes("-")&&(x=b.split("-")),p.push([b,S,!1,x]);for(const M in i){const T=i[M];M.startsWith(`${b}-`)&&p.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:p}}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:a,changes:o}=kbe(e)?e:_G(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=a);for(let p=0;pT[P],t),!(M&&M.set))){const[T,...P]=w.reverse();x=P.reverse().reduce((O,N)=>O[N],t),y=T}if(b===xG+"remove")if(x.constructor){let T=IU.get(x.constructor);T||(T=new x.constructor,IU.set(x.constructor,T)),b=T[y]}else b=0;if(S&&r)b?r.handlers[y]=b:delete r.handlers[y],r.eventCount=Object.keys(r.handlers).length;else if(M&&M.set&&(M.copy||M instanceof Ch)){if(Array.isArray(b))M.fromArray?M.fromArray(b):M.set(...b);else if(M.copy&&b&&b.constructor&&M.constructor===b.constructor)M.copy(b);else if(b!==void 0){var c;const T=(c=M)==null?void 0:c.isColor;!T&&M.setScalar?M.setScalar(b):M instanceof Ch&&b instanceof Ch?M.mask=b.mask:M.set(b),!mG()&&s&&!s.linear&&T&&M.convertSRGBToLinear()}}else{var d;if(x[y]=b,(d=x[y])!=null&&d.isTexture&&x[y].format===ss&&x[y].type===Ho&&s){const T=x[y];WA(T)&&WA(s.gl)?T.colorSpace=s.gl.outputColorSpace:T.encoding=s.gl.outputEncoding}}zm(t)}if(r&&r.parent&&t.raycast&&l!==r.eventCount){const p=Y_(t).getState().internal,y=p.interaction.indexOf(t);y>-1&&p.interaction.splice(y,1),r.eventCount&&p.interaction.push(t)}return!(o.length===1&&o[0][0]==="onUpdate")&&o.length&&(n=t.__r3f)!=null&&n.parent&&sC(t),t}function zm(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 sC(t){t.onUpdate==null||t.onUpdate(t)}function Lbe(t,e){t.manual||(gG(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 Dbe(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Km.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Km.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Km.ContinuousEventPriority;default:return Km.DefaultEventPriority}}function wG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function Ube(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)=>{wG(n.capturedMap,e,r,i)})}function jbe(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,p=[],y=c?c(d.internal.interaction):d.internal.interaction;for(let x=0;x{const T=R0(x.object),P=R0(M.object);return!T||!P?x.distance-M.distance:P.events.priority-T.events.priority||x.distance-M.distance}).filter(x=>{const M=N_(x);return f.has(M)?!1:(f.add(M),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const x of S){let M=x.object;for(;M;){var w;(w=M.__r3f)!=null&&w.eventCount&&p.push({...x,eventObject:M}),M=M.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let x of d.internal.capturedMap.get(l.pointerId).values())f.has(N_(x.intersection))||p.push(x.intersection);return p}function i(l,c,d,f){const p=t.getState();if(l.length){const y={stopped:!1};for(const b of l){const S=R0(b.object)||p,{raycaster:w,pointer:x,camera:M,internal:T}=S,P=new q(x.x,x.y,0).unproject(M),O=k=>{var j,X;return(j=(X=T.capturedMap.get(k))==null?void 0:X.has(b.eventObject))!=null?j:!1},N=k=>{const j={intersection:b,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(b.eventObject,j):T.capturedMap.set(k,new Map([[b.eventObject,j]])),c.target.setPointerCapture(k)},D=k=>{const j=T.capturedMap.get(k);j&&wG(T.capturedMap,b.eventObject,j,k)};let z={};for(let k in c){let j=c[k];typeof j!="function"&&(z[k]=j)}let V={...b,...z,pointer:x,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:P,ray:w.ray,camera:M,stopPropagation(){const k="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!k||k.has(b.eventObject))&&(V.stopped=y.stopped=!0,T.hovered.size&&Array.from(T.hovered.values()).find(j=>j.eventObject===b.eventObject))){const j=l.slice(0,l.indexOf(b));s([...j,b])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},currentTarget:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},nativeEvent:c};if(f(V),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 p=d.eventObject.__r3f,y=p==null?void 0:p.handlers;if(c.hovered.delete(N_(d)),p!=null&&p.eventCount){const b={...d,intersections:l};y.onPointerOut==null||y.onPointerOut(b),y.onPointerLeave==null||y.onPointerLeave(b)}}}function a(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:p}=t.getState();p.lastEvent.current=d;const y=l==="onPointerMove",b=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",w=r(d,y?n:void 0),x=b?e(d):0;l==="onPointerDown"&&(p.initialClick=[d.offsetX,d.offsetY],p.initialHits=w.map(T=>T.eventObject)),b&&!w.length&&x<=2&&(a(d,p.interaction),f&&f(d)),y&&s(w);function M(T){const P=T.eventObject,O=P.__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 D=N_(T),z=p.hovered.get(D);z?z.stopped&&T.stopPropagation():(p.hovered.set(D,T),N.onPointerOver==null||N.onPointerOver(T),N.onPointerEnter==null||N.onPointerEnter(T))}N.onPointerMove==null||N.onPointerMove(T)}else{const D=N[l];D?(!b||p.initialHits.includes(P))&&(a(d,p.interaction.filter(z=>!p.initialHits.includes(z))),D(T)):b&&p.initialHits.includes(P)&&a(d,p.interaction.filter(z=>!p.initialHits.includes(z)))}}i(w,d,x,M)}}return{handlePointer:o}}const SG=t=>!!(t!=null&&t.render),MG=R.createContext(null),Fbe=(t,e)=>{const n=bbe((o,l)=>{const c=new q,d=new q,f=new q;function p(x=l().camera,M=d,T=l().size){const{width:P,height:O,top:N,left:D}=T,z=P/O;M.isVector3?f.copy(M):f.set(...M);const V=x.getWorldPosition(c).distanceTo(f);if(gG(x))return{width:P/x.zoom,height:O/x.zoom,top:N,left:D,factor:1,distance:V,aspect:z};{const k=x.fov*Math.PI/180,j=2*Math.tan(k/2)*V,X=j*(P/O);return{width:X,height:j,top:N,left:D,factor:P/X,distance:V,aspect:z}}}let y;const b=x=>o(M=>({performance:{...M.performance,current:x}})),S=new He;return{set:o,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(x=1)=>t(l(),x),advance:(x,M)=>e(x,M,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new QR,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const x=l();y&&clearTimeout(y),x.performance.current!==x.performance.min&&b(x.performance.min),y=setTimeout(()=>b(l().performance.max),x.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:p},setEvents:x=>o(M=>({...M,events:{...M.events,...x}})),setSize:(x,M,T,P,O)=>{const N=l().camera,D={width:x,height:M,top:P||0,left:O||0,updateStyle:T};o(z=>({size:D,viewport:{...z.viewport,...p(N,d,D)}}))},setDpr:x=>o(M=>{const T=bG(x);return{viewport:{...M.viewport,dpr:T,initialDpr:M.viewport.initialDpr||T}}}),setFrameloop:(x="always")=>{const M=l().clock;M.stop(),M.elapsedTime=0,x!=="never"&&(M.start(),M.elapsedTime=0),o(()=>({frameloop:x}))},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:(x,M,T)=>{const P=l().internal;return P.priority=P.priority+(M>0?1:0),P.subscribers.push({ref:x,priority:M,store:T}),P.subscribers=P.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!==x))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,a=r.camera;return n.subscribe(()=>{const{camera:o,size:l,viewport:c,gl:d,set:f}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){var p;i=l,s=c.dpr,Lbe(o,l),d.setPixelRatio(c.dpr);const y=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,y)}o!==a&&(a=o,f(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(o)}})))}),n.subscribe(o=>t(o)),n};let I_,zbe=new Set,Bbe=new Set,Hbe=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(zbe,e);case"after":return qA(Bbe,e);case"tail":return qA(Hbe,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,I_=0;I_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 o(c,d=1){var f;if(!c)return t.forEach(p=>o(p.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(a)))}function l(c,d=!0,f,p){if(d&&N0("before",c),f)ZA(c,f,p);else for(const y of t.values())ZA(c,y.store.getState());d&&N0("after",c)}return{loop:a,invalidate:o,advance:l}}function EG(){const t=R.useContext(MG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function ed(t=n=>n,e){return EG()(t,e)}function AG(t,e=0){const n=EG(),r=n.getState().internal.subscribe,i=vG(t);return xx(()=>r(i,e,n),[e,r,n]),null}const zg=new Map,{invalidate:LU,advance:DU}=Vbe(zg),{reconciler:j1,applyProps:Nm}=Rbe(zg,Dbe),Im={objects:"shallow",strict:!1},Gbe=(t,e)=>{const n=typeof t=="function"?t(e):t;return SG(n)?n:new E6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Wbe(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:a,updateStyle:o=n}=e;return{width:r,height:i,top:s,left:a,updateStyle:o}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:s,left:a}=t.parentElement.getBoundingClientRect();return{width:r,height:i,top:s,left:a,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 $be(t){const e=zg.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||Fbe(LU,DU),a=n||j1.createContainer(s,Km.ConcurrentRoot,null,!1,null,"",i,null);e||zg.set(t,{fiber:a,store:s});let o,l=!1,c;return{configure(d={}){let{gl:f,size:p,scene:y,events:b,onCreated:S,shadows:w=!1,linear:x=!1,flat:M=!1,legacy:T=!1,orthographic:P=!1,frameloop:O="always",dpr:N=[1,2],performance:D,raycaster:z,camera:V,onPointerMissed:k}=d,j=s.getState(),X=j.gl;j.gl||j.set({gl:X=Gbe(f,t)});let ee=j.raycaster;ee||j.set({raycaster:ee=new fG});const{params:ie,...pe}=z||{};if(sr.equ(pe,ee,Im)||Nm(ee,{...pe}),sr.equ(ie,ee.params,Im)||Nm(ee,{params:{...ee.params,...ie}}),!j.camera||j.camera===c&&!sr.equ(c,V,Im)){c=V;const Y=V instanceof fx,H=Y?V:P?new Gc(0,0,0,0,.1,1e3):new Pr(75,0,.1,1e3);Y||(H.position.z=5,V&&(Nm(H,V),("aspect"in V||"left"in V||"right"in V||"bottom"in V||"top"in V)&&(H.manual=!0,H.updateProjectionMatrix())),!j.camera&&!(V!=null&&V.rotation)&&H.lookAt(0,0,0)),j.set({camera:H}),ee.camera=H}if(!j.scene){let Y;y!=null&&y.isScene?Y=y:(Y=new IR,y&&Nm(Y,y)),j.set({scene:Fm(Y)})}if(!j.xr){var ae;const Y=(le,se)=>{const ce=s.getState();ce.frameloop!=="never"&&DU(le,!0,ce,se)},H=()=>{const le=s.getState();le.gl.xr.enabled=le.gl.xr.isPresenting,le.gl.xr.setAnimationLoop(le.gl.xr.isPresenting?Y:null),le.gl.xr.isPresenting||LU(le)},G={connect(){const le=s.getState().gl;le.xr.addEventListener("sessionstart",H),le.xr.addEventListener("sessionend",H)},disconnect(){const le=s.getState().gl;le.xr.removeEventListener("sessionstart",H),le.xr.removeEventListener("sessionend",H)}};typeof((ae=X.xr)==null?void 0:ae.addEventListener)=="function"&&G.connect(),j.set({xr:G})}if(X.shadowMap){const Y=X.shadowMap.enabled,H=X.shadowMap.type;if(X.shadowMap.enabled=!!w,sr.boo(w))X.shadowMap.type=Y0;else if(sr.str(w)){var he;const G={basic:_V,percentage:BS,soft:Y0,variance:Oo};X.shadowMap.type=(he=G[w])!=null?he:Y0}else sr.obj(w)&&Object.assign(X.shadowMap,w);(Y!==X.shadowMap.enabled||H!==X.shadowMap.type)&&(X.shadowMap.needsUpdate=!0)}const B=mG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Nm(X,{outputEncoding:x?3e3:3001,toneMapping:M?Tl:uR}),j.legacy!==T&&j.set(()=>({legacy:T})),j.linear!==x&&j.set(()=>({linear:x})),j.flat!==M&&j.set(()=>({flat:M})),f&&!sr.fun(f)&&!SG(f)&&!sr.equ(f,X,Im)&&Nm(X,f),b&&!j.events.handlers&&j.set({events:b(s)});const J=Wbe(t,p);return sr.equ(J,j.size,Im)||j.setSize(J.width,J.height,J.updateStyle,J.top,J.left),N&&j.viewport.dpr!==bG(N)&&j.setDpr(N),j.frameloop!==O&&j.setFrameloop(O),j.onPointerMissed||j.set({onPointerMissed:k}),D&&!sr.equ(D,j.performance,Im)&&j.set(Y=>({performance:{...Y.performance,...D}})),o=S,l=!0,this},render(d){return l||this.configure(),j1.updateContainer(v.jsx(Xbe,{store:s,children:d,onCreated:o,rootElement:t}),a,null,()=>{}),s},unmount(){TG(t)}}}function Xbe({store:t,children:e,onCreated:n,rootElement:r}){return xx(()=>{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)},[]),v.jsx(MG.Provider,{value:t,children:e})}function TG(t,e){const n=zg.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),j1.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,a,o,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(o=i.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),Obe(i),zg.delete(t)}catch{}},500)})}}j1.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 qbe(t){const{handlePointer:e}=jbe(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(a=>({events:{...a.events,connected:n}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([a,o])=>{const[l,c]=QA[a];n.addEventListener(l,o,{passive:c})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,a])=>{if(r&&r.connected instanceof HTMLElement){const[o]=QA[s];r.connected.removeEventListener(o,a)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function UU(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function Kbe({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,a]=R.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),o=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,p,y]=R.useMemo(()=>{const x=()=>{if(!o.current.element)return;const{left:M,top:T,width:P,height:O,bottom:N,right:D,x:z,y:V}=o.current.element.getBoundingClientRect(),k={left:M,top:T,width:P,height:O,bottom:N,right:D,x:z,y:V};o.current.element instanceof HTMLElement&&r&&(k.height=o.current.element.offsetHeight,k.width=o.current.element.offsetWidth),Object.freeze(k),d.current&&!Jbe(o.current.lastBounds,k)&&a(o.current.lastBounds=k)};return[x,c?UU(x,c):x,l?UU(x,l):x]},[a,r,l,c]);function b(){o.current.scrollContainers&&(o.current.scrollContainers.forEach(x=>x.removeEventListener("scroll",y,!0)),o.current.scrollContainers=null),o.current.resizeObserver&&(o.current.resizeObserver.disconnect(),o.current.resizeObserver=null),o.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",o.current.orientationHandler))}function S(){o.current.element&&(o.current.resizeObserver=new i(y),o.current.resizeObserver.observe(o.current.element),e&&o.current.scrollContainers&&o.current.scrollContainers.forEach(x=>x.addEventListener("scroll",y,{capture:!0,passive:!0})),o.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",o.current.orientationHandler))}const w=x=>{!x||x===o.current.element||(b(),o.current.element=x,o.current.scrollContainers=PG(x),S())};return Zbe(y,!!e),Ybe(p),R.useEffect(()=>{b(),S()},[e,y,p]),R.useEffect(()=>b,[]),[w,s,f]}function Ybe(t){R.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function Zbe(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 PG(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,...PG(t.parentElement)]}const Qbe=["x","y","top","bottom","left","right","width","height"],Jbe=(t,e)=>Qbe.every(n=>t[n]===e[n]);var e_e=Object.defineProperty,t_e=Object.defineProperties,n_e=Object.getOwnPropertyDescriptors,jU=Object.getOwnPropertySymbols,r_e=Object.prototype.hasOwnProperty,i_e=Object.prototype.propertyIsEnumerable,FU=(t,e,n)=>e in t?e_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,zU=(t,e)=>{for(var n in e||(e={}))r_e.call(e,n)&&FU(t,n,e[n]);if(jU)for(var n of jU(e))i_e.call(e,n)&&FU(t,n,e[n]);return t},s_e=(t,e)=>t_e(t,n_e(e)),BU,HU;typeof window<"u"&&((BU=window.document)!=null&&BU.createElement||((HU=window.navigator)==null?void 0:HU.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function CG(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=CG(r,e,n);if(i)return i;r=r.sibling}}function RG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const VU=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=VU;return}return VU.apply(this,arguments)};const iN=RG(R.createContext(null));class NG extends R.Component{render(){return R.createElement(iN.Provider,{value:this._reactInternals},this.props.children)}}function a_e(){const t=R.useContext(iN);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=CG(r,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(i)return i}},[t,e])}function o_e(){const t=a_e(),[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!==iN&&!e.has(i)&&e.set(i,R.useContext(RG(i)))}n=n.return}return e}function l_e(){const t=o_e();return R.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>R.createElement(e,null,R.createElement(n.Provider,s_e(zU({},r),{value:t.get(n)}))),e=>R.createElement(NG,zU({},e))),[t])}const c_e=R.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:a=qbe,eventSource:o,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:p,orthographic:y,frameloop:b,dpr:S,performance:w,raycaster:x,camera:M,scene:T,onPointerMissed:P,onCreated:O,...N},D){R.useMemo(()=>Cbe(mbe),[]);const z=l_e(),[V,k]=Kbe({scroll:!0,debounce:{scroll:50,resize:0},...r}),j=R.useRef(null),X=R.useRef(null);R.useImperativeHandle(D,()=>j.current);const ee=vG(P),[ie,pe]=R.useState(!1),[ae,he]=R.useState(!1);if(ie)throw ie;if(ae)throw ae;const B=R.useRef(null);xx(()=>{const Y=j.current;k.width>0&&k.height>0&&Y&&(B.current||(B.current=$be(Y)),B.current.configure({gl:s,events:a,shadows:c,linear:d,flat:f,legacy:p,orthographic:y,frameloop:b,dpr:S,performance:w,raycaster:x,camera:M,scene:T,size:k,onPointerMissed:(...H)=>ee.current==null?void 0:ee.current(...H),onCreated:H=>{H.events.connect==null||H.events.connect(o?Nbe(o)?o.current:o:X.current),l&&H.setEvents({compute:(G,le)=>{const se=G[l+"X"],ce=G[l+"Y"];le.pointer.set(se/le.size.width*2-1,-(ce/le.size.height)*2+1),le.raycaster.setFromCamera(le.pointer,le.camera)}}),O==null||O(H)}}),B.current.render(v.jsx(z,{children:v.jsx(yG,{set:he,children:v.jsx(R.Suspense,{fallback:v.jsx(Ibe,{set:pe}),children:e??null})})})))}),R.useEffect(()=>{const Y=j.current;if(Y)return()=>TG(Y)},[]);const J=o?"none":"auto";return v.jsx("div",{ref:X,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:J,...i},...N,children:v.jsx("div",{ref:V,style:{width:"100%",height:"100%"},children:v.jsx("canvas",{ref:j,style:{display:"block"},children:n})})})}),u_e=R.forwardRef(function(e,n){return v.jsx(NG,{children:v.jsx(c_e,{...e,ref:n})})});function aC(){return aC=Object.assign?Object.assign.bind():function(t){for(var e=1;ee in t?d_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,h_e=(t,e,n)=>(f_e(t,e+"",n),n);class p_e{constructor(){h_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,a=i.length;se in t?m_e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Wt=(t,e,n)=>(g_e(t,typeof e!="symbol"?e+"":e,n),n);const k_=new ep,GU=new Rc,v_e=Math.cos(70*(Math.PI/180)),WU=(t,e)=>(t%e+e)%e;let y_e=class extends p_e{constructor(e,n){super(),Wt(this,"object"),Wt(this,"domElement"),Wt(this,"enabled",!0),Wt(this,"target",new q),Wt(this,"minDistance",0),Wt(this,"maxDistance",1/0),Wt(this,"minZoom",0),Wt(this,"maxZoom",1/0),Wt(this,"minPolarAngle",0),Wt(this,"maxPolarAngle",Math.PI),Wt(this,"minAzimuthAngle",-1/0),Wt(this,"maxAzimuthAngle",1/0),Wt(this,"enableDamping",!1),Wt(this,"dampingFactor",.05),Wt(this,"enableZoom",!0),Wt(this,"zoomSpeed",1),Wt(this,"enableRotate",!0),Wt(this,"rotateSpeed",1),Wt(this,"enablePan",!0),Wt(this,"panSpeed",1),Wt(this,"screenSpacePanning",!0),Wt(this,"keyPanSpeed",7),Wt(this,"zoomToCursor",!1),Wt(this,"autoRotate",!1),Wt(this,"autoRotateSpeed",2),Wt(this,"reverseOrbit",!1),Wt(this,"reverseHorizontalOrbit",!1),Wt(this,"reverseVerticalOrbit",!1),Wt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Wt(this,"mouseButtons",{LEFT:Kf.ROTATE,MIDDLE:Kf.DOLLY,RIGHT:Kf.PAN}),Wt(this,"touches",{ONE:Yf.ROTATE,TWO:Yf.DOLLY_PAN}),Wt(this,"target0"),Wt(this,"position0"),Wt(this,"zoom0"),Wt(this,"_domElementKeyEvents",null),Wt(this,"getPolarAngle"),Wt(this,"getAzimuthalAngle"),Wt(this,"setPolarAngle"),Wt(this,"setAzimuthalAngle"),Wt(this,"getDistance"),Wt(this,"getZoomScale"),Wt(this,"listenToKeyEvents"),Wt(this,"stopListenToKeyEvents"),Wt(this,"saveState"),Wt(this,"reset"),Wt(this,"update"),Wt(this,"connect"),Wt(this,"dispose"),Wt(this,"dollyIn"),Wt(this,"dollyOut"),Wt(this,"getScale"),Wt(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=fe=>{let qe=WU(fe,2*Math.PI),ue=d.phi;ue<0&&(ue+=2*Math.PI),qe<0&&(qe+=2*Math.PI);let Ye=Math.abs(qe-ue);2*Math.PI-Ye{let qe=WU(fe,2*Math.PI),ue=d.theta;ue<0&&(ue+=2*Math.PI),qe<0&&(qe+=2*Math.PI);let Ye=Math.abs(qe-ue);2*Math.PI-Yer.object.position.distanceTo(r.target),this.listenToKeyEvents=fe=>{fe.addEventListener("keydown",ht),this._domElementKeyEvents=fe},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=o.NONE},this.update=(()=>{const fe=new q,qe=new q(0,1,0),ue=new qt().setFromUnitVectors(e.up,qe),Ye=ue.clone().invert(),Re=new q,Be=new qt,at=2*Math.PI;return function(){const Jt=r.object.position;ue.setFromUnitVectors(e.up,qe),Ye.copy(ue).invert(),fe.copy(Jt).sub(r.target),fe.applyQuaternion(ue),d.setFromVector3(fe),r.autoRotate&&l===o.NONE&&ie(X()),r.enableDamping?(d.theta+=f.theta*r.dampingFactor,d.phi+=f.phi*r.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let pn=r.minAzimuthAngle,jn=r.maxAzimuthAngle;isFinite(pn)&&isFinite(jn)&&(pn<-Math.PI?pn+=at:pn>Math.PI&&(pn-=at),jn<-Math.PI?jn+=at:jn>Math.PI&&(jn-=at),pn<=jn?d.theta=Math.max(pn,Math.min(jn,d.theta)):d.theta=d.theta>(pn+jn)/2?Math.max(pn,d.theta):Math.min(jn,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&&V||r.object.isOrthographicCamera?d.radius=le(d.radius):d.radius=le(d.radius*p),fe.setFromSpherical(d),fe.applyQuaternion(Ye),Jt.copy(r.target).add(fe),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 en=!1;if(r.zoomToCursor&&V){let Hn=null;if(r.object instanceof Pr&&r.object.isPerspectiveCamera){const pr=fe.length();Hn=le(pr*p);const Mi=pr-Hn;r.object.position.addScaledVector(D,Mi),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const pr=new q(z.x,z.y,0);pr.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),en=!0;const Mi=new q(z.x,z.y,0);Mi.unproject(r.object),r.object.position.sub(Mi).add(pr),r.object.updateMatrixWorld(),Hn=fe.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Hn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Hn).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-Be.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Re.copy(r.object.position),Be.copy(r.object.quaternion),en=!1,!0):!1}})(),this.connect=fe=>{r.domElement=fe,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",te),r.domElement.addEventListener("pointerdown",be),r.domElement.addEventListener("pointercancel",ze),r.domElement.addEventListener("wheel",rt)},this.dispose=()=>{var fe,qe,ue,Ye,Re,Be;r.domElement&&(r.domElement.style.touchAction="auto"),(fe=r.domElement)==null||fe.removeEventListener("contextmenu",te),(qe=r.domElement)==null||qe.removeEventListener("pointerdown",be),(ue=r.domElement)==null||ue.removeEventListener("pointercancel",ze),(Ye=r.domElement)==null||Ye.removeEventListener("wheel",rt),(Re=r.domElement)==null||Re.ownerDocument.removeEventListener("pointermove",Ue),(Be=r.domElement)==null||Be.ownerDocument.removeEventListener("pointerup",ze),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ht)};const r=this,i={type:"change"},s={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=o.NONE;const c=1e-6,d=new rC,f=new rC;let p=1;const y=new q,b=new He,S=new He,w=new He,x=new He,M=new He,T=new He,P=new He,O=new He,N=new He,D=new q,z=new He;let V=!1;const k=[],j={};function X(){return 2*Math.PI/60/60*r.autoRotateSpeed}function ee(){return Math.pow(.95,r.zoomSpeed)}function ie(fe){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=fe:f.theta-=fe}function pe(fe){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=fe:f.phi-=fe}const ae=(()=>{const fe=new q;return function(ue,Ye){fe.setFromMatrixColumn(Ye,0),fe.multiplyScalar(-ue),y.add(fe)}})(),he=(()=>{const fe=new q;return function(ue,Ye){r.screenSpacePanning===!0?fe.setFromMatrixColumn(Ye,1):(fe.setFromMatrixColumn(Ye,0),fe.crossVectors(r.object.up,fe)),fe.multiplyScalar(ue),y.add(fe)}})(),B=(()=>{const fe=new q;return function(ue,Ye){const Re=r.domElement;if(Re&&r.object instanceof Pr&&r.object.isPerspectiveCamera){const Be=r.object.position;fe.copy(Be).sub(r.target);let at=fe.length();at*=Math.tan(r.object.fov/2*Math.PI/180),ae(2*ue*at/Re.clientHeight,r.object.matrix),he(2*Ye*at/Re.clientHeight,r.object.matrix)}else Re&&r.object instanceof Gc&&r.object.isOrthographicCamera?(ae(ue*(r.object.right-r.object.left)/r.object.zoom/Re.clientWidth,r.object.matrix),he(Ye*(r.object.top-r.object.bottom)/r.object.zoom/Re.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function J(fe){r.object instanceof Pr&&r.object.isPerspectiveCamera||r.object instanceof Gc&&r.object.isOrthographicCamera?p=fe:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function Y(fe){J(p/fe)}function H(fe){J(p*fe)}function G(fe){if(!r.zoomToCursor||!r.domElement)return;V=!0;const qe=r.domElement.getBoundingClientRect(),ue=fe.clientX-qe.left,Ye=fe.clientY-qe.top,Re=qe.width,Be=qe.height;z.x=ue/Re*2-1,z.y=-(Ye/Be)*2+1,D.set(z.x,z.y,1).unproject(r.object).sub(r.object.position).normalize()}function le(fe){return Math.max(r.minDistance,Math.min(r.maxDistance,fe))}function se(fe){b.set(fe.clientX,fe.clientY)}function ce(fe){G(fe),P.set(fe.clientX,fe.clientY)}function Se(fe){x.set(fe.clientX,fe.clientY)}function we(fe){S.set(fe.clientX,fe.clientY),w.subVectors(S,b).multiplyScalar(r.rotateSpeed);const qe=r.domElement;qe&&(ie(2*Math.PI*w.x/qe.clientHeight),pe(2*Math.PI*w.y/qe.clientHeight)),b.copy(S),r.update()}function We(fe){O.set(fe.clientX,fe.clientY),N.subVectors(O,P),N.y>0?Y(ee()):N.y<0&&H(ee()),P.copy(O),r.update()}function Ee(fe){M.set(fe.clientX,fe.clientY),T.subVectors(M,x).multiplyScalar(r.panSpeed),B(T.x,T.y),x.copy(M),r.update()}function Ge(fe){G(fe),fe.deltaY<0?H(ee()):fe.deltaY>0&&Y(ee()),r.update()}function $e(fe){let qe=!1;switch(fe.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&&(fe.preventDefault(),r.update())}function de(){if(k.length==1)b.set(k[0].pageX,k[0].pageY);else{const fe=.5*(k[0].pageX+k[1].pageX),qe=.5*(k[0].pageY+k[1].pageY);b.set(fe,qe)}}function Z(){if(k.length==1)x.set(k[0].pageX,k[0].pageY);else{const fe=.5*(k[0].pageX+k[1].pageX),qe=.5*(k[0].pageY+k[1].pageY);x.set(fe,qe)}}function Ve(){const fe=k[0].pageX-k[1].pageX,qe=k[0].pageY-k[1].pageY,ue=Math.sqrt(fe*fe+qe*qe);P.set(0,ue)}function Le(){r.enableZoom&&Ve(),r.enablePan&&Z()}function ne(){r.enableZoom&&Ve(),r.enableRotate&&de()}function Ce(fe){if(k.length==1)S.set(fe.pageX,fe.pageY);else{const ue=Zt(fe),Ye=.5*(fe.pageX+ue.x),Re=.5*(fe.pageY+ue.y);S.set(Ye,Re)}w.subVectors(S,b).multiplyScalar(r.rotateSpeed);const qe=r.domElement;qe&&(ie(2*Math.PI*w.x/qe.clientHeight),pe(2*Math.PI*w.y/qe.clientHeight)),b.copy(S)}function Xe(fe){if(k.length==1)M.set(fe.pageX,fe.pageY);else{const qe=Zt(fe),ue=.5*(fe.pageX+qe.x),Ye=.5*(fe.pageY+qe.y);M.set(ue,Ye)}T.subVectors(M,x).multiplyScalar(r.panSpeed),B(T.x,T.y),x.copy(M)}function Ze(fe){const qe=Zt(fe),ue=fe.pageX-qe.x,Ye=fe.pageY-qe.y,Re=Math.sqrt(ue*ue+Ye*Ye);O.set(0,Re),N.set(0,Math.pow(O.y/P.y,r.zoomSpeed)),Y(N.y),P.copy(O)}function Q(fe){r.enableZoom&&Ze(fe),r.enablePan&&Xe(fe)}function W(fe){r.enableZoom&&Ze(fe),r.enableRotate&&Ce(fe)}function be(fe){var qe,ue;r.enabled!==!1&&(k.length===0&&((qe=r.domElement)==null||qe.ownerDocument.addEventListener("pointermove",Ue),(ue=r.domElement)==null||ue.ownerDocument.addEventListener("pointerup",ze)),tt(fe),fe.pointerType==="touch"?Xt(fe):Fe(fe))}function Ue(fe){r.enabled!==!1&&(fe.pointerType==="touch"?Ke(fe):bt(fe))}function ze(fe){var qe,ue,Ye;Mt(fe),k.length===0&&((qe=r.domElement)==null||qe.releasePointerCapture(fe.pointerId),(ue=r.domElement)==null||ue.ownerDocument.removeEventListener("pointermove",Ue),(Ye=r.domElement)==null||Ye.ownerDocument.removeEventListener("pointerup",ze)),r.dispatchEvent(a),l=o.NONE}function Fe(fe){let qe;switch(fe.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 Kf.DOLLY:if(r.enableZoom===!1)return;ce(fe),l=o.DOLLY;break;case Kf.ROTATE:if(fe.ctrlKey||fe.metaKey||fe.shiftKey){if(r.enablePan===!1)return;Se(fe),l=o.PAN}else{if(r.enableRotate===!1)return;se(fe),l=o.ROTATE}break;case Kf.PAN:if(fe.ctrlKey||fe.metaKey||fe.shiftKey){if(r.enableRotate===!1)return;se(fe),l=o.ROTATE}else{if(r.enablePan===!1)return;Se(fe),l=o.PAN}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function bt(fe){if(r.enabled!==!1)switch(l){case o.ROTATE:if(r.enableRotate===!1)return;we(fe);break;case o.DOLLY:if(r.enableZoom===!1)return;We(fe);break;case o.PAN:if(r.enablePan===!1)return;Ee(fe);break}}function rt(fe){r.enabled===!1||r.enableZoom===!1||l!==o.NONE&&l!==o.ROTATE||(fe.preventDefault(),r.dispatchEvent(s),Ge(fe),r.dispatchEvent(a))}function ht(fe){r.enabled===!1||r.enablePan===!1||$e(fe)}function Xt(fe){switch(vt(fe),k.length){case 1:switch(r.touches.ONE){case Yf.ROTATE:if(r.enableRotate===!1)return;de(),l=o.TOUCH_ROTATE;break;case Yf.PAN:if(r.enablePan===!1)return;Z(),l=o.TOUCH_PAN;break;default:l=o.NONE}break;case 2:switch(r.touches.TWO){case Yf.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Le(),l=o.TOUCH_DOLLY_PAN;break;case Yf.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;ne(),l=o.TOUCH_DOLLY_ROTATE;break;default:l=o.NONE}break;default:l=o.NONE}l!==o.NONE&&r.dispatchEvent(s)}function Ke(fe){switch(vt(fe),l){case o.TOUCH_ROTATE:if(r.enableRotate===!1)return;Ce(fe),r.update();break;case o.TOUCH_PAN:if(r.enablePan===!1)return;Xe(fe),r.update();break;case o.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Q(fe),r.update();break;case o.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;W(fe),r.update();break;default:l=o.NONE}}function te(fe){r.enabled!==!1&&fe.preventDefault()}function tt(fe){k.push(fe)}function Mt(fe){delete j[fe.pointerId];for(let qe=0;qe{H(fe),r.update()},this.dollyOut=(fe=ee())=>{Y(fe),r.update()},this.getScale=()=>p,this.setScale=fe=>{J(fe),r.update()},this.getZoomScale=()=>ee(),n!==void 0&&this.connect(n),this.update()}};const x_e=R.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:a,onStart:o,onEnd:l,...c},d)=>{const f=ed(N=>N.invalidate),p=ed(N=>N.camera),y=ed(N=>N.gl),b=ed(N=>N.events),S=ed(N=>N.setEvents),w=ed(N=>N.set),x=ed(N=>N.get),M=ed(N=>N.performance),T=e||p,P=r||b.connected||y.domElement,O=R.useMemo(()=>new y_e(T),[T]);return AG(()=>{O.enabled&&O.update()},-1),R.useEffect(()=>(s&&O.connect(s===!0?P:s),O.connect(P),()=>void O.dispose()),[s,P,n,O,f]),R.useEffect(()=>{const N=V=>{f(),n&&M.regress(),a&&a(V)},D=V=>{o&&o(V)},z=V=>{l&&l(V)};return O.addEventListener("change",N),O.addEventListener("start",D),O.addEventListener("end",z),()=>{O.removeEventListener("start",D),O.removeEventListener("end",z),O.removeEventListener("change",N)}},[a,o,l,O,f,S]),R.useEffect(()=>{if(t){const N=x().controls;return w({controls:O}),()=>w({controls:N})}},[t,O]),R.createElement("primitive",aC({ref:d,object:O,enableDamping:i},c))});function $U(t,e){if(e===QV)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===O1||e===_R){let n=t.getIndex();if(n===null){const a=[],o=t.getAttribute("position");if(o!==void 0){for(let l=0;l=2.0 are supported."));return}const c=new J_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&&o[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(a),c.setPlugins(o),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function __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 vn={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 w_e{constructor(e){this.parser=e,this.name=vn.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,a)}}class D_e{constructor(e){this.parser=e,this.name=vn.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 a=s.extensions[n],o=i.images[a.source];let l=r.textureLoader;if(o.uri){const c=r.options.manager.getHandler(o.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,a.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 U_e{constructor(e){this.parser=e,this.name=vn.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 a=s.extensions[n],o=i.images[a.source];let l=r.textureLoader;if(o.uri){const c=r.options.manager.getHandler(o.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,a.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 j_e{constructor(e){this.name=vn.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),a=this.parser.options.meshoptDecoder;if(!a||!a.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(o){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,f=i.byteStride,p=new Uint8Array(o,l,c);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(d,f,p,i.mode,i.filter).then(function(y){return y.buffer}):a.ready.then(function(){const y=new ArrayBuffer(d*f);return a.decodeGltfBuffer(new Uint8Array(y),d,f,p,i.mode,i.filter),y})})}else return null}}class F_e{constructor(e){this.name=vn.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!==Ba.TRIANGLES&&c.mode!==Ba.TRIANGLE_STRIP&&c.mode!==Ba.TRIANGLE_FAN&&c.mode!==void 0)return null;const a=r.extensions[this.name].attributes,o=[],l={};for(const c in a)o.push(this.parser.getDependency("accessor",a[c]).then(d=>(l[c]=d,l[c])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(c=>{const d=c.pop(),f=d.isGroup?d.children:[d],p=c[0].count,y=[];for(const b of f){const S=new Ct,w=new q,x=new qt,M=new q(1,1,1),T=new OR(b.geometry,b.material,p);for(let P=0;P0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Q_e=new Ct;class J_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new __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,a=-1;if(typeof navigator<"u"){const o=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(o)===!0;const l=o.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=o.indexOf("Firefox")>-1,a=s?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&a<98?this.textureLoader=new eG(this.options.manager):this.textureLoader=new lG(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Go(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(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:r,userData:{}};return Bf(s,o,i),Pc(o,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(o)})).then(function(){for(const l of o.scenes)l.updateMatrixWorld();e(o)})}).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(a);l!=null&&this.associations.set(o,l);for(const[c,d]of a.children.entries())s(d,o.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(V,N[D*l+1]),l>=3&&w.setZ(V,N[D*l+2]),l>=4&&w.setW(V,N[D*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}w.normalized=b}return w})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,a=n.images[s];let o=this.textureLoader;if(a.uri){const l=r.manager.getHandler(a.uri);l!==null&&(o=l)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,n,r){const i=this,s=this.json,a=s.textures[e],o=s.images[n],l=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(d){d.flipY=!1,d.name=a.name||o.name||"",d.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(d.name=o.uri);const p=(s.samplers||{})[a.sampler]||{};return d.magFilter=qU[p.magFilter]||Cr,d.minFilter=qU[p.minFilter]||$a,d.wrapS=KU[p.wrapS]||Rd,d.wrapT=KU[p.wrapT]||Rd,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 a=i.images[e],o=self.URL||self.webkitURL;let l=a.uri||"",c=!1;if(a.bufferView!==void 0)l=r.getDependency("bufferView",a.bufferView).then(function(f){c=!0;const p=new Blob([f],{type:a.mimeType});return l=o.createObjectURL(p),l});else if(a.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(p,y){let b=p;n.isImageBitmapLoader===!0&&(b=function(S){const w=new fr(S);w.needsUpdate=!0,p(w)}),n.load(Sd.resolveURL(f,s.path),b,void 0,y)})}).then(function(f){return c===!0&&o.revokeObjectURL(l),Pc(f,a),f.userData.mimeType=a.mimeType||Z_e(a.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(a){if(!a)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(a=a.clone(),a.channel=r.texCoord),s.extensions[vn.KHR_TEXTURE_TRANSFORM]){const o=r.extensions!==void 0?r.extensions[vn.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const l=s.associations.get(a);a=s.extensions[vn.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,l)}}return i!==void 0&&(a.colorSpace=i),e[n]=a,a})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,a=n.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+r.uuid;let l=this.cache.get(o);l||(l=new iM,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(o,l)),r=l}else if(e.isLine){const o="LineBasicMaterial:"+r.uuid;let l=this.cache.get(o);l||(l=new $r,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(o,l)),r=l}if(i||s||a){let o="ClonedMaterial:"+r.uuid+":";i&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let l=this.cache.get(o);l||(l=r.clone(),s&&(l.vertexColors=!0),a&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(o,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return yx}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let a;const o={},l=s.extensions||{},c=[];if(l[vn.KHR_MATERIALS_UNLIT]){const f=i[vn.KHR_MATERIALS_UNLIT];a=f.getMaterialType(),c.push(f.extendParams(o,s,n))}else{const f=s.pbrMetallicRoughness||{};if(o.color=new ct(1,1,1),o.opacity=1,Array.isArray(f.baseColorFactor)){const p=f.baseColorFactor;o.color.setRGB(p[0],p[1],p[2],xi),o.opacity=p[3]}f.baseColorTexture!==void 0&&c.push(n.assignTexture(o,"map",f.baseColorTexture,Fi)),o.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,o.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(o,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(o,"roughnessMap",f.metallicRoughnessTexture))),a=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=ya);const d=s.alphaMode||eT.OPAQUE;if(d===eT.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,d===eT.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==As&&(c.push(n.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new He(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;o.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&a!==As&&(c.push(n.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==As){const f=s.emissiveFactor;o.emissive=new ct().setRGB(f[0],f[1],f[2],xi)}return s.emissiveTexture!==void 0&&a!==As&&c.push(n.assignTexture(o,"emissiveMap",s.emissiveTexture,Fi)),Promise.all(c).then(function(){const f=new a(o);return s.name&&(f.name=s.name),Pc(f,s),n.associations.set(f,{materials:e}),s.extensions&&Bf(i,f,s),f})}createUniqueName(e){const n=Rn.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(o){return r[vn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,n).then(function(l){return YU(l,o,n)})}const a=[];for(let o=0,l=e.length;o0&&K_e(x,s),x.name=n.createUniqueName(s.name||"mesh_"+e),Pc(x,s),w.extensions&&Bf(i,x,w),n.assignFinalMaterial(x),f.push(x)}for(let y=0,b=f.length;y1?d=new Ts:c.length===1?d=c[0]:d=new mn,d!==c[0])for(let f=0,p=c.length;f{const f=new Map;for(const[p,y]of i.associations)(p instanceof Gr||p instanceof fr)&&f.set(p,y);return d.traverse(p=>{const y=i.associations.get(p);y!=null&&f.set(p,y)}),f};return i.associations=c(s),s})}_createAnimationTracks(e,n,r,i,s){const a=[],o=e.name?e.name:e.uuid,l=[];td[s.path]===td.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(o);let c;switch(td[s.path]){case td.weights:c=Wh;break;case td.rotation:c=$h;break;case td.position:case td.scale:c=Xh;break;default:switch(r.itemSize){case 1:c=Wh;break;case 2:case 3:default:c=Xh;break}break}const d=i.interpolation!==void 0?$_e[i.interpolation]:Lg,f=this._getArrayFromAccessor(r);for(let p=0,y=l.length;pnew Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),Dn=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),ZU=class extends mn{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 kG(t,e,n){var r,i;const s=t.parser.json,a=(r=s.nodes)==null?void 0:r[e];if(a==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const o=a.mesh;if(o==null)return null;const l=(i=s.meshes)==null?void 0:i[o];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${o}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,d=[];return n.traverse(f=>{d.length{const s=kG(t,i,r);s!=null&&n.set(i,s)}),n})}var cC={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 OG(t){return Math.max(Math.min(t,1),0)}var ej=class LG{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(cC));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(cC));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 LG().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=OG(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"},ewe={_Color:k0.Color,_EmissionColor:k0.EmissionColor,_ShadeColor:k0.ShadeColor,_RimColor:k0.RimColor,_OutlineColor:k0.OutlineColor},twe=new ct,DG=class UG{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(),a=this._initAlphaBindState();this._state={color:s,alpha:a}}applyWeight(e){const{color:n,alpha:r}=this._state;if(n!=null){const{propertyName:i,deltaValue:s}=n,a=this.material[i];a!=null&&a.add(twe.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:a}=this,o=this._getPropertyNameMap(),l=(n=(e=o==null?void 0:o[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 ct(a.r-d.r,a.g-d.g,a.b-d.b);return{propertyName:l,initialValue:d,deltaValue:f}}_initAlphaBindState(){var e,n,r;const{material:i,type:s,targetAlpha:a}=this,o=this._getPropertyNameMap(),l=(n=(e=o==null?void 0:o[s])==null?void 0:e[1])!=null?n:null;if(l==null&&a!==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=a-c;return{propertyName:l,initialValue:c,deltaValue:d}}_getPropertyNameMap(){var e,n;return(n=(e=Object.entries(UG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};DG._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 tj=DG,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)})}},nj=new He,jG=class FG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const a=(i=Object.entries(FG._propertyNamesMap).find(([o])=>e[o]===!0))==null?void 0:i[1];a==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=[],a.forEach(o=>{var l;const c=(l=e[o])==null?void 0:l.clone();if(!c)return null;e[o]=c;const d=c.offset.clone(),f=c.repeat.clone(),p=r.clone().sub(d),y=n.clone().sub(f);this._properties.push({name:o,initialOffset:d,deltaOffset:p,initialScale:f,deltaScale:y})}))}applyWeight(e){this._properties.forEach(n=>{const r=this.material[n.name];r!==void 0&&(r.offset.add(nj.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(nj.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 rj=jG,nwe=new Set(["1.0","1.0-beta"]),zG=class BG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return Dn(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return Dn(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 Dn(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 a=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!a)return null;const o=a.specVersion;if(!nwe.has(o))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const l=a.expressions;if(!l)return null;const c=new Set(Object.values(cC)),d=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([p,y])=>{if(y!=null){if(!c.has(p)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${p}" detected. Ignoring the expression`);return}d.set(p,y)}}),l.custom!=null&&Object.entries(l.custom).forEach(([p,y])=>{if(c.has(p)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${p}". Ignoring the expression`);return}d.set(p,y)});const f=new ej;return yield Promise.all(Array.from(d.entries()).map(p=>Dn(this,[p],function*([y,b]){var S,w,x,M,T,P,O;const N=new ZU(y);if(e.scene.add(N),N.isBinary=(S=b.isBinary)!=null?S:!1,N.overrideBlink=(w=b.overrideBlink)!=null?w:"none",N.overrideLookAt=(x=b.overrideLookAt)!=null?x:"none",N.overrideMouth=(M=b.overrideMouth)!=null?M:"none",(T=b.morphTargetBinds)==null||T.forEach(D=>Dn(this,null,function*(){var z;if(D.node===void 0||D.index===void 0)return;const V=yield QU(e,D.node),k=D.index;if(!V.every(j=>Array.isArray(j.morphTargetInfluences)&&k{const V=z.material;V&&(Array.isArray(V)?D.push(...V):D.push(V))}),(P=b.materialColorBinds)==null||P.forEach(z=>Dn(this,null,function*(){D.filter(k=>{var j;const X=(j=this.parser.associations.get(k))==null?void 0:j.materials;return z.material===X}).forEach(k=>{N.addBind(new tj({material:k,type:z.type,targetValue:new ct().fromArray(z.targetValue),targetAlpha:z.targetValue[3]}))})})),(O=b.textureTransformBinds)==null||O.forEach(z=>Dn(this,null,function*(){D.filter(k=>{var j;const X=(j=this.parser.associations.get(k))==null?void 0:j.materials;return z.material===X}).forEach(k=>{var j,X;N.addBind(new rj({material:k,offset:new He().fromArray((j=z.offset)!=null?j:[0,0]),scale:new He().fromArray((X=z.scale)!=null?X:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return Dn(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 a=new ej,o=s.blendShapeGroups;if(!o)return a;const l=new Set;return yield Promise.all(o.map(c=>Dn(this,null,function*(){var d;const f=c.presetName,p=f!=null&&BG.v0v1PresetNameMap[f]||null,y=p??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 b=new ZU(y);e.scene.add(b),b.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(w=>Dn(this,null,function*(){var x;if(w.mesh===void 0||w.index===void 0)return;const M=[];if((x=r.nodes)==null||x.forEach((P,O)=>{P.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(P=>Dn(this,null,function*(){var O;const N=yield QU(e,P);if(!N.every(D=>Array.isArray(D.morphTargetInfluences)&&T{if(w.materialName===void 0||w.propertyName===void 0||w.targetValue===void 0)return;const x=[];e.scene.traverse(T=>{if(T.material){const P=T.material;Array.isArray(P)?x.push(...P.filter(O=>(O.name===w.materialName||O.name===w.materialName+" (Outline)")&&x.indexOf(O)===-1)):P.name===w.materialName&&x.indexOf(P)===-1&&x.push(P)}});const M=w.propertyName;x.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,b.addBind(new rj({material:T,scale:O,offset:N}));return}const P=ewe[M];if(P){b.addBind(new tj({material:T,type:P,targetValue:new ct().fromArray(w.targetValue),targetAlpha:w.targetValue[3]}));return}console.warn(M+" is not supported")})}),a.registerExpression(b)}))),a})}};zG.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 rwe=zG,sN=class Bm{constructor(e,n){this._firstPersonOnlyLayer=Bm.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Bm.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 Bm(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Bm.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:n=Bm.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 a=0;a0&&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 p=n[l],y=r[l];if(p[0]>0&&i.includes(y[0])||p[1]>0&&i.includes(y[1])||p[2]>0&&i.includes(y[2])||p[3]>0&&i.includes(y[3]))continue;const b=n[c],S=r[c];b[0]>0&&i.includes(S[0])||b[1]>0&&i.includes(S[1])||b[2]>0&&i.includes(S[2])||b[3]>0&&i.includes(S[3])||(e[s++]=o,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,n){const r=new nM(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"),a=s instanceof tC?[]:s.array,o=[];for(let S=0;S{this._isEraseTarget(s)&&r.push(a)}),!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 Ts;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}};sN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;sN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var ij=sN,iwe=new Set(["1.0","1.0-beta"]),swe=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return Dn(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 Dn(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 Dn(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 a=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!a)return null;const o=a.specVersion;if(!iwe.has(o))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const l=a.firstPerson,c=[],d=yield JU(t);return Array.from(d.entries()).forEach(([f,p])=>{var y,b;const S=(y=l==null?void 0:l.meshAnnotations)==null?void 0:y.find(w=>w.node===f);c.push({meshes:p,type:(b=S==null?void 0:S.type)!=null?b:"auto"})}),new ij(e,c)})}_v0Import(t,e){return Dn(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 a=[],o=yield JU(t);return Array.from(o.entries()).forEach(([l,c])=>{const d=r.nodes[l],f=s.meshAnnotations?s.meshAnnotations.find(p=>p.mesh===d.mesh):void 0;a.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new ij(e,a)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},sj=new q,aj=new q,awe=new qt,oj=class extends Ts{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new hG(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(sj,awe,aj);const r=sj.set(.1,.1,.1).divide(aj);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"],owe={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 HG(t){return t.invert?t.invert():t.inverse(),t}var Hf=new q,Vf=new qt,uC=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&&(Hf.copy(r.position),Vf.copy(r.quaternion),t[n]={position:Hf.toArray(),rotation:Vf.toArray()})}),t}getPose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);if(!r)return;Hf.set(0,0,0),Vf.identity();const i=this.restPose[n];i!=null&&i.position&&Hf.fromArray(i.position).negate(),i!=null&&i.rotation&&HG(Vf.fromArray(i.rotation)),Hf.add(r.position),Vf.premultiply(r.quaternion),t[n]={position:Hf.toArray(),rotation:Vf.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(Hf.fromArray(s.position))),n!=null&&n.rotation&&(i.quaternion.fromArray(n.rotation),s.rotation&&i.quaternion.multiply(Vf.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 q,lwe=new qt,cwe=new q,lj=class VG extends uC{static _setupTransforms(e){const n=new mn;n.name="VRMHumanoidRig";const r={},i={},s={};nT.forEach(o=>{var l;const c=e.getBoneNode(o);if(c){const d=new q,f=new qt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(d,f,rT),r[o]=d,i[o]=c.quaternion.clone();const p=new qt;(l=c.parent)==null||l.matrixWorld.decompose(rT,p,rT),s[o]=p}});const a={};return nT.forEach(o=>{var l;const c=e.getBoneNode(o);if(c){const d=r[o];let f=o,p;for(;p==null&&(f=owe[f],f!=null);)p=r[f];const y=new mn;y.name="Normalized_"+c.name,(f?(l=a[f])==null?void 0:l.node:n).add(y),y.position.copy(d),p&&y.position.sub(p),a[o]={node:y}}}),{rigBones:a,root:n,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:s}=VG._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=lwe.copy(i).invert(),a=this._boneRotations[e];if(n.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(a),e==="hips"){const o=r.getWorldPosition(cwe);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=o.applyMatrix4(l.invert());n.position.copy(c)}}})}},cj=class GG{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 uC(e),this._normalizedHumanBones=new lj(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new uC(e.humanBones),this._normalizedHumanBones=new lj(this._rawHumanBones),this}clone(){return new GG(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()}},uwe={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"},dwe=new Set(["1.0","1.0-beta"]),uj={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},fwe=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 Dn(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return Dn(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 Dn(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 a=s.specVersion;if(!dwe.has(a))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const o=s.humanoid;if(!o)return null;const l=o.humanBones.leftThumbIntermediate!=null||o.humanBones.rightThumbIntermediate!=null,c={};o.humanBones!=null&&(yield Promise.all(Object.entries(o.humanBones).map(f=>Dn(this,[f],function*([p,y]){let b=p;const S=y.node;if(l){const x=uj[b];x!=null&&(b=x)}const w=yield this.parser.getDependency("node",S);if(w==null){console.warn(`A glTF node bound to the humanoid bone ${b} (index = ${S}) does not exist`);return}c[b]={node:w}}))));const d=new cj(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new oj(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return Dn(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(o=>Dn(this,null,function*(){const l=o.bone,c=o.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=uj[l],p=f??l;if(s[p]!=null){console.warn(`Multiple bone entries for ${p} detected (index = ${c}), ignoring duplicated entries.`);return}s[p]={node:d}}))));const a=new cj(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(a.normalizedHumanBonesRoot),this.helperRoot){const o=new oj(a);this.helperRoot.add(o),o.renderOrder=this.helperRoot.renderOrder}return a})}_ensureRequiredBonesExist(t){const e=Object.values(uwe).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}},dj=class extends Yt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new Qt(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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}},hwe=class extends Yt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new q,this._currentTail=new q,this._attrPos=new Qt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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 qt,fj=new qt,O0=new q,hj=new q,pj=Math.sqrt(2)/2,pwe=new qt(0,0,-pj,pj),mwe=new q(0,1,0),gwe=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new dj;e.radius=.5;const n=new As({color:65280,transparent:!0,opacity:.5,side:ya,depthTest:!1,depthWrite:!1});this._meshPitch=new xr(e,n),this.add(this._meshPitch)}{const e=new dj;e.radius=.5;const n=new As({color:16711680,transparent:!0,opacity:.5,side:ya,depthTest:!1,depthWrite:!1});this._meshYaw=new xr(e,n),this.add(this._meshYaw)}{const e=new hwe;e.radius=.1;const n=new $r({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new ea(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(L_),L_.multiply(this.vrmLookAt.getFaceFrontQuaternion(fj)),this._meshYaw.position.copy(O0),this._meshYaw.quaternion.copy(L_),this._meshPitch.position.copy(O0),this._meshPitch.quaternion.copy(L_),this._meshPitch.quaternion.multiply(fj.setFromAxisAngle(mwe,e)),this._meshPitch.quaternion.multiply(pwe);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(hj).sub(O0),this._lineTarget.geometry.tail.copy(hj),this._lineTarget.geometry.update(),this._lineTarget.position.copy(O0)),super.updateMatrixWorld(t)}},vwe=new q,ywe=new q;function dC(t,e){return t.matrixWorld.decompose(vwe,e,ywe),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 mj(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var gj=new q(0,0,1),xwe=new q,bwe=new q,_we=new q,wwe=new qt,iT=new qt,vj=new qt,Swe=new qt,sT=new ls,WG=class $G{constructor(e,n){this.offsetFromHeadBone=new q,this.autoUpdate=!0,this.faceFront=new q(0,0,1),this.humanoid=e,this.applier=n,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new qt)}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 ls)}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 $G(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 dC(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(gj)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=Z_(this.faceFront);return sT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(sT).premultiply(Swe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(iT),this.getFaceFrontQuaternion(vj),e.copy(gj).applyQuaternion(iT).applyQuaternion(vj).applyEuler(this.getEuler(sT))}lookAt(e){const n=wwe.copy(this._restHeadWorldQuaternion).multiply(HG(this.getLookAtWorldQuaternion(iT))),r=this.getLookAtWorldPosition(bwe),i=_we.copy(e).sub(r).applyQuaternion(n).normalize(),[s,a]=Z_(this.faceFront),[o,l]=Z_(i),c=mj(o-s),d=mj(a-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(xwe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};WG.EULER_ORDER="YXZ";var Mwe=WG,Ewe=new q(0,0,1),ml=new qt,km=new qt,Fa=new ls(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 q(0,0,1),this._restQuatLeftEye=new qt,this._restQuatRightEye=new qt,this._restLeftEyeParentWorldQuat=new qt,this._restRightEyeParentWorldQuat=new qt;const s=this.humanoid.getRawBoneNode("leftEye"),a=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),dC(s.parent,this._restLeftEyeParentWorldQuat)),a&&(this._restQuatRightEye.copy(a.quaternion),dC(a.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?Fa.x=-vr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fa.x=vr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fa.y=-vr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):Fa.y=vr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),ml.setFromEuler(Fa),this._getWorldFaceFrontQuat(km),i.quaternion.copy(km).multiply(ml).multiply(km.invert()),ml.copy(this._restLeftEyeParentWorldQuat),n.quaternion.copy(i.quaternion).multiply(ml).premultiply(ml.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?Fa.x=-vr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fa.x=vr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fa.y=-vr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):Fa.y=vr.DEG2RAD*this.rangeMapHorizontalInner.map(t),ml.setFromEuler(Fa),this._getWorldFaceFrontQuat(km),s.quaternion.copy(km).multiply(ml).multiply(km.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(Ewe)<.01)return t.identity();const[e,n]=Z_(this.faceFront);return Fa.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Fa)}};Q_.type="bone";var fC=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)}};fC.type="expression";var yj=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*OG(t/this.inputMaxValue)}},Awe=new Set(["1.0","1.0-beta"]),D_=.01,Twe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return Dn(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 Dn(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 Dn(this,null,function*(){var r,i,s;const a=this.parser.json;if(!(((r=a.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=a.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!Awe.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,p=this._v1ImportRangeMap(d.rangeMapHorizontalInner,f),y=this._v1ImportRangeMap(d.rangeMapHorizontalOuter,f),b=this._v1ImportRangeMap(d.rangeMapVerticalDown,f),S=this._v1ImportRangeMap(d.rangeMapVerticalUp,f);let w;d.type==="expression"?w=new fC(n,p,y,b,S):w=new Q_(e,p,y,b,S);const x=this._importLookAt(e,w);return x.offsetFromHeadBone.fromArray((s=d.offsetFromHeadBone)!=null?s:[0,.06,0]),x})}_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(a),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},Nwe=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()}},Iwe=class extends Nwe{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)})}},kwe=Object.defineProperty,xj=Object.getOwnPropertySymbols,Owe=Object.prototype.hasOwnProperty,Lwe=Object.prototype.propertyIsEnumerable,bj=(t,e,n)=>e in t?kwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_j=(t,e)=>{for(var n in e||(e={}))Owe.call(e,n)&&bj(t,n,e[n]);if(xj)for(var n of xj(e))Lwe.call(e,n)&&bj(t,n,e[n]);return t},fh=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),Dwe={"":3e3,srgb:3001};function Uwe(t,e){parseInt(Pd,10)>=152?t.colorSpace=e:t.encoding=Dwe[e]}var jwe=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 ct().fromArray(e);n&&r.convertSRGBToLinear(),this._materialParams[t]=r}}assignTexture(t,e,n){return fh(this,null,function*(){const r=fh(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&&Uwe(i,"srgb")}});return this._pendings.push(r),r})}assignTextureByIndex(t,e,n){return fh(this,null,function*(){return this.assignTexture(t,e!=null?{index:e}:void 0,n)})}},Fwe=`// #define PHONG + */var O_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),Dn=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),ZU=class extends mn{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 OG(t,e,n){var r,i;const s=t.parser.json,a=(r=s.nodes)==null?void 0:r[e];if(a==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const o=a.mesh;if(o==null)return null;const l=(i=s.meshes)==null?void 0:i[o];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${o}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,d=[];return n.traverse(f=>{d.length{const s=OG(t,i,r);s!=null&&n.set(i,s)}),n})}var cC={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 LG(t){return Math.max(Math.min(t,1),0)}var ej=class DG{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(cC));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(cC));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 DG().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=LG(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"},twe={_Color:k0.Color,_EmissionColor:k0.EmissionColor,_ShadeColor:k0.ShadeColor,_RimColor:k0.RimColor,_OutlineColor:k0.OutlineColor},nwe=new ct,UG=class jG{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(),a=this._initAlphaBindState();this._state={color:s,alpha:a}}applyWeight(e){const{color:n,alpha:r}=this._state;if(n!=null){const{propertyName:i,deltaValue:s}=n,a=this.material[i];a!=null&&a.add(nwe.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:a}=this,o=this._getPropertyNameMap(),l=(n=(e=o==null?void 0:o[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 ct(a.r-d.r,a.g-d.g,a.b-d.b);return{propertyName:l,initialValue:d,deltaValue:f}}_initAlphaBindState(){var e,n,r;const{material:i,type:s,targetAlpha:a}=this,o=this._getPropertyNameMap(),l=(n=(e=o==null?void 0:o[s])==null?void 0:e[1])!=null?n:null;if(l==null&&a!==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=a-c;return{propertyName:l,initialValue:c,deltaValue:d}}_getPropertyNameMap(){var e,n;return(n=(e=Object.entries(jG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};UG._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 tj=UG,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)})}},nj=new He,FG=class zG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const a=(i=Object.entries(zG._propertyNamesMap).find(([o])=>e[o]===!0))==null?void 0:i[1];a==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=[],a.forEach(o=>{var l;const c=(l=e[o])==null?void 0:l.clone();if(!c)return null;e[o]=c;const d=c.offset.clone(),f=c.repeat.clone(),p=r.clone().sub(d),y=n.clone().sub(f);this._properties.push({name:o,initialOffset:d,deltaOffset:p,initialScale:f,deltaScale:y})}))}applyWeight(e){this._properties.forEach(n=>{const r=this.material[n.name];r!==void 0&&(r.offset.add(nj.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(nj.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))})}};FG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var rj=FG,rwe=new Set(["1.0","1.0-beta"]),BG=class HG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return Dn(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return Dn(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 Dn(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 a=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!a)return null;const o=a.specVersion;if(!rwe.has(o))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const l=a.expressions;if(!l)return null;const c=new Set(Object.values(cC)),d=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([p,y])=>{if(y!=null){if(!c.has(p)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${p}" detected. Ignoring the expression`);return}d.set(p,y)}}),l.custom!=null&&Object.entries(l.custom).forEach(([p,y])=>{if(c.has(p)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${p}". Ignoring the expression`);return}d.set(p,y)});const f=new ej;return yield Promise.all(Array.from(d.entries()).map(p=>Dn(this,[p],function*([y,b]){var S,w,x,M,T,P,O;const N=new ZU(y);if(e.scene.add(N),N.isBinary=(S=b.isBinary)!=null?S:!1,N.overrideBlink=(w=b.overrideBlink)!=null?w:"none",N.overrideLookAt=(x=b.overrideLookAt)!=null?x:"none",N.overrideMouth=(M=b.overrideMouth)!=null?M:"none",(T=b.morphTargetBinds)==null||T.forEach(D=>Dn(this,null,function*(){var z;if(D.node===void 0||D.index===void 0)return;const V=yield QU(e,D.node),k=D.index;if(!V.every(j=>Array.isArray(j.morphTargetInfluences)&&k{const V=z.material;V&&(Array.isArray(V)?D.push(...V):D.push(V))}),(P=b.materialColorBinds)==null||P.forEach(z=>Dn(this,null,function*(){D.filter(k=>{var j;const X=(j=this.parser.associations.get(k))==null?void 0:j.materials;return z.material===X}).forEach(k=>{N.addBind(new tj({material:k,type:z.type,targetValue:new ct().fromArray(z.targetValue),targetAlpha:z.targetValue[3]}))})})),(O=b.textureTransformBinds)==null||O.forEach(z=>Dn(this,null,function*(){D.filter(k=>{var j;const X=(j=this.parser.associations.get(k))==null?void 0:j.materials;return z.material===X}).forEach(k=>{var j,X;N.addBind(new rj({material:k,offset:new He().fromArray((j=z.offset)!=null?j:[0,0]),scale:new He().fromArray((X=z.scale)!=null?X:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return Dn(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 a=new ej,o=s.blendShapeGroups;if(!o)return a;const l=new Set;return yield Promise.all(o.map(c=>Dn(this,null,function*(){var d;const f=c.presetName,p=f!=null&&HG.v0v1PresetNameMap[f]||null,y=p??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 b=new ZU(y);e.scene.add(b),b.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(w=>Dn(this,null,function*(){var x;if(w.mesh===void 0||w.index===void 0)return;const M=[];if((x=r.nodes)==null||x.forEach((P,O)=>{P.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(P=>Dn(this,null,function*(){var O;const N=yield QU(e,P);if(!N.every(D=>Array.isArray(D.morphTargetInfluences)&&T{if(w.materialName===void 0||w.propertyName===void 0||w.targetValue===void 0)return;const x=[];e.scene.traverse(T=>{if(T.material){const P=T.material;Array.isArray(P)?x.push(...P.filter(O=>(O.name===w.materialName||O.name===w.materialName+" (Outline)")&&x.indexOf(O)===-1)):P.name===w.materialName&&x.indexOf(P)===-1&&x.push(P)}});const M=w.propertyName;x.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,b.addBind(new rj({material:T,scale:O,offset:N}));return}const P=twe[M];if(P){b.addBind(new tj({material:T,type:P,targetValue:new ct().fromArray(w.targetValue),targetAlpha:w.targetValue[3]}));return}console.warn(M+" is not supported")})}),a.registerExpression(b)}))),a})}};BG.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 iwe=BG,sN=class Bm{constructor(e,n){this._firstPersonOnlyLayer=Bm.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Bm.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 Bm(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Bm.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:n=Bm.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 a=0;a0&&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 p=n[l],y=r[l];if(p[0]>0&&i.includes(y[0])||p[1]>0&&i.includes(y[1])||p[2]>0&&i.includes(y[2])||p[3]>0&&i.includes(y[3]))continue;const b=n[c],S=r[c];b[0]>0&&i.includes(S[0])||b[1]>0&&i.includes(S[1])||b[2]>0&&i.includes(S[2])||b[3]>0&&i.includes(S[3])||(e[s++]=o,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,n){const r=new nM(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"),a=s instanceof tC?[]:s.array,o=[];for(let S=0;S{this._isEraseTarget(s)&&r.push(a)}),!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 Ts;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}};sN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;sN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var ij=sN,swe=new Set(["1.0","1.0-beta"]),awe=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return Dn(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 Dn(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 Dn(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 a=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!a)return null;const o=a.specVersion;if(!swe.has(o))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const l=a.firstPerson,c=[],d=yield JU(t);return Array.from(d.entries()).forEach(([f,p])=>{var y,b;const S=(y=l==null?void 0:l.meshAnnotations)==null?void 0:y.find(w=>w.node===f);c.push({meshes:p,type:(b=S==null?void 0:S.type)!=null?b:"auto"})}),new ij(e,c)})}_v0Import(t,e){return Dn(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 a=[],o=yield JU(t);return Array.from(o.entries()).forEach(([l,c])=>{const d=r.nodes[l],f=s.meshAnnotations?s.meshAnnotations.find(p=>p.mesh===d.mesh):void 0;a.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new ij(e,a)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},sj=new q,aj=new q,owe=new qt,oj=class extends Ts{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new pG(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(sj,owe,aj);const r=sj.set(.1,.1,.1).divide(aj);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"],lwe={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 VG(t){return t.invert?t.invert():t.inverse(),t}var Hf=new q,Vf=new qt,uC=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&&(Hf.copy(r.position),Vf.copy(r.quaternion),t[n]={position:Hf.toArray(),rotation:Vf.toArray()})}),t}getPose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);if(!r)return;Hf.set(0,0,0),Vf.identity();const i=this.restPose[n];i!=null&&i.position&&Hf.fromArray(i.position).negate(),i!=null&&i.rotation&&VG(Vf.fromArray(i.rotation)),Hf.add(r.position),Vf.premultiply(r.quaternion),t[n]={position:Hf.toArray(),rotation:Vf.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(Hf.fromArray(s.position))),n!=null&&n.rotation&&(i.quaternion.fromArray(n.rotation),s.rotation&&i.quaternion.multiply(Vf.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 q,cwe=new qt,uwe=new q,lj=class GG extends uC{static _setupTransforms(e){const n=new mn;n.name="VRMHumanoidRig";const r={},i={},s={};nT.forEach(o=>{var l;const c=e.getBoneNode(o);if(c){const d=new q,f=new qt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(d,f,rT),r[o]=d,i[o]=c.quaternion.clone();const p=new qt;(l=c.parent)==null||l.matrixWorld.decompose(rT,p,rT),s[o]=p}});const a={};return nT.forEach(o=>{var l;const c=e.getBoneNode(o);if(c){const d=r[o];let f=o,p;for(;p==null&&(f=lwe[f],f!=null);)p=r[f];const y=new mn;y.name="Normalized_"+c.name,(f?(l=a[f])==null?void 0:l.node:n).add(y),y.position.copy(d),p&&y.position.sub(p),a[o]={node:y}}}),{rigBones:a,root:n,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:s}=GG._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=cwe.copy(i).invert(),a=this._boneRotations[e];if(n.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(a),e==="hips"){const o=r.getWorldPosition(uwe);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=o.applyMatrix4(l.invert());n.position.copy(c)}}})}},cj=class WG{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 uC(e),this._normalizedHumanBones=new lj(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new uC(e.humanBones),this._normalizedHumanBones=new lj(this._rawHumanBones),this}clone(){return new WG(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()}},dwe={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"},fwe=new Set(["1.0","1.0-beta"]),uj={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},hwe=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 Dn(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return Dn(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 Dn(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 a=s.specVersion;if(!fwe.has(a))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const o=s.humanoid;if(!o)return null;const l=o.humanBones.leftThumbIntermediate!=null||o.humanBones.rightThumbIntermediate!=null,c={};o.humanBones!=null&&(yield Promise.all(Object.entries(o.humanBones).map(f=>Dn(this,[f],function*([p,y]){let b=p;const S=y.node;if(l){const x=uj[b];x!=null&&(b=x)}const w=yield this.parser.getDependency("node",S);if(w==null){console.warn(`A glTF node bound to the humanoid bone ${b} (index = ${S}) does not exist`);return}c[b]={node:w}}))));const d=new cj(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new oj(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return Dn(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(o=>Dn(this,null,function*(){const l=o.bone,c=o.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=uj[l],p=f??l;if(s[p]!=null){console.warn(`Multiple bone entries for ${p} detected (index = ${c}), ignoring duplicated entries.`);return}s[p]={node:d}}))));const a=new cj(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(a.normalizedHumanBonesRoot),this.helperRoot){const o=new oj(a);this.helperRoot.add(o),o.renderOrder=this.helperRoot.renderOrder}return a})}_ensureRequiredBonesExist(t){const e=Object.values(dwe).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}},dj=class extends Yt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new Qt(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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}},pwe=class extends Yt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new q,this._currentTail=new q,this._attrPos=new Qt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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 qt,fj=new qt,O0=new q,hj=new q,pj=Math.sqrt(2)/2,mwe=new qt(0,0,-pj,pj),gwe=new q(0,1,0),vwe=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new dj;e.radius=.5;const n=new As({color:65280,transparent:!0,opacity:.5,side:ya,depthTest:!1,depthWrite:!1});this._meshPitch=new xr(e,n),this.add(this._meshPitch)}{const e=new dj;e.radius=.5;const n=new As({color:16711680,transparent:!0,opacity:.5,side:ya,depthTest:!1,depthWrite:!1});this._meshYaw=new xr(e,n),this.add(this._meshYaw)}{const e=new pwe;e.radius=.1;const n=new $r({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new ea(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(L_),L_.multiply(this.vrmLookAt.getFaceFrontQuaternion(fj)),this._meshYaw.position.copy(O0),this._meshYaw.quaternion.copy(L_),this._meshPitch.position.copy(O0),this._meshPitch.quaternion.copy(L_),this._meshPitch.quaternion.multiply(fj.setFromAxisAngle(gwe,e)),this._meshPitch.quaternion.multiply(mwe);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(hj).sub(O0),this._lineTarget.geometry.tail.copy(hj),this._lineTarget.geometry.update(),this._lineTarget.position.copy(O0)),super.updateMatrixWorld(t)}},ywe=new q,xwe=new q;function dC(t,e){return t.matrixWorld.decompose(ywe,e,xwe),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 mj(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var gj=new q(0,0,1),bwe=new q,_we=new q,wwe=new q,Swe=new qt,iT=new qt,vj=new qt,Mwe=new qt,sT=new ls,$G=class XG{constructor(e,n){this.offsetFromHeadBone=new q,this.autoUpdate=!0,this.faceFront=new q(0,0,1),this.humanoid=e,this.applier=n,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new qt)}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 ls)}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 XG(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 dC(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(gj)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=Z_(this.faceFront);return sT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(sT).premultiply(Mwe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(iT),this.getFaceFrontQuaternion(vj),e.copy(gj).applyQuaternion(iT).applyQuaternion(vj).applyEuler(this.getEuler(sT))}lookAt(e){const n=Swe.copy(this._restHeadWorldQuaternion).multiply(VG(this.getLookAtWorldQuaternion(iT))),r=this.getLookAtWorldPosition(_we),i=wwe.copy(e).sub(r).applyQuaternion(n).normalize(),[s,a]=Z_(this.faceFront),[o,l]=Z_(i),c=mj(o-s),d=mj(a-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(bwe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};$G.EULER_ORDER="YXZ";var Ewe=$G,Awe=new q(0,0,1),ml=new qt,km=new qt,Fa=new ls(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 q(0,0,1),this._restQuatLeftEye=new qt,this._restQuatRightEye=new qt,this._restLeftEyeParentWorldQuat=new qt,this._restRightEyeParentWorldQuat=new qt;const s=this.humanoid.getRawBoneNode("leftEye"),a=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),dC(s.parent,this._restLeftEyeParentWorldQuat)),a&&(this._restQuatRightEye.copy(a.quaternion),dC(a.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?Fa.x=-vr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fa.x=vr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fa.y=-vr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):Fa.y=vr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),ml.setFromEuler(Fa),this._getWorldFaceFrontQuat(km),i.quaternion.copy(km).multiply(ml).multiply(km.invert()),ml.copy(this._restLeftEyeParentWorldQuat),n.quaternion.copy(i.quaternion).multiply(ml).premultiply(ml.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?Fa.x=-vr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fa.x=vr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fa.y=-vr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):Fa.y=vr.DEG2RAD*this.rangeMapHorizontalInner.map(t),ml.setFromEuler(Fa),this._getWorldFaceFrontQuat(km),s.quaternion.copy(km).multiply(ml).multiply(km.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(Awe)<.01)return t.identity();const[e,n]=Z_(this.faceFront);return Fa.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Fa)}};Q_.type="bone";var fC=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)}};fC.type="expression";var yj=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*LG(t/this.inputMaxValue)}},Twe=new Set(["1.0","1.0-beta"]),D_=.01,Pwe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return Dn(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 Dn(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 Dn(this,null,function*(){var r,i,s;const a=this.parser.json;if(!(((r=a.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=a.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!Twe.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,p=this._v1ImportRangeMap(d.rangeMapHorizontalInner,f),y=this._v1ImportRangeMap(d.rangeMapHorizontalOuter,f),b=this._v1ImportRangeMap(d.rangeMapVerticalDown,f),S=this._v1ImportRangeMap(d.rangeMapVerticalUp,f);let w;d.type==="expression"?w=new fC(n,p,y,b,S):w=new Q_(e,p,y,b,S);const x=this._importLookAt(e,w);return x.offsetFromHeadBone.fromArray((s=d.offsetFromHeadBone)!=null?s:[0,.06,0]),x})}_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(a),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},Iwe=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()}},kwe=class extends Iwe{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)})}},Owe=Object.defineProperty,xj=Object.getOwnPropertySymbols,Lwe=Object.prototype.hasOwnProperty,Dwe=Object.prototype.propertyIsEnumerable,bj=(t,e,n)=>e in t?Owe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_j=(t,e)=>{for(var n in e||(e={}))Lwe.call(e,n)&&bj(t,n,e[n]);if(xj)for(var n of xj(e))Dwe.call(e,n)&&bj(t,n,e[n]);return t},fh=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),Uwe={"":3e3,srgb:3001};function jwe(t,e){parseInt(Pd,10)>=152?t.colorSpace=e:t.encoding=Uwe[e]}var Fwe=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 ct().fromArray(e);n&&r.convertSRGBToLinear(),this._materialParams[t]=r}}assignTexture(t,e,n){return fh(this,null,function*(){const r=fh(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&&jwe(i,"srgb")}});return this._pendings.push(r),r})}assignTextureByIndex(t,e,n){return fh(this,null,function*(){return this.assignTexture(t,e!=null?{index:e}:void 0,n)})}},zwe=`// #define PHONG varying vec3 vViewPosition; @@ -4608,7 +4613,7 @@ void main() { #include #include -}`,zwe=`// #define PHONG +}`,Bwe=`// #define PHONG uniform vec3 litFactor; @@ -5421,9 +5426,9 @@ void main() { gl_FragColor = vec4( col, diffuseColor.a ); postCorrection(); } -`,Bwe={None:"none"},wj={None:"none",ScreenCoordinates:"screenCoordinates"},Hwe={3e3:"",3001:"srgb"};function aT(t){return parseInt(Pd,10)>=152?t.colorSpace:Hwe[t.encoding]}var Vwe=class extends Ya{constructor(t={}){var e;super({vertexShader:Fwe,fragmentShader:zwe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=au,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=Bwe.None,this._outlineWidthMode=wj.None,this._isOutline=!1,t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,t.fog=!0,t.lights=!0,t.clipping=!0,this.uniforms=TR.merge([ft.common,ft.normalmap,ft.emissivemap,ft.fog,ft.lights,{litFactor:{value:new ct(1,1,1)},mapUvTransform:{value:new $t},colorAlpha:{value:1},normalMapUvTransform:{value:new $t},shadeColorFactor:{value:new ct(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new $t},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new $t},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ct(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new $t},parametricRimColorFactor:{value:new ct(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new $t},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ct(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new $t},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new $t},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ct(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new $t},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:${aT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${aT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${aT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(Pd,10),i=Object.entries(_j(_j({},this._generateDefines()),this.defines)).filter(([s,a])=>!!a).map(([s,a])=>`#define ${s} ${a}`).join(` +`,Hwe={None:"none"},wj={None:"none",ScreenCoordinates:"screenCoordinates"},Vwe={3e3:"",3001:"srgb"};function aT(t){return parseInt(Pd,10)>=152?t.colorSpace:Vwe[t.encoding]}var Gwe=class extends Ya{constructor(t={}){var e;super({vertexShader:zwe,fragmentShader:Bwe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=au,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=Hwe.None,this._outlineWidthMode=wj.None,this._isOutline=!1,t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,t.fog=!0,t.lights=!0,t.clipping=!0,this.uniforms=TR.merge([ft.common,ft.normalmap,ft.emissivemap,ft.fog,ft.lights,{litFactor:{value:new ct(1,1,1)},mapUvTransform:{value:new $t},colorAlpha:{value:1},normalMapUvTransform:{value:new $t},shadeColorFactor:{value:new ct(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new $t},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new $t},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ct(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new $t},parametricRimColorFactor:{value:new ct(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new $t},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ct(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new $t},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new $t},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ct(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new $t},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:${aT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${aT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${aT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(Pd,10),i=Object.entries(_j(_j({},this._generateDefines()),this.defines)).filter(([s,a])=>!!a).map(([s,a])=>`#define ${s} ${a}`).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(Pd,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===wj.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},Gwe=new Set(["1.0","1.0-beta"]),XG=class J_{get name(){return J_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,a;this.parser=e,this.materialType=(r=n.materialType)!=null?r:Vwe,this.renderOrderOffset=(i=n.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(a=n.debugMode)!=null?a:"none",this._mToonMaterialSet=new Set}beforeRoot(){return fh(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return fh(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 fh(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 a=s.primitives,o=yield r.loadMesh(e);if(a.length===1){const l=o,c=a[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=o;for(let c=0;c{var a;this._getMToonExtension(s)&&((a=i.extensions)!=null&&a.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,r;const a=(n=this.parser.json.materials)==null?void 0:n[e];if(a==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const o=(r=a.extensions)==null?void 0:r[J_.EXTENSION_NAME];if(o==null)return;const l=o.specVersion;if(!Gwe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${J_.EXTENSION_NAME} specVersion "${l}"`);return}return o}_extendMaterialParams(e,n){return fh(this,null,function*(){var r;delete n.metalness,delete n.roughness;const i=new jwe(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 Gr)||!this._shouldGenerateOutline(n))return;e.material=[n];const r=n.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=as,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)}};XG.EXTENSION_NAME="VRMC_materials_mtoon";var Wwe=XG,$we=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),qG=class hC{get name(){return hC.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return $we(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 a=(n=this.parser.json.materials)==null?void 0:n[e];if(a==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const o=(r=a.extensions)==null?void 0:r[hC.EXTENSION_NAME];if(o!=null)return o}};qG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Xwe=qG,qwe=Object.defineProperty,Kwe=Object.defineProperties,Ywe=Object.getOwnPropertyDescriptors,Sj=Object.getOwnPropertySymbols,Zwe=Object.prototype.hasOwnProperty,Qwe=Object.prototype.propertyIsEnumerable,Mj=(t,e,n)=>e in t?qwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gl=(t,e)=>{for(var n in e||(e={}))Zwe.call(e,n)&&Mj(t,n,e[n]);if(Sj)for(var n of Sj(e))Qwe.call(e,n)&&Mj(t,n,e[n]);return t},Ej=(t,e)=>Kwe(t,Ywe(e)),Jwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())});function Om(t){return Math.pow(t,2.2)}var e1e=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 Jwe(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 a,o;const l=(a=e.materials)==null?void 0:a[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((o=i.shader)!=null&&o.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,a,o,l,c,d,f,p,y,b,S,w,x,M,T,P,O,N,D,z,V,k,j,X,ee,ie,pe,ae,he,B,J,Y,H,G,le,se,ce,Se,we,We,Ee,Ge,$e,de,Z,Ve,Le,ne,Ce,qe,Ze,Q;const W=(r=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?r:!1,Ue=((i=t.floatProperties)==null?void 0:i._ZWrite)===1&&W,ze=this._v0ParseRenderQueue(t),Fe=(a=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?a:!1,bt=W?"BLEND":Fe?"MASK":"OPAQUE",rt=Fe?(l=(o=t.floatProperties)==null?void 0:o._Cutoff)!=null?l:.5:void 0,Xt=((d=(c=t.floatProperties)==null?void 0:c._CullMode)!=null?d:2)===0,Ke=this._portTextureTransform(t),te=((p=(f=t.vectorProperties)==null?void 0:f._Color)!=null?p:[1,1,1,1]).map((it,yt)=>yt===3?it:Om(it)),tt=(y=t.textureProperties)==null?void 0:y._MainTex,Mt=tt!=null?{index:tt,extensions:gl({},Ke)}:void 0,vt=(S=(b=t.floatProperties)==null?void 0:b._BumpScale)!=null?S:1,Zt=(w=t.textureProperties)==null?void 0:w._BumpMap,fe=Zt!=null?{index:Zt,scale:vt,extensions:gl({},Ke)}:void 0,Xe=((M=(x=t.vectorProperties)==null?void 0:x._EmissionColor)!=null?M:[0,0,0,1]).map(Om),ue=(T=t.textureProperties)==null?void 0:T._EmissionMap,Ye=ue!=null?{index:ue,extensions:gl({},Ke)}:void 0,Re=((O=(P=t.vectorProperties)==null?void 0:P._ShadeColor)!=null?O:[.97,.81,.86,1]).map(Om),Be=(N=t.textureProperties)==null?void 0:N._ShadeTexture,at=Be!=null?{index:Be,extensions:gl({},Ke)}:void 0;let pt=(z=(D=t.floatProperties)==null?void 0:D._ShadeShift)!=null?z:0,Jt=(k=(V=t.floatProperties)==null?void 0:V._ShadeToony)!=null?k:.9;Jt=vr.lerp(Jt,1,.5+.5*pt),pt=-pt-(1-Jt);const pn=(X=(j=t.floatProperties)==null?void 0:j._IndirectLightIntensity)!=null?X:.1,jn=pn?1-pn:void 0,en=(ee=t.textureProperties)==null?void 0:ee._SphereAdd,Hn=en!=null?[1,1,1]:void 0,pr=en!=null?{index:en}:void 0,Mi=(pe=(ie=t.floatProperties)==null?void 0:ie._RimLightingMix)!=null?pe:0,to=(ae=t.textureProperties)==null?void 0:ae._RimTexture,Ei=to!=null?{index:to,extensions:gl({},Ke)}:void 0,Ko=((B=(he=t.vectorProperties)==null?void 0:he._RimColor)!=null?B:[0,0,0,1]).map(Om),Ns=(Y=(J=t.floatProperties)==null?void 0:J._RimFresnelPower)!=null?Y:1,no=(G=(H=t.floatProperties)==null?void 0:H._RimLift)!=null?G:0,Ai=["none","worldCoordinates","screenCoordinates"][(se=(le=t.floatProperties)==null?void 0:le._OutlineWidthMode)!=null?se:0];let Aa=(Se=(ce=t.floatProperties)==null?void 0:ce._OutlineWidth)!=null?Se:0;Aa=.01*Aa;const ro=(we=t.textureProperties)==null?void 0:we._OutlineWidthTexture,ou=ro!=null?{index:ro,extensions:gl({},Ke)}:void 0,lu=((Ee=(We=t.vectorProperties)==null?void 0:We._OutlineColor)!=null?Ee:[0,0,0]).map(Om),cu=(($e=(Ge=t.floatProperties)==null?void 0:Ge._OutlineColorMode)!=null?$e:0)===1?(Z=(de=t.floatProperties)==null?void 0:de._OutlineLightingMix)!=null?Z:1:0,Bl=(Ve=t.textureProperties)==null?void 0:Ve._UvAnimMaskTexture,K=Bl!=null?{index:Bl,extensions:gl({},Ke)}:void 0,xe=(ne=(Le=t.floatProperties)==null?void 0:Le._UvAnimScrollX)!=null?ne:0;let Te=(qe=(Ce=t.floatProperties)==null?void 0:Ce._UvAnimScrollY)!=null?qe:0;Te!=null&&(Te=-Te);const Ie=(Q=(Ze=t.floatProperties)==null?void 0:Ze._UvAnimRotation)!=null?Q:0,Me={specVersion:"1.0",transparentWithZWrite:Ue,renderQueueOffsetNumber:ze,shadeColorFactor:Re,shadeMultiplyTexture:at,shadingShiftFactor:pt,shadingToonyFactor:Jt,giEqualizationFactor:jn,matcapFactor:Hn,matcapTexture:pr,rimLightingMixFactor:Mi,rimMultiplyTexture:Ei,parametricRimColorFactor:Ko,parametricRimFresnelPowerFactor:Ns,parametricRimLiftFactor:no,outlineWidthMode:Ai,outlineWidthFactor:Aa,outlineWidthMultiplyTexture:ou,outlineColorFactor:lu,outlineLightingMixFactor:cu,uvAnimationMaskTexture:K,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Te,uvAnimationRotationSpeedFactor:Ie};return Ej(gl({},e),{pbrMetallicRoughness:{baseColorFactor:te,baseColorTexture:Mt},normalTexture:fe,emissiveTexture:Ye,emissiveFactor:Xe,alphaMode:bt,alphaCutoff:rt,doubleSided:Xt,extensions:{VRMC_materials_mtoon:Me}})}_parseV0UnlitProperties(t,e){var n,r,i,s,a;const o=t.shader==="VRM/UnlitTransparentZWrite",l=t.shader==="VRM/UnlitTransparent"||o,c=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",f=l?"BLEND":d?"MASK":"OPAQUE",p=d?(r=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?r:.5:void 0,y=this._portTextureTransform(t),b=((s=(i=t.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Om),S=(a=t.textureProperties)==null?void 0:a._MainTex,w=S!=null?{index:S,extensions:gl({},y)}:void 0,x={specVersion:"1.0",transparentWithZWrite:o,renderQueueOffsetNumber:c,shadeColorFactor:b,shadeMultiplyTexture:w};return Ej(gl({},e),{pbrMetallicRoughness:{baseColorFactor:b,baseColorTexture:w},alphaMode:f,alphaCutoff:p,extensions:{VRMC_materials_mtoon:x}})}_portTextureTransform(t){var e,n,r,i,s;const a=(e=t.vectorProperties)==null?void 0:e._MainTex;if(a==null)return{};const o=[(n=a==null?void 0:a[0])!=null?n:0,(r=a==null?void 0:a[1])!=null?r:0],l=[(i=a==null?void 0:a[2])!=null?i:1,(s=a==null?void 0:a[3])!=null?s:1];return o[1]=1-l[1]-o[1],{KHR_texture_transform:{offset:o,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 a=0;if(i){const o=t.renderQueue;o!=null&&(s?a=this._renderQueueMapTransparentZWrite.get(o):a=this._renderQueueMapTransparent.get(o))}return a}_populateRenderQueueMap(t){const e=new Set,n=new Set;t.forEach(r=>{var i,s;const a=r.shader==="VRM/UnlitTransparentZWrite",o=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||a,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||a;if(o){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)})}},Aj=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),nd=new q,oT=class extends Ts{constructor(t){super(),this._attrPosition=new Qt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(l6);const e=new Yt;e.setAttribute("position",this._attrPosition);const n=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Ul(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){nd.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,nd.x,nd.y,nd.z),this.constraint.source&&nd.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,nd.x,nd.y,nd.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function Tj(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var t1e=new q,n1e=new q;function r1e(t,e){return t.decompose(t1e,e,n1e),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}},i1e=new q,s1e=new q,a1e=new q,o1e=new qt,l1e=new qt,c1e=new qt,u1e=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 q(1,0,0),this._dstRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const t=o1e.identity(),e=l1e.identity();this.destination.parent&&(r1e(this.destination.parent.matrixWorld,t),z1(e.copy(t)));const n=i1e.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=Tj(this.source.matrixWorld,s1e).sub(Tj(this.destination.matrixWorld,a1e)).normalize(),i=c1e.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function d1e(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var f1e=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)d1e(s,a=>{const o=this._objectConstraintsMap.get(a);if(o)for(const l of o)this._processConstraint(l,e,n,r)});r(t),n.add(t)}},h1e=new qt,p1e=new qt,m1e=class extends aN{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new qt,this._invSrcRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),z1(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const t=h1e.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=p1e.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},g1e=new q,v1e=new qt,y1e=new qt,x1e=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 q(1,0,0),this._dstRestQuat=new qt,this._invDstRestQuat=new qt,this._invSrcRestQuatMulDstRestQuat=new qt}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=v1e.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=g1e.copy(this._v3RollAxis).applyQuaternion(t),r=y1e.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},b1e=new Set(["1.0","1.0-beta"]),KG=class $0{get name(){return $0.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return Aj(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return Aj(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf($0.EXTENSION_NAME))!==-1))return null;const s=new f1e,a=yield this.parser.getDependencies("node");return a.forEach((o,l)=>{var c;const d=r.nodes[l],f=(c=d==null?void 0:d.extensions)==null?void 0:c[$0.EXTENSION_NAME];if(f==null)return;const p=f.specVersion;if(!b1e.has(p)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${$0.EXTENSION_NAME} specVersion "${p}"`);return}const y=f.constraint;if(y.roll!=null){const b=this._importRollConstraint(o,a,y.roll);s.addConstraint(b)}else if(y.aim!=null){const b=this._importAimConstraint(o,a,y.aim);s.addConstraint(b)}else if(y.rotation!=null){const b=this._importRotationConstraint(o,a,y.rotation);s.addConstraint(b)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,r){const{source:i,rollAxis:s,weight:a}=r,o=n[i],l=new x1e(e,o);if(s!=null&&(l.rollAxis=s),a!=null&&(l.weight=a),this.helperRoot){const c=new oT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:a}=r,o=n[i],l=new u1e(e,o);if(s!=null&&(l.aimAxis=s),a!=null&&(l.weight=a),this.helperRoot){const c=new oT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,a=n[i],o=new m1e(e,a);if(s!=null&&(o.weight=s),this.helperRoot){const l=new oT(o);this.helperRoot.add(l)}return o}};KG.EXTENSION_NAME="VRMC_node_constraint";var _1e=KG,U_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),oN=class{},lT=new q,Gf=new q,YG=class extends oN{get type(){return"capsule"}constructor(t){var e,n,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new q(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new q(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),Gf.subVectors(this.tail,this.offset).applyMatrix4(t),Gf.sub(lT);const i=Gf.lengthSq();r.copy(e).sub(lT);const s=Gf.dot(r);s<=0||(i<=s||Gf.multiplyScalar(s/i),r.sub(Gf));const a=r.length(),o=this.inside?this.radius-n-a:a-n-this.radius;return o<0&&(r.multiplyScalar(1/a),this.inside&&r.negate()),o}},cT=new q,Pj=new $t,ZG=class extends oN{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new q(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new q(0,0,1)}calculateCollision(t,e,n,r){r.setFromMatrixPosition(t),r.negate().add(e),Pj.getNormalMatrix(t),cT.copy(this.normal).applyNormalMatrix(Pj).normalize();const i=r.dot(cT)-n;return r.copy(cT),i}},w1e=new q,QG=class extends oN{get type(){return"sphere"}constructor(t){var e,n,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new q(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,w1e.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 q,S1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new q,this._currentTail=new q,this._shape=t,this._attrPos=new Qt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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}},M1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentOffset=new q,this._currentNormal=new q,this._shape=t,this._attrPos=new Qt(new Float32Array(18),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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}},E1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new q,this._shape=t,this._attrPos=new Qt(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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}},A1e=new q,uT=class extends Ts{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof QG)this._geometry=new E1e(this.collider.shape);else if(this.collider.shape instanceof YG)this._geometry=new S1e(this.collider.shape);else if(this.collider.shape instanceof ZG)this._geometry=new M1e(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new ea(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=A1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},T1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new q,this._springBone=t,this._attrPos=new Qt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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}},P1e=new q,C1e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new T1e(this.springBone);const e=new $r({color:16776960,depthTest:!1,depthWrite:!1});this._line=new ea(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=P1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},dT=class extends mn{constructor(t){super(),this.colliderMatrix=new Ct,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),R1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function R1e(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 N1e=new Ct;function I1e(t){return t.invert?t.invert():t.getInverse(N1e.copy(t)),t}var k1e=class{constructor(t){this._inverseCache=new Ct,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&&(I1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},fT=new Ct,Lm=new q,L0=new q,D0=new q,U0=new q,O1e=new Ct,L1e=class{constructor(t,e,n={},r=[]){this._currentTail=new q,this._prevTail=new q,this._boneAxis=new q,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Ct,this._initialLocalRotation=new qt,this._initialLocalChildPosition=new q;var i,s,a,o,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:(a=n.gravityPower)!=null?a:0,gravityDir:(l=(o=n.gravityDir)==null?void 0:o.clone())!=null?l:new q(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 pC(t,e){t.children.forEach(n=>{e(n)||pC(n,e)})}function U1e(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 Cj=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 a,o;return((o=(a=this._objectSpringBonesMap.get(s))==null?void 0:a.size)!=null?o: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 a of s){let o=!1,l=null;D1e(a,c=>{const d=this._objectSpringBonesMap.get(c);if(d)for(const f of d)o=!0,this._insertJointSort(f,e,n,r,i);else o||(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)}},Rj="VRMC_springBone_extended_collider",j1e=new Set(["1.0","1.0-beta"]),F1e=new Set(["1.0"]),JG=class Hm{get name(){return Hm.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 U_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return U_(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 U_(this,null,function*(){var n,r,i,s,a;const o=e.parser.json;if(!(((n=o.extensionsUsed)==null?void 0:n.indexOf(Hm.EXTENSION_NAME))!==-1))return null;const c=new Cj,d=yield e.parser.getDependencies("node"),f=(r=o.extensions)==null?void 0:r[Hm.EXTENSION_NAME];if(!f)return null;const p=f.specVersion;if(!j1e.has(p))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Hm.EXTENSION_NAME} specVersion "${p}"`),null;const y=(i=f.colliders)==null?void 0:i.map((S,w)=>{var x,M,T,P,O,N,D,z,V,k,j,X,ee,ie,pe;const ae=d[S.node];if(ae==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} attempted to reference a node #${S.node} but not found. Skipping the collider`),null;const he=S.shape,B=(x=S.extensions)==null?void 0:x[Rj];if(this.useExtendedColliders&&B!=null){const J=B.specVersion;if(!F1e.has(J))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Rj} specVersion "${J}". Fallbacking to the ${Hm.EXTENSION_NAME} definition`);else{const Y=B.shape;if(Y.sphere)return this._importSphereCollider(ae,{offset:new q().fromArray((M=Y.sphere.offset)!=null?M:[0,0,0]),radius:(T=Y.sphere.radius)!=null?T:0,inside:(P=Y.sphere.inside)!=null?P:!1});if(Y.capsule)return this._importCapsuleCollider(ae,{offset:new q().fromArray((O=Y.capsule.offset)!=null?O:[0,0,0]),radius:(N=Y.capsule.radius)!=null?N:0,tail:new q().fromArray((D=Y.capsule.tail)!=null?D:[0,0,0]),inside:(z=Y.capsule.inside)!=null?z:!1});if(Y.plane)return this._importPlaneCollider(ae,{offset:new q().fromArray((V=Y.plane.offset)!=null?V:[0,0,0]),normal:new q().fromArray((k=Y.plane.normal)!=null?k:[0,0,1])})}}if(he.sphere)return this._importSphereCollider(ae,{offset:new q().fromArray((j=he.sphere.offset)!=null?j:[0,0,0]),radius:(X=he.sphere.radius)!=null?X:0,inside:!1});if(he.capsule)return this._importCapsuleCollider(ae,{offset:new q().fromArray((ee=he.capsule.offset)!=null?ee:[0,0,0]),radius:(ie=he.capsule.radius)!=null?ie:0,tail:new q().fromArray((pe=he.capsule.tail)!=null?pe:[0,0,0]),inside:!1});console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} has no valid shape. Skipping the collider`)}),b=(s=f.colliderGroups)==null?void 0:s.map((S,w)=>{var x;return{colliders:((x=S.colliders)!=null?x:[]).map(T=>{const P=y==null?void 0:y[T];return P??(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(a=f.springs)==null||a.forEach((S,w)=>{var x;const M=S.joints,T=(x=S.colliderGroups)==null?void 0:x.map(N=>{const D=b==null?void 0:b[N];return D??(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),P=S.center!=null?d[S.center]:void 0;let O;M.forEach(N=>{if(O){const D=O.node,z=d[D],V=N.node,k=d[V],j={hitRadius:O.hitRadius,dragForce:O.dragForce,gravityPower:O.gravityPower,stiffness:O.stiffness,gravityDir:O.gravityDir!=null?new q().fromArray(O.gravityDir):void 0},X=this._importJoint(z,k,j,T);P&&(X.center=P),c.addJoint(X)}O=N})}),c.setInitState(),c})}_v0Import(e){return U_(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 o=(r=s.extensions)==null?void 0:r.VRM,l=o==null?void 0:o.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const d=new Cj,f=yield e.parser.getDependencies("node"),p=(i=l.colliderGroups)==null?void 0:i.map((y,b)=>{var S;const w=f[y.node];return w==null?(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${b} 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 P,O,N;const D=new q(0,0,0);return M.offset&&D.set((P=M.offset.x)!=null?P:0,(O=M.offset.y)!=null?O:0,M.offset.z?-M.offset.z:0),this._importSphereCollider(w,{offset:D,radius:(N=M.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,b)=>{const S=y.bones;S&&S.forEach(w=>{var x,M,T,P;const O=f[w];if(O==null){console.warn(`VRMSpringBoneLoaderPlugin: The spring bone group #${b} attempted to reference a node #${w} but not found. Skipping the node`);return}const N=new q;y.gravityDir?N.set((x=y.gravityDir.x)!=null?x:0,(M=y.gravityDir.y)!=null?M:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const D=y.center!=null?f[y.center]:void 0,z={hitRadius:y.hitRadius,dragForce:y.dragForce,gravityPower:y.gravityPower,stiffness:y.stiffiness,gravityDir:N},V=(P=y.colliderGroups)==null?void 0:P.map(k=>{const j=p==null?void 0:p[k];return j??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${b} attempted to reference a collider group #${k} but not found. Skipping the collider group`),null)}).filter(k=>k!=null);O.traverse(k=>{var j;const X=(j=k.children[0])!=null?j:null,ee=this._importJoint(k,X,z,V);D&&(ee.center=D),d.addJoint(ee)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new L1e(e,n,r,i);if(this.jointHelperRoot){const a=new C1e(s);this.jointHelperRoot.add(a),a.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new QG(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 YG(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 ZG(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}};JG.EXTENSION_NAME="VRMC_springBone";var z1e=JG,B1e=class{get name(){return"VRMLoaderPlugin"}constructor(t,e){var n,r,i,s,a,o,l,c,d,f;this.parser=t;const p=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 rwe(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new swe(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new fwe(t,{helperRoot:p,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new Twe(t,{helperRoot:p}),this.metaPlugin=(a=e==null?void 0:e.metaPlugin)!=null?a:new Rwe(t),this.mtoonMaterialPlugin=(o=e==null?void 0:e.mtoonMaterialPlugin)!=null?o:new Wwe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Xwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new e1e(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new z1e(t,{colliderHelperRoot:p,jointHelperRoot:p}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new _1e(t,{helperRoot:p})}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 Iwe({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 H1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function Nj(t,e,n){if(e.size===1){const a=e.values().next().value;if(a.weight===1)return t[a.index]}const r=new Float32Array(t[0].count*3);let i=0;if(n)i=1;else for(const a of e)i+=a.weight;for(const a of e){const o=t[a.index],l=a.weight/i;for(let c=0;cd.getOrCreate(V)).join(","),D=`${P};${x};${N}`;let z=o.get(D);z==null&&(z=T.clone(),K1e(z,O,b),o.set(D,z)),M.geometry.setAttribute("skinIndex",z)}for(const M of y)M.bind(w,new Ct)}}function W1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function $1e(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 Z1e(t){var e,n,r,i;const s=new Yt;s.name=t.name,s.setIndex(t.index);for(const[a,o]of Object.entries(t.attributes))s.setAttribute(a,o);for(const[a,o]of Object.entries(t.morphAttributes)){const l=a;s.morphAttributes[l]=o.concat()}s.morphTargetsRelative=t.morphTargetsRelative,s.groups=[];for(const a of t.groups)s.addGroup(a.start,a.count,a.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 Ij(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=>Ij(i)):r&&Ij(r))}function J1e(t){t.traverse(Q1e)}function eSe(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 a=new Map;let o=0;for(const l of s){const d=l.geometry.getAttribute("skinIndex");if(a.has(d))continue;const f=new Map,p=new Map;for(let y=0;y{e.addGroup(a.start,a.count,a.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 iSe(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 a=e.get(i);if(a!=null){r.geometry=a;return}const{isVertexUsed:o,vertexCount:l,verticesUsed:c}=tSe(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=nSe(o),p=new Yt;rSe(i,p),e.set(i,p),iSe(p,s,d),aSe(p,i.attributes,f),lSe(p,i.morphAttributes,f),r.geometry=p}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function uSe(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var Wc=class{constructor(){}};Wc.combineMorphs=V1e;Wc.combineSkeletons=G1e;Wc.deepDispose=J1e;Wc.removeUnnecessaryJoints=eSe;Wc.removeUnnecessaryVertices=cSe;Wc.rotateVRM0=uSe;/*! +`;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(Pd,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===wj.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},Wwe=new Set(["1.0","1.0-beta"]),qG=class J_{get name(){return J_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,a;this.parser=e,this.materialType=(r=n.materialType)!=null?r:Gwe,this.renderOrderOffset=(i=n.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(a=n.debugMode)!=null?a:"none",this._mToonMaterialSet=new Set}beforeRoot(){return fh(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return fh(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 fh(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 a=s.primitives,o=yield r.loadMesh(e);if(a.length===1){const l=o,c=a[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=o;for(let c=0;c{var a;this._getMToonExtension(s)&&((a=i.extensions)!=null&&a.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,r;const a=(n=this.parser.json.materials)==null?void 0:n[e];if(a==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const o=(r=a.extensions)==null?void 0:r[J_.EXTENSION_NAME];if(o==null)return;const l=o.specVersion;if(!Wwe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${J_.EXTENSION_NAME} specVersion "${l}"`);return}return o}_extendMaterialParams(e,n){return fh(this,null,function*(){var r;delete n.metalness,delete n.roughness;const i=new Fwe(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 Gr)||!this._shouldGenerateOutline(n))return;e.material=[n];const r=n.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=as,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)}};qG.EXTENSION_NAME="VRMC_materials_mtoon";var $we=qG,Xwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),KG=class hC{get name(){return hC.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Xwe(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 a=(n=this.parser.json.materials)==null?void 0:n[e];if(a==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const o=(r=a.extensions)==null?void 0:r[hC.EXTENSION_NAME];if(o!=null)return o}};KG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var qwe=KG,Kwe=Object.defineProperty,Ywe=Object.defineProperties,Zwe=Object.getOwnPropertyDescriptors,Sj=Object.getOwnPropertySymbols,Qwe=Object.prototype.hasOwnProperty,Jwe=Object.prototype.propertyIsEnumerable,Mj=(t,e,n)=>e in t?Kwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gl=(t,e)=>{for(var n in e||(e={}))Qwe.call(e,n)&&Mj(t,n,e[n]);if(Sj)for(var n of Sj(e))Jwe.call(e,n)&&Mj(t,n,e[n]);return t},Ej=(t,e)=>Ywe(t,Zwe(e)),e1e=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())});function Om(t){return Math.pow(t,2.2)}var t1e=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 e1e(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 a,o;const l=(a=e.materials)==null?void 0:a[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((o=i.shader)!=null&&o.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,a,o,l,c,d,f,p,y,b,S,w,x,M,T,P,O,N,D,z,V,k,j,X,ee,ie,pe,ae,he,B,J,Y,H,G,le,se,ce,Se,we,We,Ee,Ge,$e,de,Z,Ve,Le,ne,Ce,Xe,Ze,Q;const W=(r=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?r:!1,Ue=((i=t.floatProperties)==null?void 0:i._ZWrite)===1&&W,ze=this._v0ParseRenderQueue(t),Fe=(a=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?a:!1,bt=W?"BLEND":Fe?"MASK":"OPAQUE",rt=Fe?(l=(o=t.floatProperties)==null?void 0:o._Cutoff)!=null?l:.5:void 0,Xt=((d=(c=t.floatProperties)==null?void 0:c._CullMode)!=null?d:2)===0,Ke=this._portTextureTransform(t),te=((p=(f=t.vectorProperties)==null?void 0:f._Color)!=null?p:[1,1,1,1]).map((it,yt)=>yt===3?it:Om(it)),tt=(y=t.textureProperties)==null?void 0:y._MainTex,Mt=tt!=null?{index:tt,extensions:gl({},Ke)}:void 0,vt=(S=(b=t.floatProperties)==null?void 0:b._BumpScale)!=null?S:1,Zt=(w=t.textureProperties)==null?void 0:w._BumpMap,fe=Zt!=null?{index:Zt,scale:vt,extensions:gl({},Ke)}:void 0,qe=((M=(x=t.vectorProperties)==null?void 0:x._EmissionColor)!=null?M:[0,0,0,1]).map(Om),ue=(T=t.textureProperties)==null?void 0:T._EmissionMap,Ye=ue!=null?{index:ue,extensions:gl({},Ke)}:void 0,Re=((O=(P=t.vectorProperties)==null?void 0:P._ShadeColor)!=null?O:[.97,.81,.86,1]).map(Om),Be=(N=t.textureProperties)==null?void 0:N._ShadeTexture,at=Be!=null?{index:Be,extensions:gl({},Ke)}:void 0;let pt=(z=(D=t.floatProperties)==null?void 0:D._ShadeShift)!=null?z:0,Jt=(k=(V=t.floatProperties)==null?void 0:V._ShadeToony)!=null?k:.9;Jt=vr.lerp(Jt,1,.5+.5*pt),pt=-pt-(1-Jt);const pn=(X=(j=t.floatProperties)==null?void 0:j._IndirectLightIntensity)!=null?X:.1,jn=pn?1-pn:void 0,en=(ee=t.textureProperties)==null?void 0:ee._SphereAdd,Hn=en!=null?[1,1,1]:void 0,pr=en!=null?{index:en}:void 0,Mi=(pe=(ie=t.floatProperties)==null?void 0:ie._RimLightingMix)!=null?pe:0,to=(ae=t.textureProperties)==null?void 0:ae._RimTexture,Ei=to!=null?{index:to,extensions:gl({},Ke)}:void 0,Ko=((B=(he=t.vectorProperties)==null?void 0:he._RimColor)!=null?B:[0,0,0,1]).map(Om),Ns=(Y=(J=t.floatProperties)==null?void 0:J._RimFresnelPower)!=null?Y:1,no=(G=(H=t.floatProperties)==null?void 0:H._RimLift)!=null?G:0,Ai=["none","worldCoordinates","screenCoordinates"][(se=(le=t.floatProperties)==null?void 0:le._OutlineWidthMode)!=null?se:0];let Aa=(Se=(ce=t.floatProperties)==null?void 0:ce._OutlineWidth)!=null?Se:0;Aa=.01*Aa;const ro=(we=t.textureProperties)==null?void 0:we._OutlineWidthTexture,ou=ro!=null?{index:ro,extensions:gl({},Ke)}:void 0,lu=((Ee=(We=t.vectorProperties)==null?void 0:We._OutlineColor)!=null?Ee:[0,0,0]).map(Om),cu=(($e=(Ge=t.floatProperties)==null?void 0:Ge._OutlineColorMode)!=null?$e:0)===1?(Z=(de=t.floatProperties)==null?void 0:de._OutlineLightingMix)!=null?Z:1:0,Bl=(Ve=t.textureProperties)==null?void 0:Ve._UvAnimMaskTexture,K=Bl!=null?{index:Bl,extensions:gl({},Ke)}:void 0,xe=(ne=(Le=t.floatProperties)==null?void 0:Le._UvAnimScrollX)!=null?ne:0;let Te=(Xe=(Ce=t.floatProperties)==null?void 0:Ce._UvAnimScrollY)!=null?Xe:0;Te!=null&&(Te=-Te);const Ie=(Q=(Ze=t.floatProperties)==null?void 0:Ze._UvAnimRotation)!=null?Q:0,Me={specVersion:"1.0",transparentWithZWrite:Ue,renderQueueOffsetNumber:ze,shadeColorFactor:Re,shadeMultiplyTexture:at,shadingShiftFactor:pt,shadingToonyFactor:Jt,giEqualizationFactor:jn,matcapFactor:Hn,matcapTexture:pr,rimLightingMixFactor:Mi,rimMultiplyTexture:Ei,parametricRimColorFactor:Ko,parametricRimFresnelPowerFactor:Ns,parametricRimLiftFactor:no,outlineWidthMode:Ai,outlineWidthFactor:Aa,outlineWidthMultiplyTexture:ou,outlineColorFactor:lu,outlineLightingMixFactor:cu,uvAnimationMaskTexture:K,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Te,uvAnimationRotationSpeedFactor:Ie};return Ej(gl({},e),{pbrMetallicRoughness:{baseColorFactor:te,baseColorTexture:Mt},normalTexture:fe,emissiveTexture:Ye,emissiveFactor:qe,alphaMode:bt,alphaCutoff:rt,doubleSided:Xt,extensions:{VRMC_materials_mtoon:Me}})}_parseV0UnlitProperties(t,e){var n,r,i,s,a;const o=t.shader==="VRM/UnlitTransparentZWrite",l=t.shader==="VRM/UnlitTransparent"||o,c=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",f=l?"BLEND":d?"MASK":"OPAQUE",p=d?(r=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?r:.5:void 0,y=this._portTextureTransform(t),b=((s=(i=t.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Om),S=(a=t.textureProperties)==null?void 0:a._MainTex,w=S!=null?{index:S,extensions:gl({},y)}:void 0,x={specVersion:"1.0",transparentWithZWrite:o,renderQueueOffsetNumber:c,shadeColorFactor:b,shadeMultiplyTexture:w};return Ej(gl({},e),{pbrMetallicRoughness:{baseColorFactor:b,baseColorTexture:w},alphaMode:f,alphaCutoff:p,extensions:{VRMC_materials_mtoon:x}})}_portTextureTransform(t){var e,n,r,i,s;const a=(e=t.vectorProperties)==null?void 0:e._MainTex;if(a==null)return{};const o=[(n=a==null?void 0:a[0])!=null?n:0,(r=a==null?void 0:a[1])!=null?r:0],l=[(i=a==null?void 0:a[2])!=null?i:1,(s=a==null?void 0:a[3])!=null?s:1];return o[1]=1-l[1]-o[1],{KHR_texture_transform:{offset:o,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 a=0;if(i){const o=t.renderQueue;o!=null&&(s?a=this._renderQueueMapTransparentZWrite.get(o):a=this._renderQueueMapTransparent.get(o))}return a}_populateRenderQueueMap(t){const e=new Set,n=new Set;t.forEach(r=>{var i,s;const a=r.shader==="VRM/UnlitTransparentZWrite",o=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||a,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||a;if(o){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)})}},Aj=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),nd=new q,oT=class extends Ts{constructor(t){super(),this._attrPosition=new Qt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(c6);const e=new Yt;e.setAttribute("position",this._attrPosition);const n=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Ul(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){nd.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,nd.x,nd.y,nd.z),this.constraint.source&&nd.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,nd.x,nd.y,nd.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function Tj(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var n1e=new q,r1e=new q;function i1e(t,e){return t.decompose(n1e,e,r1e),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}},s1e=new q,a1e=new q,o1e=new q,l1e=new qt,c1e=new qt,u1e=new qt,d1e=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 q(1,0,0),this._dstRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const t=l1e.identity(),e=c1e.identity();this.destination.parent&&(i1e(this.destination.parent.matrixWorld,t),z1(e.copy(t)));const n=s1e.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=Tj(this.source.matrixWorld,a1e).sub(Tj(this.destination.matrixWorld,o1e)).normalize(),i=u1e.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function f1e(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var h1e=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)f1e(s,a=>{const o=this._objectConstraintsMap.get(a);if(o)for(const l of o)this._processConstraint(l,e,n,r)});r(t),n.add(t)}},p1e=new qt,m1e=new qt,g1e=class extends aN{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new qt,this._invSrcRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),z1(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const t=p1e.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=m1e.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},v1e=new q,y1e=new qt,x1e=new qt,b1e=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 q(1,0,0),this._dstRestQuat=new qt,this._invDstRestQuat=new qt,this._invSrcRestQuatMulDstRestQuat=new qt}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=y1e.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=v1e.copy(this._v3RollAxis).applyQuaternion(t),r=x1e.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},_1e=new Set(["1.0","1.0-beta"]),YG=class $0{get name(){return $0.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return Aj(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return Aj(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf($0.EXTENSION_NAME))!==-1))return null;const s=new h1e,a=yield this.parser.getDependencies("node");return a.forEach((o,l)=>{var c;const d=r.nodes[l],f=(c=d==null?void 0:d.extensions)==null?void 0:c[$0.EXTENSION_NAME];if(f==null)return;const p=f.specVersion;if(!_1e.has(p)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${$0.EXTENSION_NAME} specVersion "${p}"`);return}const y=f.constraint;if(y.roll!=null){const b=this._importRollConstraint(o,a,y.roll);s.addConstraint(b)}else if(y.aim!=null){const b=this._importAimConstraint(o,a,y.aim);s.addConstraint(b)}else if(y.rotation!=null){const b=this._importRotationConstraint(o,a,y.rotation);s.addConstraint(b)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,r){const{source:i,rollAxis:s,weight:a}=r,o=n[i],l=new b1e(e,o);if(s!=null&&(l.rollAxis=s),a!=null&&(l.weight=a),this.helperRoot){const c=new oT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:a}=r,o=n[i],l=new d1e(e,o);if(s!=null&&(l.aimAxis=s),a!=null&&(l.weight=a),this.helperRoot){const c=new oT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,a=n[i],o=new g1e(e,a);if(s!=null&&(o.weight=s),this.helperRoot){const l=new oT(o);this.helperRoot.add(l)}return o}};YG.EXTENSION_NAME="VRMC_node_constraint";var w1e=YG,U_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{o(n.next(l))}catch(c){i(c)}},a=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,a);o((n=n.apply(t,e)).next())}),oN=class{},lT=new q,Gf=new q,ZG=class extends oN{get type(){return"capsule"}constructor(t){var e,n,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new q(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new q(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),Gf.subVectors(this.tail,this.offset).applyMatrix4(t),Gf.sub(lT);const i=Gf.lengthSq();r.copy(e).sub(lT);const s=Gf.dot(r);s<=0||(i<=s||Gf.multiplyScalar(s/i),r.sub(Gf));const a=r.length(),o=this.inside?this.radius-n-a:a-n-this.radius;return o<0&&(r.multiplyScalar(1/a),this.inside&&r.negate()),o}},cT=new q,Pj=new $t,QG=class extends oN{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new q(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new q(0,0,1)}calculateCollision(t,e,n,r){r.setFromMatrixPosition(t),r.negate().add(e),Pj.getNormalMatrix(t),cT.copy(this.normal).applyNormalMatrix(Pj).normalize();const i=r.dot(cT)-n;return r.copy(cT),i}},S1e=new q,JG=class extends oN{get type(){return"sphere"}constructor(t){var e,n,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new q(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 q,M1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new q,this._currentTail=new q,this._shape=t,this._attrPos=new Qt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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}},E1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentOffset=new q,this._currentNormal=new q,this._shape=t,this._attrPos=new Qt(new Float32Array(18),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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}},A1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new q,this._shape=t,this._attrPos=new Qt(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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}},T1e=new q,uT=class extends Ts{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof JG)this._geometry=new A1e(this.collider.shape);else if(this.collider.shape instanceof ZG)this._geometry=new M1e(this.collider.shape);else if(this.collider.shape instanceof QG)this._geometry=new E1e(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new ea(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=T1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},P1e=class extends Yt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new q,this._springBone=t,this._attrPos=new Qt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(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}},C1e=new q,R1e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new P1e(this.springBone);const e=new $r({color:16776960,depthTest:!1,depthWrite:!1});this._line=new ea(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=C1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},dT=class extends mn{constructor(t){super(),this.colliderMatrix=new Ct,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),N1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function N1e(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 I1e=new Ct;function k1e(t){return t.invert?t.invert():t.getInverse(I1e.copy(t)),t}var O1e=class{constructor(t){this._inverseCache=new Ct,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&&(k1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},fT=new Ct,Lm=new q,L0=new q,D0=new q,U0=new q,L1e=new Ct,D1e=class{constructor(t,e,n={},r=[]){this._currentTail=new q,this._prevTail=new q,this._boneAxis=new q,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Ct,this._initialLocalRotation=new qt,this._initialLocalChildPosition=new q;var i,s,a,o,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:(a=n.gravityPower)!=null?a:0,gravityDir:(l=(o=n.gravityDir)==null?void 0:o.clone())!=null?l:new q(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 pC(t,e){t.children.forEach(n=>{e(n)||pC(n,e)})}function j1e(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 Cj=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 a,o;return((o=(a=this._objectSpringBonesMap.get(s))==null?void 0:a.size)!=null?o: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 a of s){let o=!1,l=null;U1e(a,c=>{const d=this._objectSpringBonesMap.get(c);if(d)for(const f of d)o=!0,this._insertJointSort(f,e,n,r,i);else o||(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)}},Rj="VRMC_springBone_extended_collider",F1e=new Set(["1.0","1.0-beta"]),z1e=new Set(["1.0"]),eW=class Hm{get name(){return Hm.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 U_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return U_(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 U_(this,null,function*(){var n,r,i,s,a;const o=e.parser.json;if(!(((n=o.extensionsUsed)==null?void 0:n.indexOf(Hm.EXTENSION_NAME))!==-1))return null;const c=new Cj,d=yield e.parser.getDependencies("node"),f=(r=o.extensions)==null?void 0:r[Hm.EXTENSION_NAME];if(!f)return null;const p=f.specVersion;if(!F1e.has(p))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Hm.EXTENSION_NAME} specVersion "${p}"`),null;const y=(i=f.colliders)==null?void 0:i.map((S,w)=>{var x,M,T,P,O,N,D,z,V,k,j,X,ee,ie,pe;const ae=d[S.node];if(ae==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} attempted to reference a node #${S.node} but not found. Skipping the collider`),null;const he=S.shape,B=(x=S.extensions)==null?void 0:x[Rj];if(this.useExtendedColliders&&B!=null){const J=B.specVersion;if(!z1e.has(J))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Rj} specVersion "${J}". Fallbacking to the ${Hm.EXTENSION_NAME} definition`);else{const Y=B.shape;if(Y.sphere)return this._importSphereCollider(ae,{offset:new q().fromArray((M=Y.sphere.offset)!=null?M:[0,0,0]),radius:(T=Y.sphere.radius)!=null?T:0,inside:(P=Y.sphere.inside)!=null?P:!1});if(Y.capsule)return this._importCapsuleCollider(ae,{offset:new q().fromArray((O=Y.capsule.offset)!=null?O:[0,0,0]),radius:(N=Y.capsule.radius)!=null?N:0,tail:new q().fromArray((D=Y.capsule.tail)!=null?D:[0,0,0]),inside:(z=Y.capsule.inside)!=null?z:!1});if(Y.plane)return this._importPlaneCollider(ae,{offset:new q().fromArray((V=Y.plane.offset)!=null?V:[0,0,0]),normal:new q().fromArray((k=Y.plane.normal)!=null?k:[0,0,1])})}}if(he.sphere)return this._importSphereCollider(ae,{offset:new q().fromArray((j=he.sphere.offset)!=null?j:[0,0,0]),radius:(X=he.sphere.radius)!=null?X:0,inside:!1});if(he.capsule)return this._importCapsuleCollider(ae,{offset:new q().fromArray((ee=he.capsule.offset)!=null?ee:[0,0,0]),radius:(ie=he.capsule.radius)!=null?ie:0,tail:new q().fromArray((pe=he.capsule.tail)!=null?pe:[0,0,0]),inside:!1});console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} has no valid shape. Skipping the collider`)}),b=(s=f.colliderGroups)==null?void 0:s.map((S,w)=>{var x;return{colliders:((x=S.colliders)!=null?x:[]).map(T=>{const P=y==null?void 0:y[T];return P??(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(a=f.springs)==null||a.forEach((S,w)=>{var x;const M=S.joints,T=(x=S.colliderGroups)==null?void 0:x.map(N=>{const D=b==null?void 0:b[N];return D??(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),P=S.center!=null?d[S.center]:void 0;let O;M.forEach(N=>{if(O){const D=O.node,z=d[D],V=N.node,k=d[V],j={hitRadius:O.hitRadius,dragForce:O.dragForce,gravityPower:O.gravityPower,stiffness:O.stiffness,gravityDir:O.gravityDir!=null?new q().fromArray(O.gravityDir):void 0},X=this._importJoint(z,k,j,T);P&&(X.center=P),c.addJoint(X)}O=N})}),c.setInitState(),c})}_v0Import(e){return U_(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 o=(r=s.extensions)==null?void 0:r.VRM,l=o==null?void 0:o.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const d=new Cj,f=yield e.parser.getDependencies("node"),p=(i=l.colliderGroups)==null?void 0:i.map((y,b)=>{var S;const w=f[y.node];return w==null?(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${b} 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 P,O,N;const D=new q(0,0,0);return M.offset&&D.set((P=M.offset.x)!=null?P:0,(O=M.offset.y)!=null?O:0,M.offset.z?-M.offset.z:0),this._importSphereCollider(w,{offset:D,radius:(N=M.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,b)=>{const S=y.bones;S&&S.forEach(w=>{var x,M,T,P;const O=f[w];if(O==null){console.warn(`VRMSpringBoneLoaderPlugin: The spring bone group #${b} attempted to reference a node #${w} but not found. Skipping the node`);return}const N=new q;y.gravityDir?N.set((x=y.gravityDir.x)!=null?x:0,(M=y.gravityDir.y)!=null?M:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const D=y.center!=null?f[y.center]:void 0,z={hitRadius:y.hitRadius,dragForce:y.dragForce,gravityPower:y.gravityPower,stiffness:y.stiffiness,gravityDir:N},V=(P=y.colliderGroups)==null?void 0:P.map(k=>{const j=p==null?void 0:p[k];return j??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${b} attempted to reference a collider group #${k} but not found. Skipping the collider group`),null)}).filter(k=>k!=null);O.traverse(k=>{var j;const X=(j=k.children[0])!=null?j:null,ee=this._importJoint(k,X,z,V);D&&(ee.center=D),d.addJoint(ee)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new D1e(e,n,r,i);if(this.jointHelperRoot){const a=new R1e(s);this.jointHelperRoot.add(a),a.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new JG(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 ZG(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 QG(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}};eW.EXTENSION_NAME="VRMC_springBone";var B1e=eW,H1e=class{get name(){return"VRMLoaderPlugin"}constructor(t,e){var n,r,i,s,a,o,l,c,d,f;this.parser=t;const p=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 iwe(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new awe(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new hwe(t,{helperRoot:p,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new Pwe(t,{helperRoot:p}),this.metaPlugin=(a=e==null?void 0:e.metaPlugin)!=null?a:new Nwe(t),this.mtoonMaterialPlugin=(o=e==null?void 0:e.mtoonMaterialPlugin)!=null?o:new $we(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new qwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new t1e(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new B1e(t,{colliderHelperRoot:p,jointHelperRoot:p}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new w1e(t,{helperRoot:p})}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 kwe({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 V1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function Nj(t,e,n){if(e.size===1){const a=e.values().next().value;if(a.weight===1)return t[a.index]}const r=new Float32Array(t[0].count*3);let i=0;if(n)i=1;else for(const a of e)i+=a.weight;for(const a of e){const o=t[a.index],l=a.weight/i;for(let c=0;cd.getOrCreate(V)).join(","),D=`${P};${x};${N}`;let z=o.get(D);z==null&&(z=T.clone(),Y1e(z,O,b),o.set(D,z)),M.geometry.setAttribute("skinIndex",z)}for(const M of y)M.bind(w,new Ct)}}function $1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function X1e(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 Q1e(t){var e,n,r,i;const s=new Yt;s.name=t.name,s.setIndex(t.index);for(const[a,o]of Object.entries(t.attributes))s.setAttribute(a,o);for(const[a,o]of Object.entries(t.morphAttributes)){const l=a;s.morphAttributes[l]=o.concat()}s.morphTargetsRelative=t.morphTargetsRelative,s.groups=[];for(const a of t.groups)s.addGroup(a.start,a.count,a.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 Ij(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 J1e(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=>Ij(i)):r&&Ij(r))}function eSe(t){t.traverse(J1e)}function tSe(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 a=new Map;let o=0;for(const l of s){const d=l.geometry.getAttribute("skinIndex");if(a.has(d))continue;const f=new Map,p=new Map;for(let y=0;y{e.addGroup(a.start,a.count,a.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 sSe(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 a=e.get(i);if(a!=null){r.geometry=a;return}const{isVertexUsed:o,vertexCount:l,verticesUsed:c}=nSe(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=rSe(o),p=new Yt;iSe(i,p),e.set(i,p),sSe(p,s,d),oSe(p,i.attributes,f),cSe(p,i.morphAttributes,f),r.geometry=p}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function dSe(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var Wc=class{constructor(){}};Wc.combineMorphs=G1e;Wc.combineSkeletons=W1e;Wc.deepDispose=eSe;Wc.removeUnnecessaryJoints=tSe;Wc.removeUnnecessaryVertices=uSe;Wc.rotateVRM0=dSe;/*! * @pixiv/three-vrm-core v3.5.4 * The implementation of core features of VRM, for @pixiv/three-vrm * @@ -5465,12 +5470,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 dSe={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function No(t,e,n,r,i){var a;const s=(a=t.humanoid)==null?void 0:a.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function fSe(t){var e;for(const[n,r]of Object.entries(dSe))No(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function hSe(t,e,n,r,i,s){const a=Math.sin(e*1.7),o=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;No(t,"hips",0,l*.045,l*.03),No(t,"spine",a*.025+s*.07,o*.022,-l*.03),No(t,"chest",a*.02+s*.02,o*.018,0),No(t,"upperChest",a*.015,0,0),No(t,"neck",i*.4+d*.5,r*.4,0),No(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;No(t,"leftUpperArm",0,0,1.18+f+l*.04),No(t,"rightUpperArm",0,0,-1.18-f+l*.04),No(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),No(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const pSe=["happy","angry","sad","surprised","relaxed"],mSe={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function gSe({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=R.useState(null),a=R.useRef({}),o=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 x_e;return f.register(p=>new B1e(p)),f.load(t,p=>{var b;if(c)return;const y=p.userData.vrm;if(!y){r("Datei enthält kein gültiges VRM-Modell.");return}Wc.removeUnnecessaryVertices(p.scene),((b=y.meta)==null?void 0:b.metaVersion)==="0"&&Wc.rotateVRM0(y),y.scene.rotation.y=Math.PI,fSe(y),d=y,s(y)},void 0,p=>{console.error("VRM-Load-Fehler:",p),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&Wc.deepDispose(d.scene),s(null)}},[t,r]),EG((c,d)=>{var b;if(!i)return;const f=((b=e.current)==null?void 0:b.current)??0;i.lookAt&&(i.lookAt.target=c.camera);const p=l.current;p.t+=d,p.t>p.next&&(p.tYaw=(Math.random()-.5)*.5,p.tPitch=(Math.random()-.5)*.24,p.t=0,p.next=2.5+Math.random()*3.5),p.yaw+=(p.tYaw-p.yaw)*Math.min(1,d*1.5),p.pitch+=(p.tPitch-p.pitch)*Math.min(1,d*1.5),p.lean+=(Math.min(1,f*1.6)-p.lean)*Math.min(1,d*3),hSe(i,c.clock.elapsedTime,f,p.yaw,p.pitch,p.lean);const y=i.expressionManager;if(y){const S=(a.current.aa??0)*.4+f*.6;a.current.aa=S,y.setValue("aa",S);const w=mSe[n.current];for(const T of pSe){const P=w===T?.75:0,O=a.current[T]??0,N=O+(P-O)*Math.min(1,d*4);a.current[T]=N,y.setValue(T,N)}const x=o.current;x.t+=d,x.active<=0&&x.t>x.next&&(x.active=.16,x.t=0,x.next=3+Math.random()*4);let M=0;if(x.active>0){x.active-=d;const T=1-x.active/.16;M=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,M))}i.update(d)}),i?v.jsx("primitive",{object:i.scene}):null}function vSe({url:t,audioLevel:e,emotion:n}){const[r,i]=R.useState(null);return v.jsxs("div",{className:"relative h-full w-full",children:[v.jsxs(c_e,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[v.jsx("ambientLight",{intensity:.85}),v.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),v.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),v.jsx(gSe,{url:t,audioLevel:e,emotion:n,onError:i},t),v.jsx(y_e,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&v.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 ySe=["elevenlabs","edge"],xSe={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function bSe(){const[t,e]=R.useState([]),[n,r]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=R.useState(localStorage.getItem("mc_voice_voice")||""),[a,o]=R.useState(!1),[l,c]=R.useState(()=>{const x=localStorage.getItem("mc_voice_volume");if(x===null||x==="")return .6;const M=Number(x);return Number.isNaN(M)?.6:M}),d=R.useRef(null),f=x=>{c(x),localStorage.setItem("mc_voice_volume",String(x)),window.dispatchEvent(new CustomEvent("mc-voice-volume",{detail:x}))},p=(x,M)=>{r(x),s(M),localStorage.setItem("mc_voice_engine",x),localStorage.setItem("mc_voice_voice",M)};R.useEffect(()=>{fetch("/api/voice/voices").then(x=>x.ok?x.json():Promise.reject()).then(x=>{const M=x.voices||[];if(e(M),!i){const T=M.find(P=>P.engine===n);T&&p(n,T.id)}}).catch(()=>e([]))},[]);const y=async()=>{var x;if(!a){o(!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());(x=d.current)==null||x.pause();const P=new Audio(T);P.volume=Math.min(1,l),d.current=P,P.onended=()=>URL.revokeObjectURL(T),await P.play()}catch(M){console.error("Probe fehlgeschlagen:",M)}finally{o(!1)}}},b=x=>{const M=t.find(T=>T.engine===x);p(x,(M==null?void 0:M.id)||"")},S=t.filter(x=>x.engine===n),w=n==="elevenlabs"&&S.length===0;return v.jsxs("div",{className:"text-sm",children:[v.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[v.jsx(Vm,{className:"h-3.5 w-3.5"})," Stimme"]}),t.length===0?v.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."}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:ySe.map(x=>v.jsx("button",{onClick:()=>b(x),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===x?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:xSe[x]},x))}),v.jsx("select",{value:i,onChange:x=>p(n,x.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(x=>v.jsx("option",{value:x.id,children:x.label},x.id))}),v.jsxs("button",{onClick:y,disabled:a||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:[a?v.jsx($1,{className:"h-3.5 w-3.5 animate-spin"}):v.jsx(DT,{className:"h-3.5 w-3.5"}),a?"Spielt …":"Probe hören"]}),v.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[v.jsx(DT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),v.jsx("input",{type:"range",min:0,max:1.2,step:.05,value:l,onChange:x=>f(Number(x.target.value)),className:"h-1 flex-1 cursor-pointer accent-primary",title:"Lautstärke"}),v.jsxs("span",{className:"w-9 text-right text-[11px] tabular-nums text-muted-foreground",children:[Math.round(l*100),"%"]})]}),w&&v.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",v.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder keine eigene Stimme angelegt."]}),n==="edge"&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})}function _Se(t){const[e,n]=R.useState(!1),r=R.useRef(null),i=R.useRef([]),s=R.useRef(null),a=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 p;const f=new Blob(i.current,{type:c});(p=s.current)==null||p.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]),o=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:a,stop:o}}class lN{constructor(){Gs(this,"ctx");Gs(this,"analyser");Gs(this,"gain");Gs(this,"queue",[]);Gs(this,"playing",!1);Gs(this,"raf",0);Gs(this,"freq");Gs(this,"level",{current:0});Gs(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=lN.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 kj(){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 ASe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function TSe(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 PSe(){const[t,e]=R.useState("idle"),[n,r]=R.useState([]),[i,s]=R.useState(null),a=R.useRef({current:0}),o=R.useRef("neutral"),l=R.useRef(null),c=R.useRef(kj()),d=R.useCallback(()=>{if(!l.current){const M=new lN;M.onSpeaking=T=>e(P=>T?"speaking":P==="speaking"?"idle":P),l.current=M,a.current=M.level}return l.current},[]),f=R.useCallback(async M=>{var ee,ie,pe,ae;s(null);const T=d();T.clear(),e("transcribing");let P="";try{const he=new FormData;he.append("audio",M,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:he});if(!B.ok)throw new Error(`STT ${B.status}`);P=((ee=(await B.json()).text)==null?void 0:ee.trim())||""}catch(he){e("error"),s(`Spracherkennung fehlgeschlagen: ${he.message}`);return}if(!P){e("idle");return}r(he=>[...he,{role:"user",text:P}]),e("thinking");const{engine:O,voice:N}=ASe();let D="",z="";r(he=>[...he,{role:"assistant",text:""}]);let V=Promise.resolve(),k=!1,j=!1;const X=he=>{const B=ESe(he);B&&(V=V.then(async()=>{try{const J=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:B,engine:O,voice:N})});if(!J.ok)throw new Error(`TTS ${J.status}`);await T.enqueue(await J.arrayBuffer()),k=!0}catch(J){j=!0,console.error("TTS-Fehler:",J)}}))};try{const he=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:P,session_id:c.current,system:MSe})});if(!he.ok||!he.body)throw new Error(`Agent ${he.status}`);const B=he.body.getReader(),J=new TextDecoder;let Y="";for(;;){const{done:H,value:G}=await B.read();if(H)break;Y+=J.decode(G,{stream:!0});const le=Y.split(` + */const fSe={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function No(t,e,n,r,i){var a;const s=(a=t.humanoid)==null?void 0:a.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function hSe(t){var e;for(const[n,r]of Object.entries(fSe))No(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function pSe(t,e,n,r,i,s){const a=Math.sin(e*1.7),o=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;No(t,"hips",0,l*.045,l*.03),No(t,"spine",a*.025+s*.07,o*.022,-l*.03),No(t,"chest",a*.02+s*.02,o*.018,0),No(t,"upperChest",a*.015,0,0),No(t,"neck",i*.4+d*.5,r*.4,0),No(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;No(t,"leftUpperArm",0,0,1.18+f+l*.04),No(t,"rightUpperArm",0,0,-1.18-f+l*.04),No(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),No(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const mSe=["happy","angry","sad","surprised","relaxed"],gSe={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function vSe({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=R.useState(null),a=R.useRef({}),o=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 b_e;return f.register(p=>new H1e(p)),f.load(t,p=>{var b;if(c)return;const y=p.userData.vrm;if(!y){r("Datei enthält kein gültiges VRM-Modell.");return}Wc.removeUnnecessaryVertices(p.scene),((b=y.meta)==null?void 0:b.metaVersion)==="0"&&Wc.rotateVRM0(y),y.scene.rotation.y=Math.PI,hSe(y),d=y,s(y)},void 0,p=>{console.error("VRM-Load-Fehler:",p),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&Wc.deepDispose(d.scene),s(null)}},[t,r]),AG((c,d)=>{var b;if(!i)return;const f=((b=e.current)==null?void 0:b.current)??0;i.lookAt&&(i.lookAt.target=c.camera);const p=l.current;p.t+=d,p.t>p.next&&(p.tYaw=(Math.random()-.5)*.5,p.tPitch=(Math.random()-.5)*.24,p.t=0,p.next=2.5+Math.random()*3.5),p.yaw+=(p.tYaw-p.yaw)*Math.min(1,d*1.5),p.pitch+=(p.tPitch-p.pitch)*Math.min(1,d*1.5),p.lean+=(Math.min(1,f*1.6)-p.lean)*Math.min(1,d*3),pSe(i,c.clock.elapsedTime,f,p.yaw,p.pitch,p.lean);const y=i.expressionManager;if(y){const S=(a.current.aa??0)*.4+f*.6;a.current.aa=S,y.setValue("aa",S);const w=gSe[n.current];for(const T of mSe){const P=w===T?.75:0,O=a.current[T]??0,N=O+(P-O)*Math.min(1,d*4);a.current[T]=N,y.setValue(T,N)}const x=o.current;x.t+=d,x.active<=0&&x.t>x.next&&(x.active=.16,x.t=0,x.next=3+Math.random()*4);let M=0;if(x.active>0){x.active-=d;const T=1-x.active/.16;M=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,M))}i.update(d)}),i?v.jsx("primitive",{object:i.scene}):null}function ySe({url:t,audioLevel:e,emotion:n}){const[r,i]=R.useState(null);return v.jsxs("div",{className:"relative h-full w-full",children:[v.jsxs(u_e,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[v.jsx("ambientLight",{intensity:.85}),v.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),v.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),v.jsx(vSe,{url:t,audioLevel:e,emotion:n,onError:i},t),v.jsx(x_e,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&v.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 xSe=["elevenlabs","edge"],bSe={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function _Se(){const[t,e]=R.useState([]),[n,r]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=R.useState(localStorage.getItem("mc_voice_voice")||""),[a,o]=R.useState(!1),[l,c]=R.useState(()=>{const x=localStorage.getItem("mc_voice_volume");if(x===null||x==="")return .6;const M=Number(x);return Number.isNaN(M)?.6:M}),d=R.useRef(null),f=x=>{c(x),localStorage.setItem("mc_voice_volume",String(x)),window.dispatchEvent(new CustomEvent("mc-voice-volume",{detail:x}))},p=(x,M)=>{r(x),s(M),localStorage.setItem("mc_voice_engine",x),localStorage.setItem("mc_voice_voice",M)};R.useEffect(()=>{fetch("/api/voice/voices").then(x=>x.ok?x.json():Promise.reject()).then(x=>{const M=x.voices||[];if(e(M),!i){const T=M.find(P=>P.engine===n);T&&p(n,T.id)}}).catch(()=>e([]))},[]);const y=async()=>{var x;if(!a){o(!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());(x=d.current)==null||x.pause();const P=new Audio(T);P.volume=Math.min(1,l),d.current=P,P.onended=()=>URL.revokeObjectURL(T),await P.play()}catch(M){console.error("Probe fehlgeschlagen:",M)}finally{o(!1)}}},b=x=>{const M=t.find(T=>T.engine===x);p(x,(M==null?void 0:M.id)||"")},S=t.filter(x=>x.engine===n),w=n==="elevenlabs"&&S.length===0;return v.jsxs("div",{className:"text-sm",children:[v.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[v.jsx(Vm,{className:"h-3.5 w-3.5"})," Stimme"]}),t.length===0?v.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."}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:xSe.map(x=>v.jsx("button",{onClick:()=>b(x),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===x?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:bSe[x]},x))}),v.jsx("select",{value:i,onChange:x=>p(n,x.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(x=>v.jsx("option",{value:x.id,children:x.label},x.id))}),v.jsxs("button",{onClick:y,disabled:a||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:[a?v.jsx($1,{className:"h-3.5 w-3.5 animate-spin"}):v.jsx(DT,{className:"h-3.5 w-3.5"}),a?"Spielt …":"Probe hören"]}),v.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[v.jsx(DT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),v.jsx("input",{type:"range",min:0,max:1.2,step:.05,value:l,onChange:x=>f(Number(x.target.value)),className:"h-1 flex-1 cursor-pointer accent-primary",title:"Lautstärke"}),v.jsxs("span",{className:"w-9 text-right text-[11px] tabular-nums text-muted-foreground",children:[Math.round(l*100),"%"]})]}),w&&v.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",v.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder keine eigene Stimme angelegt."]}),n==="edge"&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})}function wSe(t){const[e,n]=R.useState(!1),r=R.useRef(null),i=R.useRef([]),s=R.useRef(null),a=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 p;const f=new Blob(i.current,{type:c});(p=s.current)==null||p.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]),o=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:a,stop:o}}class lN{constructor(){Gs(this,"ctx");Gs(this,"analyser");Gs(this,"gain");Gs(this,"queue",[]);Gs(this,"playing",!1);Gs(this,"raf",0);Gs(this,"freq");Gs(this,"level",{current:0});Gs(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=lN.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 kj(){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 TSe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function PSe(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 CSe(){const[t,e]=R.useState("idle"),[n,r]=R.useState([]),[i,s]=R.useState(null),a=R.useRef({current:0}),o=R.useRef("neutral"),l=R.useRef(null),c=R.useRef(kj()),d=R.useCallback(()=>{if(!l.current){const M=new lN;M.onSpeaking=T=>e(P=>T?"speaking":P==="speaking"?"idle":P),l.current=M,a.current=M.level}return l.current},[]),f=R.useCallback(async M=>{var ee,ie,pe,ae;s(null);const T=d();T.clear(),e("transcribing");let P="";try{const he=new FormData;he.append("audio",M,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:he});if(!B.ok)throw new Error(`STT ${B.status}`);P=((ee=(await B.json()).text)==null?void 0:ee.trim())||""}catch(he){e("error"),s(`Spracherkennung fehlgeschlagen: ${he.message}`);return}if(!P){e("idle");return}r(he=>[...he,{role:"user",text:P}]),e("thinking");const{engine:O,voice:N}=TSe();let D="",z="";r(he=>[...he,{role:"assistant",text:""}]);let V=Promise.resolve(),k=!1,j=!1;const X=he=>{const B=ASe(he);B&&(V=V.then(async()=>{try{const J=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:B,engine:O,voice:N})});if(!J.ok)throw new Error(`TTS ${J.status}`);await T.enqueue(await J.arrayBuffer()),k=!0}catch(J){j=!0,console.error("TTS-Fehler:",J)}}))};try{const he=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:P,session_id:c.current,system:ESe})});if(!he.ok||!he.body)throw new Error(`Agent ${he.status}`);const B=he.body.getReader(),J=new TextDecoder;let Y="";for(;;){const{done:H,value:G}=await B.read();if(H)break;Y+=J.decode(G,{stream:!0});const le=Y.split(` `);Y=le.pop()||"";for(const se of le){const ce=se.split(` -`).find($e=>$e.startsWith("data:"));if(!ce)continue;const Se=ce.slice(5).trim();if(Se==="[DONE]")continue;let we;try{we=JSON.parse(Se)}catch{continue}if(we.error)throw new Error(we.error);const We=((ae=(pe=(ie=we.choices)==null?void 0:ie[0])==null?void 0:pe.delta)==null?void 0:ae.content)||"";if(!We)continue;D+=We,z+=We,o.current=SSe(D),r($e=>{const de=$e.slice();return de[de.length-1]={role:"assistant",text:D},de});const{sentences:Ee,rest:Ge}=TSe(z);z=Ge,Ee.forEach(X)}}if(z.trim()&&X(z),await V,!D.trim()){e("idle");return}k||(e("error"),s(j?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(he){e("error"),s(`Agent-Antwort fehlgeschlagen: ${he.message}`)}},[d]),{recording:p,start:y,stop:b}=_Se(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),w=R.useCallback(()=>{b()},[b]),x=R.useCallback(()=>{var M;(M=l.current)==null||M.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=kj()},[]);return R.useEffect(()=>{!p&&t==="listening"&&e("transcribing")},[p,t]),{status:t,messages:n,error:i,recording:p,audioLevel:a,emotion:o,pressStart:S,pressEnd:w,reset:x}}const CSe="/avatar.vrm";function RSe(t){return t.split(/(\*\*[^*\n]+\*\*)/g).map((e,n)=>{const r=e.match(/^\*\*([^*]+)\*\*$/);return r?v.jsx("strong",{className:"font-semibold text-foreground",children:r[1]},n):v.jsx("span",{children:e},n)})}function NSe(){return v.jsx("span",{className:"inline-flex items-center gap-1 align-middle",children:[0,1,2].map(t=>v.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground",style:{animationDelay:`${t*.15}s`}},t))})}const ISe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function kSe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:a,pressEnd:o,reset:l}=PSe(),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=w=>w instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(w.tagName),b=w=>{w.code!=="Space"||w.repeat||c.current||y(w.target)||(w.preventDefault(),c.current=!0,a())},S=w=>{w.code!=="Space"||!c.current||(w.preventDefault(),c.current=!1,o())};return window.addEventListener("keydown",b),window.addEventListener("keyup",S),()=>{window.removeEventListener("keydown",b),window.removeEventListener("keyup",S)}},[a,o]);const f=t==="speaking",p=t==="transcribing"||t==="thinking";return v.jsxs("div",{className:"flex h-full gap-5",children:[v.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[v.jsx("div",{className:"flex-1 min-h-0",children:v.jsx(vSe,{url:CSe,audioLevel:i,emotion:s})}),v.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:[v.jsxs("div",{className:Je("flex items-center gap-2 text-sm",t==="error"?"text-red-400":f?"text-primary":"text-muted-foreground"),children:[p&&v.jsx($1,{className:"h-4 w-4 animate-spin"}),f&&v.jsx(DT,{className:"h-4 w-4 animate-pulse"}),v.jsx("span",{children:n||ISe[t]})]}),v.jsx("button",{onPointerDown:y=>{y.preventDefault(),c.current=!0,a()},onPointerUp:()=>{c.current&&(c.current=!1,o())},onPointerLeave:()=>{c.current&&(c.current=!1,o())},className:Je("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:v.jsx(fF,{className:Je("h-8 w-8",r?"text-red-400":"text-primary")})}),v.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",v.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),v.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[v.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4",children:v.jsx(bSe,{})}),v.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[v.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),v.jsx("button",{onClick:l,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:v.jsx(hF,{className:"h-3.5 w-3.5"})})]}),v.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4 scrollbar-thin",children:[e.length===0&&v.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,b)=>v.jsxs("div",{className:Je("flex flex-col gap-1",y.role==="user"?"items-end":"items-start"),children:[v.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:y.role==="user"?"Du":"Hermes"}),v.jsx("div",{className:Je("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?RSe(y.text):v.jsx(NSe,{})})]},b)),v.jsx("div",{ref:d})]})]})]})]})}const Oj=[{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 OSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function pa({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:a}){return v.jsxs("section",{id:t,className:Je("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",a&&"md:col-span-2"),children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(e,{className:Je("h-5 w-5 shrink-0",n)}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&v.jsx("span",{className:Je("text-[9px] font-mono",n),children:i})]})]}),v.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Wf({children:t}){return v.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[v.jsx(Vm,{className:"h-3 w-3"})," Bei dir konkret"]}),v.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function hn({children:t}){return v.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 Lr({href:t,name:e,note:n}){return v.jsxs("li",{className:"leading-relaxed",children:[v.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,v.jsx(M8,{className:"h-3 w-3 opacity-60"})]}),v.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function LSe(){const[t,e]=R.useState(!1);return v.jsxs("div",{className:"space-y-7",children:[v.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:[v.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:v.jsx(CT,{className:"h-6 w-6 text-primary"})}),v.jsxs("div",{className:"space-y-1",children:[v.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"}),v.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. ",v.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",v.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),v.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:v.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:v.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[v.jsx(RT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?Oj:Oj.slice(0,9)).map(n=>v.jsx("button",{onClick:()=>OSe(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)),v.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"})]})})}),v.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[v.jsxs(pa,{id:"grundlagen",icon:Md,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[v.jsxs("p",{children:["Ein LLM ist im Kern ein ",v.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.']}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),v.jsxs("li",{children:[v.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",v.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),v.jsxs(pa,{id:"moe",icon:_C,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",v.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",v.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(hn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),v.jsxs("li",{children:[v.jsx(hn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),v.jsxs("li",{children:[v.jsx(hn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),v.jsxs(Wf,{children:["VRAM/RAM ist die harte Grenze — ",v.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",v.jsx(hn,{children:"Q4_K_M"}),"/",v.jsx(hn,{children:"Q6_K"}),"."]})]}),v.jsxs(pa,{id:"lokal",icon:rw,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"llama-swap"})," — Proxy, der ",v.jsx("em",{children:"mehrere"})," Modelle hinter ",v.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(hn,{children:"CUDA"})," NVIDIA · ",v.jsx(hn,{children:"ROCm"})," AMD · ",v.jsx(hn,{children:"Vulkan"})," herstellerübergreifend · ",v.jsx(hn,{children:"Metal"})," Apple"]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",v.jsx(hn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",v.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),v.jsxs(Wf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",v.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",v.jsx(hn,{children:"Vulkan/RADV"})," das offizielle ",v.jsx(hn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",v.jsx(hn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",v.jsx(hn,{children:"coder"})," nutzt Spec-Decoding."]})]}),v.jsxs(pa,{id:"modelle",icon:nw,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Llama"})," (Meta), ",v.jsx("strong",{children:"Gemma"})," (Google), ",v.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"DeepSeek"}),", ",v.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Frontier (Cloud-API):"})}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx("strong",{children:"Claude"})," (Anthropic), ",v.jsx("strong",{children:"GPT"})," (OpenAI), ",v.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),v.jsxs("p",{className:"pt-1",children:[v.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."]})]})]}),v.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".'}),v.jsxs(Wf,{children:["Dein Line-up via llama-swap: ",v.jsx(hn,{children:"fast"})," (Alltag/Vision/MoE) · ",v.jsx(hn,{children:"heavy"})," (schwere Logik) ·",v.jsx(hn,{children:"coder"})," · ",v.jsx(hn,{children:"scout"})," · ",v.jsx(hn,{children:"vision"})," · ",v.jsx(hn,{children:"embed"})," (fürs Gedächtnis) ·",v.jsx(hn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",v.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),v.jsxs(pa,{id:"gateway",icon:Q8,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[v.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",v.jsx("strong",{children:"OpenAI-Format"})," (",v.jsx(hn,{children:"/v1/chat/completions"}),"). Ein",v.jsx("strong",{children:" Gateway"})," davor gibt dir ",v.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",v.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),v.jsxs("p",{children:["Die ",v.jsx(hn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),v.jsxs(Wf,{children:["Dein Gateway: ",v.jsx(hn,{children:"http://192.168.178.151:9001/v1"}),", Model ",v.jsx(hn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",v.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),v.jsxs(pa,{id:"mcp",icon:kT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[v.jsxs("p",{children:["Das ",v.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",v.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),v.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),v.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:[v.jsx(q8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),v.jsxs("span",{children:[v.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),v.jsxs(pa,{id:"skills",icon:n9,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",v.jsx(hn,{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."]}),v.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 Se=ce.slice(5).trim();if(Se==="[DONE]")continue;let we;try{we=JSON.parse(Se)}catch{continue}if(we.error)throw new Error(we.error);const We=((ae=(pe=(ie=we.choices)==null?void 0:ie[0])==null?void 0:pe.delta)==null?void 0:ae.content)||"";if(!We)continue;D+=We,z+=We,o.current=MSe(D),r($e=>{const de=$e.slice();return de[de.length-1]={role:"assistant",text:D},de});const{sentences:Ee,rest:Ge}=PSe(z);z=Ge,Ee.forEach(X)}}if(z.trim()&&X(z),await V,!D.trim()){e("idle");return}k||(e("error"),s(j?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(he){e("error"),s(`Agent-Antwort fehlgeschlagen: ${he.message}`)}},[d]),{recording:p,start:y,stop:b}=wSe(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),w=R.useCallback(()=>{b()},[b]),x=R.useCallback(()=>{var M;(M=l.current)==null||M.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=kj()},[]);return R.useEffect(()=>{!p&&t==="listening"&&e("transcribing")},[p,t]),{status:t,messages:n,error:i,recording:p,audioLevel:a,emotion:o,pressStart:S,pressEnd:w,reset:x}}const RSe="/avatar.vrm";function NSe(t){return t.split(/(\*\*[^*\n]+\*\*)/g).map((e,n)=>{const r=e.match(/^\*\*([^*]+)\*\*$/);return r?v.jsx("strong",{className:"font-semibold text-foreground",children:r[1]},n):v.jsx("span",{children:e},n)})}function ISe(){return v.jsx("span",{className:"inline-flex items-center gap-1 align-middle",children:[0,1,2].map(t=>v.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground",style:{animationDelay:`${t*.15}s`}},t))})}const kSe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function OSe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:a,pressEnd:o,reset:l}=CSe(),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=w=>w instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(w.tagName),b=w=>{w.code!=="Space"||w.repeat||c.current||y(w.target)||(w.preventDefault(),c.current=!0,a())},S=w=>{w.code!=="Space"||!c.current||(w.preventDefault(),c.current=!1,o())};return window.addEventListener("keydown",b),window.addEventListener("keyup",S),()=>{window.removeEventListener("keydown",b),window.removeEventListener("keyup",S)}},[a,o]);const f=t==="speaking",p=t==="transcribing"||t==="thinking";return v.jsxs("div",{className:"flex h-full gap-5",children:[v.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[v.jsx("div",{className:"flex-1 min-h-0",children:v.jsx(ySe,{url:RSe,audioLevel:i,emotion:s})}),v.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:[v.jsxs("div",{className:Je("flex items-center gap-2 text-sm",t==="error"?"text-red-400":f?"text-primary":"text-muted-foreground"),children:[p&&v.jsx($1,{className:"h-4 w-4 animate-spin"}),f&&v.jsx(DT,{className:"h-4 w-4 animate-pulse"}),v.jsx("span",{children:n||kSe[t]})]}),v.jsx("button",{onPointerDown:y=>{y.preventDefault(),c.current=!0,a()},onPointerUp:()=>{c.current&&(c.current=!1,o())},onPointerLeave:()=>{c.current&&(c.current=!1,o())},className:Je("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:v.jsx(fF,{className:Je("h-8 w-8",r?"text-red-400":"text-primary")})}),v.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",v.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),v.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[v.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4",children:v.jsx(_Se,{})}),v.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[v.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),v.jsx("button",{onClick:l,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:v.jsx(hF,{className:"h-3.5 w-3.5"})})]}),v.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4 scrollbar-thin",children:[e.length===0&&v.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,b)=>v.jsxs("div",{className:Je("flex flex-col gap-1",y.role==="user"?"items-end":"items-start"),children:[v.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:y.role==="user"?"Du":"Hermes"}),v.jsx("div",{className:Je("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?NSe(y.text):v.jsx(ISe,{})})]},b)),v.jsx("div",{ref:d})]})]})]})]})}const Oj=[{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 LSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function pa({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:a}){return v.jsxs("section",{id:t,className:Je("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",a&&"md:col-span-2"),children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(e,{className:Je("h-5 w-5 shrink-0",n)}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&v.jsx("span",{className:Je("text-[9px] font-mono",n),children:i})]})]}),v.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Wf({children:t}){return v.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[v.jsx(Vm,{className:"h-3 w-3"})," Bei dir konkret"]}),v.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function hn({children:t}){return v.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 Lr({href:t,name:e,note:n}){return v.jsxs("li",{className:"leading-relaxed",children:[v.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,v.jsx(E8,{className:"h-3 w-3 opacity-60"})]}),v.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function DSe(){const[t,e]=R.useState(!1);return v.jsxs("div",{className:"space-y-7",children:[v.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:[v.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:v.jsx(CT,{className:"h-6 w-6 text-primary"})}),v.jsxs("div",{className:"space-y-1",children:[v.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"}),v.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. ",v.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",v.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),v.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:v.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:v.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[v.jsx(RT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?Oj:Oj.slice(0,9)).map(n=>v.jsx("button",{onClick:()=>LSe(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)),v.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"})]})})}),v.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[v.jsxs(pa,{id:"grundlagen",icon:Md,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[v.jsxs("p",{children:["Ein LLM ist im Kern ein ",v.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.']}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),v.jsxs("li",{children:[v.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",v.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),v.jsxs(pa,{id:"moe",icon:_C,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",v.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",v.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(hn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),v.jsxs("li",{children:[v.jsx(hn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),v.jsxs("li",{children:[v.jsx(hn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),v.jsxs(Wf,{children:["VRAM/RAM ist die harte Grenze — ",v.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",v.jsx(hn,{children:"Q4_K_M"}),"/",v.jsx(hn,{children:"Q6_K"}),"."]})]}),v.jsxs(pa,{id:"lokal",icon:rw,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"llama-swap"})," — Proxy, der ",v.jsx("em",{children:"mehrere"})," Modelle hinter ",v.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(hn,{children:"CUDA"})," NVIDIA · ",v.jsx(hn,{children:"ROCm"})," AMD · ",v.jsx(hn,{children:"Vulkan"})," herstellerübergreifend · ",v.jsx(hn,{children:"Metal"})," Apple"]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",v.jsx(hn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",v.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),v.jsxs(Wf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",v.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",v.jsx(hn,{children:"Vulkan/RADV"})," das offizielle ",v.jsx(hn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",v.jsx(hn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",v.jsx(hn,{children:"coder"})," nutzt Spec-Decoding."]})]}),v.jsxs(pa,{id:"modelle",icon:nw,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Llama"})," (Meta), ",v.jsx("strong",{children:"Gemma"})," (Google), ",v.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"DeepSeek"}),", ",v.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Frontier (Cloud-API):"})}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx("strong",{children:"Claude"})," (Anthropic), ",v.jsx("strong",{children:"GPT"})," (OpenAI), ",v.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),v.jsxs("p",{className:"pt-1",children:[v.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."]})]})]}),v.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".'}),v.jsxs(Wf,{children:["Dein Line-up via llama-swap: ",v.jsx(hn,{children:"fast"})," (Alltag/Vision/MoE) · ",v.jsx(hn,{children:"heavy"})," (schwere Logik) ·",v.jsx(hn,{children:"coder"})," · ",v.jsx(hn,{children:"scout"})," · ",v.jsx(hn,{children:"vision"})," · ",v.jsx(hn,{children:"embed"})," (fürs Gedächtnis) ·",v.jsx(hn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",v.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),v.jsxs(pa,{id:"gateway",icon:e9,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[v.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",v.jsx("strong",{children:"OpenAI-Format"})," (",v.jsx(hn,{children:"/v1/chat/completions"}),"). Ein",v.jsx("strong",{children:" Gateway"})," davor gibt dir ",v.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",v.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),v.jsxs("p",{children:["Die ",v.jsx(hn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),v.jsxs(Wf,{children:["Dein Gateway: ",v.jsx(hn,{children:"http://192.168.178.151:9001/v1"}),", Model ",v.jsx(hn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",v.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),v.jsxs(pa,{id:"mcp",icon:kT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[v.jsxs("p",{children:["Das ",v.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",v.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),v.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),v.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:[v.jsx(Y8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),v.jsxs("span",{children:[v.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),v.jsxs(pa,{id:"skills",icon:i9,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",v.jsx(hn,{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."]}),v.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 -...`}),v.jsxs("p",{children:["Suchen & installieren über die ",v.jsx("strong",{children:"skills.sh"}),"-Registry: ",v.jsx(hn,{children:"npx skills find"})," /",v.jsx(hn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),v.jsxs(pa,{id:"memory",icon:L8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["LLMs sind ",v.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",v.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:["extrahiert Fakten ",v.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),v.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),v.jsxs("li",{children:[v.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",v.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),v.jsxs(Wf,{children:["Dein Gedächtnis (Tab ",v.jsx("strong",{children:"Gedächtnis"}),") ist ",v.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",v.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",v.jsx(hn,{children:"Identität"})," · ",v.jsx(hn,{children:"Wissen"})," · ",v.jsx(hn,{children:"Regeln"})," · ",v.jsx(hn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",v.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",v.jsx("br",{}),v.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),v.jsxs(pa,{id:"agents",icon:$c,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",v.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.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."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",v.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),v.jsxs(Wf,{children:[v.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",v.jsx(hn,{children:"fast"}),"). Reden tust du mit ihm im",v.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",v.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",v.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",v.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),v.jsxs(pa,{id:"ide",icon:uF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[v.jsxs("p",{children:["Jede ",v.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Cline"})," & ",v.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Continue"}),", ",v.jsx("strong",{children:"aider"})," (CLI), ",v.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),v.jsxs(Wf,{children:["Tipp den Kram nicht ab: der ",v.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",v.jsx(hn,{children:"…:9001/v1"}),", Model ",v.jsx(hn,{children:"auto"}),", Key beliebig."]})]}),v.jsx(pa,{id:"tricks",icon:$8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:v.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])=>v.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[v.jsx(wh,{className:"h-3 w-3 text-amber-400"})," ",n]}),v.jsx("p",{className:"text-[11px]",children:r})]},n))})}),v.jsx(pa,{id:"wartung",icon:Ym,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(dF,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(wC,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",v.jsx(hn,{children:"restore.sh"})," (Doku in ",v.jsx(hn,{children:"docs/BACKUP.md"}),")."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",v.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",v.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),v.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),v.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:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(RT,{className:"h-5 w-5 text-primary"}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),v.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),v.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(nw,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),v.jsx(Lr,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),v.jsx(Lr,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),v.jsx(Lr,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),v.jsx(Lr,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),v.jsx(Lr,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(kT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),v.jsx(Lr,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),v.jsx(Lr,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),v.jsx(Lr,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),v.jsx(Lr,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx($c,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),v.jsx(Lr,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),v.jsx(Lr,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),v.jsx(Lr,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),v.jsx(Lr,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(CT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),v.jsx(Lr,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),v.jsx(Lr,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),v.jsx(Lr,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),v.jsx(Lr,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),v.jsx(pa,{id:"troubleshooting",icon:W8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:v.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",v.jsx(hn,{children:":9001"}),")? Backend-Status in der ",v.jsx("strong",{children:"Zentrale"})," prüfen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",v.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",v.jsx(hn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",v.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",v.jsx(hn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),v.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 DSe({title:t,hint:e}){return v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-xl font-semibold",children:t}),v.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),v.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:[v.jsx(O8,{className:"h-8 w-8 text-muted-foreground"}),v.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const Lj=[{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 j0({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:a,onAction:o}){return v.jsxs("div",{className:Je("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:[v.jsx(t,{className:Je("h-4 w-4 shrink-0",e)}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:n}),v.jsx("div",{className:Je("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),v.jsx("button",{onClick:o,disabled:!i||s,className:Je("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?"…":a})]})}function USe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return v.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[v.jsx("span",{className:Je("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),v.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&v.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),v.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:v.jsx(Jf,{className:Je("h-3.5 w-3.5",r&&"animate-spin")})}),v.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:v.jsx(D8,{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 jSe({open:t,onClose:e,defaultTab:n="maintenance"}){var Ke;const[r,i]=R.useState(null),[s,a]=R.useState([]),[o,l]=R.useState("llama-swap"),[c,d]=R.useState(""),[f,p]=R.useState(!1),[y,b]=R.useState(null),[S,w]=R.useState({}),[x,M]=R.useState("maintenance"),[T,P]=R.useState(!1),[O,N]=R.useState(""),[D,z]=R.useState(!1),[V,k]=R.useState(null),[j,X]=R.useState([]),[ee,ie]=R.useState(!1),[pe,ae]=R.useState(null),[he,B]=R.useState(null);function J(te,tt,Mt){B({type:"alert",title:te,message:tt,onConfirm:()=>{B(null),Mt&&Mt()}})}function Y(te,tt,Mt){B({type:"confirm",title:te,message:tt,onConfirm:()=>{B(null),Mt()},onCancel:()=>B(null)})}function H(te){return te?new Date(te*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[G,le]=R.useState(""),[se,ce]=R.useState(""),[Se,we]=R.useState(!1),[We,Ee]=R.useState(!1);R.useEffect(()=>{t&&(le(localStorage.getItem("mc_sudo_password")||""),ce(localStorage.getItem("mc_hf_token")||""))},[t]),R.useEffect(()=>{t&&n&&M(n)},[t,n]);const Ge=R.useRef(null);function $e(){It("/api/maintenance/updates").then(i).catch(te=>console.error("Error loading updates",te))}function de(){It("/api/jobs").then(te=>a(te.jobs||[])).catch(te=>console.error("Error loading jobs",te))}function Z(){It("/api/system/services").then(k).catch(()=>{})}function Ve(){It("/api/system/backups").then(te=>X(te.backups||[])).catch(()=>{})}function Le(te){p(!0),b(null),It(`/api/maintenance/logs?service=${te}&lines=150`).then(tt=>{tt.ok?d(tt.text):(d(`Fehler beim Laden der Logs: ${tt.err||"Unbekannter Fehler"}`),(tt.status==="incorrect_password"||tt.status==="password_required")&&b(tt.status))}).catch(tt=>d(`Fehler: ${tt.message}`)).finally(()=>{p(!1),setTimeout(()=>{Ge.current&&(Ge.current.scrollTop=Ge.current.scrollHeight)},50)})}R.useEffect(()=>{if(!t)return;$e(),de(),Z(),Ve();const te=setInterval(()=>{de(),$e(),Z()},3e3);return()=>clearInterval(te)},[t]),R.useEffect(()=>{!t||x!=="logs"||Le(o)},[t,x,o]);function ne(te){return(te==null?void 0:te.status)==="busy"?(J("Update läuft bereits",`Es läuft gerade „${te.running}". Bitte warte, bis es fertig ist.`),de(),!0):!1}async function Ce(){try{const te=await It("/api/maintenance/os-update",{method:"POST"});if(ne(te))return;de(),M("maintenance")}catch(te){J("Fehler",`Fehler beim Starten des OS-Updates: ${te.message}`)}}async function qe(){try{const te=await It("/api/maintenance/engine-update",{method:"POST"});if(ne(te))return;de(),M("maintenance")}catch(te){J("Fehler",`Fehler beim Engine-Update: ${te.message}`)}}async function Ze(){try{const te=await It("/api/maintenance/swap-update",{method:"POST"});if(ne(te))return;de(),M("maintenance")}catch(te){J("Fehler",`Fehler beim Router-Update: ${te.message}`)}}async function Q(){ie(!0);try{const te=await It("/api/maintenance/hermes-update",{method:"POST"});if(ne(te))return;de()}catch(te){J("Fehler",`Hermes-Update fehlgeschlagen: ${te.message}`)}finally{ie(!1)}}async function W(te){ae({kind:te,loading:!0,data:null});try{const tt=await It(`/api/maintenance/update-details?kind=${te}`);ae({kind:te,loading:!1,data:tt})}catch(tt){ae({kind:te,loading:!1,data:{kind:te,error:tt.message}})}}function be(){const te=pe==null?void 0:pe.kind;ae(null),te==="os"?Ce():te==="engine"?qe():te==="swap"?Ze():te==="hermes"&&Q()}async function Ue(){P(!0);try{await It("/api/maintenance/check-updates",{method:"POST"}),de(),M("maintenance")}catch(te){J("Fehler",`Fehler bei der Update-Suche: ${te.message}`)}finally{P(!1)}}async function ze(te,tt){try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:te,role:tt})}),J("Gestartet",`Modell-Upgrade für '${tt}' (${te}) gestartet.`),de(),M("maintenance")}catch(Mt){J("Fehler",`Fehler beim Starten des Modell-Upgrades: ${Mt.message}`)}}async function Fe(){Y("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await It("/api/maintenance/reboot",{method:"POST"}),J("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(te){J("Fehler",`Fehler beim Reboot: ${te.message}`)}})}async function bt(){z(!0),N("Snapshot wird erzeugt...");try{const te=await It("/api/system/backup",{method:"POST"});N(te.ok?`Snapshot erzeugt: ${te.snapshot} (${te.files.length} Komponenten)`:"Backup fehlgeschlagen."),Ve()}catch(te){N(`Fehler: ${te.message}`)}finally{z(!1)}}async function rt(te){w(tt=>({...tt,[te]:!0}));try{const tt=await It("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:te})});tt.ok?J("Dienst neu gestartet",`Dienst ${te} wurde erfolgreich neu gestartet.`,()=>{x==="logs"&&o===te&&Le(te)}):J("Fehler",`Fehler beim Neustart: ${tt.err||"Unbekannter Fehler"}`)}catch(tt){J("Fehler",`Fehler beim Neustart: ${tt.message}`)}finally{w(tt=>({...tt,[te]:!1}))}}async function ht(te){try{await It(`/api/jobs/${te}/cancel`,{method:"POST"}),de()}catch(tt){J("Fehler",`Fehler beim Abbrechen: ${tt.message}`)}}const Xt=s.find(te=>(te.state==="running"||te.state==="queued")&&te.group==="maintenance");return v.jsxs(v.Fragment,{children:[v.jsx("div",{className:Je("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}),v.jsxs("div",{className:Je("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:[v.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Md,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),v.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:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[v.jsx("button",{onClick:()=>M("maintenance"),className:Je("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",x==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),v.jsx("button",{onClick:()=>M("logs"),className:Je("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",x==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),v.jsx("button",{onClick:()=>M("settings"),className:Je("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",x==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[x==="maintenance"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),v.jsxs("button",{onClick:Ue,disabled:T||!!Xt,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[v.jsx(Jf,{className:Je("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&v.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",H(r.last_check)]}),Xt&&v.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:[v.jsx(Jf,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),v.jsxs("span",{children:["Update läuft: ",v.jsx("span",{className:"font-semibold",children:Xt.label})," — bitte warten. Weitere Updates sind solange gesperrt."]})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(j0,{icon:Ym,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:()=>W("os")}),v.jsx(j0,{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:()=>W("engine")}),v.jsx(j0,{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:()=>W("swap")}),(()=>{var tt;const te=(tt=r==null?void 0:r.components)==null?void 0:tt.find(Mt=>Mt.key==="hermes_agent");return v.jsx(j0,{icon:$c,iconClass:"text-amber-400",name:"Hermes-Agent",available:(te==null?void 0:te.update)===!0,busy:ee,status:(te==null?void 0:te.update)===!0?`Update: ${te.latest}`:(te==null?void 0:te.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>W("hermes")})})(),(Ke=r==null?void 0:r.model_list)==null?void 0:Ke.map(te=>v.jsx(j0,{icon:E8,iconClass:"text-emerald-400",name:`Modell · ${te.role}`,available:!0,status:te.title,actionLabel:"Upgrade",onAction:()=>ze(te.repo,te.role)},te.role))]})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),v.jsx("div",{className:"space-y-1.5",children:Lj.map(te=>{var tt;return v.jsx(USe,{label:te.label,system:te.type==="system",ok:(tt=V==null?void 0:V.services.find(Mt=>Mt.name.toLowerCase().includes(te.reach)))==null?void 0:tt.ok,busy:S[te.id],onRestart:()=>rt(te.id),onLogs:()=>{l(te.id),M("logs")}},te.id)})})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),v.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:j[0]?`Letztes: ${j[0].snapshot}`:"Noch kein Backup"}),v.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[j.length," Snapshots · Restore per CLI (restore.sh)"]})]}),v.jsxs("button",{onClick:bt,disabled:D,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:[v.jsx(A8,{className:Je("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),O&&v.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})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),v.jsxs("button",{onClick:Fe,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:[v.jsx(t9,{className:"h-4.5 w-4.5"}),v.jsxs("div",{children:[v.jsx("div",{children:"Host-System neu starten"}),v.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),v.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(te=>te.state==="running"||te.state==="queued").length," Aktiv"]})]}),v.jsx("div",{className:"space-y-3",children:s.length===0?v.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(te=>{const tt=te.state==="running"||te.state==="queued";return v.jsxs("div",{className:Je("p-3 rounded-xl border transition-all duration-300",tt?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[tt&&v.jsxs("span",{className:"flex h-2 w-2 relative",children:[v.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),v.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),te.label]}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[v.jsxs("span",{children:["ID: ",te.id]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:Je(te.state==="done"&&"text-emerald-400",te.state==="failed"&&"text-red-400",te.state==="running"&&"text-primary",te.state==="queued"&&"text-amber-400",te.state==="canceled"&&"text-muted-foreground"),children:te.state})]})]}),tt&&v.jsx("button",{onClick:()=>ht(te.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"})]}),te.state==="running"&&v.jsxs("div",{className:"mt-3 space-y-1",children:[v.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:v.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${te.progress??0}%`}})}),v.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[v.jsxs("span",{children:[te.progress??0,"%"]}),te.done_bytes!=null&&te.total_bytes!=null&&v.jsxs("span",{children:[pT(te.done_bytes)," / ",pT(te.total_bytes),te.rate_bps!=null&&` (${pT(te.rate_bps)}/s)`]}),te.eta_s!=null&&v.jsxs("span",{children:["ETA: ",te.eta_s,"s"]})]})]})]},te.id)})})]})]}),x==="logs"&&v.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("select",{value:o,onChange:te=>l(te.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:Lj.map(te=>v.jsxs("option",{value:te.id,children:[te.label," (",te.type==="system"?"systemd-root":"user",")"]},te.id))}),v.jsxs("button",{onClick:()=>rt(o),disabled:S[o],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:[v.jsx(Jf,{className:Je("h-3.5 w-3.5",S[o]&&"animate-spin")}),"Restart"]})]}),v.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:[v.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[v.jsx(gF,{className:"h-3 w-3 text-primary"}),v.jsxs("span",{children:["stdout/stderr - ",o]})]}),v.jsx("button",{onClick:()=>Le(o),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:v.jsx(Jf,{className:Je("h-3 w-3",f&&"animate-spin")})})]}),v.jsx("pre",{ref:Ge,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"?v.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[v.jsx(bg,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),v.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."}),v.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",o," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),v.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?v.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||v.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),x==="settings"&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),v.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."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(Ym,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:Se?"text":"password",value:G,onChange:te=>le(te.target.value),"aria-label":"Host Sudo-Passwort",name:"sudo-password",autoComplete:"off",spellCheck:!1,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"}),v.jsx("button",{type:"button",onClick:()=>we(!Se),"aria-label":Se?"Passwort verbergen":"Passwort anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Se?v.jsx(aI,{className:"h-4 w-4","aria-hidden":"true"}):v.jsx(IT,{className:"h-4 w-4","aria-hidden":"true"})})]}),v.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."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(H8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:We?"text":"password",value:se,onChange:te=>ce(te.target.value),"aria-label":"HuggingFace API Token",name:"hf-token",autoComplete:"off",spellCheck:!1,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"}),v.jsx("button",{type:"button",onClick:()=>Ee(!We),"aria-label":We?"Token verbergen":"Token anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:We?v.jsx(aI,{className:"h-4 w-4","aria-hidden":"true"}):v.jsx(IT,{className:"h-4 w-4","aria-hidden":"true"})})]}),v.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."})]}),v.jsxs("div",{className:"flex gap-3 pt-2",children:[v.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",G),localStorage.setItem("mc_hf_token",se),J("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"}),v.jsx("button",{onClick:()=>{le(""),ce(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),J("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 Zt;const te=pe.data,tt={os:{icon:Ym,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:rw,cls:"text-violet-400",title:"Inferenz-Engine (llama.cpp)"},swap:{icon:cI,cls:"text-fuchsia-400",title:"Router (llama-swap)"},hermes:{icon:$c,cls:"text-amber-400",title:"Hermes-Agent"}}[pe.kind],Mt=tt.icon,vt=te?pe.kind==="os"?(te.count??0)===0:pe.kind==="hermes"?(te.behind??0)===0:te.installed_build!=null&&te.latest_build!=null&&te.latest_build<=te.installed_build:!0;return v.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[v.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>ae(null)}),v.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:[v.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-5",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Mt,{className:Je("h-4.5 w-4.5",tt.cls)}),v.jsx("h3",{className:"text-sm font-semibold",children:tt.title})]}),v.jsx("button",{onClick:()=>ae(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:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:pe.loading?v.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[v.jsx(Jf,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):te!=null&&te.error?v.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:te.error}):pe.kind==="os"?((te==null?void 0:te.count)??0)===0?v.jsx("div",{className:"text-muted-foreground",children:"Keine Pakete zu aktualisieren — System ist aktuell."}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"text-muted-foreground",children:[te.count," Paket(e) werden aktualisiert:"]}),v.jsx("div",{className:"space-y-1",children:te.packages.map(fe=>v.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:[v.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[v.jsx(J8,{className:"h-3 w-3 text-cyan-400 shrink-0"}),fe.name]}),v.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[v.jsx("span",{children:fe.current}),v.jsx(tw,{className:"h-3 w-3"}),v.jsx("span",{className:"text-emerald-400",children:fe.candidate})]})]},fe.name))})]}):pe.kind==="engine"||pe.kind==="swap"?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[v.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(te==null?void 0:te.installed_build)??"?"]}),v.jsx(tw,{className:"h-3.5 w-3.5 text-muted-foreground"}),v.jsxs("span",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/5 px-2 py-1 text-emerald-400",children:["Build ",(te==null?void 0:te.latest_build)??"?"]})]}),((te==null?void 0:te.name)||(te==null?void 0:te.latest_tag))&&v.jsxs("div",{className:"text-muted-foreground",children:["Release: ",v.jsx("span",{className:"text-foreground",children:te==null?void 0:te.name}),te!=null&&te.latest_tag?` (${te.latest_tag})`:""]}),(te==null?void 0:te.url)&&v.jsxs("a",{href:te.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Release-Notes auf GitHub ",v.jsx(xg,{className:"h-3 w-3"})]}),(te==null?void 0:te.body)&&v.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:te.body})]}):(((Zt=te==null?void 0:te.commits)==null?void 0:Zt.length)??0)===0?v.jsx("div",{className:"text-muted-foreground",children:"Keine neuen Commits — Hermes-Agent ist bereits aktuell."}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"text-muted-foreground",children:[te.behind," neue Commit(s) auf ",v.jsxs("span",{className:"font-mono text-foreground",children:["origin/",te.branch]}),":"]}),v.jsx("div",{className:"space-y-1",children:te.commits.map(fe=>v.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[v.jsx(F8,{className:"h-3.5 w-3.5 text-primary shrink-0 mt-0.5"}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[11px] truncate",children:fe.subject}),v.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[fe.hash," · ",fe.when]})]})]},fe.hash))}),v.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."})]})}),v.jsxs("div",{className:"flex gap-3 border-t border-border/40 p-4 shrink-0",children:[v.jsx("button",{onClick:()=>ae(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"}),v.jsx("button",{onClick:be,disabled:pe.loading||vt||!!Xt,title:Xt?`Update läuft bereits: ${Xt.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:Xt?"Update läuft…":"Jetzt aktualisieren"})]})]})]})})(),he&&v.jsx(gV,{type:he.type,title:he.title,message:he.message,onConfirm:he.onConfirm,onCancel:he.onCancel})]})}function FSe(){var p,y,b,S,w;D7();const[t,e]=R.useState(()=>{const x=window.location.hash.slice(1);return z0.some(M=>M.id===x)?x:"dashboard"}),n=R.useCallback(x=>{window.location.hash.slice(1)===x?e(x):window.location.hash=x},[]),[r,i]=R.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[s,a]=R.useState(!1),[o,l]=R.useState("maintenance"),{data:c}=_7(),{data:d}=$y(2e4);R.useEffect(()=>{document.documentElement.classList.add("dark")},[]),R.useEffect(()=>{const x=M=>{var P;l(((P=M.detail)==null?void 0:P.tab)||"maintenance"),a(!0)};return window.addEventListener("open-system-drawer",x),()=>window.removeEventListener("open-system-drawer",x)},[]),R.useEffect(()=>{const x=M=>{var P;const T=(P=M.detail)==null?void 0:P.view;T&&n(T)};return window.addEventListener("mc-navigate",x),()=>window.removeEventListener("mc-navigate",x)},[n]),R.useEffect(()=>{const x=()=>{const M=window.location.hash.slice(1);z0.some(T=>T.id===M)&&e(M)};return window.addEventListener("hashchange",x),()=>window.removeEventListener("hashchange",x)},[]);const f=z0.find(x=>x.id===t);return v.jsxs("div",{className:"flex h-full relative",children:[v.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[v.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]"}),v.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),v.jsx(v7,{onNavigate:n}),v.jsx(jSe,{open:s,onClose:()=>a(!1),defaultTab:o}),v.jsxs("aside",{className:Je("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",r?"w-16":"w-60"),children:[v.jsxs("div",{className:Je("flex items-center py-4 border-b border-border/40 shrink-0",r?"flex-col gap-3 px-2":"justify-between px-5"),children:[v.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[v.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!r&&v.jsxs("div",{className:"leading-tight",children:[v.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),v.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),v.jsx("button",{onClick:()=>{i(x=>{const M=!x;return localStorage.setItem("mc_sidebar_collapsed",M.toString()),M})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":r?"Seitenleiste ausklappen":"Seitenleiste einklappen",title:r?"Maximieren":"Minimieren",children:r?v.jsx(lF,{className:"h-4 w-4","aria-hidden":"true"}):v.jsx(T8,{className:"h-4 w-4","aria-hidden":"true"})})]}),v.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:z0.map(x=>v.jsxs("a",{href:`#${x.id}`,"aria-current":t===x.id?"page":void 0,className:Je("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",r?"justify-center p-2.5":"gap-3 px-3 py-2",t===x.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:r?x.label:void 0,"aria-label":r?x.label:void 0,children:[v.jsx(x.icon,{className:"h-4.5 w-4.5 shrink-0","aria-hidden":"true"}),!r&&v.jsx("span",{className:"truncate",children:x.label})]},x.id))}),v.jsx("div",{className:Je("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",r?"px-2 text-center":"px-5"),children:r?v.jsx("div",{className:"flex justify-center",children:v.jsx("span",{className:Je("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",c?c.engine_reachable?c.brain&&!c.brain.ready?"bg-amber-500 animate-pulse":"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:c?c.engine_reachable?c.brain&&!c.brain.ready?`Hirn offline (${c.brain.model??"fast"})`:"Engine + Hirn online":"Engine offline":"Backend offline"})}):v.jsxs("div",{className:"space-y-2 text-left",children:[c?v.jsxs(v.Fragment,{children:[v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:Je("h-2 w-2 rounded-full animate-pulse",c.engine_reachable?"bg-emerald-500":"bg-amber-500")}),v.jsxs("span",{className:"truncate",children:["Engine ",c.engine_reachable?"online":"offline"]})]}),c.brain&&!c.brain.ready&&v.jsxs("span",{className:"flex items-center gap-2 text-amber-400",title:`Agent-Hirn '${c.brain.model??"fast"}' lädt nicht/abgestürzt`,children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),v.jsxs("span",{className:"truncate",children:["Hirn offline",c.brain.model?` (${c.brain.model})`:""]})]})]}):v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",v.jsx("span",{className:"truncate",children:"Backend offline"})]}),(d==null?void 0:d.versions)&&v.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[v.jsxs("div",{className:"truncate",title:d.versions.mc2?`${d.versions.mc2.branch}-${d.versions.mc2.hash}${d.versions.mc2.dirty?"*":""} (${d.versions.mc2.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"MC2:"})," ",d.versions.mc2?`${d.versions.mc2.hash}${d.versions.mc2.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:((p=d.versions.engine)==null?void 0:p.type)==="git"?`${d.versions.engine.branch}-${d.versions.engine.hash}${d.versions.engine.dirty?"*":""} (${d.versions.engine.date})`:((y=d.versions.engine)==null?void 0:y.version_text)||"unbekannt",children:[v.jsx("strong",{children:"Engine:"})," ",((b=d.versions.engine)==null?void 0:b.type)==="git"?`${d.versions.engine.hash}${d.versions.engine.dirty?"*":""}`:((w=(S=d.versions.engine)==null?void 0:S.version_text)==null?void 0:w.split(" ").pop())||"—"]}),v.jsxs("div",{className:"truncate",title:d.versions.hermes_ui?`${d.versions.hermes_ui.branch}-${d.versions.hermes_ui.hash}${d.versions.hermes_ui.dirty?"*":""} (${d.versions.hermes_ui.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes UI:"})," ",d.versions.hermes_ui?`${d.versions.hermes_ui.hash}${d.versions.hermes_ui.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:d.versions.hermes_agent?`${d.versions.hermes_agent.branch}-${d.versions.hermes_agent.hash}${d.versions.hermes_agent.dirty?"*":""} (${d.versions.hermes_agent.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes Agent:"})," ",d.versions.hermes_agent?`${d.versions.hermes_agent.hash}${d.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),v.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[v.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:[v.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:f.hint}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.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"}),v.jsxs("button",{onClick:()=>{const x=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(x)},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:[v.jsx(k8,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:"Suchen"}),v.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),v.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&v.jsx(Vfe,{}),t==="models"&&v.jsx(nhe,{}),t==="connect"&&v.jsx(ihe,{}),t==="memory"&&v.jsx(dhe,{}),t==="agent"&&v.jsx(hhe,{}),t==="terminal"&&v.jsx(phe,{}),t==="voice"&&v.jsx(kSe,{}),t==="guide"&&v.jsx(LSe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&v.jsx(DSe,{title:f.label,hint:f.hint})]})]})]})}const zSe=new l8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});DW.createRoot(document.getElementById("root")).render(v.jsx($j.StrictMode,{children:v.jsx(c8,{client:zSe,children:v.jsx(FSe,{})})}));export{Jf as R,Vm as S,LT as T,s9 as a,V1 as g,v as j,R as r}; +...`}),v.jsxs("p",{children:["Suchen & installieren über die ",v.jsx("strong",{children:"skills.sh"}),"-Registry: ",v.jsx(hn,{children:"npx skills find"})," /",v.jsx(hn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),v.jsxs(pa,{id:"memory",icon:U8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["LLMs sind ",v.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",v.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:["extrahiert Fakten ",v.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),v.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),v.jsxs("li",{children:[v.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",v.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),v.jsxs(Wf,{children:["Dein Gedächtnis (Tab ",v.jsx("strong",{children:"Gedächtnis"}),") ist ",v.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",v.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",v.jsx(hn,{children:"Identität"})," · ",v.jsx(hn,{children:"Wissen"})," · ",v.jsx(hn,{children:"Regeln"})," · ",v.jsx(hn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",v.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",v.jsx("br",{}),v.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),v.jsxs(pa,{id:"agents",icon:$c,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",v.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.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."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",v.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),v.jsxs(Wf,{children:[v.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",v.jsx(hn,{children:"fast"}),"). Reden tust du mit ihm im",v.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",v.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",v.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",v.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),v.jsxs(pa,{id:"ide",icon:uF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[v.jsxs("p",{children:["Jede ",v.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Cline"})," & ",v.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Continue"}),", ",v.jsx("strong",{children:"aider"})," (CLI), ",v.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),v.jsxs(Wf,{children:["Tipp den Kram nicht ab: der ",v.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",v.jsx(hn,{children:"…:9001/v1"}),", Model ",v.jsx(hn,{children:"auto"}),", Key beliebig."]})]}),v.jsx(pa,{id:"tricks",icon:q8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:v.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])=>v.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[v.jsx(wh,{className:"h-3 w-3 text-amber-400"})," ",n]}),v.jsx("p",{className:"text-[11px]",children:r})]},n))})}),v.jsx(pa,{id:"wartung",icon:Ym,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(dF,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(wC,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",v.jsx(hn,{children:"restore.sh"})," (Doku in ",v.jsx(hn,{children:"docs/BACKUP.md"}),")."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",v.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",v.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),v.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),v.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:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(RT,{className:"h-5 w-5 text-primary"}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),v.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),v.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(nw,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),v.jsx(Lr,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),v.jsx(Lr,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),v.jsx(Lr,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),v.jsx(Lr,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),v.jsx(Lr,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(kT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),v.jsx(Lr,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),v.jsx(Lr,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),v.jsx(Lr,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),v.jsx(Lr,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx($c,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),v.jsx(Lr,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),v.jsx(Lr,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),v.jsx(Lr,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),v.jsx(Lr,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(CT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Lr,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),v.jsx(Lr,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),v.jsx(Lr,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),v.jsx(Lr,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),v.jsx(Lr,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),v.jsx(pa,{id:"troubleshooting",icon:X8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:v.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",v.jsx(hn,{children:":9001"}),")? Backend-Status in der ",v.jsx("strong",{children:"Zentrale"})," prüfen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",v.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",v.jsx(hn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",v.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",v.jsx(hn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),v.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 USe({title:t,hint:e}){return v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-xl font-semibold",children:t}),v.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),v.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:[v.jsx(D8,{className:"h-8 w-8 text-muted-foreground"}),v.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const Lj=[{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 j0({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:a,onAction:o}){return v.jsxs("div",{className:Je("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:[v.jsx(t,{className:Je("h-4 w-4 shrink-0",e)}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:n}),v.jsx("div",{className:Je("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),v.jsx("button",{onClick:o,disabled:!i||s,className:Je("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?"…":a})]})}function jSe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return v.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[v.jsx("span",{className:Je("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),v.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&v.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),v.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:v.jsx(Jf,{className:Je("h-3.5 w-3.5",r&&"animate-spin")})}),v.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:v.jsx(j8,{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 FSe({open:t,onClose:e,defaultTab:n="maintenance"}){var Ke;const[r,i]=R.useState(null),[s,a]=R.useState([]),[o,l]=R.useState("llama-swap"),[c,d]=R.useState(""),[f,p]=R.useState(!1),[y,b]=R.useState(null),[S,w]=R.useState({}),[x,M]=R.useState("maintenance"),[T,P]=R.useState(!1),[O,N]=R.useState(""),[D,z]=R.useState(!1),[V,k]=R.useState(null),[j,X]=R.useState([]),[ee,ie]=R.useState(!1),[pe,ae]=R.useState(null),[he,B]=R.useState(null);function J(te,tt,Mt){B({type:"alert",title:te,message:tt,onConfirm:()=>{B(null),Mt&&Mt()}})}function Y(te,tt,Mt){B({type:"confirm",title:te,message:tt,onConfirm:()=>{B(null),Mt()},onCancel:()=>B(null)})}function H(te){return te?new Date(te*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[G,le]=R.useState(""),[se,ce]=R.useState(""),[Se,we]=R.useState(!1),[We,Ee]=R.useState(!1);R.useEffect(()=>{t&&(le(localStorage.getItem("mc_sudo_password")||""),ce(localStorage.getItem("mc_hf_token")||""))},[t]),R.useEffect(()=>{t&&n&&M(n)},[t,n]);const Ge=R.useRef(null);function $e(){It("/api/maintenance/updates").then(i).catch(te=>console.error("Error loading updates",te))}function de(){It("/api/jobs").then(te=>a(te.jobs||[])).catch(te=>console.error("Error loading jobs",te))}function Z(){It("/api/system/services").then(k).catch(()=>{})}function Ve(){It("/api/system/backups").then(te=>X(te.backups||[])).catch(()=>{})}function Le(te){p(!0),b(null),It(`/api/maintenance/logs?service=${te}&lines=150`).then(tt=>{tt.ok?d(tt.text):(d(`Fehler beim Laden der Logs: ${tt.err||"Unbekannter Fehler"}`),(tt.status==="incorrect_password"||tt.status==="password_required")&&b(tt.status))}).catch(tt=>d(`Fehler: ${tt.message}`)).finally(()=>{p(!1),setTimeout(()=>{Ge.current&&(Ge.current.scrollTop=Ge.current.scrollHeight)},50)})}R.useEffect(()=>{if(!t)return;$e(),de(),Z(),Ve();const te=setInterval(()=>{de(),$e(),Z()},3e3);return()=>clearInterval(te)},[t]),R.useEffect(()=>{!t||x!=="logs"||Le(o)},[t,x,o]);function ne(te){return(te==null?void 0:te.status)==="busy"?(J("Update läuft bereits",`Es läuft gerade „${te.running}". Bitte warte, bis es fertig ist.`),de(),!0):!1}async function Ce(){try{const te=await It("/api/maintenance/os-update",{method:"POST"});if(ne(te))return;de(),M("maintenance")}catch(te){J("Fehler",`Fehler beim Starten des OS-Updates: ${te.message}`)}}async function Xe(){try{const te=await It("/api/maintenance/engine-update",{method:"POST"});if(ne(te))return;de(),M("maintenance")}catch(te){J("Fehler",`Fehler beim Engine-Update: ${te.message}`)}}async function Ze(){try{const te=await It("/api/maintenance/swap-update",{method:"POST"});if(ne(te))return;de(),M("maintenance")}catch(te){J("Fehler",`Fehler beim Router-Update: ${te.message}`)}}async function Q(){ie(!0);try{const te=await It("/api/maintenance/hermes-update",{method:"POST"});if(ne(te))return;de()}catch(te){J("Fehler",`Hermes-Update fehlgeschlagen: ${te.message}`)}finally{ie(!1)}}async function W(te){ae({kind:te,loading:!0,data:null});try{const tt=await It(`/api/maintenance/update-details?kind=${te}`);ae({kind:te,loading:!1,data:tt})}catch(tt){ae({kind:te,loading:!1,data:{kind:te,error:tt.message}})}}function be(){const te=pe==null?void 0:pe.kind;ae(null),te==="os"?Ce():te==="engine"?Xe():te==="swap"?Ze():te==="hermes"&&Q()}async function Ue(){P(!0);try{await It("/api/maintenance/check-updates",{method:"POST"}),de(),M("maintenance")}catch(te){J("Fehler",`Fehler bei der Update-Suche: ${te.message}`)}finally{P(!1)}}async function ze(te,tt){try{await It("/api/models/install",{method:"POST",body:JSON.stringify({repo:te,role:tt})}),J("Gestartet",`Modell-Upgrade für '${tt}' (${te}) gestartet.`),de(),M("maintenance")}catch(Mt){J("Fehler",`Fehler beim Starten des Modell-Upgrades: ${Mt.message}`)}}async function Fe(){Y("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await It("/api/maintenance/reboot",{method:"POST"}),J("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(te){J("Fehler",`Fehler beim Reboot: ${te.message}`)}})}async function bt(){z(!0),N("Snapshot wird erzeugt...");try{const te=await It("/api/system/backup",{method:"POST"});N(te.ok?`Snapshot erzeugt: ${te.snapshot} (${te.files.length} Komponenten)`:"Backup fehlgeschlagen."),Ve()}catch(te){N(`Fehler: ${te.message}`)}finally{z(!1)}}async function rt(te){w(tt=>({...tt,[te]:!0}));try{const tt=await It("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:te})});tt.ok?J("Dienst neu gestartet",`Dienst ${te} wurde erfolgreich neu gestartet.`,()=>{x==="logs"&&o===te&&Le(te)}):J("Fehler",`Fehler beim Neustart: ${tt.err||"Unbekannter Fehler"}`)}catch(tt){J("Fehler",`Fehler beim Neustart: ${tt.message}`)}finally{w(tt=>({...tt,[te]:!1}))}}async function ht(te){try{await It(`/api/jobs/${te}/cancel`,{method:"POST"}),de()}catch(tt){J("Fehler",`Fehler beim Abbrechen: ${tt.message}`)}}const Xt=s.find(te=>(te.state==="running"||te.state==="queued")&&te.group==="maintenance");return v.jsxs(v.Fragment,{children:[v.jsx("div",{className:Je("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}),v.jsxs("div",{className:Je("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:[v.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Md,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),v.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:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[v.jsx("button",{onClick:()=>M("maintenance"),className:Je("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",x==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),v.jsx("button",{onClick:()=>M("logs"),className:Je("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",x==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),v.jsx("button",{onClick:()=>M("settings"),className:Je("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",x==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[x==="maintenance"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),v.jsxs("button",{onClick:Ue,disabled:T||!!Xt,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[v.jsx(Jf,{className:Je("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&v.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",H(r.last_check)]}),Xt&&v.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:[v.jsx(Jf,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}),v.jsxs("span",{children:["Update läuft: ",v.jsx("span",{className:"font-semibold",children:Xt.label})," — bitte warten. Weitere Updates sind solange gesperrt."]})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(j0,{icon:Ym,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:()=>W("os")}),v.jsx(j0,{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:()=>W("engine")}),v.jsx(j0,{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:()=>W("swap")}),(()=>{var tt;const te=(tt=r==null?void 0:r.components)==null?void 0:tt.find(Mt=>Mt.key==="hermes_agent");return v.jsx(j0,{icon:$c,iconClass:"text-amber-400",name:"Hermes-Agent",available:(te==null?void 0:te.update)===!0,busy:ee,status:(te==null?void 0:te.update)===!0?`Update: ${te.latest}`:(te==null?void 0:te.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>W("hermes")})})(),(Ke=r==null?void 0:r.model_list)==null?void 0:Ke.map(te=>v.jsx(j0,{icon:A8,iconClass:"text-emerald-400",name:`Modell · ${te.role}`,available:!0,status:te.title,actionLabel:"Upgrade",onAction:()=>ze(te.repo,te.role)},te.role))]})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),v.jsx("div",{className:"space-y-1.5",children:Lj.map(te=>{var tt;return v.jsx(jSe,{label:te.label,system:te.type==="system",ok:(tt=V==null?void 0:V.services.find(Mt=>Mt.name.toLowerCase().includes(te.reach)))==null?void 0:tt.ok,busy:S[te.id],onRestart:()=>rt(te.id),onLogs:()=>{l(te.id),M("logs")}},te.id)})})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),v.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:j[0]?`Letztes: ${j[0].snapshot}`:"Noch kein Backup"}),v.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[j.length," Snapshots · Restore per CLI (restore.sh)"]})]}),v.jsxs("button",{onClick:bt,disabled:D,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:[v.jsx(P8,{className:Je("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),O&&v.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})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),v.jsxs("button",{onClick:Fe,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:[v.jsx(r9,{className:"h-4.5 w-4.5"}),v.jsxs("div",{children:[v.jsx("div",{children:"Host-System neu starten"}),v.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),v.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(te=>te.state==="running"||te.state==="queued").length," Aktiv"]})]}),v.jsx("div",{className:"space-y-3",children:s.length===0?v.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(te=>{const tt=te.state==="running"||te.state==="queued";return v.jsxs("div",{className:Je("p-3 rounded-xl border transition-all duration-300",tt?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[tt&&v.jsxs("span",{className:"flex h-2 w-2 relative",children:[v.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),v.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),te.label]}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[v.jsxs("span",{children:["ID: ",te.id]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:Je(te.state==="done"&&"text-emerald-400",te.state==="failed"&&"text-red-400",te.state==="running"&&"text-primary",te.state==="queued"&&"text-amber-400",te.state==="canceled"&&"text-muted-foreground"),children:te.state})]})]}),tt&&v.jsx("button",{onClick:()=>ht(te.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"})]}),te.state==="running"&&v.jsxs("div",{className:"mt-3 space-y-1",children:[v.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:v.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${te.progress??0}%`}})}),v.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[v.jsxs("span",{children:[te.progress??0,"%"]}),te.done_bytes!=null&&te.total_bytes!=null&&v.jsxs("span",{children:[pT(te.done_bytes)," / ",pT(te.total_bytes),te.rate_bps!=null&&` (${pT(te.rate_bps)}/s)`]}),te.eta_s!=null&&v.jsxs("span",{children:["ETA: ",te.eta_s,"s"]})]})]})]},te.id)})})]})]}),x==="logs"&&v.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("select",{value:o,onChange:te=>l(te.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:Lj.map(te=>v.jsxs("option",{value:te.id,children:[te.label," (",te.type==="system"?"systemd-root":"user",")"]},te.id))}),v.jsxs("button",{onClick:()=>rt(o),disabled:S[o],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:[v.jsx(Jf,{className:Je("h-3.5 w-3.5",S[o]&&"animate-spin")}),"Restart"]})]}),v.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:[v.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[v.jsx(gF,{className:"h-3 w-3 text-primary"}),v.jsxs("span",{children:["stdout/stderr - ",o]})]}),v.jsx("button",{onClick:()=>Le(o),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:v.jsx(Jf,{className:Je("h-3 w-3",f&&"animate-spin")})})]}),v.jsx("pre",{ref:Ge,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"?v.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[v.jsx(bg,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),v.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."}),v.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",o," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),v.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?v.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||v.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),x==="settings"&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),v.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."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(Ym,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:Se?"text":"password",value:G,onChange:te=>le(te.target.value),"aria-label":"Host Sudo-Passwort",name:"sudo-password",autoComplete:"off",spellCheck:!1,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"}),v.jsx("button",{type:"button",onClick:()=>we(!Se),"aria-label":Se?"Passwort verbergen":"Passwort anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:Se?v.jsx(aI,{className:"h-4 w-4","aria-hidden":"true"}):v.jsx(IT,{className:"h-4 w-4","aria-hidden":"true"})})]}),v.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."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(G8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:We?"text":"password",value:se,onChange:te=>ce(te.target.value),"aria-label":"HuggingFace API Token",name:"hf-token",autoComplete:"off",spellCheck:!1,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"}),v.jsx("button",{type:"button",onClick:()=>Ee(!We),"aria-label":We?"Token verbergen":"Token anzeigen",className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:We?v.jsx(aI,{className:"h-4 w-4","aria-hidden":"true"}):v.jsx(IT,{className:"h-4 w-4","aria-hidden":"true"})})]}),v.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."})]}),v.jsxs("div",{className:"flex gap-3 pt-2",children:[v.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",G),localStorage.setItem("mc_hf_token",se),J("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"}),v.jsx("button",{onClick:()=>{le(""),ce(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),J("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 Zt;const te=pe.data,tt={os:{icon:Ym,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:rw,cls:"text-violet-400",title:"Inferenz-Engine (llama.cpp)"},swap:{icon:cI,cls:"text-fuchsia-400",title:"Router (llama-swap)"},hermes:{icon:$c,cls:"text-amber-400",title:"Hermes-Agent"}}[pe.kind],Mt=tt.icon,vt=te?pe.kind==="os"?(te.count??0)===0:pe.kind==="hermes"?(te.behind??0)===0:te.installed_build!=null&&te.latest_build!=null&&te.latest_build<=te.installed_build:!0;return v.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[v.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>ae(null)}),v.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:[v.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-5",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(Mt,{className:Je("h-4.5 w-4.5",tt.cls)}),v.jsx("h3",{className:"text-sm font-semibold",children:tt.title})]}),v.jsx("button",{onClick:()=>ae(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:v.jsx(Ed,{className:"h-4 w-4"})})]}),v.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:pe.loading?v.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[v.jsx(Jf,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):te!=null&&te.error?v.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:te.error}):pe.kind==="os"?((te==null?void 0:te.count)??0)===0?v.jsx("div",{className:"text-muted-foreground",children:"Keine Pakete zu aktualisieren — System ist aktuell."}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"text-muted-foreground",children:[te.count," Paket(e) werden aktualisiert:"]}),v.jsx("div",{className:"space-y-1",children:te.packages.map(fe=>v.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:[v.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[v.jsx(t9,{className:"h-3 w-3 text-cyan-400 shrink-0"}),fe.name]}),v.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[v.jsx("span",{children:fe.current}),v.jsx(tw,{className:"h-3 w-3"}),v.jsx("span",{className:"text-emerald-400",children:fe.candidate})]})]},fe.name))})]}):pe.kind==="engine"||pe.kind==="swap"?v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[v.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(te==null?void 0:te.installed_build)??"?"]}),v.jsx(tw,{className:"h-3.5 w-3.5 text-muted-foreground"}),v.jsxs("span",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/5 px-2 py-1 text-emerald-400",children:["Build ",(te==null?void 0:te.latest_build)??"?"]})]}),((te==null?void 0:te.name)||(te==null?void 0:te.latest_tag))&&v.jsxs("div",{className:"text-muted-foreground",children:["Release: ",v.jsx("span",{className:"text-foreground",children:te==null?void 0:te.name}),te!=null&&te.latest_tag?` (${te.latest_tag})`:""]}),(te==null?void 0:te.url)&&v.jsxs("a",{href:te.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Release-Notes auf GitHub ",v.jsx(xg,{className:"h-3 w-3"})]}),(te==null?void 0:te.body)&&v.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:te.body})]}):(((Zt=te==null?void 0:te.commits)==null?void 0:Zt.length)??0)===0?v.jsx("div",{className:"text-muted-foreground",children:"Keine neuen Commits — Hermes-Agent ist bereits aktuell."}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"text-muted-foreground",children:[te.behind," neue Commit(s) auf ",v.jsxs("span",{className:"font-mono text-foreground",children:["origin/",te.branch]}),":"]}),v.jsx("div",{className:"space-y-1",children:te.commits.map(fe=>v.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[v.jsx(B8,{className:"h-3.5 w-3.5 text-primary shrink-0 mt-0.5"}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[11px] truncate",children:fe.subject}),v.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[fe.hash," · ",fe.when]})]})]},fe.hash))}),v.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."})]})}),v.jsxs("div",{className:"flex gap-3 border-t border-border/40 p-4 shrink-0",children:[v.jsx("button",{onClick:()=>ae(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"}),v.jsx("button",{onClick:be,disabled:pe.loading||vt||!!Xt,title:Xt?`Update läuft bereits: ${Xt.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:Xt?"Update läuft…":"Jetzt aktualisieren"})]})]})]})})(),he&&v.jsx(gV,{type:he.type,title:he.title,message:he.message,onConfirm:he.onConfirm,onCancel:he.onCancel})]})}function zSe(){var p,y,b,S,w;j7();const[t,e]=R.useState(()=>{const x=window.location.hash.slice(1);return z0.some(M=>M.id===x)?x:"dashboard"}),n=R.useCallback(x=>{window.location.hash.slice(1)===x?e(x):window.location.hash=x},[]),[r,i]=R.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[s,a]=R.useState(!1),[o,l]=R.useState("maintenance"),{data:c}=S7(),{data:d}=$y(2e4);R.useEffect(()=>{document.documentElement.classList.add("dark")},[]),R.useEffect(()=>{const x=M=>{var P;l(((P=M.detail)==null?void 0:P.tab)||"maintenance"),a(!0)};return window.addEventListener("open-system-drawer",x),()=>window.removeEventListener("open-system-drawer",x)},[]),R.useEffect(()=>{const x=M=>{var P;const T=(P=M.detail)==null?void 0:P.view;T&&n(T)};return window.addEventListener("mc-navigate",x),()=>window.removeEventListener("mc-navigate",x)},[n]),R.useEffect(()=>{const x=()=>{const M=window.location.hash.slice(1);z0.some(T=>T.id===M)&&e(M)};return window.addEventListener("hashchange",x),()=>window.removeEventListener("hashchange",x)},[]);const f=z0.find(x=>x.id===t);return v.jsxs("div",{className:"flex h-full relative",children:[v.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[v.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]"}),v.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),v.jsx(x7,{onNavigate:n}),v.jsx(FSe,{open:s,onClose:()=>a(!1),defaultTab:o}),v.jsxs("aside",{className:Je("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",r?"w-16":"w-60"),children:[v.jsxs("div",{className:Je("flex items-center py-4 border-b border-border/40 shrink-0",r?"flex-col gap-3 px-2":"justify-between px-5"),children:[v.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[v.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!r&&v.jsxs("div",{className:"leading-tight",children:[v.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),v.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),v.jsx("button",{onClick:()=>{i(x=>{const M=!x;return localStorage.setItem("mc_sidebar_collapsed",M.toString()),M})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer","aria-label":r?"Seitenleiste ausklappen":"Seitenleiste einklappen",title:r?"Maximieren":"Minimieren",children:r?v.jsx(lF,{className:"h-4 w-4","aria-hidden":"true"}):v.jsx(C8,{className:"h-4 w-4","aria-hidden":"true"})})]}),v.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:z0.map(x=>v.jsxs("a",{href:`#${x.id}`,"aria-current":t===x.id?"page":void 0,className:Je("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",r?"justify-center p-2.5":"gap-3 px-3 py-2",t===x.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:r?x.label:void 0,"aria-label":r?x.label:void 0,children:[v.jsx(x.icon,{className:"h-4.5 w-4.5 shrink-0","aria-hidden":"true"}),!r&&v.jsx("span",{className:"truncate",children:x.label})]},x.id))}),v.jsx("div",{className:Je("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",r?"px-2 text-center":"px-5"),children:r?v.jsx("div",{className:"flex justify-center",children:v.jsx("span",{className:Je("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",c?c.engine_reachable?c.brain&&!c.brain.ready?"bg-amber-500 animate-pulse":"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:c?c.engine_reachable?c.brain&&!c.brain.ready?`Hirn offline (${c.brain.model??"fast"})`:"Engine + Hirn online":"Engine offline":"Backend offline"})}):v.jsxs("div",{className:"space-y-2 text-left",children:[c?v.jsxs(v.Fragment,{children:[v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:Je("h-2 w-2 rounded-full animate-pulse",c.engine_reachable?"bg-emerald-500":"bg-amber-500")}),v.jsxs("span",{className:"truncate",children:["Engine ",c.engine_reachable?"online":"offline"]})]}),c.brain&&!c.brain.ready&&v.jsxs("span",{className:"flex items-center gap-2 text-amber-400",title:`Agent-Hirn '${c.brain.model??"fast"}' lädt nicht/abgestürzt`,children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),v.jsxs("span",{className:"truncate",children:["Hirn offline",c.brain.model?` (${c.brain.model})`:""]})]})]}):v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",v.jsx("span",{className:"truncate",children:"Backend offline"})]}),(d==null?void 0:d.versions)&&v.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[v.jsxs("div",{className:"truncate",title:d.versions.mc2?`${d.versions.mc2.branch}-${d.versions.mc2.hash}${d.versions.mc2.dirty?"*":""} (${d.versions.mc2.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"MC2:"})," ",d.versions.mc2?`${d.versions.mc2.hash}${d.versions.mc2.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:((p=d.versions.engine)==null?void 0:p.type)==="git"?`${d.versions.engine.branch}-${d.versions.engine.hash}${d.versions.engine.dirty?"*":""} (${d.versions.engine.date})`:((y=d.versions.engine)==null?void 0:y.version_text)||"unbekannt",children:[v.jsx("strong",{children:"Engine:"})," ",((b=d.versions.engine)==null?void 0:b.type)==="git"?`${d.versions.engine.hash}${d.versions.engine.dirty?"*":""}`:((w=(S=d.versions.engine)==null?void 0:S.version_text)==null?void 0:w.split(" ").pop())||"—"]}),v.jsxs("div",{className:"truncate",title:d.versions.hermes_ui?`${d.versions.hermes_ui.branch}-${d.versions.hermes_ui.hash}${d.versions.hermes_ui.dirty?"*":""} (${d.versions.hermes_ui.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes UI:"})," ",d.versions.hermes_ui?`${d.versions.hermes_ui.hash}${d.versions.hermes_ui.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:d.versions.hermes_agent?`${d.versions.hermes_agent.branch}-${d.versions.hermes_agent.hash}${d.versions.hermes_agent.dirty?"*":""} (${d.versions.hermes_agent.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes Agent:"})," ",d.versions.hermes_agent?`${d.versions.hermes_agent.hash}${d.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),v.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[v.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:[v.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:f.hint}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.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"}),v.jsxs("button",{onClick:()=>{const x=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(x)},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:[v.jsx(L8,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:"Suchen"}),v.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),v.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&v.jsx(Gfe,{}),t==="models"&&v.jsx(rhe,{}),t==="connect"&&v.jsx(she,{}),t==="memory"&&v.jsx(fhe,{}),t==="agent"&&v.jsx(phe,{}),t==="terminal"&&v.jsx(mhe,{}),t==="voice"&&v.jsx(OSe,{}),t==="guide"&&v.jsx(DSe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&v.jsx(USe,{title:f.label,hint:f.hint})]})]})]})}const BSe=new c8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});UW.createRoot(document.getElementById("root")).render(v.jsx($j.StrictMode,{children:v.jsx(u8,{client:BSe,children:v.jsx(zSe,{})})}));export{Jf as R,Vm as S,LT as T,o9 as a,V1 as g,v as j,R as r}; diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 1806a1a..8e5c35b 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,7 +7,7 @@ Mission Control 2.0 - + diff --git a/frontend/src/components/models/ModelBadges.tsx b/frontend/src/components/models/ModelBadges.tsx index 17953bc..9f7bfe8 100644 --- a/frontend/src/components/models/ModelBadges.tsx +++ b/frontend/src/components/models/ModelBadges.tsx @@ -1,8 +1,9 @@ import { type Fit } from "@/lib/api" import { cn } from "@/lib/utils" -// Die 5 kanonischen Serving-Rollen (identisch zu Backend sources.py/llamaswap.ROLE_IDS). -export const ROLES = ["fast", "heavy", "coder", "vision", "scout"] +// Die kanonischen Serving-Rollen (identisch zu Backend sources.py/llamaswap.ROLE_IDS). +// `hermes` = Lucys Agent-Hirn (warm + ko-resident); UI-Label „Hirn". +export const ROLES = ["fast", "heavy", "coder", "vision", "hermes", "scout"] // Rolle → Farbton. EINE Quelle der Wahrheit für alle Rollen-Badges (Cockpit, ModelsCard, // …). `hermes` = Agent-Hirn (taucht als geladenes Modell auf). diff --git a/frontend/src/views/models/Cockpit.tsx b/frontend/src/views/models/Cockpit.tsx index 876cebc..fc24a4c 100644 --- a/frontend/src/views/models/Cockpit.tsx +++ b/frontend/src/views/models/Cockpit.tsx @@ -6,7 +6,7 @@ import { useDialog } from "@/lib/useDialog" import { CapsChips } from "@/components/CapsChips" import { cn } from "@/lib/utils" import { fmtSize, fmtCtx } from "@/lib/format" -import { getBrandInfo, roleTone } from "@/components/models/ModelBadges" +import { getBrandInfo, roleTone, ROLES } from "@/components/models/ModelBadges" import { SpecDraftModal } from "@/components/models/SpecDraftModal" import { LaneEditor } from "@/components/models/LaneEditor" @@ -107,11 +107,14 @@ export function Cockpit() { async function handleRoleChange(role: string, modelName: string) { try { - await api(`/api/models/${encodeURIComponent(modelName)}/role`, { + // Bei der Hirn-Rolle (hermes) läuft serverseitig der warm-bewusste Flow (Alias + brains- + // Gruppe + ttl 0 + Hermes-Config + Gateway-Restart) und liefert ggf. eine Budget-Warnung. + const res = await api<{ warning?: string | null }>(`/api/models/${encodeURIComponent(modelName)}/role`, { method: "POST", body: JSON.stringify({ role: role || null }), }) reload() + if (res?.warning) showAlert("Hirn gesetzt — Hinweis", res.warning) } catch (e: any) { showAlert("Fehler", `Fehler beim Zuweisen der Rolle: ${e.message || e}`) } @@ -311,7 +314,7 @@ export function Cockpit() { Gateway Steckplatz-Belegung (Slot-Zuweisung)
- {["fast", "heavy", "coder", "vision", "scout"].map((role) => { + {ROLES.map((role) => { const m = models.find((x) => x.role === role) const isWarm = m ? running.includes(m.name) : false diff --git a/frontend/src/views/models/Discover.tsx b/frontend/src/views/models/Discover.tsx index b1e8276..6b5d604 100644 --- a/frontend/src/views/models/Discover.tsx +++ b/frontend/src/views/models/Discover.tsx @@ -1,5 +1,5 @@ import { useState } from "react" -import { Download, Star, Layers, Check, Zap, Eye, Code, Brain, Compass, ChevronDown, ChevronUp } from "lucide-react" +import { Download, Star, Layers, Check, Zap, Eye, Code, Brain, BrainCircuit, Compass, ChevronDown, ChevronUp } from "lucide-react" import { api } from "@/lib/api" import { useModels, useUpdates, useDiscover } from "@/lib/queries" import { cn } from "@/lib/utils" @@ -7,7 +7,7 @@ import { fmtBytes } from "@/lib/format" import { FitBadge } from "@/components/models/ModelBadges" import { ModelBrowse } from "./ModelBrowse" -// Die 5 kanonischen Rollen (identisch zu sources.py / ModelBadges.ROLES). +// Die kanonischen Rollen (identisch zu sources.py / ModelBadges.ROLES). const ROLE_METADATA: Record = { fast: { title: "Schnelles Alltags-Hirn", @@ -29,6 +29,11 @@ const ROLE_METADATA: Record desc: "Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.", icon: Eye }, + hermes: { + title: "Lucys Hirn (Agent)", + desc: "Lucys dauer-warmes Agent-Hirn mit Tool-Calling — bleibt ko-resident, lädt nie kalt nach.", + icon: BrainCircuit + }, scout: { title: "Multimodal-Allrounder", desc: "Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.", diff --git a/frontend/src/views/models/ModelBrowse.tsx b/frontend/src/views/models/ModelBrowse.tsx index 095be7b..3d78e8a 100644 --- a/frontend/src/views/models/ModelBrowse.tsx +++ b/frontend/src/views/models/ModelBrowse.tsx @@ -13,7 +13,7 @@ const CHIPS: { key: string; label: string; q: string }[] = [ { key: "reasoning", label: "Reasoning", q: "reasoning" }, { key: "small", label: "Klein (≤4B)", q: "3B" }, ] -const ROLE_OPTS = ["fast", "heavy", "coder", "vision", "scout"] +const ROLE_OPTS = ["fast", "heavy", "coder", "vision", "hermes", "scout"] const _nf = new Intl.NumberFormat(undefined, { notation: "compact", maximumFractionDigits: 1 }) function fmtN(n: number): string {