From d832f90ad6d599381043ba14ce193d24f09be73a Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Sun, 28 Jun 2026 11:09:33 +0200 Subject: [PATCH] =?UTF-8?q?Feat:=20Ged=C3=A4chtnis-Tab=20=C3=BCberarbeitet?= =?UTF-8?q?=20=E2=80=94=20Sigma.js-Graph=20(skaliert),=20Liste=20als=20Def?= =?UTF-8?q?ault=20+=20gruppiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Graph: reagraph (three.js, schwer, hing Renderer) → Sigma.js v3 + graphology (graph-optimiertes WebGL, skaliert auf tausende Knoten), im App-Look: Kategorie-Farben, Knotengröße nach Verknüpfungen, Hover-Highlight (Nachbarn hervor, Rest dimmt), Legende. Liste ist jetzt Default + nach Kategorie gruppierte Sektionen (statt flacher Wand). reagraph deinstalliert → leichteres Bundle. Co-Authored-By: Claude Opus 4.8 --- backend/routers/maintenance.py | 10 +- backend/services/maintenance.py | 79 + deploy/update-swap.sh | 33 + frontend/dist/assets/GraphView-COC_6OUw.js | 312 ++ frontend/dist/assets/GraphView-VftfPdeY.js | 3922 ----------------- frontend/dist/assets/index--0Qg2tjI.css | 1 - frontend/dist/assets/index-BQ6s_c3E.css | 1 + .../{index-Qs-v42ar.js => index-BhNoAezr.js} | 653 +-- frontend/dist/index.html | 4 +- frontend/package-lock.json | 494 +-- frontend/package.json | 4 +- frontend/src/components/SystemDrawer.tsx | 25 +- .../src/components/dashboard/UpdatesCard.tsx | 4 +- frontend/src/lib/api.ts | 3 +- frontend/src/views/GraphView.tsx | 125 +- frontend/src/views/MemoryView.tsx | 96 +- 16 files changed, 958 insertions(+), 4808 deletions(-) create mode 100755 deploy/update-swap.sh create mode 100644 frontend/dist/assets/GraphView-COC_6OUw.js delete mode 100644 frontend/dist/assets/GraphView-VftfPdeY.js delete mode 100644 frontend/dist/assets/index--0Qg2tjI.css create mode 100644 frontend/dist/assets/index-BQ6s_c3E.css rename frontend/dist/assets/{index-Qs-v42ar.js => index-BhNoAezr.js} (66%) diff --git a/backend/routers/maintenance.py b/backend/routers/maintenance.py index 58f42c7..ae76dc9 100644 --- a/backend/routers/maintenance.py +++ b/backend/routers/maintenance.py @@ -24,7 +24,7 @@ def updates() -> dict: @router.get("/maintenance/update-details") def update_details(kind: str) -> dict: - if kind not in ("os", "engine", "hermes"): + if kind not in ("os", "engine", "swap", "hermes"): raise HTTPException(400, "Unbekannte Update-Art.") return maintenance.update_details(kind) @@ -52,6 +52,14 @@ def engine_update(body: SudoReq) -> dict: return res +@router.post("/maintenance/swap-update") +def swap_update(body: SudoReq) -> dict: + res = maintenance.swap_update_job(body.sudo_password) + if not res: + raise HTTPException(400, "Kein Router-Update-Befehl gesetzt (MC_SWAP_UPDATE_CMD).") + return res + + @router.post("/maintenance/hermes-update") def hermes_update() -> dict: return maintenance.hermes_update_job() diff --git a/backend/services/maintenance.py b/backend/services/maintenance.py index eea19a3..98f44d1 100644 --- a/backend/services/maintenance.py +++ b/backend/services/maintenance.py @@ -30,6 +30,14 @@ ENGINE_PATH = os.environ.get("MC_ENGINE_PATH", "/opt/llamacpp-vulkan") ENGINE_REPO = os.environ.get("MC_ENGINE_REPO", "ggml-org/llama.cpp") _engine_cache = {"ts": 0.0, "avail": False} +# Router = llama-swap (mostlygeek): proxyt Anfragen und wechselt die Modelle heiß. Eigenes +# Upstream-Projekt mit eigenem Release-Zyklus → getrennt von der Engine geführt. +SWAP_UPDATE_CMD = os.environ.get( + "MC_SWAP_UPDATE_CMD", f"sudo bash {_REPO_ROOT}/deploy/update-swap.sh") +SWAP_BIN = os.environ.get("MC_SWAP_BIN", "/usr/local/bin/llama-swap") +SWAP_REPO = os.environ.get("MC_SWAP_REPO", "mostlygeek/llama-swap") +_swap_cache = {"ts": 0.0, "avail": False} + def _installed_engine_build() -> int | None: """Build-Nummer der installierten llama-server-Binary (z.B. 9821), oder None. @@ -88,6 +96,39 @@ def _engine_update_available() -> bool: return avail +def _installed_swap_version() -> int | None: + """Versions-Nummer der installierten llama-swap-Binary (z.B. 228), oder None.""" + if not os.path.exists(SWAP_BIN): + return None + try: + out = subprocess.run([SWAP_BIN, "--version"], capture_output=True, text=True, timeout=15) + txt = (out.stdout or "") + (out.stderr or "") + if (m := re.search(r"version:\s*(\d+)", txt)) or (m := re.search(r"\bv?(\d{2,})\b", txt)): + return int(m.group(1)) + except Exception: + return None + return None + + +def _swap_update_available() -> bool: + now = time.time() + if now - _swap_cache["ts"] < 3600: + return _swap_cache["avail"] + avail = False + try: + rel = httpx.get(f"https://api.github.com/repos/{SWAP_REPO}/releases/latest", + timeout=6, headers={"User-Agent": "MissionControl2"}).json() + tag = str(rel.get("tag_name", "")) + latest = int(m.group(1)) if (m := re.search(r"(\d{2,})", tag)) else None + installed = _installed_swap_version() + if latest is not None and installed is not None: + avail = latest > installed + except Exception: + avail = False + _swap_cache.update(ts=now, avail=avail) + return avail + + _comp_cache = {"ts": 0.0, "data": []} @@ -244,6 +285,7 @@ def _last_apt_update() -> float | None: def updates() -> dict: ups = model_upgrades() return {"os": _os_upgradable(), "engine": 1 if _engine_update_available() else 0, + "swap": 1 if _swap_update_available() else 0, "models": len(ups), "model_list": ups, "last_check": _last_apt_update(), "components": _components_cached()} @@ -289,6 +331,26 @@ def engine_update_details() -> dict: return info +def swap_update_details() -> dict: + """Installierte vs. neueste llama-swap-Version + Release-Name/-Notizen/-Link.""" + info: dict = {"kind": "swap", "installed_build": _installed_swap_version(), + "latest_build": None, "latest_tag": None, "name": None, + "url": None, "body": None} + try: + rel = httpx.get(f"https://api.github.com/repos/{SWAP_REPO}/releases/latest", + timeout=8, headers={"User-Agent": "MissionControl2"}).json() + tag = str(rel.get("tag_name", "")) + info["latest_tag"] = tag + info["latest_build"] = int(m.group(1)) if (m := re.search(r"(\d{2,})", tag)) else None + info["name"] = rel.get("name") or tag + info["url"] = rel.get("html_url") + body = (rel.get("body") or "").strip() + info["body"] = body[:2000] if body else None + except Exception as exc: # noqa: BLE001 + info["error"] = str(exc) + return info + + def hermes_update_details() -> dict: """Commits, die ein Hermes-Update einspielen würde (HEAD..origin/).""" info: dict = {"kind": "hermes", "branch": None, "behind": 0, "commits": []} @@ -319,6 +381,7 @@ def hermes_update_details() -> dict: def update_details(kind: str) -> dict: return {"os": os_update_details, "engine": engine_update_details, + "swap": swap_update_details, "hermes": hermes_update_details}.get(kind, lambda: {"error": "unbekannt"})() @@ -429,6 +492,22 @@ def engine_update_job(sudo_password: str | None = None) -> dict | None: return {"ok": True, "job_id": job_id} +def swap_update_job(sudo_password: str | None = None) -> dict | None: + if not SWAP_UPDATE_CMD: + return None + if err := check_sudo_needs_password(sudo_password): + return err + + def on_done(): + _swap_cache.update(ts=0.0, avail=False) # Cache leeren → frischer Versions-Vergleich + + # update-swap.sh läuft via sudo als root, ersetzt die Binary und startet llama-swap neu. + job_id = jobengine.start_job(["bash", "-c", SWAP_UPDATE_CMD], + "Router-Update (llama-swap)", + on_done=on_done, sudo_password=sudo_password) + return {"ok": True, "job_id": job_id} + + def hermes_update_job() -> dict: """Hermes-Agent aktualisieren wie die CLI (`hermes update` = git pull + Deps), danach den Gateway neu starten. Davor ein Sicherheits-Backup (unser deploy/backup.sh). Kein sudo diff --git a/deploy/update-swap.sh b/deploy/update-swap.sh new file mode 100755 index 0000000..c93ca35 --- /dev/null +++ b/deploy/update-swap.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Aktualisiert den llama-swap-Router (mostlygeek/llama-swap) auf den neuesten Release. +# Wird vom MC2-„Router Update"-Button via `sudo bash …` als ROOT aufgerufen +# (deshalb KEIN internes sudo). Ersetzt die Binary und startet llama-swap neu. +set -euo pipefail + +SWAP_BIN="${MC_SWAP_BIN:-/usr/local/bin/llama-swap}" +PIN_VER="${MC_SWAP_VERSION:-}" # leer = neuester Release + +if [ -n "$PIN_VER" ]; then + TAG="$PIN_VER" +else + TAG="$(curl -s https://api.github.com/repos/mostlygeek/llama-swap/releases/latest | jq -r .tag_name)" +fi +[ -n "$TAG" ] && [ "$TAG" != "null" ] || { echo "Konnte neuesten Release-Tag nicht ermitteln"; exit 1; } + +# Asset-Name nutzt die nackte Nummer (z.B. v230 -> 230): llama-swap_230_linux_amd64.tar.gz +NUM="${TAG#v}" +ASSET="llama-swap_${NUM}_linux_amd64.tar.gz" +URL="https://github.com/mostlygeek/llama-swap/releases/download/${TAG}/${ASSET}" +TMP="$(mktemp -d)" +trap 'rm -rf "$TMP"' EXIT + +echo "Lade llama-swap ${TAG} …" +curl -fsSL -o "$TMP/s.tgz" "$URL" +tar xzf "$TMP/s.tgz" -C "$TMP" +NEW="$(find "$TMP" -type f -name llama-swap | head -1)" +[ -n "$NEW" ] || { echo "llama-swap-Binary im Archiv nicht gefunden"; exit 1; } +install -m 0755 "$NEW" "$SWAP_BIN" +test -x "$SWAP_BIN" + +systemctl restart llama-swap +echo "Router aktualisiert auf ${TAG} und llama-swap neugestartet." diff --git a/frontend/dist/assets/GraphView-COC_6OUw.js b/frontend/dist/assets/GraphView-COC_6OUw.js new file mode 100644 index 0000000..6d525af --- /dev/null +++ b/frontend/dist/assets/GraphView-COC_6OUw.js @@ -0,0 +1,312 @@ +import{g as bi,r as ce,j as W,S as rr,a as Ot,T as nr}from"./index-BhNoAezr.js";var et={exports:{}},Ut;function ar(){if(Ut)return et.exports;Ut=1;var n=typeof Reflect=="object"?Reflect:null,i=n&&typeof n.apply=="function"?n.apply:function(y,S,R){return Function.prototype.apply.call(y,S,R)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(y){return Object.getOwnPropertyNames(y).concat(Object.getOwnPropertySymbols(y))}:t=function(y){return Object.getOwnPropertyNames(y)};function e(v){console&&console.warn&&console.warn(v)}var r=Number.isNaN||function(y){return y!==y};function a(){a.init.call(this)}et.exports=a,et.exports.once=x,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(v){if(typeof v!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof v)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(v){if(typeof v!="number"||v<0||r(v))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+v+".");o=v}}),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(y){if(typeof y!="number"||y<0||r(y))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+y+".");return this._maxListeners=y,this};function u(v){return v._maxListeners===void 0?a.defaultMaxListeners:v._maxListeners}a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(y){for(var S=[],R=1;R0&&(P=S[0]),P instanceof Error)throw P;var V=new Error("Unhandled error."+(P?" ("+P.message+")":""));throw V.context=P,V}var z=F[y];if(z===void 0)return!1;if(typeof z=="function")i(z,this,S);else for(var f=z.length,K=w(z,f),R=0;R0&&P.length>G&&!P.warned){P.warned=!0;var V=new Error("Possible EventEmitter memory leak detected. "+P.length+" "+String(y)+" listeners added. Use emitter.setMaxListeners() to increase limit");V.name="MaxListenersExceededWarning",V.emitter=v,V.type=y,V.count=P.length,e(V)}return v}a.prototype.addListener=function(y,S){return h(this,y,S,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(y,S){return h(this,y,S,!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(v,y,S){var R={fired:!1,wrapFn:void 0,target:v,type:y,listener:S},G=d.bind(R);return G.listener=S,R.wrapFn=G,G}a.prototype.once=function(y,S){return s(S),this.on(y,l(this,y,S)),this},a.prototype.prependOnceListener=function(y,S){return s(S),this.prependListener(y,l(this,y,S)),this},a.prototype.removeListener=function(y,S){var R,G,F,P,V;if(s(S),G=this._events,G===void 0)return this;if(R=G[y],R===void 0)return this;if(R===S||R.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete G[y],G.removeListener&&this.emit("removeListener",y,R.listener||S));else if(typeof R!="function"){for(F=-1,P=R.length-1;P>=0;P--)if(R[P]===S||R[P].listener===S){V=R[P].listener,F=P;break}if(F<0)return this;F===0?R.shift():m(R,F),R.length===1&&(G[y]=R[0]),G.removeListener!==void 0&&this.emit("removeListener",y,V||S)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(y){var S,R,G;if(R=this._events,R===void 0)return this;if(R.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):R[y]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete R[y]),this;if(arguments.length===0){var F=Object.keys(R),P;for(G=0;G=0;G--)this.removeListener(y,S[G]);return this};function c(v,y,S){var R=v._events;if(R===void 0)return[];var G=R[y];return G===void 0?[]:typeof G=="function"?S?[G.listener||G]:[G]:S?_(G):w(G,G.length)}a.prototype.listeners=function(y){return c(this,y,!0)},a.prototype.rawListeners=function(y){return c(this,y,!1)},a.listenerCount=function(v,y){return typeof v.listenerCount=="function"?v.listenerCount(y):g.call(v,y)},a.prototype.listenerCount=g;function g(v){var y=this._events;if(y!==void 0){var S=y[v];if(typeof S=="function")return 1;if(S!==void 0)return S.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function w(v,y){for(var S=new Array(y),R=0;Rn++}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 Dt extends Error{constructor(i){super(),this.name="GraphError",this.message=i}}class D extends Dt{constructor(i){super(i),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,D.prototype.constructor)}}class k extends Dt{constructor(i){super(i),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,k.prototype.constructor)}}class I extends Dt{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,ur=2,Ci=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 k(`Graph.${i}: could not find the "${e}" node in the graph.`);h=r,d=a}else if(t===Ci){if(r=""+r,u=n._edges.get(r),!u)throw new k(`Graph.${i}: could not find the "${r}" edge in the graph.`);const l=u.source.key,c=u.target.key;if(e===l)s=u.target;else if(e===c)s=u.source;else throw new k(`Graph.${i}: the "${e}" node is not attached to the "${r}" edge (${l}, ${c}).`);h=a,d=o}else{if(u=n._edges.get(e),!u)throw new k(`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 hr(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 dr(n,i,t){n.prototype[i]=function(e,r){const[a]=ye(this,i,t,e,r);return a.attributes}}function lr(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 cr(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 fr(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 D(`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 gr(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 pr(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 D(`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 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 D(`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 mr(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 D(`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 yr=[{name:n=>`get${n}Attribute`,attacher:hr},{name:n=>`get${n}Attributes`,attacher:dr},{name:n=>`has${n}Attribute`,attacher:lr},{name:n=>`set${n}Attribute`,attacher:cr},{name:n=>`update${n}Attribute`,attacher:fr},{name:n=>`remove${n}Attribute`,attacher:gr},{name:n=>`replace${n}Attributes`,attacher:pr},{name:n=>`merge${n}Attributes`,attacher:vr},{name:n=>`update${n}Attributes`,attacher:mr}];function br(n){yr.forEach(function({name:i,attacher:t}){t(n,i("Node"),Ri),t(n,i("Source"),Ai),t(n,i("Target"),ur),t(n,i("Opposite"),Ci)})}function wr(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 k(`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 k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]}}function Er(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 k(`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 k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function _r(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 k(`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 k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}return a.attributes.hasOwnProperty(r)}}function Tr(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 k(`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 k(`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 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 k(`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 k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof a!="function")throw new D(`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 Rr(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 k(`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 k(`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 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 k(`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 k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new D(`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 k(`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 k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(!J(r))throw new D(`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 k(`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 k(`Graph.${i}: could not find the "${e}" edge in the graph.`)}if(typeof r!="function")throw new D(`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 xr=[{name:n=>`get${n}Attribute`,attacher:wr},{name:n=>`get${n}Attributes`,attacher:Er},{name:n=>`has${n}Attribute`,attacher:_r},{name:n=>`set${n}Attribute`,attacher:Tr},{name:n=>`update${n}Attribute`,attacher:Sr},{name:n=>`remove${n}Attribute`,attacher:Rr},{name:n=>`replace${n}Attributes`,attacher:Ar},{name:n=>`merge${n}Attributes`,attacher:Cr},{name:n=>`update${n}Attributes`,attacher:kr}];function Dr(n){xr.forEach(function({name:i,attacher:t}){t(n,i("Edge"),"mixed"),t(n,i("DirectedEdge"),"directed"),t(n,i("UndirectedEdge"),"undirected")})}const Lr=[{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 Gr(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 Fr(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 dt(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 Nr(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 Pr(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 lt(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 Ir(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 ki(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:c,target:g}=s;if(u=e(d,l,c.key,g.key,c.attributes,g.attributes,s.undirected),n&&u)return d}}function Or(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 Lt(n,i,t,e,r,a){const o=i?Fr:Gr;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 Ur(n,i,t,e){const r=[];return Lt(!1,n,i,t,e,function(a){r.push(a)}),r}function zr(n,i,t){let e=Le();return n!=="undirected"&&(i!=="out"&&typeof t.in<"u"&&(e=me(e,dt(t.in))),i!=="in"&&typeof t.out<"u"&&(e=me(e,dt(t.out,i?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(e=me(e,dt(t.undirected))),e}function Gt(n,i,t,e,r,a,o){const s=t?Pr:Nr;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 $r(n,i,t,e,r){const a=[];return Gt(!1,n,i,t,e,r,function(o){a.push(o)}),a}function Br(n,i,t,e){let r=Le();return n!=="undirected"&&(typeof t.in<"u"&&i!=="out"&&e in t.in&&(r=me(r,lt(t.in,e))),typeof t.out<"u"&&i!=="in"&&e in t.out&&(i||t.key!==e)&&(r=me(r,lt(t.out,e)))),n!=="directed"&&typeof t.undirected<"u"&&e in t.undirected&&(r=me(r,lt(t.undirected,e))),r}function Mr(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 Ir(this,e);if(arguments.length===1){a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new k(`Graph.${t}: could not find the "${a}" node in the graph.`);return Ur(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 k(`Graph.${t}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new k(`Graph.${t}: could not find the "${o}" target node in the graph.`);return $r(e,this.multi,r,s,o)}throw new D(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Hr(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,ki(!1,this,e,l);if(arguments.length===2){h=""+h,l=d;const c=this._nodes.get(h);if(typeof c>"u")throw new k(`Graph.${a}: could not find the "${h}" node in the graph.`);return Lt(!1,this.multi,e==="mixed"?this.type:e,r,c,l)}if(arguments.length===3){h=""+h,d=""+d;const c=this._nodes.get(h);if(!c)throw new k(`Graph.${a}: could not find the "${h}" source node in the graph.`);if(!this._nodes.has(d))throw new k(`Graph.${a}: could not find the "${d}" target node in the graph.`);return Gt(!1,e,this.multi,r,c,d,l)}throw new D(`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 c=0;e!=="directed"&&(c+=this.undirectedSize),e!=="undirected"&&(c+=this.directedSize),l=new Array(c);let g=0;h.push((w,m,_,x,T,C,v)=>{l[g++]=d(w,m,_,x,T,C,v)})}else l=[],h.push((c,g,w,m,_,x,T)=>{l.push(d(c,g,w,m,_,x,T))});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((c,g,w,m,_,x,T)=>{d(c,g,w,m,_,x,T)&&l.push(c)}),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 D(`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 D(`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 c=l;return h.push((g,w,m,_,x,T,C)=>{c=d(c,g,w,m,_,x,T,C)}),this[a].apply(this,h),c}}function Wr(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,ki(!0,this,e,d);if(arguments.length===2){u=""+u,d=h;const l=this._nodes.get(u);if(typeof l>"u")throw new k(`Graph.${a}: could not find the "${u}" node in the graph.`);return Lt(!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 k(`Graph.${a}: could not find the "${u}" source node in the graph.`);if(!this._nodes.has(h))throw new k(`Graph.${a}: could not find the "${h}" target node in the graph.`);return Gt(!0,e,this.multi,r,l,h,d)}throw new D(`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,c,g,w,m,_,x)=>h(l,c,g,w,m,_,x)),!!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,c,g,w,m,_,x)=>!h(l,c,g,w,m,_,x)),!this[a].apply(this,u)}}function jr(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 Or(this,e);if(arguments.length===1){o=""+o;const u=this._nodes.get(o);if(!u)throw new k(`Graph.${a}: could not find the "${o}" node in the graph.`);return zr(e,r,u)}if(arguments.length===2){o=""+o,s=""+s;const u=this._nodes.get(o);if(!u)throw new k(`Graph.${a}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new k(`Graph.${a}: could not find the "${s}" target node in the graph.`);return Br(e,r,u,s)}throw new D(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function Vr(n){Lr.forEach(i=>{Mr(n,i),Hr(n,i),Wr(n,i),jr(n,i)})}const qr=[{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 st(){this.A=null,this.B=null}st.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};st.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 Ft(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 st;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 Kr(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 Ft(!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 Yr(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 st;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 Zr(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 k(`Graph.${t}: could not find the "${a}" node in the graph.`);return Kr(e==="mixed"?this.type:e,r,o)}}function Xr(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 k(`Graph.${a}: could not find the "${h}" node in the graph.`);Ft(!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,(c,g)=>{l.push(d(c,g))}),l};const s="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(h,d){const l=[];return this[a](h,(c,g)=>{d(c,g)&&l.push(c)}),l};const u="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[u]=function(h,d,l){if(arguments.length<3)throw new D(`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 c=l;return this[a](h,(g,w)=>{c=d(c,g,w)}),c}}function Jr(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 k(`Graph.${o}: could not find the "${h}" node in the graph.`);return Ft(!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,(c,g)=>!d(c,g))}}function Qr(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 k(`Graph.${a}: could not find the "${o}" node in the graph.`);return Yr(e==="mixed"?this.type:e,r,s)}}function en(n){qr.forEach(i=>{Zr(n,i),Xr(n,i),Jr(n,i),Qr(n,i)})}function tt(n,i,t,e,r){const a=e._nodes.values(),o=e.type;let s,u,h,d,l,c;for(;s=a.next(),s.done!==!0;){let g=!1;if(u=s.value,o!=="undirected"){d=u.out;for(h in d){l=d[h];do c=l.target,g=!0,r(u.key,c.key,u.attributes,c.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 c=l.target,c.key!==h&&(c=l.source),g=!0,r(u.key,c.key,u.attributes,c.attributes,l.key,l.attributes,l.undirected),l=l.next;while(l)}}t&&!g&&r(u.key,null,u.attributes,null,null,null,null)}}function tn(n,i){const t={key:n};return Ei(i.attributes)||(t.attributes=Z({},i.attributes)),t}function rn(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 nn(n){if(!J(n))throw new D('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 D("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new D("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function an(n){if(!J(n))throw new D('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 D("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new D("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!J(n.attributes)||n.attributes===null))throw new D("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new D("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const on=sr(),sn=new Set(["directed","undirected","mixed"]),$t=new Set(["domain","_events","_eventsCount","_maxListeners"]),un=[{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"}],hn={allowSelfLoops:!0,multi:!1,type:"mixed"};function dn(n,i,t){if(t&&!J(t))throw new D(`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 Bt(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 xi(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 D(`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 k(`Graph.${i}: source node "${a}" not found.`);if(!h)throw new k(`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 c=a===o;return e?(u.undirectedDegree++,h.undirectedDegree++,c&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,c&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?l.attachMulti():l.attach(),e?n._undirectedSize++:n._directedSize++,d.key=r,n.emit("edgeAdded",d),r}function ln(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 D(`Graph.${i}: invalid updater function. Expecting a function but got "${s}"`)}else if(!J(s))throw new D(`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),c,g;if(!t&&(c=n._edges.get(r),c)){if((c.source.key!==a||c.target.key!==o)&&(!e||c.source.key!==o||c.target.key!==a))throw new I(`Graph.${i}: inconsistency detected when attempting to merge the "${r}" edge with "${a}" source & "${o}" target vs. ("${c.source.key}", "${c.target.key}").`);g=c}if(!g&&!n.multi&&d&&(g=e?d.undirected[o]:d.out[o]),g){const T=[g.key,!1,!1,!1];if(u?!h:!s)return T;if(u){const C=g.attributes;g.attributes=h(C),n.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else Z(g.attributes,s),n.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:s});return T}s=s||{},u&&h&&(s=h(s));const w={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 m=!1,_=!1;d||(d=Bt(n,a,{}),m=!0,a===o&&(l=d,_=!0)),l||(l=Bt(n,o,{}),_=!0),c=new Ge(e,r,d,l,s),n._edges.set(r,c);const x=a===o;return e?(d.undirectedDegree++,l.undirectedDegree++,x&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,l.inDegree++,x&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?c.attachMulti():c.attach(),e?n._undirectedSize++:n._directedSize++,w.key=r,n.emit("edgeAdded",w),[r,!0,m,_]}function Ce(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({},hn,i),typeof i.multi!="boolean")throw new D(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${i.multi}".`);if(!sn.has(i.type))throw new D(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${i.type}".`);if(typeof i.allowSelfLoops!="boolean")throw new D(`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_"+on()+"_";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),$t.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 D(`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 D(`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 D(`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 k(`Graph.directedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`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 k(`Graph.undirectedEdge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`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 k(`Graph.edge: could not find the "${i}" source node in the graph.`);if(!this._nodes.has(t))throw new k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`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 k(`Graph.isSelfLoop: could not find the "${i}" edge in the graph.`);return t.source===t.target}addNode(i,t){return dn(this,i,t).key}mergeNode(i,t){if(t&&!J(t))throw new D(`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 D(`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 k(`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 Ce(this,e),e=e.next;while(e)}for(const r in t.in){e=t.in[r];do Ce(this,e),e=e.next;while(e)}}if(this.type!=="directed")for(const r in t.undirected){e=t.undirected[r];do Ce(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 k(`Graph.dropEdge: could not find the "${e}" -> "${r}" edge in the graph.`)}else if(i=""+i,t=this._edges.get(i),!t)throw new k(`Graph.dropEdge: could not find the "${i}" edge in the graph.`);return Ce(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 k(`Graph.dropDirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return Ce(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 k(`Graph.dropUndirectedEdge: could not find a "${i}" -> "${t}" edge in the graph.`);return Ce(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 D("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 D("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 D("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 D("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 D("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!zt(t))throw new D("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 D("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!zt(t))throw new D("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 D("Graph.forEachAdjacencyEntry: expecting a callback.");tt(!1,!1,!1,this,i)}forEachAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new D("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");tt(!1,!1,!0,this,i)}forEachAssymetricAdjacencyEntry(i){if(typeof i!="function")throw new D("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");tt(!1,!0,!1,this,i)}forEachAssymetricAdjacencyEntryWithOrphans(i){if(typeof i!="function")throw new D("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 D("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 D("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 D("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 D("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 D("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 D("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 D("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new D("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++]=tn(a,r)});const e=new Array(this._edges.size);return t=0,this._edges.forEach((r,a)=>{e[t++]=rn(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,c,g,w)=>{t?w?this.mergeUndirectedEdgeWithKey(u,d,l,h):this.mergeDirectedEdgeWithKey(u,d,l,h):w?this.addUndirectedEdgeWithKey(u,d,l,h):this.addDirectedEdgeWithKey(u,d,l,h)}),this;if(!J(i))throw new D("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(i.attributes){if(!J(i.attributes))throw new D("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 D("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,xi(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 c=`(${h})${s}(${d})`;o.startsWith("geid_")?this.multi&&(typeof e[c]>"u"?e[c]=0:e[c]++,u+=`${e[c]}. `):u+=`[${o}]: `,u+=c,t[u]=a.attributes});const r={};for(const a in this)this.hasOwnProperty(a)&&!$t.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);un.forEach(n=>{["add","merge","update"].forEach(i=>{const t=n.name(i),e=i==="add"?xi:ln;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")}})});br(j);Dr(j);Vr(j);en(j);class Di extends j{constructor(i){const t=Z({type:"directed"},i);if("multi"in t&&t.multi!==!1)throw new D("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new D('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 D("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new D('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 D("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 D("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new D('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 D("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new D('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=D;j.NotFoundGraphError=k;j.UsageGraphError=I;var ct,Mt;function Pi(){return Mt||(Mt=1,ct=function(i){return i!==null&&typeof i=="object"&&typeof i.addUndirectedEdgeWithKey=="function"&&typeof i.dropNode=="function"&&typeof i.multi=="boolean"}),ct}var ze={},Ht;function cn(){if(Ht)return ze;Ht=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,c,g,w,m){return o(e(h,d,l,c,g,w,m))},a.fromPartialEntry=function(h,d,l,c){return o(e(h,d,l,c))},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 ft,Wt;function fn(){if(Wt)return ft;Wt=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,c=2,g=0,w=1,m=2,_=3,x=4,T=5,C=6,v=7,y=8,S=3,R=10,G=3,F=9,P=10;return ft=function(z,f,K){var te,A,p,$,H,X,ie,Y,N,Ne,re=f.length,tr=K.length,Pe=z.adjustSizes,ir=z.barnesHutTheta*z.barnesHutTheta,qe,q,B,M,fe,U,O,b=[];for(p=0;pYe?(Ee-=(Ke-Ye)/2,Re=Ee+Ke):(we-=(Ye-Ke)/2,Se=we+Ye),b[0+g]=-1,b[0+w]=(we+Se)/2,b[0+m]=(Ee+Re)/2,b[0+_]=Math.max(Se-we,Re-Ee),b[0+x]=-1,b[0+T]=-1,b[0+C]=0,b[0+v]=0,b[0+y]=0,te=1,p=0;p=0){f[p+n]=0)if(U=Math.pow(f[p+n]-b[A+v],2)+Math.pow(f[p+i]-b[A+y],2),Ne=b[A+_],4*Ne*Ne/U0?(O=q*f[p+o]*b[A+C]/U,f[p+t]+=B*O,f[p+e]+=M*O):U<0&&(O=-q*f[p+o]*b[A+C]/Math.sqrt(U),f[p+t]+=B*O,f[p+e]+=M*O):U>0&&(O=q*f[p+o]*b[A+C]/U,f[p+t]+=B*O,f[p+e]+=M*O),A=b[A+x],A<0)break;continue}else{A=b[A+T];continue}else{if(X=b[A+g],X>=0&&X!==p&&(B=f[p+n]-f[X+n],M=f[p+i]-f[X+i],U=B*B+M*M,Pe===!0?U>0?(O=q*f[p+o]*f[X+o]/U,f[p+t]+=B*O,f[p+e]+=M*O):U<0&&(O=-q*f[p+o]*f[X+o]/Math.sqrt(U),f[p+t]+=B*O,f[p+e]+=M*O):U>0&&(O=q*f[p+o]*f[X+o]/U,f[p+t]+=B*O,f[p+e]+=M*O)),A=b[A+x],A<0)break;continue}else for(q=z.scalingRatio,$=0;$0?(O=q*f[$+o]*f[H+o]/U/U,f[$+t]+=B*O,f[$+e]+=M*O,f[H+t]-=B*O,f[H+e]-=M*O):U<0&&(O=100*q*f[$+o]*f[H+o],f[$+t]+=B*O,f[$+e]+=M*O,f[H+t]-=B*O,f[H+e]-=M*O)):(U=Math.sqrt(B*B+M*M),U>0&&(O=q*f[$+o]*f[H+o]/U/U,f[$+t]+=B*O,f[$+e]+=M*O,f[H+t]-=B*O,f[H+e]-=M*O));for(N=z.gravity/z.scalingRatio,q=z.scalingRatio,p=0;p0&&(O=q*f[p+o]*N):U>0&&(O=q*f[p+o]*N/U),f[p+t]-=B*O,f[p+e]-=M*O;for(q=1*(z.outboundAttractionDistribution?qe:1),ie=0;ie0&&(O=-q*fe*Math.log(1+U)/U/f[$+o]):U>0&&(O=-q*fe*Math.log(1+U)/U):z.outboundAttractionDistribution?U>0&&(O=-q*fe/f[$+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/f[$+o]):U>0&&(O=-q*fe*Math.log(1+U)/U):z.outboundAttractionDistribution?(U=1,O=-q*fe/f[$+o]):(U=1,O=-q*fe)),U>0&&(f[$+t]+=B*O,f[$+e]+=M*O,f[H+t]-=B*O,f[H+e]-=M*O);var Ze,Ie,Xe,_e,Je,Qe;if(Pe===!0)for(p=0;pP&&(f[p+t]=f[p+t]*P/Ze,f[p+e]=f[p+e]*P/Ze),Ie=f[p+o]*Math.sqrt((f[p+r]-f[p+t])*(f[p+r]-f[p+t])+(f[p+a]-f[p+e])*(f[p+a]-f[p+e])),Xe=Math.sqrt((f[p+r]+f[p+t])*(f[p+r]+f[p+t])+(f[p+a]+f[p+e])*(f[p+a]+f[p+e]))/2,_e=.1*Math.log(1+Xe)/(1+Math.sqrt(Ie)),Je=f[p+n]+f[p+t]*(_e/z.slowDown),f[p+n]=Je,Qe=f[p+i]+f[p+e]*(_e/z.slowDown),f[p+i]=Qe);else for(p=0;p=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,c,g,w,m,_){var x=o[c],T=o[g],C=e(d,l,c,g,w,m,_);u[x+6]+=C,u[T+6]+=C,h[s]=x,h[s+1]=T,h[s+2]=C,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,pt=s,pt}var mn=vn();const Kt=bi(mn);function yn(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=yn(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 yt[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],c=h[2],g=h[3];return[d,l,c,g]}function E(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;iv){var S="…";for(h=h+S,y=n.measureText(h).width;y>v&&h.length>1;)h=h.slice(0,-2)+S,y=n.measureText(h).width;if(h.length<4)return}var R;T>0?C>0?R=Math.acos(T/v):R=Math.asin(C/v):C>0?R=Math.acos(T/v)+Math.PI:R=Math.asin(T/v)+Math.PI/2,n.save(),n.translate(_,x),n.rotate(R),n.fillText(h,-y/2,i.size/2+a),n.restore()}}}function Wi(n,i,t){if(i.label){var e=t.labelSize,r=t.labelFont,a=t.labelWeight,o=t.labelColor.attribute?i[t.labelColor.attribute]||t.labelColor.color||"#000":t.labelColor.color;n.fillStyle=o,n.font="".concat(a," ").concat(e,"px ").concat(r),n.fillText(i.label,i.x+i.size+3,i.y+e/3)}}function On(n,i,t){var e=t.labelSize,r=t.labelFont,a=t.labelWeight;n.font="".concat(a," ").concat(e,"px ").concat(r),n.fillStyle="#FFF",n.shadowOffsetX=0,n.shadowOffsetY=0,n.shadowBlur=8,n.shadowColor="#000";var o=2;if(typeof i.label=="string"){var s=n.measureText(i.label).width,u=Math.round(s+5),h=Math.round(e+2*o),d=Math.max(i.size,e/2)+o,l=Math.asin(h/2/d),c=Math.sqrt(Math.abs(Math.pow(d,2)-Math.pow(h/2,2)));n.beginPath(),n.moveTo(i.x+c,i.y+h/2),n.lineTo(i.x+d+u,i.y+h/2),n.lineTo(i.x+d+u,i.y-h/2),n.lineTo(i.x+c,i.y-h/2),n.arc(i.x,i.y,d,l,-l),n.closePath(),n.fill()}else n.beginPath(),n.arc(i.x,i.y,i.size+o,0,Math.PI*2),n.closePath(),n.fill();n.shadowOffsetX=0,n.shadowOffsetY=0,n.shadowBlur=0,Wi(n,i,t)}var Un=` +precision highp float; + +varying vec4 v_color; +varying vec2 v_diffVector; +varying float v_radius; + +uniform float u_correctionRatio; + +const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0); + +void main(void) { + float border = u_correctionRatio * 2.0; + float dist = length(v_diffVector) - v_radius + border; + + // No antialiasing for picking mode: + #ifdef PICKING_MODE + if (dist > border) + gl_FragColor = transparent; + else + gl_FragColor = v_color; + + #else + float t = 0.0; + if (dist > border) + t = 1.0; + else if (dist > 0.0) + t = dist / border; + + gl_FragColor = mix(v_color, transparent, t); + #endif +} +`,zn=Un,$n=` +attribute vec4 a_id; +attribute vec4 a_color; +attribute vec2 a_position; +attribute float a_size; +attribute float a_angle; + +uniform mat3 u_matrix; +uniform float u_sizeRatio; +uniform float u_correctionRatio; + +varying vec4 v_color; +varying vec2 v_diffVector; +varying float v_radius; +varying float v_border; + +const float bias = 255.0 / 254.0; + +void main() { + float size = a_size * u_correctionRatio / u_sizeRatio * 4.0; + vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle)); + vec2 position = a_position + diffVector; + gl_Position = vec4( + (u_matrix * vec3(position, 1)).xy, + 0, + 1 + ); + + v_diffVector = diffVector; + v_radius = size / 2.0; + + #ifdef PICKING_MODE + // For picking mode, we use the ID as the color: + v_color = a_id; + #else + // For normal mode, we use the color: + v_color = a_color; + #endif + + v_color.a *= bias; +} +`,Bn=$n,ji=WebGLRenderingContext,ti=ji.UNSIGNED_BYTE,wt=ji.FLOAT,Mn=["u_sizeRatio","u_correctionRatio","u_matrix"],ut=(function(n){function i(){return Q(this,i),se(this,i,arguments)}return ue(i,n),ee(i,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:Bn,FRAGMENT_SHADER_SOURCE:zn,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Mn,ATTRIBUTES:[{name:"a_position",size:2,type:wt},{name:"a_size",size:1,type:wt},{name:"a_color",size:4,type:ti,normalized:!0},{name:"a_id",size:4,type:ti,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:wt}],CONSTANT_DATA:[[i.ANGLE_1],[i.ANGLE_2],[i.ANGLE_3]]}}},{key:"processVisibleItem",value:function(e,r,a){var o=this.array,s=Ve(a.color);o[r++]=a.x,o[r++]=a.y,o[r++]=a.size,o[r++]=s,o[r++]=e}},{key:"setUniforms",value:function(e,r){var a=r.gl,o=r.uniformLocations,s=o.u_sizeRatio,u=o.u_correctionRatio,h=o.u_matrix;a.uniform1f(u,e.correctionRatio),a.uniform1f(s,e.sizeRatio),a.uniformMatrix3fv(h,!1,e.matrix)}}])})(Nn);E(ut,"ANGLE_1",0);E(ut,"ANGLE_2",2*Math.PI/3);E(ut,"ANGLE_3",4*Math.PI/3);var Hn=` +precision mediump float; + +varying vec4 v_color; + +void main(void) { + gl_FragColor = v_color; +} +`,Wn=Hn,jn=` +attribute vec2 a_position; +attribute vec2 a_normal; +attribute float a_radius; +attribute vec3 a_barycentric; + +#ifdef PICKING_MODE +attribute vec4 a_id; +#else +attribute vec4 a_color; +#endif + +uniform mat3 u_matrix; +uniform float u_sizeRatio; +uniform float u_correctionRatio; +uniform float u_minEdgeThickness; +uniform float u_lengthToThicknessRatio; +uniform float u_widenessToThicknessRatio; + +varying vec4 v_color; + +const float bias = 255.0 / 254.0; + +void main() { + float minThickness = u_minEdgeThickness; + + float normalLength = length(a_normal); + vec2 unitNormal = a_normal / normalLength; + + // These first computations are taken from edge.vert.glsl and + // edge.clamped.vert.glsl. Please read it to get better comments on what's + // happening: + float pixelsThickness = max(normalLength / u_sizeRatio, minThickness); + float webGLThickness = pixelsThickness * u_correctionRatio; + float webGLNodeRadius = a_radius * 2.0 * u_correctionRatio / u_sizeRatio; + float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0; + float webGLArrowHeadThickness = webGLThickness * u_widenessToThicknessRatio; + + float da = a_barycentric.x; + float db = a_barycentric.y; + float dc = a_barycentric.z; + + vec2 delta = vec2( + da * (webGLNodeRadius * unitNormal.y) + + db * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y + webGLArrowHeadThickness * unitNormal.x) + + dc * ((webGLNodeRadius + webGLArrowHeadLength) * unitNormal.y - webGLArrowHeadThickness * unitNormal.x), + + da * (-webGLNodeRadius * unitNormal.x) + + db * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x + webGLArrowHeadThickness * unitNormal.y) + + dc * (-(webGLNodeRadius + webGLArrowHeadLength) * unitNormal.x - webGLArrowHeadThickness * unitNormal.y) + ); + + vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy; + + gl_Position = vec4(position, 0, 1); + + #ifdef PICKING_MODE + // For picking mode, we use the ID as the color: + v_color = a_id; + #else + // For normal mode, we use the color: + v_color = a_color; + #endif + + v_color.a *= bias; +} +`,Vn=jn,Vi=WebGLRenderingContext,ii=Vi.UNSIGNED_BYTE,rt=Vi.FLOAT,qn=["u_matrix","u_sizeRatio","u_correctionRatio","u_minEdgeThickness","u_lengthToThicknessRatio","u_widenessToThicknessRatio"],qi={extremity:"target",lengthToThicknessRatio:2.5,widenessToThicknessRatio:2};function Ki(n){var i=L(L({},qi),{});return(function(t){function e(){return Q(this,e),se(this,e,arguments)}return ue(e,t),ee(e,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:Vn,FRAGMENT_SHADER_SOURCE:Wn,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:qn,ATTRIBUTES:[{name:"a_position",size:2,type:rt},{name:"a_normal",size:2,type:rt},{name:"a_radius",size:1,type:rt},{name:"a_color",size:4,type:ii,normalized:!0},{name:"a_id",size:4,type:ii,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_barycentric",size:3,type:rt}],CONSTANT_DATA:[[1,0,0],[0,1,0],[0,0,1]]}}},{key:"processVisibleItem",value:function(a,o,s,u,h){if(i.extremity==="source"){var d=[u,s];s=d[0],u=d[1]}var l=h.size||1,c=u.size||1,g=s.x,w=s.y,m=u.x,_=u.y,x=Ve(h.color),T=m-g,C=_-w,v=T*T+C*C,y=0,S=0;v&&(v=1/Math.sqrt(v),y=-C*v*l,S=T*v*l);var R=this.array;R[o++]=m,R[o++]=_,R[o++]=-y,R[o++]=-S,R[o++]=c,R[o++]=x,R[o++]=a}},{key:"setUniforms",value:function(a,o){var s=o.gl,u=o.uniformLocations,h=u.u_matrix,d=u.u_sizeRatio,l=u.u_correctionRatio,c=u.u_minEdgeThickness,g=u.u_lengthToThicknessRatio,w=u.u_widenessToThicknessRatio;s.uniformMatrix3fv(h,!1,a.matrix),s.uniform1f(d,a.sizeRatio),s.uniform1f(l,a.correctionRatio),s.uniform1f(c,a.minEdgeThickness),s.uniform1f(g,i.lengthToThicknessRatio),s.uniform1f(w,i.widenessToThicknessRatio)}}])})(Nt)}Ki();var Kn=` +precision mediump float; + +varying vec4 v_color; +varying vec2 v_normal; +varying float v_thickness; +varying float v_feather; + +const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0); + +void main(void) { + // We only handle antialiasing for normal mode: + #ifdef PICKING_MODE + gl_FragColor = v_color; + #else + float dist = length(v_normal) * v_thickness; + + float t = smoothstep( + v_thickness - v_feather, + v_thickness, + dist + ); + + gl_FragColor = mix(v_color, transparent, t); + #endif +} +`,Yi=Kn,Yn=` +attribute vec4 a_id; +attribute vec4 a_color; +attribute vec2 a_normal; +attribute float a_normalCoef; +attribute vec2 a_positionStart; +attribute vec2 a_positionEnd; +attribute float a_positionCoef; +attribute float a_radius; +attribute float a_radiusCoef; + +uniform mat3 u_matrix; +uniform float u_zoomRatio; +uniform float u_sizeRatio; +uniform float u_pixelRatio; +uniform float u_correctionRatio; +uniform float u_minEdgeThickness; +uniform float u_lengthToThicknessRatio; +uniform float u_feather; + +varying vec4 v_color; +varying vec2 v_normal; +varying float v_thickness; +varying float v_feather; + +const float bias = 255.0 / 254.0; + +void main() { + float minThickness = u_minEdgeThickness; + + float radius = a_radius * a_radiusCoef; + vec2 normal = a_normal * a_normalCoef; + vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef; + + float normalLength = length(normal); + vec2 unitNormal = normal / normalLength; + + // These first computations are taken from edge.vert.glsl. Please read it to + // get better comments on what's happening: + float pixelsThickness = max(normalLength, minThickness * u_sizeRatio); + float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio; + + // Here, we move the point to leave space for the arrow head: + float direction = sign(radius); + float webGLNodeRadius = direction * radius * 2.0 * u_correctionRatio / u_sizeRatio; + float webGLArrowHeadLength = webGLThickness * u_lengthToThicknessRatio * 2.0; + + vec2 compensationVector = vec2(-direction * unitNormal.y, direction * unitNormal.x) * (webGLNodeRadius + webGLArrowHeadLength); + + // Here is the proper position of the vertex + gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness + compensationVector, 1)).xy, 0, 1); + + v_thickness = webGLThickness / u_zoomRatio; + + v_normal = unitNormal; + + v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0; + + #ifdef PICKING_MODE + // For picking mode, we use the ID as the color: + v_color = a_id; + #else + // For normal mode, we use the color: + v_color = a_color; + #endif + + v_color.a *= bias; +} +`,Zn=Yn,Zi=WebGLRenderingContext,ri=Zi.UNSIGNED_BYTE,Te=Zi.FLOAT,Xn=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio"],Jn={lengthToThicknessRatio:qi.lengthToThicknessRatio};function Xi(n){var i=L(L({},Jn),{});return(function(t){function e(){return Q(this,e),se(this,e,arguments)}return ue(e,t),ee(e,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:Zn,FRAGMENT_SHADER_SOURCE:Yi,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Xn,ATTRIBUTES:[{name:"a_positionStart",size:2,type:Te},{name:"a_positionEnd",size:2,type:Te},{name:"a_normal",size:2,type:Te},{name:"a_color",size:4,type:ri,normalized:!0},{name:"a_id",size:4,type:ri,normalized:!0},{name:"a_radius",size:1,type:Te}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:Te},{name:"a_normalCoef",size:1,type:Te},{name:"a_radiusCoef",size:1,type:Te}],CONSTANT_DATA:[[0,1,0],[0,-1,0],[1,1,1],[1,1,1],[0,-1,0],[1,-1,-1]]}}},{key:"processVisibleItem",value:function(a,o,s,u,h){var d=h.size||1,l=s.x,c=s.y,g=u.x,w=u.y,m=Ve(h.color),_=g-l,x=w-c,T=u.size||1,C=_*_+x*x,v=0,y=0;C&&(C=1/Math.sqrt(C),v=-x*C*d,y=_*C*d);var S=this.array;S[o++]=l,S[o++]=c,S[o++]=g,S[o++]=w,S[o++]=v,S[o++]=y,S[o++]=m,S[o++]=a,S[o++]=T}},{key:"setUniforms",value:function(a,o){var s=o.gl,u=o.uniformLocations,h=u.u_matrix,d=u.u_zoomRatio,l=u.u_feather,c=u.u_pixelRatio,g=u.u_correctionRatio,w=u.u_sizeRatio,m=u.u_minEdgeThickness,_=u.u_lengthToThicknessRatio;s.uniformMatrix3fv(h,!1,a.matrix),s.uniform1f(d,a.zoomRatio),s.uniform1f(w,a.sizeRatio),s.uniform1f(g,a.correctionRatio),s.uniform1f(c,a.pixelRatio),s.uniform1f(l,a.antiAliasingFeather),s.uniform1f(m,a.minEdgeThickness),s.uniform1f(_,i.lengthToThicknessRatio)}}])})(Nt)}Xi();function Qn(n){return Pn([Xi(),Ki()])}var ea=Qn(),ta=ea,ia=` +attribute vec4 a_id; +attribute vec4 a_color; +attribute vec2 a_normal; +attribute float a_normalCoef; +attribute vec2 a_positionStart; +attribute vec2 a_positionEnd; +attribute float a_positionCoef; + +uniform mat3 u_matrix; +uniform float u_sizeRatio; +uniform float u_zoomRatio; +uniform float u_pixelRatio; +uniform float u_correctionRatio; +uniform float u_minEdgeThickness; +uniform float u_feather; + +varying vec4 v_color; +varying vec2 v_normal; +varying float v_thickness; +varying float v_feather; + +const float bias = 255.0 / 254.0; + +void main() { + float minThickness = u_minEdgeThickness; + + vec2 normal = a_normal * a_normalCoef; + vec2 position = a_positionStart * (1.0 - a_positionCoef) + a_positionEnd * a_positionCoef; + + float normalLength = length(normal); + vec2 unitNormal = normal / normalLength; + + // We require edges to be at least "minThickness" pixels thick *on screen* + // (so we need to compensate the size ratio): + float pixelsThickness = max(normalLength, minThickness * u_sizeRatio); + + // Then, we need to retrieve the normalized thickness of the edge in the WebGL + // referential (in a ([0, 1], [0, 1]) space), using our "magic" correction + // ratio: + float webGLThickness = pixelsThickness * u_correctionRatio / u_sizeRatio; + + // Here is the proper position of the vertex + gl_Position = vec4((u_matrix * vec3(position + unitNormal * webGLThickness, 1)).xy, 0, 1); + + // For the fragment shader though, we need a thickness that takes the "magic" + // correction ratio into account (as in webGLThickness), but so that the + // antialiasing effect does not depend on the zoom level. So here's yet + // another thickness version: + v_thickness = webGLThickness / u_zoomRatio; + + v_normal = unitNormal; + + v_feather = u_feather * u_correctionRatio / u_zoomRatio / u_pixelRatio * 2.0; + + #ifdef PICKING_MODE + // For picking mode, we use the ID as the color: + v_color = a_id; + #else + // For normal mode, we use the color: + v_color = a_color; + #endif + + v_color.a *= bias; +} +`,ra=ia,Ji=WebGLRenderingContext,ni=Ji.UNSIGNED_BYTE,$e=Ji.FLOAT,na=["u_matrix","u_zoomRatio","u_sizeRatio","u_correctionRatio","u_pixelRatio","u_feather","u_minEdgeThickness"],aa=(function(n){function i(){return Q(this,i),se(this,i,arguments)}return ue(i,n),ee(i,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:ra,FRAGMENT_SHADER_SOURCE:Yi,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:na,ATTRIBUTES:[{name:"a_positionStart",size:2,type:$e},{name:"a_positionEnd",size:2,type:$e},{name:"a_normal",size:2,type:$e},{name:"a_color",size:4,type:ni,normalized:!0},{name:"a_id",size:4,type:ni,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_positionCoef",size:1,type:$e},{name:"a_normalCoef",size:1,type:$e}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[1,1],[0,-1],[1,-1]]}}},{key:"processVisibleItem",value:function(e,r,a,o,s){var u=s.size||1,h=a.x,d=a.y,l=o.x,c=o.y,g=Ve(s.color),w=l-h,m=c-d,_=w*w+m*m,x=0,T=0;_&&(_=1/Math.sqrt(_),x=-m*_*u,T=w*_*u);var C=this.array;C[r++]=h,C[r++]=d,C[r++]=l,C[r++]=c,C[r++]=x,C[r++]=T,C[r++]=g,C[r++]=e}},{key:"setUniforms",value:function(e,r){var a=r.gl,o=r.uniformLocations,s=o.u_matrix,u=o.u_zoomRatio,h=o.u_feather,d=o.u_pixelRatio,l=o.u_correctionRatio,c=o.u_sizeRatio,g=o.u_minEdgeThickness;a.uniformMatrix3fv(s,!1,e.matrix),a.uniform1f(u,e.zoomRatio),a.uniform1f(c,e.sizeRatio),a.uniform1f(l,e.correctionRatio),a.uniform1f(d,e.pixelRatio),a.uniform1f(h,e.antiAliasingFeather),a.uniform1f(g,e.minEdgeThickness)}}])})(Nt),Pt=(function(n){function i(){var t;return Q(this,i),t=se(this,i),t.rawEmitter=t,t}return ue(i,n),ee(i)})(wi.EventEmitter),oa=Pi();const sa=bi(oa);var ua=function(i){return i},ha=function(i){return i*i},da=function(i){return i*(2-i)},la=function(i){return(i*=2)<1?.5*i*i:-.5*(--i*(i-2)-1)},ca=function(i){return i*i*i},fa=function(i){return--i*i*i+1},ga=function(i){return(i*=2)<1?.5*i*i*i:.5*((i-=2)*i*i+2)},pa={linear:ua,quadraticIn:ha,quadraticOut:da,quadraticInOut:la,cubicIn:ca,cubicOut:fa,cubicInOut:ga},va={easing:"quadraticInOut",duration:150};function de(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function nt(n,i,t){return n[0]=i,n[4]=typeof t=="number"?t:i,n}function ai(n,i){var t=Math.sin(i),e=Math.cos(i);return n[0]=e,n[1]=t,n[3]=-t,n[4]=e,n}function oi(n,i,t){return n[6]=i,n[7]=t,n}function be(n,i){var t=n[0],e=n[1],r=n[2],a=n[3],o=n[4],s=n[5],u=n[6],h=n[7],d=n[8],l=i[0],c=i[1],g=i[2],w=i[3],m=i[4],_=i[5],x=i[6],T=i[7],C=i[8];return n[0]=l*t+c*a+g*u,n[1]=l*e+c*o+g*h,n[2]=l*r+c*s+g*d,n[3]=w*t+m*a+_*u,n[4]=w*e+m*o+_*h,n[5]=w*r+m*s+_*d,n[6]=x*t+T*a+C*u,n[7]=x*e+T*o+C*h,n[8]=x*r+T*s+C*d,n}function kt(n,i){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,e=n[0],r=n[1],a=n[3],o=n[4],s=n[6],u=n[7],h=i.x,d=i.y;return{x:h*e+d*a+s*t,y:h*r+d*o+u*t}}function ma(n,i){var t=n.height/n.width,e=i.height/i.width;return t<1&&e>1||t>1&&e<1?1:Math.min(Math.max(e,1/e),Math.max(1/t,t))}function Be(n,i,t,e,r){var a=n.angle,o=n.ratio,s=n.x,u=n.y,h=i.width,d=i.height,l=de(),c=Math.min(h,d)-2*e,g=ma(i,t);return r?(be(l,oi(de(),s,u)),be(l,nt(de(),o)),be(l,ai(de(),a)),be(l,nt(de(),h/c/2/g,d/c/2/g))):(be(l,nt(de(),2*(c/h)*g,2*(c/d)*g)),be(l,ai(de(),-a)),be(l,nt(de(),1/o)),be(l,oi(de(),-s,-u))),l}function ya(n,i,t){var e=kt(n,{x:Math.cos(i.angle),y:Math.sin(i.angle)},0),r=e.x,a=e.y;return 1/Math.sqrt(Math.pow(r,2)+Math.pow(a,2))/t.width}function ba(n){if(!n.order)return{x:[0,1],y:[0,1]};var i=1/0,t=-1/0,e=1/0,r=-1/0;return n.forEachNode(function(a,o){var s=o.x,u=o.y;st&&(t=s),ur&&(r=u)}),{x:[i,t],y:[e,r]}}function wa(n){if(!sa(n))throw new Error("Sigma: invalid graph instance.");n.forEachNode(function(i,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw new Error("Sigma: Coordinates of node ".concat(i," are invalid. A node must have a numeric 'x' and 'y' attribute."))})}function Ea(n,i,t){var e=document.createElement(n);if(i)for(var r in i)e.style[r]=i[r];if(t)for(var a in t)e.setAttribute(a,t[a]);return e}function si(){return typeof window.devicePixelRatio<"u"?window.devicePixelRatio:1}function ui(n,i,t){return t.sort(function(e,r){var a=i(e)||0,o=i(r)||0;return ao?1:0})}function hi(n){var i=De(n.x,2),t=i[0],e=i[1],r=De(n.y,2),a=r[0],o=r[1],s=Math.max(e-t,o-a),u=(e+t)/2,h=(o+a)/2;(s===0||Math.abs(s)===1/0||isNaN(s))&&(s=1),isNaN(u)&&(u=0),isNaN(h)&&(h=0);var d=function(c){return{x:.5+(c.x-u)/s,y:.5+(c.y-h)/s}};return d.applyTo=function(l){l.x=.5+(l.x-u)/s,l.y=.5+(l.y-h)/s},d.inverse=function(l){return{x:u+s*(l.x-.5),y:h+s*(l.y-.5)}},d.ratio=s,d}function xt(n){"@babel/helpers - typeof";return xt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},xt(n)}function di(n,i){var t=i.size;if(t!==0){var e=n.length;n.length+=t;var r=0;i.forEach(function(a){n[e+r]=a,r++})}}function Et(n){n=n||{};for(var i=0,t=arguments.length<=1?0:arguments.length-1;i1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(!o)return new Promise(function(g){return r.animate(e,a,g)});if(this.enabled){var s=L(L({},va),a),u=this.validateState(e),h=typeof s.easing=="function"?s.easing:pa[s.easing],d=Date.now(),l=this.getState(),c=function(){var w=(Date.now()-d)/s.duration;if(w>=1){r.nextFrame=null,r.setState(u),r.animationCallback&&(r.animationCallback.call(null),r.animationCallback=void 0);return}var m=h(w),_={};typeof u.x=="number"&&(_.x=l.x+(u.x-l.x)*m),typeof u.y=="number"&&(_.y=l.y+(u.y-l.y)*m),r.enabledRotation&&typeof u.angle=="number"&&(_.angle=l.angle+(u.angle-l.angle)*m),typeof u.ratio=="number"&&(_.ratio=l.ratio+(u.ratio-l.ratio)*m),r.setState(_),r.nextFrame=requestAnimationFrame(c)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(c)):c(),this.animationCallback=o}}},{key:"animatedZoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||at)},e):this.animate({ratio:this.ratio/at})}},{key:"animatedUnzoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||at)},e):this.animate({ratio:this.ratio*at})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:"copy",value:function(){return i.from(this.getState())}}],[{key:"from",value:function(e){var r=new i;return r.setState(e)}}])})(Pt);function le(n,i){var t=i.getBoundingClientRect();return{x:n.clientX-t.left,y:n.clientY-t.top}}function pe(n,i){var t=L(L({},le(n,i)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){t.sigmaDefaultPrevented=!0},original:n});return t}function Me(n){var i="x"in n?n:L(L({},n.touches[0]||n.previousTouches[0]),{},{original:n.original,sigmaDefaultPrevented:n.sigmaDefaultPrevented,preventSigmaDefault:function(){n.sigmaDefaultPrevented=!0,i.sigmaDefaultPrevented=!0}});return i}function Ra(n,i){return L(L({},pe(n,i)),{},{delta:Qi(n)})}var Aa=2;function ot(n){for(var i=[],t=0,e=Math.min(n.length,Aa);t0;r.draggedEvents=0,l&&r.renderer.getSetting("hideEdgesOnMove")&&r.renderer.refresh()},0),this.emit("mouseup",pe(e,this.container))}}},{key:"handleMove",value:function(e){var r=this;if(this.enabled){var a=pe(e,this.container);if(this.emit("mousemovebody",a),(e.target===this.container||e.composedPath()[0]===this.container)&&this.emit("mousemove",a),!a.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout=="number"&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){r.movingTimeout=null,r.isMoving=!1},this.settings.dragTimeout);var o=this.renderer.getCamera(),s=le(e,this.container),u=s.x,h=s.y,d=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),l=this.renderer.viewportToFramedGraph({x:u,y:h}),c=d.x-l.x,g=d.y-l.y,w=o.getState(),m=w.x+c,_=w.y+g;o.setState({x:m,y:_}),this.lastMouseX=u,this.lastMouseY=h,e.preventDefault(),e.stopPropagation()}}}},{key:"handleLeave",value:function(e){this.emit("mouseleave",pe(e,this.container))}},{key:"handleEnter",value:function(e){this.emit("mouseenter",pe(e,this.container))}},{key:"handleWheel",value:function(e){var r=this,a=this.renderer.getCamera();if(!(!this.enabled||!a.enabledZooming)){var o=Qi(e);if(o){var s=Ra(e,this.container);if(this.emit("wheel",s),s.sigmaDefaultPrevented){e.preventDefault(),e.stopPropagation();return}var u=a.getState().ratio,h=o>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,d=a.getBoundedRatio(u*h),l=o>0?1:-1,c=Date.now();u!==d&&(e.preventDefault(),e.stopPropagation(),!(this.currentWheelDirection===l&&this.lastWheelTriggerTime&&c-this.lastWheelTriggerTimee.size?-1:t.sizee.key?1:-1}}])})(),gi=(function(){function n(){Q(this,n),E(this,"width",0),E(this,"height",0),E(this,"cellSize",0),E(this,"columns",0),E(this,"rows",0),E(this,"cells",{})}return ee(n,[{key:"resizeAndClear",value:function(t,e){this.width=t.width,this.height=t.height,this.cellSize=e,this.columns=Math.ceil(t.width/e),this.rows=Math.ceil(t.height/e),this.cells={}}},{key:"getIndex",value:function(t){var e=Math.floor(t.x/this.cellSize),r=Math.floor(t.y/this.cellSize);return r*this.columns+e}},{key:"add",value:function(t,e,r){var a=new fi(t,e),o=this.getIndex(r),s=this.cells[o];s||(s=[],this.cells[o]=s),s.push(a)}},{key:"organize",value:function(){for(var t in this.cells){var e=this.cells[t];e.sort(fi.compare)}}},{key:"getLabelsToDisplay",value:function(t,e){var r=this.cellSize*this.cellSize,a=r/t/t,o=a*e/r,s=Math.ceil(o),u=[];for(var h in this.cells)for(var d=this.cells[h],l=0;l2&&arguments[2]!==void 0?arguments[2]:{};if(Q(this,i),r=se(this,i),E(r,"elements",{}),E(r,"canvasContexts",{}),E(r,"webGLContexts",{}),E(r,"pickingLayers",new Set),E(r,"textures",{}),E(r,"frameBuffers",{}),E(r,"activeListeners",{}),E(r,"labelGrid",new gi),E(r,"nodeDataCache",{}),E(r,"edgeDataCache",{}),E(r,"nodeProgramIndex",{}),E(r,"edgeProgramIndex",{}),E(r,"nodesWithForcedLabels",new Set),E(r,"edgesWithForcedLabels",new Set),E(r,"nodeExtent",{x:[0,1],y:[0,1]}),E(r,"nodeZExtent",[1/0,-1/0]),E(r,"edgeZExtent",[1/0,-1/0]),E(r,"matrix",de()),E(r,"invMatrix",de()),E(r,"correctionRatio",1),E(r,"customBBox",null),E(r,"normalizationFunction",hi({x:[0,1],y:[0,1]})),E(r,"graphToViewportRatio",1),E(r,"itemIDsIndex",{}),E(r,"nodeIndices",{}),E(r,"edgeIndices",{}),E(r,"width",0),E(r,"height",0),E(r,"pixelRatio",si()),E(r,"pickingDownSizingRatio",2*r.pixelRatio),E(r,"displayedNodeLabels",new Set),E(r,"displayedEdgeLabels",new Set),E(r,"highlightedNodes",new Set),E(r,"hoveredNode",null),E(r,"hoveredEdge",null),E(r,"renderFrame",null),E(r,"renderHighlightedNodesFrame",null),E(r,"needToProcess",!1),E(r,"checkEdgesEventsFrame",null),E(r,"nodePrograms",{}),E(r,"nodeHoverPrograms",{}),E(r,"edgePrograms",{}),r.settings=Sa(a),_t(r.settings),wa(t),!(e instanceof HTMLElement))throw new Error("Sigma: container should be an html element.");r.graph=t,r.container=e,r.createWebGLContext("edges",{picking:a.enableEdgeEvents}),r.createCanvasContext("edgeLabels"),r.createWebGLContext("nodes",{picking:!0}),r.createCanvasContext("labels"),r.createCanvasContext("hovers"),r.createWebGLContext("hoverNodes"),r.createCanvasContext("mouse",{style:{touchAction:"none",userSelect:"none"}}),r.resize();for(var o in r.settings.nodeProgramClasses)r.registerNodeProgram(o,r.settings.nodeProgramClasses[o],r.settings.nodeHoverProgramClasses[o]);for(var s in r.settings.edgeProgramClasses)r.registerEdgeProgram(s,r.settings.edgeProgramClasses[s]);return r.camera=new li,r.bindCameraHandlers(),r.mouseCaptor=new xa(r.elements.mouse,r),r.mouseCaptor.setSettings(r.settings),r.touchCaptor=new Ga(r.elements.mouse,r),r.touchCaptor.setSettings(r.settings),r.bindEventHandlers(),r.bindGraphHandlers(),r.handleSettingsUpdate(),r.refresh(),r}return ue(i,n),ee(i,[{key:"registerNodeProgram",value:function(e,r,a){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new r(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(a||r)(this.webGLContexts.hoverNodes,null,this),this}},{key:"registerEdgeProgram",value:function(e,r){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new r(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:"unregisterNodeProgram",value:function(e){if(this.nodePrograms[e]){var r=this.nodePrograms,a=r[e],o=Tt(r,[e].map(je));a.kill(),this.nodePrograms=o}if(this.nodeHoverPrograms[e]){var s=this.nodeHoverPrograms,u=s[e],h=Tt(s,[e].map(je));u.kill(),this.nodePrograms=h}return this}},{key:"unregisterEdgeProgram",value:function(e){if(this.edgePrograms[e]){var r=this.edgePrograms,a=r[e],o=Tt(r,[e].map(je));a.kill(),this.edgePrograms=o}return this}},{key:"resetWebGLTexture",value:function(e){var r=this.webGLContexts[e],a=this.frameBuffers[e],o=this.textures[e];o&&r.deleteTexture(o);var s=r.createTexture();return r.bindFramebuffer(r.FRAMEBUFFER,a),r.bindTexture(r.TEXTURE_2D,s),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,this.width,this.height,0,r.RGBA,r.UNSIGNED_BYTE,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,s,0),this.textures[e]=s,this}},{key:"bindCameraHandlers",value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.activeListeners.camera),this}},{key:"unbindCameraHandlers",value:function(){return this.camera.removeListener("updated",this.activeListeners.camera),this}},{key:"getNodeAtPosition",value:function(e){var r=e.x,a=e.y,o=Xt(this.webGLContexts.nodes,this.frameBuffers.nodes,r,a,this.pixelRatio,this.pickingDownSizingRatio),s=Zt.apply(void 0,ci(o)),u=this.itemIDsIndex[s];return u&&u.type==="node"?u.id:null}},{key:"bindEventHandlers",value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener("resize",this.activeListeners.handleResize),this.activeListeners.handleMove=function(a){var o=Me(a),s={event:o,preventSigmaDefault:function(){o.preventSigmaDefault()}},u=e.getNodeAtPosition(o);if(u&&e.hoveredNode!==u&&!e.nodeDataCache[u].hidden){e.hoveredNode&&e.emit("leaveNode",L(L({},s),{},{node:e.hoveredNode})),e.hoveredNode=u,e.emit("enterNode",L(L({},s),{},{node:u})),e.scheduleHighlightedNodesRender();return}if(e.hoveredNode&&e.getNodeAtPosition(o)!==e.hoveredNode){var h=e.hoveredNode;e.hoveredNode=null,e.emit("leaveNode",L(L({},s),{},{node:h})),e.scheduleHighlightedNodesRender();return}if(e.settings.enableEdgeEvents){var d=e.hoveredNode?null:e.getEdgeAtPoint(s.event.x,s.event.y);d!==e.hoveredEdge&&(e.hoveredEdge&&e.emit("leaveEdge",L(L({},s),{},{edge:e.hoveredEdge})),d&&e.emit("enterEdge",L(L({},s),{},{edge:d})),e.hoveredEdge=d)}},this.activeListeners.handleMoveBody=function(a){var o=Me(a);e.emit("moveBody",{event:o,preventSigmaDefault:function(){o.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(a){var o=Me(a),s={event:o,preventSigmaDefault:function(){o.preventSigmaDefault()}};e.hoveredNode&&(e.emit("leaveNode",L(L({},s),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit("leaveEdge",L(L({},s),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit("leaveStage",L({},s))},this.activeListeners.handleEnter=function(a){var o=Me(a),s={event:o,preventSigmaDefault:function(){o.preventSigmaDefault()}};e.emit("enterStage",L({},s))};var r=function(o){return function(s){var u=Me(s),h={event:u,preventSigmaDefault:function(){u.preventSigmaDefault()}},d=e.getNodeAtPosition(u);if(d)return e.emit("".concat(o,"Node"),L(L({},h),{},{node:d}));if(e.settings.enableEdgeEvents){var l=e.getEdgeAtPoint(u.x,u.y);if(l)return e.emit("".concat(o,"Edge"),L(L({},h),{},{edge:l}))}return e.emit("".concat(o,"Stage"),h)}};return this.activeListeners.handleClick=r("click"),this.activeListeners.handleRightClick=r("rightClick"),this.activeListeners.handleDoubleClick=r("doubleClick"),this.activeListeners.handleWheel=r("wheel"),this.activeListeners.handleDown=r("down"),this.activeListeners.handleUp=r("up"),this.mouseCaptor.on("mousemove",this.activeListeners.handleMove),this.mouseCaptor.on("mousemovebody",this.activeListeners.handleMoveBody),this.mouseCaptor.on("click",this.activeListeners.handleClick),this.mouseCaptor.on("rightClick",this.activeListeners.handleRightClick),this.mouseCaptor.on("doubleClick",this.activeListeners.handleDoubleClick),this.mouseCaptor.on("wheel",this.activeListeners.handleWheel),this.mouseCaptor.on("mousedown",this.activeListeners.handleDown),this.mouseCaptor.on("mouseup",this.activeListeners.handleUp),this.mouseCaptor.on("mouseleave",this.activeListeners.handleLeave),this.mouseCaptor.on("mouseenter",this.activeListeners.handleEnter),this.touchCaptor.on("touchdown",this.activeListeners.handleDown),this.touchCaptor.on("touchdown",this.activeListeners.handleMove),this.touchCaptor.on("touchup",this.activeListeners.handleUp),this.touchCaptor.on("touchmove",this.activeListeners.handleMove),this.touchCaptor.on("tap",this.activeListeners.handleClick),this.touchCaptor.on("doubletap",this.activeListeners.handleDoubleClick),this.touchCaptor.on("touchmove",this.activeListeners.handleMoveBody),this}},{key:"bindGraphHandlers",value:function(){var e=this,r=this.graph,a=new Set(["x","y","zIndex","type"]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(o){var s,u=(s=o.hints)===null||s===void 0?void 0:s.attributes;e.graph.forEachNode(function(d){return e.updateNode(d)});var h=!u||u.some(function(d){return a.has(d)});e.refresh({partialGraph:{nodes:r.nodes()},skipIndexation:!h,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(o){var s,u=(s=o.hints)===null||s===void 0?void 0:s.attributes;e.graph.forEachEdge(function(d){return e.updateEdge(d)});var h=u&&["zIndex","type"].some(function(d){return u==null?void 0:u.includes(d)});e.refresh({partialGraph:{edges:r.edges()},skipIndexation:!h,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(o){var s=o.key;e.addNode(s),e.refresh({partialGraph:{nodes:[s]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(o){var s=o.key;e.refresh({partialGraph:{nodes:[s]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(o){var s=o.key;e.removeNode(s),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(o){var s=o.key;e.addEdge(s),e.refresh({partialGraph:{edges:[s]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(o){var s=o.key;e.refresh({partialGraph:{edges:[s]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(o){var s=o.key;e.removeEdge(s),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},r.on("nodeAdded",this.activeListeners.addNodeGraphUpdate),r.on("nodeDropped",this.activeListeners.dropNodeGraphUpdate),r.on("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),r.on("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),r.on("edgeAdded",this.activeListeners.addEdgeGraphUpdate),r.on("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),r.on("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),r.on("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),r.on("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),r.on("cleared",this.activeListeners.clearGraphUpdate),this}},{key:"unbindGraphHandlers",value:function(){var e=this.graph;e.removeListener("nodeAdded",this.activeListeners.addNodeGraphUpdate),e.removeListener("nodeDropped",this.activeListeners.dropNodeGraphUpdate),e.removeListener("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),e.removeListener("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener("edgeAdded",this.activeListeners.addEdgeGraphUpdate),e.removeListener("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),e.removeListener("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),e.removeListener("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),e.removeListener("cleared",this.activeListeners.clearGraphUpdate)}},{key:"getEdgeAtPoint",value:function(e,r){var a=Xt(this.webGLContexts.edges,this.frameBuffers.edges,e,r,this.pixelRatio,this.pickingDownSizingRatio),o=Zt.apply(void 0,ci(a)),s=this.itemIDsIndex[o];return s&&s.type==="edge"?s.id:null}},{key:"process",value:function(){var e=this;this.emit("beforeProcess");var r=this.graph,a=this.settings,o=this.getDimensions();if(this.nodeExtent=ba(this.graph),!this.settings.autoRescale){var s=o.width,u=o.height,h=this.nodeExtent,d=h.x,l=h.y;this.nodeExtent={x:[(d[0]+d[1])/2-s/2,(d[0]+d[1])/2+s/2],y:[(l[0]+l[1])/2-u/2,(l[0]+l[1])/2+u/2]}}this.normalizationFunction=hi(this.customBBox||this.nodeExtent);var c=new li,g=Be(c.getState(),o,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(o,a.labelGridCellSize);for(var w={},m={},_={},x={},T=1,C=r.nodes(),v=0,y=C.length;v1&&arguments[1]!==void 0?arguments[1]:{},a=r.tolerance,o=a===void 0?0:a,s=r.boundaries,u=L({},e),h=s||this.nodeExtent,d=De(h.x,2),l=d[0],c=d[1],g=De(h.y,2),w=g[0],m=g[1],_=[this.graphToViewport({x:l,y:w},{cameraState:e}),this.graphToViewport({x:c,y:w},{cameraState:e}),this.graphToViewport({x:l,y:m},{cameraState:e}),this.graphToViewport({x:c,y:m},{cameraState:e})],x=1/0,T=-1/0,C=1/0,v=-1/0;_.forEach(function(K){var te=K.x,A=K.y;x=Math.min(x,te),T=Math.max(T,te),C=Math.min(C,A),v=Math.max(v,A)});var y=T-x,S=v-C,R=this.getDimensions(),G=R.width,F=R.height,P=0,V=0;if(y>=G?To&&(P=x-o):T>G+o?P=T-(G+o):x<-o&&(P=x+o),S>=F?vo&&(V=C-o):v>F+o?V=v-(F+o):C<-o&&(V=C+o),P||V){var z=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),f=this.viewportToFramedGraph({x:P,y:V},{cameraState:e});P=f.x-z.x,V=f.y-z.y,u.x+=P,u.y+=V}return u}},{key:"renderLabels",value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),r=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);di(r,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var a=this.canvasContexts.labels,o=0,s=r.length;othis.width+pi||c<-vi||c>this.height+vi)){this.displayedNodeLabels.add(u);var w=this.settings.defaultDrawNodeLabel,m=this.nodePrograms[h.type],_=(m==null?void 0:m.drawLabel)||w;_(a,L(L({key:u},h),{},{size:g,x:l,y:c}),this.settings)}}}return this}},{key:"renderEdgeLabels",value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var r=Oa({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});di(r,this.edgesWithForcedLabels);for(var a=new Set,o=0,s=r.length;othis.nodeZExtent[1]&&(this.nodeZExtent[1]=a.zIndex))}},{key:"updateNode",value:function(e){this.addNode(e);var r=this.nodeDataCache[e];this.normalizationFunction.applyTo(r)}},{key:"removeNode",value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:"addEdge",value:function(e){var r=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(r=this.settings.edgeReducer(e,r));var a=za(this.settings,e,r);this.edgeDataCache[e]=a,this.edgesWithForcedLabels.delete(e),a.forceLabel&&!a.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(a.zIndexthis.edgeZExtent[1]&&(this.edgeZExtent[1]=a.zIndex))}},{key:"updateEdge",value:function(e){this.addEdge(e)}},{key:"removeEdge",value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:"clearNodeIndices",value:function(){this.labelGrid=new gi,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0],this.highlightedNodes=new Set}},{key:"clearEdgeIndices",value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:"clearIndices",value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:"clearNodeState",value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:"clearEdgeState",value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:"clearState",value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:"addNodeToProgram",value:function(e,r,a){var o=this.nodeDataCache[e],s=this.nodePrograms[o.type];if(!s)throw new Error('Sigma: could not find a suitable program for node type "'.concat(o.type,'"!'));s.process(r,a,o),this.nodeProgramIndex[e]=a}},{key:"addEdgeToProgram",value:function(e,r,a){var o=this.edgeDataCache[e],s=this.edgePrograms[o.type];if(!s)throw new Error('Sigma: could not find a suitable program for edge type "'.concat(o.type,'"!'));var u=this.graph.extremities(e),h=this.nodeDataCache[u[0]],d=this.nodeDataCache[u[1]];s.process(r,a,h,d,o),this.edgeProgramIndex[e]=a}},{key:"getRenderParams",value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:"getStagePadding",value:function(){var e=this.settings,r=e.stagePadding,a=e.autoRescale;return a&&r||0}},{key:"createLayer",value:function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[e])throw new Error('Sigma: a layer named "'.concat(e,'" already exists'));var o=Ea(r,{position:"absolute"},{class:"sigma-".concat(e)});return a.style&&Object.assign(o.style,a.style),this.elements[e]=o,"beforeLayer"in a&&a.beforeLayer?this.elements[a.beforeLayer].before(o):"afterLayer"in a&&a.afterLayer?this.elements[a.afterLayer].after(o):this.container.appendChild(o),o}},{key:"createCanvas",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(e,"canvas",r)}},{key:"createCanvasContext",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.createCanvas(e,r),o={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[e]=a.getContext("2d",o),this}},{key:"createWebGLContext",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=(r==null?void 0:r.canvas)||this.createCanvas(e,r);r.hidden&&a.remove();var o=L({preserveDrawingBuffer:!1,antialias:!1},r),s;s=a.getContext("webgl2",o),s||(s=a.getContext("webgl",o)),s||(s=a.getContext("experimental-webgl",o));var u=s;if(this.webGLContexts[e]=u,u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA),r.picking){this.pickingLayers.add(e);var h=u.createFramebuffer();if(!h)throw new Error("Sigma: cannot create a new frame buffer for layer ".concat(e));this.frameBuffers[e]=h}return u}},{key:"killLayer",value:function(e){var r=this.elements[e];if(!r)throw new Error("Sigma: cannot kill layer ".concat(e,", which does not exist"));if(this.webGLContexts[e]){var a,o=this.webGLContexts[e];(a=o.getExtension("WEBGL_lose_context"))===null||a===void 0||a.loseContext(),delete this.webGLContexts[e]}else this.canvasContexts[e]&&delete this.canvasContexts[e];return r.remove(),delete this.elements[e],this}},{key:"getCamera",value:function(){return this.camera}},{key:"setCamera",value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:"getContainer",value:function(){return this.container}},{key:"getGraph",value:function(){return this.graph}},{key:"setGraph",value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:"getMouseCaptor",value:function(){return this.mouseCaptor}},{key:"getTouchCaptor",value:function(){return this.touchCaptor}},{key:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"getGraphDimensions",value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:"getNodeDisplayData",value:function(e){var r=this.nodeDataCache[e];return r?Object.assign({},r):void 0}},{key:"getEdgeDisplayData",value:function(e){var r=this.edgeDataCache[e];return r?Object.assign({},r):void 0}},{key:"getNodeDisplayedLabels",value:function(){return new Set(this.displayedNodeLabels)}},{key:"getEdgeDisplayedLabels",value:function(){return new Set(this.displayedEdgeLabels)}},{key:"getSettings",value:function(){return L({},this.settings)}},{key:"getSetting",value:function(e){return this.settings[e]}},{key:"setSetting",value:function(e,r){var a=L({},this.settings);return this.settings[e]=r,_t(this.settings),this.handleSettingsUpdate(a),this.scheduleRefresh(),this}},{key:"updateSetting",value:function(e,r){return this.setSetting(e,r(this.settings[e])),this}},{key:"setSettings",value:function(e){var r=L({},this.settings);return this.settings=L(L({},this.settings),e),_t(this.settings),this.handleSettingsUpdate(r),this.scheduleRefresh(),this}},{key:"resize",value:function(e){var r=this.width,a=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=si(),this.width===0)if(this.settings.allowInvalidContainer)this.width=1;else throw new Error("Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(this.height===0)if(this.settings.allowInvalidContainer)this.height=1;else throw new Error("Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(!e&&r===this.width&&a===this.height)return this;for(var o in this.elements){var s=this.elements[o];s.style.width=this.width+"px",s.style.height=this.height+"px"}for(var u in this.canvasContexts)this.elements[u].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[u].setAttribute("height",this.height*this.pixelRatio+"px"),this.pixelRatio!==1&&this.canvasContexts[u].scale(this.pixelRatio,this.pixelRatio);for(var h in this.webGLContexts){this.elements[h].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[h].setAttribute("height",this.height*this.pixelRatio+"px");var d=this.webGLContexts[h];if(d.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(h)){var l=this.textures[h];l&&d.deleteTexture(l)}}return this.emit("resize"),this}},{key:"clear",value:function(){return this.emit("beforeClear"),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit("afterClear"),this}},{key:"refresh",value:function(e){var r=this,a=(e==null?void 0:e.skipIndexation)!==void 0?e==null?void 0:e.skipIndexation:!1,o=(e==null?void 0:e.schedule)!==void 0?e.schedule:!1,s=!e||!e.partialGraph;if(s)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(v){return r.addNode(v)}),this.graph.forEachEdge(function(v){return r.addEdge(v)});else{for(var u,h,d=((u=e.partialGraph)===null||u===void 0?void 0:u.nodes)||[],l=0,c=(d==null?void 0:d.length)||0;l1&&arguments[1]!==void 0?arguments[1]:{},a=!!r.cameraState||!!r.viewportDimensions||!!r.graphDimensions,o=r.matrix?r.matrix:a?Be(r.cameraState||this.camera.getState(),r.viewportDimensions||this.getDimensions(),r.graphDimensions||this.getGraphDimensions(),r.padding||this.getStagePadding()):this.matrix,s=kt(o,e);return{x:(1+s.x)*this.width/2,y:(1-s.y)*this.height/2}}},{key:"viewportToFramedGraph",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=!!r.cameraState||!!r.viewportDimensions||!r.graphDimensions,o=r.matrix?r.matrix:a?Be(r.cameraState||this.camera.getState(),r.viewportDimensions||this.getDimensions(),r.graphDimensions||this.getGraphDimensions(),r.padding||this.getStagePadding(),!0):this.invMatrix,s=kt(o,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(s.x)&&(s.x=0),isNaN(s.y)&&(s.y=0),s}},{key:"viewportToGraph",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,r))}},{key:"graphToViewport",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),r)}},{key:"getGraphToViewportRatio",value:function(){var e={x:0,y:0},r={x:1,y:1},a=Math.sqrt(Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2)),o=this.graphToViewport(e),s=this.graphToViewport(r),u=Math.sqrt(Math.pow(o.x-s.x,2)+Math.pow(o.y-s.y,2));return u/a}},{key:"getBBox",value:function(){return this.nodeExtent}},{key:"getCustomBBox",value:function(){return this.customBBox}},{key:"setCustomBBox",value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:"kill",value:function(){this.emit("kill"),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener("resize",this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var r in this.nodePrograms)this.nodePrograms[r].kill();for(var a in this.nodeHoverPrograms)this.nodeHoverPrograms[a].kill();for(var o in this.edgePrograms)this.edgePrograms[o].kill();this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={};for(var s in this.elements)this.killLayer(s);this.canvasContexts={},this.webGLContexts={},this.elements={}}},{key:"scaleSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(r)*(this.getSetting("itemSizesReference")==="positions"?r*this.graphToViewportRatio:1)}},{key:"getCanvases",value:function(){var e={};for(var r in this.elements)this.elements[r]instanceof HTMLCanvasElement&&(e[r]=this.elements[r]);return e}}])})(Pt),Ba=$a;const We={identity:"#22d3ee",knowledge:"#6366f1",rules:"#a78bfa",events:"#fbbf24"},mi={identity:"Identität",knowledge:"Wissen",rules:"Regeln",events:"Ereignisse"},St=new Set(["auto","agent","hermes"]),Ma="#1f2937",Ha="#0f172a",yi="#243044",Wa="#4b5563";function Va({data:n,onDelete:i}){const[t,e]=ce.useState(null),r=ce.useRef(null),a=ce.useRef(null),o=ce.useRef(null),s=ce.useRef(null),u=ce.useRef(null),h=ce.useMemo(()=>{const c={};return n.edges.forEach(g=>{c[g.source]=(c[g.source]||0)+1,c[g.target]=(c[g.target]||0)+1}),c},[n]);ce.useEffect(()=>{if(!r.current||!n.nodes.length)return;const c=new j,g=n.nodes.length;n.nodes.forEach((m,_)=>{const x=2*Math.PI*_/g;c.addNode(m.id,{x:Math.cos(x),y:Math.sin(x),size:4+Math.min(h[m.id]||0,12)*1.4,color:We[m.category]||"#64748b",label:m.content.length>48?m.content.slice(0,47)+"…":m.content})}),n.edges.forEach(m=>{c.hasNode(m.source)&&c.hasNode(m.target)&&!c.hasEdge(m.source,m.target)&&c.addEdge(m.source,m.target,{size:.6+(m.weight||0),color:yi})}),Kt.assign(c,{iterations:220,settings:Kt.inferSettings(c)}),o.current=c;const w=new Ba(c,r.current,{renderLabels:!0,labelColor:{color:"#cbd5e1"},labelSize:11,labelWeight:"500",labelDensity:.6,labelRenderedSizeThreshold:g>120?12:0,defaultEdgeColor:yi,minCameraRatio:.1,maxCameraRatio:4,nodeReducer:(m,_)=>{const x=s.current;return!x||m===x||c.areNeighbors(x,m)?_:{..._,color:Ma,label:""}},edgeReducer:(m,_)=>{const x=s.current;if(!x)return _;const T=c.extremities(m);return T[0]===x||T[1]===x?{..._,color:Wa,size:(_.size||1)*1.6}:{..._,color:Ha}}});return a.current=w,w.on("clickNode",({node:m})=>e(m)),w.on("clickStage",()=>e(null)),w.on("enterNode",({node:m})=>{s.current=m,w.refresh(),r.current.style.cursor="pointer"}),w.on("leaveNode",()=>{s.current=u.current,w.refresh(),r.current.style.cursor="default"}),()=>{w.kill(),a.current=null,o.current=null}},[n,h]),ce.useEffect(()=>{var c;u.current=t,s.current=t,(c=a.current)==null||c.refresh()},[t]);const d=t?n.nodes.find(c=>c.id===t)??null:null,l=ce.useMemo(()=>{if(!t)return[];const c=new Set;return n.edges.forEach(g=>{g.source===t&&c.add(g.target),g.target===t&&c.add(g.source)}),n.nodes.filter(g=>c.has(g.id))},[t,n]);return n.nodes.length?W.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_280px] gap-3",children:[W.jsxs("div",{className:"relative h-[480px] rounded-2xl border border-border/60 bg-[#070a0f] overflow-hidden",children:[W.jsx("div",{ref:r,className:"absolute inset-0"}),W.jsx("div",{className:"absolute left-3 bottom-3 flex flex-wrap gap-2 rounded-lg bg-background/40 px-2.5 py-1.5 backdrop-blur-sm",children:Object.entries(mi).map(([c,g])=>W.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[W.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:We[c]}}),g]},c))})]}),W.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 min-h-[480px]",children:d?W.jsxs(W.Fragment,{children:[W.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[W.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:We[d.category],boxShadow:`0 0 0 2px ${St.has(d.source)?"#34d399":"#475569"}`}}),W.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:We[d.category]},children:mi[d.category]||d.category}),W.jsxs("span",{className:`ml-auto text-[10px] font-mono flex items-center gap-1 ${St.has(d.source)?"text-emerald-400":"text-muted-foreground/70"}`,children:[St.has(d.source)&&W.jsx(rr,{className:"h-2.5 w-2.5"}),d.source]})]}),W.jsx("div",{className:"text-sm text-foreground leading-relaxed mb-4 break-words",children:d.content}),W.jsxs("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70 mb-2 flex items-center gap-1",children:[W.jsx(Ot,{className:"h-3 w-3"})," verwandte Fakten"]}),W.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:l.length?l.map(c=>W.jsxs("button",{onClick:()=>e(c.id),className:"flex items-center gap-2 text-[11px] text-muted-foreground hover:text-foreground text-left transition-colors",children:[W.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:We[c.category]}}),W.jsx("span",{className:"truncate",children:c.content})]},c.id)):W.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"—"})}),W.jsxs("button",{onClick:()=>{i(d.id),e(null)},className:"flex items-center gap-1.5 text-[11px] text-red-400 border border-red-500/20 rounded-lg px-2.5 py-1.5 hover:bg-red-500/5 transition-all",children:[W.jsx(nr,{className:"h-3.5 w-3.5"})," vergessen"]})]}):W.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center text-muted-foreground/70 gap-2 pt-24",children:[W.jsx(Ot,{className:"h-6 w-6"}),W.jsx("div",{className:"text-xs max-w-[180px] leading-relaxed",children:"Auf einen Knoten klicken, um den Fakt und seine semantischen Nachbarn zu sehen. Hover hebt das Netz hervor."})]})})]}):W.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Noch keine Fakten — der Graph füllt sich, sobald Hermes lernt oder du Einträge anlegst."})}export{Va as GraphView}; diff --git a/frontend/dist/assets/GraphView-VftfPdeY.js b/frontend/dist/assets/GraphView-VftfPdeY.js deleted file mode 100644 index 5da8edd..0000000 --- a/frontend/dist/assets/GraphView-VftfPdeY.js +++ /dev/null @@ -1,3922 +0,0 @@ -import{R as Fh,B as Ww,a as Xw,V as _n,F as qw,r as Iy,g as ki,b as q,c as go,d as Yw,e as jw,_ as Tc,u as $w,j as Zw,f as Kw,h as Se,l as Jw,S as Qw,i as Cg,T as eS}from"./index-Qs-v42ar.js";const tS=r=>typeof r=="object"&&typeof r.then=="function",Zc=[];function nS(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:n.equal,remove:()=>{const s=Zc.indexOf(i);s!==-1&&Zc.splice(s,1)},promise:(tS(r)?r:r(...e)).then(s=>{i.response=s,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(s=>i.error=s)};if(Zc.push(i),!t)throw i.promise}const rS=(r,e,t)=>iS(r,e,!1,t);function sS(r,e,t){return Math.max(e,Math.min(r,t))}const Tt={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function Rg(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function Pg(r,e,t,n=.15){return n===0?sS(r,e,t):rt?+Rg(r-t,t-e,n)+t:r}function oS(r,[e,t],[n,i]){const[[s,o],[a,c]]=r;return[Pg(e,s,o,n),Pg(t,a,c,i)]}function aS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function cS(r){var e=aS(r,"string");return typeof e=="symbol"?e:String(e)}function $t(r,e,t){return e=cS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lg(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ut(r){for(var e=1;e{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function gS(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function Ny(r){return Du(r)?gS(r)[0]:r}function Pd(r,e){try{const t=e.clientX-r.clientX,n=e.clientY-r.clientY,i=(e.clientX+r.clientX)/2,s=(e.clientY+r.clientY)/2,o=Math.hypot(t,n);return{angle:-(Math.atan2(t,n)*180)/Math.PI,distance:o,origin:[i,s]}}catch{}return null}function vS(r){return mS(r).map(e=>e.identifier)}function Ig(r,e){const[t,n]=Array.from(r.touches).filter(i=>e.includes(i.identifier));return Pd(t,n)}function kh(r){const e=Ny(r);return Du(r)?e.identifier:e.pointerId}function To(r){const e=Ny(r);return[e.clientX,e.clientY]}const Ug=40,Og=800;function Fy(r){let{deltaX:e,deltaY:t,deltaMode:n}=r;return n===1?(e*=Ug,t*=Ug):n===2&&(e*=Og,t*=Og),[e,t]}function _S(r){var e,t;const{scrollX:n,scrollY:i,scrollLeft:s,scrollTop:o}=r.currentTarget;return[(e=n??s)!==null&&e!==void 0?e:0,(t=i??o)!==null&&t!==void 0?t:0]}function yS(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s})}return e}function gu(r,...e){return typeof r=="function"?r(...e):r}function xS(){}function bS(...r){return r.length===0?xS:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function Ng(r,e){return Object.assign({},e,r||{})}const wS=32;class ky{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?gu(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let s=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,yS(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,s=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const w=t._delta.map(Math.abs);Tt.addTo(t._distance,w)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[c,l]=n.threshold,{_step:u,values:h}=t;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(o)>=c&&h[0]),u[1]===!1&&(u[1]=Math.abs(a)>=l&&h[1])):(u[0]===!1&&(u[0]=Math.abs(o)>=c&&Math.sign(o)*c),u[1]===!1&&(u[1]=Math.abs(a)>=l&&Math.sign(a)*l)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const f=[0,0];if(n.hasCustomTransform){const[w,S]=h;f[0]=u[0]!==!1?w-u[0]:0,f[1]=u[1]!==!1?S-u[1]:0}else f[0]=u[0]!==!1?o-u[0]:0,f[1]=u[1]!==!1?a-u[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(f);const d=t.offset,m=t._active&&!t._blocked||t.active;m&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=gu(n.bounds,t)),this.setup&&this.setup()),t.movement=f,this.computeOffset()));const[v,g]=t.offset,[[p,_],[y,x]]=t._bounds;t.overflow=[v_?1:0,gx?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const b=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=oS(t._bounds,t.offset,b),t.delta=Tt.sub(t.offset,d),this.computeMovement(),m&&(!t.last||s>wS)){t.delta=Tt.sub(t.offset,d);const w=t.delta.map(Math.abs);Tt.addTo(t.distance,w),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[w[0]/s,w[1]/s],t.timeDelta=s)}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(Ut(Ut(Ut({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function SS([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class Ac extends ky{constructor(...e){super(...e),$t(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=Tt.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Tt.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Oy(e)]:n.axisThreshold;t.axis=SS(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const ES=r=>r,Fg=.15,zy={enabled(r=!0){return r},eventOptions(r,e,t){return Ut(Ut({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[Fg,Fg];case!1:return[0,0];default:return Tt.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return Tt.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;return this.hasCustomTransform=!!n,n||ES},threshold(r){return Tt.toVector(r,0)}},MS=0,Es=Ut(Ut({},zy),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=MS){return r},bounds(r={}){if(typeof r=="function")return s=>Es.bounds(r(s));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),kg={ArrowRight:(r,e=1)=>[r*e,0],ArrowLeft:(r,e=1)=>[-1*r*e,0],ArrowUp:(r,e=1)=>[0,-1*r*e],ArrowDown:(r,e=1)=>[0,r*e]};class TS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=Es.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=kh(e),n._pointerActive=!0,this.computeValues(To(e)),this.computeInitial(),t.preventScrollAxis&&Oy(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=To(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=Tt.sub(s,t._values),this.computeValues(s)),Tt.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,o]=t._distance;if(t.tap=s<=n.tapsThreshold&&o<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[a,c]=t._delta,[l,u]=t._movement,[h,f]=n.swipe.velocity,[d,m]=n.swipe.distance,v=n.swipe.duration;if(t.elapsedTimeh&&Math.abs(l)>d&&(t.swipe[0]=Math.sign(a)),p>f&&Math.abs(u)>m&&(t.swipe[1]=Math.sign(c))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,AS(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=kg[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,i),n._keyboardActive=!0,Tt.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in kg&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function AS(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const Cc=typeof window<"u"&&window.document&&window.document.createElement;function By(){return Cc&&"ontouchstart"in window}function CS(){return By()||Cc&&window.navigator.maxTouchPoints>1}function RS(){return Cc&&"onpointerdown"in window}function PS(){return Cc&&"exitPointerLock"in window.document}function LS(){try{return"constructor"in GestureEvent}catch{return!1}}const Qn={isBrowser:Cc,gesture:LS(),touch:By(),touchscreen:CS(),pointer:RS(),pointerLock:PS()},DS=250,IS=180,US=.5,OS=50,NS=250,FS=10,zg={mouse:0,touch:0,pen:8},kS=Ut(Ut({},Es),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&Qn.pointerLock,Qn.touch&&t?"touch":this.pointerLock?"mouse":Qn.pointer&&!i?"pointer":Qn.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?DS:void 0,!(!Qn.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const s=Tt.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,s},swipe({velocity:r=US,distance:e=OS,duration:t=NS}={}){return{velocity:this.transform(Tt.toVector(r)),distance:this.transform(Tt.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return IS;case!1:return 0;default:return r}},axisThreshold(r){return r?Ut(Ut({},zg),r):zg},keyboardDisplacement(r=FS){return r}});function Gy(r){const[e,t]=r.overflow,[n,i]=r._delta,[s,o]=r._direction;(e<0&&n>0&&s<0||e>0&&n<0&&s>0)&&(r._movement[0]=r._movementBound[0]),(t<0&&i>0&&o<0||t>0&&i<0&&o>0)&&(r._movement[1]=r._movementBound[1])}const zS=30,BS=100;class GS extends ky{constructor(...e){super(...e),$t(this,"ingKey","pinching"),$t(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:n}=this.state;e==="wheel"?this.state.offset=Tt.add(t,n):this.state.offset=[(1+t[0])*n[0],t[1]+n[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,n]=e._movement;if(!e.axis){const i=Math.abs(t)*zS-Math.abs(n);i<0?e.axis="angle":i>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,n=this.ctrl.touchIds;if(t._active&&t._touchIds.every(s=>n.has(s))||n.size<2)return;this.start(e),t._touchIds=Array.from(n).slice(0,2);const i=Ig(e,t._touchIds);i&&this.pinchStart(e,i)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,n=t._pointerEvents,i=this.ctrl.pointerIds;if(t._active&&Array.from(n.keys()).every(o=>i.has(o))||(n.size<2&&n.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const s=Pd(...Array.from(n.values()));s&&this.pinchStart(e,s)}pinchStart(e,t){const n=this.state;n.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=Ig(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const n=Pd(...Array.from(t.values()));n&&this.pinchMove(e,n)}pinchMove(e,t){const n=this.state,i=n._values[1],s=t.angle-i;let o=0;Math.abs(s)>270&&(o+=Math.sign(s)),this.computeValues([t.distance,t.angle-360*o]),n.origin=t.origin,n.turns=o,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(t=>!this.ctrl.touchIds.has(t))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const n=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=Tt.sub(t._movement,n),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&(Array.isArray(t)?!t.find(n=>e[n]):!e[t])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const n=this.state;n._delta=[-Fy(e)[1]/BS*n.offset[0],0],Tt.addTo(n._movement,n._delta),Gy(n),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}}const VS=Ut(Ut({},zy),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!Qn.touch&&Qn.gesture)return"gesture";if(Qn.touch&&n)return"touch";if(Qn.touchscreen){if(Qn.pointer)return"pointer";if(Qn.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=o=>{const a=Ng(gu(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=Ng(gu(n,o),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof t!="function"&&typeof n!="function"?[i(),s()]:o=>[i(o),s(o)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",Tt.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r},pinchOnWheel(r=!0){return r}});class HS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","moving")}move(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(To(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;const t=To(e),n=this.state;n._delta=Tt.sub(t,n._values),Tt.addTo(n._movement,n._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}const WS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r});class XS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();const t=this.state,n=_S(e);t._delta=Tt.sub(n,t._values),Tt.addTo(t._movement,t._delta),this.computeValues(n),this.compute(e),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}const qS=Es;class YS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=Fy(e),Tt.addTo(t._movement,t._delta),Gy(t),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const jS=Es;class $S extends Ac{constructor(...e){super(...e),$t(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.start(e),this.computeValues(To(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&e.pointerType!=="mouse")return;const t=this.state;if(!t._active)return;t._active=!1;const n=To(e);t._movement=t._delta=Tt.sub(n,t._values),this.computeValues(n),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}const ZS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r}),Gp=new Map,Ld=new Map;function KS(r){Gp.set(r.key,r.engine),Ld.set(r.key,r.resolver)}const JS={key:"drag",engine:TS,resolver:kS},QS={key:"hover",engine:$S,resolver:ZS},eE={key:"move",engine:HS,resolver:WS},tE={key:"pinch",engine:GS,resolver:VS},nE={key:"scroll",engine:XS,resolver:qS},iE={key:"wheel",engine:YS,resolver:jS};function rE(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s=0)&&(t[i]=r[i]);return t}function sE(r,e){if(r==null)return{};var t=rE(r,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const oE={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=Qn.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},aE=["target","eventOptions","window","enabled","transform"];function nu(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=nu(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function cE(r,e,t={}){const n=r,{target:i,eventOptions:s,window:o,enabled:a,transform:c}=n,l=sE(n,aE);if(t.shared=nu({target:i,eventOptions:s,window:o,enabled:a,transform:c},oE),e){const u=Ld.get(e);t[e]=nu(Ut({shared:t.shared},l),u)}else for(const u in l){const h=Ld.get(u);h&&(t[u]=nu(Ut({shared:t.shared},l[u]),h))}return t}class Vy{constructor(e,t){$t(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,s){const o=this._listeners,a=pS(t,n),c=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},l=Ut(Ut({},c),s);e.addEventListener(a,i,l);const u=()=>{e.removeEventListener(a,i,l),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class lE{constructor(){$t(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}let uE=class{constructor(e){$t(this,"gestures",new Set),$t(this,"_targetEventStore",new Vy(this)),$t(this,"gestureEventStores",{}),$t(this,"gestureTimeoutStores",{}),$t(this,"handlers",{}),$t(this,"config",{}),$t(this,"pointerIds",new Set),$t(this,"touchIds",new Set),$t(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),hE(this,e)}setEventIds(e){if(Du(e))return this.touchIds=new Set(vS(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=cE(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const o of this.gestures){const a=this.config[o],c=Bg(n,a.eventOptions,!!i);if(a.enabled){const l=Gp.get(o);new l(this,e,o).bind(c)}}const s=Bg(n,t.eventOptions,!!i);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](Ut(Ut({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in n)n[s]=bS(...n[s]);if(!i)return n;for(const s in n){const{device:o,capture:a,passive:c}=dS(s);this._targetEventStore.add(i,o,"",n[s],{capture:a,passive:c})}}}};function Ds(r,e){r.gestures.add(e),r.gestureEventStores[e]=new Vy(r,e),r.gestureTimeoutStores[e]=new lE}function hE(r,e){e.drag&&Ds(r,"drag"),e.wheel&&Ds(r,"wheel"),e.scroll&&Ds(r,"scroll"),e.move&&Ds(r,"move"),e.pinch&&Ds(r,"pinch"),e.hover&&Ds(r,"hover")}const Bg=(r,e,t)=>(n,i,s,o={},a=!1)=>{var c,l;const u=(c=o.capture)!==null&&c!==void 0?c:e.capture,h=(l=o.passive)!==null&&l!==void 0?l:e.passive;let f=a?n:hS(n,i,u);t&&h&&(f+="Passive"),r[f]=r[f]||[],r[f].push(s)},fE=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function dE(r){const e={},t={},n=new Set;for(let i in r)fE.test(i)?(n.add(RegExp.lastMatch),t[i]=r[i]):e[i]=r[i];return[t,e,n]}function Is(r,e,t,n,i,s){if(!r.has(t)||!Gp.has(n))return;const o=t+"Start",a=t+"End",c=l=>{let u;return l.first&&o in e&&e[o](l),t in e&&(u=e[t](l)),l.last&&a in e&&e[a](l),u};i[n]=c,s[n]=s[n]||{}}function pE(r,e){const[t,n,i]=dE(r),s={};return Is(i,t,"onDrag","drag",s,e),Is(i,t,"onWheel","wheel",s,e),Is(i,t,"onScroll","scroll",s,e),Is(i,t,"onPinch","pinch",s,e),Is(i,t,"onMove","move",s,e),Is(i,t,"onHover","hover",s,e),{handlers:s,config:e,nativeHandlers:n}}function mE(r,e={},t,n){const i=Fh.useMemo(()=>new uE(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),Fh.useEffect(i.effect.bind(i)),Fh.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function gE(r){return r.forEach(KS),function(t,n){const{handlers:i,nativeHandlers:s,config:o}=pE(t,n||{});return mE(i,o,void 0,s)}}function vE(r,e){return gE([JS,tE,nE,iE,eE,QS])(r,e||{})}const Kc=(r,e)=>{const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,c=new Ww;let l=0;if(r.forEach((u,h)=>{let f=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in u.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(u.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in u.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(u.morphAttributes[d])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(u.userData),e){let d;if(u.index)d=u.index.count;else if(u.attributes.position!==void 0)d=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,d,h),l+=d}}),t){let u=0;const h=[];r.forEach(f=>{const d=f.index;for(let m=0;m{let e,t,n,i=0;if(r.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}),e&&t){const s=new e(i);let o=0;return r.forEach(a=>{s.set(a.array,o),o+=a.array.length}),new Xw(s,t,n)}},zh=new qw,Bh=new _n,Us=new _n,ci=new _n,Gi=new _n,Ti=new _n,Vi=new _n,Hi=new _n,Jo=new _n,Qo=new _n,ea=new _n,Jc=new _n,ta=new _n,na=new _n,ia=new _n;class Vg{constructor(e,t,n){this.camera=e,this.scene=t,this.startPoint=new _n,this.endPoint=new _n,this.collection=[],this.deep=n||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(zh,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){Us.copy(e),Us.x=Math.min(e.x,t.x),Us.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),ci.setFromMatrixPosition(this.camera.matrixWorld),Gi.copy(Us),Ti.set(t.x,Us.y,0),Vi.copy(t),Hi.set(Us.x,t.y,0),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),ta.copy(Gi).sub(ci),na.copy(Ti).sub(ci),ia.copy(Vi).sub(ci),ta.normalize(),na.normalize(),ia.normalize(),ta.multiplyScalar(this.deep),na.multiplyScalar(this.deep),ia.multiplyScalar(this.deep),ta.add(ci),na.add(ci),ia.add(ci);var n=zh.planes;n[0].setFromCoplanarPoints(ci,Gi,Ti),n[1].setFromCoplanarPoints(ci,Ti,Vi),n[2].setFromCoplanarPoints(Vi,Hi,ci),n[3].setFromCoplanarPoints(Hi,Gi,ci),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ia,na,ta),n[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const i=Math.min(e.x,t.x),s=Math.max(e.y,t.y),o=Math.max(e.x,t.x),a=Math.min(e.y,t.y);Gi.set(i,s,-1),Ti.set(o,s,-1),Vi.set(o,a,-1),Hi.set(i,a,-1),Jo.set(i,s,1),Qo.set(o,s,1),ea.set(o,a,1),Jc.set(i,a,1),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),Jo.unproject(this.camera),Qo.unproject(this.camera),ea.unproject(this.camera),Jc.unproject(this.camera);var n=zh.planes;n[0].setFromCoplanarPoints(Gi,Jo,Qo),n[1].setFromCoplanarPoints(Ti,Qo,ea),n[2].setFromCoplanarPoints(ea,Jc,Hi),n[3].setFromCoplanarPoints(Jc,Jo,Gi),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ea,Qo,Jo),n[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),Bh.copy(t.geometry.boundingSphere.center),Bh.applyMatrix4(t.matrixWorld),e.containsPoint(Bh)&&this.collection.push(t)),t.children.length>0)for(let n=0;n0;)de[pe]=arguments[pe+2];var Me=xe[he]||(xe[he]=R.getUniformLocation(ce,he));R["uniform"+$].apply(R,[Me].concat(de))},setAttribute:function($,he,de,pe,Me){var we=fe[$];we||(we=fe[$]={buf:R.createBuffer(),loc:R.getAttribLocation(ce,$),data:null}),R.bindBuffer(R.ARRAY_BUFFER,we.buf),R.vertexAttribPointer(we.loc,he,R.FLOAT,!1,0,0),R.enableVertexAttribArray(we.loc),H?R.vertexAttribDivisor(we.loc,pe):ge("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(we.loc,pe),Me!==we.data&&(R.bufferData(R.ARRAY_BUFFER,Me,de),we.data=Me)}})}}}J[K].transaction(re)},D=function(K,W){ne++;try{R.activeTexture(R.TEXTURE0+ne);var ye=ie[K];ye||(ye=ie[K]=R.createTexture(),R.bindTexture(R.TEXTURE_2D,ye),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.NEAREST),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MAG_FILTER,R.NEAREST)),R.bindTexture(R.TEXTURE_2D,ye),W(ye,ne)}finally{ne--}},Q=function(K,W,ye){var re=R.createFramebuffer();ee.push(re),R.bindFramebuffer(R.FRAMEBUFFER,re),R.activeTexture(R.TEXTURE0+W),R.bindTexture(R.TEXTURE_2D,K),R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,K,0);try{ye(re)}finally{R.deleteFramebuffer(re),R.bindFramebuffer(R.FRAMEBUFFER,ee[--ee.length-1]||null)}},j=function(){Y={},J={},ie={},ne=-1,ee.length=0};var H=typeof WebGL2RenderingContext<"u"&&R instanceof WebGL2RenderingContext,Y={},J={},ie={},ne=-1,ee=[];R.canvas.addEventListener("webglcontextlost",function(K){j(),K.preventDefault()},!1),c.set(R,F={gl:R,isWebGL2:H,getExtension:ge,withProgram:te,withTexture:D,withTextureFramebuffer:Q,handleContextLoss:j})}U(F)}function h(k,U,R,F,H,Y,J,ie){J===void 0&&(J=15),ie===void 0&&(ie=null),u(k,function(ne){var ee=ne.gl,ge=ne.withProgram,me=ne.withTexture;me("copy",function(te,D){ee.texImage2D(ee.TEXTURE_2D,0,ee.RGBA,H,Y,0,ee.RGBA,ee.UNSIGNED_BYTE,U),ge("copy",o,a,function(Q){var j=Q.setUniform,K=Q.setAttribute;K("aUV",2,ee.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),j("1i","image",D),ee.bindFramebuffer(ee.FRAMEBUFFER,ie||null),ee.disable(ee.BLEND),ee.colorMask(J&8,J&4,J&2,J&1),ee.viewport(R,F,H,Y),ee.scissor(R,F,H,Y),ee.drawArrays(ee.TRIANGLES,0,3)})})})}function f(k,U,R){var F=k.width,H=k.height;u(k,function(Y){var J=Y.gl,ie=new Uint8Array(F*H*4);J.readPixels(0,0,F,H,J.RGBA,J.UNSIGNED_BYTE,ie),k.width=U,k.height=R,h(J,ie,0,0,F,H)})}var d=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:h,resizeWebGLCanvasWithoutClearing:f});function m(k,U,R,F,H,Y){Y===void 0&&(Y=1);var J=new Uint8Array(k*U),ie=F[2]-F[0],ne=F[3]-F[1],ee=[];s(R,function(K,W,ye,re){ee.push({x1:K,y1:W,x2:ye,y2:re,minX:Math.min(K,ye),minY:Math.min(W,re),maxX:Math.max(K,ye),maxY:Math.max(W,re)})}),ee.sort(function(K,W){return K.maxX-W.maxX});for(var ge=0;gexe.minX&&W-rexe.minY){var ce=p(K,W,xe.x1,xe.y1,xe.x2,xe.y2);ceW!=fe.y2>W&&K<(fe.x2-fe.x1)*(W-fe.y1)/(fe.y2-fe.y1)+fe.x1;xe&&(ye+=fe.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function v(re,fe){var xe=36,ce=0,Pe=new Map,B=fe&&new Map,I;return re.split(",").forEach(function $(he){if(he.indexOf("+")!==-1)for(var de=+he;de--;)$(I);else{I=he;var pe=he.split(">"),Me=pe[0],we=pe[1];Me=String.fromCodePoint(ce+=parseInt(Me,xe)),we=String.fromCodePoint(ce+=parseInt(we,xe)),Pe.set(Me,we),fe&&B.set(we,Me)}}),{map:Pe,reverseMap:B}}var g,p,_;function y(){if(!g){var re=v(m.pairs,!0),fe=re.map,xe=re.reverseMap;g=fe,p=xe,_=v(m.canonical,!1).map}}function x(re){return y(),g.get(re)||null}function b(re){return y(),p.get(re)||null}function w(re){return y(),_.get(re)||null}var S=n.L,M=n.R,E=n.EN,T=n.ES,L=n.ET,P=n.AN,A=n.CS,z=n.B,V=n.S,N=n.ON,C=n.BN,O=n.NSM,k=n.AL,U=n.LRO,R=n.RLO,F=n.LRE,H=n.RLE,Y=n.PDF,J=n.LRI,ie=n.RLI,ne=n.FSI,ee=n.PDI;function ge(re,fe){for(var xe=125,ce=new Uint32Array(re.length),Pe=0;Pe0)De--;else if(je>0){for(Ve=0;!Le[Le.length-1]._isolate;)Le.pop();var tt=Le[Le.length-1]._isolInitIndex;tt!=null&&(he.set(tt,Z),he.set(Z,tt)),Le.pop(),je--}Ee=Le[Le.length-1],$[Z]=Ee._level,Ee._override&&I(Z,Ee._override)}else Ae&Y?(De===0&&(Ve>0?Ve--:!Ee._isolate&&Le.length>1&&(Le.pop(),Ee=Le[Le.length-1])),$[Z]=Ee._level):Ae&z&&($[Z]=pe.level);else $[Z]=Ee._level,Ee._override&&Ae!==C&&I(Z,Ee._override)}for(var lt=[],ft=null,ut=pe.start;ut<=pe.end;ut++){var xt=ce[ut];if(!(xt&c)){var dt=$[ut],ct=xt&s,Mn=xt===ee;ft&&dt===ft._level?(ft._end=ut,ft._endsWithIsolInit=ct):lt.push(ft={_start:ut,_end:ut,_level:dt,_startsWithPDI:Mn,_endsWithIsolInit:ct})}}for(var fn=[],yt=0;yt=0;se--)if(!(ce[se]&c)){ve=$[se];break}var _e=sn[sn.length-1],Ge=$[_e],We=pe.level;if(!(ce[_e]&s)){for(var qe=_e+1;qe<=pe.end;qe++)if(!(ce[qe]&c)){We=$[qe];break}}fn.push({_seqIndices:sn,_sosType:Math.max(ve,ae)%2?M:S,_eosType:Math.max(We,Ge)%2?M:S})}}for(var Ye=0;Ye=0;at--)if(!(ce[Te[at]]&c)){Ct=ce[Te[at]];break}I(Xn,Ct&(s|ee)?N:Ct)}}if(B.get(E))for(var fr=0;fr=-1;qn--){var Vo=qn===-1?Ze:ce[Te[qn]];if(Vo&o){Vo===k&&I(Wt,P);break}}}if(B.get(k))for(var Bi=0;Bi=0&&(Mi=ce[Te[zr]],!!(Mi&c));zr--);for(var Ho=Xt+1;Ho=0&&ce[Te[Hc]]&(L|c);Hc--)I(Te[Hc],E);for(On++;On=0&&ce[Te[Wc]]&c;Wc--)I(Te[Wc],N);for(var Xc=Wo+1;Xc=0;Yo--){var Rh=Ps[Yo].char;if(Rh===vg||Rh===b(w(qo))||x(w(Rh))===qo){qc.push([Ps[Yo].seqIndex,Ls]),Ps.length=Yo;break}}}qc.sort(function(Tn,ai){return Tn[0]-ai[0]})}for(var Ph=0;Ph=0;Ih--){var wg=Te[Ih];if(ce[wg]&gg){var Sg=ce[wg]&Xo?M:S;Sg!==bt?oi=Sg:oi=bt;break}}}if(oi){if(ce[Te[Yc]]=ce[Te[Lh]]=oi,oi!==bt){for(var jo=Yc+1;jo=0;Zo--)if(ce[Te[Zo]]&c)Eg=Zo;else{Oh=ce[Te[Zo]]&Xo?M:S;break}for(var Mg=At,Ko=dr+1;Ko=0&&f(re[$c])&l;$c--)$[$c]=pe.level}}return{levels:$,paragraphs:de};function Tg(Tn,ai){for(var An=Tn;An=$&&f(re[pe])&l;pe--)de[pe]=I.level;for(var Me=I.level,we=1/0,ue=0;ueMe&&(Me=Ce),Ce=we;ze--)for(var Le=0;Le=ze){for(var Ee=Le;Le+1=ze;)Le++;Le>Ee&&B.push([Ee+$,Le+$])}}}),B}function W(re,fe,xe,ce){var Pe=ye(re,fe,xe,ce),B=[].concat(re);return Pe.forEach(function(I,$){B[$]=(fe.levels[I]&1?Q(re[I]):null)||re[I]}),B.join("")}function ye(re,fe,xe,ce){for(var Pe=K(re,fe,xe,ce),B=[],I=0;I0==d>u&&(d=u,t.value=(d-u)/s),d}function Xg(r,e,t,n,i=1/0,s,o){n=Math.max(1e-4,n);const a=2/n,c=a*s,l=1/(1+c+.48*c*c+.235*c*c*c);let u=e.x,h=e.y,f=e.z,d=r.x-u,m=r.y-h,v=r.z-f;const g=u,p=h,_=f,y=i*n,x=y*y,b=d*d+m*m+v*v;if(b>x){const V=Math.sqrt(b);d=d/V*y,m=m/V*y,v=v/V*y}u=r.x-d,h=r.y-m,f=r.z-v;const w=(t.x+a*d)*s,S=(t.y+a*m)*s,M=(t.z+a*v)*s;t.x=(t.x-a*w)*l,t.y=(t.y-a*S)*l,t.z=(t.z-a*M)*l,o.x=u+(d+w)*l,o.y=h+(m+S)*l,o.z=f+(v+M)*l;const E=g-r.x,T=p-r.y,L=_-r.z,P=o.x-g,A=o.y-p,z=o.z-_;return E*P+T*A+L*z>0&&(o.x=g,o.y=p,o.z=_,t.x=(o.x-g)/s,t.y=(o.y-p)/s,t.z=(o.z-_)/s),o}function Gh(r,e){e.set(0,0),r.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=r.length,e.y/=r.length}function Vh(r,e){return wr(r)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}let yE=class{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s{},this._enabled=!0,this._state=oe.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Os.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new $e.Vector3,this._focalOffsetVelocity=new $e.Vector3,this._zoomVelocity={value:0},this._truckInternal=(p,_,y,x)=>{let b,w;if(Br(this._camera)){const S=it.copy(this._camera.position).sub(this._target),M=this._camera.getEffectiveFOV()*ra,E=S.length()*Math.tan(M*.5);b=this.truckSpeed*p*E/this._elementRect.height,w=this.truckSpeed*_*E/this._elementRect.height}else if(wr(this._camera)){const S=this._camera;b=this.truckSpeed*p*(S.right-S.left)/S.zoom/this._elementRect.width,w=this.truckSpeed*_*(S.top-S.bottom)/S.zoom/this._elementRect.height}else return;x?(y?this.setFocalOffset(this._focalOffsetEnd.x+b,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(b,0,!0),this.forward(-w,!0)):y?this.setFocalOffset(this._focalOffsetEnd.x+b,this._focalOffsetEnd.y+w,this._focalOffsetEnd.z,!0):this.truck(b,w,!0)},this._rotateInternal=(p,_)=>{const y=Ns*this.azimuthRotateSpeed*p/this._elementRect.height,x=Ns*this.polarRotateSpeed*_/this._elementRect.height;this.rotate(y,x,!0)},this._dollyInternal=(p,_,y)=>{const x=Math.pow(.95,-p*this.dollySpeed),b=this._sphericalEnd.radius,w=this._sphericalEnd.radius*x,S=pi(w,this.minDistance,this.maxDistance),M=S-w;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(w,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(M,!0),this._dollyToNoClamp(S,!0)):this._dollyToNoClamp(S,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?w:S)-b,this._dollyControlCoord.set(_,y)),this._lastDollyDirection=Math.sign(-p)},this._zoomInternal=(p,_,y)=>{const x=Math.pow(.95,p*this.dollySpeed),b=this._zoom,w=this._zoom*x;this.zoomTo(w,!0),this.dollyToCursor&&(this._changedZoom+=w-b,this._dollyControlCoord.set(_,y))},typeof $e>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new $e.Quaternion().setFromUnitVectors(this._camera.up,tl),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=oe.NONE,this._target=new $e.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new $e.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new $e.Spherical().setFromVector3(it.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new $e.Vector3,new $e.Vector3,new $e.Vector3,new $e.Vector3],this._updateNearPlaneCorners(),this._boundary=new $e.Box3(new $e.Vector3(-1/0,-1/0,-1/0),new $e.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new $e.Vector2,this.mouseButtons={left:oe.ROTATE,middle:oe.DOLLY,right:oe.TRUCK,wheel:Br(this._camera)?oe.DOLLY:wr(this._camera)?oe.ZOOM:oe.NONE},this.touches={one:oe.TOUCH_ROTATE,two:Br(this._camera)?oe.TOUCH_DOLLY_TRUCK:wr(this._camera)?oe.TOUCH_ZOOM_TRUCK:oe.NONE,three:oe.TOUCH_TRUCK};const n=new $e.Vector2,i=new $e.Vector2,s=new $e.Vector2,o=p=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),b=p.clientX/x.width,w=p.clientY/x.height;if(bthis._interactiveArea.right||wthis._interactiveArea.bottom)return}const _=p.pointerType!=="mouse"?null:(p.buttons&Lt.LEFT)===Lt.LEFT?Lt.LEFT:(p.buttons&Lt.MIDDLE)===Lt.MIDDLE?Lt.MIDDLE:(p.buttons&Lt.RIGHT)===Lt.RIGHT?Lt.RIGHT:null;if(_!==null){const x=this._findPointerByMouseButton(_);x&&this._disposePointer(x)}if((p.buttons&Lt.LEFT)===Lt.LEFT&&this._lockedPointer)return;const y={pointerId:p.pointerId,clientX:p.clientX,clientY:p.clientY,deltaX:0,deltaY:0,mouseButton:_};this._activePointers.push(y),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",c),this._isDragging=!0,f(p)},a=p=>{p.cancelable&&p.preventDefault();const _=p.pointerId,y=this._lockedPointer||this._findPointerById(_);if(y){if(y.clientX=p.clientX,y.clientY=p.clientY,y.deltaX=p.movementX,y.deltaY=p.movementY,this._state=0,p.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(p.buttons&Lt.LEFT)===Lt.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(p.buttons&Lt.MIDDLE)===Lt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(p.buttons&Lt.RIGHT)===Lt.RIGHT&&(this._state=this._state|this.mouseButtons.right);d()}},c=p=>{const _=this._findPointerById(p.pointerId);if(!(_&&_===this._lockedPointer)){if(_&&this._disposePointer(_),p.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=oe.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=oe.NONE;m()}};let l=-1;const u=p=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===oe.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const w=this._domElement.getBoundingClientRect(),S=p.clientX/w.width,M=p.clientY/w.height;if(Sthis._interactiveArea.right||Mthis._interactiveArea.bottom)return}if(p.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===oe.ROTATE||this.mouseButtons.wheel===oe.TRUCK){const w=performance.now();l-w<1e3&&this._getClientRect(this._elementRect),l=w}const _=bE?-1:-3,y=p.deltaMode===1||p.ctrlKey?p.deltaY/_:p.deltaY/(_*10),x=this.dollyToCursor?(p.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,b=this.dollyToCursor?(p.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case oe.ROTATE:{this._rotateInternal(p.deltaX,p.deltaY),this._isUserControllingRotate=!0;break}case oe.TRUCK:{this._truckInternal(p.deltaX,p.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case oe.SCREEN_PAN:{this._truckInternal(p.deltaX,p.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case oe.OFFSET:{this._truckInternal(p.deltaX,p.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case oe.DOLLY:{this._dollyInternal(-y,x,b),this._isUserControllingDolly=!0;break}case oe.ZOOM:{this._zoomInternal(-y,x,b),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},h=p=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Dd.ACTION.NONE){const _=p instanceof PointerEvent?p.pointerId:0,y=this._findPointerById(_);y&&this._disposePointer(y),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c);return}p.preventDefault()}},f=p=>{if(!this._enabled)return;if(Gh(this._activePointers,Cn),this._getClientRect(this._elementRect),n.copy(Cn),i.copy(Cn),this._activePointers.length>=2){const y=Cn.x-this._activePointers[1].clientX,x=Cn.y-this._activePointers[1].clientY,b=Math.sqrt(y*y+x*x);s.set(0,b);const w=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,S=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(w,S)}if(this._state=0,!p)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in p&&p.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(p.buttons&Lt.LEFT)===Lt.LEFT&&(this._state=this._state|this.mouseButtons.left),(p.buttons&Lt.MIDDLE)===Lt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(p.buttons&Lt.RIGHT)===Lt.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&oe.ROTATE)===oe.ROTATE||(this._state&oe.TOUCH_ROTATE)===oe.TOUCH_ROTATE||(this._state&oe.TOUCH_DOLLY_ROTATE)===oe.TOUCH_DOLLY_ROTATE||(this._state&oe.TOUCH_ZOOM_ROTATE)===oe.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&oe.TRUCK)===oe.TRUCK||(this._state&oe.SCREEN_PAN)===oe.SCREEN_PAN||(this._state&oe.TOUCH_TRUCK)===oe.TOUCH_TRUCK||(this._state&oe.TOUCH_SCREEN_PAN)===oe.TOUCH_SCREEN_PAN||(this._state&oe.TOUCH_DOLLY_TRUCK)===oe.TOUCH_DOLLY_TRUCK||(this._state&oe.TOUCH_DOLLY_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN||(this._state&oe.TOUCH_ZOOM_TRUCK)===oe.TOUCH_ZOOM_TRUCK||(this._state&oe.TOUCH_ZOOM_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&oe.DOLLY)===oe.DOLLY||(this._state&oe.TOUCH_DOLLY)===oe.TOUCH_DOLLY||(this._state&oe.TOUCH_DOLLY_TRUCK)===oe.TOUCH_DOLLY_TRUCK||(this._state&oe.TOUCH_DOLLY_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN||(this._state&oe.TOUCH_DOLLY_OFFSET)===oe.TOUCH_DOLLY_OFFSET||(this._state&oe.TOUCH_DOLLY_ROTATE)===oe.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&oe.ZOOM)===oe.ZOOM||(this._state&oe.TOUCH_ZOOM)===oe.TOUCH_ZOOM||(this._state&oe.TOUCH_ZOOM_TRUCK)===oe.TOUCH_ZOOM_TRUCK||(this._state&oe.TOUCH_ZOOM_SCREEN_PAN)===oe.TOUCH_ZOOM_SCREEN_PAN||(this._state&oe.TOUCH_ZOOM_OFFSET)===oe.TOUCH_ZOOM_OFFSET||(this._state&oe.TOUCH_ZOOM_ROTATE)===oe.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&oe.OFFSET)===oe.OFFSET||(this._state&oe.TOUCH_OFFSET)===oe.TOUCH_OFFSET||(this._state&oe.TOUCH_DOLLY_OFFSET)===oe.TOUCH_DOLLY_OFFSET||(this._state&oe.TOUCH_ZOOM_OFFSET)===oe.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},d=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Gh(this._activePointers,Cn);const _=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,y=_?-_.deltaX:i.x-Cn.x,x=_?-_.deltaY:i.y-Cn.y;if(i.copy(Cn),((this._state&oe.ROTATE)===oe.ROTATE||(this._state&oe.TOUCH_ROTATE)===oe.TOUCH_ROTATE||(this._state&oe.TOUCH_DOLLY_ROTATE)===oe.TOUCH_DOLLY_ROTATE||(this._state&oe.TOUCH_ZOOM_ROTATE)===oe.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(y,x),this._isUserControllingRotate=!0),(this._state&oe.DOLLY)===oe.DOLLY||(this._state&oe.ZOOM)===oe.ZOOM){const b=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,S=this.dollyDragInverted?-1:1;(this._state&oe.DOLLY)===oe.DOLLY?(this._dollyInternal(S*x*el,b,w),this._isUserControllingDolly=!0):(this._zoomInternal(S*x*el,b,w),this._isUserControllingZoom=!0)}if((this._state&oe.TOUCH_DOLLY)===oe.TOUCH_DOLLY||(this._state&oe.TOUCH_ZOOM)===oe.TOUCH_ZOOM||(this._state&oe.TOUCH_DOLLY_TRUCK)===oe.TOUCH_DOLLY_TRUCK||(this._state&oe.TOUCH_ZOOM_TRUCK)===oe.TOUCH_ZOOM_TRUCK||(this._state&oe.TOUCH_DOLLY_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN||(this._state&oe.TOUCH_ZOOM_SCREEN_PAN)===oe.TOUCH_ZOOM_SCREEN_PAN||(this._state&oe.TOUCH_DOLLY_OFFSET)===oe.TOUCH_DOLLY_OFFSET||(this._state&oe.TOUCH_ZOOM_OFFSET)===oe.TOUCH_ZOOM_OFFSET||(this._state&oe.TOUCH_DOLLY_ROTATE)===oe.TOUCH_DOLLY_ROTATE||(this._state&oe.TOUCH_ZOOM_ROTATE)===oe.TOUCH_ZOOM_ROTATE){const b=Cn.x-this._activePointers[1].clientX,w=Cn.y-this._activePointers[1].clientY,S=Math.sqrt(b*b+w*w),M=s.y-S;s.set(0,S);const E=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,T=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&oe.TOUCH_DOLLY)===oe.TOUCH_DOLLY||(this._state&oe.TOUCH_DOLLY_ROTATE)===oe.TOUCH_DOLLY_ROTATE||(this._state&oe.TOUCH_DOLLY_TRUCK)===oe.TOUCH_DOLLY_TRUCK||(this._state&oe.TOUCH_DOLLY_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN||(this._state&oe.TOUCH_DOLLY_OFFSET)===oe.TOUCH_DOLLY_OFFSET?(this._dollyInternal(M*el,E,T),this._isUserControllingDolly=!0):(this._zoomInternal(M*el,E,T),this._isUserControllingZoom=!0)}((this._state&oe.TRUCK)===oe.TRUCK||(this._state&oe.TOUCH_TRUCK)===oe.TOUCH_TRUCK||(this._state&oe.TOUCH_DOLLY_TRUCK)===oe.TOUCH_DOLLY_TRUCK||(this._state&oe.TOUCH_ZOOM_TRUCK)===oe.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(y,x,!1,!1),this._isUserControllingTruck=!0),((this._state&oe.SCREEN_PAN)===oe.SCREEN_PAN||(this._state&oe.TOUCH_SCREEN_PAN)===oe.TOUCH_SCREEN_PAN||(this._state&oe.TOUCH_DOLLY_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN||(this._state&oe.TOUCH_ZOOM_SCREEN_PAN)===oe.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(y,x,!1,!0),this._isUserControllingTruck=!0),((this._state&oe.OFFSET)===oe.OFFSET||(this._state&oe.TOUCH_OFFSET)===oe.TOUCH_OFFSET||(this._state&oe.TOUCH_DOLLY_OFFSET)===oe.TOUCH_DOLLY_OFFSET||(this._state&oe.TOUCH_ZOOM_OFFSET)===oe.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(y,x,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},m=()=>{Gh(this._activePointers,Cn),i.copy(Cn),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",v),this._domElement.ownerDocument.addEventListener("pointerlockerror",g),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",c),f())},this.unlockPointer=()=>{var p,_,y;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(p=this._domElement)===null||p===void 0||p.ownerDocument.exitPointerLock(),(_=this._domElement)===null||_===void 0||_.ownerDocument.removeEventListener("pointerlockchange",v),(y=this._domElement)===null||y===void 0||y.ownerDocument.removeEventListener("pointerlockerror",g),this.cancel()};const v=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},g=()=>{this.unlockPointer()};this._addAllEventListeners=p=>{this._domElement=p,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),this._domElement.addEventListener("pointercancel",c),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",h)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("pointercancel",c),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",h),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.ownerDocument.removeEventListener("pointerlockchange",v),this._domElement.ownerDocument.removeEventListener("pointerlockerror",g))},this.cancel=()=>{this._state!==oe.NONE&&(this._state=oe.NONE,this._activePointers.length=0,m())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=pi(e.width,0,1),this._interactiveArea.height=pi(e.height,0,1),this._interactiveArea.x=pi(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=pi(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,n=!1){this._isUserControllingRotate=!1;const i=pi(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=pi(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!n||vt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&vt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Os.NONE,this._changedDolly=0,this._dollyToNoClamp(pi(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),a=vt(o,this._spherical.radius);if(!(n>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||vt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(aa).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||vt(this._target.x,this._targetEnd.x,this.restThreshold)&&vt(this._target.y,this._targetEnd.y,this.restThreshold)&&vt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=pi(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||vt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),Ai.setFromMatrixColumn(this._camera.matrix,0),Ci.setFromMatrixColumn(this._camera.matrix,1),Ai.multiplyScalar(e),Ci.multiplyScalar(-t);const i=it.copy(Ai).add(Ci),s=pt.copy(this._targetEnd).add(i);return this.moveTo(s.x,s.y,s.z,n)}forward(e,t=!1){it.setFromMatrixColumn(this._camera.matrix,0),it.crossVectors(this._camera.up,it),it.multiplyScalar(e);const n=pt.copy(this._targetEnd).add(it);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return it.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+it.x,this._targetEnd.y+it.y,this._targetEnd.z+it.z,t)}moveTo(e,t,n,i=!1){this._isUserControllingTruck=!1;const s=it.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const o=!i||vt(this._target.x,this._targetEnd.x,this.restThreshold)&&vt(this._target.y,this._targetEnd.y,this.restThreshold)&&vt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,n,i=!1){const a=it.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(a.x,a.y,a.z,i)}fitToBox(e,t,{cover:n=!1,paddingLeft:i=0,paddingRight:s=0,paddingBottom:o=0,paddingTop:a=0}={}){const c=[],l=e.isBox3?ks.copy(e):ks.setFromObject(e);l.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=Wg(this._sphericalEnd.theta,Hg),h=Wg(this._sphericalEnd.phi,Hg);c.push(this.rotateTo(u,h,t));const f=it.setFromSpherical(this._sphericalEnd).normalize(),d=Zg.setFromUnitVectors(f,Wh),m=vt(Math.abs(f.y),1);m&&d.multiply(qh.setFromAxisAngle(tl,u)),d.multiply(this._yAxisUpSpaceInverse);const v=$g.makeEmpty();pt.copy(l.min).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.min).setX(l.max.x).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.min).setY(l.max.y).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.max).setZ(l.min.z).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.min).setZ(l.max.z).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.max).setY(l.min.y).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.max).setX(l.min.x).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.max).applyQuaternion(d),v.expandByPoint(pt),v.min.x-=i,v.min.y-=o,v.max.x+=s,v.max.y+=a,d.setFromUnitVectors(Wh,f),m&&d.premultiply(qh.invert()),d.premultiply(this._yAxisUpSpace);const g=v.getSize(it),p=v.getCenter(pt).applyQuaternion(d);if(Br(this._camera)){const _=this.getDistanceToFitBox(g.x,g.y,g.z,n);c.push(this.moveTo(p.x,p.y,p.z,t)),c.push(this.dollyTo(_,t)),c.push(this.setFocalOffset(0,0,0,t))}else if(wr(this._camera)){const _=this._camera,y=_.right-_.left,x=_.top-_.bottom,b=n?Math.max(y/g.x,x/g.y):Math.min(y/g.x,x/g.y);c.push(this.moveTo(p.x,p.y,p.z,t)),c.push(this.zoomTo(b,t)),c.push(this.setFocalOffset(0,0,0,t))}return Promise.all(c)}fitToSphere(e,t){const n=[],s="isObject3D"in e?Dd.createBoundingSphere(e,Xh):Xh.copy(e);if(n.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),Br(this._camera)){const o=this.getDistanceToFitSphere(s.radius);n.push(this.dollyTo(o,t))}else if(wr(this._camera)){const o=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,c=2*s.radius,l=Math.min(o/c,a/c);n.push(this.zoomTo(l,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,i,s,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Os.NONE,this._changedDolly=0;const c=pt.set(i,s,o),l=it.set(e,t,n);this._targetEnd.copy(c),this._sphericalEnd.setFromVector3(l.sub(c).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!a||vt(this._target.x,this._targetEnd.x,this.restThreshold)&&vt(this._target.y,this._targetEnd.y,this.restThreshold)&&vt(this._target.z,this._targetEnd.z,this.restThreshold)&&vt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&vt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&vt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,n,i,s,o,a,c,l,u,h,f,d,m=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Os.NONE,this._changedDolly=0;const v=it.set(i,s,o),g=pt.set(e,t,n);Yn.setFromVector3(g.sub(v).applyQuaternion(this._yAxisUpSpace));const p=Fs.set(u,h,f),_=pt.set(a,c,l);ca.setFromVector3(_.sub(p).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(v.lerp(p,d));const y=ca.theta-Yn.theta,x=ca.phi-Yn.phi,b=ca.radius-Yn.radius;this._sphericalEnd.set(Yn.radius+b*d,Yn.phi+x*d,Yn.theta+y*d),this.normalizeRotations(),this._needsUpdate=!0,m||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const w=!m||vt(this._target.x,this._targetEnd.x,this.restThreshold)&&vt(this._target.y,this._targetEnd.y,this.restThreshold)&&vt(this._target.z,this._targetEnd.z,this.restThreshold)&&vt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&vt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&vt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(w)}setPosition(e,t,n,i=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,n,i=!1){const s=this.getPosition(it),o=this.setLookAt(s.x,s.y,s.z,e,t,n,i);return this._sphericalEnd.phi=pi(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,n,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const s=!i||vt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&vt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&vt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),Ai.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Ci.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Gr.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=it.set(e,t,n),s=i.distanceTo(this._camera.position),o=i.sub(this._camera.position);Ai.multiplyScalar(o.x),Ci.multiplyScalar(o.y),Gr.multiplyScalar(o.z),it.copy(Ai).add(Ci).add(Gr),it.z=it.z+s,this.dollyTo(s,!1),this.setFocalOffset(-it.x,it.y,-it.z,!1),this.moveTo(e,t,n,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,n,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new $e.Vector4,typeof e=="number"?this._viewport.set(e,t,n,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,i=!1){if(Vh(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/t,o=this._camera.getEffectiveFOV()*ra,a=this._camera.aspect;return((i?s>a:st.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,n){const i=t.lengthSq();if(i===0)return e;const s=pt.copy(t).add(e),a=this._boundary.clampPoint(s,Fs).sub(s),c=a.lengthSq();if(c===0)return e.add(t);if(c===i)return e;if(n===0)return e.add(t).add(a);{const l=1+n*c/t.dot(a);return e.add(pt.copy(t).multiplyScalar(l)).add(a.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(Br(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*ra,i=Math.tan(n*.5)*t,s=i*e.aspect;this._nearPlaneCorners[0].set(-s,-i,0),this._nearPlaneCorners[1].set(s,-i,0),this._nearPlaneCorners[2].set(s,i,0),this._nearPlaneCorners[3].set(-s,i,0)}else if(wr(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,i=e.right*t,s=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(n,s,0),this._nearPlaneCorners[1].set(i,s,0),this._nearPlaneCorners[2].set(i,o,0),this._nearPlaneCorners[3].set(n,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Vh(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(aa);Yh.lookAt(qg,n,this._camera.up);for(let i=0;i<4;i++){const s=pt.copy(this._nearPlaneCorners[i]);s.applyMatrix4(Yh);const o=Fs.addVectors(this._target,s);nl.set(o,n),nl.far=this._spherical.radius+1;const a=nl.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance{const n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new $e.Sphere){const n=t,i=n.center;ks.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&ks.expandByObject(o)}),ks.getCenter(i);let s=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o;if(!a.geometry)return;const c=a.geometry.clone();c.applyMatrix4(a.matrixWorld);const u=c.attributes.position;for(let h=0,f=u.count;h{let e;const t=new Set,n=(c,l)=>{const u=typeof c=="function"?c(e):c;if(!Object.is(u,e)){const h=e;e=l??typeof u!="object"?u:Object.assign({},e,u),t.forEach(f=>f(e,h))}},i=()=>e,a={setState:n,getState:i,subscribe:c=>(t.add(c),()=>t.delete(c)),destroy:()=>{(wE?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}};return e=r(n,i,a),a},SE=r=>r?Kg(r):Kg;var jh={exports:{}},$h={},Zh={exports:{}},Kh={};/** - * @license React - * use-sync-external-store-shim.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Jg;function EE(){if(Jg)return Kh;Jg=1;var r=Iy();function e(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var t=typeof Object.is=="function"?Object.is:e,n=r.useState,i=r.useEffect,s=r.useLayoutEffect,o=r.useDebugValue;function a(h,f){var d=f(),m=n({inst:{value:d,getSnapshot:f}}),v=m[0].inst,g=m[1];return s(function(){v.value=d,v.getSnapshot=f,c(v)&&g({inst:v})},[h,d,f]),i(function(){return c(v)&&g({inst:v}),h(function(){c(v)&&g({inst:v})})},[h]),o(d),d}function c(h){var f=h.getSnapshot;h=h.value;try{var d=f();return!t(h,d)}catch{return!0}}function l(h,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Kh.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:u,Kh}var Qg;function ME(){return Qg||(Qg=1,Zh.exports=EE()),Zh.exports}/** - * @license React - * use-sync-external-store-shim/with-selector.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var e0;function TE(){if(e0)return $h;e0=1;var r=Iy(),e=ME();function t(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,s=r.useRef,o=r.useEffect,a=r.useMemo,c=r.useDebugValue;return $h.useSyncExternalStoreWithSelector=function(l,u,h,f,d){var m=s(null);if(m.current===null){var v={hasValue:!1,value:null};m.current=v}else v=m.current;m=a(function(){function p(w){if(!_){if(_=!0,y=w,w=f(w),d!==void 0&&v.hasValue){var S=v.value;if(d(S,w))return x=S}return x=w}if(S=x,n(y,w))return S;var M=f(w);return d!==void 0&&d(S,M)?S:(y=w,x=M)}var _=!1,y,x,b=h===void 0?null:h;return[function(){return p(u())},b===null?void 0:function(){return p(b())}]},[u,h,f,d]);var g=i(l,m[0],m[1]);return o(function(){v.hasValue=!0,v.value=g},[g]),c(g),g},$h}var t0;function AE(){return t0||(t0=1,jh.exports=TE()),jh.exports}var CE=AE();const RE=ki(CE),PE={},{useSyncExternalStoreWithSelector:LE}=RE;function Xy(r,e=r.getState,t){const n=LE(r.subscribe,r.getState,r.getServerState||r.getState,e,t);return q.useDebugValue(n),n}const n0=r=>{(PE?"production":void 0)!=="production"&&typeof r!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof r=="function"?SE(r):r,t=(n,i)=>Xy(e,n,i);return Object.assign(t,e),t},DE=r=>r?n0(r):n0;/** - * @license - * Copyright 2010-2023 Three.js Authors - * SPDX-License-Identifier: MIT - */const Iu="154",qy={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},IE={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Yy=0,Id=1,jy=2,UE=3,$y=0,Uu=1,za=2,mi=3,Oi=0,vn=1,Dt=2,OE=2,nr=0,ls=1,Ud=2,Od=3,Nd=4,Zy=5,ns=100,Ky=101,Jy=102,Fd=103,kd=104,Qy=200,ex=201,tx=202,nx=203,Vp=204,Hp=205,ix=206,rx=207,sx=208,ox=209,ax=210,cx=0,lx=1,ux=2,vu=3,hx=4,fx=5,dx=6,px=7,Rc=0,mx=1,gx=2,yi=0,vx=1,_x=2,yx=3,Wp=4,xx=5,Ou=300,Pr=301,Lr=302,Ka=303,Ja=304,Oo=306,Qa=1e3,gn=1001,ec=1002,Yt=1003,_u=1004,NE=1004,Ba=1005,FE=1005,Pt=1006,Xp=1007,kE=1007,Dr=1008,zE=1008,Ii=1009,bx=1010,wx=1011,Nu=1012,qp=1013,tr=1014,Li=1015,Ao=1016,Yp=1017,jp=1018,Mr=1020,Sx=1021,Ln=1023,Ex=1024,Mx=1025,Tr=1026,ms=1027,Tx=1028,$p=1029,Ax=1030,Zp=1031,Kp=1033,iu=33776,ru=33777,su=33778,ou=33779,zd=35840,Bd=35841,Gd=35842,Vd=35843,Cx=36196,Hd=37492,Wd=37496,Xd=37808,qd=37809,Yd=37810,jd=37811,$d=37812,Zd=37813,Kd=37814,Jd=37815,Qd=37816,ep=37817,tp=37818,np=37819,ip=37820,rp=37821,au=36492,Rx=36283,sp=36284,op=36285,ap=36286,Px=2200,Lx=2201,Dx=2202,tc=2300,nc=2301,cu=2302,ss=2400,os=2401,ic=2402,Fu=2500,Jp=2501,BE=0,GE=1,VE=2,Qp=3e3,Ar=3001,Ix=3200,em=3201,Or=0,Ux=1,Cr="",et="srgb",xi="srgb-linear",tm="display-p3",HE=0,lu=7680,WE=7681,XE=7682,qE=7683,YE=34055,jE=34056,$E=5386,ZE=512,KE=513,JE=514,QE=515,eM=516,tM=517,nM=518,Ox=519,Nx=512,Fx=513,kx=514,zx=515,Bx=516,Gx=517,Vx=518,Hx=519,rc=35044,iM=35048,rM=35040,sM=35045,oM=35049,aM=35041,cM=35046,lM=35050,uM=35042,hM="100",cp="300 es",yu=1035,Di=2e3,sc=2001;let ar=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s>8&255]+pn[r>>16&255]+pn[r>>24&255]+"-"+pn[e&255]+pn[e>>8&255]+"-"+pn[e>>16&15|64]+pn[e>>24&255]+"-"+pn[t&63|128]+pn[t>>8&255]+"-"+pn[t>>16&255]+pn[t>>24&255]+pn[n&255]+pn[n>>8&255]+pn[n>>16&255]+pn[n>>24&255]).toLowerCase()}function Bt(r,e,t){return Math.max(e,Math.min(t,r))}function nm(r,e){return(r%e+e)%e}function fM(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function dM(r,e,t){return r!==e?(t-r)/(e-r):0}function Ga(r,e,t){return(1-t)*r+t*e}function pM(r,e,t,n){return Ga(r,e,1-Math.exp(-t*n))}function mM(r,e=1){return e-Math.abs(nm(r,e*2)-e)}function gM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function vM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function _M(r,e){return r+Math.floor(Math.random()*(e-r+1))}function yM(r,e){return r+Math.random()*(e-r)}function xM(r){return r*(.5-Math.random())}function bM(r){r!==void 0&&(i0=r);let e=i0+=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 wM(r){return r*us}function SM(r){return r*Co}function lp(r){return(r&r-1)===0&&r!==0}function Wx(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function xu(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function EM(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),c=o(t/2),l=s((e+n)/2),u=o((e+n)/2),h=s((e-n)/2),f=o((e-n)/2),d=s((n-e)/2),m=o((n-e)/2);switch(i){case"XYX":r.set(a*u,c*h,c*f,a*l);break;case"YZY":r.set(c*f,a*u,c*h,a*l);break;case"ZXZ":r.set(c*h,c*f,a*u,a*l);break;case"XZX":r.set(a*u,c*m,c*d,a*l);break;case"YXY":r.set(c*d,a*u,c*m,a*l);break;case"ZYZ":r.set(c*m,c*d,a*u,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function zn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function ot(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const bu={DEG2RAD:us,RAD2DEG:Co,generateUUID:Bn,clamp:Bt,euclideanModulo:nm,mapLinear:fM,inverseLerp:dM,lerp:Ga,damp:pM,pingpong:mM,smoothstep:gM,smootherstep:vM,randInt:_M,randFloat:yM,randFloatSpread:xM,seededRandom:bM,degToRad:wM,radToDeg:SM,isPowerOfTwo:lp,ceilPowerOfTwo:Wx,floorPowerOfTwo:xu,setQuaternionFromProperEuler:EM,normalize:ot,denormalize:zn};class be{constructor(e=0,t=0){be.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,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,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;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,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,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,t){return this.x=e.x-t.x,this.y=e.y-t.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 t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+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,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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 t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Bt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class rt{constructor(e,t,n,i,s,o,a,c,l){rt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,c,l)}set(e,t,n,i,s,o,a,c,l){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=c,u[6]=n,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[3],c=n[6],l=n[1],u=n[4],h=n[7],f=n[2],d=n[5],m=n[8],v=i[0],g=i[3],p=i[6],_=i[1],y=i[4],x=i[7],b=i[2],w=i[5],S=i[8];return s[0]=o*v+a*_+c*b,s[3]=o*g+a*y+c*w,s[6]=o*p+a*x+c*S,s[1]=l*v+u*_+h*b,s[4]=l*g+u*y+h*w,s[7]=l*p+u*x+h*S,s[2]=f*v+d*_+m*b,s[5]=f*g+d*y+m*w,s[8]=f*p+d*x+m*S,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8];return t*o*u-t*a*l-n*s*u+n*a*c+i*s*l-i*o*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,f=a*c-u*s,d=l*s-o*c,m=t*h+n*f+i*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/m;return e[0]=h*v,e[1]=(i*l-u*n)*v,e[2]=(a*n-i*o)*v,e[3]=f*v,e[4]=(u*t-i*c)*v,e[5]=(i*s-a*t)*v,e[6]=d*v,e[7]=(n*c-l*t)*v,e[8]=(o*t-n*s)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,o,a){const c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*o+l*a)+o+e,-i*l,i*c,-i*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Jh.makeScale(e,t)),this}rotate(e){return this.premultiply(Jh.makeRotation(-e)),this}translate(e,t){return this.premultiply(Jh.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Jh=new rt;function Xx(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const MM={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function vo(r,e){return new MM[r](e)}function oc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}const r0={};function Va(r){r in r0||(r0[r]=!0,console.warn(r))}function wo(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Qh(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}const TM=new rt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),AM=new rt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function CM(r){return r.convertSRGBToLinear().applyMatrix3(AM)}function RM(r){return r.applyMatrix3(TM).convertLinearToSRGB()}const PM={[xi]:r=>r,[et]:r=>r.convertSRGBToLinear(),[tm]:CM},LM={[xi]:r=>r,[et]:r=>r.convertLinearToSRGB(),[tm]:RM},Zn={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return xi},set workingColorSpace(r){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;const n=PM[e],i=LM[t];if(n===void 0||i===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return i(n(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this.workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this.workingColorSpace)}};let zs;class im{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{zs===void 0&&(zs=oc("canvas")),zs.width=e.width,zs.height=e.height;const n=zs.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=zs}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.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 t=oc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ou)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Qa:e.x=e.x-Math.floor(e.x);break;case gn:e.x=e.x<0?0:1;break;case ec: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 Qa:e.y=e.y-Math.floor(e.y);break;case gn:e.y=e.y<0?0:1;break;case ec: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)}get encoding(){return Va("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===et?Ar:Qp}set encoding(e){Va("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Ar?et:Cr}}Ft.DEFAULT_IMAGE=null;Ft.DEFAULT_MAPPING=Ou;Ft.DEFAULT_ANISOTROPY=1;class mt{constructor(e=0,t=0,n=0,i=1){mt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,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,t,n,i){return this.x=e,this.y=t,this.z=n,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,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;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,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,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,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.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 t=this.x,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const c=e.elements,l=c[0],u=c[4],h=c[8],f=c[1],d=c[5],m=c[9],v=c[2],g=c[6],p=c[10];if(Math.abs(u-f)<.01&&Math.abs(h-v)<.01&&Math.abs(m-g)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+v)<.1&&Math.abs(m+g)<.1&&Math.abs(l+d+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(l+1)/2,x=(d+1)/2,b=(p+1)/2,w=(u+f)/4,S=(h+v)/4,M=(m+g)/4;return y>x&&y>b?y<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(y),i=w/n,s=S/n):x>b?x<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),n=w/i,s=M/i):b<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(b),n=S/s,i=M/s),this.set(n,i,s,t),this}let _=Math.sqrt((g-m)*(g-m)+(h-v)*(h-v)+(f-u)*(f-u));return Math.abs(_)<.001&&(_=1),this.x=(g-m)/_,this.y=(h-v)/_,this.z=(f-u)/_,this.w=Math.acos((l+d+p-1)/2),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,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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 bi extends ar{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new mt(0,0,e,t),this.scissorTest=!1,this.viewport=new mt(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(Va("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Ar?et:Cr),this.texture=new Ft(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.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Pt,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new as(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ku extends Ft{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Yt,this.minFilter=Yt,this.wrapR=gn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class UM extends bi{constructor(e=1,t=1,n=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new ku(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class rm extends Ft{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Yt,this.minFilter=Yt,this.wrapR=gn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class OM extends bi{constructor(e=1,t=1,n=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new rm(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class NM extends bi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o=0?1:-1,y=1-p*p;if(y>Number.EPSILON){const b=Math.sqrt(y),w=Math.atan2(b,p*_);g=Math.sin(g*w)/b,a=Math.sin(a*w)/b}const x=a*_;if(c=c*g+f*x,l=l*g+d*x,u=u*g+m*x,h=h*g+v*x,g===1-a){const b=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=b,l*=b,u*=b,h*=b}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],c=n[i+1],l=n[i+2],u=n[i+3],h=s[o],f=s[o+1],d=s[o+2],m=s[o+3];return e[t]=a*m+u*h+c*d-l*f,e[t+1]=c*m+u*f+l*h-a*d,e[t+2]=l*m+u*d+a*f-c*h,e[t+3]=u*m-a*h-c*f-l*d,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,t,n,i){return this._x=e,this._y=t,this._z=n,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,t){const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(n/2),u=a(i/2),h=a(s/2),f=c(n/2),d=c(i/2),m=c(s/2);switch(o){case"XYZ":this._x=f*u*h+l*d*m,this._y=l*d*h-f*u*m,this._z=l*u*m+f*d*h,this._w=l*u*h-f*d*m;break;case"YXZ":this._x=f*u*h+l*d*m,this._y=l*d*h-f*u*m,this._z=l*u*m-f*d*h,this._w=l*u*h+f*d*m;break;case"ZXY":this._x=f*u*h-l*d*m,this._y=l*d*h+f*u*m,this._z=l*u*m+f*d*h,this._w=l*u*h-f*d*m;break;case"ZYX":this._x=f*u*h-l*d*m,this._y=l*d*h+f*u*m,this._z=l*u*m-f*d*h,this._w=l*u*h+f*d*m;break;case"YZX":this._x=f*u*h+l*d*m,this._y=l*d*h+f*u*m,this._z=l*u*m-f*d*h,this._w=l*u*h-f*d*m;break;case"XZY":this._x=f*u*h-l*d*m,this._y=l*d*h-f*u*m,this._z=l*u*m+f*d*h,this._w=l*u*h+f*d*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],a=t[5],c=t[9],l=t[2],u=t[6],h=t[10],f=n+a+h;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-c)*d,this._y=(s-l)*d,this._z=(o-i)*d}else if(n>a&&n>h){const d=2*Math.sqrt(1+n-a-h);this._w=(u-c)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+l)/d}else if(a>h){const d=2*Math.sqrt(1+a-n-h);this._w=(s-l)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(c+u)/d}else{const d=2*Math.sqrt(1+h-n-a);this._w=(o-i)/d,this._x=(s+l)/d,this._y=(c+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Bt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);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,t){const n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,c=t._y,l=t._z,u=t._w;return this._x=n*u+o*a+i*l-s*c,this._y=i*u+o*c+s*a-n*l,this._z=s*u+o*l+n*c-i*a,this._w=o*u-n*a-i*c-s*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=n,this._y=i,this._z=s,this;const c=1-a*a;if(c<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*n+t*this._x,this._y=d*i+t*this._y,this._z=d*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(c),u=Math.atan2(l,a),h=Math.sin((1-t)*u)/l,f=Math.sin(t*u)/l;return this._w=o*h+this._w*f,this._x=n*h+this._x*f,this._y=i*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),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 G{constructor(e=0,t=0,n=0){G.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,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,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;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,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,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,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.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,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(s0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s0.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,c=e.w,l=c*t+o*i-a*n,u=c*n+a*t-s*i,h=c*i+s*n-o*t,f=-s*t-o*n-a*i;return this.x=l*c+f*-s+u*-a-h*-o,this.y=u*c+f*-o+h*-s-l*-a,this.z=h*c+f*-a+l*-o-u*-s,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+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,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,o=t.x,a=t.y,c=t.z;return this.x=i*c-s*a,this.y=s*o-n*c,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return tf.copy(this).projectOnVector(e),this.sub(tf)}reflect(e){return this.sub(tf.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Bt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+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,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*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,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const tf=new G,s0=new ln;class Hn{constructor(e=new G(1/0,1/0,1/0),t=new G(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.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,t){return t.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Xi),Xi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(la),il.subVectors(this.max,la),Gs.subVectors(e.a,la),Vs.subVectors(e.b,la),Hs.subVectors(e.c,la),mr.subVectors(Vs,Gs),gr.subVectors(Hs,Vs),Vr.subVectors(Gs,Hs);let t=[0,-mr.z,mr.y,0,-gr.z,gr.y,0,-Vr.z,Vr.y,mr.z,0,-mr.x,gr.z,0,-gr.x,Vr.z,0,-Vr.x,-mr.y,mr.x,0,-gr.y,gr.x,0,-Vr.y,Vr.x,0];return!nf(t,Gs,Vs,Hs,il)||(t=[1,0,0,0,1,0,0,0,1],!nf(t,Gs,Vs,Hs,il))?!1:(rl.crossVectors(mr,gr),t=[rl.x,rl.y,rl.z],nf(t,Gs,Vs,Hs,il))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Xi).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:(Wi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wi),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 Wi=[new G,new G,new G,new G,new G,new G,new G,new G],Xi=new G,Bs=new Hn,Gs=new G,Vs=new G,Hs=new G,mr=new G,gr=new G,Vr=new G,la=new G,il=new G,rl=new G,Hr=new G;function nf(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){Hr.fromArray(r,s);const a=i.x*Math.abs(Hr.x)+i.y*Math.abs(Hr.y)+i.z*Math.abs(Hr.z),c=e.dot(Hr),l=t.dot(Hr),u=n.dot(Hr);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}const FM=new Hn,ua=new G,rf=new G;let Wn=class{constructor(e=new G,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):FM.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}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;ua.subVectors(e,this.center);const t=ua.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ua,i/n),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):(rf.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ua.copy(e.center).add(rf)),this.expandByPoint(ua.copy(e.center).sub(rf))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const qi=new G,sf=new G,sl=new G,vr=new G,of=new G,ol=new G,af=new G;class No{constructor(e=new G,t=new G(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.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,qi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=qi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qi.copy(this.origin).addScaledVector(this.direction,t),qi.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){sf.copy(e).add(t).multiplyScalar(.5),sl.copy(t).sub(e).normalize(),vr.copy(this.origin).sub(sf);const s=e.distanceTo(t)*.5,o=-this.direction.dot(sl),a=vr.dot(this.direction),c=-vr.dot(sl),l=vr.lengthSq(),u=Math.abs(1-o*o);let h,f,d,m;if(u>0)if(h=o*c-a,f=o*a-c,m=s*u,h>=0)if(f>=-m)if(f<=m){const v=1/u;h*=v,f*=v,d=h*(h+o*f+2*a)+f*(o*h+f+2*c)+l}else f=s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*c)+l;else f=-s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*c)+l;else f<=-m?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-c),s),d=-h*h+f*(f+2*c)+l):f<=m?(h=0,f=Math.min(Math.max(-s,-c),s),d=f*(f+2*c)+l):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-c),s),d=-h*h+f*(f+2*c)+l);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(sf).addScaledVector(sl,f),d}intersectSphere(e,t){qi.subVectors(e.center,this.origin);const n=qi.dot(this.direction),i=qi.dot(qi)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,c=n+o;return c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,a,c;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return l>=0?(n=(e.min.x-f.x)*l,i=(e.max.x-f.x)*l):(n=(e.max.x-f.x)*l,i=(e.min.x-f.x)*l),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-f.z)*h,c=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,c=(e.min.z-f.z)*h),n>c||a>i)||((a>n||n!==n)&&(n=a),(c=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,qi)!==null}intersectTriangle(e,t,n,i,s){of.subVectors(t,e),ol.subVectors(n,e),af.crossVectors(of,ol);let o=this.direction.dot(af),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;vr.subVectors(this.origin,e);const c=a*this.direction.dot(ol.crossVectors(vr,ol));if(c<0)return null;const l=a*this.direction.dot(of.cross(vr));if(l<0||c+l>o)return null;const u=-a*vr.dot(af);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ke{constructor(e,t,n,i,s,o,a,c,l,u,h,f,d,m,v,g){Ke.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,t,n,i,s,o,a,c,l,u,h,f,d,m,v,g)}set(e,t,n,i,s,o,a,c,l,u,h,f,d,m,v,g){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=o,p[9]=a,p[13]=c,p[2]=l,p[6]=u,p[10]=h,p[14]=f,p[3]=d,p[7]=m,p[11]=v,p[15]=g,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 Ke().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Ws.setFromMatrixColumn(e,0).length(),s=1/Ws.setFromMatrixColumn(e,1).length(),o=1/Ws.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),c=Math.cos(i),l=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=o*u,d=o*h,m=a*u,v=a*h;t[0]=c*u,t[4]=-c*h,t[8]=l,t[1]=d+m*l,t[5]=f-v*l,t[9]=-a*c,t[2]=v-f*l,t[6]=m+d*l,t[10]=o*c}else if(e.order==="YXZ"){const f=c*u,d=c*h,m=l*u,v=l*h;t[0]=f+v*a,t[4]=m*a-d,t[8]=o*l,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=d*a-m,t[6]=v+f*a,t[10]=o*c}else if(e.order==="ZXY"){const f=c*u,d=c*h,m=l*u,v=l*h;t[0]=f-v*a,t[4]=-o*h,t[8]=m+d*a,t[1]=d+m*a,t[5]=o*u,t[9]=v-f*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){const f=o*u,d=o*h,m=a*u,v=a*h;t[0]=c*u,t[4]=m*l-d,t[8]=f*l+v,t[1]=c*h,t[5]=v*l+f,t[9]=d*l-m,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){const f=o*c,d=o*l,m=a*c,v=a*l;t[0]=c*u,t[4]=v-f*h,t[8]=m*h+d,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=d*h+m,t[10]=f-v*h}else if(e.order==="XZY"){const f=o*c,d=o*l,m=a*c,v=a*l;t[0]=c*u,t[4]=-h,t[8]=l*u,t[1]=f*h+v,t[5]=o*u,t[9]=d*h-m,t[2]=m*h-d,t[6]=a*u,t[10]=v*h+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(kM,e,zM)}lookAt(e,t,n){const i=this.elements;return Fn.subVectors(e,t),Fn.lengthSq()===0&&(Fn.z=1),Fn.normalize(),_r.crossVectors(n,Fn),_r.lengthSq()===0&&(Math.abs(n.z)===1?Fn.x+=1e-4:Fn.z+=1e-4,Fn.normalize(),_r.crossVectors(n,Fn)),_r.normalize(),al.crossVectors(Fn,_r),i[0]=_r.x,i[4]=al.x,i[8]=Fn.x,i[1]=_r.y,i[5]=al.y,i[9]=Fn.y,i[2]=_r.z,i[6]=al.z,i[10]=Fn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[4],c=n[8],l=n[12],u=n[1],h=n[5],f=n[9],d=n[13],m=n[2],v=n[6],g=n[10],p=n[14],_=n[3],y=n[7],x=n[11],b=n[15],w=i[0],S=i[4],M=i[8],E=i[12],T=i[1],L=i[5],P=i[9],A=i[13],z=i[2],V=i[6],N=i[10],C=i[14],O=i[3],k=i[7],U=i[11],R=i[15];return s[0]=o*w+a*T+c*z+l*O,s[4]=o*S+a*L+c*V+l*k,s[8]=o*M+a*P+c*N+l*U,s[12]=o*E+a*A+c*C+l*R,s[1]=u*w+h*T+f*z+d*O,s[5]=u*S+h*L+f*V+d*k,s[9]=u*M+h*P+f*N+d*U,s[13]=u*E+h*A+f*C+d*R,s[2]=m*w+v*T+g*z+p*O,s[6]=m*S+v*L+g*V+p*k,s[10]=m*M+v*P+g*N+p*U,s[14]=m*E+v*A+g*C+p*R,s[3]=_*w+y*T+x*z+b*O,s[7]=_*S+y*L+x*V+b*k,s[11]=_*M+y*P+x*N+b*U,s[15]=_*E+y*A+x*C+b*R,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],o=e[1],a=e[5],c=e[9],l=e[13],u=e[2],h=e[6],f=e[10],d=e[14],m=e[3],v=e[7],g=e[11],p=e[15];return m*(+s*c*h-i*l*h-s*a*f+n*l*f+i*a*d-n*c*d)+v*(+t*c*d-t*l*f+s*o*f-i*o*d+i*l*u-s*c*u)+g*(+t*l*h-t*a*d-s*o*h+n*o*d+s*a*u-n*l*u)+p*(-i*a*u-t*c*h+t*a*f+i*o*h-n*o*f+n*c*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],f=e[10],d=e[11],m=e[12],v=e[13],g=e[14],p=e[15],_=h*g*l-v*f*l+v*c*d-a*g*d-h*c*p+a*f*p,y=m*f*l-u*g*l-m*c*d+o*g*d+u*c*p-o*f*p,x=u*v*l-m*h*l+m*a*d-o*v*d-u*a*p+o*h*p,b=m*h*c-u*v*c-m*a*f+o*v*f+u*a*g-o*h*g,w=t*_+n*y+i*x+s*b;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/w;return e[0]=_*S,e[1]=(v*f*s-h*g*s-v*i*d+n*g*d+h*i*p-n*f*p)*S,e[2]=(a*g*s-v*c*s+v*i*l-n*g*l-a*i*p+n*c*p)*S,e[3]=(h*c*s-a*f*s-h*i*l+n*f*l+a*i*d-n*c*d)*S,e[4]=y*S,e[5]=(u*g*s-m*f*s+m*i*d-t*g*d-u*i*p+t*f*p)*S,e[6]=(m*c*s-o*g*s-m*i*l+t*g*l+o*i*p-t*c*p)*S,e[7]=(o*f*s-u*c*s+u*i*l-t*f*l-o*i*d+t*c*d)*S,e[8]=x*S,e[9]=(m*h*s-u*v*s-m*n*d+t*v*d+u*n*p-t*h*p)*S,e[10]=(o*v*s-m*a*s+m*n*l-t*v*l-o*n*p+t*a*p)*S,e[11]=(u*a*s-o*h*s-u*n*l+t*h*l+o*n*d-t*a*d)*S,e[12]=b*S,e[13]=(u*v*i-m*h*i+m*n*f-t*v*f-u*n*g+t*h*g)*S,e[14]=(m*a*i-o*v*i-m*n*c+t*v*c+o*n*g-t*a*g)*S,e[15]=(o*h*i-u*a*i+u*n*c-t*h*c-o*n*f+t*a*f)*S,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=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(t,n,i))}makeTranslation(e,t,n){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,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,a=e.y,c=e.z,l=s*o,u=s*a;return this.set(l*o+n,l*a-i*c,l*c+i*a,0,l*a+i*c,u*a+n,u*c-i*o,0,l*c-i*a,u*c+i*o,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,c=t._w,l=s+s,u=o+o,h=a+a,f=s*l,d=s*u,m=s*h,v=o*u,g=o*h,p=a*h,_=c*l,y=c*u,x=c*h,b=n.x,w=n.y,S=n.z;return i[0]=(1-(v+p))*b,i[1]=(d+x)*b,i[2]=(m-y)*b,i[3]=0,i[4]=(d-x)*w,i[5]=(1-(f+p))*w,i[6]=(g+_)*w,i[7]=0,i[8]=(m+y)*S,i[9]=(g-_)*S,i[10]=(1-(f+v))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=Ws.set(i[0],i[1],i[2]).length();const o=Ws.set(i[4],i[5],i[6]).length(),a=Ws.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],li.copy(this);const l=1/s,u=1/o,h=1/a;return li.elements[0]*=l,li.elements[1]*=l,li.elements[2]*=l,li.elements[4]*=u,li.elements[5]*=u,li.elements[6]*=u,li.elements[8]*=h,li.elements[9]*=h,li.elements[10]*=h,t.setFromRotationMatrix(li),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o,a=Di){const c=this.elements,l=2*s/(t-e),u=2*s/(n-i),h=(t+e)/(t-e),f=(n+i)/(n-i);let d,m;if(a===Di)d=-(o+s)/(o-s),m=-2*o*s/(o-s);else if(a===sc)d=-o/(o-s),m=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=l,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=d,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,s,o,a=Di){const c=this.elements,l=1/(t-e),u=1/(n-i),h=1/(o-s),f=(t+e)*l,d=(n+i)*u;let m,v;if(a===Di)m=(o+s)*h,v=-2*h;else if(a===sc)m=s*h,v=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-f,c[1]=0,c[5]=2*u,c[9]=0,c[13]=-d,c[2]=0,c[6]=0,c[10]=v,c[14]=-m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Ws=new G,li=new Ke,kM=new G(0,0,0),zM=new G(1,1,1),_r=new G,al=new G,Fn=new G,o0=new Ke,a0=new ln;class Ir{constructor(e=0,t=0,n=0,i=Ir.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,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,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,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,t=this._order,n=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],c=i[1],l=i[5],u=i[9],h=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(Bt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Bt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Bt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Bt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Bt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Bt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return o0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(o0,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return a0.setFromEuler(this),this.setFromQuaternion(a0,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=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+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}}Ir.DEFAULT_ORDER="XYZ";class hs{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(n=n.concat(o))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ha,e,GM),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ha,VM,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n0&&(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()));function s(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(n.geometries=a),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),m.length>0&&(n.nodes=m)}return n.object=i,n;function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!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.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){ui.subVectors(i,t),ji.subVectors(n,t),cf.subVectors(e,t);const o=ui.dot(ui),a=ui.dot(ji),c=ui.dot(cf),l=ji.dot(ji),u=ji.dot(cf),h=o*l-a*a;if(h===0)return s.set(-2,-1,-1);const f=1/h,d=(l*c-a*u)*f,m=(o*u-a*c)*f;return s.set(1-d-m,m,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,$i),$i.x>=0&&$i.y>=0&&$i.x+$i.y<=1}static getUV(e,t,n,i,s,o,a,c){return ll===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ll=!0),this.getInterpolation(e,t,n,i,s,o,a,c)}static getInterpolation(e,t,n,i,s,o,a,c){return this.getBarycoord(e,t,n,i,$i),c.setScalar(0),c.addScaledVector(s,$i.x),c.addScaledVector(o,$i.y),c.addScaledVector(a,$i.z),c}static isFrontFacing(e,t,n,i){return ui.subVectors(n,t),ji.subVectors(e,t),ui.cross(ji).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),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 ui.subVectors(this.c,this.b),ji.subVectors(this.a,this.b),ui.cross(ji).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Pn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Pn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return ll===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ll=!0),Pn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return Pn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Pn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Pn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,a;qs.subVectors(i,n),Ys.subVectors(s,n),lf.subVectors(e,n);const c=qs.dot(lf),l=Ys.dot(lf);if(c<=0&&l<=0)return t.copy(n);uf.subVectors(e,i);const u=qs.dot(uf),h=Ys.dot(uf);if(u>=0&&h<=u)return t.copy(i);const f=c*h-u*l;if(f<=0&&c>=0&&u<=0)return o=c/(c-u),t.copy(n).addScaledVector(qs,o);hf.subVectors(e,s);const d=qs.dot(hf),m=Ys.dot(hf);if(m>=0&&d<=m)return t.copy(s);const v=d*l-c*m;if(v<=0&&l>=0&&m<=0)return a=l/(l-m),t.copy(n).addScaledVector(Ys,a);const g=u*m-d*h;if(g<=0&&h-u>=0&&d-m>=0)return d0.subVectors(s,i),a=(h-u)/(h-u+(d-m)),t.copy(i).addScaledVector(d0,a);const p=1/(g+v+f);return o=v*p,a=f*p,t.copy(n).addScaledVector(qs,o).addScaledVector(Ys,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let WM=0;class un extends ar{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:WM++}),this.uuid=Bn(),this.name="",this.type="Material",this.blending=ls,this.side=Oi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Vp,this.blendDst=Hp,this.blendEquation=ns,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=vu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ox,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=lu,this.stencilZFail=lu,this.stencilZPass=lu,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ls&&(n.blending=this.blending),this.side!==Oi&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=this.alphaHash),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(n.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const a in s){const c=s[a];delete c.metadata,o.push(c)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}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.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 t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,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++}}const qx={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},hi={h:0,s:0,l:0},ul={h:0,s:0,l:0};function ff(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Ne{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===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,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=et){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Zn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Zn.workingColorSpace){return this.r=e,this.g=t,this.b=n,Zn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Zn.workingColorSpace){if(e=nm(e,1),t=Bt(t,0,1),n=Bt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=ff(o,s,e+1/3),this.g=ff(o,s,e),this.b=ff(o,s,e-1/3)}return Zn.toWorkingColorSpace(this,i),this}setStyle(e,t=et){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(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,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(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,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=et){const n=qx[e.toLowerCase()];return n!==void 0?this.setHex(n,t):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=wo(e.r),this.g=wo(e.g),this.b=wo(e.b),this}copyLinearToSRGB(e){return this.r=Qh(e.r),this.g=Qh(e.g),this.b=Qh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=et){return Zn.fromWorkingColorSpace(mn.copy(this),e),Math.round(Bt(mn.r*255,0,255))*65536+Math.round(Bt(mn.g*255,0,255))*256+Math.round(Bt(mn.b*255,0,255))}getHexString(e=et){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Zn.workingColorSpace){Zn.fromWorkingColorSpace(mn.copy(this),t);const n=mn.r,i=mn.g,s=mn.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let c,l;const u=(a+o)/2;if(a===o)c=0,l=0;else{const h=o-a;switch(l=u<=.5?h/(o+a):h/(2-o-a),o){case n:c=(i-s)/h+(i>-l-14,n[c|256]=1024>>-l-14|32768,i[c]=-l-1,i[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,i[c]=13,i[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,u=0;for(;(l&8388608)===0;)l<<=1,u-=8388608;l&=-8388609,u+=947912704,s[c]=l|u}for(let c=1024;c<2048;++c)s[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)o[c]=c<<23;o[31]=1199570944,o[32]=2147483648;for(let c=33;c<63;++c)o[c]=2147483648+(c-32<<23);o[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(a[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function Rn(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=Bt(r,-65504,65504),er.floatView[0]=r;const e=er.uint32View[0],t=e>>23&511;return er.baseTable[t]+((e&8388607)>>er.shiftTable[t])}function Ua(r){const e=r>>10;return er.uint32View[0]=er.mantissaTable[er.offsetTable[e]+(r&1023)]+er.exponentTable[e],er.floatView[0]}const qM={toHalfFloat:Rn,fromHalfFloat:Ua},jt=new G,hl=new be;class wt{constructor(e,t,n=!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=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=rc,this.updateRange={offset:0,count:-1},this.gpuType=Li,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let h=0,f=l.length;h0&&(i[c]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const l in i){const u=i[l];this.setAttribute(l,u.clone(t))}const s=e.morphAttributes;for(const l in s){const u=[],h=s[l];for(let f=0,d=h.length;f0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(p0.copy(s).invert(),Wr.copy(e.ray).applyMatrix4(p0),!(n.boundingBox!==null&&Wr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Wr)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,a=s.index,c=s.attributes.position,l=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,d=s.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,v=f.length;mt.far?null:{distance:l,point:_l.clone(),object:r}}function yl(r,e,t,n,i,s,o,a,c,l){r.getVertexPosition(a,$s),r.getVertexPosition(c,Zs),r.getVertexPosition(l,Ks);const u=tT(r,e,t,n,$s,Zs,Ks,vl);if(u){i&&(pl.fromBufferAttribute(i,a),ml.fromBufferAttribute(i,c),gl.fromBufferAttribute(i,l),u.uv=Pn.getInterpolation(vl,$s,Zs,Ks,pl,ml,gl,new be)),s&&(pl.fromBufferAttribute(s,a),ml.fromBufferAttribute(s,c),gl.fromBufferAttribute(s,l),u.uv1=Pn.getInterpolation(vl,$s,Zs,Ks,pl,ml,gl,new be),u.uv2=u.uv1),o&&(g0.fromBufferAttribute(o,a),v0.fromBufferAttribute(o,c),_0.fromBufferAttribute(o,l),u.normal=Pn.getInterpolation(vl,$s,Zs,Ks,g0,v0,_0,new G),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:c,c:l,normal:new G,materialIndex:0};Pn.getNormal($s,Zs,Ks,h.normal),u.face=h}return u}class lr extends st{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const c=[],l=[],u=[],h=[];let f=0,d=0;m("z","y","x",-1,-1,n,t,e,o,s,0),m("z","y","x",1,-1,n,t,-e,o,s,1),m("x","z","y",1,1,e,n,t,i,o,2),m("x","z","y",1,-1,e,n,-t,i,o,3),m("x","y","z",1,-1,e,t,n,i,s,4),m("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(c),this.setAttribute("position",new He(l,3)),this.setAttribute("normal",new He(u,3)),this.setAttribute("uv",new He(h,2));function m(v,g,p,_,y,x,b,w,S,M,E){const T=x/S,L=b/M,P=x/2,A=b/2,z=w/2,V=S+1,N=M+1;let C=0,O=0;const k=new G;for(let U=0;U0?1:-1,u.push(k.x,k.y,k.z),h.push(F/S),h.push(1-U/M),C+=1}}for(let U=0;U0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Pc extends gt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ke,this.projectionMatrix=new Ke,this.projectionMatrixInverse=new Ke,this.coordinateSystem=Di}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Zt extends Pc{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),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 t=.5*this.getFilmHeight()/e;this.fov=Co*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(us*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Co*2*Math.atan(Math.tan(us*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,i,s,o){this.aspect=e/t,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=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(us*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,l=o.fullHeight;s+=o.offsetX*i/c,t-=o.offsetY*n/l,i*=o.width/c,n*=o.height/l}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Js=-90,Qs=1;class jx extends gt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null;const i=new Zt(Js,Qs,e,t);i.layers=this.layers,this.add(i);const s=new Zt(Js,Qs,e,t);s.layers=this.layers,this.add(s);const o=new Zt(Js,Qs,e,t);o.layers=this.layers,this.add(o);const a=new Zt(Js,Qs,e,t);a.layers=this.layers,this.add(a);const c=new Zt(Js,Qs,e,t);c.layers=this.layers,this.add(c);const l=new Zt(Js,Qs,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,o,a,c]=t;for(const l of t)this.remove(l);if(e===Di)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===sc)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[i,s,o,a,c,l]=this.children,u=e.getRenderTarget(),h=e.toneMapping,f=e.xr.enabled;e.toneMapping=yi,e.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,c),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=f,n.texture.needsPMREMUpdate=!0}}class Lc extends Ft{constructor(e,t,n,i,s,o,a,c,l,u){e=e!==void 0?e:[],t=t!==void 0?t:Pr,super(e,t,n,i,s,o,a,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class $x extends bi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];t.encoding!==void 0&&(Va("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Ar?et:Cr),this.texture=new Lc(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Pt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - `,fragmentShader:` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - `},i=new lr(5,5,5),s=new Ni({name:"CubemapFromEquirect",uniforms:Ro(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:vn,blending:nr});s.uniforms.tEquirect.value=t;const o=new Ot(i,s),a=t.minFilter;return t.minFilter===Dr&&(t.minFilter=Pt),new jx(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}const mf=new G,sT=new G,oT=new rt;class Qi{constructor(e=new G(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=mf.subVectors(n,t).cross(sT.subVectors(e,t)).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,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(mf),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>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,t){const n=t||oT.getNormalMatrix(e),i=this.coplanarPoint(mf).applyMatrix4(e),s=this.normal.applyMatrix3(n).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 Xr=new Wn,xl=new G;class zu{constructor(e=new Qi,t=new Qi,n=new Qi,i=new Qi,s=new Qi,o=new Qi){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Di){const n=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],c=i[3],l=i[4],u=i[5],h=i[6],f=i[7],d=i[8],m=i[9],v=i[10],g=i[11],p=i[12],_=i[13],y=i[14],x=i[15];if(n[0].setComponents(c-s,f-l,g-d,x-p).normalize(),n[1].setComponents(c+s,f+l,g+d,x+p).normalize(),n[2].setComponents(c+o,f+u,g+m,x+_).normalize(),n[3].setComponents(c-o,f-u,g-m,x-_).normalize(),n[4].setComponents(c-a,f-h,g-v,x-y).normalize(),t===Di)n[5].setComponents(c+a,f+h,g+v,x+y).normalize();else if(t===sc)n[5].setComponents(a,h,v,y).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Xr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Xr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Xr)}intersectsSprite(e){return Xr.center.set(0,0,0),Xr.radius=.7071067811865476,Xr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,xl.y=i.normal.y>0?e.max.y:e.min.y,xl.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(xl)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Zx(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function aT(r,e){const t=e.isWebGL2,n=new WeakMap;function i(l,u){const h=l.array,f=l.usage,d=r.createBuffer();r.bindBuffer(u,d),r.bufferData(u,h,f),l.onUploadCallback();let m;if(h instanceof Float32Array)m=r.FLOAT;else if(h instanceof Uint16Array)if(l.isFloat16BufferAttribute)if(t)m=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else m=r.UNSIGNED_SHORT;else if(h instanceof Int16Array)m=r.SHORT;else if(h instanceof Uint32Array)m=r.UNSIGNED_INT;else if(h instanceof Int32Array)m=r.INT;else if(h instanceof Int8Array)m=r.BYTE;else if(h instanceof Uint8Array)m=r.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)m=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:d,type:m,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version}}function s(l,u,h){const f=u.array,d=u.updateRange;r.bindBuffer(h,l),d.count===-1?r.bufferSubData(h,0,f):(t?r.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f,d.offset,d.count):r.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f.subarray(d.offset,d.offset+d.count)),d.count=-1),u.onUploadCallback()}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),n.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const u=n.get(l);u&&(r.deleteBuffer(u.buffer),n.delete(l))}function c(l,u){if(l.isGLBufferAttribute){const f=n.get(l);(!f||f.version 0 - vec4 plane; - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - bool clipped = true; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; - } - #pragma unroll_loop_end - if ( clipped ) discard; - #endif -#endif`,wT=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,ST=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`,ET=`#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`,MT=`#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`,TT=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`,AT=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - varying vec3 vColor; -#endif`,CT=`#if defined( USE_COLOR_ALPHA ) - vColor = vec4( 1.0 ); -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - vColor = vec3( 1.0 ); -#endif -#ifdef USE_COLOR - vColor *= color; -#endif -#ifdef USE_INSTANCING_COLOR - vColor.xyz *= instanceColor.xyz; -#endif`,RT=`#define PI 3.141592653589793 -#define PI2 6.283185307179586 -#define PI_HALF 1.5707963267948966 -#define RECIPROCAL_PI 0.3183098861837907 -#define RECIPROCAL_PI2 0.15915494309189535 -#define EPSILON 1e-6 -#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -#define whiteComplement( a ) ( 1.0 - saturate( a ) ) -float pow2( const in float x ) { return x*x; } -vec3 pow2( const in vec3 x ) { return x*x; } -float pow3( const in float x ) { return x*x*x; } -float pow4( const in float x ) { float x2 = x*x; return x2*x2; } -float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } -float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } -highp float rand( const in vec2 uv ) { - const highp float a = 12.9898, b = 78.233, c = 43758.5453; - highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); - return fract( sin( sn ) * c ); -} -#ifdef HIGH_PRECISION - float precisionSafeLength( vec3 v ) { return length( v ); } -#else - float precisionSafeLength( vec3 v ) { - float maxComponent = max3( abs( v ) ); - return length( v / maxComponent ) * maxComponent; - } -#endif -struct IncidentLight { - vec3 color; - vec3 direction; - bool visible; -}; -struct ReflectedLight { - vec3 directDiffuse; - vec3 directSpecular; - vec3 indirectDiffuse; - vec3 indirectSpecular; -}; -struct GeometricContext { - vec3 position; - vec3 normal; - vec3 viewDir; -#ifdef USE_CLEARCOAT - vec3 clearcoatNormal; -#endif -}; -#ifdef USE_ALPHAHASH - varying vec3 vPosition; -#endif -vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); -} -vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); -} -mat3 transposeMat3( const in mat3 m ) { - mat3 tmp; - tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); - tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); - tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); - return tmp; -} -float luminance( const in vec3 rgb ) { - const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); - return dot( weights, rgb ); -} -bool isPerspectiveMatrix( mat4 m ) { - return m[ 2 ][ 3 ] == - 1.0; -} -vec2 equirectUv( in vec3 dir ) { - float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; - float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; - return vec2( u, v ); -} -vec3 BRDF_Lambert( const in vec3 diffuseColor ) { - return RECIPROCAL_PI * diffuseColor; -} -vec3 F_Schlick( const in vec3 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 ); -} -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`,PT=`#ifdef ENVMAP_TYPE_CUBE_UV - #define cubeUV_minMipLevel 4.0 - #define cubeUV_minTileSize 16.0 - float getFace( vec3 direction ) { - vec3 absDirection = abs( direction ); - float face = - 1.0; - if ( absDirection.x > absDirection.z ) { - if ( absDirection.x > absDirection.y ) - face = direction.x > 0.0 ? 0.0 : 3.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } else { - if ( absDirection.z > absDirection.y ) - face = direction.z > 0.0 ? 2.0 : 5.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } - return face; - } - vec2 getUV( vec3 direction, float face ) { - vec2 uv; - if ( face == 0.0 ) { - uv = vec2( direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 1.0 ) { - uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); - } else if ( face == 2.0 ) { - uv = vec2( - direction.x, direction.y ) / abs( direction.z ); - } else if ( face == 3.0 ) { - uv = vec2( - direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 4.0 ) { - uv = vec2( - direction.x, direction.z ) / abs( direction.y ); - } else { - uv = vec2( direction.x, direction.y ) / abs( direction.z ); - } - return 0.5 * ( uv + 1.0 ); - } - vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { - float face = getFace( direction ); - float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); - mipInt = max( mipInt, cubeUV_minMipLevel ); - float faceSize = exp2( mipInt ); - highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; - if ( face > 2.0 ) { - uv.y += faceSize; - face -= 3.0; - } - uv.x += face * faceSize; - uv.x += filterInt * 3.0 * cubeUV_minTileSize; - uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); - uv.x *= CUBEUV_TEXEL_WIDTH; - uv.y *= CUBEUV_TEXEL_HEIGHT; - #ifdef texture2DGradEXT - return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; - #else - return texture2D( envMap, uv ).rgb; - #endif - } - #define cubeUV_r0 1.0 - #define cubeUV_v0 0.339 - #define cubeUV_m0 - 2.0 - #define cubeUV_r1 0.8 - #define cubeUV_v1 0.276 - #define cubeUV_m1 - 1.0 - #define cubeUV_r4 0.4 - #define cubeUV_v4 0.046 - #define cubeUV_m4 2.0 - #define cubeUV_r5 0.305 - #define cubeUV_v5 0.016 - #define cubeUV_m5 3.0 - #define cubeUV_r6 0.21 - #define cubeUV_v6 0.0038 - #define cubeUV_m6 4.0 - float roughnessToMip( float roughness ) { - float mip = 0.0; - if ( roughness >= cubeUV_r1 ) { - mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; - } else if ( roughness >= cubeUV_r4 ) { - mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; - } else if ( roughness >= cubeUV_r5 ) { - mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; - } else if ( roughness >= cubeUV_r6 ) { - mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; - } else { - mip = - 2.0 * log2( 1.16 * roughness ); } - return mip; - } - vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { - float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); - float mipF = fract( mip ); - float mipInt = floor( mip ); - vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); - if ( mipF == 0.0 ) { - return vec4( color0, 1.0 ); - } else { - vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); - return vec4( mix( color0, color1, mipF ), 1.0 ); - } - } -#endif`,LT=`vec3 transformedNormal = objectNormal; -#ifdef USE_INSTANCING - mat3 m = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); - transformedNormal = m * transformedNormal; -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #ifdef FLIP_SIDED - transformedTangent = - transformedTangent; - #endif -#endif`,DT=`#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`,IT=`#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,UT=`#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,OT=`#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`,NT="gl_FragColor = linearToOutputTexel( gl_FragColor );",FT=`vec4 LinearToLinear( in vec4 value ) { - return value; -} -vec4 LinearTosRGB( 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 ); -}`,kT=`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vec3 cameraToFrag; - if ( isOrthographic ) { - cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToFrag = normalize( vWorldPosition - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vec3 reflectVec = reflect( cameraToFrag, worldNormal ); - #else - vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); - #endif - #else - vec3 reflectVec = vReflect; - #endif - #ifdef ENVMAP_TYPE_CUBE - vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); - #else - vec4 envColor = vec4( 0.0 ); - #endif - #ifdef ENVMAP_BLENDING_MULTIPLY - outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_MIX ) - outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_ADD ) - outgoingLight += envColor.xyz * specularStrength * reflectivity; - #endif -#endif`,zT=`#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`,BT=`#ifdef USE_ENVMAP - uniform float reflectivity; - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - varying vec3 vWorldPosition; - uniform float refractionRatio; - #else - varying vec3 vReflect; - #endif -#endif`,GT=`#ifdef USE_ENVMAP - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - - varying vec3 vWorldPosition; - #else - varying vec3 vReflect; - uniform float refractionRatio; - #endif -#endif`,VT=`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vWorldPosition = worldPosition.xyz; - #else - vec3 cameraToVertex; - if ( isOrthographic ) { - cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vReflect = reflect( cameraToVertex, worldNormal ); - #else - vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); - #endif - #endif -#endif`,HT=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,WT=`#ifdef USE_FOG - varying float vFogDepth; -#endif`,XT=`#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`,qT=`#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`,YT=`#ifdef USE_GRADIENTMAP - uniform sampler2D gradientMap; -#endif -vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { - float dotNL = dot( normal, lightDirection ); - vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); - #ifdef USE_GRADIENTMAP - return vec3( texture2D( gradientMap, coord ).r ); - #else - 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 -}`,jT=`#ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,$T=`#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`,ZT=`LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,KT=`varying vec3 vViewPosition; -struct LambertMaterial { - vec3 diffuseColor; - float specularStrength; -}; -void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,JT=`uniform bool receiveShadow; -uniform vec3 ambientLightColor; -uniform vec3 lightProbe[ 9 ]; -vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { - float x = normal.x, y = normal.y, z = normal.z; - vec3 result = shCoefficients[ 0 ] * 0.886227; - result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; - result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; - result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; - result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; - result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; - result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); - result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; - result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); - return result; -} -vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); - return irradiance; -} -vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { - vec3 irradiance = ambientLightColor; - return irradiance; -} -float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { - #if defined ( LEGACY_LIGHTS ) - if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { - return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); - } - return 1.0; - #else - float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); - if ( cutoffDistance > 0.0 ) { - distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); - } - return distanceFalloff; - #endif -} -float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { - return smoothstep( coneCosine, penumbraCosine, angleCosine ); -} -#if NUM_DIR_LIGHTS > 0 - struct DirectionalLight { - vec3 direction; - vec3 color; - }; - uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; - void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { - light.color = directionalLight.color; - light.direction = directionalLight.direction; - light.visible = true; - } -#endif -#if NUM_POINT_LIGHTS > 0 - struct PointLight { - vec3 position; - vec3 color; - float distance; - float decay; - }; - uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; - void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometry.position; - light.direction = normalize( lVector ); - float lightDistance = length( lVector ); - light.color = pointLight.color; - light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } -#endif -#if NUM_SPOT_LIGHTS > 0 - struct SpotLight { - vec3 position; - vec3 direction; - vec3 color; - float distance; - float decay; - float coneCos; - float penumbraCos; - }; - uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; - void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometry.position; - light.direction = normalize( lVector ); - float angleCos = dot( light.direction, spotLight.direction ); - float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); - if ( spotAttenuation > 0.0 ) { - float lightDistance = length( lVector ); - light.color = spotLight.color * spotAttenuation; - light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } else { - light.color = vec3( 0.0 ); - light.visible = false; - } - } -#endif -#if NUM_RECT_AREA_LIGHTS > 0 - struct RectAreaLight { - vec3 color; - vec3 position; - vec3 halfWidth; - vec3 halfHeight; - }; - uniform sampler2D ltc_1; uniform sampler2D ltc_2; - uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; -#endif -#if NUM_HEMI_LIGHTS > 0 - struct HemisphereLight { - vec3 direction; - vec3 skyColor; - vec3 groundColor; - }; - uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; - vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { - float dotNL = dot( normal, hemiLight.direction ); - float hemiDiffuseWeight = 0.5 * dotNL + 0.5; - vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); - return irradiance; - } -#endif`,QT=`#ifdef USE_ENVMAP - vec3 getIBLIrradiance( const in vec3 normal ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); - return PI * envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 reflectVec = reflect( - viewDir, normal ); - reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); - reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); - return envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - #ifdef USE_ANISOTROPY - vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 bentNormal = cross( bitangent, viewDir ); - bentNormal = normalize( cross( bentNormal, bitangent ) ); - bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); - return getIBLRadiance( viewDir, bentNormal, roughness ); - #else - return vec3( 0.0 ); - #endif - } - #endif -#endif`,eA=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,tA=`varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,nA=`BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`,iA=`varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,rA=`PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); -float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); -material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; -material.roughness = min( material.roughness, 1.0 ); -#ifdef IOR - material.ior = ior; - #ifdef USE_SPECULAR - float specularIntensityFactor = specularIntensity; - vec3 specularColorFactor = specularColor; - #ifdef USE_SPECULAR_COLORMAP - specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; - #endif - material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); - #else - float specularIntensityFactor = 1.0; - vec3 specularColorFactor = vec3( 1.0 ); - material.specularF90 = 1.0; - #endif - material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); -#else - material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); - material.specularF90 = 1.0; -#endif -#ifdef USE_CLEARCOAT - material.clearcoat = clearcoat; - material.clearcoatRoughness = clearcoatRoughness; - material.clearcoatF0 = vec3( 0.04 ); - material.clearcoatF90 = 1.0; - #ifdef USE_CLEARCOATMAP - material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; - #endif - #ifdef USE_CLEARCOAT_ROUGHNESSMAP - material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; - #endif - material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); - material.clearcoatRoughness += geometryRoughness; - material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); -#endif -#ifdef USE_IRIDESCENCE - material.iridescence = iridescence; - material.iridescenceIOR = iridescenceIOR; - #ifdef USE_IRIDESCENCEMAP - material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; - #endif - #ifdef USE_IRIDESCENCE_THICKNESSMAP - material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; - #else - material.iridescenceThickness = iridescenceThicknessMaximum; - #endif -#endif -#ifdef USE_SHEEN - material.sheenColor = sheenColor; - #ifdef USE_SHEEN_COLORMAP - material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; - #endif - material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); - #ifdef USE_SHEEN_ROUGHNESSMAP - material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; - #endif -#endif -#ifdef USE_ANISOTROPY - #ifdef USE_ANISOTROPYMAP - mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); - vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; - vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; - #else - vec2 anisotropyV = anisotropyVector; - #endif - material.anisotropy = length( anisotropyV ); - anisotropyV /= material.anisotropy; - material.anisotropy = saturate( material.anisotropy ); - 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`,sA=`struct PhysicalMaterial { - vec3 diffuseColor; - float roughness; - vec3 specularColor; - float specularF90; - #ifdef USE_CLEARCOAT - float clearcoat; - float clearcoatRoughness; - vec3 clearcoatF0; - float clearcoatF90; - #endif - #ifdef USE_IRIDESCENCE - float iridescence; - float iridescenceIOR; - float iridescenceThickness; - vec3 iridescenceFresnel; - vec3 iridescenceF0; - #endif - #ifdef USE_SHEEN - vec3 sheenColor; - float sheenRoughness; - #endif - #ifdef IOR - float ior; - #endif - #ifdef USE_TRANSMISSION - float transmission; - float transmissionAlpha; - float thickness; - float attenuationDistance; - vec3 attenuationColor; - #endif - #ifdef USE_ANISOTROPY - float anisotropy; - float alphaT; - vec3 anisotropyT; - vec3 anisotropyB; - #endif -}; -vec3 clearcoatSpecular = vec3( 0.0 ); -vec3 sheenSpecular = vec3( 0.0 ); -vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { - float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); - float x2 = x * x; - float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); - return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); -} -float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { - float a2 = pow2( alpha ); - float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); - float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); - return 0.5 / max( gv + gl, EPSILON ); -} -float D_GGX( const in float alpha, const in float dotNH ) { - float a2 = pow2( alpha ); - float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; - return RECIPROCAL_PI * a2 / pow2( denom ); -} -#ifdef USE_ANISOTROPY - float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { - float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); - float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); - float v = 0.5 / ( gv + gl ); - return saturate(v); - } - float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { - float a2 = alphaT * alphaB; - highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); - highp float v2 = dot( v, v ); - float w2 = a2 / v2; - return RECIPROCAL_PI * a2 * pow2 ( w2 ); - } -#endif -#ifdef USE_CLEARCOAT - vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { - vec3 f0 = material.clearcoatF0; - float f90 = material.clearcoatF90; - float roughness = material.clearcoatRoughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - return F * ( V * D ); - } -#endif -vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { - vec3 f0 = material.specularColor; - float f90 = material.specularF90; - float roughness = material.roughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - #ifdef USE_IRIDESCENCE - F = mix( F, material.iridescenceFresnel, material.iridescence ); - #endif - #ifdef USE_ANISOTROPY - float dotTL = dot( material.anisotropyT, lightDir ); - float dotTV = dot( material.anisotropyT, viewDir ); - float dotTH = dot( material.anisotropyT, halfDir ); - float dotBL = dot( material.anisotropyB, lightDir ); - float dotBV = dot( material.anisotropyB, viewDir ); - float dotBH = dot( material.anisotropyB, halfDir ); - float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); - float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); - #else - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - #endif - return F * ( V * D ); -} -vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { - const float LUT_SIZE = 64.0; - const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; - const float LUT_BIAS = 0.5 / LUT_SIZE; - float dotNV = saturate( dot( N, V ) ); - vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); - uv = uv * LUT_SCALE + LUT_BIAS; - return uv; -} -float LTC_ClippedSphereFormFactor( const in vec3 f ) { - float l = length( f ); - return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); -} -vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { - float x = dot( v1, v2 ); - float y = abs( x ); - float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; - float b = 3.4175940 + ( 4.1616724 + y ) * y; - float v = a / b; - float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; - return cross( v1, v2 ) * theta_sintheta; -} -vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { - vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; - vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; - vec3 lightNormal = cross( v1, v2 ); - if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); - vec3 T1, T2; - T1 = normalize( V - N * dot( V, N ) ); - T2 = - cross( N, T1 ); - mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); - vec3 coords[ 4 ]; - coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); - coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); - coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); - coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); - coords[ 0 ] = normalize( coords[ 0 ] ); - coords[ 1 ] = normalize( coords[ 1 ] ); - coords[ 2 ] = normalize( coords[ 2 ] ); - coords[ 3 ] = normalize( coords[ 3 ] ); - vec3 vectorFormFactor = vec3( 0.0 ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); - float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); - return vec3( result ); -} -#if defined( USE_SHEEN ) -float D_Charlie( float roughness, float dotNH ) { - float alpha = pow2( roughness ); - float invAlpha = 1.0 / alpha; - float cos2h = dotNH * dotNH; - float sin2h = max( 1.0 - cos2h, 0.0078125 ); - return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); -} -float V_Neubelt( float dotNV, float dotNL ) { - return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); -} -vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float D = D_Charlie( sheenRoughness, dotNH ); - float V = V_Neubelt( dotNV, dotNL ); - return sheenColor * ( D * V ); -} -#endif -float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - float r2 = roughness * roughness; - float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; - float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; - float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); - return saturate( DG * RECIPROCAL_PI ); -} -vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); - const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); - vec4 r = roughness * c0 + c1; - float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; - vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; - return fab; -} -vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { - vec2 fab = DFGApprox( normal, viewDir, roughness ); - return specularColor * fab.x + specularF90 * fab.y; -} -#ifdef USE_IRIDESCENCE -void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#else -void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#endif - vec2 fab = DFGApprox( normal, viewDir, roughness ); - #ifdef USE_IRIDESCENCE - vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); - #else - vec3 Fr = specularColor; - #endif - vec3 FssEss = Fr * fab.x + specularF90 * fab.y; - float Ess = fab.x + fab.y; - float Ems = 1.0 - Ess; - vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); - singleScatter += FssEss; - multiScatter += Fms * Ems; -} -#if NUM_RECT_AREA_LIGHTS > 0 - void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometry.normal; - vec3 viewDir = geometry.viewDir; - vec3 position = geometry.position; - vec3 lightPos = rectAreaLight.position; - vec3 halfWidth = rectAreaLight.halfWidth; - vec3 halfHeight = rectAreaLight.halfHeight; - vec3 lightColor = rectAreaLight.color; - float roughness = material.roughness; - vec3 rectCoords[ 4 ]; - rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; - rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; - rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; - vec2 uv = LTC_Uv( normal, viewDir, roughness ); - vec4 t1 = texture2D( ltc_1, uv ); - vec4 t2 = texture2D( ltc_2, uv ); - mat3 mInv = mat3( - vec3( t1.x, 0, t1.y ), - vec3( 0, 1, 0 ), - vec3( t1.z, 0, t1.w ) - ); - vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); - reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); - reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); - } -#endif -void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); - #endif - reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material ); - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); - #endif - vec3 singleScattering = vec3( 0.0 ); - vec3 multiScattering = vec3( 0.0 ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); - #else - computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); - #endif - vec3 totalScattering = singleScattering + multiScattering; - vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); - reflectedLight.indirectSpecular += radiance * singleScattering; - reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; - reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; -} -#define RE_Direct RE_Direct_Physical -#define RE_Direct_RectArea RE_Direct_RectArea_Physical -#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical -#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 ); -}`,oA=` -GeometricContext geometry; -geometry.position = - vViewPosition; -geometry.normal = normal; -geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -#ifdef USE_CLEARCOAT - geometry.clearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometry.viewDir ) ); - if ( material.iridescenceThickness == 0.0 ) { - material.iridescence = 0.0; - } else { - material.iridescence = saturate( material.iridescence ); - } - if ( material.iridescence > 0.0 ) { - material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); - material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); - } -#endif -IncidentLight directLight; -#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) - PointLight pointLight; - #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - pointLight = pointLights[ i ]; - getPointLightInfo( pointLight, geometry, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - pointLightShadow = pointLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - RE_Direct( directLight, geometry, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - SpotLight spotLight; - vec4 spotColor; - vec3 spotLightCoord; - bool inSpotLightMap; - #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - spotLight = spotLights[ i ]; - getSpotLightInfo( spotLight, geometry, directLight ); - #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX - #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS - #else - #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #endif - #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) - spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; - inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); - spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); - directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; - #endif - #undef SPOT_LIGHT_MAP_INDEX - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometry, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) - DirectionalLight directionalLight; - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, geometry, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometry, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) - RectAreaLight rectAreaLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { - rectAreaLight = rectAreaLights[ i ]; - RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); - } - #pragma unroll_loop_end - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,aA=`#if defined( RE_IndirectDiffuse ) - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - irradiance += lightMapIrradiance; - #endif - #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) - iblIrradiance += getIBLIrradiance( geometry.normal ); - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - #ifdef USE_ANISOTROPY - radiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy ); - #else - radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); - #endif - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`,cA=`#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); -#endif`,lA=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,uA=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`,hA=`#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - varying float vFragDepth; - varying float vIsPerspective; - #else - uniform float logDepthBufFC; - #endif -#endif`,fA=`#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - vFragDepth = 1.0 + gl_Position.w; - vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); - #else - if ( isPerspectiveMatrix( projectionMatrix ) ) { - gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; - gl_Position.z *= gl_Position.w; - } - #endif -#endif`,dA=`#ifdef USE_MAP - diffuseColor *= texture2D( map, vMapUv ); -#endif`,pA=`#ifdef USE_MAP - uniform sampler2D map; -#endif`,mA=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - #if defined( USE_POINTS_UV ) - vec2 uv = vUv; - #else - vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; - #endif -#endif -#ifdef USE_MAP - diffuseColor *= texture2D( map, uv ); -#endif -#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,gA=`#if defined( USE_POINTS_UV ) - varying vec2 vUv; -#else - #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - uniform mat3 uvTransform; - #endif -#endif -#ifdef USE_MAP - uniform sampler2D map; -#endif -#ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; -#endif`,vA=`float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`,_A=`#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`,yA=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) - vColor *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - #if defined( USE_COLOR_ALPHA ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; - #elif defined( USE_COLOR ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; - #endif - } -#endif`,xA=`#ifdef USE_MORPHNORMALS - objectNormal *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; - } - #else - objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; - objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; - objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; - objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; - #endif -#endif`,bA=`#ifdef USE_MORPHTARGETS - uniform float morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - uniform sampler2DArray morphTargetsTexture; - uniform ivec2 morphTargetsTextureSize; - vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { - int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; - int y = texelIndex / morphTargetsTextureSize.x; - int x = texelIndex - y * morphTargetsTextureSize.x; - ivec3 morphUV = ivec3( x, y, morphTargetIndex ); - return texelFetch( morphTargetsTexture, morphUV, 0 ); - } - #else - #ifndef USE_MORPHNORMALS - uniform float morphTargetInfluences[ 8 ]; - #else - uniform float morphTargetInfluences[ 4 ]; - #endif - #endif -#endif`,wA=`#ifdef USE_MORPHTARGETS - transformed *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; - } - #else - transformed += morphTarget0 * morphTargetInfluences[ 0 ]; - transformed += morphTarget1 * morphTargetInfluences[ 1 ]; - transformed += morphTarget2 * morphTargetInfluences[ 2 ]; - transformed += morphTarget3 * morphTargetInfluences[ 3 ]; - #ifndef USE_MORPHNORMALS - transformed += morphTarget4 * morphTargetInfluences[ 4 ]; - transformed += morphTarget5 * morphTargetInfluences[ 5 ]; - transformed += morphTarget6 * morphTargetInfluences[ 6 ]; - transformed += morphTarget7 * morphTargetInfluences[ 7 ]; - #endif - #endif -#endif`,SA=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; -#ifdef FLAT_SHADED - vec3 fdx = dFdx( vViewPosition ); - vec3 fdy = dFdy( vViewPosition ); - vec3 normal = normalize( cross( fdx, fdy ) ); -#else - vec3 normal = normalize( vNormal ); - #ifdef DOUBLE_SIDED - normal *= faceDirection; - #endif -#endif -#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) - #ifdef USE_TANGENT - mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn = getTangentFrame( - vViewPosition, normal, - #if defined( USE_NORMALMAP ) - vNormalMapUv - #elif defined( USE_CLEARCOAT_NORMALMAP ) - vClearcoatNormalMapUv - #else - vUv - #endif - ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn[0] *= faceDirection; - tbn[1] *= faceDirection; - #endif -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - #ifdef USE_TANGENT - mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn2[0] *= faceDirection; - tbn2[1] *= faceDirection; - #endif -#endif -vec3 geometryNormal = normal;`,EA=`#ifdef USE_NORMALMAP_OBJECTSPACE - normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - #ifdef FLIP_SIDED - normal = - normal; - #endif - #ifdef DOUBLE_SIDED - normal = normal * faceDirection; - #endif - normal = normalize( normalMatrix * normal ); -#elif defined( USE_NORMALMAP_TANGENTSPACE ) - vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - mapN.xy *= normalScale; - normal = normalize( tbn * mapN ); -#elif defined( USE_BUMPMAP ) - normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,MA=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,TA=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,AA=`#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`,CA=`#ifdef USE_NORMALMAP - uniform sampler2D normalMap; - uniform vec2 normalScale; -#endif -#ifdef USE_NORMALMAP_OBJECTSPACE - uniform mat3 normalMatrix; -#endif -#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) - mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { - vec3 q0 = dFdx( eye_pos.xyz ); - vec3 q1 = dFdy( eye_pos.xyz ); - vec2 st0 = dFdx( uv.st ); - vec2 st1 = dFdy( uv.st ); - vec3 N = surf_norm; - vec3 q1perp = cross( q1, N ); - vec3 q0perp = cross( N, q0 ); - vec3 T = q1perp * st0.x + q0perp * st1.x; - vec3 B = q1perp * st0.y + q0perp * st1.y; - float det = max( dot( T, T ), dot( B, B ) ); - float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); - return mat3( T * scale, B * scale, N ); - } -#endif`,RA=`#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = geometryNormal; -#endif`,PA=`#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,LA=`#ifdef USE_CLEARCOATMAP - uniform sampler2D clearcoatMap; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform sampler2D clearcoatNormalMap; - uniform vec2 clearcoatNormalScale; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform sampler2D clearcoatRoughnessMap; -#endif`,DA=`#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`,IA=`#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,UA=`vec3 packNormalToRGB( const in vec3 normal ) { - return normalize( normal ) * 0.5 + 0.5; -} -vec3 unpackRGBToNormal( const in vec3 rgb ) { - return 2.0 * rgb.xyz - 1.0; -} -const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; -const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); -const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); -const float ShiftRight8 = 1. / 256.; -vec4 packDepthToRGBA( const in float v ) { - vec4 r = vec4( fract( v * PackFactors ), v ); - r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; -} -float unpackRGBAToDepth( const in vec4 v ) { - return dot( v, UnpackFactors ); -} -vec2 packDepthToRG( in highp float v ) { - return packDepthToRGBA( v ).yx; -} -float unpackRGToDepth( const in highp vec2 v ) { - return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); -} -vec4 pack2HalfToRGBA( vec2 v ) { - vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); - return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); -} -vec2 unpackRGBATo2Half( vec4 v ) { - return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); -} -float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { - return ( viewZ + near ) / ( near - far ); -} -float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { - return depth * ( near - far ) - near; -} -float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { - return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); -} -float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { - return ( near * far ) / ( ( far - near ) * depth - far ); -}`,OA=`#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`,NA=`vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,FA=`#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,kA=`#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`,zA=`float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`,BA=`#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`,GA=`#if NUM_SPOT_LIGHT_COORDS > 0 - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#if NUM_SPOT_LIGHT_MAPS > 0 - uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; - struct SpotLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif - float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { - return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); - } - vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { - return unpackRGBATo2Half( texture2D( shadow, uv ) ); - } - float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ - float occlusion = 1.0; - vec2 distribution = texture2DDistribution( shadow, uv ); - float hard_shadow = step( compare , distribution.x ); - if (hard_shadow != 1.0 ) { - float distance = compare - distribution.x ; - float variance = max( 0.00000, distribution.y * distribution.y ); - float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); - } - return occlusion; - } - float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - shadowCoord.z += shadowBias; - bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; - bool frustumTest = inFrustum && shadowCoord.z <= 1.0; - if ( frustumTest ) { - #if defined( SHADOWMAP_TYPE_PCF ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx0 = - texelSize.x * shadowRadius; - float dy0 = - texelSize.y * shadowRadius; - float dx1 = + texelSize.x * shadowRadius; - float dy1 = + texelSize.y * shadowRadius; - float dx2 = dx0 / 2.0; - float dy2 = dy0 / 2.0; - float dx3 = dx1 / 2.0; - float dy3 = dy1 / 2.0; - shadow = ( - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) - ) * ( 1.0 / 17.0 ); - #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx = texelSize.x; - float dy = texelSize.y; - vec2 uv = shadowCoord.xy; - vec2 f = fract( uv * shadowMapSize + 0.5 ); - uv -= f * texelSize; - shadow = ( - texture2DCompare( shadowMap, uv, shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), - f.x ), - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), - f.x ), - f.y ) - ) * ( 1.0 / 9.0 ); - #elif defined( SHADOWMAP_TYPE_VSM ) - shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); - #else - shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); - #endif - } - return shadow; - } - vec2 cubeToUV( vec3 v, float texelSizeY ) { - vec3 absV = abs( v ); - float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); - absV *= scaleToCube; - v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); - vec2 planar = v.xy; - float almostATexel = 1.5 * texelSizeY; - float almostOne = 1.0 - almostATexel; - if ( absV.z >= almostOne ) { - if ( v.z > 0.0 ) - planar.x = 4.0 - v.x; - } else if ( absV.x >= almostOne ) { - float signX = sign( v.x ); - planar.x = v.z * signX + 2.0 * signX; - } else if ( absV.y >= almostOne ) { - float signY = sign( v.y ); - planar.x = v.x + 2.0 * signY + 2.0; - planar.y = v.z * signY - 2.0; - } - return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); - } - float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); - vec3 lightToPosition = shadowCoord.xyz; - float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; - vec3 bd3D = normalize( lightToPosition ); - #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) - vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; - return ( - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) - ) * ( 1.0 / 9.0 ); - #else - return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); - #endif - } -#endif`,VA=`#if NUM_SPOT_LIGHT_COORDS > 0 - uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - struct SpotLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif -#endif`,HA=`#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 -#if defined( USE_SHADOWMAP ) - #if NUM_DIR_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); - vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); - vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif -#endif -#if NUM_SPOT_LIGHT_COORDS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { - shadowWorldPosition = worldPosition; - #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; - #endif - vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end -#endif`,WA=`float getShadowMask() { - float shadow = 1.0; - #ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - directionalLight = directionalLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { - spotLight = spotLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - pointLight = pointLightShadows[ i ]; - shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; - } - #pragma unroll_loop_end - #endif - #endif - return shadow; -}`,XA=`#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,qA=`#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - uniform int boneTextureSize; - mat4 getBoneMatrix( const in float i ) { - float j = i * 4.0; - float x = mod( j, float( boneTextureSize ) ); - float y = floor( j / float( boneTextureSize ) ); - float dx = 1.0 / float( boneTextureSize ); - float dy = 1.0 / float( boneTextureSize ); - y = dy * ( y + 0.5 ); - vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); - vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); - vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); - vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); - mat4 bone = mat4( v1, v2, v3, v4 ); - return bone; - } -#endif`,YA=`#ifdef USE_SKINNING - vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); - vec4 skinned = vec4( 0.0 ); - skinned += boneMatX * skinVertex * skinWeight.x; - skinned += boneMatY * skinVertex * skinWeight.y; - skinned += boneMatZ * skinVertex * skinWeight.z; - skinned += boneMatW * skinVertex * skinWeight.w; - transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,jA=`#ifdef USE_SKINNING - mat4 skinMatrix = mat4( 0.0 ); - skinMatrix += skinWeight.x * boneMatX; - skinMatrix += skinWeight.y * boneMatY; - skinMatrix += skinWeight.z * boneMatZ; - skinMatrix += skinWeight.w * boneMatW; - skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; - objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; - #ifdef USE_TANGENT - objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #endif -#endif`,$A=`float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`,ZA=`#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`,KA=`#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,JA=`#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -uniform float toneMappingExposure; -vec3 LinearToneMapping( vec3 color ) { - return saturate( toneMappingExposure * color ); -} -vec3 ReinhardToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( color / ( vec3( 1.0 ) + color ) ); -} -vec3 OptimizedCineonToneMapping( vec3 color ) { - color *= toneMappingExposure; - color = max( vec3( 0.0 ), color - 0.004 ); - return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); -} -vec3 RRTAndODTFit( vec3 v ) { - vec3 a = v * ( v + 0.0245786 ) - 0.000090537; - vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; - return a / b; -} -vec3 ACESFilmicToneMapping( vec3 color ) { - const mat3 ACESInputMat = mat3( - vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), - vec3( 0.04823, 0.01566, 0.83777 ) - ); - const mat3 ACESOutputMat = mat3( - vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), - vec3( -0.07367, -0.00605, 1.07602 ) - ); - color *= toneMappingExposure / 0.6; - color = ACESInputMat * color; - color = RRTAndODTFit( color ); - color = ACESOutputMat * color; - return saturate( color ); -} -vec3 CustomToneMapping( vec3 color ) { return color; }`,QA=`#ifdef USE_TRANSMISSION - material.transmission = transmission; - material.transmissionAlpha = 1.0; - material.thickness = thickness; - material.attenuationDistance = attenuationDistance; - material.attenuationColor = attenuationColor; - #ifdef USE_TRANSMISSIONMAP - material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; - #endif - #ifdef USE_THICKNESSMAP - material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; - #endif - vec3 pos = vWorldPosition; - vec3 v = normalize( cameraPosition - pos ); - vec3 n = inverseTransformDirection( normal, viewMatrix ); - vec4 transmitted = getIBLVolumeRefraction( - n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, - pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, - material.attenuationColor, material.attenuationDistance ); - material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); - totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,e2=`#ifdef USE_TRANSMISSION - uniform float transmission; - uniform float thickness; - uniform float attenuationDistance; - uniform vec3 attenuationColor; - #ifdef USE_TRANSMISSIONMAP - uniform sampler2D transmissionMap; - #endif - #ifdef USE_THICKNESSMAP - uniform sampler2D thicknessMap; - #endif - uniform vec2 transmissionSamplerSize; - uniform sampler2D transmissionSamplerMap; - uniform mat4 modelMatrix; - uniform mat4 projectionMatrix; - varying vec3 vWorldPosition; - float w0( float a ) { - return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); - } - float w1( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); - } - float w2( float a ){ - return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); - } - float w3( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * a ); - } - float g0( float a ) { - return w0( a ) + w1( a ); - } - float g1( float a ) { - return w2( a ) + w3( a ); - } - float h0( float a ) { - return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); - } - float h1( float a ) { - return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); - } - vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { - uv = uv * texelSize.zw + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); - float g0x = g0( fuv.x ); - float g1x = g1( fuv.x ); - float h0x = h0( fuv.x ); - float h1x = h1( fuv.x ); - float h0y = h0( fuv.y ); - float h1y = h1( fuv.y ); - vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + - g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); - } - vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { - vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); - vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); - vec2 fLodSizeInv = 1.0 / fLodSize; - vec2 cLodSizeInv = 1.0 / cLodSize; - vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); - vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); - return mix( fSample, cSample, fract( lod ) ); - } - vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { - vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); - vec3 modelScale; - modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); - modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); - modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); - return normalize( refractionVector ) * thickness * modelScale; - } - float applyIorToRoughness( const in float roughness, const in float ior ) { - return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); - } - vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { - float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); - return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); - } - vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { - if ( isinf( attenuationDistance ) ) { - return vec3( 1.0 ); - } else { - vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; - vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; - } - } - vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, - const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, - const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, - const in vec3 attenuationColor, const in float attenuationDistance ) { - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); - vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); - vec3 attenuatedColor = transmittance * transmittedLight.rgb; - vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); - float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; - return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); - } -#endif`,t2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - varying vec2 vNormalMapUv; -#endif -#ifdef USE_EMISSIVEMAP - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_SPECULARMAP - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,n2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - uniform mat3 mapTransform; - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - uniform mat3 alphaMapTransform; - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - uniform mat3 lightMapTransform; - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - uniform mat3 aoMapTransform; - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - uniform mat3 bumpMapTransform; - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - uniform mat3 normalMapTransform; - varying vec2 vNormalMapUv; -#endif -#ifdef USE_DISPLACEMENTMAP - uniform mat3 displacementMapTransform; - varying vec2 vDisplacementMapUv; -#endif -#ifdef USE_EMISSIVEMAP - uniform mat3 emissiveMapTransform; - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - uniform mat3 metalnessMapTransform; - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - uniform mat3 roughnessMapTransform; - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - uniform mat3 anisotropyMapTransform; - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - uniform mat3 clearcoatMapTransform; - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform mat3 clearcoatNormalMapTransform; - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform mat3 clearcoatRoughnessMapTransform; - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - uniform mat3 sheenColorMapTransform; - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - uniform mat3 sheenRoughnessMapTransform; - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - uniform mat3 iridescenceMapTransform; - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform mat3 iridescenceThicknessMapTransform; - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SPECULARMAP - uniform mat3 specularMapTransform; - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - uniform mat3 specularColorMapTransform; - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - uniform mat3 specularIntensityMapTransform; - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,i2=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - vUv = vec3( uv, 1 ).xy; -#endif -#ifdef USE_MAP - vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ALPHAMAP - vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_LIGHTMAP - vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_AOMAP - vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_BUMPMAP - vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_NORMALMAP - vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_DISPLACEMENTMAP - vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_EMISSIVEMAP - vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_METALNESSMAP - vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ROUGHNESSMAP - vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ANISOTROPYMAP - vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOATMAP - vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCEMAP - vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_COLORMAP - vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULARMAP - vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_COLORMAP - vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_TRANSMISSIONMAP - vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_THICKNESSMAP - vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,r2=`#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_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`;const s2=`varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,o2=`uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,a2=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,c2=`#ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; -#elif defined( ENVMAP_TYPE_CUBE_UV ) - uniform sampler2D envMap; -#endif -uniform float flipEnvMap; -uniform float backgroundBlurriness; -uniform float backgroundIntensity; -varying vec3 vWorldDirection; -#include -void main() { - #ifdef ENVMAP_TYPE_CUBE - vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); - #elif defined( ENVMAP_TYPE_CUBE_UV ) - vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); - #else - vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,l2=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,u2=`uniform samplerCube tCube; -uniform float tFlip; -uniform float opacity; -varying vec3 vWorldDirection; -void main() { - vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); - gl_FragColor = texColor; - gl_FragColor.a *= opacity; - #include - #include -}`,h2=`#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`,f2=`#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - vec4 diffuseColor = vec4( 1.0 ); - #if DEPTH_PACKING == 3200 - diffuseColor.a = opacity; - #endif - #include - #include - #include - #include - #include - float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; - #if DEPTH_PACKING == 3200 - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); - #elif DEPTH_PACKING == 3201 - gl_FragColor = packDepthToRGBA( fragCoordZ ); - #endif -}`,d2=`#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`,p2=`#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -#include -void main () { - #include - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`,m2=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`,g2=`uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`,v2=`uniform float scale; -attribute float lineDistance; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vLineDistance = scale * lineDistance; - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,_2=`uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,y2=`#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,x2=`uniform vec3 diffuse; -uniform float opacity; -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; - #else - reflectedLight.indirectDiffuse += vec3( 1.0 ); - #endif - #include - reflectedLight.indirectDiffuse *= diffuseColor.rgb; - vec3 outgoingLight = reflectedLight.indirectDiffuse; - #include - #include - #include - #include - #include - #include - #include -}`,b2=`#define LAMBERT -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,w2=`#define LAMBERT -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,S2=`#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; -}`,E2=`#define MATCAP -uniform vec3 diffuse; -uniform float opacity; -uniform sampler2D matcap; -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - vec3 viewDir = normalize( vViewPosition ); - vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); - vec3 y = cross( viewDir, x ); - vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; - #ifdef USE_MATCAP - vec4 matcapColor = texture2D( matcap, uv ); - #else - vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); - #endif - vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; - #include - #include - #include - #include - #include - #include -}`,M2=`#define NORMAL -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - vViewPosition = - mvPosition.xyz; -#endif -}`,T2=`#define NORMAL -uniform float opacity; -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`,A2=`#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,C2=`#define PHONG -uniform vec3 diffuse; -uniform vec3 emissive; -uniform vec3 specular; -uniform float shininess; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,R2=`#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`,P2=`#define STANDARD -#ifdef PHYSICAL - #define IOR - #define USE_SPECULAR -#endif -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float roughness; -uniform float metalness; -uniform float opacity; -#ifdef IOR - uniform float ior; -#endif -#ifdef USE_SPECULAR - uniform float specularIntensity; - uniform vec3 specularColor; - #ifdef USE_SPECULAR_COLORMAP - uniform sampler2D specularColorMap; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - uniform sampler2D specularIntensityMap; - #endif -#endif -#ifdef USE_CLEARCOAT - uniform float clearcoat; - uniform float clearcoatRoughness; -#endif -#ifdef USE_IRIDESCENCE - uniform float iridescence; - uniform float iridescenceIOR; - uniform float iridescenceThicknessMinimum; - uniform float iridescenceThicknessMaximum; -#endif -#ifdef USE_SHEEN - uniform vec3 sheenColor; - uniform float sheenRoughness; - #ifdef USE_SHEEN_COLORMAP - uniform sampler2D sheenColorMap; - #endif - #ifdef USE_SHEEN_ROUGHNESSMAP - uniform sampler2D sheenRoughnessMap; - #endif -#endif -#ifdef USE_ANISOTROPY - uniform vec2 anisotropyVector; - #ifdef USE_ANISOTROPYMAP - uniform sampler2D anisotropyMap; - #endif -#endif -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; - #include - vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; - #ifdef USE_SHEEN - float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); - outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`,L2=`#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`,D2=`#define TOON -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`,I2=`uniform float size; -uniform float scale; -#include -#include -#include -#include -#include -#include -#ifdef USE_POINTS_UV - varying vec2 vUv; - uniform mat3 uvTransform; -#endif -void main() { - #ifdef USE_POINTS_UV - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - #endif - #include - #include - #include - #include - #include - gl_PointSize = size; - #ifdef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); - #endif - #include - #include - #include - #include -}`,U2=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,O2=`#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,N2=`uniform vec3 color; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); - #include - #include - #include -}`,F2=`uniform float rotation; -uniform vec2 center; -#include -#include -#include -#include -#include -void main() { - #include - vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); - vec2 scale; - scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); - scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); - #ifndef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - #endif - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - gl_Position = projectionMatrix * mvPosition; - #include - #include - #include -}`,k2=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`,Qe={alphahash_fragment:cT,alphahash_pars_fragment:lT,alphamap_fragment:uT,alphamap_pars_fragment:hT,alphatest_fragment:fT,alphatest_pars_fragment:dT,aomap_fragment:pT,aomap_pars_fragment:mT,begin_vertex:gT,beginnormal_vertex:vT,bsdfs:_T,iridescence_fragment:yT,bumpmap_pars_fragment:xT,clipping_planes_fragment:bT,clipping_planes_pars_fragment:wT,clipping_planes_pars_vertex:ST,clipping_planes_vertex:ET,color_fragment:MT,color_pars_fragment:TT,color_pars_vertex:AT,color_vertex:CT,common:RT,cube_uv_reflection_fragment:PT,defaultnormal_vertex:LT,displacementmap_pars_vertex:DT,displacementmap_vertex:IT,emissivemap_fragment:UT,emissivemap_pars_fragment:OT,colorspace_fragment:NT,colorspace_pars_fragment:FT,envmap_fragment:kT,envmap_common_pars_fragment:zT,envmap_pars_fragment:BT,envmap_pars_vertex:GT,envmap_physical_pars_fragment:QT,envmap_vertex:VT,fog_vertex:HT,fog_pars_vertex:WT,fog_fragment:XT,fog_pars_fragment:qT,gradientmap_pars_fragment:YT,lightmap_fragment:jT,lightmap_pars_fragment:$T,lights_lambert_fragment:ZT,lights_lambert_pars_fragment:KT,lights_pars_begin:JT,lights_toon_fragment:eA,lights_toon_pars_fragment:tA,lights_phong_fragment:nA,lights_phong_pars_fragment:iA,lights_physical_fragment:rA,lights_physical_pars_fragment:sA,lights_fragment_begin:oA,lights_fragment_maps:aA,lights_fragment_end:cA,logdepthbuf_fragment:lA,logdepthbuf_pars_fragment:uA,logdepthbuf_pars_vertex:hA,logdepthbuf_vertex:fA,map_fragment:dA,map_pars_fragment:pA,map_particle_fragment:mA,map_particle_pars_fragment:gA,metalnessmap_fragment:vA,metalnessmap_pars_fragment:_A,morphcolor_vertex:yA,morphnormal_vertex:xA,morphtarget_pars_vertex:bA,morphtarget_vertex:wA,normal_fragment_begin:SA,normal_fragment_maps:EA,normal_pars_fragment:MA,normal_pars_vertex:TA,normal_vertex:AA,normalmap_pars_fragment:CA,clearcoat_normal_fragment_begin:RA,clearcoat_normal_fragment_maps:PA,clearcoat_pars_fragment:LA,iridescence_pars_fragment:DA,opaque_fragment:IA,packing:UA,premultiplied_alpha_fragment:OA,project_vertex:NA,dithering_fragment:FA,dithering_pars_fragment:kA,roughnessmap_fragment:zA,roughnessmap_pars_fragment:BA,shadowmap_pars_fragment:GA,shadowmap_pars_vertex:VA,shadowmap_vertex:HA,shadowmask_pars_fragment:WA,skinbase_vertex:XA,skinning_pars_vertex:qA,skinning_vertex:YA,skinnormal_vertex:jA,specularmap_fragment:$A,specularmap_pars_fragment:ZA,tonemapping_fragment:KA,tonemapping_pars_fragment:JA,transmission_fragment:QA,transmission_pars_fragment:e2,uv_pars_fragment:t2,uv_pars_vertex:n2,uv_vertex:i2,worldpos_vertex:r2,background_vert:s2,background_frag:o2,backgroundCube_vert:a2,backgroundCube_frag:c2,cube_vert:l2,cube_frag:u2,depth_vert:h2,depth_frag:f2,distanceRGBA_vert:d2,distanceRGBA_frag:p2,equirect_vert:m2,equirect_frag:g2,linedashed_vert:v2,linedashed_frag:_2,meshbasic_vert:y2,meshbasic_frag:x2,meshlambert_vert:b2,meshlambert_frag:w2,meshmatcap_vert:S2,meshmatcap_frag:E2,meshnormal_vert:M2,meshnormal_frag:T2,meshphong_vert:A2,meshphong_frag:C2,meshphysical_vert:R2,meshphysical_frag:P2,meshtoon_vert:L2,meshtoon_frag:D2,points_vert:I2,points_frag:U2,shadow_vert:O2,shadow_frag:N2,sprite_vert:F2,sprite_frag:k2},ke={common:{diffuse:{value:new Ne(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new rt},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new rt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new rt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new rt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new rt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new rt},normalScale:{value:new be(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new rt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new rt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new rt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new rt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ne(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 Ne(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0},uvTransform:{value:new rt}},sprite:{diffuse:{value:new Ne(16777215)},opacity:{value:1},center:{value:new be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new rt},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0}}},gi={basic:{uniforms:bn([ke.common,ke.specularmap,ke.envmap,ke.aomap,ke.lightmap,ke.fog]),vertexShader:Qe.meshbasic_vert,fragmentShader:Qe.meshbasic_frag},lambert:{uniforms:bn([ke.common,ke.specularmap,ke.envmap,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.fog,ke.lights,{emissive:{value:new Ne(0)}}]),vertexShader:Qe.meshlambert_vert,fragmentShader:Qe.meshlambert_frag},phong:{uniforms:bn([ke.common,ke.specularmap,ke.envmap,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.fog,ke.lights,{emissive:{value:new Ne(0)},specular:{value:new Ne(1118481)},shininess:{value:30}}]),vertexShader:Qe.meshphong_vert,fragmentShader:Qe.meshphong_frag},standard:{uniforms:bn([ke.common,ke.envmap,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.roughnessmap,ke.metalnessmap,ke.fog,ke.lights,{emissive:{value:new Ne(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag},toon:{uniforms:bn([ke.common,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.gradientmap,ke.fog,ke.lights,{emissive:{value:new Ne(0)}}]),vertexShader:Qe.meshtoon_vert,fragmentShader:Qe.meshtoon_frag},matcap:{uniforms:bn([ke.common,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.fog,{matcap:{value:null}}]),vertexShader:Qe.meshmatcap_vert,fragmentShader:Qe.meshmatcap_frag},points:{uniforms:bn([ke.points,ke.fog]),vertexShader:Qe.points_vert,fragmentShader:Qe.points_frag},dashed:{uniforms:bn([ke.common,ke.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qe.linedashed_vert,fragmentShader:Qe.linedashed_frag},depth:{uniforms:bn([ke.common,ke.displacementmap]),vertexShader:Qe.depth_vert,fragmentShader:Qe.depth_frag},normal:{uniforms:bn([ke.common,ke.bumpmap,ke.normalmap,ke.displacementmap,{opacity:{value:1}}]),vertexShader:Qe.meshnormal_vert,fragmentShader:Qe.meshnormal_frag},sprite:{uniforms:bn([ke.sprite,ke.fog]),vertexShader:Qe.sprite_vert,fragmentShader:Qe.sprite_frag},background:{uniforms:{uvTransform:{value:new rt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Qe.background_vert,fragmentShader:Qe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Qe.backgroundCube_vert,fragmentShader:Qe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Qe.cube_vert,fragmentShader:Qe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qe.equirect_vert,fragmentShader:Qe.equirect_frag},distanceRGBA:{uniforms:bn([ke.common,ke.displacementmap,{referencePosition:{value:new G},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qe.distanceRGBA_vert,fragmentShader:Qe.distanceRGBA_frag},shadow:{uniforms:bn([ke.lights,ke.fog,{color:{value:new Ne(0)},opacity:{value:1}}]),vertexShader:Qe.shadow_vert,fragmentShader:Qe.shadow_frag}};gi.physical={uniforms:bn([gi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new rt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new rt},clearcoatNormalScale:{value:new be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new rt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new rt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new rt},sheen:{value:0},sheenColor:{value:new Ne(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new rt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new rt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new rt},transmissionSamplerSize:{value:new be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new rt},attenuationDistance:{value:0},attenuationColor:{value:new Ne(0)},specularColor:{value:new Ne(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new rt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new rt},anisotropyVector:{value:new be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new rt}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag};const bl={r:0,b:0,g:0};function z2(r,e,t,n,i,s,o){const a=new Ne(0);let c=s===!0?0:1,l,u,h=null,f=0,d=null;function m(g,p){let _=!1,y=p.isScene===!0?p.background:null;switch(y&&y.isTexture&&(y=(p.backgroundBlurriness>0?t:e).get(y)),y===null?v(a,c):y&&y.isColor&&(v(y,1),_=!0),r.xr.getEnvironmentBlendMode()){case"opaque":_=!0;break;case"additive":n.buffers.color.setClear(0,0,0,1,o),_=!0;break;case"alpha-blend":n.buffers.color.setClear(0,0,0,0,o),_=!0;break}(r.autoClear||_)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),y&&(y.isCubeTexture||y.mapping===Oo)?(u===void 0&&(u=new Ot(new lr(1,1,1),new Ni({name:"BackgroundCubeMaterial",uniforms:Ro(gi.backgroundCube.uniforms),vertexShader:gi.backgroundCube.vertexShader,fragmentShader:gi.backgroundCube.fragmentShader,side:vn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(w,S,M){this.matrixWorld.copyPosition(M.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=y,u.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,u.material.toneMapped=y.colorSpace!==et,(h!==y||f!==y.version||d!==r.toneMapping)&&(u.material.needsUpdate=!0,h=y,f=y.version,d=r.toneMapping),u.layers.enableAll(),g.unshift(u,u.geometry,u.material,0,0,null)):y&&y.isTexture&&(l===void 0&&(l=new Ot(new Nr(2,2),new Ni({name:"BackgroundMaterial",uniforms:Ro(gi.background.uniforms),vertexShader:gi.background.vertexShader,fragmentShader:gi.background.fragmentShader,side:Oi,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=y,l.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,l.material.toneMapped=y.colorSpace!==et,y.matrixAutoUpdate===!0&&y.updateMatrix(),l.material.uniforms.uvTransform.value.copy(y.matrix),(h!==y||f!==y.version||d!==r.toneMapping)&&(l.material.needsUpdate=!0,h=y,f=y.version,d=r.toneMapping),l.layers.enableAll(),g.unshift(l,l.geometry,l.material,0,0,null))}function v(g,p){g.getRGB(bl,Yx(r)),n.buffers.color.setClear(bl.r,bl.g,bl.b,p,o)}return{getClearColor:function(){return a},setClearColor:function(g,p=1){a.set(g),c=p,v(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(g){c=g,v(a,c)},render:m}}function B2(r,e,t,n){const i=r.getParameter(r.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},c=g(null);let l=c,u=!1;function h(z,V,N,C,O){let k=!1;if(o){const U=v(C,N,V);l!==U&&(l=U,d(l.object)),k=p(z,C,N,O),k&&_(z,C,N,O)}else{const U=V.wireframe===!0;(l.geometry!==C.id||l.program!==N.id||l.wireframe!==U)&&(l.geometry=C.id,l.program=N.id,l.wireframe=U,k=!0)}O!==null&&t.update(O,r.ELEMENT_ARRAY_BUFFER),(k||u)&&(u=!1,M(z,V,N,C),O!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(O).buffer))}function f(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function d(z){return n.isWebGL2?r.bindVertexArray(z):s.bindVertexArrayOES(z)}function m(z){return n.isWebGL2?r.deleteVertexArray(z):s.deleteVertexArrayOES(z)}function v(z,V,N){const C=N.wireframe===!0;let O=a[z.id];O===void 0&&(O={},a[z.id]=O);let k=O[V.id];k===void 0&&(k={},O[V.id]=k);let U=k[C];return U===void 0&&(U=g(f()),k[C]=U),U}function g(z){const V=[],N=[],C=[];for(let O=0;O=0){const Y=O[F];let J=k[F];if(J===void 0&&(F==="instanceMatrix"&&z.instanceMatrix&&(J=z.instanceMatrix),F==="instanceColor"&&z.instanceColor&&(J=z.instanceColor)),Y===void 0||Y.attribute!==J||J&&Y.data!==J.data)return!0;U++}return l.attributesNum!==U||l.index!==C}function _(z,V,N,C){const O={},k=V.attributes;let U=0;const R=N.getAttributes();for(const F in R)if(R[F].location>=0){let Y=k[F];Y===void 0&&(F==="instanceMatrix"&&z.instanceMatrix&&(Y=z.instanceMatrix),F==="instanceColor"&&z.instanceColor&&(Y=z.instanceColor));const J={};J.attribute=Y,Y&&Y.data&&(J.data=Y.data),O[F]=J,U++}l.attributes=O,l.attributesNum=U,l.index=C}function y(){const z=l.newAttributes;for(let V=0,N=z.length;V=0){let H=O[R];if(H===void 0&&(R==="instanceMatrix"&&z.instanceMatrix&&(H=z.instanceMatrix),R==="instanceColor"&&z.instanceColor&&(H=z.instanceColor)),H!==void 0){const Y=H.normalized,J=H.itemSize,ie=t.get(H);if(ie===void 0)continue;const ne=ie.buffer,ee=ie.type,ge=ie.bytesPerElement,me=n.isWebGL2===!0&&(ee===r.INT||ee===r.UNSIGNED_INT||H.gpuType===qp);if(H.isInterleavedBufferAttribute){const te=H.data,D=te.stride,Q=H.offset;if(te.isInstancedInterleavedBuffer){for(let j=0;j0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";S="mediump"}return S==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const c=s(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);const l=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),f=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=r.getParameter(r.MAX_TEXTURE_SIZE),m=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),v=r.getParameter(r.MAX_VERTEX_ATTRIBS),g=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),p=r.getParameter(r.MAX_VARYING_VECTORS),_=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),y=f>0,x=o||e.has("OES_texture_float"),b=y&&x,w=o?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:m,maxAttributes:v,maxVertexUniforms:g,maxVaryings:p,maxFragmentUniforms:_,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:b,maxSamples:w}}function H2(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new Qi,a=new rt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const d=h.length!==0||f||n!==0||i;return i=f,n=h.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,d){const m=h.clippingPlanes,v=h.clipIntersection,g=h.clipShadows,p=r.get(h);if(!i||m===null||m.length===0||s&&!g)s?u(null):l();else{const _=s?0:n,y=_*4;let x=p.clippingState||null;c.value=x,x=u(m,f,y,d);for(let b=0;b!==y;++b)x[b]=t[b];p.clippingState=x,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=_}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,m){const v=h!==null?h.length:0;let g=null;if(v!==0){if(g=c.value,m!==!0||g===null){const p=d+v*4,_=f.matrixWorldInverse;a.getNormalMatrix(_),(g===null||g.length0){const l=new $x(c.height/2);return l.fromEquirectangularTexture(r,o),e.set(o,l),o.addEventListener("dispose",i),t(l.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Ms extends Pc{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),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,t,n,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,o=s+l*this.view.width,a-=u*this.view.offsetY,c=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const _o=4,y0=[.125,.215,.35,.446,.526,.582],is=20,gf=new Ms,x0=new Ne;let vf=null;const es=(1+Math.sqrt(5))/2,eo=1/es,b0=[new G(1,1,1),new G(-1,1,1),new G(1,1,-1),new G(-1,1,-1),new G(0,es,eo),new G(0,es,-eo),new G(eo,0,es),new G(-eo,0,es),new G(es,eo,0),new G(-es,eo,0)];class up{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,t=0,n=.1,i=100){vf=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=E0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=S0(),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?y:0,y,y),u.setRenderTarget(i),v&&u.render(m,a),u.render(e,a)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=g}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Pr||e.mapping===Lr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=E0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=S0());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new Ot(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const c=this._cubeSize;wl(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(o,gf)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;iis&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${is}`);const p=[];let _=0;for(let S=0;Sy-_o?i-y+_o:0),w=4*(this._cubeSize-x);wl(t,b,w,3*x,2*x),c.setRenderTarget(t),c.render(h,gf)}}function X2(r){const e=[],t=[],n=[];let i=r;const s=r-_o+1+y0.length;for(let o=0;or-_o?c=y0[o-r+_o-1]:o===0&&(c=0),n.push(c);const l=1/(a-2),u=-l,h=1+l,f=[u,u,h,u,h,h,u,u,h,h,u,h],d=6,m=6,v=3,g=2,p=1,_=new Float32Array(v*m*d),y=new Float32Array(g*m*d),x=new Float32Array(p*m*d);for(let w=0;w2?0:-1,E=[S,M,0,S+2/3,M,0,S+2/3,M+1,0,S,M,0,S+2/3,M+1,0,S,M+1,0];_.set(E,v*m*w),y.set(f,g*m*w);const T=[w,w,w,w,w,w];x.set(T,p*m*w)}const b=new st;b.setAttribute("position",new wt(_,v)),b.setAttribute("uv",new wt(y,g)),b.setAttribute("faceIndex",new wt(x,p)),e.push(b),i>_o&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function w0(r,e,t){const n=new bi(r,e,t);return n.texture.mapping=Oo,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function wl(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function q2(r,e,t){const n=new Float32Array(is),i=new G(0,1,0);return new Ni({name:"SphericalGaussianBlur",defines:{n:is,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:cm(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - } - `,blending:nr,depthTest:!1,depthWrite:!1})}function S0(){return new Ni({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:cm(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - `,blending:nr,depthTest:!1,depthWrite:!1})}function E0(){return new Ni({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:cm(),fragmentShader:` - - precision mediump float; - precision mediump int; - - uniform float flipEnvMap; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - void main() { - - gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); - - } - `,blending:nr,depthTest:!1,depthWrite:!1})}function cm(){return` - - precision mediump float; - precision mediump int; - - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - `}function Y2(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const c=a.mapping,l=c===Ka||c===Ja,u=c===Pr||c===Lr;if(l||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new up(r)),h=l?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(l&&h&&h.height>0||u&&h&&i(h)){t===null&&(t=new up(r));const f=l?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function i(a){let c=0;const l=6;for(let u=0;ue.maxTextureSize&&(T=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const L=new Float32Array(E*T*4*m),P=new ku(L,E,T,m);P.type=Li,P.needsUpdate=!0;const A=M*4;for(let V=0;V0)return r;const i=e*t;let s=M0[i];if(s===void 0&&(s=new Float32Array(i),M0[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Qt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t":" "} ${a}: ${t[o]}`)}return n.join(` -`)}function jC(r){switch(r){case xi:return["Linear","( value )"];case et:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),["Linear","( value )"]}}function D0(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` - -`+i+` - -`+YC(r.getShaderSource(e),o)}else return i}function $C(r,e){const t=jC(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function ZC(r,e){let t;switch(e){case vx:t="Linear";break;case _x:t="Reinhard";break;case yx:t="OptimizedCineon";break;case Wp:t="ACESFilmic";break;case xx:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function KC(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Oa).join(` -`)}function JC(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` -`)}function QC(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function hp(r){return r.replace(eR,nR)}const tR=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function nR(r,e){let t=Qe[e];if(t===void 0){const n=tR.get(e);if(n!==void 0)t=Qe[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return hp(t)}const iR=/#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 O0(r){return r.replace(iR,rR)}function rR(r,e,t,n){let i="";for(let s=parseInt(e);s0&&(g+=` -`),p=[d,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Oa).join(` -`),p.length>0&&(p+=` -`)):(g=[N0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(Oa).join(` -`),p=[d,N0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==yi?"#define TONE_MAPPING":"",t.toneMapping!==yi?Qe.tonemapping_pars_fragment:"",t.toneMapping!==yi?ZC("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Qe.colorspace_pars_fragment,$C("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(Oa).join(` -`)),o=hp(o),o=I0(o,t),o=U0(o,t),a=hp(a),a=I0(a,t),a=U0(a,t),o=O0(o),a=O0(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(_=`#version 300 es -`,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` -`)+` -`+g,p=["#define varying in",t.glslVersion===cp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===cp?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` -`)+` -`+p);const y=_+g+o,x=_+p+a,b=L0(i,i.VERTEX_SHADER,y),w=L0(i,i.FRAGMENT_SHADER,x);if(i.attachShader(v,b),i.attachShader(v,w),t.index0AttributeName!==void 0?i.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(v,0,"position"),i.linkProgram(v),r.debug.checkShaderErrors){const E=i.getProgramInfoLog(v).trim(),T=i.getShaderInfoLog(b).trim(),L=i.getShaderInfoLog(w).trim();let P=!0,A=!0;if(i.getProgramParameter(v,i.LINK_STATUS)===!1)if(P=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,v,b,w);else{const z=D0(i,b,"vertex"),V=D0(i,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(v,i.VALIDATE_STATUS)+` - -Program Info Log: `+E+` -`+z+` -`+V)}else E!==""?console.warn("THREE.WebGLProgram: Program Info Log:",E):(T===""||L==="")&&(A=!1);A&&(this.diagnostics={runnable:P,programLog:E,vertexShader:{log:T,prefix:g},fragmentShader:{log:L,prefix:p}})}i.deleteShader(b),i.deleteShader(w);let S;this.getUniforms=function(){return S===void 0&&(S=new uu(i,v)),S};let M;return this.getAttributes=function(){return M===void 0&&(M=QC(i,v)),M},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=qC++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=b,this.fragmentShader=w,this}let hR=0;class fR{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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 t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new dR(e),t.set(e,n)),n}}class dR{constructor(e){this.id=hR++,this.code=e,this.usedTimes=0}}function pR(r,e,t,n,i,s,o){const a=new hs,c=new fR,l=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,f=i.vertexTextures;let d=i.precision;const m={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 v(E){return E===0?"uv":`uv${E}`}function g(E,T,L,P,A){const z=P.fog,V=A.geometry,N=E.isMeshStandardMaterial?P.environment:null,C=(E.isMeshStandardMaterial?t:e).get(E.envMap||N),O=C&&C.mapping===Oo?C.image.height:null,k=m[E.type];E.precision!==null&&(d=i.getMaxPrecision(E.precision),d!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",d,"instead."));const U=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,R=U!==void 0?U.length:0;let F=0;V.morphAttributes.position!==void 0&&(F=1),V.morphAttributes.normal!==void 0&&(F=2),V.morphAttributes.color!==void 0&&(F=3);let H,Y,J,ie;if(k){const ut=gi[k];H=ut.vertexShader,Y=ut.fragmentShader}else H=E.vertexShader,Y=E.fragmentShader,c.update(E),J=c.getVertexShaderID(E),ie=c.getFragmentShaderID(E);const ne=r.getRenderTarget(),ee=A.isInstancedMesh===!0,ge=!!E.map,me=!!E.matcap,te=!!C,D=!!E.aoMap,Q=!!E.lightMap,j=!!E.bumpMap,K=!!E.normalMap,W=!!E.displacementMap,ye=!!E.emissiveMap,re=!!E.metalnessMap,fe=!!E.roughnessMap,xe=E.anisotropy>0,ce=E.clearcoat>0,Pe=E.iridescence>0,B=E.sheen>0,I=E.transmission>0,$=xe&&!!E.anisotropyMap,he=ce&&!!E.clearcoatMap,de=ce&&!!E.clearcoatNormalMap,pe=ce&&!!E.clearcoatRoughnessMap,Me=Pe&&!!E.iridescenceMap,we=Pe&&!!E.iridescenceThicknessMap,ue=B&&!!E.sheenColorMap,Ce=B&&!!E.sheenRoughnessMap,ze=!!E.specularMap,Le=!!E.specularColorMap,Ee=!!E.specularIntensityMap,De=I&&!!E.transmissionMap,Ve=I&&!!E.thicknessMap,je=!!E.gradientMap,Z=!!E.alphaMap,Ae=E.alphaTest>0,le=!!E.alphaHash,Re=!!E.extensions,Fe=!!V.attributes.uv1,tt=!!V.attributes.uv2,lt=!!V.attributes.uv3;return{isWebGL2:u,shaderID:k,shaderType:E.type,shaderName:E.name,vertexShader:H,fragmentShader:Y,defines:E.defines,customVertexShaderID:J,customFragmentShaderID:ie,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:d,instancing:ee,instancingColor:ee&&A.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:ne===null?r.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:xi,map:ge,matcap:me,envMap:te,envMapMode:te&&C.mapping,envMapCubeUVHeight:O,aoMap:D,lightMap:Q,bumpMap:j,normalMap:K,displacementMap:f&&W,emissiveMap:ye,normalMapObjectSpace:K&&E.normalMapType===Ux,normalMapTangentSpace:K&&E.normalMapType===Or,metalnessMap:re,roughnessMap:fe,anisotropy:xe,anisotropyMap:$,clearcoat:ce,clearcoatMap:he,clearcoatNormalMap:de,clearcoatRoughnessMap:pe,iridescence:Pe,iridescenceMap:Me,iridescenceThicknessMap:we,sheen:B,sheenColorMap:ue,sheenRoughnessMap:Ce,specularMap:ze,specularColorMap:Le,specularIntensityMap:Ee,transmission:I,transmissionMap:De,thicknessMap:Ve,gradientMap:je,opaque:E.transparent===!1&&E.blending===ls,alphaMap:Z,alphaTest:Ae,alphaHash:le,combine:E.combine,mapUv:ge&&v(E.map.channel),aoMapUv:D&&v(E.aoMap.channel),lightMapUv:Q&&v(E.lightMap.channel),bumpMapUv:j&&v(E.bumpMap.channel),normalMapUv:K&&v(E.normalMap.channel),displacementMapUv:W&&v(E.displacementMap.channel),emissiveMapUv:ye&&v(E.emissiveMap.channel),metalnessMapUv:re&&v(E.metalnessMap.channel),roughnessMapUv:fe&&v(E.roughnessMap.channel),anisotropyMapUv:$&&v(E.anisotropyMap.channel),clearcoatMapUv:he&&v(E.clearcoatMap.channel),clearcoatNormalMapUv:de&&v(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:pe&&v(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Me&&v(E.iridescenceMap.channel),iridescenceThicknessMapUv:we&&v(E.iridescenceThicknessMap.channel),sheenColorMapUv:ue&&v(E.sheenColorMap.channel),sheenRoughnessMapUv:Ce&&v(E.sheenRoughnessMap.channel),specularMapUv:ze&&v(E.specularMap.channel),specularColorMapUv:Le&&v(E.specularColorMap.channel),specularIntensityMapUv:Ee&&v(E.specularIntensityMap.channel),transmissionMapUv:De&&v(E.transmissionMap.channel),thicknessMapUv:Ve&&v(E.thicknessMap.channel),alphaMapUv:Z&&v(E.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(K||xe),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,vertexUv1s:Fe,vertexUv2s:tt,vertexUv3s:lt,pointsUvs:A.isPoints===!0&&!!V.attributes.uv&&(ge||Z),fog:!!z,useFog:E.fog===!0,fogExp2:z&&z.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:A.isSkinnedMesh===!0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:R,morphTextureStride:F,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:E.dithering,shadowMapEnabled:r.shadowMap.enabled&&L.length>0,shadowMapType:r.shadowMap.type,toneMapping:E.toneMapped?r.toneMapping:yi,useLegacyLights:r.useLegacyLights,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Dt,flipSided:E.side===vn,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionDerivatives:Re&&E.extensions.derivatives===!0,extensionFragDepth:Re&&E.extensions.fragDepth===!0,extensionDrawBuffers:Re&&E.extensions.drawBuffers===!0,extensionShaderTextureLOD:Re&&E.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:E.customProgramCacheKey()}}function p(E){const T=[];if(E.shaderID?T.push(E.shaderID):(T.push(E.customVertexShaderID),T.push(E.customFragmentShaderID)),E.defines!==void 0)for(const L in E.defines)T.push(L),T.push(E.defines[L]);return E.isRawShaderMaterial===!1&&(_(T,E),y(T,E),T.push(r.outputColorSpace)),T.push(E.customProgramCacheKey),T.join()}function _(E,T){E.push(T.precision),E.push(T.outputColorSpace),E.push(T.envMapMode),E.push(T.envMapCubeUVHeight),E.push(T.mapUv),E.push(T.alphaMapUv),E.push(T.lightMapUv),E.push(T.aoMapUv),E.push(T.bumpMapUv),E.push(T.normalMapUv),E.push(T.displacementMapUv),E.push(T.emissiveMapUv),E.push(T.metalnessMapUv),E.push(T.roughnessMapUv),E.push(T.anisotropyMapUv),E.push(T.clearcoatMapUv),E.push(T.clearcoatNormalMapUv),E.push(T.clearcoatRoughnessMapUv),E.push(T.iridescenceMapUv),E.push(T.iridescenceThicknessMapUv),E.push(T.sheenColorMapUv),E.push(T.sheenRoughnessMapUv),E.push(T.specularMapUv),E.push(T.specularColorMapUv),E.push(T.specularIntensityMapUv),E.push(T.transmissionMapUv),E.push(T.thicknessMapUv),E.push(T.combine),E.push(T.fogExp2),E.push(T.sizeAttenuation),E.push(T.morphTargetsCount),E.push(T.morphAttributeCount),E.push(T.numDirLights),E.push(T.numPointLights),E.push(T.numSpotLights),E.push(T.numSpotLightMaps),E.push(T.numHemiLights),E.push(T.numRectAreaLights),E.push(T.numDirLightShadows),E.push(T.numPointLightShadows),E.push(T.numSpotLightShadows),E.push(T.numSpotLightShadowsWithMaps),E.push(T.shadowMapType),E.push(T.toneMapping),E.push(T.numClippingPlanes),E.push(T.numClipIntersection),E.push(T.depthPacking)}function y(E,T){a.disableAll(),T.isWebGL2&&a.enable(0),T.supportsVertexTextures&&a.enable(1),T.instancing&&a.enable(2),T.instancingColor&&a.enable(3),T.matcap&&a.enable(4),T.envMap&&a.enable(5),T.normalMapObjectSpace&&a.enable(6),T.normalMapTangentSpace&&a.enable(7),T.clearcoat&&a.enable(8),T.iridescence&&a.enable(9),T.alphaTest&&a.enable(10),T.vertexColors&&a.enable(11),T.vertexAlphas&&a.enable(12),T.vertexUv1s&&a.enable(13),T.vertexUv2s&&a.enable(14),T.vertexUv3s&&a.enable(15),T.vertexTangents&&a.enable(16),T.anisotropy&&a.enable(17),E.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.skinning&&a.enable(4),T.morphTargets&&a.enable(5),T.morphNormals&&a.enable(6),T.morphColors&&a.enable(7),T.premultipliedAlpha&&a.enable(8),T.shadowMapEnabled&&a.enable(9),T.useLegacyLights&&a.enable(10),T.doubleSided&&a.enable(11),T.flipSided&&a.enable(12),T.useDepthPacking&&a.enable(13),T.dithering&&a.enable(14),T.transmission&&a.enable(15),T.sheen&&a.enable(16),T.opaque&&a.enable(17),T.pointsUvs&&a.enable(18),E.push(a.mask)}function x(E){const T=m[E.type];let L;if(T){const P=gi[T];L=am.clone(P.uniforms)}else L=E.uniforms;return L}function b(E,T){let L;for(let P=0,A=l.length;P0?n.push(p):d.transparent===!0?i.push(p):t.push(p)}function c(h,f,d,m,v,g){const p=o(h,f,d,m,v,g);d.transmission>0?n.unshift(p):d.transparent===!0?i.unshift(p):t.unshift(p)}function l(h,f){t.length>1&&t.sort(h||gR),n.length>1&&n.sort(f||F0),i.length>1&&i.sort(f||F0)}function u(){for(let h=e,f=r.length;h=s.length?(o=new k0,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function _R(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new G,color:new Ne};break;case"SpotLight":t={position:new G,direction:new G,color:new Ne,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new G,color:new Ne,distance:0,decay:0};break;case"HemisphereLight":t={direction:new G,skyColor:new Ne,groundColor:new Ne};break;case"RectAreaLight":t={color:new Ne,position:new G,halfWidth:new G,halfHeight:new G};break}return r[e.id]=t,t}}}function yR(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let xR=0;function bR(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function wR(r,e){const t=new _R,n=yR(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let u=0;u<9;u++)i.probe.push(new G);const s=new G,o=new Ke,a=new Ke;function c(u,h){let f=0,d=0,m=0;for(let L=0;L<9;L++)i.probe[L].set(0,0,0);let v=0,g=0,p=0,_=0,y=0,x=0,b=0,w=0,S=0,M=0;u.sort(bR);const E=h===!0?Math.PI:1;for(let L=0,P=u.length;L0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ke.LTC_FLOAT_1,i.rectAreaLTC2=ke.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=ke.LTC_HALF_1,i.rectAreaLTC2=ke.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=f,i.ambient[1]=d,i.ambient[2]=m;const T=i.hash;(T.directionalLength!==v||T.pointLength!==g||T.spotLength!==p||T.rectAreaLength!==_||T.hemiLength!==y||T.numDirectionalShadows!==x||T.numPointShadows!==b||T.numSpotShadows!==w||T.numSpotMaps!==S)&&(i.directional.length=v,i.spot.length=p,i.rectArea.length=_,i.point.length=g,i.hemi.length=y,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=w,i.spotShadowMap.length=w,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=w+S-M,i.spotLightMap.length=S,i.numSpotLightShadowsWithMaps=M,T.directionalLength=v,T.pointLength=g,T.spotLength=p,T.rectAreaLength=_,T.hemiLength=y,T.numDirectionalShadows=x,T.numPointShadows=b,T.numSpotShadows=w,T.numSpotMaps=S,i.version=xR++)}function l(u,h){let f=0,d=0,m=0,v=0,g=0;const p=h.matrixWorldInverse;for(let _=0,y=u.length;_=a.length?(c=new z0(r,e),a.push(c)):c=a[o],c}function i(){t=new WeakMap}return{get:n,dispose:i}}class Gu extends un{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ix,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 Vu extends un{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 ER=`void main() { - gl_Position = vec4( position, 1.0 ); -}`,MR=`uniform sampler2D shadow_pass; -uniform vec2 resolution; -uniform float radius; -#include -void main() { - const float samples = float( VSM_SAMPLES ); - float mean = 0.0; - float squared_mean = 0.0; - float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); - float uvStart = samples <= 1.0 ? 0.0 : - 1.0; - for ( float i = 0.0; i < samples; i ++ ) { - float uvOffset = uvStart + i * uvStride; - #ifdef HORIZONTAL_PASS - vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); - mean += distribution.x; - squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; - #else - float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); - mean += depth; - squared_mean += depth * depth; - #endif - } - mean = mean / samples; - squared_mean = squared_mean / samples; - float std_dev = sqrt( squared_mean - mean * mean ); - gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function TR(r,e,t){let n=new zu;const i=new be,s=new be,o=new mt,a=new Gu({depthPacking:em}),c=new Vu,l={},u=t.maxTextureSize,h={[Oi]:vn,[vn]:Oi,[Dt]:Dt},f=new Ni({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new be},radius:{value:4}},vertexShader:ER,fragmentShader:MR}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const m=new st;m.setAttribute("position",new wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Ot(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Uu;let p=this.type;this.render=function(b,w,S){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;const M=r.getRenderTarget(),E=r.getActiveCubeFace(),T=r.getActiveMipmapLevel(),L=r.state;L.setBlending(nr),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const P=p!==mi&&this.type===mi,A=p===mi&&this.type!==mi;for(let z=0,V=b.length;zu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/O.x),i.x=s.x*O.x,C.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/O.y),i.y=s.y*O.y,C.mapSize.y=s.y)),C.map===null||P===!0||A===!0){const U=this.type!==mi?{minFilter:Yt,magFilter:Yt}:{};C.map!==null&&C.map.dispose(),C.map=new bi(i.x,i.y,U),C.map.texture.name=N.name+".shadowMap",C.camera.updateProjectionMatrix()}r.setRenderTarget(C.map),r.clear();const k=C.getViewportCount();for(let U=0;U0||w.map&&w.alphaTest>0){const L=E.uuid,P=w.uuid;let A=l[L];A===void 0&&(A={},l[L]=A);let z=A[P];z===void 0&&(z=E.clone(),A[P]=z),E=z}if(E.visible=w.visible,E.wireframe=w.wireframe,M===mi?E.side=w.shadowSide!==null?w.shadowSide:w.side:E.side=w.shadowSide!==null?w.shadowSide:h[w.side],E.alphaMap=w.alphaMap,E.alphaTest=w.alphaTest,E.map=w.map,E.clipShadows=w.clipShadows,E.clippingPlanes=w.clippingPlanes,E.clipIntersection=w.clipIntersection,E.displacementMap=w.displacementMap,E.displacementScale=w.displacementScale,E.displacementBias=w.displacementBias,E.wireframeLinewidth=w.wireframeLinewidth,E.linewidth=w.linewidth,S.isPointLight===!0&&E.isMeshDistanceMaterial===!0){const L=r.properties.get(E);L.light=S}return E}function x(b,w,S,M,E){if(b.visible===!1)return;if(b.layers.test(w.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&E===mi)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,b.matrixWorld);const P=e.update(b),A=b.material;if(Array.isArray(A)){const z=P.groups;for(let V=0,N=z.length;V=1):O.indexOf("OpenGL ES")!==-1&&(C=parseFloat(/^OpenGL ES (\d)/.exec(O)[1]),N=C>=2);let k=null,U={};const R=r.getParameter(r.SCISSOR_BOX),F=r.getParameter(r.VIEWPORT),H=new mt().fromArray(R),Y=new mt().fromArray(F);function J(Z,Ae,le,Re){const Fe=new Uint8Array(4),tt=r.createTexture();r.bindTexture(Z,tt),r.texParameteri(Z,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(Z,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let lt=0;lt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let v;const g=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(B,I){return p?new OffscreenCanvas(B,I):oc("canvas")}function y(B,I,$,he){let de=1;if((B.width>he||B.height>he)&&(de=he/Math.max(B.width,B.height)),de<1||I===!0)if(typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&B instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&B instanceof ImageBitmap){const pe=I?xu:Math.floor,Me=pe(de*B.width),we=pe(de*B.height);v===void 0&&(v=_(Me,we));const ue=$?_(Me,we):v;return ue.width=Me,ue.height=we,ue.getContext("2d").drawImage(B,0,0,Me,we),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+B.width+"x"+B.height+") to ("+Me+"x"+we+")."),ue}else return"data"in B&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+B.width+"x"+B.height+")."),B;return B}function x(B){return lp(B.width)&&lp(B.height)}function b(B){return a?!1:B.wrapS!==gn||B.wrapT!==gn||B.minFilter!==Yt&&B.minFilter!==Pt}function w(B,I){return B.generateMipmaps&&I&&B.minFilter!==Yt&&B.minFilter!==Pt}function S(B){r.generateMipmap(B)}function M(B,I,$,he,de=!1){if(a===!1)return I;if(B!==null){if(r[B]!==void 0)return r[B];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+B+"'")}let pe=I;return I===r.RED&&($===r.FLOAT&&(pe=r.R32F),$===r.HALF_FLOAT&&(pe=r.R16F),$===r.UNSIGNED_BYTE&&(pe=r.R8)),I===r.RG&&($===r.FLOAT&&(pe=r.RG32F),$===r.HALF_FLOAT&&(pe=r.RG16F),$===r.UNSIGNED_BYTE&&(pe=r.RG8)),I===r.RGBA&&($===r.FLOAT&&(pe=r.RGBA32F),$===r.HALF_FLOAT&&(pe=r.RGBA16F),$===r.UNSIGNED_BYTE&&(pe=he===et&&de===!1?r.SRGB8_ALPHA8:r.RGBA8),$===r.UNSIGNED_SHORT_4_4_4_4&&(pe=r.RGBA4),$===r.UNSIGNED_SHORT_5_5_5_1&&(pe=r.RGB5_A1)),(pe===r.R16F||pe===r.R32F||pe===r.RG16F||pe===r.RG32F||pe===r.RGBA16F||pe===r.RGBA32F)&&e.get("EXT_color_buffer_float"),pe}function E(B,I,$){return w(B,$)===!0||B.isFramebufferTexture&&B.minFilter!==Yt&&B.minFilter!==Pt?Math.log2(Math.max(I.width,I.height))+1:B.mipmaps!==void 0&&B.mipmaps.length>0?B.mipmaps.length:B.isCompressedTexture&&Array.isArray(B.image)?I.mipmaps.length:1}function T(B){return B===Yt||B===_u||B===Ba?r.NEAREST:r.LINEAR}function L(B){const I=B.target;I.removeEventListener("dispose",L),A(I),I.isVideoTexture&&m.delete(I)}function P(B){const I=B.target;I.removeEventListener("dispose",P),V(I)}function A(B){const I=n.get(B);if(I.__webglInit===void 0)return;const $=B.source,he=g.get($);if(he){const de=he[I.__cacheKey];de.usedTimes--,de.usedTimes===0&&z(B),Object.keys(he).length===0&&g.delete($)}n.remove(B)}function z(B){const I=n.get(B);r.deleteTexture(I.__webglTexture);const $=B.source,he=g.get($);delete he[I.__cacheKey],o.memory.textures--}function V(B){const I=B.texture,$=n.get(B),he=n.get(I);if(he.__webglTexture!==void 0&&(r.deleteTexture(he.__webglTexture),o.memory.textures--),B.depthTexture&&B.depthTexture.dispose(),B.isWebGLCubeRenderTarget)for(let de=0;de<6;de++)r.deleteFramebuffer($.__webglFramebuffer[de]),$.__webglDepthbuffer&&r.deleteRenderbuffer($.__webglDepthbuffer[de]);else{if(r.deleteFramebuffer($.__webglFramebuffer),$.__webglDepthbuffer&&r.deleteRenderbuffer($.__webglDepthbuffer),$.__webglMultisampledFramebuffer&&r.deleteFramebuffer($.__webglMultisampledFramebuffer),$.__webglColorRenderbuffer)for(let de=0;de<$.__webglColorRenderbuffer.length;de++)$.__webglColorRenderbuffer[de]&&r.deleteRenderbuffer($.__webglColorRenderbuffer[de]);$.__webglDepthRenderbuffer&&r.deleteRenderbuffer($.__webglDepthRenderbuffer)}if(B.isWebGLMultipleRenderTargets)for(let de=0,pe=I.length;de=c&&console.warn("THREE.WebGLTextures: Trying to use "+B+" texture units while this GPU supports only "+c),N+=1,B}function k(B){const I=[];return I.push(B.wrapS),I.push(B.wrapT),I.push(B.wrapR||0),I.push(B.magFilter),I.push(B.minFilter),I.push(B.anisotropy),I.push(B.internalFormat),I.push(B.format),I.push(B.type),I.push(B.generateMipmaps),I.push(B.premultiplyAlpha),I.push(B.flipY),I.push(B.unpackAlignment),I.push(B.colorSpace),I.join()}function U(B,I){const $=n.get(B);if(B.isVideoTexture&&ce(B),B.isRenderTargetTexture===!1&&B.version>0&&$.__version!==B.version){const he=B.image;if(he===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(he.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ge($,B,I);return}}t.bindTexture(r.TEXTURE_2D,$.__webglTexture,r.TEXTURE0+I)}function R(B,I){const $=n.get(B);if(B.version>0&&$.__version!==B.version){ge($,B,I);return}t.bindTexture(r.TEXTURE_2D_ARRAY,$.__webglTexture,r.TEXTURE0+I)}function F(B,I){const $=n.get(B);if(B.version>0&&$.__version!==B.version){ge($,B,I);return}t.bindTexture(r.TEXTURE_3D,$.__webglTexture,r.TEXTURE0+I)}function H(B,I){const $=n.get(B);if(B.version>0&&$.__version!==B.version){me($,B,I);return}t.bindTexture(r.TEXTURE_CUBE_MAP,$.__webglTexture,r.TEXTURE0+I)}const Y={[Qa]:r.REPEAT,[gn]:r.CLAMP_TO_EDGE,[ec]:r.MIRRORED_REPEAT},J={[Yt]:r.NEAREST,[_u]:r.NEAREST_MIPMAP_NEAREST,[Ba]:r.NEAREST_MIPMAP_LINEAR,[Pt]:r.LINEAR,[Xp]:r.LINEAR_MIPMAP_NEAREST,[Dr]:r.LINEAR_MIPMAP_LINEAR},ie={[Nx]:r.NEVER,[Hx]:r.ALWAYS,[Fx]:r.LESS,[zx]:r.LEQUAL,[kx]:r.EQUAL,[Vx]:r.GEQUAL,[Bx]:r.GREATER,[Gx]:r.NOTEQUAL};function ne(B,I,$){if($?(r.texParameteri(B,r.TEXTURE_WRAP_S,Y[I.wrapS]),r.texParameteri(B,r.TEXTURE_WRAP_T,Y[I.wrapT]),(B===r.TEXTURE_3D||B===r.TEXTURE_2D_ARRAY)&&r.texParameteri(B,r.TEXTURE_WRAP_R,Y[I.wrapR]),r.texParameteri(B,r.TEXTURE_MAG_FILTER,J[I.magFilter]),r.texParameteri(B,r.TEXTURE_MIN_FILTER,J[I.minFilter])):(r.texParameteri(B,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(B,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(B===r.TEXTURE_3D||B===r.TEXTURE_2D_ARRAY)&&r.texParameteri(B,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(I.wrapS!==gn||I.wrapT!==gn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(B,r.TEXTURE_MAG_FILTER,T(I.magFilter)),r.texParameteri(B,r.TEXTURE_MIN_FILTER,T(I.minFilter)),I.minFilter!==Yt&&I.minFilter!==Pt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),I.compareFunction&&(r.texParameteri(B,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(B,r.TEXTURE_COMPARE_FUNC,ie[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const he=e.get("EXT_texture_filter_anisotropic");if(I.magFilter===Yt||I.minFilter!==Ba&&I.minFilter!==Dr||I.type===Li&&e.has("OES_texture_float_linear")===!1||a===!1&&I.type===Ao&&e.has("OES_texture_half_float_linear")===!1)return;(I.anisotropy>1||n.get(I).__currentAnisotropy)&&(r.texParameterf(B,he.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,i.getMaxAnisotropy())),n.get(I).__currentAnisotropy=I.anisotropy)}}function ee(B,I){let $=!1;B.__webglInit===void 0&&(B.__webglInit=!0,I.addEventListener("dispose",L));const he=I.source;let de=g.get(he);de===void 0&&(de={},g.set(he,de));const pe=k(I);if(pe!==B.__cacheKey){de[pe]===void 0&&(de[pe]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,$=!0),de[pe].usedTimes++;const Me=de[B.__cacheKey];Me!==void 0&&(de[B.__cacheKey].usedTimes--,Me.usedTimes===0&&z(I)),B.__cacheKey=pe,B.__webglTexture=de[pe].texture}return $}function ge(B,I,$){let he=r.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(he=r.TEXTURE_2D_ARRAY),I.isData3DTexture&&(he=r.TEXTURE_3D);const de=ee(B,I),pe=I.source;t.bindTexture(he,B.__webglTexture,r.TEXTURE0+$);const Me=n.get(pe);if(pe.version!==Me.__version||de===!0){t.activeTexture(r.TEXTURE0+$),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,I.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,I.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE);const we=b(I)&&x(I.image)===!1;let ue=y(I.image,we,!1,u);ue=Pe(I,ue);const Ce=x(ue)||a,ze=s.convert(I.format,I.colorSpace);let Le=s.convert(I.type),Ee=M(I.internalFormat,ze,Le,I.colorSpace);ne(he,I,Ce);let De;const Ve=I.mipmaps,je=a&&I.isVideoTexture!==!0,Z=Me.__version===void 0||de===!0,Ae=E(I,ue,Ce);if(I.isDepthTexture)Ee=r.DEPTH_COMPONENT,a?I.type===Li?Ee=r.DEPTH_COMPONENT32F:I.type===tr?Ee=r.DEPTH_COMPONENT24:I.type===Mr?Ee=r.DEPTH24_STENCIL8:Ee=r.DEPTH_COMPONENT16:I.type===Li&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),I.format===Tr&&Ee===r.DEPTH_COMPONENT&&I.type!==Nu&&I.type!==tr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),I.type=tr,Le=s.convert(I.type)),I.format===ms&&Ee===r.DEPTH_COMPONENT&&(Ee=r.DEPTH_STENCIL,I.type!==Mr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),I.type=Mr,Le=s.convert(I.type))),Z&&(je?t.texStorage2D(r.TEXTURE_2D,1,Ee,ue.width,ue.height):t.texImage2D(r.TEXTURE_2D,0,Ee,ue.width,ue.height,0,ze,Le,null));else if(I.isDataTexture)if(Ve.length>0&&Ce){je&&Z&&t.texStorage2D(r.TEXTURE_2D,Ae,Ee,Ve[0].width,Ve[0].height);for(let le=0,Re=Ve.length;le>=1,Re>>=1}}else if(Ve.length>0&&Ce){je&&Z&&t.texStorage2D(r.TEXTURE_2D,Ae,Ee,Ve[0].width,Ve[0].height);for(let le=0,Re=Ve.length;le0&&Z++,t.texStorage2D(r.TEXTURE_CUBE_MAP,Z,De,ue[0].width,ue[0].height));for(let le=0;le<6;le++)if(we){Ve?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+le,0,0,0,ue[le].width,ue[le].height,Le,Ee,ue[le].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+le,0,De,ue[le].width,ue[le].height,0,Le,Ee,ue[le].data);for(let Re=0;Re=r.TEXTURE_CUBE_MAP_POSITIVE_X&&de<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,he,de,n.get($).__webglTexture,0),t.bindFramebuffer(r.FRAMEBUFFER,null)}function D(B,I,$){if(r.bindRenderbuffer(r.RENDERBUFFER,B),I.depthBuffer&&!I.stencilBuffer){let he=r.DEPTH_COMPONENT16;if($||xe(I)){const de=I.depthTexture;de&&de.isDepthTexture&&(de.type===Li?he=r.DEPTH_COMPONENT32F:de.type===tr&&(he=r.DEPTH_COMPONENT24));const pe=fe(I);xe(I)?f.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,pe,he,I.width,I.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,pe,he,I.width,I.height)}else r.renderbufferStorage(r.RENDERBUFFER,he,I.width,I.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,B)}else if(I.depthBuffer&&I.stencilBuffer){const he=fe(I);$&&xe(I)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,he,r.DEPTH24_STENCIL8,I.width,I.height):xe(I)?f.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,he,r.DEPTH24_STENCIL8,I.width,I.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,I.width,I.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,B)}else{const he=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let de=0;de0&&xe(B)===!1){const we=pe?I:[I];$.__webglMultisampledFramebuffer=r.createFramebuffer(),$.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,$.__webglMultisampledFramebuffer);for(let ue=0;ue0&&xe(B)===!1){const I=B.isWebGLMultipleRenderTargets?B.texture:[B.texture],$=B.width,he=B.height;let de=r.COLOR_BUFFER_BIT;const pe=[],Me=B.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,we=n.get(B),ue=B.isWebGLMultipleRenderTargets===!0;if(ue)for(let Ce=0;Ce0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function ce(B){const I=o.render.frame;m.get(B)!==I&&(m.set(B,I),B.update())}function Pe(B,I){const $=B.colorSpace,he=B.format,de=B.type;return B.isCompressedTexture===!0||B.format===yu||$!==xi&&$!==Cr&&($===et?a===!1?e.has("EXT_sRGB")===!0&&he===Ln?(B.format=yu,B.minFilter=Pt,B.generateMipmaps=!1):I=im.sRGBToLinear(I):(he!==Ln||de!==Ii)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",$)),I}this.allocateTextureUnit=O,this.resetTextureUnits=C,this.setTexture2D=U,this.setTexture2DArray=R,this.setTexture3D=F,this.setTextureCube=H,this.rebindTextures=K,this.setupRenderTarget=W,this.updateRenderTargetMipmap=ye,this.updateMultisampleRenderTarget=re,this.setupDepthRenderbuffer=j,this.setupFrameBufferTexture=te,this.useMultisampledRTT=xe}function tb(r,e,t){const n=t.isWebGL2;function i(s,o=Cr){let a;if(s===Ii)return r.UNSIGNED_BYTE;if(s===Yp)return r.UNSIGNED_SHORT_4_4_4_4;if(s===jp)return r.UNSIGNED_SHORT_5_5_5_1;if(s===bx)return r.BYTE;if(s===wx)return r.SHORT;if(s===Nu)return r.UNSIGNED_SHORT;if(s===qp)return r.INT;if(s===tr)return r.UNSIGNED_INT;if(s===Li)return r.FLOAT;if(s===Ao)return n?r.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Sx)return r.ALPHA;if(s===Ln)return r.RGBA;if(s===Ex)return r.LUMINANCE;if(s===Mx)return r.LUMINANCE_ALPHA;if(s===Tr)return r.DEPTH_COMPONENT;if(s===ms)return r.DEPTH_STENCIL;if(s===yu)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Tx)return r.RED;if(s===$p)return r.RED_INTEGER;if(s===Ax)return r.RG;if(s===Zp)return r.RG_INTEGER;if(s===Kp)return r.RGBA_INTEGER;if(s===iu||s===ru||s===su||s===ou)if(o===et)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===iu)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===ru)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===su)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===ou)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===iu)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===ru)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===su)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===ou)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===zd||s===Bd||s===Gd||s===Vd)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===zd)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Bd)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Gd)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Vd)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Cx)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Hd||s===Wd)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Hd)return o===et?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Wd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Xd||s===qd||s===Yd||s===jd||s===$d||s===Zd||s===Kd||s===Jd||s===Qd||s===ep||s===tp||s===np||s===ip||s===rp)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Xd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===qd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Yd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===jd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===$d)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Zd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Kd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Jd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Qd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===ep)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===tp)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===np)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===ip)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===rp)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===au)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===au)return o===et?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===Rx||s===sp||s===op||s===ap)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===au)return a.COMPRESSED_RED_RGTC1_EXT;if(s===sp)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===op)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===ap)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Mr?n?r.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class nb extends Zt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class yo extends gt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const RR={type:"move"};class yf{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new yo,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 yo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new G,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new G),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new yo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new G,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new G),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 t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}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,t,n){let i=null,s=null,o=null;const a=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(const v of e.hand.values()){const g=t.getJointPose(v,n),p=this._getHandJoint(l,v);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const u=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,m=.005;l.inputState.pinching&&f>d+m?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&f<=d-m&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(RR)))}return a!==null&&(a.visible=i!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new yo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class ib extends Ft{constructor(e,t,n,i,s,o,a,c,l,u){if(u=u!==void 0?u:Tr,u!==Tr&&u!==ms)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Tr&&(n=tr),n===void 0&&u===ms&&(n=Mr),super(null,i,s,o,a,c,u,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Yt,this.minFilter=c!==void 0?c:Yt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class PR extends ar{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,f=null,d=null,m=null;const v=t.getContextAttributes();let g=null,p=null;const _=[],y=[],x=new Zt;x.layers.enable(1),x.viewport=new mt;const b=new Zt;b.layers.enable(2),b.viewport=new mt;const w=[x,b],S=new nb;S.layers.enable(1),S.layers.enable(2);let M=null,E=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(R){let F=_[R];return F===void 0&&(F=new yf,_[R]=F),F.getTargetRaySpace()},this.getControllerGrip=function(R){let F=_[R];return F===void 0&&(F=new yf,_[R]=F),F.getGripSpace()},this.getHand=function(R){let F=_[R];return F===void 0&&(F=new yf,_[R]=F),F.getHandSpace()};function T(R){const F=y.indexOf(R.inputSource);if(F===-1)return;const H=_[F];H!==void 0&&(H.update(R.inputSource,R.frame,l||o),H.dispatchEvent({type:R.type,data:R.inputSource}))}function L(){i.removeEventListener("select",T),i.removeEventListener("selectstart",T),i.removeEventListener("selectend",T),i.removeEventListener("squeeze",T),i.removeEventListener("squeezestart",T),i.removeEventListener("squeezeend",T),i.removeEventListener("end",L),i.removeEventListener("inputsourceschange",P);for(let R=0;R<_.length;R++){const F=y[R];F!==null&&(y[R]=null,_[R].disconnect(F))}M=null,E=null,e.setRenderTarget(g),d=null,f=null,h=null,i=null,p=null,U.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(R){s=R,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(R){a=R,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(R){l=R},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return h},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(R){if(i=R,i!==null){if(g=e.getRenderTarget(),i.addEventListener("select",T),i.addEventListener("selectstart",T),i.addEventListener("selectend",T),i.addEventListener("squeeze",T),i.addEventListener("squeezestart",T),i.addEventListener("squeezeend",T),i.addEventListener("end",L),i.addEventListener("inputsourceschange",P),v.xrCompatible!==!0&&await t.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const F={antialias:i.renderState.layers===void 0?v.antialias:!0,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(i,t,F),i.updateRenderState({baseLayer:d}),p=new bi(d.framebufferWidth,d.framebufferHeight,{format:Ln,type:Ii,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil})}else{let F=null,H=null,Y=null;v.depth&&(Y=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,F=v.stencil?ms:Tr,H=v.stencil?Mr:tr);const J={colorFormat:t.RGBA8,depthFormat:Y,scaleFactor:s};h=new XRWebGLBinding(i,t),f=h.createProjectionLayer(J),i.updateRenderState({layers:[f]}),p=new bi(f.textureWidth,f.textureHeight,{format:Ln,type:Ii,depthTexture:new ib(f.textureWidth,f.textureHeight,H,void 0,void 0,void 0,void 0,void 0,void 0,F),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0});const ie=e.properties.get(p);ie.__ignoreDepthValues=f.ignoreDepthValues}p.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await i.requestReferenceSpace(a),U.setContext(i),U.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function P(R){for(let F=0;F=0&&(y[Y]=null,_[Y].disconnect(H))}for(let F=0;F=y.length){y.push(H),Y=ie;break}else if(y[ie]===null){y[ie]=H,Y=ie;break}if(Y===-1)break}const J=_[Y];J&&J.connect(H)}}const A=new G,z=new G;function V(R,F,H){A.setFromMatrixPosition(F.matrixWorld),z.setFromMatrixPosition(H.matrixWorld);const Y=A.distanceTo(z),J=F.projectionMatrix.elements,ie=H.projectionMatrix.elements,ne=J[14]/(J[10]-1),ee=J[14]/(J[10]+1),ge=(J[9]+1)/J[5],me=(J[9]-1)/J[5],te=(J[8]-1)/J[0],D=(ie[8]+1)/ie[0],Q=ne*te,j=ne*D,K=Y/(-te+D),W=K*-te;F.matrixWorld.decompose(R.position,R.quaternion,R.scale),R.translateX(W),R.translateZ(K),R.matrixWorld.compose(R.position,R.quaternion,R.scale),R.matrixWorldInverse.copy(R.matrixWorld).invert();const ye=ne+K,re=ee+K,fe=Q-W,xe=j+(Y-W),ce=ge*ee/re*ye,Pe=me*ee/re*ye;R.projectionMatrix.makePerspective(fe,xe,ce,Pe,ye,re),R.projectionMatrixInverse.copy(R.projectionMatrix).invert()}function N(R,F){F===null?R.matrixWorld.copy(R.matrix):R.matrixWorld.multiplyMatrices(F.matrixWorld,R.matrix),R.matrixWorldInverse.copy(R.matrixWorld).invert()}this.updateCamera=function(R){if(i===null)return;S.near=b.near=x.near=R.near,S.far=b.far=x.far=R.far,(M!==S.near||E!==S.far)&&(i.updateRenderState({depthNear:S.near,depthFar:S.far}),M=S.near,E=S.far);const F=R.parent,H=S.cameras;N(S,F);for(let Y=0;Y0&&(g.alphaTest.value=p.alphaTest);const _=e.get(p).envMap;if(_&&(g.envMap.value=_,g.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap){g.lightMap.value=p.lightMap;const y=r.useLegacyLights===!0?Math.PI:1;g.lightMapIntensity.value=p.lightMapIntensity*y,t(p.lightMap,g.lightMapTransform)}p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function o(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function a(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function c(g,p,_,y){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*_,g.scale.value=y*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function l(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function u(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function h(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function f(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),e.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function d(g,p,_){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===vn&&g.clearcoatNormalScale.value.negate())),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function v(g,p){const _=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(_.matrixWorld),g.nearDistance.value=_.shadow.camera.near,g.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function DR(r,e,t,n){let i={},s={},o=[];const a=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(_,y){const x=y.program;n.uniformBlockBinding(_,x)}function l(_,y){let x=i[_.id];x===void 0&&(m(_),x=u(_),i[_.id]=x,_.addEventListener("dispose",g));const b=y.program;n.updateUBOMapping(_,b);const w=e.render.frame;s[_.id]!==w&&(f(_),s[_.id]=w)}function u(_){const y=h();_.__bindingPointIndex=y;const x=r.createBuffer(),b=_.__size,w=_.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,b,w),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,x),x}function h(){for(let _=0;_0){w=x%b;const P=b-w;w!==0&&P-T.boundary<0&&(x+=b-w,E.__offset=x)}x+=T.storage}return w=x%b,w>0&&(x+=b-w),_.__size=x,_.__cache={},this}function v(_){const y={boundary:0,storage:0};return typeof _=="number"?(y.boundary=4,y.storage=4):_.isVector2?(y.boundary=8,y.storage=8):_.isVector3||_.isColor?(y.boundary=16,y.storage=12):_.isVector4?(y.boundary=16,y.storage=16):_.isMatrix3?(y.boundary=48,y.storage=48):_.isMatrix4?(y.boundary=64,y.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),y}function g(_){const y=_.target;y.removeEventListener("dispose",g);const x=o.indexOf(y.__bindingPointIndex);o.splice(x,1),r.deleteBuffer(i[y.id]),delete i[y.id],delete s[y.id]}function p(){for(const _ in i)r.deleteBuffer(i[_]);o=[],i={},s={}}return{bind:c,update:l,dispose:p}}function IR(){const r=oc("canvas");return r.style.display="block",r}class lm{constructor(e={}){const{canvas:t=IR(),context:n=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;n!==null?f=n.getContextAttributes().alpha:f=o;const d=new Uint32Array(4),m=new Int32Array(4);let v=null,g=null;const p=[],_=[];this.domElement=t,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=et,this.useLegacyLights=!0,this.toneMapping=yi,this.toneMappingExposure=1;const y=this;let x=!1,b=0,w=0,S=null,M=-1,E=null;const T=new mt,L=new mt;let P=null;const A=new Ne(0);let z=0,V=t.width,N=t.height,C=1,O=null,k=null;const U=new mt(0,0,V,N),R=new mt(0,0,V,N);let F=!1;const H=new zu;let Y=!1,J=!1,ie=null;const ne=new Ke,ee=new be,ge=new G,me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return S===null?C:1}let D=n;function Q(X,ae){for(let ve=0;ve0?g=_[_.length-1]:g=null,p.pop(),p.length>0?v=p[p.length-1]:v=null};function Mn(X,ae,ve,se){if(X.visible===!1)return;if(X.layers.test(ae.layers)){if(X.isGroup)ve=X.renderOrder;else if(X.isLOD)X.autoUpdate===!0&&X.update(ae);else if(X.isLight)g.pushLight(X),X.castShadow&&g.pushShadow(X);else if(X.isSprite){if(!X.frustumCulled||H.intersectsSprite(X)){se&&ge.setFromMatrixPosition(X.matrixWorld).applyMatrix4(ne);const We=I.update(X),qe=X.material;qe.visible&&v.push(X,We,qe,ve,ge.z,null)}}else if((X.isMesh||X.isLine||X.isPoints)&&(!X.frustumCulled||H.intersectsObject(X))){const We=I.update(X),qe=X.material;if(se&&(X.boundingSphere!==void 0?(X.boundingSphere===null&&X.computeBoundingSphere(),ge.copy(X.boundingSphere.center)):(We.boundingSphere===null&&We.computeBoundingSphere(),ge.copy(We.boundingSphere.center)),ge.applyMatrix4(X.matrixWorld).applyMatrix4(ne)),Array.isArray(qe)){const Ye=We.groups;for(let nt=0,Te=Ye.length;nt0&&yt(_e,Ge,ae,ve),se&&W.viewport(T.copy(se)),_e.length>0&&kt(_e,ae,ve),Ge.length>0&&kt(Ge,ae,ve),We.length>0&&kt(We,ae,ve),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1)}function yt(X,ae,ve,se){const _e=K.isWebGL2;ie===null&&(ie=new bi(1,1,{generateMipmaps:!0,type:j.has("EXT_color_buffer_half_float")?Ao:Ii,minFilter:Dr,samples:_e?4:0})),y.getDrawingBufferSize(ee),_e?ie.setSize(ee.x,ee.y):ie.setSize(xu(ee.x),xu(ee.y));const Ge=y.getRenderTarget();y.setRenderTarget(ie),y.getClearColor(A),z=y.getClearAlpha(),z<1&&y.setClearColor(16777215,.5),y.clear();const We=y.toneMapping;y.toneMapping=yi,kt(X,ve,se),fe.updateMultisampleRenderTarget(ie),fe.updateRenderTargetMipmap(ie);let qe=!1;for(let Ye=0,nt=ae.length;Ye0),Ze=!!ve.morphAttributes.position,At=!!ve.morphAttributes.normal,bt=!!ve.morphAttributes.color,dn=se.toneMapped?y.toneMapping:yi,Xn=ve.morphAttributes.position||ve.morphAttributes.normal||ve.morphAttributes.color,Ct=Xn!==void 0?Xn.length:0,at=re.get(se),fr=g.state.lights;if(Y===!0&&(J===!0||X!==E)){const on=X===E&&se.id===M;Me.setState(se,X,on)}let Wt=!1;se.version===at.__version?(at.needsLights&&at.lightsStateVersion!==fr.state.version||at.outputColorSpace!==qe||_e.isInstancedMesh&&at.instancing===!1||!_e.isInstancedMesh&&at.instancing===!0||_e.isSkinnedMesh&&at.skinning===!1||!_e.isSkinnedMesh&&at.skinning===!0||at.envMap!==Ye||se.fog===!0&&at.fog!==Ge||at.numClippingPlanes!==void 0&&(at.numClippingPlanes!==Me.numPlanes||at.numIntersection!==Me.numIntersection)||at.vertexAlphas!==nt||at.vertexTangents!==Te||at.morphTargets!==Ze||at.morphNormals!==At||at.morphColors!==bt||at.toneMapping!==dn||K.isWebGL2===!0&&at.morphTargetsCount!==Ct)&&(Wt=!0):(Wt=!0,at.__version=se.version);let qn=at.currentProgram;Wt===!0&&(qn=Vt(se,ae,_e));let Vo=!1,Bi=!1,Rs=!1;const Xt=qn.getUniforms(),si=at.uniforms;if(W.useProgram(qn.program)&&(Vo=!0,Bi=!0,Rs=!0),se.id!==M&&(M=se.id,Bi=!0),Vo||E!==X){if(Xt.setValue(D,"projectionMatrix",X.projectionMatrix),K.logarithmicDepthBuffer&&Xt.setValue(D,"logDepthBufFC",2/(Math.log(X.far+1)/Math.LN2)),E!==X&&(E=X,Bi=!0,Rs=!0),se.isShaderMaterial||se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshStandardMaterial||se.envMap){const on=Xt.map.cameraPosition;on!==void 0&&on.setValue(D,ge.setFromMatrixPosition(X.matrixWorld))}(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&Xt.setValue(D,"isOrthographic",X.isOrthographicCamera===!0),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial||se.isShadowMaterial||_e.isSkinnedMesh)&&Xt.setValue(D,"viewMatrix",X.matrixWorldInverse)}if(_e.isSkinnedMesh){Xt.setOptional(D,_e,"bindMatrix"),Xt.setOptional(D,_e,"bindMatrixInverse");const on=_e.skeleton;on&&(K.floatVertexTextures?(on.boneTexture===null&&on.computeBoneTexture(),Xt.setValue(D,"boneTexture",on.boneTexture,fe),Xt.setValue(D,"boneTextureSize",on.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Mi=ve.morphAttributes;if((Mi.position!==void 0||Mi.normal!==void 0||Mi.color!==void 0&&K.isWebGL2===!0)&&Ce.update(_e,ve,qn),(Bi||at.receiveShadow!==_e.receiveShadow)&&(at.receiveShadow=_e.receiveShadow,Xt.setValue(D,"receiveShadow",_e.receiveShadow)),se.isMeshGouraudMaterial&&se.envMap!==null&&(si.envMap.value=Ye,si.flipEnvMap.value=Ye.isCubeTexture&&Ye.isRenderTargetTexture===!1?-1:1),Bi&&(Xt.setValue(D,"toneMappingExposure",y.toneMappingExposure),at.needsLights&&Ei(si,Rs),Ge&&se.fog===!0&&he.refreshFogUniforms(si,Ge),he.refreshMaterialUniforms(si,se,C,N,ie),uu.upload(D,at.uniformsList,si,fe)),se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(uu.upload(D,at.uniformsList,si,fe),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&Xt.setValue(D,"center",_e.center),Xt.setValue(D,"modelViewMatrix",_e.modelViewMatrix),Xt.setValue(D,"normalMatrix",_e.normalMatrix),Xt.setValue(D,"modelMatrix",_e.matrixWorld),se.isShaderMaterial||se.isRawShaderMaterial){const on=se.uniformsGroups;for(let zr=0,Ho=on.length;zr0&&fe.useMultisampledRTT(X)===!1?_e=re.get(X).__webglMultisampledFramebuffer:_e=Te,T.copy(X.viewport),L.copy(X.scissor),P=X.scissorTest}else T.copy(U).multiplyScalar(C).floor(),L.copy(R).multiplyScalar(C).floor(),P=F;if(W.bindFramebuffer(D.FRAMEBUFFER,_e)&&K.drawBuffers&&se&&W.drawBuffers(X,_e),W.viewport(T),W.scissor(L),W.setScissorTest(P),Ge){const Ye=re.get(X.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+ae,Ye.__webglTexture,ve)}else if(We){const Ye=re.get(X.texture),nt=ae||0;D.framebufferTextureLayer(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,Ye.__webglTexture,ve||0,nt)}M=-1},this.readRenderTargetPixels=function(X,ae,ve,se,_e,Ge,We){if(!(X&&X.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let qe=re.get(X).__webglFramebuffer;if(X.isWebGLCubeRenderTarget&&We!==void 0&&(qe=qe[We]),qe){W.bindFramebuffer(D.FRAMEBUFFER,qe);try{const Ye=X.texture,nt=Ye.format,Te=Ye.type;if(nt!==Ln&&Ee.convert(nt)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=Te===Ao&&(j.has("EXT_color_buffer_half_float")||K.isWebGL2&&j.has("EXT_color_buffer_float"));if(Te!==Ii&&Ee.convert(Te)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Te===Li&&(K.isWebGL2||j.has("OES_texture_float")||j.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ae>=0&&ae<=X.width-se&&ve>=0&&ve<=X.height-_e&&D.readPixels(ae,ve,se,_e,Ee.convert(nt),Ee.convert(Te),Ge)}finally{const Ye=S!==null?re.get(S).__webglFramebuffer:null;W.bindFramebuffer(D.FRAMEBUFFER,Ye)}}},this.copyFramebufferToTexture=function(X,ae,ve=0){const se=Math.pow(2,-ve),_e=Math.floor(ae.image.width*se),Ge=Math.floor(ae.image.height*se);fe.setTexture2D(ae,0),D.copyTexSubImage2D(D.TEXTURE_2D,ve,0,0,X.x,X.y,_e,Ge),W.unbindTexture()},this.copyTextureToTexture=function(X,ae,ve,se=0){const _e=ae.image.width,Ge=ae.image.height,We=Ee.convert(ve.format),qe=Ee.convert(ve.type);fe.setTexture2D(ve,0),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,ve.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ve.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,ve.unpackAlignment),ae.isDataTexture?D.texSubImage2D(D.TEXTURE_2D,se,X.x,X.y,_e,Ge,We,qe,ae.image.data):ae.isCompressedTexture?D.compressedTexSubImage2D(D.TEXTURE_2D,se,X.x,X.y,ae.mipmaps[0].width,ae.mipmaps[0].height,We,ae.mipmaps[0].data):D.texSubImage2D(D.TEXTURE_2D,se,X.x,X.y,We,qe,ae.image),se===0&&ve.generateMipmaps&&D.generateMipmap(D.TEXTURE_2D),W.unbindTexture()},this.copyTextureToTexture3D=function(X,ae,ve,se,_e=0){if(y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ge=X.max.x-X.min.x+1,We=X.max.y-X.min.y+1,qe=X.max.z-X.min.z+1,Ye=Ee.convert(se.format),nt=Ee.convert(se.type);let Te;if(se.isData3DTexture)fe.setTexture3D(se,0),Te=D.TEXTURE_3D;else if(se.isDataArrayTexture)fe.setTexture2DArray(se,0),Te=D.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,se.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,se.unpackAlignment);const Ze=D.getParameter(D.UNPACK_ROW_LENGTH),At=D.getParameter(D.UNPACK_IMAGE_HEIGHT),bt=D.getParameter(D.UNPACK_SKIP_PIXELS),dn=D.getParameter(D.UNPACK_SKIP_ROWS),Xn=D.getParameter(D.UNPACK_SKIP_IMAGES),Ct=ve.isCompressedTexture?ve.mipmaps[0]:ve.image;D.pixelStorei(D.UNPACK_ROW_LENGTH,Ct.width),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,Ct.height),D.pixelStorei(D.UNPACK_SKIP_PIXELS,X.min.x),D.pixelStorei(D.UNPACK_SKIP_ROWS,X.min.y),D.pixelStorei(D.UNPACK_SKIP_IMAGES,X.min.z),ve.isDataTexture||ve.isData3DTexture?D.texSubImage3D(Te,_e,ae.x,ae.y,ae.z,Ge,We,qe,Ye,nt,Ct.data):ve.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),D.compressedTexSubImage3D(Te,_e,ae.x,ae.y,ae.z,Ge,We,qe,Ye,Ct.data)):D.texSubImage3D(Te,_e,ae.x,ae.y,ae.z,Ge,We,qe,Ye,nt,Ct),D.pixelStorei(D.UNPACK_ROW_LENGTH,Ze),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,At),D.pixelStorei(D.UNPACK_SKIP_PIXELS,bt),D.pixelStorei(D.UNPACK_SKIP_ROWS,dn),D.pixelStorei(D.UNPACK_SKIP_IMAGES,Xn),_e===0&&se.generateMipmaps&&D.generateMipmap(Te),W.unbindTexture()},this.initTexture=function(X){X.isCubeTexture?fe.setTextureCube(X,0):X.isData3DTexture?fe.setTexture3D(X,0):X.isDataArrayTexture||X.isCompressedArrayTexture?fe.setTexture2DArray(X,0):fe.setTexture2D(X,0),W.unbindTexture()},this.resetState=function(){b=0,w=0,S=null,W.reset(),De.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Di}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===et?Ar:Qp}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ar?et:xi}}class rb extends lm{}rb.prototype.isWebGL1Renderer=!0;class Hu{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ne(e),this.density=t}clone(){return new Hu(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class Wu{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Ne(e),this.near=t,this.far=n}clone(){return new Wu(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class ac extends gt{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),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,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class Xu{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=rc,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Bn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;ie.far||t.push({distance:c,point:da.clone(),uv:Pn.getInterpolation(da,Sl,ma,El,B0,xf,G0,new be),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Ml(r,e,t,n,i,s){ro.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(pa.x=s*ro.x-i*ro.y,pa.y=i*ro.x+s*ro.y):pa.copy(ro),r.copy(e),r.x+=pa.x,r.y+=pa.y,r.applyMatrix4(sb)}const Tl=new G,V0=new G;class ab extends gt{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 t=e.levels;for(let n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){Tl.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Tl);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Tl.setFromMatrixPosition(e.matrixWorld),V0.setFromMatrixPosition(this.matrixWorld);const n=Tl.distanceTo(V0)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;ic)continue;f.applyMatrix4(this.matrixWorld);const M=e.ray.origin.distanceTo(f);Me.far||t.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else{const p=Math.max(0,o.start),_=Math.min(g.count,o.start+o.count);for(let y=p,x=_-1;yc)continue;f.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(f);we.far||t.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,object:o})}}class FR extends Ft{constructor(e,t,n,i,s,o,a,c,l){super(e,t,n,i,s,o,a,c,l),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Pt,this.magFilter=s!==void 0?s:Pt,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}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 kR extends Ft{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Yt,this.minFilter=Yt,this.generateMipmaps=!1,this.needsUpdate=!0}}class dm extends Ft{constructor(e,t,n,i,s,o,a,c,l,u,h,f){super(null,o,a,c,l,u,i,s,h,f),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class zR extends dm{constructor(e,t,n,i,s,o){super(e,t,n,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=gn}}class BR extends Ft{constructor(e,t,n,i,s,o,a,c,l){super(e,t,n,i,s,o,a,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class wi{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}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 t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,c=s-1,l;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),l=n[i]-o,l<0)a=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(s-1);const u=n[i],f=n[i+1]-u,d=(o-u)/f;return(i+d)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),c=t||(o.isVector2?new be:new G);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new G,i=[],s=[],o=[],a=new G,c=new Ke;for(let d=0;d<=e;d++){const m=d/e;i[d]=this.getTangentAt(m,new G)}s[0]=new G,o[0]=new G;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),f=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),f<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(Bt(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(c.makeRotationAxis(a,m))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(Bt(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let m=1;m<=e;m++)s[m].applyMatrix4(c.makeRotationAxis(i[m],d*m)),o[m].crossVectors(i[m],s[m])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Yu extends wi{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t){const n=t||new be,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:c===0&&a===s-1&&(a=s-2,c=1);let l,u;this.closed||a>0?l=i[(a-1)%s]:(Ll.subVectors(i[0],i[1]).add(i[0]),l=Ll);const h=i[a%s],f=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return n.set(rv(a,c.x,l.x,u.x,h.x),rv(a,c.y,l.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const o=i[s]-n,a=this.curves[s],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}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 t=0;for(let n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),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 Dc extends st{constructor(e=[new be(0,-.5),new be(.5,0),new be(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Bt(i,0,Math.PI*2);const s=[],o=[],a=[],c=[],l=[],u=1/t,h=new G,f=new be,d=new G,m=new G,v=new G;let g=0,p=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:g=e[_+1].x-e[_].x,p=e[_+1].y-e[_].y,d.x=p*1,d.y=-g,d.z=p*0,v.copy(d),d.normalize(),c.push(d.x,d.y,d.z);break;case e.length-1:c.push(v.x,v.y,v.z);break;default:g=e[_+1].x-e[_].x,p=e[_+1].y-e[_].y,d.x=p*1,d.y=-g,d.z=p*0,m.copy(d),d.x+=v.x,d.y+=v.y,d.z+=v.z,d.normalize(),c.push(d.x,d.y,d.z),v.copy(m)}for(let _=0;_<=t;_++){const y=n+_*u*i,x=Math.sin(y),b=Math.cos(y);for(let w=0;w<=e.length-1;w++){h.x=e[w].x*x,h.y=e[w].y,h.z=e[w].x*b,o.push(h.x,h.y,h.z),f.x=_/t,f.y=w/(e.length-1),a.push(f.x,f.y);const S=c[3*w+0]*x,M=c[3*w+1],E=c[3*w+0]*b;l.push(S,M,E)}}for(let _=0;_0&&y(!0),t>0&&y(!1)),this.setIndex(u),this.setAttribute("position",new He(h,3)),this.setAttribute("normal",new He(f,3)),this.setAttribute("uv",new He(d,2));function _(){const x=new G,b=new G;let w=0;const S=(t-e)/n;for(let M=0;M<=s;M++){const E=[],T=M/s,L=T*(t-e)+e;for(let P=0;P<=i;P++){const A=P/i,z=A*c+a,V=Math.sin(z),N=Math.cos(z);b.x=L*V,b.y=-T*n+g,b.z=L*N,h.push(b.x,b.y,b.z),x.set(V,S,N).normalize(),f.push(x.x,x.y,x.z),d.push(A,1-T),E.push(m++)}v.push(E)}for(let M=0;M.9&&S<.1&&(y<.2&&(o[_+0]+=1),x<.2&&(o[_+2]+=1),b<.2&&(o[_+4]+=1))}}function f(_){s.push(_.x,_.y,_.z)}function d(_,y){const x=_*3;y.x=e[x+0],y.y=e[x+1],y.z=e[x+2]}function m(){const _=new G,y=new G,x=new G,b=new G,w=new be,S=new be,M=new be;for(let E=0,T=0;E80*t){a=l=r[0],c=u=r[1];for(let m=t;ml&&(l=h),f>u&&(u=f);d=Math.max(l-a,u-c),d=d!==0?32767/d:0}return lc(s,o,t,a,c,d,0),o}};function vb(r,e,t,n,i){let s,o;if(i===uP(r,e,t,n)>0)for(s=e;s=e;s-=n)o=sv(s,r[s],r[s+1],o);return o&&eh(o,o.next)&&(hc(o),o=o.next),o}function _s(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(eh(t,t.next)||It(t.prev,t,t.next)===0)){if(hc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function lc(r,e,t,n,i,s,o){if(!r)return;!o&&s&&rP(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?ZR(r,n,i,s):$R(r)){e.push(c.i/t|0),e.push(r.i/t|0),e.push(l.i/t|0),hc(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=KR(_s(r),e,t),lc(r,e,t,n,i,s,2)):o===2&&JR(r,e,t,n,i,s):lc(_s(r),e,t,n,i,s,1);break}}}function $R(r){const e=r.prev,t=r,n=r.next;if(It(e,t,n)>=0)return!1;const i=e.x,s=t.x,o=n.x,a=e.y,c=t.y,l=n.y,u=is?i>o?i:o:s>o?s:o,d=a>c?a>l?a:l:c>l?c:l;let m=n.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=h&&m.y<=d&&xo(i,a,s,c,o,l,m.x,m.y)&&It(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function ZR(r,e,t,n){const i=r.prev,s=r,o=r.next;if(It(i,s,o)>=0)return!1;const a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,f=o.y,d=ac?a>l?a:l:c>l?c:l,g=u>h?u>f?u:f:h>f?h:f,p=dp(d,m,e,t,n),_=dp(v,g,e,t,n);let y=r.prevZ,x=r.nextZ;for(;y&&y.z>=p&&x&&x.z<=_;){if(y.x>=d&&y.x<=v&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&xo(a,u,c,h,l,f,y.x,y.y)&&It(y.prev,y,y.next)>=0||(y=y.prevZ,x.x>=d&&x.x<=v&&x.y>=m&&x.y<=g&&x!==i&&x!==o&&xo(a,u,c,h,l,f,x.x,x.y)&&It(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;y&&y.z>=p;){if(y.x>=d&&y.x<=v&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&xo(a,u,c,h,l,f,y.x,y.y)&&It(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=_;){if(x.x>=d&&x.x<=v&&x.y>=m&&x.y<=g&&x!==i&&x!==o&&xo(a,u,c,h,l,f,x.x,x.y)&&It(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function KR(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!eh(i,s)&&_b(i,n,n.next,s)&&uc(i,s)&&uc(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),hc(n),hc(n.next),n=r=s),n=n.next}while(n!==r);return _s(n)}function JR(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&aP(o,a)){let c=yb(o,a);o=_s(o,o.next),c=_s(c,c.next),lc(o,e,t,n,i,s,0),lc(c,e,t,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function QR(r,e,t,n){const i=[];let s,o,a,c,l;for(s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){const f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>n&&(n=f,i=t.x=t.x&&t.x>=c&&s!==t.x&&xo(oi.x||t.x===i.x&&iP(i,t)))&&(i=t,u=h)),t=t.next;while(t!==a);return i}function iP(r,e){return It(r.prev,r,e.prev)<0&&It(e.next,r,r.next)<0}function rP(r,e,t,n){let i=r;do i.z===0&&(i.z=dp(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,sP(i)}function sP(r){let e,t,n,i,s,o,a,c,l=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,n=t,a=0,e=0;e0||c>0&&n;)a!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,c--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,l*=2}while(o>1);return r}function dp(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function oP(r){let e=r,t=r;do(e.x=(r-o)*(s-a)&&(r-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(n-a)}function aP(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!cP(r,e)&&(uc(r,e)&&uc(e,r)&&lP(r,e)&&(It(r.prev,r,e.prev)||It(r,e.prev,e))||eh(r,e)&&It(r.prev,r,r.next)>0&&It(e.prev,e,e.next)>0)}function It(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function eh(r,e){return r.x===e.x&&r.y===e.y}function _b(r,e,t,n){const i=Nl(It(r,e,t)),s=Nl(It(r,e,n)),o=Nl(It(t,n,r)),a=Nl(It(t,n,e));return!!(i!==s&&o!==a||i===0&&Ol(r,t,e)||s===0&&Ol(r,n,e)||o===0&&Ol(t,r,n)||a===0&&Ol(t,e,n))}function Ol(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Nl(r){return r>0?1:r<0?-1:0}function cP(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&_b(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function uc(r,e){return It(r.prev,r,r.next)<0?It(r,e,r.next)>=0&&It(r,r.prev,e)>=0:It(r,e,r.prev)<0||It(r,r.next,e)<0}function lP(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function yb(r,e){const t=new pp(r.i,r.x,r.y),n=new pp(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function sv(r,e,t,n){const i=new pp(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function hc(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function pp(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function uP(r,e,t,n){let i=0;for(let s=e,o=t-n;s2&&r[e-1].equals(r[0])&&r.pop()}function av(r,e){for(let t=0;tNumber.EPSILON){const I=Math.sqrt(Pe),$=Math.sqrt(xe*xe+ce*ce),he=Q.x-fe/I,de=Q.y+re/I,pe=j.x-ce/$,Me=j.y+xe/$,we=((pe-he)*ce-(Me-de)*xe)/(re*ce-fe*xe);K=he+re*we-D.x,W=de+fe*we-D.y;const ue=K*K+W*W;if(ue<=2)return new be(K,W);ye=Math.sqrt(ue/2)}else{let I=!1;re>Number.EPSILON?xe>Number.EPSILON&&(I=!0):re<-Number.EPSILON?xe<-Number.EPSILON&&(I=!0):Math.sign(fe)===Math.sign(ce)&&(I=!0),I?(K=-fe,W=re,ye=Math.sqrt(Pe)):(K=re,W=fe,ye=Math.sqrt(Pe/2))}return new be(K/ye,W/ye)}const k=[];for(let D=0,Q=z.length,j=Q-1,K=D+1;D=0;D--){const Q=D/g,j=d*Math.cos(Q*Math.PI/2),K=m*Math.sin(Q*Math.PI/2)+v;for(let W=0,ye=z.length;W=0;){const K=j;let W=j-1;W<0&&(W=D.length-1);for(let ye=0,re=u+g*2;ye0)&&d.push(y,x,w),(p!==n-1||c0!=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 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.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 Eb extends un{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ne(16777215),this.specular=new Ne(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Or,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Rc,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.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 Mb extends un{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ne(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Or,this.normalScale=new be(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 Tb extends un{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Or,this.normalScale=new be(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 Ab extends un{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ne(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Or,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Rc,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.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 Cb extends un{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ne(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Or,this.normalScale=new be(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 Rb extends Sn{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 Kn(r,e,t){return bm(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)}function cs(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function bm(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Pb(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function mp(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let c=0;c!==e;++c)i[o++]=r[a+c]}return i}function wm(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}function pP(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let c=0;c=n)){h.push(l.times[d]);for(let v=0;vs.tracks[c].times[0]&&(a=s.tracks[c].times[0]);for(let c=0;c=a.times[m]){const p=m*h+u,_=p+h-u;v=Kn(a.values,p,_)}else{const p=a.createInterpolant(),_=u,y=h-u;p.evaluate(s),v=Kn(p.resultBuffer,_,y)}c==="quaternion"&&new ln().fromArray(v).normalize().conjugate().toArray(v);const g=l.times.length;for(let p=0;p=s)){const a=t[1];e=s)break t}o=n,n=0;break n}break e}for(;n>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=Kn(n,s,o),this.values=Kn(this.values,s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&bm(i))for(let a=0,c=i.length;a!==c;++a){const l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){const e=Kn(this.times),t=Kn(this.values),n=this.getValueSize(),i=this.getInterpolation()===cu,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=Kn(e,0,o),this.values=Kn(t,0,o*n)):(this.times=e,this.values=t),this}clone(){const e=Kn(this.times,0),t=Kn(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Si.prototype.TimeBufferType=Float32Array;Si.prototype.ValueBufferType=Float32Array;Si.prototype.DefaultInterpolation=nc;class As extends Si{}As.prototype.ValueTypeName="bool";As.prototype.ValueBufferType=Array;As.prototype.DefaultInterpolation=tc;As.prototype.InterpolantFactoryMethodLinear=void 0;As.prototype.InterpolantFactoryMethodSmooth=void 0;class Em extends Si{}Em.prototype.ValueTypeName="color";class fc extends Si{}fc.prototype.ValueTypeName="number";class Ib extends Oc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t);let l=e*a;for(let u=l+a;l!==u;l+=4)ln.slerpFlat(s,0,o,l-a,o,l,c);return s}}class ko extends Si{InterpolantFactoryMethodLinear(e){return new Ib(this.times,this.values,this.getValueSize(),e)}}ko.prototype.ValueTypeName="quaternion";ko.prototype.DefaultInterpolation=nc;ko.prototype.InterpolantFactoryMethodSmooth=void 0;class Cs extends Si{}Cs.prototype.ValueTypeName="string";Cs.prototype.ValueBufferType=Array;Cs.prototype.DefaultInterpolation=tc;Cs.prototype.InterpolantFactoryMethodLinear=void 0;Cs.prototype.InterpolantFactoryMethodSmooth=void 0;class dc extends Si{}dc.prototype.ValueTypeName="vector";class pc{constructor(e,t=-1,n,i=Fu){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Bn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(_P(n[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push(Si.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a1){const h=u[1];let f=i[h];f||(i[h]=f=[]),f.push(l)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,f,d,m,v){if(d.length!==0){const g=[],p=[];wm(d,g,p,m),g.length!==0&&v.push(new h(f,g,p))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let h=0;h{t&&t(s),this.manager.itemEnd(e)},0),s;if(Zi[e]!==void 0){Zi[e].push({onLoad:t,onProgress:n,onError:i});return}Zi[e]=[],Zi[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const u=Zi[e],h=l.body.getReader(),f=l.headers.get("Content-Length")||l.headers.get("X-File-Size"),d=f?parseInt(f):0,m=d!==0;let v=0;const g=new ReadableStream({start(p){_();function _(){h.read().then(({done:y,value:x})=>{if(y)p.close();else{v+=x.byteLength;const b=new ProgressEvent("progress",{lengthComputable:m,loaded:v,total:d});for(let w=0,S=u.length;w{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return l.json();default:if(a===void 0)return l.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(f);return l.arrayBuffer().then(m=>d.decode(m))}}}).then(l=>{xs.add(e,l);const u=Zi[e];delete Zi[e];for(let h=0,f=u.length;h{const u=Zi[e];if(u===void 0)throw this.manager.itemError(e),l;delete Zi[e];for(let h=0,f=u.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class xP extends Dn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new sr(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(c){i?i(c):console.error(c),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=n(o.value);break;case"c":i.uniforms[s].value=new Ne().setHex(o.value);break;case"v2":i.uniforms[s].value=new be().fromArray(o.value);break;case"v3":i.uniforms[s].value=new G().fromArray(o.value);break;case"v4":i.uniforms[s].value=new mt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new rt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new Ke().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(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 be().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),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=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new be().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:bb,SpriteMaterial:um,RawShaderMaterial:wb,ShaderMaterial:Ni,PointsMaterial:fm,MeshPhysicalMaterial:Sb,MeshStandardMaterial:xm,MeshPhongMaterial:Eb,MeshToonMaterial:Mb,MeshNormalMaterial:Tb,MeshLambertMaterial:Ab,MeshDepthMaterial:Gu,MeshDistanceMaterial:Vu,MeshBasicMaterial:cr,MeshMatcapMaterial:Cb,LineDashedMaterial:Rb,LineBasicMaterial:Sn,Material:un};return new t[e]}}class gp{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n0){const c=new Mm(t);s=new mc(c),s.setCrossOrigin(this.crossOrigin);for(let l=0,u=e.length;l0){i=new mc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o"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,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=xs.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){xs.add(e,c),t&&t(c),s.manager.itemEnd(e)}).catch(function(c){i&&i(c),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let Fl;class Cm{static getContext(){return Fl===void 0&&(Fl=new(window.AudioContext||window.webkitAudioContext)),Fl}static setContext(e){Fl=e}}class PP extends Dn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new sr(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{const l=c.slice(0);Cm.getContext().decodeAudioData(l,function(h){t(h)},a)}catch(l){a(l)}},n,i);function a(c){i?i(c):console.error(c),s.manager.itemError(e)}}}class LP extends ch{constructor(e,t,n=1){super(void 0,n),this.isHemisphereLightProbe=!0;const i=new Ne().set(e),s=new Ne().set(t),o=new G(i.r,i.g,i.b),a=new G(s.r,s.g,s.b),c=Math.sqrt(Math.PI),l=c*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(c),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l)}}class DP extends ch{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const n=new Ne().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const mv=new Ke,gv=new Ke,qr=new Ke;class IP{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Zt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Zt,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 t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,qr.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(us*t.fov*.5)/t.zoom;let a,c;gv.elements[12]=-i,mv.elements[12]=i,a=-o*t.aspect+s,c=o*t.aspect+s,qr.elements[0]=2*t.near/(c-a),qr.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(qr),a=-o*t.aspect-s,c=o*t.aspect-s,qr.elements[0]=2*t.near/(c-a),qr.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(qr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(gv),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(mv)}}class Rm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=vv(),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 t=vv();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function vv(){return(typeof performance>"u"?Date:performance).now()}const Yr=new G,_v=new ln,UP=new G,jr=new G;class OP extends gt{constructor(){super(),this.type="AudioListener",this.context=Cm.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Rm}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 t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Yr,_v,UP),jr.set(0,0,-1).applyQuaternion(_v),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Yr.x,i),t.positionY.linearRampToValueAtTime(Yr.y,i),t.positionZ.linearRampToValueAtTime(Yr.z,i),t.forwardX.linearRampToValueAtTime(jr.x,i),t.forwardY.linearRampToValueAtTime(jr.y,i),t.forwardZ.linearRampToValueAtTime(jr.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Yr.x,Yr.y,Yr.z),t.setOrientation(jr.x,jr.y,jr.z,n.x,n.y,n.z)}}class Wb extends gt{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 t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,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(){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.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];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,t=e+this.valueSize;for(let n=e;n=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){ln.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;ln.multiplyQuaternionsFlat(e,o,e,t,e,n),ln.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const c=t+a;e[c]=e[c]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const Pm="\\[\\]\\.:\\/",zP=new RegExp("["+Pm+"]","g"),Lm="[^"+Pm+"]",BP="[^"+Pm.replace("\\.","")+"]",GP=/((?:WC+[\/:])*)/.source.replace("WC",Lm),VP=/(WCOD+)?/.source.replace("WCOD",BP),HP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Lm),WP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Lm),XP=new RegExp("^"+GP+VP+HP+WP+"$"),qP=["material","materials","bones","map"];class YP{constructor(e,t,n){const i=n||ht.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class ht{constructor(e,t,n){this.path=t,this.parsedPath=n||ht.parseTrackName(t),this.node=ht.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new ht.Composite(e,t,n):new ht(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(zP,"")}static parseTrackName(e){const t=XP.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);qP.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o=s){const h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[l]=h,e[h]=c;for(let d=0,m=i;d!==m;++d){const v=n[d],g=v[h],p=v[u];v[u]=g,v[h]=p}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){const l=arguments[a],u=l.uuid,h=t[u];if(h!==void 0)if(delete t[u],h0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let m=0,v=i;m!==v;++m){const g=n[m];g[h]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,c=this._objects,l=c.length,u=this.nCachedObjects_,h=new Array(l);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(h);for(let f=u,d=c.length;f!==d;++f){const m=c[f];h[f]=new ht(m,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],l=e[a];t[l]=n,o[n]=c,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}}class qb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),c={endingStart:ss,endingEnd:ss};for(let l=0;l!==o;++l){const u=s[l].createInterpolant(null);a[l]=u,u.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Lx,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,t){return this.loop=e,this.repetitions=t,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,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}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,t,n){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,l=a.sampleValues;return c[0]=s,c[1]=s+n,l[0]=e/o,l[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Jp:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(a);break;case Fu:default:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const o=n===Dx;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===Px){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=os,i.endingEnd=os):(e?i.endingStart=this.zeroSlopeAtStart?os:ss:i.endingStart=ic,t?i.endingEnd=this.zeroSlopeAtEnd?os:ss:i.endingEnd=ic)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=s,c[0]=t,a[1]=s+e,c[1]=n,this}}const $P=new Float32Array(1);class ZP extends ar{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let u=l[c];u===void 0&&(u={},l[c]=u);for(let h=0;h!==s;++h){const f=i[h],d=f.name;let m=u[d];if(m!==void 0)++m.referenceCount,o[h]=m;else{if(m=o[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,c,d));continue}const v=t&&t._propertyBindings[h].binding.parsedPath;m=new Xb(ht.create(n,d,v),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,c,d),o[h]=m}a[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--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 t=e._cacheIndex;return t!==null&&t=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,s,o);const a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.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,t){return t.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.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,bv).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 wv=new G,kl=new G;class iL{constructor(e=new G,t=new G){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),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,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){wv.subVectors(e,this.start),kl.subVectors(this.end,this.start);const n=kl.dot(kl);let s=kl.dot(wv)/n;return t&&(s=Bt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).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 Sv=new G;class rL extends gt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new st,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,c=32;o1)for(let h=0;h.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Cv.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Cv,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),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 vL extends zi{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new st;i.setAttribute("position",new He(t,3)),i.setAttribute("color",new He(n,3));const s=new Sn({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new Ne,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class _L{constructor(){this.type="ShapePath",this.color=new Ne,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new cc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(p){const _=[];for(let y=0,x=p.length;yNumber.EPSILON){if(T<0&&(S=_[w],E=-E,M=_[b],T=-T),p.yM.y)continue;if(p.y===S.y){if(p.x===S.x)return!0}else{const L=T*(p.x-S.x)-E*(p.y-S.y);if(L===0)return!0;if(L<0)continue;x=!x}}else{if(p.y!==S.y)continue;if(M.x<=p.x&&p.x<=S.x||S.x<=p.x&&p.x<=M.x)return!0}}return x}const i=Ui.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,c;const l=[];if(s.length===1)return a=s[0],c=new fs,c.curves=a.curves,l.push(c),l;let u=!i(s[0].getPoints());u=e?!u:u;const h=[],f=[];let d=[],m=0,v;f[m]=void 0,d[m]=[];for(let p=0,_=s.length;p<_;p++)a=s[p],v=a.getPoints(),o=i(v),o=e?!o:o,o?(!u&&f[m]&&m++,f[m]={s:new fs,p:v},f[m].s.curves=a.curves,u&&m++,d[m]=[]):d[m].push({h:a,p:v[0]});if(!f[0])return t(s);if(f.length>1){let p=!1,_=0;for(let y=0,x=f.length;y0&&p===!1&&(d=h)}let g;for(let p=0,_=f.length;p<_;p++){c=f[p].s,l.push(c),g=d[p];for(let y=0,x=g.length;y{const h=typeof l=="function"?l(e):l;if(h!==e){const f=e;e=u?h:Object.assign({},e,h),t.forEach(d=>d(e,f))}},i=()=>e,s=(l,u=i,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let f=u(e);function d(){const m=u(e);if(!h(f,m)){const v=f;l(f=m,v)}}return t.add(d),()=>t.delete(d)},c={setState:n,getState:i,subscribe:(l,u,h)=>u||h?s(l,u,h):(t.add(l),()=>t.delete(l)),destroy:()=>t.clear()};return e=r(n,i,c),c}const xL=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),Rv=xL?q.useEffect:q.useLayoutEffect;function bL(r){const e=typeof r=="function"?yL(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=q.useReducer(g=>g+1,0),o=e.getState(),a=q.useRef(o),c=q.useRef(n),l=q.useRef(i),u=q.useRef(!1),h=q.useRef();h.current===void 0&&(h.current=n(o));let f,d=!1;(a.current!==o||c.current!==n||l.current!==i||u.current)&&(f=n(o),d=!i(h.current,f)),Rv(()=>{d&&(h.current=f),a.current=o,c.current=n,l.current=i,u.current=!1});const m=q.useRef(o);Rv(()=>{const g=()=>{try{const _=e.getState(),y=c.current(_);l.current(h.current,y)||(a.current=_,h.current=y,s())}catch{u.current=!0,s()}},p=e.subscribe(g);return e.getState()!==m.current&&g(),p},[]);const v=d?f:h.current;return q.useDebugValue(v),v};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const n=[t,e];return{next(){const i=n.length<=0;return{value:n.shift(),done:i}}}},t}var Df={exports:{}},If={};/** - * @license React - * scheduler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Pv;function wL(){return Pv||(Pv=1,(function(r){function e(O,k){var U=O.length;O.push(k);e:for(;0>>1,F=O[R];if(0>>1;Ri(J,U))iei(ne,J)?(O[R]=ne,O[ie]=U,R=ie):(O[R]=J,O[Y]=U,R=Y);else if(iei(ne,U))O[R]=ne,O[ie]=U,R=ie;else break e}}return k}function i(O,k){var U=O.sortIndex-k.sortIndex;return U!==0?U:O.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();r.unstable_now=function(){return o.now()-a}}var c=[],l=[],u=1,h=null,f=3,d=!1,m=!1,v=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(O){for(var k=t(l);k!==null;){if(k.callback===null)n(l);else if(k.startTime<=O)n(l),k.sortIndex=k.expirationTime,e(c,k);else break;k=t(l)}}function x(O){if(v=!1,y(O),!m)if(t(c)!==null)m=!0,N(b);else{var k=t(l);k!==null&&C(x,k.startTime-O)}}function b(O,k){m=!1,v&&(v=!1,p(M),M=-1),d=!0;var U=f;try{for(y(k),h=t(c);h!==null&&(!(h.expirationTime>k)||O&&!L());){var R=h.callback;if(typeof R=="function"){h.callback=null,f=h.priorityLevel;var F=R(h.expirationTime<=k);k=r.unstable_now(),typeof F=="function"?h.callback=F:h===t(c)&&n(c),y(k)}else n(c);h=t(c)}if(h!==null)var H=!0;else{var Y=t(l);Y!==null&&C(x,Y.startTime-k),H=!1}return H}finally{h=null,f=U,d=!1}}var w=!1,S=null,M=-1,E=5,T=-1;function L(){return!(r.unstable_now()-TO||125R?(O.sortIndex=U,e(l,O),t(c)===null&&O===t(l)&&(v?(p(M),M=-1):v=!0,C(x,U-R))):(O.sortIndex=F,e(c,O),m||d||(m=!0,N(b))),O},r.unstable_shouldYield=L,r.unstable_wrapCallback=function(O){var k=f;return function(){var U=f;f=k;try{return O.apply(this,arguments)}finally{f=U}}}})(If)),If}var Lv;function SL(){return Lv||(Lv=1,Df.exports=wL()),Df.exports}var Dv=SL();const Um={},Zb=r=>void Object.assign(Um,r);function EL(r,e){function t(u,{args:h=[],attach:f,...d},m){let v=`${u[0].toUpperCase()}${u.slice(1)}`,g;if(u==="primitive"){if(d.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const p=d.object;g=po(p,{type:u,root:m,attach:f,primitive:!0})}else{const p=Um[v];if(!p)throw new Error(`R3F: ${v} 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(h))throw new Error("R3F: The args prop must be an array!");g=po(new p(...h),{type:u,root:m,attach:f,memoizedProps:{args:h}})}return g.__r3f.attach===void 0&&(g instanceof st?g.__r3f.attach="geometry":g instanceof un&&(g.__r3f.attach="material")),v!=="inject"&&Nf(g,d),g}function n(u,h){let f=!1;if(h){var d,m;(d=h.__r3f)!=null&&d.attach?Of(u,h,h.__r3f.attach):h.isObject3D&&u.isObject3D&&(u.add(h),f=!0),f||(m=u.__r3f)==null||m.objects.push(h),h.__r3f||po(h,{}),h.__r3f.parent=u,yp(h),mo(h)}}function i(u,h,f){let d=!1;if(h){var m,v;if((m=h.__r3f)!=null&&m.attach)Of(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){h.parent=u,h.dispatchEvent({type:"added"});const g=u.children.filter(_=>_!==h),p=g.indexOf(f);u.children=[...g.slice(0,p),h,...g.slice(p)],d=!0}d||(v=u.__r3f)==null||v.objects.push(h),h.__r3f||po(h,{}),h.__r3f.parent=u,yp(h),mo(h)}}function s(u,h,f=!1){u&&[...u].forEach(d=>o(h,d,f))}function o(u,h,f){if(h){var d,m,v;if(h.__r3f&&(h.__r3f.parent=null),(d=u.__r3f)!=null&&d.objects&&(u.__r3f.objects=u.__r3f.objects.filter(x=>x!==h)),(m=h.__r3f)!=null&&m.attach)Fv(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){var g;u.remove(h),(g=h.__r3f)!=null&&g.root&&LL(h.__r3f.root,h)}const _=(v=h.__r3f)==null?void 0:v.primitive,y=f===void 0?h.dispose!==null&&!_:f;if(!_){var p;s((p=h.__r3f)==null?void 0:p.objects,h,y),s(h.children,h,y)}delete h.__r3f,y&&h.dispose&&h.type!=="Scene"&&Dv.unstable_scheduleCallback(Dv.unstable_IdlePriority,()=>{try{h.dispose()}catch{}}),mo(u)}}function a(u,h,f,d){var m;const v=(m=u.__r3f)==null?void 0:m.parent;if(!v)return;const g=t(h,f,u.__r3f.root);if(u.children){for(const p of u.children)p.__r3f&&n(g,p);u.children=u.children.filter(p=>!p.__r3f)}u.__r3f.objects.forEach(p=>n(g,p)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||o(v,u),g.parent&&(g.__r3f.autoRemovedBeforeAppend=!0),n(v,g),g.raycast&&g.__r3f.eventCount&&g.__r3f.root.getState().internal.interaction.push(g),[d,d.alternate].forEach(p=>{p!==null&&(p.stateNode=g,p.ref&&(typeof p.ref=="function"?p.ref(g):p.ref.current=g))})}const c=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:Yw({createInstance:t,removeChild:o,appendChild:n,appendInitialChild:n,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,h)=>{if(!h)return;const f=u.getState().scene;f.__r3f&&(f.__r3f.root=u,n(f,h))},removeChildFromContainer:(u,h)=>{h&&o(u.getState().scene,h)},insertInContainerBefore:(u,h,f)=>{if(!h||!f)return;const d=u.getState().scene;d.__r3f&&i(d,h,f)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var h;return!!((h=u==null?void 0:u.__r3f)!=null?h:{}).handlers},prepareUpdate(u,h,f,d){var m;if(((m=u==null?void 0:u.__r3f)!=null?m:{}).primitive&&d.object&&d.object!==u)return[!0];{const{args:g=[],children:p,..._}=d,{args:y=[],children:x,...b}=f;if(!Array.isArray(g))throw new Error("R3F: the args prop must be an array!");if(g.some((S,M)=>S!==y[M]))return[!0];const w=i1(u,_,b,!0);return w.changes.length?[!1,w]:null}},commitUpdate(u,[h,f],d,m,v,g){h?a(u,d,v,g):Nf(u,f)},commitMount(u,h,f,d){var m;const v=(m=u.__r3f)!=null?m:{};u.raycast&&v.handlers&&v.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>po(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var h;const{attach:f,parent:d}=(h=u.__r3f)!=null?h:{};f&&d&&Fv(d,u,f),u.isObject3D&&(u.visible=!1),mo(u)},unhideInstance(u,h){var f;const{attach:d,parent:m}=(f=u.__r3f)!=null?f:{};d&&m&&Of(m,u,d),(u.isObject3D&&h.visible==null||h.visible)&&(u.visible=!0),mo(u)},createTextInstance:c,hideTextInstance:c,unhideTextInstance:c,getCurrentEventPriority:()=>e?e():go.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Rt.fun(performance.now)?performance.now:Rt.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Rt.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Rt.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Nf}}var Iv,Uv;const Uf=r=>"colorSpace"in r||"outputColorSpace"in r,Kb=()=>{var r;return(r=Um.ColorManagement)!=null?r:null},Jb=r=>r&&r.isOrthographicCamera,ML=r=>r&&r.hasOwnProperty("current"),Nc=typeof window<"u"&&((Iv=window.document)!=null&&Iv.createElement||((Uv=window.navigator)==null?void 0:Uv.product)==="ReactNative")?q.useLayoutEffect:q.useEffect;function Qb(r){const e=q.useRef(r);return Nc(()=>void(e.current=r),[r]),e}function TL({set:r}){return Nc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class e1 extends q.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}e1.getDerivedStateFromError=()=>({error:!0});const t1="__default",Ov=new Map,AL=r=>r&&!!r.memoized&&!!r.changes;function n1(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}const ya=r=>{var e;return(e=r.__r3f)==null?void 0:e.root.getState()},Rt={obj:r=>r===Object(r)&&!Rt.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(Rt.str(r)||Rt.num(r))return r===e;const s=Rt.obj(r);if(s&&n==="reference")return r===e;const o=Rt.arr(r);if(o&&t==="reference")return r===e;if((o||s)&&r===e)return!0;let a;for(a in r)if(!(a in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(a in i?e:r)if(!Rt.equ(r[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:r)if(r[a]!==e[a])return!1;if(Rt.und(a)){if(o&&r.length===0&&e.length===0||s&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function CL(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}function po(r,e){const t=r;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},r}function _p(r,e){let t=r;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((s,o)=>s[o],r),{target:t,key:i}}else return{target:t,key:e}}const Nv=/-\d+$/;function Of(r,e,t){if(Rt.str(t)){if(Nv.test(t)){const s=t.replace(Nv,""),{target:o,key:a}=_p(r,s);Array.isArray(o[a])||(o[a]=[])}const{target:n,key:i}=_p(r,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(r,e)}function Fv(r,e,t){var n,i;if(Rt.str(t)){const{target:s,key:o}=_p(r,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(r,e);(i=e.__r3f)==null||delete i.previousAttach}function i1(r,{children:e,key:t,ref:n,...i},{children:s,key:o,ref:a,...c}={},l=!1){var u;const h=(u=r==null?void 0:r.__r3f)!=null?u:{},f=Object.entries(i),d=[];if(l){const v=Object.keys(c);for(let g=0;g{var p;if((p=r.__r3f)!=null&&p.primitive&&v==="object"||Rt.equ(g,c[v]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(v))return d.push([v,g,!0,[]]);let _=[];v.includes("-")&&(_=v.split("-")),d.push([v,g,!1,_]);for(const y in i){const x=i[y];y.startsWith(`${v}-`)&&d.push([y,x,!1,y.split("-")])}});const m={...i};return h.memoizedProps&&h.memoizedProps.args&&(m.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(m.attach=h.memoizedProps.attach),{memoized:m,changes:d}}function Nf(r,e){var t,n,i;const s=(t=r.__r3f)!=null?t:{},o=s.root,a=(n=o==null||o.getState==null?void 0:o.getState())!=null?n:{},{memoized:c,changes:l}=AL(e)?e:i1(r,e),u=s.eventCount;r.__r3f&&(r.__r3f.memoizedProps=c);for(let f=0;fy[x],r),!(_&&_.set))){const[y,...x]=g.reverse();p=x.reverse().reduce((b,w)=>b[w],r),d=y}if(m===t1+"remove")if(p.constructor){let y=Ov.get(p.constructor);y||(y=new p.constructor,Ov.set(p.constructor,y)),m=y[d]}else m=0;if(v)m?s.handlers[d]=m:delete s.handlers[d],s.eventCount=Object.keys(s.handlers).length;else if(_&&_.set&&(_.copy||_ instanceof hs)){if(Array.isArray(m))_.fromArray?_.fromArray(m):_.set(...m);else if(_.copy&&m&&m.constructor&&_.constructor===m.constructor)_.copy(m);else if(m!==void 0){const y=_ instanceof Ne;!y&&_.setScalar?_.setScalar(m):_ instanceof hs&&m instanceof hs?_.mask=m.mask:_.set(m),!Kb()&&!a.linear&&y&&_.convertSRGBToLinear()}}else if(p[d]=m,p[d]instanceof Ft&&p[d].format===Ln&&p[d].type===Ii){const y=p[d];Uf(y)&&Uf(a.gl)?y.colorSpace=a.gl.outputColorSpace:y.encoding=a.gl.outputEncoding}mo(r)}if(s.parent&&a.internal&&r.raycast&&u!==s.eventCount){const f=a.internal.interaction.indexOf(r);f>-1&&a.internal.interaction.splice(f,1),s.eventCount&&a.internal.interaction.push(r)}return!(l.length===1&&l[0][0]==="onUpdate")&&l.length&&(i=r.__r3f)!=null&&i.parent&&yp(r),r}function mo(r){var e,t;const n=(e=r.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function yp(r){r.onUpdate==null||r.onUpdate(r)}function RL(r,e){r.manual||(Jb(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix(),r.updateMatrixWorld())}function Wl(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function PL(){var r;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return go.DefaultEventPriority;switch((r=e.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return go.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return go.ContinuousEventPriority;default:return go.DefaultEventPriority}}function r1(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function LL(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{r1(t.capturedMap,e,n,i)})}function DL(r){function e(c){const{internal:l}=r.getState(),u=c.offsetX-l.initialClick[0],h=c.offsetY-l.initialClick[1];return Math.round(Math.sqrt(u*u+h*h))}function t(c){return c.filter(l=>["Move","Over","Enter","Out","Leave"].some(u=>{var h;return(h=l.__r3f)==null?void 0:h.handlers["onPointer"+u]}))}function n(c,l){const u=r.getState(),h=new Set,f=[],d=l?l(u.internal.interaction):u.internal.interaction;for(let p=0;p{const y=ya(p.object),x=ya(_.object);return!y||!x?p.distance-_.distance:x.events.priority-y.events.priority||p.distance-_.distance}).filter(p=>{const _=Wl(p);return h.has(_)?!1:(h.add(_),!0)});u.events.filter&&(v=u.events.filter(v,u));for(const p of v){let _=p.object;for(;_;){var g;(g=_.__r3f)!=null&&g.eventCount&&f.push({...p,eventObject:_}),_=_.parent}}if("pointerId"in c&&u.internal.capturedMap.has(c.pointerId))for(let p of u.internal.capturedMap.get(c.pointerId).values())h.has(Wl(p.intersection))||f.push(p.intersection);return f}function i(c,l,u,h){const f=r.getState();if(c.length){const d={stopped:!1};for(const m of c){const v=ya(m.object)||f,{raycaster:g,pointer:p,camera:_,internal:y}=v,x=new G(p.x,p.y,0).unproject(_),b=T=>{var L,P;return(L=(P=y.capturedMap.get(T))==null?void 0:P.has(m.eventObject))!=null?L:!1},w=T=>{const L={intersection:m,target:l.target};y.capturedMap.has(T)?y.capturedMap.get(T).set(m.eventObject,L):y.capturedMap.set(T,new Map([[m.eventObject,L]])),l.target.setPointerCapture(T)},S=T=>{const L=y.capturedMap.get(T);L&&r1(y.capturedMap,m.eventObject,L,T)};let M={};for(let T in l){let L=l[T];typeof L!="function"&&(M[T]=L)}let E={...m,...M,pointer:p,intersections:c,stopped:d.stopped,delta:u,unprojectedPoint:x,ray:g.ray,camera:_,stopPropagation(){const T="pointerId"in l&&y.capturedMap.get(l.pointerId);if((!T||T.has(m.eventObject))&&(E.stopped=d.stopped=!0,y.hovered.size&&Array.from(y.hovered.values()).find(L=>L.eventObject===m.eventObject))){const L=c.slice(0,c.indexOf(m));s([...L,m])}},target:{hasPointerCapture:b,setPointerCapture:w,releasePointerCapture:S},currentTarget:{hasPointerCapture:b,setPointerCapture:w,releasePointerCapture:S},nativeEvent:l};if(h(E),d.stopped===!0)break}}return c}function s(c){const{internal:l}=r.getState();for(const u of l.hovered.values())if(!c.length||!c.find(h=>h.object===u.object&&h.index===u.index&&h.instanceId===u.instanceId)){const f=u.eventObject.__r3f,d=f==null?void 0:f.handlers;if(l.hovered.delete(Wl(u)),f!=null&&f.eventCount){const m={...u,intersections:c};d.onPointerOut==null||d.onPointerOut(m),d.onPointerLeave==null||d.onPointerLeave(m)}}}function o(c,l){for(let u=0;us([]);case"onLostPointerCapture":return l=>{const{internal:u}=r.getState();"pointerId"in l&&u.capturedMap.has(l.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(l.pointerId)&&(u.capturedMap.delete(l.pointerId),s([]))})}}return function(u){const{onPointerMissed:h,internal:f}=r.getState();f.lastEvent.current=u;const d=c==="onPointerMove",m=c==="onClick"||c==="onContextMenu"||c==="onDoubleClick",g=n(u,d?t:void 0),p=m?e(u):0;c==="onPointerDown"&&(f.initialClick=[u.offsetX,u.offsetY],f.initialHits=g.map(y=>y.eventObject)),m&&!g.length&&p<=2&&(o(u,f.interaction),h&&h(u)),d&&s(g);function _(y){const x=y.eventObject,b=x.__r3f,w=b==null?void 0:b.handlers;if(b!=null&&b.eventCount)if(d){if(w.onPointerOver||w.onPointerEnter||w.onPointerOut||w.onPointerLeave){const S=Wl(y),M=f.hovered.get(S);M?M.stopped&&y.stopPropagation():(f.hovered.set(S,y),w.onPointerOver==null||w.onPointerOver(y),w.onPointerEnter==null||w.onPointerEnter(y))}w.onPointerMove==null||w.onPointerMove(y)}else{const S=w[c];S?(!m||f.initialHits.includes(x))&&(o(u,f.interaction.filter(M=>!f.initialHits.includes(M))),S(y)):m&&f.initialHits.includes(x)&&o(u,f.interaction.filter(M=>!f.initialHits.includes(M)))}}i(g,u,p,_)}}return{handlePointer:a}}const s1=r=>!!(r!=null&&r.render),o1=q.createContext(null),IL=(r,e)=>{const t=bL((a,c)=>{const l=new G,u=new G,h=new G;function f(p=c().camera,_=u,y=c().size){const{width:x,height:b,top:w,left:S}=y,M=x/b;_ instanceof G?h.copy(_):h.set(..._);const E=p.getWorldPosition(l).distanceTo(h);if(Jb(p))return{width:x/p.zoom,height:b/p.zoom,top:w,left:S,factor:1,distance:E,aspect:M};{const T=p.fov*Math.PI/180,L=2*Math.tan(T/2)*E,P=L*(x/b);return{width:P,height:L,top:w,left:S,factor:x/P,distance:E,aspect:M}}}let d;const m=p=>a(_=>({performance:{..._.performance,current:p}})),v=new be;return{set:a,get:c,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(p=1)=>r(c(),p),advance:(p,_)=>e(p,_,c()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Rm,pointer:v,mouse:v,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const p=c();d&&clearTimeout(d),p.performance.current!==p.performance.min&&m(p.performance.min),d=setTimeout(()=>m(c().performance.max),p.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:f},setEvents:p=>a(_=>({..._,events:{..._.events,...p}})),setSize:(p,_,y,x,b)=>{const w=c().camera,S={width:p,height:_,top:x||0,left:b||0,updateStyle:y};a(M=>({size:S,viewport:{...M.viewport,...f(w,u,S)}}))},setDpr:p=>a(_=>{const y=n1(p);return{viewport:{..._.viewport,dpr:y,initialDpr:_.viewport.initialDpr||y}}}),setFrameloop:(p="always")=>{const _=c().clock;_.stop(),_.elapsedTime=0,p!=="never"&&(_.start(),_.elapsedTime=0),a(()=>({frameloop:p}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:q.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(p,_,y)=>{const x=c().internal;return x.priority=x.priority+(_>0?1:0),x.subscribers.push({ref:p,priority:_,store:y}),x.subscribers=x.subscribers.sort((b,w)=>b.priority-w.priority),()=>{const b=c().internal;b!=null&&b.subscribers&&(b.priority=b.priority-(_>0?1:0),b.subscribers=b.subscribers.filter(w=>w.ref!==p))}}}}}),n=t.getState();let i=n.size,s=n.viewport.dpr,o=n.camera;return t.subscribe(()=>{const{camera:a,size:c,viewport:l,gl:u,set:h}=t.getState();if(c!==i||l.dpr!==s){var f;i=c,s=l.dpr,RL(a,c),u.setPixelRatio(l.dpr);const d=(f=c.updateStyle)!=null?f:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(c.width,c.height,d)}a!==o&&(o=a,h(d=>({viewport:{...d.viewport,...d.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>r(a)),t};function UL(r,e){const t={callback:r};return e.add(t),()=>void e.delete(t)}let Xl,a1=new Set,OL=new Set,NL=new Set;const FL=r=>UL(r,a1);function Ff(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function xa(r,e){switch(r){case"before":return Ff(a1,e);case"after":return Ff(OL,e);case"tail":return Ff(NL,e)}}let kf,zf;function Bf(r,e,t){let n=e.clock.getDelta();for(e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),kf=e.internal.subscribers,Xl=0;Xl0)&&!((l=i.gl.xr)!=null&&l.isPresenting)&&(t+=Bf(c,i))}if(xa("after",c),t===0)return xa("tail",c),e=!1,cancelAnimationFrame(n)}function o(c,l=1){var u;if(!c)return r.forEach(h=>o(h.store.getState()),l);(u=c.gl.xr)!=null&&u.isPresenting||!c.internal.active||c.frameloop==="never"||(c.internal.frames=Math.min(60,c.internal.frames+l),e||(e=!0,requestAnimationFrame(s)))}function a(c,l=!0,u,h){if(l&&xa("before",c),u)Bf(c,u,h);else for(const f of r.values())Bf(c,f.store.getState());l&&xa("after",c)}return{loop:s,invalidate:o,advance:a}}function c1(){const r=q.useContext(o1);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function Kt(r=t=>t,e){return c1()(r,e)}function uh(r,e=0){const t=c1(),n=t.getState().internal.subscribe,i=Qb(r);return Nc(()=>n(i,e,t),[e,n,t]),null}const Po=new Map,{invalidate:kv,advance:zv}=kL(Po),{reconciler:wu,applyProps:ts}=EL(Po,PL),ao={objects:"shallow",strict:!1},zL=(r,e)=>{const t=typeof r=="function"?r(e):r;return s1(t)?t:new lm({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r})};function BL(r,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:s}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:s}}else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function GL(r){const e=Po.get(r),t=e==null?void 0:e.fiber,n=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=n||IL(kv,zv),o=t||wu.createContainer(s,go.ConcurrentRoot,null,!1,null,"",i,null);e||Po.set(r,{fiber:o,store:s});let a,c=!1,l;return{configure(u={}){let{gl:h,size:f,scene:d,events:m,onCreated:v,shadows:g=!1,linear:p=!1,flat:_=!1,legacy:y=!1,orthographic:x=!1,frameloop:b="always",dpr:w=[1,2],performance:S,raycaster:M,camera:E,onPointerMissed:T}=u,L=s.getState(),P=L.gl;L.gl||L.set({gl:P=zL(h,r)});let A=L.raycaster;A||L.set({raycaster:A=new Im});const{params:z,...V}=M||{};if(Rt.equ(V,A,ao)||ts(A,{...V}),Rt.equ(z,A.params,ao)||ts(A,{params:{...A.params,...z}}),!L.camera||L.camera===l&&!Rt.equ(l,E,ao)){l=E;const R=E instanceof Pc,F=R?E:x?new Ms(0,0,0,0,.1,1e3):new Zt(75,0,.1,1e3);R||(F.position.z=5,E&&ts(F,E),!L.camera&&!(E!=null&&E.rotation)&&F.lookAt(0,0,0)),L.set({camera:F})}if(!L.scene){let R;d instanceof ac?R=d:(R=new ac,d&&ts(R,d)),L.set({scene:po(R)})}if(!L.xr){const R=(Y,J)=>{const ie=s.getState();ie.frameloop!=="never"&&zv(Y,!0,ie,J)},F=()=>{const Y=s.getState();Y.gl.xr.enabled=Y.gl.xr.isPresenting,Y.gl.xr.setAnimationLoop(Y.gl.xr.isPresenting?R:null),Y.gl.xr.isPresenting||kv(Y)},H={connect(){const Y=s.getState().gl;Y.xr.addEventListener("sessionstart",F),Y.xr.addEventListener("sessionend",F)},disconnect(){const Y=s.getState().gl;Y.xr.removeEventListener("sessionstart",F),Y.xr.removeEventListener("sessionend",F)}};P.xr&&H.connect(),L.set({xr:H})}if(P.shadowMap){const R=P.shadowMap.enabled,F=P.shadowMap.type;if(P.shadowMap.enabled=!!g,Rt.boo(g))P.shadowMap.type=za;else if(Rt.str(g)){var N;const H={basic:$y,percentage:Uu,soft:za,variance:mi};P.shadowMap.type=(N=H[g])!=null?N:za}else Rt.obj(g)&&Object.assign(P.shadowMap,g);(R!==P.shadowMap.enabled||F!==P.shadowMap.type)&&(P.shadowMap.needsUpdate=!0)}const C=Kb();C&&("enabled"in C?C.enabled=!y:"legacyMode"in C&&(C.legacyMode=y)),ts(P,{outputEncoding:p?3e3:3001,toneMapping:_?yi:Wp}),L.legacy!==y&&L.set(()=>({legacy:y})),L.linear!==p&&L.set(()=>({linear:p})),L.flat!==_&&L.set(()=>({flat:_})),h&&!Rt.fun(h)&&!s1(h)&&!Rt.equ(h,P,ao)&&ts(P,h),m&&!L.events.handlers&&L.set({events:m(s)});const U=BL(r,f);return Rt.equ(U,L.size,ao)||L.setSize(U.width,U.height,U.updateStyle,U.top,U.left),w&&L.viewport.dpr!==n1(w)&&L.setDpr(w),L.frameloop!==b&&L.setFrameloop(b),L.onPointerMissed||L.set({onPointerMissed:T}),S&&!Rt.equ(S,L.performance,ao)&&L.set(R=>({performance:{...R.performance,...S}})),a=v,c=!0,this},render(u){return c||this.configure(),wu.updateContainer(q.createElement(VL,{store:s,children:u,onCreated:a,rootElement:r}),o,null,()=>{}),s},unmount(){l1(r)}}}function VL({store:r,children:e,onCreated:t,rootElement:n}){return Nc(()=>{const i=r.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),q.createElement(o1.Provider,{value:r},e)}function l1(r,e){const t=Po.get(r),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),wu.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var s,o,a,c;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(c=i.gl)!=null&&c.xr&&i.xr.disconnect(),CL(i),Po.delete(r)}catch{}},500)})}}wu.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:q.version});const Gf={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 HL(r){const{handlePointer:e}=DL(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Gf).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var n;const{set:i,events:s}=r.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:t}})),Object.entries((n=s.handlers)!=null?n:[]).forEach(([o,a])=>{const[c,l]=Gf[o];t.addEventListener(c,a,{passive:l})})},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([s,o])=>{if(n&&n.connected instanceof HTMLElement){const[a]=Gf[s];n.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const WL=q.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:s,events:o=HL,eventSource:a,eventPrefix:c,shadows:l,linear:u,flat:h,legacy:f,orthographic:d,frameloop:m,dpr:v,performance:g,raycaster:p,camera:_,onPointerMissed:y,onCreated:x,...b},w){q.useMemo(()=>Zb($b),[]);const S=$w(),[M,E]=Zw({scroll:!0,debounce:{scroll:50,resize:0},...n}),T=q.useRef(null),L=q.useRef(null);q.useImperativeHandle(w,()=>T.current);const P=Qb(y),[A,z]=q.useState(!1),[V,N]=q.useState(!1);if(A)throw A;if(V)throw V;const C=q.useRef(null);Nc(()=>{const k=T.current;E.width>0&&E.height>0&&k&&(C.current||(C.current=GL(k)),C.current.configure({gl:s,events:o,shadows:l,linear:u,flat:h,legacy:f,orthographic:d,frameloop:m,dpr:v,performance:g,raycaster:p,camera:_,size:E,onPointerMissed:(...U)=>P.current==null?void 0:P.current(...U),onCreated:U=>{U.events.connect==null||U.events.connect(a?ML(a)?a.current:a:L.current),c&&U.setEvents({compute:(R,F)=>{const H=R[c+"X"],Y=R[c+"Y"];F.pointer.set(H/F.size.width*2-1,-(Y/F.size.height)*2+1),F.raycaster.setFromCamera(F.pointer,F.camera)}}),x==null||x(U)}}),C.current.render(q.createElement(S,null,q.createElement(e1,{set:N},q.createElement(q.Suspense,{fallback:q.createElement(TL,{set:z})},e)))))}),q.useEffect(()=>{const k=T.current;if(k)return()=>l1(k)},[]);const O=a?"none":"auto";return q.createElement("div",Tc({ref:L,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:O,...i}},b),q.createElement("div",{ref:M,style:{width:"100%",height:"100%"}},q.createElement("canvas",{ref:T,style:{display:"block"}},t)))}),XL=q.forwardRef(function(e,t){return q.createElement(jw,null,q.createElement(WL,Tc({},e,{ref:t})))});function qL(r,e,t){var n,i=1;r==null&&(r=0),e==null&&(e=0),t==null&&(t=0);function s(){var o,a=n.length,c,l=0,u=0,h=0;for(o=0;o=(c=(o+a)/2))?o=c:a=c,n=i,!(i=i[h=+u]))return n[h]=s,r;if(l=+r._x.call(null,i.data),e===l)return s.next=i,n?n[h]=s:r._root=s,r;do n=n?n[h]=new Array(2):r._root=new Array(2),(u=e>=(c=(o+a)/2))?o=c:a=c;while((h=+u)==(f=+(l>=c)));return n[f]=i,n[h]=s,r}function jL(r){Array.isArray(r)||(r=Array.from(r));const e=r.length,t=new Float64Array(e);let n=1/0,i=-1/0;for(let s=0,o;si&&(i=o));if(n>i)return this;this.cover(n).cover(i);for(let s=0;sr||r>=t;)switch(o=+(ro||(s=l.x1)=h))&&(l=a[a.length-1],a[a.length-1]=a[a.length-1-u],a[a.length-1-u]=l)}else{var f=Math.abs(r-+this._x.call(null,c.data));f=(l=(o+a)/2))?o=l:a=l,e=t,!(t=t[h=+u]))return this;if(!t.length)break;e[h+1&1]&&(n=e,f=h)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):e?(s?e[h]=s:delete e[h],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(n?n[f]=t:this._root=t),this):(this._root=s,this)}function eD(r){for(var e=0,t=r.length;e=(h=(a+l)/2))?a=h:l=h,(g=t>=(f=(c+u)/2))?c=f:u=f,i=s,!(s=s[p=g<<1|v]))return i[p]=o,r;if(d=+r._x.call(null,s.data),m=+r._y.call(null,s.data),e===d&&t===m)return o.next=s,i?i[p]=o:r._root=o,r;do i=i?i[p]=new Array(4):r._root=new Array(4),(v=e>=(h=(a+l)/2))?a=h:l=h,(g=t>=(f=(c+u)/2))?c=f:u=f;while((p=g<<1|v)===(_=(m>=f)<<1|d>=h));return i[_]=s,i[p]=o,r}function cD(r){var e,t,n=r.length,i,s,o=new Array(n),a=new Array(n),c=1/0,l=1/0,u=-1/0,h=-1/0;for(t=0;tu&&(u=i),sh&&(h=s));if(c>u||l>h)return this;for(this.cover(c,l).cover(u,h),t=0;tr||r>=i||n>e||e>=s;)switch(l=(eu||(a=m.y0)>h||(c=m.x1)=p)<<1|r>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-v],f[f.length-1-v]=m)}else{var _=r-+this._x.call(null,d.data),y=e-+this._y.call(null,d.data),x=_*_+y*y;if(x=(f=(o+c)/2))?o=f:c=f,(v=h>=(d=(a+l)/2))?a=d:l=d,e=t,!(t=t[g=v<<1|m]))return this;if(!t.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(n=e,p=g)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):e?(s?e[g]=s:delete e[g],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[p]=t:this._root=t),this):(this._root=s,this)}function pD(r){for(var e=0,t=r.length;e=(m=(c+h)/2))?c=m:h=m,(b=t>=(v=(l+f)/2))?l=v:f=v,(w=n>=(g=(u+d)/2))?u=g:d=g,s=o,!(o=o[S=w<<2|b<<1|x]))return s[S]=a,r;if(p=+r._x.call(null,o.data),_=+r._y.call(null,o.data),y=+r._z.call(null,o.data),e===p&&t===_&&n===y)return a.next=o,s?s[S]=a:r._root=a,r;do s=s?s[S]=new Array(8):r._root=new Array(8),(x=e>=(m=(c+h)/2))?c=m:h=m,(b=t>=(v=(l+f)/2))?l=v:f=v,(w=n>=(g=(u+d)/2))?u=g:d=g;while((S=w<<2|b<<1|x)===(M=(y>=g)<<2|(_>=v)<<1|p>=m));return s[M]=o,s[S]=a,r}function ED(r){Array.isArray(r)||(r=Array.from(r));const e=r.length,t=new Float64Array(e),n=new Float64Array(e),i=new Float64Array(e);let s=1/0,o=1/0,a=1/0,c=-1/0,l=-1/0,u=-1/0;for(let h=0,f,d,m,v;hc&&(c=d),ml&&(l=m),vu&&(u=v));if(s>c||o>l||a>u)return this;this.cover(s,o,a).cover(c,l,u);for(let h=0;hr||r>=o||i>e||e>=a||s>t||t>=c;)switch(f=(tm||(l=y.y0)>v||(u=y.z0)>g||(h=y.x1)=S)<<2|(e>=w)<<1|r>=b)&&(y=p[p.length-1],p[p.length-1]=p[p.length-1-x],p[p.length-1-x]=y)}else{var M=r-+this._x.call(null,_.data),E=e-+this._y.call(null,_.data),T=t-+this._z.call(null,_.data),L=M*M+E*E+T*T;if(LMath.sqrt((r-n)**2+(e-i)**2+(t-s)**2);function PD(r,e,t,n){const i=[],s=r-n,o=e-n,a=t-n,c=r+n,l=e+n,u=t+n;return this.visit((h,f,d,m,v,g,p)=>{if(!h.length)do{const _=h.data;RD(r,e,t,this._x(_),this._y(_),this._z(_))<=n&&i.push(_)}while(h=h.next);return f>c||d>l||m>u||v=(v=(o+l)/2))?o=v:l=v,(y=d>=(g=(a+u)/2))?a=g:u=g,(x=m>=(p=(c+h)/2))?c=p:h=p,e=t,!(t=t[b=x<<2|y<<1|_]))return this;if(!t.length)break;(e[b+1&7]||e[b+2&7]||e[b+3&7]||e[b+4&7]||e[b+5&7]||e[b+6&7]||e[b+7&7])&&(n=e,w=b)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):e?(s?e[b]=s:delete e[b],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[w]=t:this._root=t),this):(this._root=s,this)}function DD(r){for(var e=0,t=r.length;e1&&(v=d.y+d.vy),t>2&&(g=d.z+d.vz),f.visit(x);function x(b,w,S,M,E,T,L){var P=[w,S,M,E,T,L],A=P[0],z=P[1],V=P[2],N=P[t],C=P[t+1],O=P[t+2],k=b.data,U=b.r,R=p+U;if(k){if(k.index>d.index){var F=m-k.x-k.vx,H=t>1?v-k.y-k.vy:0,Y=t>2?g-k.z-k.vz:0,J=F*F+H*H+Y*Y;J1&&H===0&&(H=ei(i),J+=H*H),t>2&&Y===0&&(Y=ei(i),J+=Y*Y),J=(R-(J=Math.sqrt(J)))/J*s,d.vx+=(F*=J)*(R=(U*=U)/(_+U)),t>1&&(d.vy+=(H*=J)*R),t>2&&(d.vz+=(Y*=J)*R),k.vx-=F*(R=1-R),t>1&&(k.vy-=H*R),t>2&&(k.vz-=Y*R))}return}return A>m+R||N1&&(z>v+R||C2&&(V>g+R||Ou.r&&(u.r=u[h].r)}function l(){if(e){var u,h=e.length,f;for(n=new Array(h),u=0;utypeof f=="function")||Math.random,t=h.find(f=>[1,2,3].includes(f))||2,l()},a.iterations=function(u){return arguments.length?(o=+u,a):o},a.strength=function(u){return arguments.length?(s=+u,a):s},a.radius=function(u){return arguments.length?(r=typeof u=="function"?u:Nt(+u),l(),a):r},a}function WD(r){return r.index}function Wv(r,e){var t=r.get(e);if(!t)throw new Error("node not found: "+e);return t}function p1(r){var e=WD,t=f,n,i=Nt(30),s,o,a,c,l,u,h=1;r==null&&(r=[]);function f(p){return 1/Math.min(c[p.source.index],c[p.target.index])}function d(p){for(var _=0,y=r.length;_1&&(E=S.y+S.vy-w.y-w.vy||ei(u)),a>2&&(T=S.z+S.vz-w.z-w.vz||ei(u)),L=Math.sqrt(M*M+E*E+T*T),L=(L-s[x])/L*p*n[x],M*=L,E*=L,T*=L,S.vx-=M*(P=l[x]),a>1&&(S.vy-=E*P),a>2&&(S.vz-=T*P),w.vx+=M*(P=1-P),a>1&&(w.vy+=E*P),a>2&&(w.vz+=T*P)}function m(){if(o){var p,_=o.length,y=r.length,x=new Map(o.map((w,S)=>[e(w,S,o),w])),b;for(p=0,c=new Array(_);ptypeof y=="function")||Math.random,a=_.find(y=>[1,2,3].includes(y))||2,m()},d.links=function(p){return arguments.length?(r=p,m(),d):r},d.id=function(p){return arguments.length?(e=p,d):e},d.iterations=function(p){return arguments.length?(h=+p,d):h},d.strength=function(p){return arguments.length?(t=typeof p=="function"?p:Nt(+p),v(),d):t},d.distance=function(p){return arguments.length?(i=typeof p=="function"?p:Nt(+p),g(),d):i},d}var XD={value:()=>{}};function m1(){for(var r=0,e=arguments.length,t={},n;r=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}hu.prototype=m1.prototype={constructor:hu,on:function(r,e){var t=this._,n=qD(r+"",t),i,s=-1,o=n.length;if(arguments.length<2){for(;++s0)for(var t=new Array(i),n=0,i,s;n=0&&r._call.call(void 0,e),r=r._next;--Lo}function qv(){bs=(Eu=gc.now())+hh,Lo=Na=0;try{$D()}finally{Lo=0,KD(),bs=0}}function ZD(){var r=gc.now(),e=r-Eu;e>g1&&(hh-=e,Eu=r)}function KD(){for(var r,e=Su,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:Su=t);Fa=r,bp(n)}function bp(r){if(!Lo){Na&&(Na=clearTimeout(Na));var e=r-bs;e>24?(r<1/0&&(Na=setTimeout(qv,r-gc.now()-hh)),ba&&(ba=clearInterval(ba))):(ba||(Eu=gc.now(),ba=setInterval(ZD,g1)),Lo=1,v1(qv))}}const JD=1664525,QD=1013904223,Yv=4294967296;function eI(){let r=1;return()=>(r=(JD*r+QD)%Yv)/Yv}var jv=3;function Hf(r){return r.x}function $v(r){return r.y}function tI(r){return r.z}var nI=10,iI=Math.PI*(3-Math.sqrt(5)),rI=Math.PI*20/(9+Math.sqrt(221));function x1(r,e){e=e||2;var t=Math.min(jv,Math.max(1,Math.round(e))),n,i=1,s=.001,o=1-Math.pow(s,1/300),a=0,c=.6,l=new Map,u=y1(d),h=m1("tick","end"),f=eI();r==null&&(r=[]);function d(){m(),h.call("tick",n),i1&&(x.fy==null?x.y+=x.vy*=c:(x.y=x.fy,x.vy=0)),t>2&&(x.fz==null?x.z+=x.vz*=c:(x.z=x.fz,x.vz=0));return n}function v(){for(var p=0,_=r.length,y;p<_;++p){if(y=r[p],y.index=p,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),y.fz!=null&&(y.z=y.fz),isNaN(y.x)||t>1&&isNaN(y.y)||t>2&&isNaN(y.z)){var x=nI*(t>2?Math.cbrt(.5+p):t>1?Math.sqrt(.5+p):p),b=p*iI,w=p*rI;t===1?y.x=x:t===2?(y.x=x*Math.cos(b),y.y=x*Math.sin(b)):(y.x=x*Math.sin(b)*Math.cos(w),y.y=x*Math.cos(b),y.z=x*Math.sin(b)*Math.sin(w))}(isNaN(y.vx)||t>1&&isNaN(y.vy)||t>2&&isNaN(y.vz))&&(y.vx=0,t>1&&(y.vy=0),t>2&&(y.vz=0))}}function g(p){return p.initialize&&p.initialize(r,f,t),p}return v(),n={tick:m,restart:function(){return u.restart(d),n},stop:function(){return u.stop(),n},numDimensions:function(p){return arguments.length?(t=Math.min(jv,Math.max(1,Math.round(p))),l.forEach(g),n):t},nodes:function(p){return arguments.length?(r=p,v(),l.forEach(g),n):r},alpha:function(p){return arguments.length?(i=+p,n):i},alphaMin:function(p){return arguments.length?(s=+p,n):s},alphaDecay:function(p){return arguments.length?(o=+p,n):+o},alphaTarget:function(p){return arguments.length?(a=+p,n):a},velocityDecay:function(p){return arguments.length?(c=1-p,n):1-c},randomSource:function(p){return arguments.length?(f=p,l.forEach(g),n):f},force:function(p,_){return arguments.length>1?(_==null?l.delete(p):l.set(p,g(_)),n):l.get(p)},find:function(){var p=Array.prototype.slice.call(arguments),_=p.shift()||0,y=(t>1?p.shift():null)||0,x=(t>2?p.shift():null)||0,b=p.shift()||1/0,w=0,S=r.length,M,E,T,L,P,A;for(b*=b,w=0;w1?(h.on(p,_),n):h.on(p)}}}function b1(){var r,e,t,n,i,s=Nt(-30),o,a=1,c=1/0,l=.81;function u(m){var v,g=r.length,p=(e===1?Om(r,Hf):e===2?Fm(r,Hf,$v):e===3?zm(r,Hf,$v,tI):null).visitAfter(f);for(i=m,v=0;v1&&(m.y=x/_),e>2&&(m.z=b/_)}else{g=m,g.x=g.data.x,e>1&&(g.y=g.data.y),e>2&&(g.z=g.data.z);do v+=o[g.data.index];while(g=g.next)}m.value=v}function d(m,v,g,p,_){if(!m.value)return!0;var y=[g,p,_][e-1],x=m.x-t.x,b=e>1?m.y-t.y:0,w=e>2?m.z-t.z:0,S=y-v,M=x*x+b*b+w*w;if(S*S/l1&&b===0&&(b=ei(n),M+=b*b),e>2&&w===0&&(w=ei(n),M+=w*w),M1&&(t.vy+=b*m.value*i/M),e>2&&(t.vz+=w*m.value*i/M)),!0;if(m.length||M>=c)return;(m.data!==t||m.next)&&(x===0&&(x=ei(n),M+=x*x),e>1&&b===0&&(b=ei(n),M+=b*b),e>2&&w===0&&(w=ei(n),M+=w*w),M1&&(t.vy+=b*S),e>2&&(t.vz+=w*S));while(m=m.next)}return u.initialize=function(m,...v){r=m,n=v.find(g=>typeof g=="function")||Math.random,e=v.find(g=>[1,2,3].includes(g))||2,h()},u.strength=function(m){return arguments.length?(s=typeof m=="function"?m:Nt(+m),h(),u):s},u.distanceMin=function(m){return arguments.length?(a=m*m,u):Math.sqrt(a)},u.distanceMax=function(m){return arguments.length?(c=m*m,u):Math.sqrt(c)},u.theta=function(m){return arguments.length?(l=m*m,u):Math.sqrt(l)},u}function sI(r,e,t,n){var i,s,o=Nt(.1),a,c;typeof r!="function"&&(r=Nt(+r)),e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function l(h){for(var f=0,d=i.length;f1&&(m.vy+=g*y),s>2&&(m.vz+=p*y)}}function u(){if(i){var h,f=i.length;for(a=new Array(f),c=new Array(f),h=0;h[1,2,3].includes(d))||2,u()},l.strength=function(h){return arguments.length?(o=typeof h=="function"?h:Nt(+h),u(),l):o},l.radius=function(h){return arguments.length?(r=typeof h=="function"?h:Nt(+h),u(),l):r},l.x=function(h){return arguments.length?(e=+h,l):e},l.y=function(h){return arguments.length?(t=+h,l):t},l.z=function(h){return arguments.length?(n=+h,l):n},l}function wp(r){var e=Nt(.1),t,n,i;typeof r!="function"&&(r=Nt(r==null?0:+r));function s(a){for(var c=0,l=t.length,u;c=0;)e+=t[n].value;r.value=e}function cI(){return this.eachAfter(aI)}function lI(r,e){let t=-1;for(const n of this)r.call(e,n,++t,this);return this}function uI(r,e){for(var t=this,n=[t],i,s,o=-1;t=n.pop();)if(r.call(e,t,++o,this),i=t.children)for(s=i.length-1;s>=0;--s)n.push(i[s]);return this}function hI(r,e){for(var t=this,n=[t],i=[],s,o,a,c=-1;t=n.pop();)if(i.push(t),s=t.children)for(o=0,a=s.length;o=0;)t+=n[i].value;e.value=t})}function pI(r){return this.eachBefore(function(e){e.children&&e.children.sort(r)})}function mI(r){for(var e=this,t=gI(e,r),n=[e];e!==t;)e=e.parent,n.push(e);for(var i=n.length;r!==t;)n.splice(i,0,r),r=r.parent;return n}function gI(r,e){if(r===e)return r;var t=r.ancestors(),n=e.ancestors(),i=null;for(r=t.pop(),e=n.pop();r===e;)i=r,r=t.pop(),e=n.pop();return i}function vI(){for(var r=this,e=[r];r=r.parent;)e.push(r);return e}function _I(){return Array.from(this)}function yI(){var r=[];return this.eachBefore(function(e){e.children||r.push(e)}),r}function xI(){var r=this,e=[];return r.each(function(t){t!==r&&e.push({source:t.parent,target:t})}),e}function*bI(){var r=this,e,t=[r],n,i,s;do for(e=t.reverse(),t=[];r=e.pop();)if(yield r,n=r.children)for(i=0,s=n.length;i=0;--a)i.push(s=o[a]=new Do(o[a])),s.parent=n,s.depth=n.depth+1;return t.eachBefore(w1)}function wI(){return fh(this).eachBefore(MI)}function SI(r){return r.children}function EI(r){return Array.isArray(r)?r[1]:null}function MI(r){r.data.value!==void 0&&(r.value=r.data.value),r.data=r.data.data}function w1(r){var e=0;do r.height=e;while((r=r.parent)&&r.height<++e)}function Do(r){this.data=r,this.depth=this.height=0,this.parent=null}Do.prototype=fh.prototype={constructor:Do,count:cI,each:lI,eachAfter:hI,eachBefore:uI,find:fI,sum:dI,sort:pI,path:mI,ancestors:vI,descendants:_I,leaves:yI,links:xI,copy:wI,[Symbol.iterator]:bI};function Wf(r){return r==null?null:S1(r)}function S1(r){if(typeof r!="function")throw new Error;return r}function wa(){return 0}function Sa(r){return function(){return r}}function TI(r){r.x0=Math.round(r.x0),r.y0=Math.round(r.y0),r.x1=Math.round(r.x1),r.y1=Math.round(r.y1)}function AI(r,e,t,n,i){for(var s=r.children,o,a=-1,c=s.length,l=r.value&&(n-e)/r.value;++aDI(t(x,b,i))),_=p.map(Kv),y=new Set(p).add("");for(const x of _)y.has(x)||(y.add(x),p.push(x),_.push(Kv(x)),s.push(Xf));o=(x,b)=>p[b],a=(x,b)=>_[b]}for(u=0,c=s.length;u=0&&(d=s[p],d.data===Xf);--p)d.data=null}if(h.parent=CI,h.eachBefore(function(p){p.depth=p.parent.depth+1,--c}).eachBefore(w1),h.parent=null,c>0)throw new Error("cycle");return h}return n.id=function(i){return arguments.length?(r=Wf(i),n):r},n.parentId=function(i){return arguments.length?(e=Wf(i),n):e},n.path=function(i){return arguments.length?(t=Wf(i),n):t},n}function DI(r){r=`${r}`;let e=r.length;return Ep(r,e-1)&&!Ep(r,e-2)&&(r=r.slice(0,-1)),r[0]==="/"?r:`/${r}`}function Kv(r){let e=r.length;if(e<2)return"";for(;--e>1&&!Ep(r,e););return r.slice(0,e)}function Ep(r,e){if(r[e]==="/"){let t=0;for(;e>0&&r[--e]==="\\";)++t;if((t&1)===0)return!0}return!1}function II(r,e){return r.parent===e.parent?1:2}function qf(r){var e=r.children;return e?e[0]:r.t}function Yf(r){var e=r.children;return e?e[e.length-1]:r.t}function UI(r,e,t){var n=t/(e.i-r.i);e.c-=n,e.s+=t,r.c+=n,e.z+=t,e.m+=t}function OI(r){for(var e=0,t=0,n=r.children,i=n.length,s;--i>=0;)s=n[i],s.z+=e,s.m+=e,e+=s.s+(t+=s.c)}function NI(r,e,t){return r.a.parent===e.parent?r.a:t}function fu(r,e){this._=r,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}fu.prototype=Object.create(Do.prototype);function FI(r){for(var e=new fu(r,0),t,n=[e],i,s,o,a;t=n.pop();)if(s=t._.children)for(t.children=new Array(a=s.length),o=a-1;o>=0;--o)n.push(i=t.children[o]=new fu(s[o],o)),i.parent=t;return(e.parent=new fu(null,0)).children=[e],e}function kI(){var r=II,e=1,t=1,n=null;function i(l){var u=FI(l);if(u.eachAfter(s),u.parent.m=-u.z,u.eachBefore(o),n)l.eachBefore(c);else{var h=l,f=l,d=l;l.eachBefore(function(_){_.xf.x&&(f=_),_.depth>d.depth&&(d=_)});var m=h===f?1:r(h,f)/2,v=m-h.x,g=e/(f.x+m+v),p=t/(d.depth||1);l.eachBefore(function(_){_.x=(_.x+v)*g,_.y=_.depth*p})}return l}function s(l){var u=l.children,h=l.parent.children,f=l.i?h[l.i-1]:null;if(u){OI(l);var d=(u[0].z+u[u.length-1].z)/2;f?(l.z=f.z+r(l._,f._),l.m=l.z-d):l.z=d}else f&&(l.z=f.z+r(l._,f._));l.parent.A=a(l,f,l.parent.A||h[0])}function o(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,h){if(u){for(var f=l,d=l,m=u,v=f.parent.children[0],g=f.m,p=d.m,_=m.m,y=v.m,x;m=Yf(m),f=qf(f),m&&f;)v=qf(v),d=Yf(d),d.a=l,x=m.z+_-f.z-g+r(m._,f._),x>0&&(UI(NI(m,l,h),l,x),g+=x,p+=x),_+=m.m,g+=f.m,y+=v.m,p+=d.m;m&&!Yf(d)&&(d.t=m,d.m+=_-p),f&&!qf(v)&&(v.t=f,v.m+=g-y,h=l)}return h}function c(l){l.x*=e,l.y=l.depth*t}return i.separation=function(l){return arguments.length?(r=l,i):r},i.size=function(l){return arguments.length?(n=!1,e=+l[0],t=+l[1],i):n?null:[e,t]},i.nodeSize=function(l){return arguments.length?(n=!0,e=+l[0],t=+l[1],i):n?[e,t]:null},i}function zI(r,e,t,n,i){for(var s=r.children,o,a=-1,c=s.length,l=r.value&&(i-t)/r.value;++a_&&(_=l),w=g*g*b,y=Math.max(_/w,w/p),y>x){g-=l;break}x=y}o.push(c={value:g,dice:d1?n:1)},t})(BI);function HI(){var r=VI,e=!1,t=1,n=1,i=[0],s=wa,o=wa,a=wa,c=wa,l=wa;function u(f){return f.x0=f.y0=0,f.x1=t,f.y1=n,f.eachBefore(h),i=[0],e&&f.eachBefore(TI),f}function h(f){var d=i[f.depth],m=f.x0+d,v=f.y0+d,g=f.x1-d,p=f.y1-d;g1&&te.has(xe))&&(O>1&&te.add(xe),K=c[Q+r],ye=c[Q+e],fe=c[Q+t],ce=K-j,Pe=ye-W,B=Math.sqrt(ce*ce+Pe*Pe),I=B0?(S[Q]+=ce/B*(1+re),M[Q]+=Pe/B*(1+re)):(S[Q]+=A*s(),M[Q]+=z*s())));for(m=0,v=0;m"u"?i:l};typeof i=="function"&&(o=i);var a=function(l){return o(l[n])},c=function(){return o(void 0)};return typeof n=="string"?(s.fromAttributes=a,s.fromGraph=function(l,u){return a(l.getNodeAttributes(u))},s.fromEntry=function(l,u){return a(u)}):typeof n=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},s.fromGraph=function(l,u){return o(n(u,l.getNodeAttributes(u)))},s.fromEntry=function(l,u){return o(n(l,u))}):(s.fromAttributes=c,s.fromGraph=c,s.fromEntry=c),s}function t(n,i){var s={},o=function(l){return typeof l>"u"?i:l};typeof i=="function"&&(o=i);var a=function(l){return o(l[n])},c=function(){return o(void 0)};return typeof n=="string"?(s.fromAttributes=a,s.fromGraph=function(l,u){return a(l.getEdgeAttributes(u))},s.fromEntry=function(l,u){return a(u)},s.fromPartialEntry=s.fromEntry,s.fromMinimalEntry=s.fromEntry):typeof n=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},s.fromGraph=function(l,u){var h=l.extremities(u);return o(n(u,l.getEdgeAttributes(u),h[0],h[1],l.getNodeAttributes(h[0]),l.getNodeAttributes(h[1]),l.isUndirected(u)))},s.fromEntry=function(l,u,h,f,d,m,v){return o(n(l,u,h,f,d,m,v))},s.fromPartialEntry=function(l,u,h,f){return o(n(l,u,h,f))},s.fromMinimalEntry=function(l,u){return o(n(l,u))}):(s.fromAttributes=c,s.fromGraph=c,s.fromEntry=c,s.fromMinimalEntry=c),s}return Ea.createNodeValueGetter=e,Ea.createEdgeValueGetter=t,Ea.createEdgeWeightGetter=function(n){return t(n,r)},Ea}var ed,o_;function QI(){if(o_)return ed;o_=1;var r=0,e=1,t=2,n=3,i=4,s=5,o=6,a=7,c=8,l=9,u=0,h=1,f=2,d=0,m=1,v=2,g=3,p=4,_=5,y=6,x=7,b=8,w=3,S=10,M=3,E=9,T=10;return ed=function(P,A,z){var V,N,C,O,k,U,R,F,H,Y,J=A.length,ie=z.length,ne=P.adjustSizes,ee=P.barnesHutTheta*P.barnesHutTheta,ge,me,te,D,Q,j,K,W=[];for(C=0;C$?(fe-=(I-$)/2,xe=fe+I):(ye-=($-I)/2,re=ye+$),W[0+d]=-1,W[0+m]=(ye+re)/2,W[0+v]=(fe+xe)/2,W[0+g]=Math.max(re-ye,xe-fe),W[0+p]=-1,W[0+_]=-1,W[0+y]=0,W[0+x]=0,W[0+b]=0,V=1,C=0;C=0){A[C+r]=0)if(j=Math.pow(A[C+r]-W[N+x],2)+Math.pow(A[C+e]-W[N+b],2),Y=W[N+g],4*Y*Y/j0?(K=me*A[C+o]*W[N+y]/j,A[C+t]+=te*K,A[C+n]+=D*K):j<0&&(K=-me*A[C+o]*W[N+y]/Math.sqrt(j),A[C+t]+=te*K,A[C+n]+=D*K):j>0&&(K=me*A[C+o]*W[N+y]/j,A[C+t]+=te*K,A[C+n]+=D*K),N=W[N+p],N<0)break;continue}else{N=W[N+_];continue}else{if(U=W[N+d],U>=0&&U!==C&&(te=A[C+r]-A[U+r],D=A[C+e]-A[U+e],j=te*te+D*D,ne===!0?j>0?(K=me*A[C+o]*A[U+o]/j,A[C+t]+=te*K,A[C+n]+=D*K):j<0&&(K=-me*A[C+o]*A[U+o]/Math.sqrt(j),A[C+t]+=te*K,A[C+n]+=D*K):j>0&&(K=me*A[C+o]*A[U+o]/j,A[C+t]+=te*K,A[C+n]+=D*K)),N=W[N+p],N<0)break;continue}else for(me=P.scalingRatio,O=0;O0?(K=me*A[O+o]*A[k+o]/j/j,A[O+t]+=te*K,A[O+n]+=D*K,A[k+t]-=te*K,A[k+n]-=D*K):j<0&&(K=100*me*A[O+o]*A[k+o],A[O+t]+=te*K,A[O+n]+=D*K,A[k+t]-=te*K,A[k+n]-=D*K)):(j=Math.sqrt(te*te+D*D),j>0&&(K=me*A[O+o]*A[k+o]/j/j,A[O+t]+=te*K,A[O+n]+=D*K,A[k+t]-=te*K,A[k+n]-=D*K));for(H=P.gravity/P.scalingRatio,me=P.scalingRatio,C=0;C0&&(K=me*A[C+o]*H):j>0&&(K=me*A[C+o]*H/j),A[C+t]-=te*K,A[C+n]-=D*K;for(me=1*(P.outboundAttractionDistribution?ge:1),R=0;R0&&(K=-me*Q*Math.log(1+j)/j/A[O+o]):j>0&&(K=-me*Q*Math.log(1+j)/j):P.outboundAttractionDistribution?j>0&&(K=-me*Q/A[O+o]):j>0&&(K=-me*Q)):(j=Math.sqrt(Math.pow(te,2)+Math.pow(D,2)),P.linLogMode?P.outboundAttractionDistribution?j>0&&(K=-me*Q*Math.log(1+j)/j/A[O+o]):j>0&&(K=-me*Q*Math.log(1+j)/j):P.outboundAttractionDistribution?(j=1,K=-me*Q/A[O+o]):(j=1,K=-me*Q)),j>0&&(A[O+t]+=te*K,A[O+n]+=D*K,A[k+t]-=te*K,A[k+n]-=D*K);var he,de,pe,Me,we,ue;if(ne===!0)for(C=0;CT&&(A[C+t]=A[C+t]*T/he,A[C+n]=A[C+n]*T/he),de=A[C+o]*Math.sqrt((A[C+i]-A[C+t])*(A[C+i]-A[C+t])+(A[C+s]-A[C+n])*(A[C+s]-A[C+n])),pe=Math.sqrt((A[C+i]+A[C+t])*(A[C+i]+A[C+t])+(A[C+s]+A[C+n])*(A[C+s]+A[C+n]))/2,Me=.1*Math.log(1+pe)/(1+Math.sqrt(de)),we=A[C+r]+A[C+t]*(Me/P.slowDown),A[C+r]=we,ue=A[C+e]+A[C+n]*(Me/P.slowDown),A[C+e]=ue);else for(C=0;C=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},Ki.graphToByteArrays=function(t,n){var i=t.order,s=t.size,o={},a,c=new Float32Array(i*r),l=new Float32Array(s*e);return a=0,t.forEachNode(function(u,h){o[u]=a,c[a]=h.x,c[a+1]=h.y,c[a+2]=0,c[a+3]=0,c[a+4]=0,c[a+5]=0,c[a+6]=1,c[a+7]=1,c[a+8]=h.size||1,c[a+9]=h.fixed?1:0,a+=r}),a=0,t.forEachEdge(function(u,h,f,d,m,v,g){var p=o[f],_=o[d],y=n(u,h,f,d,m,v,g);c[p+6]+=y,c[_+6]+=y,l[a]=p,l[a+1]=_,l[a+2]=y,a+=e}),{nodes:c,edges:l}},Ki.assignLayoutChanges=function(t,n,i){var s=0;t.updateEachNodeAttributes(function(o,a){return a.x=n[s],a.y=n[s+1],s+=r,i?i(o,a):a})},Ki.readGraphPositions=function(t,n){var i=0;t.forEachNode(function(s,o){n[i]=o.x,n[i+1]=o.y,i+=r})},Ki.collectLayoutChanges=function(t,n,i){for(var s=t.nodes(),o={},a=0,c=0,l=n.length;a2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(l)}}var a=s.bind(null,!1);return a.assign=s.bind(null,!0),a.inferSettings=o,nd=a,nd}var iU=nU();const rU=ki(iU);var id,u_;function sU(){if(u_)return id;u_=1;var r=Gm(),e=ur(),t={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function n(s,o,a){if(!e(o))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");a=r(a,t);var c=a.dimensions;if(!Array.isArray(c)||c.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var l=c.length,u=a.center,h=a.rng,f=a.scale,d=(u-.5)*f;function m(g){for(var p=0;p 4294967295 is not supported.")},r.getSignedPointerArray=function(c){var l=c-1;return l<=i?Int8Array:l<=s?Int16Array:l<=o?Int32Array:Float64Array},r.getNumberType=function(c){return c===(c|0)?Math.sign(c)===-1?c<=127&&c>=-128?Int8Array:c<=32767&&c>=-32768?Int16Array:Int32Array:c<=255?Uint8Array:c<=65535?Uint16Array:Uint32Array:Float64Array};var a={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};r.getMinimalRepresentation=function(c,l){var u=null,h=0,f,d,m,v,g;for(v=0,g=c.length;vh&&(h=f,u=d);return u},r.isTypedArray=function(c){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(c)},r.concat=function(){var c=0,l,u,h;for(l=0,h=arguments.length;l{const o=q.useRef();return o.current||(o.current=i()),q.createElement(r.Provider,{value:o.current},s)},useStore:(i,s)=>{const o=q.useContext(r);if(!o)throw new Error("Seems like you have not used zustand provider as an ancestor.");return Xy(o,i,s)},useStoreApi:()=>{const i=q.useContext(r);if(!i)throw new Error("Seems like you have not used zustand provider as an ancestor.");return q.useMemo(()=>({...i}),[i])}}}var fi={},Jr={},od,m_;function ph(){if(m_)return od;m_=1;function r(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var e=arguments,t=e.length,n=0;return new r(function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}})},r.empty=function(){var e=new r(function(){return{done:!0}});return e},r.fromSequence=function(e){var t=0,n=e.length;return new r(function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}})},r.is=function(e){return e instanceof r?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},od=r,od}var Yl={},g_;function M1(){return g_||(g_=1,Yl.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",Yl.SYMBOL_SUPPORT=typeof Symbol<"u"),Yl}var ad,v_;function Vm(){if(v_)return ad;v_=1;var r=M1(),e=r.ARRAY_BUFFER_SUPPORT,t=r.SYMBOL_SUPPORT;return ad=function(i,s){var o,a,c,l,u;if(!i)throw new Error("obliterator/forEach: invalid iterable.");if(typeof s!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(i)||e&&ArrayBuffer.isView(i)||typeof i=="string"||i.toString()==="[object Arguments]"){for(c=0,l=i.length;c=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,n}},t.prototype.peek=function(){if(this.size)return this.items[this.offset]},t.prototype.forEach=function(n,i){i=arguments.length>1?i:this;for(var s=this.offset,o=0,a=this.items.length;s=n.length)return{done:!0};var s=n[i];return i++,{value:s,done:!1}})},t.prototype.entries=function(){var n=this.items,i=this.offset,s=0;return new r(function(){if(i>=n.length)return{done:!0};var o=n[i];return i++,{value:[s++,o],done:!1}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.values),t.prototype.toString=function(){return this.toArray().join(",")},t.prototype.toJSON=function(){return this.toArray()},t.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:t,enumerable:!1}),n},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),t.from=function(n){var i=new t;return e(n,function(s){i.enqueue(s)}),i},t.of=function(){return t.from(arguments)},cd=t,cd}var ld,y_;function vU(){return y_||(y_=1,ld=function(e,t){var n=t.length;if(n!==0){var i=e.length;e.length+=n;for(var s=0;ss?1:0},e=function(i,s){return is?-1:0};function t(i){return function(s,o){return i(o,s)}}function n(i){return i===2?function(s,o){return s[0]o[0]?1:s[1]o[1]?1:0}:function(s,o){for(var a=0;ao[a])return 1;a++}return 0}}return co.DEFAULT_COMPARATOR=r,co.DEFAULT_REVERSE_COMPARATOR=e,co.reverseComparator=t,co.createTupleComparator=n,co}var lo={},S_;function bU(){if(S_)return lo;S_=1;var r=Vm(),e=E1();function t(o){return Array.isArray(o)||e.isTypedArray(o)}function n(o){if(typeof o.length=="number")return o.length;if(typeof o.size=="number")return o.size}function i(o){var a=n(o),c=typeof a=="number"?new Array(a):[],l=0;return r(o,function(u){c[l++]=u}),c}function s(o){var a=n(o),c=typeof a=="number"?e.getPointerArray(a):Array,l=typeof a=="number"?new Array(a):[],u=typeof a=="number"?new c(a):[],h=0;return r(o,function(f){l[h]=f,u[h]=h++}),[l,u]}return lo.isArrayLike=t,lo.guessLength=n,lo.toArray=i,lo.toArrayWithIndices=s,lo}var hd,E_;function T1(){if(E_)return hd;E_=1;var r=Vm(),e=xU(),t=bU(),n=e.DEFAULT_COMPARATOR,i=e.reverseComparator;function s(p,_,y,x){for(var b=_[x],w,S;x>y;){if(w=x-1>>1,S=_[w],p(b,S)<0){_[x]=S,x=w;continue}break}_[x]=b}function o(p,_,y){for(var x=_.length,b=y,w=_[y],S=2*y+1,M;S=0&&(S=M),_[y]=_[S],y=S,S=2*y+1;_[y]=w,s(p,_,b,y)}function a(p,_,y){_.push(y),s(p,_,0,_.length-1)}function c(p,_){var y=_.pop();if(_.length!==0){var x=_[0];return _[0]=y,o(p,_,0),x}return y}function l(p,_,y){if(_.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var x=_[0];return _[0]=y,o(p,_,0),x}function u(p,_,y){var x;return _.length!==0&&p(_[0],y)<0&&(x=_[0],_[0]=y,y=x,o(p,_,0)),y}function h(p,_){for(var y=_.length,x=y>>1,b=x;--b>=0;)o(p,_,b)}function f(p,_){for(var y=_.length,x=0,b=new Array(y);x=y.length)return y.slice().sort(p);for(E=y.slice(0,_),h(x,E),b=_,w=y.length;b0&&l(x,E,y[b]);return E.sort(p)}var T=t.guessLength(y);return T!==null&&T<_&&(_=T),E=new Array(_),b=0,r(y,function(L){b<_?E[b]=L:(b===_&&h(x,E),x(L,E[0])>0&&l(x,E,L)),b++}),E.length>b&&(E.length=b),E.sort(p)}function m(p,_,y){arguments.length===2&&(y=_,_=p,p=n);var x=i(p),b,w,S,M=-1/0,E;if(_===1){if(t.isArrayLike(y)){for(b=0,w=y.length;b0)&&(M=S);return E=new y.constructor(1),E[0]=M,E}return r(y,function(L){(M===-1/0||p(L,M)>0)&&(M=L)}),[M]}if(t.isArrayLike(y)){if(_>=y.length)return y.slice().sort(x);for(E=y.slice(0,_),h(p,E),b=_,w=y.length;b0&&l(p,E,y[b]);return E.sort(x)}var T=t.guessLength(y);return T!==null&&T<_&&(_=T),E=new Array(_),b=0,r(y,function(L){b<_?E[b]=L:(b===_&&h(p,E),p(L,E[0])>0&&l(p,E,L)),b++}),E.length>b&&(E.length=b),E.sort(x)}function v(p){if(this.clear(),this.comparator=p||n,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}v.prototype.clear=function(){this.items=[],this.size=0},v.prototype.push=function(p){return a(this.comparator,this.items,p),++this.size},v.prototype.peek=function(){return this.items[0]},v.prototype.pop=function(){return this.size!==0&&this.size--,c(this.comparator,this.items)},v.prototype.replace=function(p){return l(this.comparator,this.items,p)},v.prototype.pushpop=function(p){return u(this.comparator,this.items,p)},v.prototype.consume=function(){return this.size=0,f(this.comparator,this.items)},v.prototype.toArray=function(){return f(this.comparator,this.items.slice())},v.prototype.inspect=function(){var p=this.toArray();return Object.defineProperty(p,"constructor",{value:v,enumerable:!1}),p},typeof Symbol<"u"&&(v.prototype[Symbol.for("nodejs.util.inspect.custom")]=v.prototype.inspect);function g(p){if(this.clear(),this.comparator=p||n,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=i(this.comparator)}return g.prototype=v.prototype,v.from=function(p,_){var y=new v(_),x;return t.isArrayLike(p)?x=p.slice():x=t.toArray(p),h(y.comparator,x),y.items=x,y.size=x.length,y},g.from=function(p,_){var y=new g(_),x;return t.isArrayLike(p)?x=p.slice():x=t.toArray(p),h(y.comparator,x),y.items=x,y.size=x.length,y},v.siftUp=o,v.siftDown=s,v.push=a,v.pop=c,v.replace=l,v.pushpop=u,v.heapify=h,v.consume=f,v.nsmallest=d,v.nlargest=m,v.MinHeap=v,v.MaxHeap=g,hd=v,hd}var M_;function wU(){if(M_)return Ta;M_=1;var r=ur(),e=dh().createEdgeWeightGetter,t=T1(),n="weight";function i(h,f){return h[0]>f[0]?1:h[0]f[1]?1:h[1]f[2]?1:h[2]f[0]?1:h[0]f[1]?1:h[1]f[2]?1:h[2]f[3]?1:h[3]T)&&(x=T,y=g[0][P].concat(g[1][P].slice(0,-1).reverse()))))}}return[1/0,null]}function a(h,f,d,m,v,g){if(!r(h))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");d=e(d||n).fromMinimalEntry;var p={},_={},y=new t(i),x=0,b,w,S,M,E,T,L,P,A,z,V;for(P=0,z=f.length;Pa[0]?1:o[0]a[1]?1:o[1]h.cutoff||(m[L]=[T,M],d.push([T+M,f++,L,T,p]))}}for(;d.size!==0;){if(g=d.pop(),p=g[2],y=g[3],x=g[4],p===c){for(b=[p],w=x;w!==null;)b.push(w),w=v[w];return b.reverse(),b}v.hasOwnProperty(p)&&(v[p]===null||(S=m[p][0],S0&&(T=w[0]),T instanceof Error)throw T;var L=new Error("Unhandled error."+(T?" ("+T.message+")":""));throw L.context=T,L}var P=E[b];if(P===void 0)return!1;if(typeof P=="function")e(P,this,w);else for(var A=P.length,z=m(P,A),S=0;S0&&T.length>M&&!T.warned){T.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+T.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=x,L.type=b,L.count=T.length,n(L)}return x}s.prototype.addListener=function(b,w){return l(this,b,w,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(b,w){return l(this,b,w,!0)};function u(){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 h(x,b,w){var S={fired:!1,wrapFn:void 0,target:x,type:b,listener:w},M=u.bind(S);return M.listener=w,S.wrapFn=M,M}s.prototype.once=function(b,w){return a(w),this.on(b,h(this,b,w)),this},s.prototype.prependOnceListener=function(b,w){return a(w),this.prependListener(b,h(this,b,w)),this},s.prototype.removeListener=function(b,w){var S,M,E,T,L;if(a(w),M=this._events,M===void 0)return this;if(S=M[b],S===void 0)return this;if(S===w||S.listener===w)--this._eventsCount===0?this._events=Object.create(null):(delete M[b],M.removeListener&&this.emit("removeListener",b,S.listener||w));else if(typeof S!="function"){for(E=-1,T=S.length-1;T>=0;T--)if(S[T]===w||S[T].listener===w){L=S[T].listener,E=T;break}if(E<0)return this;E===0?S.shift():v(S,E),S.length===1&&(M[b]=S[0]),M.removeListener!==void 0&&this.emit("removeListener",b,L||w)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(b){var w,S,M;if(S=this._events,S===void 0)return this;if(S.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):S[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete S[b]),this;if(arguments.length===0){var E=Object.keys(S),T;for(M=0;M=0;M--)this.removeListener(b,w[M]);return this};function f(x,b,w){var S=x._events;if(S===void 0)return[];var M=S[b];return M===void 0?[]:typeof M=="function"?w?[M.listener||M]:[M]:w?g(M):m(M,M.length)}s.prototype.listeners=function(b){return f(this,b,!0)},s.prototype.rawListeners=function(b){return f(this,b,!1)},s.listenerCount=function(x,b){return typeof x.listenerCount=="function"?x.listenerCount(b):d.call(x,b)},s.prototype.listenerCount=d;function d(x){var b=this._events;if(b!==void 0){var w=b[x];if(typeof w=="function")return 1;if(w!==void 0)return w.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function m(x,b){for(var w=new Array(b),S=0;S1?n:1/0,s=i!==1/0?new Array(i):[],o,a=0,c=r(t);;){if(a===i)return s;if(o=c.next(),o.done)return a!==n&&(s.length=a),s;s[a++]=o.value}},pd}var RU=CU();const C1=ki(RU);var md,L_;function PU(){if(L_)return md;L_=1;var r=ph(),e=A1();return md=function(){var n=arguments,i=null,s=-1;return new r(function(){var a=null;do{if(i===null){if(s++,s>=n.length)return{done:!0};i=e(n[s])}if(a=i.next(),a.done===!0){i=null;continue}break}while(!0);return a})},md}var LU=PU();const rr=ki(LU);function DU(){const r=arguments[0];for(let e=1,t=arguments.length;er++}class Hm extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class Be extends Hm{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Be.prototype.constructor)}}class Ie extends Hm{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Ie.prototype.constructor)}}class Xe extends Hm{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Xe.prototype.constructor)}}function P1(r,e){this.key=r,this.attributes=e,this.clear()}P1.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 L1(r,e){this.key=r,this.attributes=e,this.clear()}L1.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function D1(r,e){this.key=r,this.attributes=e,this.clear()}D1.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function zo(r,e,t,n,i){this.key=e,this.attributes=i,this.undirected=r,this.source=t,this.target=n}zo.prototype.attach=function(){let r="out",e="in";this.undirected&&(r=e="undirected");const t=this.source.key,n=this.target.key;this.source[r][n]=this,!(this.undirected&&t===n)&&(this.target[e][t]=this)};zo.prototype.attachMulti=function(){let r="out",e="in";const t=this.source.key,n=this.target.key;this.undirected&&(r=e="undirected");const i=this.source[r],s=i[n];if(typeof s>"u"){i[n]=this,this.undirected&&t===n||(this.target[e][t]=this);return}s.previous=this,this.next=s,i[n]=this,this.target[e][t]=this};zo.prototype.detach=function(){const r=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),delete this.source[t][e],delete this.target[n][r]};zo.prototype.detachMulti=function(){const r=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[n][r]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[n][r]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const I1=0,U1=1,UU=2,O1=3;function hr(r,e,t,n,i,s,o){let a,c,l,u;if(n=""+n,t===I1){if(a=r._nodes.get(n),!a)throw new Ie(`Graph.${e}: could not find the "${n}" node in the graph.`);l=i,u=s}else if(t===O1){if(i=""+i,c=r._edges.get(i),!c)throw new Ie(`Graph.${e}: could not find the "${i}" edge in the graph.`);const h=c.source.key,f=c.target.key;if(n===h)a=c.target;else if(n===f)a=c.source;else throw new Ie(`Graph.${e}: the "${n}" node is not attached to the "${i}" edge (${h}, ${f}).`);l=s,u=o}else{if(c=r._edges.get(n),!c)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`);t===U1?a=c.source:a=c.target,l=i,u=s}return[a,l,u]}function OU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);return o.attributes[a]}}function NU(r,e,t){r.prototype[e]=function(n,i){const[s]=hr(this,e,t,n,i);return s.attributes}}function FU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);return o.attributes.hasOwnProperty(a)}}function kU(r,e,t){r.prototype[e]=function(n,i,s,o){const[a,c,l]=hr(this,e,t,n,i,s,o);return a.attributes[c]=l,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}function zU(r,e,t){r.prototype[e]=function(n,i,s,o){const[a,c,l]=hr(this,e,t,n,i,s,o);if(typeof l!="function")throw new Be(`Graph.${e}: updater should be a function.`);const u=a.attributes,h=l(u[c]);return u[c]=h,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}function BU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);return delete o.attributes[a],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:a}),this}}function GU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);if(!cn(a))throw new Be(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=a,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function VU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);if(!cn(a))throw new Be(`Graph.${e}: provided attributes are not a plain object.`);return Jt(o.attributes,a),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:a}),this}}function HU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);if(typeof a!="function")throw new Be(`Graph.${e}: provided updater is not a function.`);return o.attributes=a(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const WU=[{name:r=>`get${r}Attribute`,attacher:OU},{name:r=>`get${r}Attributes`,attacher:NU},{name:r=>`has${r}Attribute`,attacher:FU},{name:r=>`set${r}Attribute`,attacher:kU},{name:r=>`update${r}Attribute`,attacher:zU},{name:r=>`remove${r}Attribute`,attacher:BU},{name:r=>`replace${r}Attributes`,attacher:GU},{name:r=>`merge${r}Attributes`,attacher:VU},{name:r=>`update${r}Attributes`,attacher:HU}];function XU(r){WU.forEach(function({name:e,attacher:t}){t(r,e("Node"),I1),t(r,e("Source"),U1),t(r,e("Target"),UU),t(r,e("Opposite"),O1)})}function qU(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: 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=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: 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(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes[i]}}function YU(r,e,t){r.prototype[e]=function(n){let i;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Xe(`Graph.${e}: 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=""+n,o=""+arguments[1];if(i=ii(this,s,o,t),!i)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${s}" - "${o}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: 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(n=""+n,i=this._edges.get(n),!i)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return i.attributes}}function jU(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: 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=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: 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(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes.hasOwnProperty(i)}}function $U(r,e,t){r.prototype[e]=function(n,i,s){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Xe(`Graph.${e}: 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=""+n,c=""+i;if(i=arguments[2],s=arguments[3],o=ii(this,a,c,t),!o)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${a}" - "${c}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: 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(n=""+n,o=this._edges.get(n),!o)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return o.attributes[i]=s,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function ZU(r,e,t){r.prototype[e]=function(n,i,s){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Xe(`Graph.${e}: 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=""+n,c=""+i;if(i=arguments[2],s=arguments[3],o=ii(this,a,c,t),!o)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${a}" - "${c}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: 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(n=""+n,o=this._edges.get(n),!o)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof s!="function")throw new Be(`Graph.${e}: updater should be a function.`);return o.attributes[i]=s(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function KU(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: 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=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: 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(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return delete s.attributes[i],this.emit("edgeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:i}),this}}function JU(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: 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=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: 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(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!cn(i))throw new Be(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function QU(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: 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=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: 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(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!cn(i))throw new Be(`Graph.${e}: provided attributes are not a plain object.`);return Jt(s.attributes,i),this.emit("edgeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:i}),this}}function eO(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: 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=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: 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(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof i!="function")throw new Be(`Graph.${e}: provided updater is not a function.`);return s.attributes=i(s.attributes),this.emit("edgeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const tO=[{name:r=>`get${r}Attribute`,attacher:qU},{name:r=>`get${r}Attributes`,attacher:YU},{name:r=>`has${r}Attribute`,attacher:jU},{name:r=>`set${r}Attribute`,attacher:$U},{name:r=>`update${r}Attribute`,attacher:ZU},{name:r=>`remove${r}Attribute`,attacher:KU},{name:r=>`replace${r}Attributes`,attacher:JU},{name:r=>`merge${r}Attributes`,attacher:QU},{name:r=>`update${r}Attributes`,attacher:eO}];function nO(r){tO.forEach(function({name:e,attacher:t}){t(r,e("Edge"),"mixed"),t(r,e("DirectedEdge"),"directed"),t(r,e("UndirectedEdge"),"undirected")})}const iO=[{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 rO(r,e,t,n){let i=!1;for(const s in e){if(s===n)continue;const o=e[s];if(i=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),r&&i)return o.key}}function sO(r,e,t,n){let i,s,o,a=!1;for(const c in e)if(c!==n){i=e[c];do{if(s=i.source,o=i.target,a=t(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected),r&&a)return i.key;i=i.next}while(i!==void 0)}}function gd(r,e){const t=Object.keys(r),n=t.length;let i,s=0;return new ri(function(){do if(i)i=i.next;else{if(s>=n)return{done:!0};const a=t[s++];if(a===e){i=void 0;continue}i=r[a]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}})}function oO(r,e,t,n){const i=e[t];if(!i)return;const s=i.source,o=i.target;if(n(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected)&&r)return i.key}function aO(r,e,t,n){let i=e[t];if(!i)return;let s=!1;do{if(s=n(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),r&&s)return i.key;i=i.next}while(i!==void 0)}function vd(r,e){let t=r[e];return t.next!==void 0?new ri(function(){if(!t)return{done:!0};const n={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:n}}):ri.of({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 cO(r,e){if(r.size===0)return[];if(e==="mixed"||e===r.type)return typeof Array.from=="function"?Array.from(r._edges.keys()):C1(r._edges.keys(),r._edges.size);const t=e==="undirected"?r.undirectedSize:r.directedSize,n=new Array(t),i=e==="undirected",s=r._edges.values();let o=0,a,c;for(;a=s.next(),a.done!==!0;)c=a.value,c.undirected===i&&(n[o++]=c.key);return n}function N1(r,e,t,n){if(e.size===0)return;const i=t!=="mixed"&&t!==e.type,s=t==="undirected";let o,a,c=!1;const l=e._edges.values();for(;o=l.next(),o.done!==!0;){if(a=o.value,i&&a.undirected!==s)continue;const{key:u,attributes:h,source:f,target:d}=a;if(c=n(u,h,f.key,d.key,f.attributes,d.attributes,a.undirected),r&&c)return u}}function lO(r,e){if(r.size===0)return ri.empty();const t=e!=="mixed"&&e!==r.type,n=e==="undirected",i=r._edges.values();return new ri(function(){let o,a;for(;;){if(o=i.next(),o.done)return o;if(a=o.value,!(t&&a.undirected!==n))break}return{value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected},done:!1}})}function Wm(r,e,t,n,i,s){const o=e?sO:rO;let a;if(t!=="undirected"&&(n!=="out"&&(a=o(r,i.in,s),r&&a)||n!=="in"&&(a=o(r,i.out,s,n?void 0:i.key),r&&a))||t!=="directed"&&(a=o(r,i.undirected,s),r&&a))return a}function uO(r,e,t,n){const i=[];return Wm(!1,r,e,t,n,function(s){i.push(s)}),i}function hO(r,e,t){let n=ri.empty();return r!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(n=rr(n,gd(t.in))),e!=="in"&&typeof t.out<"u"&&(n=rr(n,gd(t.out,e?void 0:t.key)))),r!=="directed"&&typeof t.undirected<"u"&&(n=rr(n,gd(t.undirected))),n}function Xm(r,e,t,n,i,s,o){const a=t?aO:oO;let c;if(e!=="undirected"&&(typeof i.in<"u"&&n!=="out"&&(c=a(r,i.in,s,o),r&&c)||typeof i.out<"u"&&n!=="in"&&(n||i.key!==s)&&(c=a(r,i.out,s,o),r&&c))||e!=="directed"&&typeof i.undirected<"u"&&(c=a(r,i.undirected,s,o),r&&c))return c}function fO(r,e,t,n,i){const s=[];return Xm(!1,r,e,t,n,i,function(o){s.push(o)}),s}function dO(r,e,t,n){let i=ri.empty();return r!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&n in t.in&&(i=rr(i,vd(t.in,n))),typeof t.out<"u"&&e!=="in"&&n in t.out&&(e||t.key!==n)&&(i=rr(i,vd(t.out,n)))),r!=="directed"&&typeof t.undirected<"u"&&n in t.undirected&&(i=rr(i,vd(t.undirected,n))),i}function pO(r,e){const{name:t,type:n,direction:i}=e;r.prototype[t]=function(s,o){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];if(!arguments.length)return cO(this,n);if(arguments.length===1){s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new Ie(`Graph.${t}: could not find the "${s}" node in the graph.`);return uO(this.multi,n==="mixed"?this.type:n,i,a)}if(arguments.length===2){s=""+s,o=""+o;const a=this._nodes.get(s);if(!a)throw new Ie(`Graph.${t}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(o))throw new Ie(`Graph.${t}: could not find the "${o}" target node in the graph.`);return fO(n,this.multi,i,a,o)}throw new Be(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function mO(r,e){const{name:t,type:n,direction:i}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[s]=function(l,u,h){if(!(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)){if(arguments.length===1)return h=l,N1(!1,this,n,h);if(arguments.length===2){l=""+l,h=u;const f=this._nodes.get(l);if(typeof f>"u")throw new Ie(`Graph.${s}: could not find the "${l}" node in the graph.`);return Wm(!1,this.multi,n==="mixed"?this.type:n,i,f,h)}if(arguments.length===3){l=""+l,u=""+u;const f=this._nodes.get(l);if(!f)throw new Ie(`Graph.${s}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(u))throw new Ie(`Graph.${s}: could not find the "${u}" target node in the graph.`);return Xm(!1,n,this.multi,i,f,u,h)}throw new Be(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);r.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),u=l.pop();let h;if(l.length===0){let f=0;n!=="directed"&&(f+=this.undirectedSize),n!=="undirected"&&(f+=this.directedSize),h=new Array(f);let d=0;l.push((m,v,g,p,_,y,x)=>{h[d++]=u(m,v,g,p,_,y,x)})}else h=[],l.push((f,d,m,v,g,p,_)=>{h.push(u(f,d,m,v,g,p,_))});return this[s].apply(this,l),h};const a="filter"+t[0].toUpperCase()+t.slice(1);r.prototype[a]=function(){const l=Array.prototype.slice.call(arguments),u=l.pop(),h=[];return l.push((f,d,m,v,g,p,_)=>{u(f,d,m,v,g,p,_)&&h.push(f)}),this[s].apply(this,l),h};const c="reduce"+t[0].toUpperCase()+t.slice(1);r.prototype[c]=function(){let l=Array.prototype.slice.call(arguments);if(l.length<2||l.length>4)throw new Be(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${l.length}).`);if(typeof l[l.length-1]=="function"&&typeof l[l.length-2]!="function")throw new Be(`Graph.${c}: 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 u,h;l.length===2?(u=l[0],h=l[1],l=[]):l.length===3?(u=l[1],h=l[2],l=[l[0]]):l.length===4&&(u=l[2],h=l[3],l=[l[0],l[1]]);let f=h;return l.push((d,m,v,g,p,_,y)=>{f=u(f,d,m,v,g,p,_,y)}),this[s].apply(this,l),f}}function gO(r,e){const{name:t,type:n,direction:i}=e,s="find"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[s]=function(c,l,u){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return!1;if(arguments.length===1)return u=c,N1(!0,this,n,u);if(arguments.length===2){c=""+c,u=l;const h=this._nodes.get(c);if(typeof h>"u")throw new Ie(`Graph.${s}: could not find the "${c}" node in the graph.`);return Wm(!0,this.multi,n==="mixed"?this.type:n,i,h,u)}if(arguments.length===3){c=""+c,l=""+l;const h=this._nodes.get(c);if(!h)throw new Ie(`Graph.${s}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(l))throw new Ie(`Graph.${s}: could not find the "${l}" target node in the graph.`);return Xm(!0,n,this.multi,i,h,l,u)}throw new Be(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((h,f,d,m,v,g,p)=>l(h,f,d,m,v,g,p)),!!this[s].apply(this,c)};const a="every"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((h,f,d,m,v,g,p)=>!l(h,f,d,m,v,g,p)),!this[s].apply(this,c)}}function vO(r,e){const{name:t,type:n,direction:i}=e,s=t.slice(0,-1)+"Entries";r.prototype[s]=function(o,a){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return ri.empty();if(!arguments.length)return lO(this,n);if(arguments.length===1){o=""+o;const c=this._nodes.get(o);if(!c)throw new Ie(`Graph.${s}: could not find the "${o}" node in the graph.`);return hO(n,i,c)}if(arguments.length===2){o=""+o,a=""+a;const c=this._nodes.get(o);if(!c)throw new Ie(`Graph.${s}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(a))throw new Ie(`Graph.${s}: could not find the "${a}" target node in the graph.`);return dO(n,i,c,a)}throw new Be(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function _O(r){iO.forEach(e=>{pO(r,e),mO(r,e),gO(r,e),vO(r,e)})}const yO=[{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 mh(){this.A=null,this.B=null}mh.prototype.wrap=function(r){this.A===null?this.A=r:this.B===null&&(this.B=r)};mh.prototype.has=function(r){return this.A!==null&&r in this.A||this.B!==null&&r in this.B};function Aa(r,e,t,n,i){for(const s in n){const o=n[s],a=o.source,c=o.target,l=a===t?c:a;if(e&&e.has(l.key))continue;const u=i(l.key,l.attributes);if(r&&u)return l.key}}function qm(r,e,t,n,i){if(e!=="mixed"){if(e==="undirected")return Aa(r,null,n,n.undirected,i);if(typeof t=="string")return Aa(r,null,n,n[t],i)}const s=new mh;let o;if(e!=="undirected"){if(t!=="out"){if(o=Aa(r,null,n,n.in,i),r&&o)return o;s.wrap(n.in)}if(t!=="in"){if(o=Aa(r,s,n,n.out,i),r&&o)return o;s.wrap(n.out)}}if(e!=="directed"&&(o=Aa(r,s,n,n.undirected,i),r&&o))return o}function xO(r,e,t){if(r!=="mixed"){if(r==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const n=[];return qm(!1,r,e,t,function(i){n.push(i)}),n}function Ca(r,e,t){const n=Object.keys(t),i=n.length;let s=0;return new ri(function(){let a=null;do{if(s>=i)return r&&r.wrap(t),{done:!0};const c=t[n[s++]],l=c.source,u=c.target;if(a=l===e?u:l,r&&r.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}})}function bO(r,e,t){if(r!=="mixed"){if(r==="undirected")return Ca(null,t,t.undirected);if(typeof e=="string")return Ca(null,t,t[e])}let n=ri.empty();const i=new mh;return r!=="undirected"&&(e!=="out"&&(n=rr(n,Ca(i,t,t.in))),e!=="in"&&(n=rr(n,Ca(i,t,t.out)))),r!=="directed"&&(n=rr(n,Ca(i,t,t.undirected))),n}function wO(r,e){const{name:t,type:n,direction:i}=e;r.prototype[t]=function(s){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];s=""+s;const o=this._nodes.get(s);if(typeof o>"u")throw new Ie(`Graph.${t}: could not find the "${s}" node in the graph.`);return xO(n==="mixed"?this.type:n,i,o)}}function SO(r,e){const{name:t,type:n,direction:i}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[s]=function(l,u){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;l=""+l;const h=this._nodes.get(l);if(typeof h>"u")throw new Ie(`Graph.${s}: could not find the "${l}" node in the graph.`);qm(!1,n==="mixed"?this.type:n,i,h,u)};const o="map"+t[0].toUpperCase()+t.slice(1);r.prototype[o]=function(l,u){const h=[];return this[s](l,(f,d)=>{h.push(u(f,d))}),h};const a="filter"+t[0].toUpperCase()+t.slice(1);r.prototype[a]=function(l,u){const h=[];return this[s](l,(f,d)=>{u(f,d)&&h.push(f)}),h};const c="reduce"+t[0].toUpperCase()+t.slice(1);r.prototype[c]=function(l,u,h){if(arguments.length<3)throw new Be(`Graph.${c}: 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=h;return this[s](l,(d,m)=>{f=u(f,d,m)}),f}}function EO(r,e){const{name:t,type:n,direction:i}=e,s=t[0].toUpperCase()+t.slice(1,-1),o="find"+s;r.prototype[o]=function(l,u){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;l=""+l;const h=this._nodes.get(l);if(typeof h>"u")throw new Ie(`Graph.${o}: could not find the "${l}" node in the graph.`);return qm(!0,n==="mixed"?this.type:n,i,h,u)};const a="some"+s;r.prototype[a]=function(l,u){return!!this[o](l,u)};const c="every"+s;r.prototype[c]=function(l,u){return!this[o](l,(f,d)=>!u(f,d))}}function MO(r,e){const{name:t,type:n,direction:i}=e,s=t.slice(0,-1)+"Entries";r.prototype[s]=function(o){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return ri.empty();o=""+o;const a=this._nodes.get(o);if(typeof a>"u")throw new Ie(`Graph.${s}: could not find the "${o}" node in the graph.`);return bO(n==="mixed"?this.type:n,i,a)}}function TO(r){yO.forEach(e=>{wO(r,e),SO(r,e),EO(r,e),MO(r,e)})}function $l(r,e,t,n,i){const s=n._nodes.values(),o=n.type;let a,c,l,u,h,f;for(;a=s.next(),a.done!==!0;){let d=!1;if(c=a.value,o!=="undirected"){u=c.out;for(l in u){h=u[l];do f=h.target,d=!0,i(c.key,f.key,c.attributes,f.attributes,h.key,h.attributes,h.undirected),h=h.next;while(h)}}if(o!=="directed"){u=c.undirected;for(l in u)if(!(e&&c.key>l)){h=u[l];do f=h.target,f.key!==l&&(f=h.source),d=!0,i(c.key,f.key,c.attributes,f.attributes,h.key,h.attributes,h.undirected),h=h.next;while(h)}}t&&!d&&i(c.key,null,c.attributes,null,null,null,null)}}function AO(r,e){const t={key:r};return R1(e.attributes)||(t.attributes=Jt({},e.attributes)),t}function CO(r,e,t){const n={key:e,source:t.source.key,target:t.target.key};return R1(t.attributes)||(n.attributes=Jt({},t.attributes)),r==="mixed"&&t.undirected&&(n.undirected=!0),n}function RO(r){if(!cn(r))throw new Be('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in r))throw new Be("Graph.import: serialized node is missing its key.");if("attributes"in r&&(!cn(r.attributes)||r.attributes===null))throw new Be("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function PO(r){if(!cn(r))throw new Be('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in r))throw new Be("Graph.import: serialized edge is missing its source.");if(!("target"in r))throw new Be("Graph.import: serialized edge is missing its target.");if("attributes"in r&&(!cn(r.attributes)||r.attributes===null))throw new Be("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in r&&typeof r.undirected!="boolean")throw new Be("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const LO=IU(),DO=new Set(["directed","undirected","mixed"]),I_=new Set(["domain","_events","_eventsCount","_maxListeners"]),IO=[{name:r=>`${r}Edge`,generateKey:!0},{name:r=>`${r}DirectedEdge`,generateKey:!0,type:"directed"},{name:r=>`${r}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:r=>`${r}EdgeWithKey`},{name:r=>`${r}DirectedEdgeWithKey`,type:"directed"},{name:r=>`${r}UndirectedEdgeWithKey`,type:"undirected"}],UO={allowSelfLoops:!0,multi:!1,type:"mixed"};function OO(r,e,t){if(t&&!cn(t))throw new Be(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},r._nodes.has(e))throw new Xe(`Graph.addNode: the "${e}" node already exist in the graph.`);const n=new r.NodeDataClass(e,t);return r._nodes.set(e,n),r.emit("nodeAdded",{key:e,attributes:t}),n}function U_(r,e,t){const n=new r.NodeDataClass(e,t);return r._nodes.set(e,n),r.emit("nodeAdded",{key:e,attributes:t}),n}function F1(r,e,t,n,i,s,o,a){if(!n&&r.type==="undirected")throw new Xe(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(n&&r.type==="directed")throw new Xe(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!cn(a))throw new Be(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(s=""+s,o=""+o,a=a||{},!r.allowSelfLoops&&s===o)throw new Xe(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const c=r._nodes.get(s),l=r._nodes.get(o);if(!c)throw new Ie(`Graph.${e}: source node "${s}" not found.`);if(!l)throw new Ie(`Graph.${e}: target node "${o}" not found.`);const u={key:null,undirected:n,source:s,target:o,attributes:a};if(t)i=r._edgeKeyGenerator();else if(i=""+i,r._edges.has(i))throw new Xe(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!r.multi&&(n?typeof c.undirected[o]<"u":typeof c.out[o]<"u"))throw new Xe(`Graph.${e}: an edge linking "${s}" 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 h=new zo(n,i,c,l,a);r._edges.set(i,h);const f=s===o;return n?(c.undirectedDegree++,l.undirectedDegree++,f&&(c.undirectedLoops++,r._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,f&&(c.directedLoops++,r._directedSelfLoopCount++)),r.multi?h.attachMulti():h.attach(),n?r._undirectedSize++:r._directedSize++,u.key=i,r.emit("edgeAdded",u),i}function NO(r,e,t,n,i,s,o,a,c){if(!n&&r.type==="undirected")throw new Xe(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(n&&r.type==="directed")throw new Xe(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a){if(c){if(typeof a!="function")throw new Be(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!cn(a))throw new Be(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`)}s=""+s,o=""+o;let l;if(c&&(l=a,a=void 0),!r.allowSelfLoops&&s===o)throw new Xe(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=r._nodes.get(s),h=r._nodes.get(o),f,d;if(!t&&(f=r._edges.get(i),f)){if((f.source.key!==s||f.target.key!==o)&&(!n||f.source.key!==o||f.target.key!==s))throw new Xe(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${s}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);d=f}if(!d&&!r.multi&&u&&(d=n?u.undirected[o]:u.out[o]),d){const _=[d.key,!1,!1,!1];if(c?!l:!a)return _;if(c){const y=d.attributes;d.attributes=l(y),r.emit("edgeAttributesUpdated",{type:"replace",key:d.key,attributes:d.attributes})}else Jt(d.attributes,a),r.emit("edgeAttributesUpdated",{type:"merge",key:d.key,attributes:d.attributes,data:a});return _}a=a||{},c&&l&&(a=l(a));const m={key:null,undirected:n,source:s,target:o,attributes:a};if(t)i=r._edgeKeyGenerator();else if(i=""+i,r._edges.has(i))throw new Xe(`Graph.${e}: the "${i}" edge already exists in the graph.`);let v=!1,g=!1;u||(u=U_(r,s,{}),v=!0,s===o&&(h=u,g=!0)),h||(h=U_(r,o,{}),g=!0),f=new zo(n,i,u,h,a),r._edges.set(i,f);const p=s===o;return n?(u.undirectedDegree++,h.undirectedDegree++,p&&(u.undirectedLoops++,r._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,p&&(u.directedLoops++,r._directedSelfLoopCount++)),r.multi?f.attachMulti():f.attach(),n?r._undirectedSize++:r._directedSize++,m.key=i,r.emit("edgeAdded",m),[i,!0,v,g]}function uo(r,e){r._edges.delete(e.key);const{source:t,target:n,attributes:i}=e,s=e.undirected,o=t===n;s?(t.undirectedDegree--,n.undirectedDegree--,o&&(t.undirectedLoops--,r._undirectedSelfLoopCount--)):(t.outDegree--,n.inDegree--,o&&(t.directedLoops--,r._directedSelfLoopCount--)),r.multi?e.detachMulti():e.detach(),s?r._undirectedSize--:r._directedSize--,r.emit("edgeDropped",{key:e.key,attributes:i,source:t.key,target:n.key,undirected:s})}class St extends TU.EventEmitter{constructor(e){if(super(),e=Jt({},UO,e),typeof e.multi!="boolean")throw new Be(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!DO.has(e.type))throw new Be(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new Be(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?P1:e.type==="directed"?L1:D1;$n(this,"NodeDataClass",t);const n="geid_"+LO()+"_";let i=0;const s=()=>{let o;do o=n+i++;while(this._edges.has(o));return o};$n(this,"_attributes",{}),$n(this,"_nodes",new Map),$n(this,"_edges",new Map),$n(this,"_directedSize",0),$n(this,"_undirectedSize",0),$n(this,"_directedSelfLoopCount",0),$n(this,"_undirectedSelfLoopCount",0),$n(this,"_edgeKeyGenerator",s),$n(this,"_options",e),I_.forEach(o=>$n(this,o,this[o])),di(this,"order",()=>this._nodes.size),di(this,"size",()=>this._edges.size),di(this,"directedSize",()=>this._directedSize),di(this,"undirectedSize",()=>this._undirectedSize),di(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),di(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),di(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),di(this,"multi",this._options.multi),di(this,"type",this._options.type),di(this,"allowSelfLoops",this._options.allowSelfLoops),di(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const n=""+e,i=this._edges.get(n);return!!i&&!i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new Be(`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(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const n=""+e,i=this._edges.get(n);return!!i&&i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new Be(`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(e,t){if(arguments.length===1){const n=""+e;return this._edges.has(n)}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?typeof n.out<"u"&&n.out.hasOwnProperty(t)||typeof n.undirected<"u"&&n.undirected.hasOwnProperty(t):!1}throw new Be(`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(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new Xe("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new Ie(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const i=n.out&&n.out[t]||void 0;if(i)return i.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new Xe("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new Ie(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const i=n.undirected&&n.undirected[t]||void 0;if(i)return i.key}edge(e,t){if(this.multi)throw new Xe("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new Ie(`Graph.edge: could not find the "${t}" target node in the graph.`);const i=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(i)return i.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.out}areInNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in n.undirected}areNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in n.in||t in n.out)||this.type!=="directed"&&t in n.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.in||this.type!=="directed"&&t in n.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.out||this.type!=="directed"&&t in n.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree),n}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.outDegree),n}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree,i+=t.directedLoops),n-i}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.outDegree,i+=t.directedLoops),n-i}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree,i+=t.directedLoops*2),n-i}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const n=this._edges.get(t);if(!n)throw new Ie(`Graph.opposite: could not find the "${t}" edge in the graph.`);const i=n.source.key,s=n.target.key;if(e===i)return s;if(e===s)return i;throw new Ie(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${i}, ${s}).`)}hasExtremity(e,t){e=""+e,t=""+t;const n=this._edges.get(e);if(!n)throw new Ie(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return OO(this,e,t).key}mergeNode(e,t){if(t&&!cn(t))throw new Be(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let n=this._nodes.get(e);return n?(t&&(Jt(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new Be(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let n=this._nodes.get(e);if(n){if(t){const s=n.attributes;n.attributes=t(s),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}const i=t?t({}):{};return n=new this.NodeDataClass(e,i),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!=="undirected"){for(const i in t.out){n=t.out[i];do uo(this,n),n=n.next;while(n)}for(const i in t.in){n=t.in[i];do uo(this,n),n=n.next;while(n)}}if(this.type!=="directed")for(const i in t.undirected){n=t.undirected[i];do uo(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const n=""+arguments[0],i=""+arguments[1];if(t=ii(this,n,i,this.type),!t)throw new Ie(`Graph.dropEdge: could not find the "${n}" -> "${i}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new Ie(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return uo(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new Xe("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 Xe("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.");e=""+e,t=""+t;const n=ii(this,e,t,"directed");if(!n)throw new Ie(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return uo(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new Xe("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 Xe("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 n=ii(this,e,t,"undirected");if(!n)throw new Ie(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return uo(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new Be("Graph.updateAttribute: updater should be a function.");const n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!cn(e))throw new Be("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!cn(e))throw new Be("Graph.mergeAttributes: provided attributes are not a plain object.");return Jt(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new Be("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new Be("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!D_(t))throw new Be("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let i,s;for(;i=n.next(),i.done!==!0;)s=i.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new Be("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!D_(t))throw new Be("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let i,s,o,a;for(;i=n.next(),i.done!==!0;)s=i.value,o=s.source,a=s.target,s.attributes=e(s.key,s.attributes,o.key,a.key,o.attributes,a.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new Be("Graph.forEachAdjacencyEntry: expecting a callback.");$l(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new Be("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");$l(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new Be("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");$l(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new Be("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");$l(!1,!0,!0,this,e)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):C1(this._nodes.keys(),this._nodes.size)}forEachNode(e){if(typeof e!="function")throw new Be("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)i=n.value,e(i.key,i.attributes)}findNode(e){if(typeof e!="function")throw new Be("Graph.findNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,e(i.key,i.attributes))return i.key}mapNodes(e){if(typeof e!="function")throw new Be("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let n,i;const s=new Array(this.order);let o=0;for(;n=t.next(),n.done!==!0;)i=n.value,s[o++]=e(i.key,i.attributes);return s}someNode(e){if(typeof e!="function")throw new Be("Graph.someNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,e(i.key,i.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new Be("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,!e(i.key,i.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new Be("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let n,i;const s=[];for(;n=t.next(),n.done!==!0;)i=n.value,e(i.key,i.attributes)&&s.push(i.key);return s}reduceNodes(e,t){if(typeof e!="function")throw new Be("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new Be("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 n=t;const i=this._nodes.values();let s,o;for(;s=i.next(),s.done!==!0;)o=s.value,n=e(n,o.key,o.attributes);return n}nodeEntries(){const e=this._nodes.values();return new ri(()=>{const t=e.next();if(t.done)return t;const n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}})}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((i,s)=>{e[t++]=AO(s,i)});const n=new Array(this._edges.size);return t=0,this._edges.forEach((i,s)=>{n[t++]=CO(this.type,s,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof St)return e.forEachNode((c,l)=>{t?this.mergeNode(c,l):this.addNode(c,l)}),e.forEachEdge((c,l,u,h,f,d,m)=>{t?m?this.mergeUndirectedEdgeWithKey(c,u,h,l):this.mergeDirectedEdgeWithKey(c,u,h,l):m?this.addUndirectedEdgeWithKey(c,u,h,l):this.addDirectedEdgeWithKey(c,u,h,l)}),this;if(!cn(e))throw new Be("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!cn(e.attributes))throw new Be("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let n,i,s,o,a;if(e.nodes){if(s=e.nodes,!Array.isArray(s))throw new Be("Graph.import: invalid nodes. Expecting an array.");for(n=0,i=s.length;n{const s=Jt({},n.attributes);n=new t.NodeDataClass(i,s),t._nodes.set(i,n)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new Xe(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new Xe("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 e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new Xe("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(e),n=this._edges.values();let i,s;for(;i=n.next(),i.done!==!0;)s=i.value,F1(t,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,Jt({},s.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((s,o)=>{e[o]=s.attributes});const t={},n={};this._edges.forEach((s,o)=>{const a=s.undirected?"--":"->";let c="",l=s.source.key,u=s.target.key,h;s.undirected&&l>u&&(h=l,l=u,u=h);const f=`(${l})${a}(${u})`;o.startsWith("geid_")?this.multi&&(typeof n[f]>"u"?n[f]=0:n[f]++,c+=`${n[f]}. `):c+=`[${o}]: `,c+=f,t[c]=s.attributes});const i={};for(const s in this)this.hasOwnProperty(s)&&!I_.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(i[s]=this[s]);return i.attributes=this._attributes,i.nodes=e,i.edges=t,$n(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(St.prototype[Symbol.for("nodejs.util.inspect.custom")]=St.prototype.inspect);IO.forEach(r=>{["add","merge","update"].forEach(e=>{const t=r.name(e),n=e==="add"?F1:NO;r.generateKey?St.prototype[t]=function(i,s,o){return n(this,t,!0,(r.type||this.type)==="undirected",null,i,s,o,e==="update")}:St.prototype[t]=function(i,s,o,a){return n(this,t,!1,(r.type||this.type)==="undirected",i,s,o,a,e==="update")}})});XU(St);nO(St);_O(St);TO(St);class k1 extends St{constructor(e){const t=Jt({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new Be("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new Be('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class z1 extends St{constructor(e){const t=Jt({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new Be("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new Be('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class B1 extends St{constructor(e){const t=Jt({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new Be("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class G1 extends St{constructor(e){const t=Jt({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new Be("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new Be('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class V1 extends St{constructor(e){const t=Jt({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new Be("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new Be('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Bo(r){r.from=function(e,t){const n=Jt({},e.options,t),i=new r(n);return i.import(e),i}}Bo(St);Bo(k1);Bo(z1);Bo(B1);Bo(G1);Bo(V1);St.Graph=St;St.DirectedGraph=k1;St.UndirectedGraph=z1;St.MultiGraph=B1;St.MultiDirectedGraph=G1;St.MultiUndirectedGraph=V1;St.InvalidArgumentsGraphError=Be;St.NotFoundGraphError=Ie;St.UsageGraphError=Xe;const Fc=new G,Ym=new G,FO=new G;function kO(r,e,t){const n=Fc.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,s=t.height/2;return[n.x*i+i,-(n.y*s)+s]}function zO(r,e){const t=Fc.setFromMatrixPosition(r.matrixWorld),n=Ym.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),s=e.getWorldDirection(FO);return i.angleTo(s)>Math.PI/2}function BO(r,e,t,n){const i=Fc.setFromMatrixPosition(r.matrixWorld),s=i.clone();s.project(e),t.setFromCamera(s,e);const o=t.intersectObjects(n,!0);if(o.length){const a=o[0].distance;return i.distanceTo(t.ray.origin)Math.abs(r)<1e-10?0:r;function H1(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=Mp(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const HO=(r=>e=>H1(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),WO=(r=>(e,t)=>H1(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]);function XO(r){return r&&typeof r=="object"&&"current"in r}const jm=q.forwardRef(({children:r,eps:e=.001,style:t,className:n,prepend:i,center:s,fullscreen:o,portal:a,distanceFactor:c,sprite:l=!1,transform:u=!1,occlude:h,onOcclude:f,castShadow:d,receiveShadow:m,material:v,geometry:g,zIndexRange:p=[16777271,0],calculatePosition:_=kO,as:y="div",wrapperClass:x,pointerEvents:b="auto",...w},S)=>{const{gl:M,camera:E,scene:T,size:L,raycaster:P,events:A,viewport:z}=Kt(),[V]=q.useState(()=>document.createElement(y)),N=q.useRef(),C=q.useRef(null),O=q.useRef(0),k=q.useRef([0,0]),U=q.useRef(null),R=q.useRef(null),F=(a==null?void 0:a.current)||A.connected||M.domElement.parentNode,H=q.useRef(null),Y=q.useRef(!1),J=q.useMemo(()=>h&&h!=="blending"||Array.isArray(h)&&h.length&&XO(h[0]),[h]);q.useLayoutEffect(()=>{const me=M.domElement;h&&h==="blending"?(me.style.zIndex=`${Math.floor(p[0]/2)}`,me.style.position="absolute",me.style.pointerEvents="none"):(me.style.zIndex=null,me.style.position=null,me.style.pointerEvents=null)},[h]),q.useLayoutEffect(()=>{if(C.current){const me=N.current=Kw.createRoot(V);if(T.updateMatrixWorld(),u)V.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const te=_(C.current,E,L);V.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${te[0]}px,${te[1]}px,0);transform-origin:0 0;`}return F&&(i?F.prepend(V):F.appendChild(V)),()=>{F&&F.removeChild(V),me.unmount()}}},[F,u]),q.useLayoutEffect(()=>{x&&(V.className=x)},[x]);const ie=q.useMemo(()=>u?{position:"absolute",top:0,left:0,width:L.width,height:L.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-L.height/2,left:-L.width/2,width:L.width,height:L.height},...t},[t,s,o,L,u]),ne=q.useMemo(()=>({position:"absolute",pointerEvents:b}),[b]);q.useLayoutEffect(()=>{if(Y.current=!1,u){var me;(me=N.current)==null||me.render(q.createElement("div",{ref:U,style:ie},q.createElement("div",{ref:R,style:ne},q.createElement("div",{ref:S,className:n,style:t,children:r}))))}else{var te;(te=N.current)==null||te.render(q.createElement("div",{ref:S,style:ie,className:n,children:r}))}});const ee=q.useRef(!0);uh(me=>{if(C.current){E.updateMatrixWorld(),C.current.updateWorldMatrix(!0,!1);const te=u?k.current:_(C.current,E,L);if(u||Math.abs(O.current-E.zoom)>e||Math.abs(k.current[0]-te[0])>e||Math.abs(k.current[1]-te[1])>e){const D=zO(C.current,E);let Q=!1;J&&(Array.isArray(h)?Q=h.map(ye=>ye.current):h!=="blending"&&(Q=[T]));const j=ee.current;if(Q){const ye=BO(C.current,E,P,Q);ee.current=ye&&!D}else ee.current=!D;j!==ee.current&&(f?f(!ee.current):V.style.display=ee.current?"block":"none");const K=Math.floor(p[0]/2),W=h?J?[p[0],K]:[K-1,0]:p;if(V.style.zIndex=`${VO(C.current,E,W)}`,u){const[ye,re]=[L.width/2,L.height/2],fe=E.projectionMatrix.elements[5]*re,{isOrthographicCamera:xe,top:ce,left:Pe,bottom:B,right:I}=E,$=HO(E.matrixWorldInverse),he=xe?`scale(${fe})translate(${Mp(-(I+Pe)/2)}px,${Mp((ce+B)/2)}px)`:`translateZ(${fe}px)`;let de=C.current.matrixWorld;l&&(de=E.matrixWorldInverse.clone().transpose().copyPosition(de).scale(C.current.scale),de.elements[3]=de.elements[7]=de.elements[11]=0,de.elements[15]=1),V.style.width=L.width+"px",V.style.height=L.height+"px",V.style.perspective=xe?"":`${fe}px`,U.current&&R.current&&(U.current.style.transform=`${he}${$}translate(${ye}px,${re}px)`,R.current.style.transform=WO(de,1/((c||10)/400)))}else{const ye=c===void 0?1:GO(C.current,E)*c;V.style.transform=`translate3d(${te[0]}px,${te[1]}px,0) scale(${ye})`}k.current=te,O.current=E.zoom}}if(!J&&H.current&&!Y.current)if(u){if(U.current){const te=U.current.children[0];if(te!=null&&te.clientWidth&&te!=null&&te.clientHeight){const{isOrthographicCamera:D}=E;if(D||g)w.scale&&(Array.isArray(w.scale)?w.scale instanceof G?H.current.scale.copy(w.scale.clone().divideScalar(1)):H.current.scale.set(1/w.scale[0],1/w.scale[1],1/w.scale[2]):H.current.scale.setScalar(1/w.scale));else{const Q=(c||10)/400,j=te.clientWidth*Q,K=te.clientHeight*Q;H.current.scale.set(j,K,1)}Y.current=!0}}}else{const te=V.children[0];if(te!=null&&te.clientWidth&&te!=null&&te.clientHeight){const D=1/z.factor,Q=te.clientWidth*D,j=te.clientHeight*D;H.current.scale.set(Q,j,1),Y.current=!0}H.current.lookAt(me.camera.position)}});const ge=q.useMemo(()=>({vertexShader:u?void 0:` - /* - This shader is from the THREE's SpriteMaterial. - We need to turn the backing plane into a Sprite - (make it always face the camera) if "transfrom" - is false. - */ - #include - - void main() { - vec2 center = vec2(0., 1.); - float rotation = 0.0; - - // This is somewhat arbitrary, but it seems to work well - // Need to figure out how to derive this dynamically if it even matters - float size = 0.03; - - vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); - vec2 scale; - scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); - scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); - - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - - gl_Position = projectionMatrix * mvPosition; - } - `,fragmentShader:` - void main() { - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); - } - `}),[u]);return q.createElement("group",Tc({},w,{ref:C}),h&&!J&&q.createElement("mesh",{castShadow:d,receiveShadow:m,ref:H},g||q.createElement("planeGeometry",null),v||q.createElement("shaderMaterial",{side:Dt,vertexShader:ge.vertexShader,fragmentShader:ge.fragmentShader})))});function ds(r,e="pointer",t="auto",n=document.body){q.useEffect(()=>{if(r)return n.style.cursor=e,()=>void(n.style.cursor=t)},[r])}let $m=zc();const Je=r=>kc(r,$m);let Zm=zc();Je.write=r=>kc(r,Zm);let gh=zc();Je.onStart=r=>kc(r,gh);let Km=zc();Je.onFrame=r=>kc(r,Km);let Jm=zc();Je.onFinish=r=>kc(r,Jm);let Eo=[];Je.setTimeout=(r,e)=>{let t=Je.now()+e,n=()=>{let s=Eo.findIndex(o=>o.cancel==n);~s&&Eo.splice(s,1),Er-=~s?1:0},i={time:t,handler:r,cancel:n};return Eo.splice(W1(t),0,i),Er+=1,X1(),i};let W1=r=>~(~Eo.findIndex(e=>e.time>r)||~Eo.length);Je.cancel=r=>{gh.delete(r),Km.delete(r),Jm.delete(r),$m.delete(r),Zm.delete(r)};Je.sync=r=>{Tp=!0,Je.batchedUpdates(r),Tp=!1};Je.throttle=r=>{let e;function t(){try{r(...e)}finally{e=null}}function n(...i){e=i,Je.onStart(t)}return n.handler=r,n.cancel=()=>{gh.delete(t),e=null},n};let Qm=typeof window<"u"?window.requestAnimationFrame:()=>{};Je.use=r=>Qm=r;Je.now=typeof performance<"u"?()=>performance.now():Date.now;Je.batchedUpdates=r=>r();Je.catch=console.error;Je.frameLoop="always";Je.advance=()=>{Je.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Y1()};let Sr=-1,Er=0,Tp=!1;function kc(r,e){Tp?(e.delete(r),r(0)):(e.add(r),X1())}function X1(){Sr<0&&(Sr=0,Je.frameLoop!=="demand"&&Qm(q1))}function qO(){Sr=-1}function q1(){~Sr&&(Qm(q1),Je.batchedUpdates(Y1))}function Y1(){let r=Sr;Sr=Je.now();let e=W1(Sr);if(e&&(j1(Eo.splice(0,e),t=>t.handler()),Er-=e),!Er){qO();return}gh.flush(),$m.flush(r?Math.min(64,Sr-r):16.667),Km.flush(),Zm.flush(),Jm.flush()}function zc(){let r=new Set,e=r;return{add(t){Er+=e==r&&!r.has(t)?1:0,r.add(t)},delete(t){return Er-=e==r&&r.has(t)?1:0,r.delete(t)},flush(t){e.size&&(r=new Set,Er-=e.size,j1(e,n=>n(t)&&r.add(n)),Er+=r.size,e=r)}}}function j1(r,e){r.forEach(t=>{try{e(t)}catch(n){Je.catch(n)}})}function Ap(){}const YO=(r,e,t)=>Object.defineProperty(r,e,{value:t,writable:!0,configurable:!0}),Oe={arr:Array.isArray,obj:r=>!!r&&r.constructor.name==="Object",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",und:r=>r===void 0};function Ji(r,e){if(Oe.arr(r)){if(!Oe.arr(e)||r.length!==e.length)return!1;for(let t=0;tr.forEach(e);function or(r,e,t){if(Oe.arr(r)){for(let n=0;nOe.und(r)?[]:Oe.arr(r)?r:[r];function Xa(r,e){if(r.size){const t=Array.from(r);r.clear(),_t(t,e)}}const ka=(r,...e)=>Xa(r,t=>t(...e)),eg=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);let tg,$1,Rr=null,Z1=!1,ng=Ap;const jO=r=>{r.to&&($1=r.to),r.now&&(Je.now=r.now),r.colors!==void 0&&(Rr=r.colors),r.skipAnimation!=null&&(Z1=r.skipAnimation),r.createStringInterpolator&&(tg=r.createStringInterpolator),r.requestAnimationFrame&&Je.use(r.requestAnimationFrame),r.batchedUpdates&&(Je.batchedUpdates=r.batchedUpdates),r.willAdvance&&(ng=r.willAdvance),r.frameLoop&&(Je.frameLoop=r.frameLoop)};var Fi=Object.freeze({__proto__:null,get createStringInterpolator(){return tg},get to(){return $1},get colors(){return Rr},get skipAnimation(){return Z1},get willAdvance(){return ng},assign:jO});const qa=new Set;let ti=[],_d=[],Mu=0;const vh={get idle(){return!qa.size&&!ti.length},start(r){Mu>r.priority?(qa.add(r),Je.onStart($O)):(K1(r),Je(Cp))},advance:Cp,sort(r){if(Mu)Je.onFrame(()=>vh.sort(r));else{const e=ti.indexOf(r);~e&&(ti.splice(e,1),J1(r))}},clear(){ti=[],qa.clear()}};function $O(){qa.forEach(K1),qa.clear(),Je(Cp)}function K1(r){ti.includes(r)||J1(r)}function J1(r){ti.splice(ZO(ti,e=>e.priority>r.priority),0,r)}function Cp(r){const e=_d;for(let t=0;t0}function ZO(r,e){const t=r.findIndex(e);return t<0?r.length:t}const KO={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},_i="[-+]?\\d*\\.?\\d+",Tu=_i+"%";function _h(...r){return"\\(\\s*("+r.join(")\\s*,\\s*(")+")\\s*\\)"}const JO=new RegExp("rgb"+_h(_i,_i,_i)),QO=new RegExp("rgba"+_h(_i,_i,_i,_i)),e3=new RegExp("hsl"+_h(_i,Tu,Tu)),t3=new RegExp("hsla"+_h(_i,Tu,Tu,_i)),n3=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,i3=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,r3=/^#([0-9a-fA-F]{6})$/,s3=/^#([0-9a-fA-F]{8})$/;function o3(r){let e;return typeof r=="number"?r>>>0===r&&r>=0&&r<=4294967295?r:null:(e=r3.exec(r))?parseInt(e[1]+"ff",16)>>>0:Rr&&Rr[r]!==void 0?Rr[r]:(e=JO.exec(r))?(ho(e[1])<<24|ho(e[2])<<16|ho(e[3])<<8|255)>>>0:(e=QO.exec(r))?(ho(e[1])<<24|ho(e[2])<<16|ho(e[3])<<8|F_(e[4]))>>>0:(e=n3.exec(r))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=s3.exec(r))?parseInt(e[1],16)>>>0:(e=i3.exec(r))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=e3.exec(r))?(O_(N_(e[1]),Zl(e[2]),Zl(e[3]))|255)>>>0:(e=t3.exec(r))?(O_(N_(e[1]),Zl(e[2]),Zl(e[3]))|F_(e[4]))>>>0:null}function yd(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*(2/3-t)*6:r}function O_(r,e,t){const n=t<.5?t*(1+e):t+e-t*e,i=2*t-n,s=yd(i,n,r+1/3),o=yd(i,n,r),a=yd(i,n,r-1/3);return Math.round(s*255)<<24|Math.round(o*255)<<16|Math.round(a*255)<<8}function ho(r){const e=parseInt(r,10);return e<0?0:e>255?255:e}function N_(r){return(parseFloat(r)%360+360)%360/360}function F_(r){const e=parseFloat(r);return e<0?0:e>1?255:Math.round(e*255)}function Zl(r){const e=parseFloat(r);return e<0?0:e>100?1:e/100}function k_(r){let e=o3(r);if(e===null)return r;e=e||0;let t=(e&4278190080)>>>24,n=(e&16711680)>>>16,i=(e&65280)>>>8,s=(e&255)/255;return`rgba(${t}, ${n}, ${i}, ${s})`}const vc=(r,e,t)=>{if(Oe.fun(r))return r;if(Oe.arr(r))return vc({range:r,output:e,extrapolate:t});if(Oe.str(r.output[0]))return tg(r);const n=r,i=n.output,s=n.range||[0,1],o=n.extrapolateLeft||n.extrapolate||"extend",a=n.extrapolateRight||n.extrapolate||"extend",c=n.easing||(l=>l);return l=>{const u=c3(l,s);return a3(l,s[u],s[u+1],i[u],i[u+1],c,o,a,n.map)}};function a3(r,e,t,n,i,s,o,a,c){let l=c?c(r):r;if(lt){if(a==="identity")return l;a==="clamp"&&(l=t)}return n===i?n:e===t?r<=e?n:i:(e===-1/0?l=-l:t===1/0?l=l-e:l=(l-e)/(t-e),l=s(l),n===-1/0?l=-l:i===1/0?l=l+n:l=l*(i-n)+n,l)}function c3(r,e){for(var t=1;t=r);++t);return t-1}const l3={linear:r=>r};function Rp(){return Rp=Object.assign?Object.assign.bind():function(r){for(var e=1;e!!(r&&r[Io]),Jn=r=>r&&r[Io]?r[Io]():r,z_=r=>r[ws]||null;function u3(r,e){r.eventObserved?r.eventObserved(e):r(e)}function Au(r,e){let t=r[ws];t&&t.forEach(n=>{u3(n,e)})}class h3{constructor(e){if(this[Io]=void 0,this[ws]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");f3(this,e)}}const f3=(r,e)=>Q1(r,Io,e);function Bc(r,e){if(r[Io]){let t=r[ws];t||Q1(r,ws,t=new Set),t.has(e)||(t.add(e),r.observerAdded&&r.observerAdded(t.size,e))}return e}function Cu(r,e){let t=r[ws];if(t&&t.has(e)){const n=t.size-1;n?t.delete(e):r[ws]=null,r.observerRemoved&&r.observerRemoved(n,e)}}const Q1=(r,e,t)=>Object.defineProperty(r,e,{value:t,writable:!0,configurable:!0}),du=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,d3=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,B_=new RegExp(`(${du.source})(%|[a-z]+)`,"i"),p3=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,yh=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,ew=r=>{const[e,t]=m3(r);if(!e||eg())return r;const n=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(n)return n.trim();if(t&&t.startsWith("--")){const i=window.getComputedStyle(document.documentElement).getPropertyValue(t);return i||r}else{if(t&&yh.test(t))return ew(t);if(t)return t}return r},m3=r=>{const e=yh.exec(r);if(!e)return[,];const[,t,n]=e;return[t,n]};let xd;const g3=(r,e,t,n,i)=>`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(n)}, ${i})`,tw=r=>{xd||(xd=Rr?new RegExp(`(${Object.keys(Rr).join("|")})(?!\\w)`,"g"):/^\b$/);const e=r.output.map(s=>Jn(s).replace(yh,ew).replace(d3,k_).replace(xd,k_)),t=e.map(s=>s.match(du).map(Number)),i=t[0].map((s,o)=>t.map(a=>{if(!(o in a))throw Error('The arity of each "output" value must be equal');return a[o]})).map(s=>vc(Rp({},r,{output:s})));return s=>{var o;const a=!B_.test(e[0])&&((o=e.find(l=>B_.test(l)))==null?void 0:o.replace(du,""));let c=0;return e[0].replace(du,()=>`${i[c++](s)}${a||""}`).replace(p3,g3)}},ig="react-spring: ",nw=r=>{const e=r;let t=!1;if(typeof e!="function")throw new TypeError(`${ig}once requires a function parameter`);return(...n)=>{t||(e(...n),t=!0)}},v3=nw(console.warn);function _3(){v3(`${ig}The "interpolate" function is deprecated in v9 (use "to" instead)`)}const y3=nw(console.warn);function x3(){y3(`${ig}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function xh(r){return Oe.str(r)&&(r[0]=="#"||/\d/.test(r)||!eg()&&yh.test(r)||r in(Rr||{}))}const rg=eg()?q.useEffect:q.useLayoutEffect,b3=()=>{const r=q.useRef(!1);return rg(()=>(r.current=!0,()=>{r.current=!1}),[]),r};function iw(){const r=q.useState()[1],e=b3();return()=>{e.current&&r(Math.random())}}function w3(r,e){const[t]=q.useState(()=>({inputs:e,result:r()})),n=q.useRef(),i=n.current;let s=i;return s?e&&s.inputs&&S3(e,s.inputs)||(s={inputs:e,result:r()}):s=t,q.useEffect(()=>{n.current=s,i==t&&(t.inputs=t.result=void 0)},[s]),s.result}function S3(r,e){if(r.length!==e.length)return!1;for(let t=0;tq.useEffect(r,E3),E3=[];function G_(r){const e=q.useRef();return q.useEffect(()=>{e.current=r}),e.current}const _c=Symbol.for("Animated:node"),M3=r=>!!r&&r[_c]===r,Ri=r=>r&&r[_c],sg=(r,e)=>YO(r,_c,e),bh=r=>r&&r[_c]&&r[_c].getPayload();class sw{constructor(){this.payload=void 0,sg(this,this)}getPayload(){return this.payload||[]}}class Go extends sw{constructor(e){super(),this.done=!0,this.elapsedTime=void 0,this.lastPosition=void 0,this.lastVelocity=void 0,this.v0=void 0,this.durationProgress=0,this._value=e,Oe.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new Go(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Oe.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,Oe.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class Uo extends Go{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=vc({output:[e,e]})}static create(e){return new Uo(e)}getValue(){let e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(Oe.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=vc({output:[this.getValue(),e]})),this._value=0,super.reset()}}const Ru={dependencies:null};class og extends sw{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return or(this.source,(n,i)=>{M3(n)?t[i]=n.getValue(e):Pi(n)?t[i]=Jn(n):e||(t[i]=n)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&_t(this.payload,e=>e.reset())}_makePayload(e){if(e){const t=new Set;return or(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Ru.dependencies&&Pi(e)&&Ru.dependencies.add(e);const t=bh(e);t&&_t(t,n=>this.add(n))}}class ag extends og{constructor(e){super(e)}static create(e){return new ag(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const t=this.getPayload();return e.length==t.length?t.map((n,i)=>n.setValue(e[i])).some(Boolean):(super.setValue(e.map(T3)),!0)}}function T3(r){return(xh(r)?Uo:Go).create(r)}function Pp(r){const e=Ri(r);return e?e.constructor:Oe.arr(r)?ag:xh(r)?Uo:Go}function Pu(){return Pu=Object.assign?Object.assign.bind():function(r){for(var e=1;e{const t=!Oe.fun(r)||r.prototype&&r.prototype.isReactComponent;return q.forwardRef((n,i)=>{const s=q.useRef(null),o=t&&q.useCallback(m=>{s.current=R3(i,m)},[i]),[a,c]=C3(n,e),l=iw(),u=()=>{const m=s.current;if(t&&!m)return;(m?e.applyAnimatedValues(m,a.getValue(!0)):!1)===!1&&l()},h=new A3(u,c),f=q.useRef();rg(()=>(f.current=h,_t(c,m=>Bc(m,h)),()=>{f.current&&(_t(f.current.deps,m=>Cu(m,f.current)),Je.cancel(f.current.update))})),q.useEffect(u,[]),rw(()=>()=>{const m=f.current;_t(m.deps,v=>Cu(v,m))});const d=e.getComponentProps(a.getValue());return q.createElement(r,Pu({},d,{ref:o}))})};class A3{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type=="change"&&Je.write(this.update)}}function C3(r,e){const t=new Set;return Ru.dependencies=t,r.style&&(r=Pu({},r,{style:e.createAnimatedStyle(r.style)})),r=new og(r),Ru.dependencies=null,[r,t]}function R3(r,e){return r&&(Oe.fun(r)?r(e):r.current=e),e}const H_=Symbol.for("AnimatedComponent"),P3=(r,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:t=i=>new og(i),getComponentProps:n=i=>i}={})=>{const i={applyAnimatedValues:e,createAnimatedStyle:t,getComponentProps:n},s=o=>{const a=W_(o)||"Anonymous";return Oe.str(o)?o=s[o]||(s[o]=V_(o,i)):o=o[H_]||(o[H_]=V_(o,i)),o.displayName=`Animated(${a})`,o};return or(r,(o,a)=>{Oe.arr(r)&&(a=W_(o)),s[a]=s(o)}),{animated:s}},W_=r=>Oe.str(r)?r:r&&Oe.str(r.displayName)?r.displayName:Oe.fun(r)&&r.name||null;function rn(){return rn=Object.assign?Object.assign.bind():function(r){for(var e=1;er===!0||!!(e&&r&&(Oe.fun(r)?r(e):ni(r).includes(e))),ow=(r,e)=>Oe.obj(r)?e&&r[e]:r,aw=(r,e)=>r.default===!0?r[e]:r.default?r.default[e]:void 0,L3=r=>r,cg=(r,e=L3)=>{let t=D3;r.default&&r.default!==!0&&(r=r.default,t=Object.keys(r));const n={};for(const i of t){const s=e(r[i],i);Oe.und(s)||(n[i]=s)}return n},D3=["config","onProps","onStart","onChange","onPause","onResume","onRest"],I3={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function U3(r){const e={};let t=0;if(or(r,(n,i)=>{I3[i]||(e[i]=n,t++)}),t)return e}function cw(r){const e=U3(r);if(e){const t={to:e};return or(r,(n,i)=>i in e||(t[i]=n)),t}return rn({},r)}function yc(r){return r=Jn(r),Oe.arr(r)?r.map(yc):xh(r)?Fi.createStringInterpolator({range:[0,1],output:[r,r]})(1):r}function O3(r){for(const e in r)return!0;return!1}function Lp(r){return Oe.fun(r)||Oe.arr(r)&&Oe.obj(r[0])}function N3(r,e){var t;(t=r.ref)==null||t.delete(r),e==null||e.delete(r)}function F3(r,e){if(e&&r.ref!==e){var t;(t=r.ref)==null||t.delete(r),e.add(r),r.ref=e}}const k3={default:{tension:170,friction:26}},Dp=rn({},k3.default,{mass:1,damping:1,easing:l3.linear,clamp:!1});class z3{constructor(){this.tension=void 0,this.friction=void 0,this.frequency=void 0,this.damping=void 0,this.mass=void 0,this.velocity=0,this.restVelocity=void 0,this.precision=void 0,this.progress=void 0,this.duration=void 0,this.easing=void 0,this.clamp=void 0,this.bounce=void 0,this.decay=void 0,this.round=void 0,Object.assign(this,Dp)}}function B3(r,e,t){t&&(t=rn({},t),X_(t,e),e=rn({},t,e)),X_(r,e),Object.assign(r,e);for(const o in Dp)r[o]==null&&(r[o]=Dp[o]);let{mass:n,frequency:i,damping:s}=r;return Oe.und(i)||(i<.01&&(i=.01),s<0&&(s=0),r.tension=Math.pow(2*Math.PI/i,2)*n,r.friction=4*Math.PI*s*n/i),r}function X_(r,e){if(!Oe.und(e.decay))r.duration=void 0;else{const t=!Oe.und(e.tension)||!Oe.und(e.friction);(t||!Oe.und(e.frequency)||!Oe.und(e.damping)||!Oe.und(e.mass))&&(r.duration=void 0,r.decay=void 0),t&&(r.frequency=void 0)}}const q_=[];class G3{constructor(){this.changed=!1,this.values=q_,this.toValues=null,this.fromValues=q_,this.to=void 0,this.from=void 0,this.config=new z3,this.immediate=!1}}function lw(r,{key:e,props:t,defaultProps:n,state:i,actions:s}){return new Promise((o,a)=>{var c;let l,u,h=Ya((c=t.cancel)!=null?c:n==null?void 0:n.cancel,e);if(h)m();else{Oe.und(t.pause)||(i.paused=Ya(t.pause,e));let v=n==null?void 0:n.pause;v!==!0&&(v=i.paused||Ya(v,e)),l=rs(t.delay||0,e),v?(i.resumeQueue.add(d),s.pause()):(s.resume(),d())}function f(){i.resumeQueue.add(d),i.timeouts.delete(u),u.cancel(),l=u.time-Je.now()}function d(){l>0&&!Fi.skipAnimation?(i.delayed=!0,u=Je.setTimeout(m,l),i.pauseQueue.add(f),i.timeouts.add(u)):m()}function m(){i.delayed&&(i.delayed=!1),i.pauseQueue.delete(f),i.timeouts.delete(u),r<=(i.cancelId||0)&&(h=!0);try{s.start(rn({},t,{callId:r,cancel:h}),o)}catch(v){a(v)}}})}const lg=(r,e)=>e.length==1?e[0]:e.some(t=>t.cancelled)?Mo(r.get()):e.every(t=>t.noop)?uw(r.get()):vi(r.get(),e.every(t=>t.finished)),uw=r=>({value:r,noop:!0,finished:!0,cancelled:!1}),vi=(r,e,t=!1)=>({value:r,finished:e,cancelled:t}),Mo=r=>({value:r,cancelled:!0,finished:!1});function hw(r,e,t,n){const{callId:i,parentId:s,onRest:o}=e,{asyncTo:a,promise:c}=t;return!s&&r===a&&!e.reset?c:t.promise=(async()=>{t.asyncId=i,t.asyncTo=r;const l=cg(e,(g,p)=>p==="onRest"?void 0:g);let u,h;const f=new Promise((g,p)=>(u=g,h=p)),d=g=>{const p=i<=(t.cancelId||0)&&Mo(n)||i!==t.asyncId&&vi(n,!1);if(p)throw g.result=p,h(g),g},m=(g,p)=>{const _=new Y_,y=new j_;return(async()=>{if(Fi.skipAnimation)throw xc(t),y.result=vi(n,!1),h(y),y;d(_);const x=Oe.obj(g)?rn({},g):rn({},p,{to:g});x.parentId=i,or(l,(w,S)=>{Oe.und(x[S])&&(x[S]=w)});const b=await n.start(x);return d(_),t.paused&&await new Promise(w=>{t.resumeQueue.add(w)}),b})()};let v;if(Fi.skipAnimation)return xc(t),vi(n,!1);try{let g;Oe.arr(r)?g=(async p=>{for(const _ of p)await m(_)})(r):g=Promise.resolve(r(m,n.stop.bind(n))),await Promise.all([g.then(u),f]),v=vi(n.get(),!0,!1)}catch(g){if(g instanceof Y_)v=g.result;else if(g instanceof j_)v=g.result;else throw g}finally{i==t.asyncId&&(t.asyncId=s,t.asyncTo=s?a:void 0,t.promise=s?c:void 0)}return Oe.fun(o)&&Je.batchedUpdates(()=>{o(v,n,n.item)}),v})()}function xc(r,e){Xa(r.timeouts,t=>t.cancel()),r.pauseQueue.clear(),r.resumeQueue.clear(),r.asyncId=r.asyncTo=r.promise=void 0,e&&(r.cancelId=e)}class Y_ extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."),this.result=void 0}}class j_ extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const Ip=r=>r instanceof ug;let V3=1;class ug extends h3{constructor(...e){super(...e),this.id=V3++,this.key=void 0,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=Ri(this);return e&&e.getValue()}to(...e){return Fi.to(this,e)}interpolate(...e){return _3(),Fi.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){Au(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||vh.sort(this),Au(this,{type:"priority",parent:this,priority:e})}}const Ss=Symbol.for("SpringPhase"),fw=1,Up=2,Op=4,bd=r=>(r[Ss]&fw)>0,xr=r=>(r[Ss]&Up)>0,Ra=r=>(r[Ss]&Op)>0,$_=(r,e)=>e?r[Ss]|=Up|fw:r[Ss]&=~Up,Z_=(r,e)=>e?r[Ss]|=Op:r[Ss]&=~Op;class H3 extends ug{constructor(e,t){if(super(),this.key=void 0,this.animation=new G3,this.queue=void 0,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!Oe.und(e)||!Oe.und(t)){const n=Oe.obj(e)?rn({},e):rn({},t,{from:e});Oe.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(xr(this)||this._state.asyncTo)||Ra(this)}get goal(){return Jn(this.animation.to)}get velocity(){const e=Ri(this);return e instanceof Go?e.lastVelocity||0:e.getPayload().map(t=>t.lastVelocity||0)}get hasAnimated(){return bd(this)}get isAnimating(){return xr(this)}get isPaused(){return Ra(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1;const i=this.animation;let{config:s,toValues:o}=i;const a=bh(i.to);!a&&Pi(i.to)&&(o=ni(Jn(i.to))),i.values.forEach((u,h)=>{if(u.done)return;const f=u.constructor==Uo?1:a?a[h].lastPosition:o[h];let d=i.immediate,m=f;if(!d){if(m=u.lastPosition,s.tension<=0){u.done=!0;return}let v=u.elapsedTime+=e;const g=i.fromValues[h],p=u.v0!=null?u.v0:u.v0=Oe.arr(s.velocity)?s.velocity[h]:s.velocity;let _;const y=s.precision||(g==f?.005:Math.min(1,Math.abs(f-g)*.001));if(Oe.und(s.duration))if(s.decay){const x=s.decay===!0?.998:s.decay,b=Math.exp(-(1-x)*v);m=g+p/(1-x)*(1-b),d=Math.abs(u.lastPosition-m)<=y,_=p*b}else{_=u.lastVelocity==null?p:u.lastVelocity;const x=s.restVelocity||y/10,b=s.clamp?0:s.bounce,w=!Oe.und(b),S=g==f?u.v0>0:gx,!(!M&&(d=Math.abs(f-m)<=y,d)));++P){w&&(E=m==f||m>f==S,E&&(_=-_*b,m=f));const A=-s.tension*1e-6*(m-f),z=-s.friction*.001*_,V=(A+z)/s.mass;_=_+V*T,m=m+_*T}}else{let x=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,u.durationProgress>0&&(u.elapsedTime=s.duration*u.durationProgress,v=u.elapsedTime+=e)),x=(s.progress||0)+v/this._memoizedDuration,x=x>1?1:x<0?0:x,u.durationProgress=x),m=g+s.easing(x)*(f-g),_=(m-u.lastPosition)/e,d=x==1}u.lastVelocity=_,Number.isNaN(m)&&(console.warn("Got NaN while animating:",this),d=!0)}a&&!a[h].done&&(d=!1),d?u.done=!0:t=!1,u.setValue(m,s.round)&&(n=!0)});const c=Ri(this),l=c.getValue();if(t){const u=Jn(i.to);(l!==u||n)&&!s.decay?(c.setValue(u),this._onChange(u)):n&&s.decay&&this._onChange(l),this._stop()}else n&&this._onChange(l)}set(e){return Je.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(xr(this)){const{to:e,config:t}=this.animation;Je.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return Oe.und(e)?(n=this.queue||[],this.queue=[]):n=[Oe.obj(e)?e:rn({},t,{to:e})],Promise.all(n.map(i=>this._update(i))).then(i=>lg(this,i))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),xc(this._state,e&&this._lastCallId),Je.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){const t=this.key||"";let{to:n,from:i}=e;n=Oe.obj(n)?n[t]:n,(n==null||Lp(n))&&(n=void 0),i=Oe.obj(i)?i[t]:i,i==null&&(i=void 0);const s={to:n,from:i};return bd(this)||(e.reverse&&([n,i]=[i,n]),i=Jn(i),Oe.und(i)?Ri(this)||this._set(n):this._set(i)),s}_update(e,t){let n=rn({},e);const{key:i,defaultProps:s}=this;n.default&&Object.assign(s,cg(n,(c,l)=>/^on/.test(l)?ow(c,i):c)),J_(this,n,"onProps"),La(this,"onProps",n,this);const o=this._prepareNode(n);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const a=this._state;return lw(++this._lastCallId,{key:i,props:n,defaultProps:s,state:a,actions:{pause:()=>{Ra(this)||(Z_(this,!0),ka(a.pauseQueue),La(this,"onPause",vi(this,Pa(this,this.animation.to)),this))},resume:()=>{Ra(this)&&(Z_(this,!1),xr(this)&&this._resume(),ka(a.resumeQueue),La(this,"onResume",vi(this,Pa(this,this.animation.to)),this))},start:this._merge.bind(this,o)}}).then(c=>{if(n.loop&&c.finished&&!(t&&c.noop)){const l=dw(n);if(l)return this._update(l,!0)}return c})}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(Mo(this));const i=!Oe.und(e.to),s=!Oe.und(e.from);if(i||s)if(t.callId>this._lastToId)this._lastToId=t.callId;else return n(Mo(this));const{key:o,defaultProps:a,animation:c}=this,{to:l,from:u}=c;let{to:h=l,from:f=u}=e;s&&!i&&(!t.default||Oe.und(h))&&(h=f),t.reverse&&([h,f]=[f,h]);const d=!Ji(f,u);d&&(c.from=f),f=Jn(f);const m=!Ji(h,l);m&&this._focus(h);const v=Lp(t.to),{config:g}=c,{decay:p,velocity:_}=g;(i||s)&&(g.velocity=0),t.config&&!v&&B3(g,rs(t.config,o),t.config!==a.config?rs(a.config,o):void 0);let y=Ri(this);if(!y||Oe.und(h))return n(vi(this,!0));const x=Oe.und(t.reset)?s&&!t.default:!Oe.und(f)&&Ya(t.reset,o),b=x?f:this.get(),w=yc(h),S=Oe.num(w)||Oe.arr(w)||xh(w),M=!v&&(!S||Ya(a.immediate||t.immediate,o));if(m){const P=Pp(h);if(P!==y.constructor)if(M)y=this._set(w);else throw Error(`Cannot animate between ${y.constructor.name} and ${P.name}, as the "to" prop suggests`)}const E=y.constructor;let T=Pi(h),L=!1;if(!T){const P=x||!bd(this)&&d;(m||P)&&(L=Ji(yc(b),w),T=!L),(!Ji(c.immediate,M)&&!M||!Ji(g.decay,p)||!Ji(g.velocity,_))&&(T=!0)}if(L&&xr(this)&&(c.changed&&!x?T=!0:T||this._stop(l)),!v&&((T||Pi(l))&&(c.values=y.getPayload(),c.toValues=Pi(h)?null:E==Uo?[1]:ni(w)),c.immediate!=M&&(c.immediate=M,!M&&!x&&this._set(l)),T)){const{onRest:P}=c;_t(X3,z=>J_(this,t,z));const A=vi(this,Pa(this,l));ka(this._pendingCalls,A),this._pendingCalls.add(n),c.changed&&Je.batchedUpdates(()=>{c.changed=!x,P==null||P(A,this),x?rs(a.onRest,A):c.onStart==null||c.onStart(A,this)})}x&&this._set(b),v?n(hw(t.to,t,this._state,this)):T?this._start():xr(this)&&!m?this._pendingCalls.add(n):n(uw(b))}_focus(e){const t=this.animation;e!==t.to&&(z_(this)&&this._detach(),t.to=e,z_(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;Pi(t)&&(Bc(t,this),Ip(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;Pi(e)&&Cu(e,this)}_set(e,t=!0){const n=Jn(e);if(!Oe.und(n)){const i=Ri(this);if(!i||!Ji(n,i.getValue())){const s=Pp(n);!i||i.constructor!=s?sg(this,s.create(n)):i.setValue(n),i&&Je.batchedUpdates(()=>{this._onChange(n,t)})}}return Ri(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,La(this,"onStart",vi(this,Pa(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),rs(this.animation.onChange,e,this)),rs(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;Ri(this).reset(Jn(e.to)),e.immediate||(e.fromValues=e.values.map(t=>t.lastPosition)),xr(this)||($_(this,!0),Ra(this)||this._resume())}_resume(){Fi.skipAnimation?this.finish():vh.start(this)}_stop(e,t){if(xr(this)){$_(this,!1);const n=this.animation;_t(n.values,s=>{s.done=!0}),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Au(this,{type:"idle",parent:this});const i=t?Mo(this.get()):vi(this.get(),Pa(this,e??n.to));ka(this._pendingCalls,i),n.changed&&(n.changed=!1,La(this,"onRest",i,this))}}}function Pa(r,e){const t=yc(e),n=yc(r.get());return Ji(n,t)}function dw(r,e=r.loop,t=r.to){let n=rs(e);if(n){const i=n!==!0&&cw(n),s=(i||r).reverse,o=!i||i.reset;return bc(rn({},r,{loop:e,default:!1,pause:void 0,to:!s||Lp(t)?t:void 0,from:o?r.from:void 0,reset:o},i))}}function bc(r){const{to:e,from:t}=r=cw(r),n=new Set;return Oe.obj(e)&&K_(e,n),Oe.obj(t)&&K_(t,n),r.keys=n.size?Array.from(n):null,r}function W3(r){const e=bc(r);return Oe.und(e.default)&&(e.default=cg(e)),e}function K_(r,e){or(r,(t,n)=>t!=null&&e.add(n))}const X3=["onStart","onRest","onChange","onPause","onResume"];function J_(r,e,t){r.animation[t]=e[t]!==aw(e,t)?ow(e[t],r.key):void 0}function La(r,e,...t){var n,i,s,o;(n=(i=r.animation)[e])==null||n.call(i,...t),(s=(o=r.defaultProps)[e])==null||s.call(o,...t)}const q3=["onStart","onChange","onRest"];let Y3=1;class j3{constructor(e,t){this.id=Y3++,this.springs={},this.queue=[],this.ref=void 0,this._flush=void 0,this._initialProps=void 0,this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._item=void 0,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start(rn({default:!0},e))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each((t,n)=>e[n]=t.get()),e}set(e){for(const t in e){const n=e[t];Oe.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(bc(e)),this}start(e){let{queue:t}=this;return e?t=ni(e).map(bc):this.queue=[],this._flush?this._flush(this,t):(_w(this,t),Np(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;_t(ni(t),i=>n[i].stop(!!e))}else xc(this._state,this._lastAsyncId),this.each(n=>n.stop(!!e));return this}pause(e){if(Oe.und(e))this.start({pause:!0});else{const t=this.springs;_t(ni(e),n=>t[n].pause())}return this}resume(e){if(Oe.und(e))this.start({pause:!1});else{const t=this.springs;_t(ni(e),n=>t[n].resume())}return this}each(e){or(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:n}=this._events,i=this._active.size>0,s=this._changed.size>0;(i&&!this._started||s&&!this._started)&&(this._started=!0,Xa(e,([c,l])=>{l.value=this.get(),c(l,this,this._item)}));const o=!i&&this._started,a=s||o&&n.size?this.get():null;s&&t.size&&Xa(t,([c,l])=>{l.value=a,c(l,this,this._item)}),o&&(this._started=!1,Xa(n,([c,l])=>{l.value=a,c(l,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;Je.onFrame(this._onFrame)}}function Np(r,e){return Promise.all(e.map(t=>pw(r,t))).then(t=>lg(r,t))}async function pw(r,e,t){const{keys:n,to:i,from:s,loop:o,onRest:a,onResolve:c}=e,l=Oe.obj(e.default)&&e.default;o&&(e.loop=!1),i===!1&&(e.to=null),s===!1&&(e.from=null);const u=Oe.arr(i)||Oe.fun(i)?i:void 0;u?(e.to=void 0,e.onRest=void 0,l&&(l.onRest=void 0)):_t(q3,v=>{const g=e[v];if(Oe.fun(g)){const p=r._events[v];e[v]=({finished:_,cancelled:y})=>{const x=p.get(g);x?(_||(x.finished=!1),y&&(x.cancelled=!0)):p.set(g,{value:null,finished:_||!1,cancelled:y||!1})},l&&(l[v]=e[v])}});const h=r._state;e.pause===!h.paused?(h.paused=e.pause,ka(e.pause?h.pauseQueue:h.resumeQueue)):h.paused&&(e.pause=!0);const f=(n||Object.keys(r.springs)).map(v=>r.springs[v].start(e)),d=e.cancel===!0||aw(e,"cancel")===!0;(u||d&&h.asyncId)&&f.push(lw(++r._lastAsyncId,{props:e,state:h,actions:{pause:Ap,resume:Ap,start(v,g){d?(xc(h,r._lastAsyncId),g(Mo(r))):(v.onRest=a,g(hw(u,v,h,r)))}}})),h.paused&&await new Promise(v=>{h.resumeQueue.add(v)});const m=lg(r,await Promise.all(f));if(o&&m.finished&&!(t&&m.noop)){const v=dw(e,o,i);if(v)return _w(r,[v]),pw(r,v,!0)}return c&&Je.batchedUpdates(()=>c(m,r,r.item)),m}function Q_(r,e){const t=rn({},r.springs);return e&&_t(ni(e),n=>{Oe.und(n.keys)&&(n=bc(n)),Oe.obj(n.to)||(n=rn({},n,{to:void 0})),vw(t,n,i=>gw(i))}),mw(r,t),t}function mw(r,e){or(e,(t,n)=>{r.springs[n]||(r.springs[n]=t,Bc(t,r))})}function gw(r,e){const t=new H3;return t.key=r,e&&Bc(t,e),t}function vw(r,e,t){e.keys&&_t(e.keys,n=>{(r[n]||(r[n]=t(n)))._prepareNode(e)})}function _w(r,e){_t(e,t=>{vw(r.springs,t,n=>gw(n,r))})}function $3(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s=0)&&(t[i]=r[i]);return t}const Z3=["children"],wh=r=>{let{children:e}=r,t=$3(r,Z3);const n=q.useContext(Lu),i=t.pause||!!n.pause,s=t.immediate||!!n.immediate;t=w3(()=>({pause:i,immediate:s}),[i,s]);const{Provider:o}=Lu;return q.createElement(o,{value:t},e)},Lu=K3(wh,{});wh.Provider=Lu.Provider;wh.Consumer=Lu.Consumer;function K3(r,e){return Object.assign(r,q.createContext(e)),r.Provider._context=r,r.Consumer._context=r,r}const J3=()=>{const r=[],e=function(i){x3();const s=[];return _t(r,(o,a)=>{if(Oe.und(i))s.push(o.start());else{const c=t(i,o,a);c&&s.push(o.start(c))}}),s};e.current=r,e.add=function(n){r.includes(n)||r.push(n)},e.delete=function(n){const i=r.indexOf(n);~i&&r.splice(i,1)},e.pause=function(){return _t(r,n=>n.pause(...arguments)),this},e.resume=function(){return _t(r,n=>n.resume(...arguments)),this},e.set=function(n){_t(r,i=>i.set(n))},e.start=function(n){const i=[];return _t(r,(s,o)=>{if(Oe.und(n))i.push(s.start());else{const a=this._getProps(n,s,o);a&&i.push(s.start(a))}}),i},e.stop=function(){return _t(r,n=>n.stop(...arguments)),this},e.update=function(n){return _t(r,(i,s)=>i.update(this._getProps(n,i,s))),this};const t=function(i,s,o){return Oe.fun(i)?i(o,s):i};return e._getProps=t,e};function Q3(r,e,t){const n=Oe.fun(e)&&e;n&&!t&&(t=[]);const i=q.useMemo(()=>n||arguments.length==3?J3():void 0,[]),s=q.useRef(0),o=iw(),a=q.useMemo(()=>({ctrls:[],queue:[],flush(p,_){const y=Q_(p,_);return s.current>0&&!a.queue.length&&!Object.keys(y).some(b=>!p.springs[b])?Np(p,_):new Promise(b=>{mw(p,y),a.queue.push(()=>{b(Np(p,_))}),o()})}}),[]),c=q.useRef([...a.ctrls]),l=[],u=G_(r)||0;q.useMemo(()=>{_t(c.current.slice(r,u),p=>{N3(p,i),p.stop(!0)}),c.current.length=r,h(u,r)},[r]),q.useMemo(()=>{h(0,Math.min(u,r))},t);function h(p,_){for(let y=p;y<_;y++){const x=c.current[y]||(c.current[y]=new j3(null,a.flush)),b=n?n(y,x):e[y];b&&(l[y]=W3(b))}}const f=c.current.map((p,_)=>Q_(p,l[_])),d=q.useContext(wh),m=G_(d),v=d!==m&&O3(d);rg(()=>{s.current++,a.ctrls=c.current;const{queue:p}=a;p.length&&(a.queue=[],_t(p,_=>_())),_t(c.current,(_,y)=>{i==null||i.add(_),v&&_.start({default:d});const x=l[y];x&&(F3(_,x.ref),_.ref?_.queue.push(x):_.start(x))})}),rw(()=>()=>{_t(a.ctrls,p=>p.stop(!0))});const g=f.map(p=>rn({},p));return i?[g,i]:g}function Gn(r,e){const t=Oe.fun(r),[[n],i]=Q3(1,t?r:[r],t?e||[]:e);return t||arguments.length==2?[n,i]:n}let ey;(function(r){r.MOUNT="mount",r.ENTER="enter",r.UPDATE="update",r.LEAVE="leave"})(ey||(ey={}));class eN extends ug{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=vc(...t);const n=this._get(),i=Pp(n);sg(this,i.create(n))}advance(e){const t=this._get(),n=this.get();Ji(t,n)||(Ri(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&ty(this._active)&&wd(this)}_get(){const e=Oe.arr(this.source)?this.source.map(Jn):ni(Jn(this.source));return this.calc(...e)}_start(){this.idle&&!ty(this._active)&&(this.idle=!1,_t(bh(this),e=>{e.done=!1}),Fi.skipAnimation?(Je.batchedUpdates(()=>this.advance()),wd(this)):vh.start(this))}_attach(){let e=1;_t(ni(this.source),t=>{Pi(t)&&Bc(t,this),Ip(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){_t(ni(this.source),e=>{Pi(e)&&Cu(e,this)}),this._active.clear(),wd(this)}eventObserved(e){e.type=="change"?e.idle?this.advance():(this._active.add(e.parent),this._start()):e.type=="idle"?this._active.delete(e.parent):e.type=="priority"&&(this.priority=ni(this.source).reduce((t,n)=>Math.max(t,(Ip(n)?n.priority:0)+1),0))}}function tN(r){return r.idle!==!1}function ty(r){return!r.size||Array.from(r).every(tN)}function wd(r){r.idle||(r.idle=!0,_t(bh(r),e=>{e.done=!0}),Au(r,{type:"idle",parent:r}))}Fi.assign({createStringInterpolator:tw,to:(r,e)=>new eN(r,e)});const nN=["primitive"].concat(Object.keys($b).filter(r=>/^[A-Z]/.test(r)).map(r=>r[0].toLowerCase()+r.slice(1)));Fi.assign({createStringInterpolator:tw,colors:KO,frameLoop:"demand"});FL(()=>{Je.advance()});const iN=P3(nN,{applyAnimatedValues:ts}),Gt=iN.animated,yw=q.forwardRef(function({children:e,follow:t=!0,lockX:n=!1,lockY:i=!1,lockZ:s=!1,...o},a){const c=q.useRef(null),l=q.useRef(null),u=new ln;return uh(({camera:h})=>{if(!t||!l.current)return;const f=l.current.rotation.clone();l.current.updateMatrix(),l.current.updateWorldMatrix(!1,!1),l.current.getWorldQuaternion(u),h.getWorldQuaternion(c.current.quaternion).premultiply(u.invert()),n&&(l.current.rotation.x=f.x),i&&(l.current.rotation.y=f.y),s&&(l.current.rotation.z=f.z)}),q.useImperativeHandle(a,()=>l.current,[]),q.createElement("group",Tc({ref:l,matrixAutoUpdate:!1,matrixWorldAutoUpdate:!1},o),q.createElement("group",{ref:c},e))});function rN(){var r=Object.create(null);function e(i,s){var o=i.id,a=i.name,c=i.dependencies;c===void 0&&(c=[]);var l=i.init;l===void 0&&(l=function(){});var u=i.getTransferables;if(u===void 0&&(u=null),!r[o])try{c=c.map(function(f){return f&&f.isWorkerModule&&(e(f,function(d){if(d instanceof Error)throw d}),f=r[f.id].value),f}),l=n("<"+a+">.init",l),u&&(u=n("<"+a+">.getTransferables",u));var h=null;typeof l=="function"?h=l.apply(void 0,c):console.error("worker module init function failed to rehydrate"),r[o]={id:o,value:h,getTransferables:u},s(h)}catch(f){f&&f.noLog||console.error(f),s(f)}}function t(i,s){var o,a=i.id,c=i.args;(!r[a]||typeof r[a].value!="function")&&s(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var l=(o=r[a]).value.apply(o,c);l&&typeof l.then=="function"?l.then(u,function(h){return s(h instanceof Error?h:new Error(""+h))}):u(l)}catch(h){s(h)}function u(h){try{var f=r[a].getTransferables&&r[a].getTransferables(h);(!f||!Array.isArray(f)||!f.length)&&(f=void 0),s(h,f)}catch(d){console.error(d),s(d)}}}function n(i,s){var o=void 0;self.troikaDefine=function(c){return o=c};var a=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/ - -troikaDefine( -`+s+` -)`],{type:"application/javascript"}));try{importScripts(a)}catch(c){console.error(c)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(i){var s=i.data,o=s.messageId,a=s.action,c=s.data;try{a==="registerModule"&&e(c,function(l){l instanceof Error?postMessage({messageId:o,success:!1,error:l.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof l=="function"}})}),a==="callModule"&&t(c,function(l,u){l instanceof Error?postMessage({messageId:o,success:!1,error:l.message}):postMessage({messageId:o,success:!0,result:l},u||void 0)})}catch(l){postMessage({messageId:o,success:!1,error:l.stack})}})}function sN(r){var e=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=r.dependencies,n=r.init;t=Array.isArray(t)?t.map(function(s){return s&&s._getInitResult?s._getInitResult():s}):[];var i=Promise.all(t).then(function(s){return n.apply(null,s)});return e._getInitResult=function(){return i},i},e}var xw=function(){var r=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),r=!0}catch(t){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return xw=function(){return r},r},oN=0,aN=0,Sd=!1,ja=Object.create(null),$a=Object.create(null),Fp=Object.create(null);function Gc(r){if((!r||typeof r.init!="function")&&!Sd)throw new Error("requires `options.init` function");var e=r.dependencies,t=r.init,n=r.getTransferables,i=r.workerId;if(!xw())return sN(r);i==null&&(i="#default");var s="workerModule"+ ++oN,o=r.name||s,a=null;e=e&&e.map(function(l){return typeof l=="function"&&!l.workerModuleData&&(Sd=!0,l=Gc({workerId:i,name:"<"+o+"> function dependency: "+l.name,init:`function(){return ( -`+pu(l)+` -)}`}),Sd=!1),l&&l.workerModuleData&&(l=l.workerModuleData),l});function c(){for(var l=[],u=arguments.length;u--;)l[u]=arguments[u];if(!a){a=ny(i,"registerModule",c.workerModuleData);var h=function(){a=null,$a[i].delete(h)};($a[i]||($a[i]=new Set)).add(h)}return a.then(function(f){var d=f.isCallable;if(d)return ny(i,"callModule",{id:s,args:l});throw new Error("Worker module function was called but `init` did not return a callable function")})}return c.workerModuleData={isWorkerModule:!0,id:s,name:o,dependencies:e,init:pu(t),getTransferables:n&&pu(n)},c}function cN(r){$a[r]&&$a[r].forEach(function(e){e()}),ja[r]&&(ja[r].terminate(),delete ja[r])}function pu(r){var e=r.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function lN(r){var e=ja[r];if(!e){var t=pu(rN);e=ja[r]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+r.replace(/\*/g,"")+` **/ - -;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(n){var i=n.data,s=i.messageId,o=Fp[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete Fp[s],o(i)}}return e}function ny(r,e,t){return new Promise(function(n,i){var s=++aN;Fp[s]=function(o){o.success?n(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},lN(r).postMessage({messageId:s,action:e,data:t})})}const bw=/\bvoid\s+main\s*\(\s*\)\s*{/g;function kp(r){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function t(n,i){let s=Qe[i];return s?kp(s):n}return r.replace(e,t)}const an=[];for(let r=0;r<256;r++)an[r]=(r<16?"0":"")+r.toString(16);function uN(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(an[r&255]+an[r>>8&255]+an[r>>16&255]+an[r>>24&255]+"-"+an[e&255]+an[e>>8&255]+"-"+an[e>>16&15|64]+an[e>>24&255]+"-"+an[t&63|128]+an[t>>8&255]+"-"+an[t>>16&255]+an[t>>24&255]+an[n&255]+an[n>>8&255]+an[n>>16&255]+an[n>>24&255]).toUpperCase()}const Qr=Object.assign||function(){let r=arguments[0];for(let e=1,t=arguments.length;e/gm,` -//!BEGIN_POST_CHUNK $1 -$& -//!END_POST_CHUNK -`),t=kp(t)),d){let v=d({vertexShader:e,fragmentShader:t});e=v.vertexShader,t=v.fragmentShader}if(f){let v=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,g=>(v.push(g),"")),h=`${f} -${v.join(` -`)} -${h}`}if(m){const v=` -uniform float ${m}; -`;s=v+s,l=v+l}return c&&(e=`vec3 troika_position_${i}; -vec3 troika_normal_${i}; -vec2 troika_uv_${i}; -${e} -`,s=`${s} -void troikaVertexTransform${i}(inout vec3 position, inout vec3 normal, inout vec2 uv) { - ${c} -} -`,o=` -troika_position_${i} = vec3(position); -troika_normal_${i} = vec3(normal); -troika_uv_${i} = vec2(uv); -troikaVertexTransform${i}(troika_position_${i}, troika_normal_${i}, troika_uv_${i}); -${o} -`,e=e.replace(/\b(position|normal|uv)\b/g,(v,g,p,_)=>/\battribute\s+vec[23]\s+$/.test(_.substr(0,p))?g:`troika_${g}_${i}`),r.map&&r.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=sy(e,i,s,o,a),t=sy(t,i,l,u,h),{vertexShader:e,fragmentShader:t}}function sy(r,e,t,n,i){return(n||i||t)&&(r=r.replace(bw,` -${t} -void troikaOrigMain${e}() {`),r+=` -void main() { - ${n} - troikaOrigMain${e}(); - ${i} -}`),r}function pN(r,e){return r==="uniforms"?void 0:typeof e=="function"?e.toString():e}let mN=0;const oy=new Map;function gN(r){const e=JSON.stringify(r,pN);let t=oy.get(e);return t==null&&oy.set(e,t=++mN),t}function vN(r,e,t){const{defaultFontURL:n}=t,i=Object.create(null),s=1/0,o=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,a="[^\\S\\u00A0]",c=new RegExp(`${a}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function l(_,y){function x(){const b=w=>{console.error(`Failure loading font ${_}${_===n?"":"; trying fallback"}`,w),_!==n&&(_=n,x())};try{const w=new XMLHttpRequest;w.open("get",_,!0),w.responseType="arraybuffer",w.onload=function(){if(w.status>=400)b(new Error(w.statusText));else if(w.status>0)try{const S=r(w.response);y(S)}catch(S){b(S)}},w.onerror=b,w.send()}catch(w){b(w)}}x()}function u(_,y){_||(_=n);let x=i[_];x?x.pending?x.pending.push(y):y(x):(i[_]={pending:[y]},l(_,b=>{let w=i[_].pending;i[_]=b,w.forEach(S=>S(b))}))}function h({text:_="",font:y=n,sdfGlyphSize:x=64,fontSize:b=1,letterSpacing:w=0,lineHeight:S="normal",maxWidth:M=s,direction:E,textAlign:T="left",textIndent:L=0,whiteSpace:P="normal",overflowWrap:A="normal",anchorX:z=0,anchorY:V=0,includeCaretPositions:N=!1,chunkedBoundsSize:C=8192,colorRanges:O=null},k,U=!1){const R=v(),F={fontLoad:0,typesetting:0};_.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),_=_.replace(/\r\n/g,` -`).replace(/\r/g,` -`)),b=+b,w=+w,M=+M,S=S||"normal",L=+L,u(y,H=>{const Y=isFinite(M);let J=null,ie=null,ne=null,ee=null,ge=null,me=null,te=null,D=0,Q=0,j=P!=="nowrap";const{ascender:K,descender:W,unitsPerEm:ye,lineGap:re,capHeight:fe,xHeight:xe}=H;F.fontLoad=v()-R;const ce=v(),Pe=b/ye;S==="normal"&&(S=(K-W+re)/ye),S=S*b;const B=(S-(K-W)*Pe)/2,I=-(K*Pe+B),$=Math.min(S,(K-W)*Pe),he=(K+W)/2*Pe-$/2;let de=L,pe=new g;const Me=[pe];H.forEachGlyph(_,b,w,(Ce,ze,Le)=>{const Ee=_.charAt(Le),De=Ce.advanceWidth*Pe,Ve=pe.count;let je;if("isEmpty"in Ce||(Ce.isWhitespace=!!Ee&&new RegExp(a).test(Ee),Ce.canBreakAfter=!!Ee&&c.test(Ee),Ce.isEmpty=Ce.xMin===Ce.xMax||Ce.yMin===Ce.yMax||o.test(Ee)),!Ce.isWhitespace&&!Ce.isEmpty&&Q++,j&&Y&&!Ce.isWhitespace&&ze+De+de>M&&Ve){if(pe.glyphAt(Ve-1).glyphObj.canBreakAfter)je=new g,de=-ze;else for(let Ae=Ve;Ae--;)if(Ae===0&&A==="break-word"){je=new g,de=-ze;break}else if(pe.glyphAt(Ae).glyphObj.canBreakAfter){je=pe.splitAt(Ae+1);const le=je.glyphAt(0).x;de-=le;for(let Re=je.count;Re--;)je.glyphAt(Re).x-=le;break}je&&(pe.isSoftWrapped=!0,pe=je,Me.push(pe),D=M)}let Z=pe.glyphAt(pe.count);Z.glyphObj=Ce,Z.x=ze+de,Z.width=De,Z.charIndex=Le,Ee===` -`&&(pe=new g,Me.push(pe),de=-(ze+De+w*b)+L)}),Me.forEach(Ce=>{for(let ze=Ce.count;ze--;){let{glyphObj:Le,x:Ee,width:De}=Ce.glyphAt(ze);if(!Le.isWhitespace){Ce.width=Ee+De,Ce.width>D&&(D=Ce.width);return}}});let we=0,ue=0;if(z&&(typeof z=="number"?we=-z:typeof z=="string"&&(we=-D*(z==="left"?0:z==="center"?.5:z==="right"?1:d(z)))),V){if(typeof V=="number")ue=-V;else if(typeof V=="string"){let Ce=Me.length*S;ue=V==="top"?0:V==="top-baseline"?-I:V==="top-cap"?-I-fe*Pe:V==="top-ex"?-I-xe*Pe:V==="middle"?Ce/2:V==="bottom"?Ce:V==="bottom-baseline"?Ce-B+W*Pe:d(V)*Ce}}if(!U){const Ce=e.getEmbeddingLevels(_,E);J=new Uint16Array(Q),ie=new Float32Array(Q*2),ne={},me=[s,s,-s,-s],te=[];let ze=I;N&&(ge=new Float32Array(_.length*3)),O&&(ee=new Uint8Array(Q*3));let Le=0,Ee=-1,De=-1,Ve,je;if(Me.forEach((Z,Ae)=>{let{count:le,width:Re}=Z;if(le>0){let Fe=0;for(let dt=le;dt--&&Z.glyphAt(dt).glyphObj.isWhitespace;)Fe++;let tt=0,lt=0;if(T==="center")tt=(D-Re)/2;else if(T==="right")tt=D-Re;else if(T==="justify"&&Z.isSoftWrapped){let dt=0;for(let ct=le-Fe;ct--;)Z.glyphAt(ct).glyphObj.isWhitespace&&dt++;lt=(D-Re)/dt}if(lt||tt){let dt=0;for(let ct=0;ct=ct){let yn=kt,Vt=kt;for(;VtMn)break;Vtut=dt;for(let dt=0;dt1&&m(ge,Ee,Vt),Ee=yt}if(O){const{charIndex:yt}=ct;for(;yt>De;)De++,O.hasOwnProperty(De)&&(je=O[De])}if(!ut.isWhitespace&&!ut.isEmpty){const yt=Le++;ne[Mn]||(ne[Mn]={path:ut.path,pathBounds:[ut.xMin,ut.yMin,ut.xMax,ut.yMax]});const kt=ct.x+we,yn=ze+ue;ie[yt*2]=kt,ie[yt*2+1]=yn;const Vt=kt+ut.xMin*Pe,Ht=yn+ut.yMin*Pe,sn=kt+ut.xMax*Pe,Ei=yn+ut.yMax*Pe;Vtme[2]&&(me[2]=sn),Ei>me[3]&&(me[3]=Ei),yt%C===0&&(Ve={start:yt,end:yt,rect:[s,s,-s,-s]},te.push(Ve)),Ve.end++;const Un=Ve.rect;if(VtUn[2]&&(Un[2]=sn),Ei>Un[3]&&(Un[3]=Ei),J[yt]=Mn,O){const X=yt*3;ee[X]=je>>16&255,ee[X+1]=je>>8&255,ee[X+2]=je&255}}}}ze-=S}),ge){const Z=_.length-Ee;Z>1&&m(ge,Ee,Z)}}F.typesetting=v()-ce,k({glyphIds:J,glyphPositions:ie,glyphData:ne,caretPositions:ge,caretHeight:$,glyphColors:ee,chunkedBounds:te,fontSize:b,unitsPerEm:ye,ascender:K*Pe,descender:W*Pe,capHeight:fe*Pe,xHeight:xe*Pe,lineHeight:S,topBaseline:I,blockBounds:[we,ue-Me.length*S,we+D,ue],visibleBounds:me,timings:F})})}function f(_,y){h(_,x=>{const[b,w,S,M]=x.blockBounds;y({width:S-b,height:M-w})},{})}function d(_){let y=_.match(/^([\d.]+)%$/),x=y?parseFloat(y[1]):NaN;return isNaN(x)?0:x/100}function m(_,y,x){const b=_[y*3],w=_[y*3+1],S=_[y*3+2],M=(w-b)/x;for(let E=0;E(Object.defineProperty(_,y,{get(){return this.data[this.index*p.length+x]},set(w){this.data[this.index*p.length+x]=w}}),_),{data:null,index:0}),{typeset:h,measure:f,loadFont:u}}const ps=()=>(self.performance||Date).now(),Sh=Hy();let ay;function _N(r,e,t,n,i,s,o,a,c,l,u=!0){return u?xN(r,e,t,n,i,s,o,a,c,l).then(null,h=>(ay||(console.warn("WebGL SDF generation failed, falling back to JS",h),ay=!0),ly(r,e,t,n,i,s,o,a,c,l))):ly(r,e,t,n,i,s,o,a,c,l)}const mu=[],yN=5;let Bp=0;function ww(){const r=ps();for(;mu.length&&ps()-rnew Promise((e,t)=>{mu.push(()=>{const n=ps();try{Sh.webgl.generateIntoCanvas(...r),e({timing:ps()-n})}catch(i){t(i)}}),Bp||(Bp=setTimeout(ww,0))}),bN=4,wN=2e3,cy={};let SN=0;function ly(r,e,t,n,i,s,o,a,c,l){const u="TroikaTextSDFGenerator_JS_"+SN++%bN;let h=cy[u];return h||(h=cy[u]={workerModule:Gc({name:u,workerId:u,dependencies:[Hy,ps],init(f,d){const m=f().javascript.generate;return function(...v){const g=d();return{textureData:m(...v),timing:d()-g}}},getTransferables(f){return[f.textureData.buffer]}}),requests:0,idleTimer:null}),h.requests++,clearTimeout(h.idleTimer),h.workerModule(r,e,t,n,i,s).then(({textureData:f,timing:d})=>{const m=ps(),v=new Uint8Array(f.length*4);for(let g=0;g{cN(u)},wN)),{timing:d}})}function EN(r){r._warm||(Sh.webgl.isSupported(r),r._warm=!0)}const MN=Sh.webglUtils.resizeWebGLCanvasWithoutClearing;/*! -Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering. -Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE -*/function TN(){return typeof window>"u"&&(self.window=self),(function(r){var e={parse:function(i){var s=e._bin,o=new Uint8Array(i);if(s.readASCII(o,0,4)=="ttcf"){var a=4;s.readUshort(o,a),a+=2,s.readUshort(o,a),a+=2;var c=s.readUint(o,a);a+=4;for(var l=[],u=0;u>>o&1)!=0&&s++;return s},e._lctf.readClassDef=function(i,s){var o=e._bin,a=[],c=o.readUshort(i,s);if(s+=2,c==1){var l=o.readUshort(i,s);s+=2;var u=o.readUshort(i,s);s+=2;for(var h=0;h0&&(c.featureParams=a+l);var u=o.readUshort(i,s);s+=2,c.tab=[];for(var h=0;h255?-1:e.CFF.glyphByUnicode(i,e.CFF.tableSE[s])},e.CFF.readEncoding=function(i,s,o){e._bin;var a=[".notdef"],c=i[s];if(s++,c!=0)throw"error: unknown encoding format: "+c;var l=i[s];s++;for(var u=0;u>4,_=15&g;if(p!=15&&v.push(p),_!=15&&v.push(_),_==15)break}for(var y="",x=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],b=0;b=l.xMax||l.yMin>=l.yMax)return null;if(l.noc>0){l.endPts=[];for(var u=0;u=1&&u.fmt<=2){f=c.readUshort(i,o),o+=2;var m=c.readUshort(i,o);o+=2,d=e._lctf.numOfOnes(f);var v=e._lctf.numOfOnes(m);if(u.fmt==1){u.pairsets=[];var g=c.readUshort(i,o);o+=2;for(var p=0;p=1&&u.fmt<=2){if(u.fmt==1)u.delta=c.readShort(i,o),o+=2;else if(u.fmt==2){var f=c.readUshort(i,o);o+=2,u.newg=c.readUshorts(i,o,f),o+=2*u.newg.length}}else if(s==4){u.vals=[],f=c.readUshort(i,o),o+=2;for(var d=0;d>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;s=e.kern.readFormat0(i,s,h)}return h},e.kern.parseV1=function(i,s,o,a){var c=e._bin;c.readFixed(i,s),s+=4;var l=c.readUint(i,s);s+=4;for(var u={glyph1:[],rval:[]},h=0;h>>8;if((d&=15)!=0)throw"unknown kern table format: "+d;s=e.kern.readFormat0(i,s,u)}return u},e.kern.readFormat0=function(i,s,o){var a=e._bin,c=-1,l=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2;for(var u=0;u=c.map.length?0:c.map[s];if(c.format==4){for(var l=-1,u=0;us?0:65535&(c.idRangeOffset[l]!=0?c.glyphIdArray[s-c.startCount[l]+(c.idRangeOffset[l]>>1)-(c.idRangeOffset.length-l)]:s+c.idDelta[l])}if(c.format==12){if(s>c.groups[c.groups.length-1][1])return 0;for(u=0;u-1?e.U._simpleGlyph(a,o):e.U._compoGlyph(a,s,o))},e.U._simpleGlyph=function(i,s){for(var o=0;oc)){for(var g=!0,p=0,_=0;_c)){for(g=!0,_=0;_>1,l.length=0,h=!0;else if(P=="o3"||P=="o23")l.length%2!=0&&!h&&(f=l.shift()+a.nominalWidthX),u+=l.length>>1,l.length=0,h=!0;else if(P=="o4")l.length>1&&!h&&(f=l.shift()+a.nominalWidthX,h=!0),d&&e.U.P.closePath(c),g+=l.pop(),e.U.P.moveTo(c,v,g),d=!0;else if(P=="o5")for(;l.length>0;)v+=l.shift(),g+=l.shift(),e.U.P.lineTo(c,v,g);else if(P=="o6"||P=="o7")for(var A=l.length,z=P=="o6",V=0;VMath.abs(M-g)?v=S+l.shift():g=M+l.shift(),e.U.P.curveTo(c,p,_,y,x,E,T),e.U.P.curveTo(c,b,w,S,M,v,g));else if(P=="o14"){if(l.length>0&&!h&&(f=l.shift()+o.nominalWidthX,h=!0),l.length==4){var O=l.shift(),k=l.shift(),U=l.shift(),R=l.shift(),F=e.CFF.glyphBySE(o,U),H=e.CFF.glyphBySE(o,R);e.U._drawCFF(o.CharStrings[F],s,o,a,c),s.x=O,s.y=k,e.U._drawCFF(o.CharStrings[H],s,o,a,c)}d&&(e.U.P.closePath(c),d=!1)}else if(P=="o19"||P=="o20")l.length%2!=0&&!h&&(f=l.shift()+a.nominalWidthX),u+=l.length>>1,l.length=0,h=!0,m+=u+7>>3;else if(P=="o21")l.length>2&&!h&&(f=l.shift()+a.nominalWidthX,h=!0),g+=l.pop(),v+=l.pop(),d&&e.U.P.closePath(c),e.U.P.moveTo(c,v,g),d=!0;else if(P=="o22")l.length>1&&!h&&(f=l.shift()+a.nominalWidthX,h=!0),v+=l.pop(),d&&e.U.P.closePath(c),e.U.P.moveTo(c,v,g),d=!0;else if(P=="o25"){for(;l.length>6;)v+=l.shift(),g+=l.shift(),e.U.P.lineTo(c,v,g);p=v+l.shift(),_=g+l.shift(),y=p+l.shift(),x=_+l.shift(),v=y+l.shift(),g=x+l.shift(),e.U.P.curveTo(c,p,_,y,x,v,g)}else if(P=="o26")for(l.length%2&&(v+=l.shift());l.length>0;)p=v,_=g+l.shift(),v=y=p+l.shift(),g=(x=_+l.shift())+l.shift(),e.U.P.curveTo(c,p,_,y,x,v,g);else if(P=="o27")for(l.length%2&&(g+=l.shift());l.length>0;)_=g,y=(p=v+l.shift())+l.shift(),x=_+l.shift(),v=y+l.shift(),g=x,e.U.P.curveTo(c,p,_,y,x,v,g);else if(P=="o10"||P=="o29"){var Y=P=="o10"?a:o;if(l.length==0)console.debug("error: empty stack");else{var J=l.pop(),ie=Y.Subrs[J+Y.Bias];s.x=v,s.y=g,s.nStems=u,s.haveWidth=h,s.width=f,s.open=d,e.U._drawCFF(ie,s,o,a,c),v=s.x,g=s.y,u=s.nStems,h=s.haveWidth,f=s.width,d=s.open}}else if(P=="o30"||P=="o31"){var ne=l.length,ee=(C=0,P=="o31");for(C+=ne-(A=-3&ne);C>>1|(21845&d)<<1;m=(61680&(m=(52428&m)>>>2|(13107&m)<<2))>>>4|(3855&m)<<4,f[d]=((65280&m)>>>8|(255&m)<<8)>>>1}var v=function(P,A,z){for(var V=P.length,N=0,C=new t(A);N>>U]=R}return O},g=new e(288);for(d=0;d<144;++d)g[d]=8;for(d=144;d<256;++d)g[d]=9;for(d=256;d<280;++d)g[d]=7;for(d=280;d<288;++d)g[d]=8;var p=new e(32);for(d=0;d<32;++d)p[d]=5;var _=v(g,9),y=v(p,5),x=function(P){for(var A=P[0],z=1;zA&&(A=P[z]);return A},b=function(P,A,z){var V=A/8|0;return(P[V]|P[V+1]<<8)>>(7&A)&z},w=function(P,A){var z=A/8|0;return(P[z]|P[z+1]<<8|P[z+2]<<16)>>(7&A)},S=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],M=function(P,A,z){var V=new Error(A||S[P]);if(V.code=P,Error.captureStackTrace&&Error.captureStackTrace(V,M),!z)throw V;return V},E=function(P,A,z){var V=P.length;if(!V||z&&!z.l&&V<5)return A||new e(0);var N=!A||z,C=!z||z.i;z||(z={}),A||(A=new e(3*V));var O,k=function(Ee){var De=A.length;if(Ee>De){var Ve=new e(Math.max(2*De,Ee));Ve.set(A),A=Ve}},U=z.f||0,R=z.p||0,F=z.b||0,H=z.l,Y=z.d,J=z.m,ie=z.n,ne=8*V;do{if(!H){z.f=U=b(P,R,1);var ee=b(P,R+1,3);if(R+=3,!ee){var ge=P[(xe=((O=R)/8|0)+(7&O&&1)+4)-4]|P[xe-3]<<8,me=xe+ge;if(me>V){C&&M(0);break}N&&k(F+ge),A.set(P.subarray(xe,me),F),z.b=F+=ge,z.p=R=8*me;continue}if(ee==1)H=_,Y=y,J=9,ie=5;else if(ee==2){var te=b(P,R,31)+257,D=b(P,R+10,15)+4,Q=te+b(P,R+5,31)+1;R+=14;for(var j=new e(Q),K=new e(19),W=0;W>>4)<16)j[W++]=xe;else{var Pe=0,B=0;for(xe==16?(B=3+b(P,R,3),R+=2,Pe=j[W-1]):xe==17?(B=3+b(P,R,7),R+=3):xe==18&&(B=11+b(P,R,127),R+=7);B--;)j[W++]=Pe}}var I=j.subarray(0,te),$=j.subarray(te);J=x(I),ie=x($),H=v(I,J),Y=v($,ie)}else M(1);if(R>ne){C&&M(0);break}}N&&k(F+131072);for(var he=(1<>>4;if((R+=15&Pe)>ne){C&&M(0);break}if(Pe||M(2),Me<256)A[F++]=Me;else{if(Me==256){pe=R,H=null;break}var we=Me-254;if(Me>264){var ue=i[W=Me-257];we=b(P,R,(1<>>4;if(Ce||M(3),R+=15&Ce,$=h[ze],ze>3&&(ue=s[ze],$+=w(P,R)&(1<ne){C&&M(0);break}N&&k(F+131072);for(var Le=F+we;FEe.length)&&(Ve=Ee.length);var je=new(Ee instanceof t?t:Ee instanceof n?n:e)(Ve-De);return je.set(Ee.subarray(De,Ve)),je})(A,0,F)},T=new e(0),L=typeof TextDecoder<"u"&&new TextDecoder;try{L.decode(T,{stream:!0})}catch{}return r.convert_streams=function(P){var A=new DataView(P),z=0;function V(){var te=A.getUint16(z);return z+=2,te}function N(){var te=A.getUint32(z);return z+=4,te}function C(te){ge.setUint16(me,te),me+=2}function O(te){ge.setUint32(me,te),me+=4}for(var k={signature:N(),flavor:N(),length:N(),numTables:V(),reserved:V(),totalSfntSize:N(),majorVersion:V(),minorVersion:V(),metaOffset:N(),metaLength:N(),metaOrigLength:N(),privOffset:N(),privLength:N()},U=0;Math.pow(2,U)<=k.numTables;)U++;U--;for(var R=16*Math.pow(2,U),F=16*k.numTables-R,H=12,Y=[],J=0;J{let[T,L]=E.split("+");T=parseInt(T,36),L=L?parseInt(L,36):0,u.set(M+=T,w[S]);for(let P=L;P--;)u.set(++M,w[S])})}}return u.get(b)||l}const f=1,d=2,m=3,v=4,g=[null,"isol","init","fina","medi"];function p(b){const w=new Uint8Array(b.length);let S=l,M=f,E=-1;for(let T=0;T65535&&T++)}return w}function _(b,w){const S=[];for(let E=0;E65535&&E++,S.push(r.U.codeToGlyph(b,T))}const M=b.GSUB;if(M){const{lookupList:E,featureList:T}=M;let L;const P=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,A=[];T.forEach(z=>{if(P.test(z.tag))for(let V=0;V{if(R!==-1){let H=w[R];if(!H){const{cmds:Y,crds:J}=r.U.glyphToPath(b,R);let ie="",ne=0;for(let D=0,Q=Y.length;D1?",":"")+J[ne++]}let ee,ge,me,te;if(J.length){ee=ge=1/0,me=te=-1/0;for(let D=0,Q=J.length;Dme&&(me=j),K>te&&(te=K)}}else ee=me=ge=te=0;H=w[R]={index:R,advanceWidth:b.hmtx.aWidth[R],xMin:ee,yMin:ge,xMax:me,yMax:te,path:ie,pathCommandCount:Y.length}}U!==-1&&(N+=r.U.getPairAdjustment(b,U,R)*C),V.call(null,H,N,k),H.advanceWidth&&(N+=H.advanceWidth*C),z&&(N+=z*A),U=R}k+=P.codePointAt(k)>65535?2:1}),N}};return L}return function(w){const S=new Uint8Array(w,0,4),M=r._bin.readASCII(S,0,4);if(M==="wOFF")w=e(w);else if(M==="wOF2")throw new Error("woff2 fonts not supported");return x(r.parse(w)[0])}}const RN=Gc({name:"Typr Font Parser",dependencies:[TN,AN,CN],init(r,e,t){const n=r(),i=e();return t(n,i)}}),bo={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},PN=new Ne;function fo(){return(self.performance||Date).now()}const uy=Object.create(null);function Sw(r,e){r=IN({},r);const t=fo();if(r.font=UN(r.font||bo.defaultFontURL),r.text=""+r.text,r.sdfGlyphSize=r.sdfGlyphSize||bo.sdfGlyphSize,r.colorRanges!=null){let h={};for(let f in r.colorRanges)if(r.colorRanges.hasOwnProperty(f)){let d=r.colorRanges[f];typeof d!="number"&&(d=PN.set(d).getHex()),h[f]=d}r.colorRanges=h}Object.freeze(r);const{textureWidth:n,sdfExponent:i}=bo,{sdfGlyphSize:s}=r,o=n/s*4;let a=uy[s];if(!a){const h=document.createElement("canvas");h.width=n,h.height=s*256/o,a=uy[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:h,sdfTexture:new Ft(h,void 0,void 0,void 0,Pt,Pt),contextLost:!1,glyphsByFont:new Map},a.sdfTexture.generateMipmaps=!1,LN(a)}const{sdfTexture:c,sdfCanvas:l}=a;let u=a.glyphsByFont.get(r.font);u||a.glyphsByFont.set(r.font,u=new Map),NN(r).then(h=>{const{glyphIds:f,glyphPositions:d,fontSize:m,unitsPerEm:v,timings:g}=h,p=[],_=new Float32Array(f.length*4),y=m/v;let x=0,b=0;const w=fo();f.forEach((L,P)=>{let A=u.get(L);if(!A){const{path:C,pathBounds:O}=h.glyphData[L],k=Math.max(O[2]-O[0],O[3]-O[1])/s*(bo.sdfMargin*s+.5),U=a.glyphCount++,R=[O[0]-k,O[1]-k,O[2]+k,O[3]+k];u.set(L,A={path:C,atlasIndex:U,sdfViewBox:R}),p.push(A)}const{sdfViewBox:z}=A,V=d[b++],N=d[b++];_[x++]=V+z[0]*y,_[x++]=N+z[1]*y,_[x++]=V+z[2]*y,_[x++]=N+z[3]*y,f[P]=A.atlasIndex}),g.quads=(g.quads||0)+(fo()-w);const S=fo();g.sdf={};const M=l.height,E=Math.ceil(a.glyphCount/o),T=Math.pow(2,Math.ceil(Math.log2(E*s)));T>M&&(console.info(`Increasing SDF texture size ${M}->${T}`),MN(l,n,T),c.dispose()),Promise.all(p.map(L=>Ew(L,a,r.gpuAccelerateSDF).then(({timing:P})=>{g.sdf[L.atlasIndex]=P}))).then(()=>{p.length&&!a.contextLost&&(Mw(a),c.needsUpdate=!0),g.sdfTotal=fo()-S,g.total=fo()-t,e(Object.freeze({parameters:r,sdfTexture:c,sdfGlyphSize:s,sdfExponent:i,glyphBounds:_,glyphAtlasIndices:f,glyphColors:h.glyphColors,caretPositions:h.caretPositions,caretHeight:h.caretHeight,chunkedBounds:h.chunkedBounds,ascender:h.ascender,descender:h.descender,lineHeight:h.lineHeight,capHeight:h.capHeight,xHeight:h.xHeight,topBaseline:h.topBaseline,blockBounds:h.blockBounds,visibleBounds:h.visibleBounds,timings:h.timings}))})}),Promise.resolve().then(()=>{a.contextLost||EN(l)})}function Ew({path:r,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:n,sdfCanvas:i,contextLost:s},o){if(s)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:c}=bo,l=Math.max(t[2]-t[0],t[3]-t[1]),u=Math.floor(e/4),h=u%(a/n)*n,f=Math.floor(u/(a/n))*n,d=e%4;return _N(n,n,r,t,l,c,i,h,f,d,o)}function LN(r){const e=r.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),r.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),r.contextLost=!1;const n=[];r.glyphsByFont.forEach(i=>{i.forEach(s=>{n.push(Ew(s,r,!0))})}),Promise.all(n).then(()=>{Mw(r),r.sdfTexture.needsUpdate=!0})})}function DN({font:r,characters:e,sdfGlyphSize:t},n){let i=Array.isArray(e)?e.join(` -`):""+e;Sw({font:r,sdfGlyphSize:t,text:i},n)}function IN(r,e){for(let t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r}let Kl;function UN(r){return Kl||(Kl=typeof document>"u"?{}:document.createElement("a")),Kl.href=r,Kl.href}function Mw(r){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=r,{width:n,height:i}=e,s=r.sdfCanvas.getContext("webgl");let o=t.image.data;(!o||o.length!==n*i*4)&&(o=new Uint8Array(n*i*4),t.image={width:n,height:i,data:o},t.flipY=!1,t.isDataTexture=!0),s.readPixels(0,0,n,i,s.RGBA,s.UNSIGNED_BYTE,o)}}const ON=Gc({name:"Typesetter",dependencies:[bo,RN,vN,_E],init(r,e,t,n){const{defaultFontURL:i}=r;return t(e,n(),{defaultFontURL:i})}}),NN=Gc({name:"Typesetter",dependencies:[ON],init(r){return function(e){return new Promise(t=>{r.typeset(e,t)})}},getTransferables(r){const e=[r.glyphPositions.buffer,r.glyphIds.buffer];return r.caretPositions&&e.push(r.caretPositions.buffer),r.glyphColors&&e.push(r.glyphColors.buffer),e}}),hy={};function FN(r){let e=hy[r];if(!e){const t=new Nr(1,1,r,r),n=t.clone(),i=t.attributes,s=n.attributes,o=new st,a=i.uv.count;for(let c=0;c{o.setAttribute(c,new He([...i[c].array,...s[c].array],i[c].itemSize))}),o.setIndex([...t.index.array,...n.index.array.map(c=>c+a)]),o.translate(.5,.5,0),e=hy[r]=o}return e}const kN="aTroikaGlyphBounds",fy="aTroikaGlyphIndex",zN="aTroikaGlyphColor";class BN extends Am{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new Wn,this.boundingBox=new Hn}computeBoundingSphere(){}computeBoundingBox(){}setSide(e){const t=this.getIndex().count;this.setDrawRange(e===vn?t/2:0,e===Dt?t:t/2)}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=FN(e);["position","normal","uv"].forEach(n=>{this.attributes[n]=t.attributes[n].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,n,i,s){Ed(this,kN,e,4),Ed(this,fy,t,1),Ed(this,zN,s,3),this._blockBounds=n,this._chunkedBounds=i,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:n}=this;if(t){const{PI:i,floor:s,min:o,max:a,sin:c,cos:l}=Math,u=i/2,h=i*2,f=Math.abs(t),d=e[0]/f,m=e[2]/f,v=s((d+u)/h)!==s((m+u)/h)?-f:o(c(d)*f,c(m)*f),g=s((d-u)/h)!==s((m-u)/h)?f:a(c(d)*f,c(m)*f),p=s((d+i)/h)!==s((m+i)/h)?f*2:a(f-l(d)*f,f-l(m)*f);n.min.set(v,e[1],t<0?-p:0),n.max.set(g,e[3],t<0?0:p)}else n.min.set(e[0],e[1],0),n.max.set(e[2],e[3],0);n.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(fy).count,n=this._chunkedBounds;if(n)for(let i=n.length;i--;){t=n[i].end;let s=n[i].rect;if(s[1]e.y&&s[0]e.x)break}this.instanceCount=t}}function Ed(r,e,t,n){const i=r.getAttribute(e);t?i&&i.array.length===t.length?(i.array.set(t),i.needsUpdate=!0):(r.setAttribute(e,new vs(t,n)),delete r._maxInstanceCount,r.dispose()):i&&r.deleteAttribute(e)}const GN=` -uniform vec2 uTroikaSDFTextureSize; -uniform float uTroikaSDFGlyphSize; -uniform vec4 uTroikaTotalBounds; -uniform vec4 uTroikaClipRect; -uniform mat3 uTroikaOrient; -uniform bool uTroikaUseGlyphColors; -uniform float uTroikaDistanceOffset; -uniform float uTroikaBlurRadius; -uniform vec2 uTroikaPositionOffset; -uniform float uTroikaCurveRadius; -attribute vec4 aTroikaGlyphBounds; -attribute float aTroikaGlyphIndex; -attribute vec3 aTroikaGlyphColor; -varying vec2 vTroikaGlyphUV; -varying vec4 vTroikaTextureUVBounds; -varying float vTroikaTextureChannel; -varying vec3 vTroikaGlyphColor; -varying vec2 vTroikaGlyphDimensions; -`,VN=` -vec4 bounds = aTroikaGlyphBounds; -bounds.xz += uTroikaPositionOffset.x; -bounds.yw -= uTroikaPositionOffset.y; - -vec4 outlineBounds = vec4( - bounds.xy - uTroikaDistanceOffset - uTroikaBlurRadius, - bounds.zw + uTroikaDistanceOffset + uTroikaBlurRadius -); -vec4 clippedBounds = vec4( - clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw), - clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw) -); - -vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy); - -position.xy = mix(bounds.xy, bounds.zw, clippedXY); - -uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy); - -float rad = uTroikaCurveRadius; -if (rad != 0.0) { - float angle = position.x / rad; - position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad); - normal.xz = vec2(sin(angle), cos(angle)); -} - -position = uTroikaOrient * position; -normal = uTroikaOrient * normal; - -vTroikaGlyphUV = clippedXY.xy; -vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]); - - -float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize; -vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize; -vec2 txStartUV = txUvPerSquare * vec2( - mod(floor(aTroikaGlyphIndex / 4.0), txCols), - floor(floor(aTroikaGlyphIndex / 4.0) / txCols) -); -vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare); -vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0); -`,HN=` -uniform sampler2D uTroikaSDFTexture; -uniform vec2 uTroikaSDFTextureSize; -uniform float uTroikaSDFGlyphSize; -uniform float uTroikaSDFExponent; -uniform float uTroikaDistanceOffset; -uniform float uTroikaFillOpacity; -uniform float uTroikaOutlineOpacity; -uniform float uTroikaBlurRadius; -uniform vec3 uTroikaStrokeColor; -uniform float uTroikaStrokeWidth; -uniform float uTroikaStrokeOpacity; -uniform bool uTroikaSDFDebug; -varying vec2 vTroikaGlyphUV; -varying vec4 vTroikaTextureUVBounds; -varying float vTroikaTextureChannel; -varying vec2 vTroikaGlyphDimensions; - -float troikaSdfValueToSignedDistance(float alpha) { - // Inverse of exponential encoding in webgl-sdf-generator - - float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y); - float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension; - float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0); - return signedDist; -} - -float troikaGlyphUvToSdfValue(vec2 glyphUV) { - vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV); - vec4 rgba = texture2D(uTroikaSDFTexture, textureUV); - float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1 - return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a; -} - -float troikaGlyphUvToDistance(vec2 uv) { - return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv)); -} - -float troikaGetAADist() { - - #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300 - return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5; - #else - return vTroikaGlyphDimensions.x / 64.0; - #endif -} - -float troikaGetFragDistValue() { - vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize); - float distance = troikaGlyphUvToDistance(clampedGlyphUV); - - // Extrapolate distance when outside bounds: - distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : - length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions); - - - - return distance; -} - -float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) { - #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL) - float alpha = step(-distanceOffset, -distance); - #else - - float alpha = smoothstep( - distanceOffset + aaDist, - distanceOffset - aaDist, - distance - ); - #endif - - return alpha; -} -`,WN=` -float aaDist = troikaGetAADist(); -float fragDistance = troikaGetFragDistValue(); -float edgeAlpha = uTroikaSDFDebug ? - troikaGlyphUvToSdfValue(vTroikaGlyphUV) : - troikaGetEdgeAlpha(fragDistance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius)); - -#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL) -vec4 fillRGBA = gl_FragColor; -fillRGBA.a *= uTroikaFillOpacity; -vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity); -if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb; -gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep( - -uTroikaStrokeWidth - aaDist, - -uTroikaStrokeWidth + aaDist, - fragDistance -)); -gl_FragColor.a *= edgeAlpha; -#endif - -if (edgeAlpha == 0.0) { - discard; -} -`;function XN(r){const e=zp(r,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new be},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new mt(0,0,0,0)},uTroikaClipRect:{value:new mt(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new be},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Ne},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new rt},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:GN,vertexTransform:VN,fragmentDefs:HN,fragmentColorTransform:WN,customRewriter({vertexShader:t,fragmentShader:n}){let i=/\buniform\s+vec3\s+diffuse\b/;return i.test(n)&&(n=n.replace(i,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),i.test(t)||(t=t.replace(bw,`uniform vec3 diffuse; -$& -vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; -`))),{vertexShader:t,fragmentShader:n}}});return e.transparent=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const hg=new cr({color:16777215,side:Dt,transparent:!0}),dy=8421504,py=new Ke,Jl=new G,Md=new G,Da=[],qN=new G,Td="+x+y";function my(r){return Array.isArray(r)?r[0]:r}let Tw=()=>{const r=new Ot(new Nr(1,1),hg);return Tw=()=>r,r},Aw=()=>{const r=new Ot(new Nr(1,1,32,1),hg);return Aw=()=>r,r};const YN={type:"syncstart"},jN={type:"synccomplete"},Cw=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],$N=Cw.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let Rw=class extends Ot{constructor(){const e=new BN;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=dy,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=Td,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(YN),Sw({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{n.forEach(i=>i&&i())})),this.dispatchEvent(jN),e&&e()})))}onBeforeRender(e,t,n,i,s,o){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s),s._hadOwnSide=s.hasOwnProperty("side"),this.geometry.setSide(s._actualSide=s.side),s.side=Oi}onAfterRender(e,t,n,i,s,o){s._hadOwnSide?s.side=s._actualSide:delete s.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=hg.clone());if((!e||e.baseMaterial!==t)&&(e=this._derivedMaterial=XN(t),t.addEventListener("dispose",function n(){t.removeEventListener("dispose",n),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let n=e._outlineMtl;return n||(n=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),n.isTextOutlineMaterial=!0,n.depthWrite=!1,n.map=null,e.addEventListener("dispose",function i(){e.removeEventListener("dispose",i),n.dispose()})),[n,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return my(this.material).getDepthMaterial()}get customDistanceMaterial(){return my(this.material).getDistanceMaterial()}_prepareForRender(e){const t=e.isTextOutlineMaterial,n=e.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:a,blockBounds:c}=i;n.uTroikaSDFTexture.value=a,n.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),n.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,n.uTroikaSDFExponent.value=i.sdfExponent,n.uTroikaTotalBounds.value.fromArray(c),n.uTroikaUseGlyphColors.value=!t&&!!i.glyphColors;let l=0,u=0,h=0,f,d,m,v=0,g=0;if(t){let{outlineWidth:_,outlineOffsetX:y,outlineOffsetY:x,outlineBlur:b,outlineOpacity:w}=this;l=this._parsePercent(_)||0,u=Math.max(0,this._parsePercent(b)||0),f=w,v=this._parsePercent(y)||0,g=this._parsePercent(x)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(m=this.strokeColor,n.uTroikaStrokeColor.value.set(m??dy),d=this.strokeOpacity,d==null&&(d=1)),f=this.fillOpacity;n.uTroikaDistanceOffset.value=l,n.uTroikaPositionOffset.value.set(v,g),n.uTroikaBlurRadius.value=u,n.uTroikaStrokeWidth.value=h,n.uTroikaStrokeOpacity.value=d,n.uTroikaFillOpacity.value=f??1,n.uTroikaCurveRadius.value=this.curveRadius||0;let p=this.clipRect;if(p&&Array.isArray(p)&&p.length===4)n.uTroikaClipRect.value.fromArray(p);else{const _=(this.fontSize||.1)*100;n.uTroikaClipRect.value.set(c[0]-_,c[1]-_,c[2]+_,c[3]+_)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new Ne;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||Td;if(o!==e._orientation){let a=n.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let c=o!==Td&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(c){let[,l,u,h,f]=c;Jl.set(0,0,0)[u]=l==="-"?1:-1,Md.set(0,0,0)[f]=h==="-"?-1:1,py.lookAt(qN,Jl.cross(Md),Md),a.setFromMatrix4(py)}else a.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),n=t?parseFloat(t[1]):NaN;e=(isNaN(n)?0:n/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new be){t.copy(e);const n=this.curveRadius;return n&&(t.x=Math.atan2(e.x,Math.abs(n)-Math.abs(e.z))*Math.abs(n)),t}worldPositionToTextCoords(e,t=new be){return Jl.copy(e),this.localPositionToTextCoords(this.worldToLocal(Jl),t)}raycast(e,t){const{textRenderInfo:n,curveRadius:i}=this;if(n){const s=n.blockBounds,o=i?Aw():Tw(),a=o.geometry,{position:c,uv:l}=a.attributes;for(let u=0;u{this[n]=e[n]}),this}clone(){return new this.constructor().copy(this)}};Cw.forEach(r=>{const e="_private_"+r;Object.defineProperty(Rw.prototype,r,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});const ZN=q.forwardRef(({sdfGlyphSize:r=64,anchorX:e="center",anchorY:t="middle",font:n,fontSize:i=1,children:s,characters:o,onSync:a,...c},l)=>{const u=Kt(({invalidate:m})=>m),[h]=q.useState(()=>new Rw),[f,d]=q.useMemo(()=>{const m=[];let v="";return q.Children.forEach(s,g=>{typeof g=="string"||typeof g=="number"?v+=g:m.push(g)}),[m,v]},[s]);return rS(()=>new Promise(m=>DN({font:n,characters:o},m)),["troika-text",n,o]),q.useLayoutEffect(()=>void h.sync(()=>{u(),a&&a(h)})),q.useEffect(()=>()=>h.dispose(),[h]),q.createElement("primitive",Tc({object:h,ref:l,font:n,text:d,anchorX:e,anchorY:t,fontSize:i,sdfGlyphSize:r},c),f)});var Ia={exports:{}},gy;function KN(){if(gy)return Ia.exports;gy=1;var r={ellipse:"…",chars:[" ","-"],max:140,truncate:!0};function e(n,i,s,o){if(n<=i)return n;if(i<2)return n.slice(0,i-s.length)+s;for(var a=i-s.length,c=Math.floor(a/2),l=c,u=n.length-c,h=0;h"u")&&(s[o]=r[o]);return s.max=i||s.max,s.truncate=="middle"?e(n,s.max,s.ellipse,s.chars):t(n,s.max,s.ellipse,s.chars,s.truncate)},Ia.exports.ellipsizeMiddle=e,Ia.exports.ellipsize=t,Ia.exports}var JN=KN();const QN=ki(JN);/*! - * hold-event - * https://github.com/yomotsu/hold-event - * (c) 2020 @yomotsu - * Released under the MIT License. - */var Za;(function(r){r.HOLD_START="holdStart",r.HOLD_END="holdEnd",r.HOLDING="holding"})(Za||(Za={}));class eF{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s{if(!this._enabled||this._holding)return;this._deltaTime=0,this._elapsedTime=0,this._lastTime=performance.now(),this.dispatchEvent({type:Za.HOLD_START,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),this._holding=!0;const n=()=>{this._intervalId=this.holdIntervalDelay?window.setTimeout(n,this.holdIntervalDelay):window.requestAnimationFrame(n);const i=performance.now();this._deltaTime=i-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:Za.HOLDING,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t})};this._intervalId=this.holdIntervalDelay?window.setTimeout(n,this.holdIntervalDelay):window.requestAnimationFrame(n)},this._holdEnd=t=>{if(!this._enabled||!this._holding)return;const n=performance.now();this._deltaTime=n-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:Za.HOLD_END,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),window.clearTimeout(this._intervalId),window.cancelAnimationFrame(this._intervalId),this._holding=!1},this.holdIntervalDelay=e}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._enabled||this._holdEnd())}}class Eh extends tF{constructor(e,t){super(t),this._holdStart=this._holdStart.bind(this),this._holdEnd=this._holdEnd.bind(this);const n=s=>{nF(s)||s.keyCode===e&&this._holdStart(s)},i=s=>{s.keyCode===e&&this._holdEnd(s)};document.addEventListener("keydown",n),document.addEventListener("keyup",i),window.addEventListener("blur",this._holdEnd)}}function nF(r){const e=r.target;return e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA"||e.isContentEditable}var Ad={exports:{}};/*! - Copyright (c) 2018 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/var vy;function iF(){return vy||(vy=1,(function(r){(function(){var e={}.hasOwnProperty;function t(){for(var s="",o=0;o-1){const s=[...e.slice(i),n].map(o=>o.data.id);throw new Error(`Invalid Graph: Circular node path detected: ${s.join(" -> ")}.`)}t>n.depth&&(n.depth=t,Pw(n.out,[...e,n]))}}function Lw(r,e){let t=!1;const n=r.reduce((o,a)=>({...o,[a.id]:{data:a,out:[],depth:-1,ins:[]}}),{});try{for(const o of e){const a=o.source,c=o.target;if(!n.hasOwnProperty(a))throw new Error(`Missing source Node ${a}`);if(!n.hasOwnProperty(c))throw new Error(`Missing target Node ${c}`);const l=n[a],u=n[c];u.ins.push(l),l.out.push(u)}Pw(Object.values(n))}catch{t=!0}const i=Object.keys(n).map(o=>n[o].depth),s=Math.max(...i);return{invalid:t,depths:n,maxDepth:s||1}}const xy=["radialin","radialout"];function rF({nodes:r,edges:e,mode:t="lr",nodeLevelRatio:n=2}){const{depths:i,maxDepth:s,invalid:o}=Lw(r,e);if(o)return null;const a=xy.includes(t)?1:5,c=r.length/s*n*a;if(t){const l=(d,m)=>v=>d?(i[v.id].depth-s/2)*c*(m?-1:1):void 0,u=l(["lr","rl"].includes(t),t==="rl"),h=l(["td","bu"].includes(t),t==="td"),f=l(["zin","zout"].includes(t),t==="zout");r.forEach(d=>{d.fx=u(d),d.fy=h(d),d.fz=f(d)})}return xy.includes(t)?sI(l=>{const u=i[l.id];return(t==="radialin"?s-u.depth:u.depth)*c}).strength(1):null}function sF(r){return new Promise((e,t)=>{let n;function i(){n?e(n):(n=r.step(),i())}i()})}function Vc(r){const e=[],t=[];return r.forEachNode((n,i)=>{e.push({...i,id:n,radius:i.size||1})}),r.forEachEdge((n,i)=>{t.push({...i,id:n})}),{nodes:e,edges:t}}function oF(){const r=C=>()=>C;let t=C=>C.index,n=[],i=[],s,o,a=[100,100],c=r(1),l=r(-1),u=r(100),h=r(.1),f={},d=.1,m=.001,v=[],g=[0,0],p,_=C=>C.cluster,y="treemap",x=!0,b=.1;function w(C){if(!x)return w;y==="force"&&(p.tick(),A());for(let O=0,k=n.length,U,R=C*b;OO.radius).sort(function(O,k){return k.height-O.height||k.value-O.value}),v=C(o).leaves(),A()}function V(){let C=0;n.length!==0&&i.forEach(function(O){let k,U;if(n){if(k=O.source,U=O.target,typeof O.source!="object"&&(k=n.find(R=>R.id===O.source)),typeof O.target!="object"&&(U=n.find(R=>R.id===O.target)),k===void 0||U===void 0)throw Error("Error setting links, couldnt find nodes for a link (see it on the console)");O.source=k,O.target=U,O.index=C++}})}function N(){let C;!n||!n.length||(V(),C=L(),s.size>0&&C.nodes.forEach(O=>{var k,U,R,F;O.fx=(U=(k=s.get(O.id))==null?void 0:k.position)==null?void 0:U.x,O.fy=(F=(R=s.get(O.id))==null?void 0:R.position)==null?void 0:F.y}),p=x1(C.nodes).force("x",wp(a[0]/2).strength(.1)).force("y",Sp(a[1]/2).strength(.1)).force("collide",d1(O=>O.r).iterations(4)).force("charge",b1().strength(l)).force("links",p1(C.nodes.length?C.links:[]).distance(u).strength(h)),v=p.nodes(),A())}return w.template=function(C){return arguments.length?(y=C,S(),w):y},w.groupBy=function(C){return arguments.length?typeof C=="string"?(_=function(O){return O[C]},w):(_=C,w):_},w.enableGrouping=function(C){return arguments.length?(x=C,w):x},w.strength=function(C){return arguments.length?(b=C,w):b},w.getLinkStrength=function(C){return x?_(C.source)===_(C.target)?typeof d=="function"?d(C):d:typeof m=="function"?m(C):m:typeof d=="function"?d(C):d},w.id=function(C){return arguments.length?(t=C,w):t},w.size=function(C){return arguments.length?(a=C,w):a},w.linkStrengthInterCluster=function(C){return arguments.length?(m=C,w):m},w.linkStrengthIntraCluster=function(C){return arguments.length?(d=C,w):d},w.nodes=function(C){return arguments.length?(n=C,w):n},w.links=function(C){return arguments.length?(C===null?i=[]:i=C,S(),w):i},w.template=function(C){return arguments.length?(y=C,S(),w):y},w.forceNodeSize=function(C){return arguments.length?(c=typeof C=="function"?C:r(+C),S(),w):c},w.nodeSize=w.forceNodeSize,w.forceCharge=function(C){return arguments.length?(l=typeof C=="function"?C:r(+C),S(),w):l},w.forceLinkDistance=function(C){return arguments.length?(u=typeof C=="function"?C:r(+C),S(),w):u},w.forceLinkStrength=function(C){return arguments.length?(h=typeof C=="function"?C:r(+C),S(),w):h},w.offset=function(C){return arguments.length?(g=typeof C=="function"?C:r(+C),w):g},w.getFocis=A,w.setClusters=function(C){return s=C,w},w}function br({graph:r,nodeLevelRatio:e=2,mode:t=null,dimensions:n=2,nodeStrength:i=-250,linkDistance:s=50,clusterStrength:o=.5,linkStrengthInterCluster:a=.01,linkStrengthIntraCluster:c=.5,forceLinkDistance:l=100,forceLinkStrength:u=.1,clusterType:h="force",forceCharge:f=-700,getNodePosition:d,drags:m,clusters:v,clusterAttribute:g,forceLayout:p}){const{nodes:_,edges:y}=Vc(r),b=n===2&&y.length>25?i*2:i;let w,S;p==="forceDirected2d"?(w=wp(),S=Sp()):(w=wp(600).strength(.05),S=Sp(600).strength(.05));const M=x1().force("center",qL(0,0)).force("link",p1()).force("charge",b1().strength(b)).force("x",w).force("y",S).force("z",oI()).force("collide",d1(P=>P.radius+10)).force("dagRadial",rF({nodes:_,edges:y,mode:t,nodeLevelRatio:e})).stop();let E;if(g){let P=f;if(_!=null&&_.length){const A=Math.ceil(_.length/200);P=f*A}E=oF().setClusters(v).strength(o).template(h).groupBy(A=>A.data[g]).links(y).size([100,100]).linkStrengthInterCluster(a).linkStrengthIntraCluster(c).forceLinkDistance(l).forceLinkStrength(u).forceCharge(P).forceNodeSize(A=>A.radius)}let T=M.numDimensions(n).nodes(_);if(E&&(T=T.force("group",E)),s){let P=T.force("link");P&&(P.id(A=>A.id).links(y).distance(s),E&&(P=P.strength((E==null?void 0:E.getLinkStrength)??.1)))}const L=new Map(_.map(P=>[P.id,P]));return{step(){for(;M.alpha()>.01;)M.tick();return!0},getNodePosition(P){var A,z;if(d){const V=d(P,{graph:r,drags:m,nodes:_,edges:y});if(V)return V}return(A=m==null?void 0:m[P])!=null&&A.position?(z=m==null?void 0:m[P])==null?void 0:z.position:L.get(P)}}}function aF({graph:r,radius:e,drags:t,getNodePosition:n}){const i=qI(r,{scale:e}),{nodes:s,edges:o}=Vc(r);return{step(){return!0},getNodePosition(a){var c,l;if(n){const u=n(a,{graph:r,drags:t,nodes:s,edges:o});if(u)return u}return(c=t==null?void 0:t[a])!=null&&c.position?(l=t==null?void 0:t[a])==null?void 0:l.position:i==null?void 0:i[a]}}}const cF={td:{x:"x",y:"y",factor:-1},lr:{x:"y",y:"x",factor:1}};function by({graph:r,drags:e,mode:t="td",nodeSeparation:n=1,nodeSize:i=[50,50],getNodePosition:s}){const{nodes:o,edges:a}=Vc(r),{depths:c}=Lw(o,a),l=Object.keys(c).map(v=>c[v]),u=LI().id(v=>v.data.id).parentId(v=>{var g,p,_;return(_=(p=(g=v.ins)==null?void 0:g[0])==null?void 0:p.data)==null?void 0:_.id})(l),f=kI().separation(()=>n).nodeSize(i)(fh(u)).descendants(),d=cF[t],m=new Map(o.map(v=>{const{x:g,y:p}=f.find(_=>_.data.id===v.id);return[v.id,{...v,[d.x]:g*d.factor,[d.y]:p*d.factor,z:0}]}));return{step(){return!0},getNodePosition(v){var g,p;if(s){const _=s(v,{graph:r,drags:e,nodes:o,edges:a});if(_)return _}return(g=e==null?void 0:e[v])!=null&&g.position?(p=e==null?void 0:e[v])==null?void 0:p.position:m.get(v)}}}function lF({graph:r,margin:e,drags:t,getNodePosition:n,ratio:i,gridSize:s,maxIterations:o}){const{nodes:a,edges:c}=Vc(r),l=JI(r,{maxIterations:o,inputReducer:(u,h)=>({...h,x:h.x||0,y:h.y||0}),settings:{ratio:i,margin:e,gridSize:s}});return{step(){return!0},getNodePosition(u){var h,f;if(n){const d=n(u,{graph:r,drags:t,nodes:a,edges:c});if(d)return d}return(h=t==null?void 0:t[u])!=null&&h.position?(f=t==null?void 0:t[u])==null?void 0:f.position:l==null?void 0:l[u]}}}function uF({graph:r,drags:e,iterations:t,...n}){aU.assign(r);const i=rU(r,{iterations:t,settings:n});return{step(){return!0},getNodePosition(s){var o;return((o=e==null?void 0:e[s])==null?void 0:o.position)||(i==null?void 0:i[s])}}}function hF({graph:r,drags:e,getNodePosition:t}){const{nodes:n,edges:i}=Vc(r);return{step(){return!0},getNodePosition(s){return t(s,{graph:r,drags:e,nodes:n,edges:i})}}}const fF=["forceDirected2d","treeTd2d","treeLr2d","radialOut2d","treeTd3d","treeLr3d","radialOut3d","forceDirected3d"];function dF({type:r,...e}){if(fF.includes(r)){const{nodeStrength:t,linkDistance:n,nodeLevelRatio:i}=e;if(r==="forceDirected2d")return br({...e,dimensions:2,nodeLevelRatio:i||2,nodeStrength:t||-250,linkDistance:n,forceLayout:r});if(r==="treeTd2d")return br({...e,mode:"td",dimensions:2,nodeLevelRatio:i||5,nodeStrength:t||-250,linkDistance:n||50,forceLayout:r});if(r==="treeLr2d")return br({...e,mode:"lr",dimensions:2,nodeLevelRatio:i||5,nodeStrength:t||-250,linkDistance:n||50,forceLayout:r});if(r==="radialOut2d")return br({...e,mode:"radialout",dimensions:2,nodeLevelRatio:i||5,nodeStrength:t||-500,linkDistance:n||100,forceLayout:r});if(r==="treeTd3d")return br({...e,mode:"td",dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-500,linkDistance:n||50});if(r==="treeLr3d")return br({...e,mode:"lr",dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-500,linkDistance:n||50,forceLayout:r});if(r==="radialOut3d")return br({...e,mode:"radialout",dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-500,linkDistance:n||100,forceLayout:r});if(r==="forceDirected3d")return br({...e,dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-250,linkDistance:n,forceLayout:r})}else if(r==="circular2d"){const{radius:t}=e;return aF({...e,radius:t||300})}else{if(r==="hierarchicalTd")return by({...e,mode:"td"});if(r==="hierarchicalLr")return by({...e,mode:"lr"});if(r==="nooverlap"){const{graph:t,maxIterations:n,ratio:i,margin:s,gridSize:o,...a}=e;return lF({graph:t,margin:s||10,maxIterations:n||50,ratio:i||10,gridSize:o||20,...a})}else if(r==="forceatlas2"){const{graph:t,iterations:n,gravity:i,scalingRatio:s,...o}=e;return uF({type:"forceatlas2",graph:t,...o,scalingRatio:s||100,gravity:i||10,iterations:n||50})}else if(r==="custom")return hF({...e})}throw new Error(`Layout ${r} not found.`)}function Dw({nodeCount:r,nodePosition:e,labelType:t,camera:n}){return(i,s)=>{var o;if(n&&e&&((o=n==null?void 0:n.position)==null?void 0:o.z)/(n==null?void 0:n.zoom)-(e==null?void 0:e.z)>6e3)return!1;if(t==="all")return!0;if(t==="nodes"&&i==="node")return!0;if(t==="edges"&&i==="edge")return!0;if(t==="auto"&&i==="node"){if(s>7)return!0;if(n&&e&&n.position.z/n.zoom-e.z<3e3)return!0}return!1}}function Iw(r,e){switch(e){case"above":return r;case"below":return-r;case"inline":case"natural":default:return 0}}function pF({graph:r}){const e=hU(r);return{ranks:e,getSizeForNode:t=>e[t]*80}}function mF({graph:r}){const e=dU.degreeCentrality(r);return{ranks:e,getSizeForNode:t=>e[t]*20}}function gF({graph:r,attribute:e,defaultSize:t}){const n=new Map;return e?r.forEachNode((i,s)=>{var o;const a=(o=s.data)==null?void 0:o[e];isNaN(a)&&console.warn(`Attribute ${a} is not a number for node ${s.id}`),n.set(i,a||0)}):console.warn("Attribute sizing configured but no attribute provided"),{getSizeForNode:i=>!e||!n?t:n.get(i)}}const wy={pagerank:pF,centrality:mF,attribute:gF,none:({defaultSize:r})=>({getSizeForNode:e=>r})};function vF({type:r,...e}){var t;const n=(t=wy[r])==null?void 0:t.call(wy,e);if(!n&&r!=="default")throw new Error(`Unknown sizing strategy: ${r}`);const{graph:i,minSize:s,maxSize:o}=e,a=new Map;let c,l;if(i.forEachNode((u,h)=>{let f;r==="default"?f=h.size||e.defaultSize:f=n.getSizeForNode(u),(c===void 0||fl)&&(l=f),a.set(u,f)}),r!=="none"){const u=Jw().domain([c,l]).rangeRound([s,o]);for(const[h,f]of a)a.set(h,u(f))}return a}function _F(r,e,t){r.clear();const n=new Set;for(const i of e)try{n.has(i.id)||(r.addNode(i.id,i),n.add(i.id))}catch(s){console.error(`[Graph] Error adding node '${i.id}`,s)}for(const i of t)if(!(!n.has(i.source)||!n.has(i.target)))try{r.addEdge(i.source,i.target,i)}catch(s){console.error(`[Graph] Error adding edge '${i.source} -> ${i.target}`,s)}return r}function yF({graph:r,layout:e,sizingType:t,labelType:n,sizingAttribute:i,defaultNodeSize:s,minNodeSize:o,maxNodeSize:a,clusterAttribute:c}){const l=[],u=[],h=new Map,f=vF({graph:r,type:t,attribute:i,minSize:o,maxSize:a,defaultSize:s}),d=r.nodes().length,m=Dw({nodeCount:d,labelType:n});return r.forEachNode((v,g)=>{const p=e.getNodePosition(v),{data:_,fill:y,icon:x,label:b,size:w,...S}=g,M=f.get(g.id),E=m("node",M),L=(r.inboundNeighbors(g.id)||[]).map(A=>r.getNodeAttributes(A)),P={...g,size:M,labelVisible:E,label:b,icon:x,fill:y,cluster:c?_[c]:void 0,parents:L,data:{...S,..._??{}},position:{...p,x:p.x||0,y:p.y||0,z:p.z||1}};h.set(g.id,P),l.push(P)}),r.forEachEdge((v,g)=>{const p=h.get(g.source),_=h.get(g.target);if(p&&_){const{data:y,id:x,label:b,size:w,...S}=g,M=m("edge",w);u.push({...g,id:x,label:b,labelVisible:M,size:w,data:{...S,id:x,...y||{}}})}}),{nodes:l,edges:u}}const Vn={mass:10,tension:1e3,friction:300,precision:.1};function Uw(r,e,t){const n=e.getLength(),i=r==="end"?n:n/2,s=r==="end"?t/2:0,o=(i-s)/n,a=e.getPointAt(o),c=e.getTangentAt(o);return[a,c]}function Ow(r){return[r+6,2+r/1.5]}const Cd=.7;function Nw(r,e,t=0){const n=new G(r.x,r.y||0,r.z||0),i=new G(e.x,e.y||0,e.z||0),s=new G().addVectors(n,i).divideScalar(2);return s.setLength(s.length()+t)}function xF(r,e,t=-1){const n=r.clone(),i=e.clone(),s=new G().subVectors(i,n),o=s.length(),a=s.clone().normalize(),c=new G().subVectors(i,n).divideScalar(2),l=Math.abs(a.x)%1,u=new G(-a.y,a.x-l*a.z,l*a.y).normalize(),h=new G().add(n).add(c).add(u.multiplyScalar(o/4).multiplyScalar(t));return[r,h,e]}function wc(r,e,t,n,i,s){const o=Sy(r,t,e),a=Sy(t,r,n);return i?new $u(...xF(o,a,s)):new gm(o,a)}function Sc(r){return new G(r.position.x,r.position.y,r.position.z||0)}function Sy(r,e,t){const n=r.distanceTo(e);return r.clone().add(e.clone().sub(r).multiplyScalar(t/n))}function Ey(r,e){return{...r,position:{...r.position,x:r.position.x+e.x,y:r.position.y+e.y,z:r.position.z+e.z}}}function bF({edge:r,edges:e,curved:t}){let n=t,i;const s=e.filter(o=>o.target===r.target&&o.source===r.source).map(o=>o.id);if(s.length>1){n=!0;const o=s.indexOf(r.id);s.length===2?i=o===0?Cd:-Cd:i=(o-Math.floor(s.length/2))*Cd}return{curved:n,curveOffset:i}}function Ec(r){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let a of r)e=Math.min(e,a.position.x),t=Math.max(t,a.position.x),n=Math.min(n,a.position.y),i=Math.max(i,a.position.y),s=Math.min(s,a.position.z),o=Math.max(o,a.position.z);return{height:i-n,width:t-e,minX:e,maxX:t,minY:n,maxY:i,minZ:s,maxZ:o,x:(t+e)/2,y:(i+n)/2,z:(o+s)/2}}function wF(r,e){return e?r.reduce((t,n)=>{const i=n.data[e];return i&&t.set(i,[...t.get(i)||[],n]),t},new Map):new Map}function SF({nodes:r,clusterAttribute:e}){const t=new Map;if(e){const n=wF(r,e);for(const[i,s]of n){const o=Ec(s);t.set(i,{label:i,nodes:s,position:o})}}return t}const fg=({sensitivity:r=7,interval:e=50,timeout:t=0,disabled:n,onPointerOver:i,onPointerOut:s})=>{const o=q.useRef(!1),a=q.useRef(null),c=q.useRef(0),l=q.useRef({x:null,y:null,px:null,py:null}),u=q.useCallback(g=>{l.current.x=g.clientX,l.current.y=g.clientY},[]),h=q.useCallback(g=>{a.current=clearTimeout(a.current);const{px:p,x:_,py:y,y:x}=l.current;Math.abs(p-_)+Math.abs(y-x)h(g),e))},[e,i,r]),f=q.useCallback(()=>{clearTimeout(a.current),typeof window<"u"&&document.removeEventListener("mousemove",u,!1)},[u]),d=q.useCallback(g=>{n||(o.current=!0,f(),c.current!==1&&(l.current.px=g.pointer.x,l.current.py=g.pointer.y,typeof window<"u"&&document.addEventListener("mousemove",u,!1),a.current=setTimeout(()=>h(g),t)))},[f,h,n,u,t]),m=q.useCallback(g=>{a.current=clearTimeout(a.current),c.current=0,s(g)},[s]),v=q.useCallback(g=>{o.current=!1,f(),c.current===1&&(a.current=setTimeout(()=>m(g),t))},[f,m,t]);return{pointerOver:d,pointerOut:v}},Fw=({draggable:r,set:e,position:t,bounds:n,onDragStart:i,onDragEnd:s})=>{const o=Kt(g=>g.camera),a=Kt(g=>g.raycaster),c=Kt(g=>g.size),l=Kt(g=>g.gl),{mouse2D:u,mouse3D:h,offset:f,normal:d,plane:m}=q.useMemo(()=>({mouse2D:new be,mouse3D:new G,offset:new G,normal:new G,plane:new Qi}),[]),v=q.useMemo(()=>l.domElement.getBoundingClientRect(),[l.domElement]);return vE({onDragStart:({event:g})=>{const{eventObject:p,point:_}=g;p.getWorldPosition(f).sub(_),h.copy(_),i()},onDrag:({xy:g,buttons:p,cancel:_})=>{if(p!==1){_();return}const y=(g[0]-((v==null?void 0:v.left)??0))/c.width*2-1,x=-((g[1]-((v==null?void 0:v.top)??0))/c.height)*2+1;u.set(y,x),a.setFromCamera(u,o),o.getWorldDirection(d).negate(),m.setFromNormalAndCoplanarPoint(d,h),a.ray.intersectPlane(m,h);const b=new G(t.x,t.y,t.z).copy(h).add(f);if(n){const w=new G((n.minX+n.maxX)/2,(n.minY+n.maxY)/2,(n.minZ+n.maxZ)/2),S=(n.maxX-n.minX)/2,M=b.clone().sub(w);M.length()>S&&(M.normalize().multiplyScalar(S),b.copy(w).add(M))}return e(b)},onDragEnd:s},{drag:{enabled:r,threshold:10}})},{Provider:EF,useStore:Ue}=mU(),MF=({actives:r=[],selections:e=[],collapsedNodeIds:t=[],theme:n})=>DE(i=>({theme:{...n,edge:{...n.edge,label:{...n.edge.label,fontSize:n.edge.label.fontSize??6}}},edges:[],nodes:[],collapsedNodeIds:t,clusters:new Map,panning:!1,draggingIds:[],actives:r,edgeContextMenus:new Set,edgeMeshes:[],selections:e,hoveredNodeId:null,drags:{},graph:new St({multi:!0}),setTheme:s=>i(o=>({...o,theme:s})),setClusters:s=>i(o=>({...o,clusters:s})),setEdgeContextMenus:s=>i(o=>({...o,edgeContextMenus:s})),setEdgeMeshes:s=>i(o=>({...o,edgeMeshes:s})),setPanning:s=>i(o=>({...o,panning:s})),setDrags:s=>i(o=>({...o,drags:s})),addDraggingId:s=>i(o=>({...o,draggingIds:[...o.draggingIds,s]})),removeDraggingId:s=>i(o=>({...o,draggingIds:o.draggingIds.filter(a=>a!==s)})),setActives:s=>i(o=>({...o,actives:s})),setSelections:s=>i(o=>({...o,selections:s})),setHoveredNodeId:s=>i(o=>({...o,hoveredNodeId:s})),setNodes:s=>i(o=>({...o,nodes:s,centerPosition:Ec(s)})),setEdges:s=>i(o=>({...o,edges:s})),setNodePosition:(s,o)=>i(a=>{var c,l;const u=a.nodes.find(v=>v.id===s),h=Sc(u),d=new G(o.x,o.y,o.z).sub(h),m=[...a.nodes];if((c=a.selections)!=null&&c.includes(s))(l=a.selections)==null||l.forEach(v=>{const g=a.nodes.find(p=>p.id===v);if(g){const p=a.nodes.indexOf(g);m[p]=Ey(g,d)}});else{const v=a.nodes.indexOf(u);m[v]=Ey(u,d)}return{...a,drags:{...a.drags,[s]:u},nodes:m}}),setCollapsedNodeIds:(s=[])=>i(o=>({...o,collapsedNodeIds:s})),setClusterPosition:(s,o)=>i(a=>{const c=new Map(a.clusters),l=c.get(s);if(l){const u=l.position,h=new G(o.x-u.x,o.y-u.y,o.z-(u.z??0)),f=[...a.nodes],d={...a.drags};f.forEach((g,p)=>{g.cluster===s&&(f[p]={...g,position:{...g.position,x:g.position.x+h.x,y:g.position.y+h.y,z:g.position.z+(h.z??0)}},d[g.id]=g)});const m=f.filter(g=>g.cluster===s),v=Ec(m);return c.set(s,{...l,position:v}),{...a,drags:{...d,[s]:l},clusters:c,nodes:f}}return a})}));function kw({nodeId:r,nodes:e,edges:t,currentHiddenNodes:n,currentHiddenEdges:i}){const s=[],o=[],a=n.map(d=>d.id),c=i.map(d=>d.id),l=t.filter(d=>d.source===r),u=l.map(d=>d.target);o.push(...l);for(const d of u){const m=t.filter(g=>g.target===d&&g.source!==r);let v=!1;if((m.length===0||m.length>0&&!a.includes(d)&&m.map(p=>p.id).every(p=>c.includes(p)))&&(v=!0),v){const g=e.find(_=>_.id===d);g&&s.push(g);const p=kw({nodeId:d,nodes:e,edges:t,currentHiddenEdges:o,currentHiddenNodes:s});o.push(...p.hiddenEdges),s.push(...p.hiddenNodes)}}const h=Object.values(o.reduce((d,m)=>({...d,[m.id]:m}),{})),f=Object.values(s.reduce((d,m)=>({...d,[m.id]:m}),{}));return{hiddenEdges:h,hiddenNodes:f}}const TF=({collapsedIds:r,nodes:e,edges:t})=>{const n=[],i=[];for(const l of r){const{hiddenEdges:u,hiddenNodes:h}=kw({nodeId:l,nodes:e,edges:t,currentHiddenEdges:i,currentHiddenNodes:n});n.push(...h),i.push(...u)}const s=n.map(l=>l.id),o=i.map(l=>l.id),a=e.filter(l=>!s.includes(l.id)),c=t.filter(l=>!o.includes(l.id));return{visibleNodes:a,visibleEdges:c}},AF=({layoutType:r,sizingType:e,labelType:t,sizingAttribute:n,clusterAttribute:i,selections:s,nodes:o,edges:a,actives:c,collapsedNodeIds:l,defaultNodeSize:u,maxNodeSize:h,minNodeSize:f,layoutOverrides:d,constrainDragging:m})=>{const v=Ue(R=>R.graph),g=Ue(R=>R.clusters),p=Ue(R=>R.nodes),_=Ue(R=>R.setClusters),y=Ue(R=>R.collapsedNodeIds),x=Ue(R=>R.setEdges),b=Ue(R=>R.nodes),w=Ue(R=>R.setNodes),S=Ue(R=>R.setSelections),M=Ue(R=>R.setActives),E=Ue(R=>R.drags),T=Ue(R=>R.setDrags),L=Ue(R=>R.setCollapsedNodeIds),P=q.useRef(!1),A=q.useRef(null),z=Kt(R=>R.camera),V=q.useRef(E),N=q.useRef([]);q.useEffect(()=>{var R;if(!i)return;const F=p.map(Y=>Y.id),H=o.find(Y=>!F.includes(Y.id));if(H){const Y=H.data[i],J=g.get(Y),ie={...V.current};(R=J==null?void 0:J.nodes)==null||R.forEach(ne=>ie[ne.id]=void 0),V.current=ie,T(ie)}},[p,o,i,g,T]);const{visibleEdges:C,visibleNodes:O}=q.useMemo(()=>TF({collapsedIds:y,nodes:o,edges:a}),[y,o,a]),k=q.useCallback(R=>{const F={...V.current};R.forEach(H=>F[H.id]=H),V.current=F,T(F)},[T]),U=q.useCallback(async R=>{A.current=R||dF({...d,type:r,graph:v,drags:V.current,clusters:N==null?void 0:N.current,clusterAttribute:i}),await sF(A.current);const F=yF({graph:v,layout:A.current,sizingType:e,labelType:t,sizingAttribute:n,maxNodeSize:h,minNodeSize:f,defaultNodeSize:u,clusterAttribute:i}),H=SF({nodes:F.nodes,clusterAttribute:i});m&&H.forEach(Y=>{var J,ie;const ne=N.current.get(Y.label);(ne==null?void 0:ne.nodes.length)===Y.nodes.length&&(Y.position=((ie=(J=N.current)==null?void 0:J.get(Y.label))==null?void 0:ie.position)??Y.position)}),x(F.edges),w(F.nodes),_(H),i&&k(F.nodes)},[d,r,i,e,t,n,h,f,u,x,w,_]);return q.useEffect(()=>{V.current=E},[E,i,U]),q.useEffect(()=>{N.current=g},[g]),q.useEffect(()=>{const R=b.map(H=>({...H,labelVisible:Dw({nodeCount:b==null?void 0:b.length,labelType:t,camera:z,nodePosition:H==null?void 0:H.position})("node",H==null?void 0:H.size)}));R.some((H,Y)=>H.labelVisible!==b[Y].labelVisible)&&w(R)},[z,z.zoom,z.position.z,w,b,t]),q.useEffect(()=>{P.current&&S(s)},[s,S]),q.useEffect(()=>{P.current&&M(c)},[c,M]),q.useEffect(()=>{async function R(){P.current=!1,_F(v,O,C),await U(),requestAnimationFrame(()=>P.current=!0)}R()},[O,C]),q.useEffect(()=>{P.current&&L(l)},[l,L]),q.useEffect(()=>{P.current&&(V.current={},T({}),U())},[r,U,T]),q.useEffect(()=>{P.current&&U(A.current)},[e,n,t,U]),{updateLayout:U}},Mc=({text:r,fontSize:e=7,fontUrl:t,color:n="#2A6475",opacity:i=1,stroke:s,active:o,ellipsis:a=75,rotation:c})=>{const l=a&&!o?QN(r,a):r,u=q.useMemo(()=>new Ne(n),[n]),h=q.useMemo(()=>s?new Ne(s):void 0,[s]);return Se.jsx(yw,{position:[0,0,1],children:Se.jsx(ZN,{font:t,fontSize:e,color:u,fillOpacity:i,textAlign:"center",outlineWidth:s?1:0,outlineColor:h,depthOffset:0,maxWidth:100,overflowWrap:"break-word",rotation:c,children:l})})},CF=({color:r="#D8E6EA",size:e=1,opacity:t=.5,animated:n,strokeWidth:i=5,innerRadius:s=4,segments:o=25})=>{const a=q.useMemo(()=>new Ne(r),[r]),{ringSize:c,ringOpacity:l}=Gn({from:{ringOpacity:0,ringSize:[1e-5,1e-5,1e-5]},to:{ringOpacity:t,ringSize:[e/2,e/2,1]},config:{...Vn,duration:n?void 0:0}}),u=i/10,h=s+u;return Se.jsx(yw,{position:[0,0,1],children:Se.jsxs(Gt.mesh,{scale:c,children:[Se.jsx("ringGeometry",{attach:"geometry",args:[s,h,o]}),Se.jsx(Gt.meshBasicMaterial,{attach:"material",color:a,transparent:!0,depthTest:!1,opacity:l,side:Dt,fog:!0})]})})},RF=({color:r,id:e,size:t,selected:n,opacity:i=1,animated:s})=>{const{scale:o,nodeOpacity:a}=Gn({from:{scale:[1e-5,1e-5,1e-5],nodeOpacity:0},to:{scale:[t,t,t],nodeOpacity:i},config:{...Vn,duration:s?void 0:0}}),c=q.useMemo(()=>new Ne(r),[r]),l=Ue(u=>u.theme);return Se.jsxs(Se.Fragment,{children:[Se.jsxs(Gt.mesh,{userData:{id:e,type:"node"},scale:o,children:[Se.jsx("sphereGeometry",{attach:"geometry",args:[1,25,25]}),Se.jsx(Gt.meshPhongMaterial,{attach:"material",side:Dt,transparent:!0,fog:!0,opacity:a,color:c})]}),Se.jsx(CF,{opacity:n?.5:0,size:t,animated:s,color:n?l.ring.activeFill:l.ring.fill})]})},zw=q.createContext({controls:null,resetControls:()=>{},zoomIn:()=>{},zoomOut:()=>{},dollyIn:()=>{},dollyOut:()=>{},panLeft:()=>{},panRight:()=>{},panUp:()=>{},panDown:()=>{},freeze:()=>{},unFreeze:()=>{}}),Mh=()=>{const r=q.useContext(zw);if(r===void 0)throw new Error("`useCameraControls` hook must be used within a `ControlsProvider` component");return r};nn.install({THREE:{MOUSE:qy,Vector2:be,Vector3:G,Vector4:mt,Quaternion:ln,Matrix4:Ke,Spherical:Yb,Box3:Hn,Sphere:Wn,Raycaster:Im,MathUtils:{DEG2RAD:(_y=bu)==null?void 0:_y.DEG2RAD,clamp:(yy=bu)==null?void 0:yy.clamp}}});Zb({ThreeCameraControls:nn});const Th={ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40},My=new Eh(Th.ARROW_LEFT,100),Ty=new Eh(Th.ARROW_RIGHT,100),Ay=new Eh(Th.ARROW_UP,100),Cy=new Eh(Th.ARROW_DOWN,100),PF=q.forwardRef(({mode:r="rotate",children:e,animated:t,disabled:n,minDistance:i=1e3,maxDistance:s=5e4},o)=>{const a=q.useRef(null),c=Kt(L=>L.camera),l=Kt(L=>L.gl),u=r==="orbit",h=Ue(L=>L.setPanning),f=Ue(L=>L.draggingIds.length>0),d=q.useRef(0),[m,v]=q.useState(!1);uh((L,P)=>{var A,z;(A=a.current)!=null&&A.enabled&&((z=a.current)==null||z.update(P)),u&&(a.current.azimuthAngle+=20*P*bu.DEG2RAD)},-1),q.useEffect(()=>()=>{var L;return(L=a.current)==null?void 0:L.dispose()},[]);const g=q.useCallback(()=>{var L;(L=a.current)==null||L.zoom(c.zoom/2,t)},[t,c.zoom]),p=q.useCallback(()=>{var L;(L=a.current)==null||L.zoom(-c.zoom/2,t)},[t,c.zoom]),_=q.useCallback(L=>{var P;(P=a.current)==null||P.dolly(L,t)},[t]),y=q.useCallback(L=>{var P;(P=a.current)==null||P.dolly(L,t)},[t]),x=q.useCallback(L=>{var P;u||(P=a.current)==null||P.truck(-.03*L.deltaTime,0,t)},[t,u]),b=q.useCallback(L=>{var P;u||(P=a.current)==null||P.truck(.03*L.deltaTime,0,t)},[t,u]),w=q.useCallback(L=>{var P;u||(P=a.current)==null||P.truck(0,.03*L.deltaTime,t)},[t,u]),S=q.useCallback(L=>{var P;u||(P=a.current)==null||P.truck(0,-.03*L.deltaTime,t)},[t,u]),M=q.useCallback(L=>{L.code==="Space"&&(r==="rotate"?a.current.mouseButtons.left=nn.ACTION.TRUCK:a.current.mouseButtons.left=nn.ACTION.ROTATE)},[r]),E=q.useCallback(L=>{L.code==="Space"&&(r==="rotate"?a.current.mouseButtons.left=nn.ACTION.ROTATE:a.current.mouseButtons.left=nn.ACTION.TRUCK)},[r]);q.useEffect(()=>(n||(My.addEventListener("holding",b),Ty.addEventListener("holding",x),Ay.addEventListener("holding",w),Cy.addEventListener("holding",S),typeof window<"u"&&(window.addEventListener("keydown",M),window.addEventListener("keyup",E))),()=>{My.removeEventListener("holding",b),Ty.removeEventListener("holding",x),Ay.removeEventListener("holding",w),Cy.removeEventListener("holding",S),typeof window<"u"&&(window.removeEventListener("keydown",M),window.removeEventListener("keyup",E))}),[n,M,E,S,b,x,w]),q.useEffect(()=>{n?(a.current.mouseButtons.left=nn.ACTION.NONE,a.current.mouseButtons.middle=nn.ACTION.NONE,a.current.mouseButtons.wheel=nn.ACTION.NONE):(a.current.mouseButtons.left=nn.ACTION.TRUCK,a.current.mouseButtons.middle=nn.ACTION.TRUCK,a.current.mouseButtons.wheel=nn.ACTION.DOLLY)},[n]),q.useEffect(()=>{const L=()=>h(!0),P=()=>h(!1),A=a.current;return A&&(A.addEventListener("control",L),A.addEventListener("controlend",P)),()=>{A&&(A.removeEventListener("control",L),A.removeEventListener("controlend",P))}},[a,h]),q.useEffect(()=>{f?(a.current.mouseButtons.left=nn.ACTION.NONE,a.current.touches.one=nn.ACTION.NONE):r==="rotate"?(a.current.mouseButtons.left=nn.ACTION.ROTATE,a.current.touches.one=nn.ACTION.TOUCH_ROTATE):(a.current.touches.one=nn.ACTION.TOUCH_TRUCK,a.current.mouseButtons.left=nn.ACTION.TRUCK)},[f,r]);const T=q.useMemo(()=>({controls:a.current,zoomIn:()=>g(),zoomOut:()=>p(),dollyIn:(L=1e3)=>_(L),dollyOut:(L=-1e3)=>y(L),panLeft:(L=100)=>b({deltaTime:L}),panRight:(L=100)=>x({deltaTime:L}),panDown:(L=100)=>S({deltaTime:L}),panUp:(L=100)=>w({deltaTime:L}),resetControls:L=>{var P;return(P=a.current)==null?void 0:P.reset(L)},freeze:()=>{a.current.truckSpeed&&(d.current=a.current.truckSpeed),a.current.truckSpeed=0},unFreeze:()=>a.current.truckSpeed=d.current}),[g,p,b,x,S,w,a.current]);return q.useImperativeHandle(o,()=>T),Se.jsxs(zw.Provider,{value:T,children:[Se.jsx("threeCameraControls",{ref:L=>{a.current=L,m||v(!0)},args:[c,l.domElement],smoothTime:.1,minDistance:i,dollyToCursor:!0,maxDistance:s}),e]})});function Bw(r,e){const t=e.position.z;rc.x0&&(e==null?void 0:e.x)c.y0&&(e==null?void 0:e.y)Math.abs(n-r%Math.PI){const n=Ue(v=>v.nodes),[i,s]=q.useState(!1),o=Kt(v=>v.invalidate),{controls:a}=Mh(),c=Kt(v=>v.camera),l=q.useRef(!1),u=q.useCallback(async(v,g)=>{const p=(g==null?void 0:g.animated)!==void 0?g==null?void 0:g.animated:!0,_=(g==null?void 0:g.centerOnlyIfNodesNotInView)!==void 0?g==null?void 0:g.centerOnlyIfNodesNotInView:!1;if(!l.current||!_||_&&(v!=null&&v.some(y=>!Ry(c,y.position)))){const{x:y,y:x,z:b}=Ec(v);await a.setTarget(y,x,b,p),i||s(!0),o()}},[o,a,n]),h=q.useCallback(async(v,g={animated:!0,fitOnlyIfNodesNotInView:!1})=>{const{fitOnlyIfNodesNotInView:p}=g;if(!p||p&&(v!=null&&v.some(_=>!Ry(c,_.position)))){const{minX:_,maxX:y,minY:x,maxY:b,minZ:w,maxZ:S}=Ec(v);if(!t.includes("3d")){const{horizontalRotation:M,verticalRotation:E}=DF(a==null?void 0:a.azimuthAngle,a==null?void 0:a.polarAngle);a==null||a.rotate(M,E,!0)}await(a==null?void 0:a.zoomTo(1,g==null?void 0:g.animated)),await(a==null?void 0:a.fitToBox(new Hn(new G(_,x,w),new G(y,b,S)),g==null?void 0:g.animated,{cover:!1,paddingLeft:Ql,paddingRight:Ql,paddingBottom:Ql,paddingTop:Ql}))}},[c,a,t]),f=q.useCallback(v=>{let g=null;return v!=null&&v.length&&(g=v.reduce((p,_)=>{const y=n.find(x=>x.id===_);if(y)p.push(y);else throw new Error(`Attempted to center ${_} but it was not found in the nodes`);return p},[])),g},[n]),d=q.useCallback((v,g)=>{const p=f(v);u(p||n,{animated:r,centerOnlyIfNodesNotInView:g==null?void 0:g.centerOnlyIfNodesNotInView})},[r,u,f,n]),m=q.useCallback(async(v,g)=>{const p=f(v);await h(p||n,{animated:r,...g})},[r,h,f,n]);return q.useLayoutEffect(()=>{async function v(){a&&(n!=null&&n.length)&&(l.current||(await u(n,{animated:!1}),await h(n,{animated:!1}),l.current=!0))}v()},[a,u,n,r,c,h]),{centerNodes:u,centerNodesById:d,fitNodesInViewById:m,isCentered:i}},UF=({image:r,id:e,size:t,opacity:n=1,animated:i})=>{const s=q.useMemo(()=>new Ob().load(r),[r]),{scale:o,spriteOpacity:a}=Gn({from:{scale:[1e-5,1e-5,1e-5],spriteOpacity:0},to:{scale:[t,t,t],spriteOpacity:n},config:{...Vn,duration:i?void 0:0}});return Se.jsx(Gt.sprite,{userData:{id:e,type:"node"},scale:o,children:Se.jsx(Gt.spriteMaterial,{attach:"material",opacity:a,fog:!0,depthTest:!1,transparent:!0,side:Dt,children:Se.jsx("primitive",{attach:"map",object:s,minFilter:Pt})})})},OF=({animated:r,disabled:e,id:t,draggable:n=!1,labelFontUrl:i,contextMenu:s,onClick:o,onDoubleClick:a,onPointerOver:c,onDragged:l,onPointerOut:u,onContextMenu:h,renderNode:f,constrainDragging:d})=>{var m,v,g;const p=Mh(),_=Ue($=>$.theme),y=Ue($=>$.nodes.find(he=>he.id===t)),x=Ue($=>$.edges),b=Ue($=>$.draggingIds),w=Ue($=>$.collapsedNodeIds),S=Ue($=>$.addDraggingId),M=Ue($=>$.removeDraggingId),E=Ue($=>$.setHoveredNodeId),T=Ue($=>$.setNodePosition),L=Ue($=>$.setCollapsedNodeIds),P=Ue($=>$.collapsedNodeIds.includes(t)),A=Ue($=>{var he;return(he=$.actives)==null?void 0:he.includes(t)}),z=Ue($=>{var he;return(he=$.selections)==null?void 0:he.includes(t)}),V=Ue($=>{var he;return((he=$.selections)==null?void 0:he.length)>0}),N=Ue($=>$.centerPosition),C=Ue($=>$.clusters.get(y.cluster)),O=b.includes(t),k=b.length>0,{position:U,label:R,subLabel:F,size:H=7,labelVisible:Y=!0}=y,J=q.useRef(null),[ie,ne]=q.useState(!1),[ee,ge]=q.useState(!1),me=ie||z||A,te=V?me?_.node.selectedOpacity:_.node.inactiveOpacity:_.node.opacity,D=q.useMemo(()=>x.filter(he=>he.source===t).length>0||P,[x,t,P]),Q=q.useCallback(()=>{D&&L(P?w.filter($=>$!==t):[...w,t])},[D,w,t,P,L]),[{nodePosition:j,labelPosition:K,subLabelPosition:W}]=Gn(()=>({from:{nodePosition:N?[N.x,N.y,0]:[0,0,0],labelPosition:[0,-(H+7),2],subLabelPosition:[0,-(H+14),2]},to:{nodePosition:U?[U.x,U.y,me?U.z+1:U.z]:[0,0,0],labelPosition:[0,-(H+7),2],subLabelPosition:[0,-(H+14),2]},config:{...Vn,duration:r&&!k?void 0:0}}),[O,U,r,H,me]),ye=Fw({draggable:n,position:U,bounds:d?C==null?void 0:C.position:void 0,set:$=>T(t,$),onDragStart:()=>{S(t),ne(!0)},onDragEnd:()=>{M(t),l==null||l(y)}});ds(ie&&!k&&o!==void 0,"pointer"),ds(ie&&n&&!O&&o===void 0,"grab"),ds(O,"grabbing");const re=me||O,fe=re?_.node.activeFill:y.fill||_.node.fill,{pointerOver:xe,pointerOut:ce}=fg({disabled:e||O,onPointerOver:$=>{p.freeze(),ne(!0),c==null||c(y,$),E(t)},onPointerOut:$=>{p.unFreeze(),ne(!1),u==null||u(y,$),E(null)}}),Pe=q.useMemo(()=>f?f({id:t,color:fe,size:H,active:re,opacity:te,animated:r,selected:z,node:y}):Se.jsx(Se.Fragment,{children:y.icon?Se.jsx(UF,{id:t,image:y.icon||"",size:H+8,opacity:te,animated:r,color:fe,node:y,active:re,selected:z}):Se.jsx(RF,{id:t,size:H,opacity:te,animated:r,color:fe,node:y,active:re,selected:z})}),[f,t,fe,H,re,te,r,z,y]),B=q.useMemo(()=>{var $,he,de;return Y&&(Y||z||ie)&&R&&Se.jsxs(Se.Fragment,{children:[Se.jsx(Gt.group,{position:K,children:Se.jsx(Mc,{text:R,fontUrl:i,opacity:te,stroke:_.node.label.stroke,active:z||ie||O||A,color:z||ie||O||A?_.node.label.activeColor:_.node.label.color})}),F&&Se.jsx(Gt.group,{position:W,children:Se.jsx(Mc,{text:F,fontUrl:i,fontSize:5,opacity:te,stroke:($=_.node.subLabel)==null?void 0:$.stroke,active:z||ie||O||A,color:z||ie||O||A?(he=_.node.subLabel)==null?void 0:he.activeColor:(de=_.node.subLabel)==null?void 0:de.color})})]})},[ie,A,O,z,R,i,K,Y,te,F,W,_.node.label.activeColor,_.node.label.color,_.node.label.stroke,(m=_.node.subLabel)==null?void 0:m.activeColor,(v=_.node.subLabel)==null?void 0:v.color,(g=_.node.subLabel)==null?void 0:g.stroke]),I=q.useMemo(()=>ee&&s&&Se.jsx(jm,{prepend:!0,center:!0,children:s({data:y,canCollapse:D,isCollapsed:P,onCollapse:Q,onClose:()=>ge(!1)})}),[ee,s,y,D,P,Q]);return Se.jsxs(Gt.group,{renderOrder:1,userData:{id:t,type:"node"},ref:J,position:j,onPointerOver:xe,onPointerOut:ce,onClick:$=>{!e&&!O&&(o==null||o(y,{canCollapse:D,isCollapsed:P},$))},onDoubleClick:$=>{!e&&!O&&(a==null||a(y,$))},onContextMenu:()=>{e||(ge(!0),h==null||h(y,{canCollapse:D,isCollapsed:P,onCollapse:Q}))},...ye(),children:[Pe,I,B]})},NF=({animated:r,color:e="#D8E6EA",length:t,opacity:n=.5,position:i,rotation:s,size:o=1,onActive:a,onContextMenu:c})=>{const l=q.useMemo(()=>new Ne(e),[e]),u=q.useRef(null),h=Ue(g=>g.draggingIds.length>0),f=Ue(g=>g.centerPosition),[{pos:d,arrowOpacity:m}]=Gn(()=>({from:{pos:f?[f.x,f.y,f.z]:[0,0,0],arrowOpacity:0},to:{pos:[i.x,i.y,i.z],arrowOpacity:n},config:{...Vn,duration:r&&!h?void 0:0}}),[r,h,n,i]),v=q.useCallback(()=>{var g;const p=new G(0,1,0);(g=u.current)==null||g.quaternion.setFromUnitVectors(p,s)},[s,u]);return q.useEffect(()=>v(),[v]),Se.jsxs(Gt.mesh,{position:d,ref:u,scale:[1,1,1],onPointerOver:()=>a(!0),onPointerOut:()=>a(!1),onPointerDown:g=>{g.nativeEvent.buttons===2&&(g.stopPropagation(),c())},children:[Se.jsx("cylinderGeometry",{args:[0,o,t,20,1,!0],attach:"geometry"}),Se.jsx(Gt.meshBasicMaterial,{attach:"material",color:l,depthTest:!1,opacity:m,transparent:!0,side:Dt,fog:!0})]})},FF=({curveOffset:r,animated:e,color:t="#000",curve:n,curved:i=!1,id:s,opacity:o=1,size:a=1,onContextMenu:c,onClick:l,onPointerOver:u,onPointerOut:h})=>{const f=q.useRef(null),d=Ue(_=>_.draggingIds.length>0),m=q.useMemo(()=>new Ne(t),[t]),v=Ue(_=>_.centerPosition),g=q.useRef(!1),{lineOpacity:p}=Gn({from:{lineOpacity:0},to:{lineOpacity:o},config:{...Vn,duration:e?void 0:0}});return Gn(()=>{const _=n.getPoint(0),y=n.getPoint(1);return{from:{fromVertices:g.current?[y==null?void 0:y.x,y==null?void 0:y.y,(y==null?void 0:y.z)||0]:[v==null?void 0:v.x,v==null?void 0:v.y,(v==null?void 0:v.z)||0],toVertices:[_==null?void 0:_.x,_==null?void 0:_.y,(_==null?void 0:_.z)||0]},to:{fromVertices:[_==null?void 0:_.x,_==null?void 0:_.y,(_==null?void 0:_.z)||0],toVertices:[y==null?void 0:y.x,y==null?void 0:y.y,(y==null?void 0:y.z)||0]},onChange:x=>{const{fromVertices:b,toVertices:w}=x.value,S=new G(...b),M=new G(...w),E=wc(S,0,M,0,i,r);f.current.copy(new ys(E,20,a/2,5,!1))},config:{...Vn,duration:e&&!d?void 0:0}}},[e,d,n,a]),q.useEffect(()=>{g.current=!0},[]),Se.jsxs("mesh",{userData:{id:s,type:"edge"},onPointerOver:u,onPointerOut:h,onClick:l,onPointerDown:_=>{_.nativeEvent.buttons===2&&(_.stopPropagation(),c())},children:[Se.jsx("tubeGeometry",{attach:"geometry",ref:f}),Se.jsx(Gt.meshBasicMaterial,{attach:"material",opacity:p,fog:!0,transparent:!0,depthTest:!1,color:m})]})},Ly=3,kF=({animated:r,arrowPlacement:e="end",contextMenu:t,disabled:n,labelPlacement:i="inline",id:s,interpolation:o,labelFontUrl:a,onContextMenu:c,onClick:l,onPointerOver:u,onPointerOut:h})=>{const f=Ue(Q=>Q.theme),d=Ue(Q=>Q.draggingIds.length>0),[m,v]=q.useState(!1),[g,p]=q.useState(!1),_=Ue(Q=>Q.edges),y=_.find(Q=>Q.id===s),{target:x,source:b,label:w,labelVisible:S=!1,size:M=1,fill:E}=y,T=Ue(Q=>Q.nodes.find(j=>j.id===b)),L=Ue(Q=>Q.nodes.find(j=>j.id===x)),P=(M+f.edge.label.fontSize)/2,[A,z]=q.useMemo(()=>Ow(M),[M]),{curveOffset:V,curved:N}=q.useMemo(()=>bF({edge:y,edges:_,curved:o==="curved"}),[y,_,o]),[C,O,k]=q.useMemo(()=>{const Q=Sc(T),j=T.size,K=Sc(L),W=L.size;let ye=wc(Q,j,K,W,N,V);const[re,fe]=Uw(e,ye,A);return e==="end"&&(ye=wc(Q,j,re,0,N,V)),[ye,re,fe]},[T,L,N,V,e,A]),U=q.useMemo(()=>{let Q=Nw(T.position,L.position,Iw(P,i));if(N){const j=new G().subVectors(Q,C.getPoint(.5));switch(i){case"above":j.y=j.y-Ly;break;case"below":j.y=j.y+Ly;break}Q=Q.sub(j)}return Q},[T.position,L.position,P,i,N,C]),R=Ue(Q=>{var j;return(j=Q.selections)==null?void 0:j.includes(s)}),F=Ue(Q=>{var j;return(j=Q.selections)==null?void 0:j.length}),H=Ue(Q=>{var j;return(j=Q.actives)==null?void 0:j.includes(s)}),Y=Ue(Q=>Q.centerPosition),J=F?R||H?f.edge.selectedOpacity:f.edge.inactiveOpacity:f.edge.opacity,[{labelPosition:ie}]=Gn(()=>({from:{labelPosition:Y?[Y.x,Y.y,Y.z]:[0,0,0]},to:{labelPosition:[U.x,U.y,U.z]},config:{...Vn,duration:r&&!d?void 0:0}}),[U,r,d]),ne=q.useMemo(()=>new Ir(0,0,i==="natural"?0:Math.atan((L.position.y-T.position.y)/(L.position.x-T.position.x))),[L.position.x,L.position.y,T.position.x,T.position.y,i]);ds(m&&!d&&l!==void 0,"pointer");const{pointerOver:ee,pointerOut:ge}=fg({disabled:n,onPointerOver:Q=>{v(!0),u==null||u(y,Q)},onPointerOut:Q=>{v(!1),h==null||h(y,Q)}}),me=q.useMemo(()=>e!=="none"&&Se.jsx(NF,{animated:r,color:R||m||H?f.arrow.activeFill:E||f.arrow.fill,length:A,opacity:J,position:O,rotation:k,size:z,onActive:v,onContextMenu:()=>{n||(p(!0),c==null||c(y))}}),[E,m,r,A,e,O,k,z,n,y,H,R,c,J,f.arrow.activeFill,f.arrow.fill]),te=q.useMemo(()=>S&&w&&Se.jsx(Gt.group,{position:ie,onContextMenu:()=>{n||(p(!0),c==null||c(y))},onPointerOver:ee,onPointerOut:ge,children:Se.jsx(Mc,{text:w,ellipsis:15,fontUrl:a,stroke:f.edge.label.stroke,color:R||m||H?f.edge.label.activeColor:f.edge.label.color,opacity:J,fontSize:f.edge.label.fontSize,rotation:ne})}),[m,n,y,H,R,w,a,ie,ne,S,c,ge,ee,J,f.edge.label.activeColor,f.edge.label.color,f.edge.label.fontSize,f.edge.label.stroke]),D=q.useMemo(()=>g&&t&&Se.jsx(jm,{prepend:!0,center:!0,position:U,children:t({data:y,onClose:()=>p(!1)})}),[g,t,U,y]);return Se.jsxs("group",{children:[Se.jsx(FF,{curveOffset:V,animated:r,color:R||m||H?f.edge.activeFill:E||f.edge.fill,curve:C,curved:N,id:s,opacity:J,size:M,onClick:Q=>{n||l==null||l(y,Q)},onPointerOver:ee,onPointerOut:ge,onContextMenu:()=>{n||(p(!0),c==null||c(y))}}),me,te,D]})},Dy=new lr(0,0,0);function zF(r,e){const t=q.useRef(),n=Ue(l=>l.theme);Ue(l=>{t.current=l});const i=q.useRef(new Map);q.useRef(new lr(0,0,0));const s=q.useRef(),o=e==="curved",a=q.useCallback(l=>{const u=[],h=i.current,{nodes:f}=t.current,d=new Map(f.map(v=>[v.id,v])),m=n.edge.label.fontSize;return r!=="none"&&!s.current&&(s.current=new Ts(0,1,1,20,1,!0)),l.forEach(v=>{const{target:g,source:p,size:_=1}=v,y=d.get(p),x=d.get(g);if(!y||!x)return;const b=`${y.position.x},${y.position.y},${x.position.x},${x.position.y},${_}`;if(h.has(b)){u.push(h.get(b));return}const w=Sc(y),S=y.size+m,M=Sc(x),E=x.size+m;let T=wc(w,S,M,E,o),L=new ys(T,20,_/2,5,!1);if(r==="none"){u.push(L),h.set(b,L);return}const[P,A]=Ow(_),z=s.current.clone();z.scale(A,P,A);const[V,N]=Uw(r,T,P),C=new ln;if(C.setFromUnitVectors(new G(0,1,0),N),z.applyQuaternion(C),z.translate(V.x,V.y,V.z),r&&r==="end"){const k=wc(w,S,V,0,o);L=new ys(k,20,_/2,5,!1)}const O=Kc([L,z]);u.push(O),h.set(b,O)}),u},[r,o,n.edge.label.fontSize]),c=q.useCallback((l,u)=>{const h=a(l),f=a(u);return Kc([f.length?Kc(f):Dy,h.length?Kc(h):Dy],!0)},[a]);return{getGeometries:a,getGeometry:c}}function BF(r,e,t){const n=q.useRef(r);q.useEffect(()=>{n.current=r},[r]);const i=Ue(h=>h.edgeContextMenus),s=Ue(q.useCallback(h=>h.setEdgeContextMenus,[])),o=q.useRef(!1),a=q.useCallback(()=>{o.current=!0},[]),c=q.useRef(!1),l=q.useCallback(()=>{c.current=!0},[]),u=q.useCallback((h,f)=>{const{onClick:d,onContextMenu:m,onPointerOver:v,onPointerOut:g}=n.current;if(d&&o.current&&!t){o.current=!1;for(const p of f)d(p)}if((e||m)&&c.current&&!t){c.current=!1;const p=new Set(i);let _=!1;for(const y of f)i.has(y.id)||(p.add(y.id),_=!0,m==null||m(y));_&&s(p)}v&&f.filter(_=>!h.includes(_)).forEach(_=>{v(_)}),g&&h.filter(_=>!f.includes(_)).forEach(_=>{g(_)})},[e,t,i,s]);return{handleClick:a,handleContextMenu:l,handleIntersections:u}}function GF(r,e){const t=q.useRef(r),n=q.useRef();q.useEffect(()=>{t.current=r;const o=r.getAttribute("position");n.current=new Float32Array(o.array.length)},[r]);const i=q.useCallback(()=>{const o=t.current.getAttribute("position");return{from:new Float32Array(o.array.length),to:o.array}},[]),s=q.useCallback(o=>{const a=n.current;a.set(o);const c=new wt(a,3,!1);t.current.setAttribute("position",c),c.needsUpdate=!0},[]);Gn(()=>{if(!e)return null;const o=i();return{from:{positions:o.from},to:{positions:o.to},onChange:a=>{s(a.value.positions)},config:{...Vn,duration:e?void 0:0}}},[e,i,s])}function VF(r,e,t){const[{activeOpacity:n,inactiveOpacity:i}]=Gn(()=>({from:{activeOpacity:0,inactiveOpacity:0},to:{activeOpacity:e?t.edge.selectedOpacity:t.edge.opacity,inactiveOpacity:e?t.edge.inactiveOpacity:t.edge.opacity},config:{...Vn,duration:r?void 0:0}}),[r,e,t]);return{activeOpacity:n,inactiveOpacity:i}}const HF=({animated:r,color:e,contextMenu:t,edge:n,labelFontUrl:i,labelPlacement:s="inline",opacity:o})=>{const a=Ue(T=>T.theme),{target:c,source:l,label:u,labelVisible:h=!1,size:f=1}=n,d=Ue(T=>T.nodes),[m,v]=q.useMemo(()=>[d.find(T=>T.id===l),d.find(T=>T.id===c)],[d,l,c]),g=Ue(T=>T.draggingIds.length>0),p=q.useMemo(()=>(f+a.edge.label.fontSize)/2,[f,a.edge.label.fontSize]),_=q.useMemo(()=>Nw(m.position,v.position,Iw(p,s)),[m.position,v.position,p,s]),y=Ue(T=>T.edgeContextMenus),x=Ue(T=>T.setEdgeContextMenus),[{labelPosition:b}]=Gn(()=>({from:{labelPosition:[0,0,0]},to:{labelPosition:[_.x,_.y,_.z]},config:{...Vn,duration:r&&!g?void 0:0}}),[_,r,g]),w=q.useCallback(T=>{y.delete(T),x(new Set(y))},[y,x]),S=q.useMemo(()=>s==="natural"?new Ir(0,0,0):new Ir(0,0,Math.atan2(v.position.y-m.position.y,v.position.x-m.position.x)),[s,v.position.y,v.position.x,m.position.y,m.position.x]),M=q.useMemo(()=>({prepend:!0,center:!0,position:_}),[_]),E=q.useMemo(()=>({text:u,ellipsis:15,fontUrl:i,stroke:a.edge.label.stroke,color:e,opacity:o,fontSize:a.edge.label.fontSize,rotation:S}),[u,i,a.edge.label.stroke,e,o,a.edge.label.fontSize,S]);return Se.jsxs("group",{children:[h&&u&&Se.jsx(Gt.group,{position:b,children:Se.jsx(Mc,{...E})}),t&&y.has(n.id)&&Se.jsx(jm,{...M,children:t({data:n,onClose:()=>w(n.id)})})]})},WF=({interpolation:r="linear",arrowPlacement:e="end",labelPlacement:t="inline",animated:n,contextMenu:i,disabled:s,edges:o,labelFontUrl:a,onClick:c,onContextMenu:l,onPointerOut:u,onPointerOver:h})=>{const f=Ue(U=>U.theme),{getGeometries:d,getGeometry:m}=zF(e,r),v=Ue(U=>U.draggingIds),g=Ue(U=>U.edgeMeshes),p=Ue(U=>U.setEdgeMeshes),_=Ue(U=>U.actives||[]),y=Ue(U=>U.selections||[]),[x,b,w,S]=q.useMemo(()=>{const U=[],R=[],F=[],H=[];return o.forEach(Y=>{if(v.includes(Y.source)||v.includes(Y.target)){y.includes(Y.id)||_.includes(Y.id)?F.push(Y):H.push(Y);return}y.includes(Y.id)||_.includes(Y.id)?U.push(Y):R.push(Y)}),[U,R,F,H]},[o,_,y,v]),M=!!y.length,E=q.useMemo(()=>m(x,b),[m,x,b]),{activeOpacity:T,inactiveOpacity:L}=VF(n,M,f);GF(E,n),q.useEffect(()=>{if(v.length===0){const R=d(o).map(F=>new Ot(F));p(R)}},[d,p,o,v.length]);const P=q.useRef(new Ot),A=q.useRef(new Ot),z=q.useCallback(U=>{if(!U.camera)return[];const R=U.intersectObjects(g);return R.length?R.map(F=>o[g.indexOf(F.object)]):[]},[g,o]),{handleClick:V,handleContextMenu:N,handleIntersections:C}=BF({onClick:c,onContextMenu:l,onPointerOut:u,onPointerOver:h},i,s),O=q.useRef([]),k=q.useRef([]);return uh(U=>{if(P.current.geometry=E,s)return;const R=O.current;if((v.length||v.length===0&&R!==null)&&(A.current.geometry=m(w,S)),O.current=v,v.length)return;const F=k.current,H=z(U.raycaster);C(F,H),H.join()!==F.join()&&(A.current.geometry=m(H,[])),k.current=H}),Se.jsxs("group",{onClick:V,onContextMenu:N,children:[Se.jsxs("mesh",{ref:P,children:[Se.jsx(Gt.meshBasicMaterial,{attach:"material-0",color:f.edge.fill,depthTest:!1,fog:!0,opacity:L,side:Dt,transparent:!0}),Se.jsx(Gt.meshBasicMaterial,{attach:"material-1",color:f.edge.activeFill,depthTest:!1,fog:!0,opacity:T,side:Dt,transparent:!0})]}),Se.jsxs("mesh",{ref:A,children:[Se.jsx(Gt.meshBasicMaterial,{attach:"material-0",color:f.edge.fill,depthTest:!1,fog:!0,opacity:L,side:Dt,transparent:!0}),Se.jsx(Gt.meshBasicMaterial,{attach:"material-1",color:f.edge.activeFill,depthTest:!1,fog:!0,opacity:T,side:Dt,transparent:!0})]}),o.map(U=>Se.jsx(HF,{animated:n,contextMenu:i,color:f.edge.label.color,disabled:s,edge:U,labelFontUrl:a,labelPlacement:t},U.id))]})},XF=({outerRadius:r,innerRadius:e,padding:t,normalizedFill:n,normalizedStroke:i,opacity:s,animated:o,theme:a})=>{var c;const{opacity:l}=Gn({from:{opacity:0},to:{opacity:s},config:{...Vn,duration:o?void 0:0}});return Se.jsxs(Se.Fragment,{children:[Se.jsxs("mesh",{children:[Se.jsx("ringGeometry",{attach:"geometry",args:[r,0,128]}),Se.jsx(Gt.meshBasicMaterial,{attach:"material",color:n,transparent:!0,depthTest:!1,opacity:(c=a.cluster)!=null&&c.fill?l:0,side:Dt,fog:!0})]}),Se.jsxs("mesh",{children:[Se.jsx("ringGeometry",{attach:"geometry",args:[r,e+t,128]}),Se.jsx(Gt.meshBasicMaterial,{attach:"material",color:i,transparent:!0,depthTest:!1,opacity:l,side:Dt,fog:!0})]})]})},qF=({animated:r,position:e,padding:t=40,labelFontUrl:n,disabled:i,radius:s=2,nodes:o,label:a,onClick:c,onPointerOver:l,onPointerOut:u,draggable:h=!1,onDragged:f,onRender:d})=>{var m,v,g,p,_,y,x;const b=Ue(D=>D.theme),w=Math.max(e.width,e.height)/2,S=w-s+t,[M,E]=q.useState(!1),T=Ue(D=>D.centerPosition),L=Ue(D=>D.nodes),P=Mh(),A=Ue(D=>D.draggingIds),z=A.includes(a),V=A.length>0,N=Ue(D=>{var Q;return(Q=D.actives)==null?void 0:Q.some(j=>o.some(K=>K.id===j))}),C=Ue(D=>D.hoveredNodeId),O=Ue(D=>{var Q;return(Q=D.selections)==null?void 0:Q.some(j=>o.some(K=>K.id===j))}),U=Ue(D=>{var Q;return((Q=D.selections)==null?void 0:Q.length)>0})?O||M||N?(m=b.cluster)==null?void 0:m.selectedOpacity:(v=b.cluster)==null?void 0:v.inactiveOpacity:(g=b.cluster)==null?void 0:g.opacity,R=q.useMemo(()=>{var D,Q;const j=[0,-S,2],K=(Q=(D=b.cluster)==null?void 0:D.label)==null?void 0:Q.offset;return K?[j[0]-K[0],j[1]-K[1],j[2]-K[2]]:j},[S,(_=(p=b.cluster)==null?void 0:p.label)==null?void 0:_.offset]),{circlePosition:F}=Gn({from:{circlePosition:[T.x,T.y,-1]},to:{circlePosition:e?[e.x,e.y,-1]:[0,0,-1]},config:{...Vn,duration:r&&!V?void 0:0}}),H=q.useMemo(()=>{var D;return new Ne((D=b.cluster)==null?void 0:D.stroke)},[(y=b.cluster)==null?void 0:y.stroke]),Y=q.useMemo(()=>{var D;return new Ne((D=b.cluster)==null?void 0:D.fill)},[(x=b.cluster)==null?void 0:x.fill]),J=Ue(D=>D.addDraggingId),ie=Ue(D=>D.removeDraggingId),ne=Ue(D=>D.setClusterPosition),ee=Fw({draggable:h&&!C,position:{x:e.x,y:e.y,z:-1},set:D=>ne(a,D),onDragStart:()=>{J(a),E(!0)},onDragEnd:()=>{ie(a),E(!1);const D=L.filter(Q=>Q.cluster===a);f==null||f({nodes:D,label:a})}});ds(M&&!V&&c!==void 0,"pointer"),ds(M&&h&&!z&&c===void 0,"grab"),ds(z,"grabbing");const{pointerOver:ge,pointerOut:me}=fg({disabled:i,onPointerOver:D=>{E(!0),P.freeze(),l==null||l({nodes:o,label:a},D)},onPointerOut:D=>{E(!1),P.unFreeze(),u==null||u({nodes:o,label:a},D)}});return q.useMemo(()=>{var D,Q,j;return b.cluster&&Se.jsx(Gt.group,{userData:{id:a,type:"cluster"},position:F,onPointerOver:ge,onPointerOut:me,onClick:K=>{!i&&!z&&(c==null||c({nodes:o,label:a},K))},...ee(),children:d?d({label:{position:R,text:a,opacity:U,fontUrl:n},opacity:U,outerRadius:S,innerRadius:w,padding:t,theme:b}):Se.jsxs(Se.Fragment,{children:[Se.jsx(XF,{outerRadius:S,innerRadius:w,padding:t,normalizedFill:Y,normalizedStroke:H,opacity:U,animated:r,theme:b}),((D=b.cluster)==null?void 0:D.label)&&Se.jsx(Gt.group,{position:R,children:Se.jsx(Mc,{text:a,opacity:U,fontUrl:n,stroke:b.cluster.label.stroke,active:!1,color:(Q=b.cluster)==null?void 0:Q.label.color,fontSize:((j=b.cluster)==null?void 0:j.label.fontSize)??12})})]})})},[b,F,ge,me,S,Y,w,t,H,R,a,U,n,i,c,o,ee,z,d,r])},YF=q.forwardRef(({onNodeClick:r,onNodeDoubleClick:e,onNodeContextMenu:t,onEdgeContextMenu:n,onEdgeClick:i,onEdgePointerOver:s,onEdgePointerOut:o,onNodePointerOver:a,onNodePointerOut:c,onClusterClick:l,onNodeDragged:u,onClusterDragged:h,onClusterPointerOver:f,onClusterPointerOut:d,contextMenu:m,animated:v,disabled:g,draggable:p,constrainDragging:_=!1,edgeLabelPosition:y,edgeArrowPosition:x,edgeInterpolation:b="linear",labelFontUrl:w,renderNode:S,onRenderCluster:M,...E},T)=>{const{layoutType:L,clusterAttribute:P}=E,A=Kt(ee=>ee.gl),z=Kt(ee=>ee.scene),V=Kt(ee=>ee.camera),{updateLayout:N}=AF({...E,constrainDragging:_});if(P&&!(L==="forceDirected2d"||L==="forceDirected3d"))throw new Error("Clustering is only supported for the force directed layouts.");const C=Ue(ee=>ee.graph),O=Ue(ee=>ee.nodes),k=Ue(ee=>ee.edges),U=Ue(ee=>[...ee.clusters.values()]),{centerNodesById:R,fitNodesInViewById:F,isCentered:H}=IF({animated:v,disabled:g,layoutType:L});q.useImperativeHandle(T,()=>({centerGraph:R,fitNodesInView:F,graph:C,renderScene:()=>A.render(z,V)}),[R,F,C,A,z,V]);const Y=q.useCallback(ee=>{u==null||u(ee),P&&N()},[P,u,N]),J=q.useMemo(()=>O.map(ee=>Se.jsx(OF,{id:ee==null?void 0:ee.id,labelFontUrl:w,draggable:p,constrainDragging:_,disabled:g,animated:v,contextMenu:m,renderNode:S,onClick:r,onDoubleClick:e,onContextMenu:t,onPointerOver:a,onPointerOut:c,onDragged:Y},ee==null?void 0:ee.id)),[_,v,m,g,p,w,O,r,t,e,Y,c,a,S]),ie=q.useMemo(()=>v?k.map(ee=>Se.jsx(kF,{id:ee.id,disabled:g,animated:v,labelFontUrl:w,labelPlacement:y,arrowPlacement:x,interpolation:b,contextMenu:m,onClick:i,onContextMenu:n,onPointerOver:s,onPointerOut:o},ee.id)):Se.jsx(WF,{edges:k,disabled:g,animated:v,labelFontUrl:w,labelPlacement:y,arrowPlacement:x,interpolation:b,contextMenu:m,onClick:i,onContextMenu:n,onPointerOver:s,onPointerOut:o}),[v,m,g,x,b,y,k,w,i,n,o,s]),ne=q.useMemo(()=>U.map(ee=>Se.jsx(qF,{animated:v,disabled:g,draggable:p,labelFontUrl:w,onClick:l,onPointerOver:f,onPointerOut:d,onDragged:h,onRender:M,...ee},ee.label)),[v,U,g,p,w,l,d,f,h,M]);return H&&Se.jsxs(q.Fragment,{children:[ie,J,ne]})}),jF={canvas:{background:"#1E2026"},node:{fill:"#7A8C9E",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{stroke:"#1E2026",color:"#ACBAC7",activeColor:"#1DE9AC"},subLabel:{stroke:"#1E2026",color:"#ACBAC7",activeColor:"#1DE9AC"}},lasso:{border:"1px solid #55aaff",background:"rgba(75, 160, 255, 0.1)"},ring:{fill:"#54616D",activeFill:"#1DE9AC"},edge:{fill:"#474B56",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#1E2026",color:"#ACBAC7",activeColor:"#1DE9AC",fontSize:6}},arrow:{fill:"#474B56",activeFill:"#1DE9AC"},cluster:{stroke:"#474B56",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#1E2026",color:"#ACBAC7"}}},$F={canvas:{background:"#fff"},node:{fill:"#7CA0AB",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{color:"#2A6475",stroke:"#fff",activeColor:"#1DE9AC"},subLabel:{color:"#ddd",stroke:"transparent",activeColor:"#1DE9AC"}},lasso:{border:"1px solid #55aaff",background:"rgba(75, 160, 255, 0.1)"},ring:{fill:"#D8E6EA",activeFill:"#1DE9AC"},edge:{fill:"#D8E6EA",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475",activeColor:"#1DE9AC",fontSize:6}},arrow:{fill:"#D8E6EA",activeFill:"#1DE9AC"},cluster:{stroke:"#D8E6EA",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475"}}};function eu(r,e,t){const{offsetX:n,offsetY:i}=r,{width:s,height:o}=t;e.set(n/s*2-1,-(i/o)*2+1)}function ZF(r){const e=document.createElement("div");return e.style.pointerEvents="none",e.style.border=r.lasso.border,e.style.backgroundColor=r.lasso.background,e.style.position="fixed",e}const KF=({children:r,type:e="none",onLasso:t,onLassoEnd:n,disabled:i})=>{var s;const o=Ue(A=>A.theme),a=Kt(A=>A.camera),c=Kt(A=>A.gl),l=Kt(A=>A.setEvents),u=Kt(A=>A.size),h=Kt(A=>A.get),f=Kt(A=>A.scene),d=Mh(),m=Ue(A=>A.actives),v=Ue(A=>A.setActives),g=Ue(A=>A.edges),p=Ue(A=>A.edgeMeshes),_=q.useRef(!1),y=q.useRef(null),x=q.useRef(null),b=q.useRef(ZF(o)),w=q.useRef(null),S=q.useRef(!1),M=q.useRef(h().events.enabled),E=q.useRef((s=d.controls)==null?void 0:s.enabled);q.useEffect(()=>{_.current&&(t==null||t(m)),_.current=!0},[m,t]);const T=q.useCallback(A=>{if(S.current){const[z,V,N]=w.current;N.x=Math.max(z.x,A.clientX),N.y=Math.max(z.y,A.clientY),V.x=Math.min(z.x,A.clientX),V.y=Math.min(z.y,A.clientY),b.current.style.left=`${V.x}px`,b.current.style.top=`${V.y}px`,b.current.style.width=`${N.x-V.x}px`,b.current.style.height=`${N.y-V.y}px`,eu(A,y.current.endPoint,u),eu(A,x.current.endPoint,u);const C=[],O=x.current.select().sort(U=>U.uuid).map(U=>g[p.indexOf(U)].id);C.push(...O);const k=y.current.select().sort(U=>U.uuid).filter(U=>{var R,F;return U.isMesh&&((R=U.userData)==null?void 0:R.id)&&(((F=U.userData)==null?void 0:F.type)===e||e==="all")}).map(U=>U.userData.id);C.push(...k),requestAnimationFrame(()=>{v(C)}),document.addEventListener("pointermove",T,{passive:!0,capture:!0,once:!0})}},[g,p,v,u,e]),L=q.useCallback(()=>{var A;S.current&&(l({enabled:M.current}),S.current=!1,(A=b.current.parentElement)==null||A.removeChild(b.current),d.controls.enabled=E.current,n==null||n(m),document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",L))},[l,d.controls,n,m,T]),P=q.useCallback(A=>{var z,V;if(A.shiftKey){M.current=h().events.enabled,E.current=(z=d.controls)==null?void 0:z.enabled,y.current=new Vg(a,f);const N=new ac;p.length&&N.add(...p),x.current=new Vg(a,N),w.current=[new be,new be,new be];const[C]=w.current;d.controls.enabled=!1,l({enabled:!1}),S.current=!0,(V=c.domElement.parentElement)==null||V.appendChild(b.current),b.current.style.left=`${A.clientX}px`,b.current.style.top=`${A.clientY}px`,b.current.style.width="0px",b.current.style.height="0px",C.x=A.clientX,C.y=A.clientY,eu(A,y.current.startPoint,u),eu(A,x.current.startPoint,u),document.addEventListener("pointermove",T,{passive:!0,capture:!0,once:!0}),document.addEventListener("pointerup",L,{passive:!0})}},[a,d.controls,p,h,c.domElement.parentElement,T,L,f,l,u]);return q.useEffect(()=>{if(!(i||e==="none"))return typeof window<"u"&&(document.addEventListener("pointerdown",P,{passive:!0}),document.addEventListener("pointermove",T,{passive:!0}),document.addEventListener("pointerup",L,{passive:!0})),()=>{typeof window<"u"&&(document.removeEventListener("pointerdown",P),document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",L))}},[e,i,P,T,L]),Se.jsx("group",{children:r})},JF="_canvas_670zp_1",QF={canvas:JF},ek={alpha:!0,antialias:!0},tk={position:[0,0,1e3],near:5,far:5e4,fov:10},nk=q.forwardRef(({cameraMode:r="pan",layoutType:e="forceDirected2d",sizingType:t="default",labelType:n="auto",theme:i=$F,animated:s=!0,defaultNodeSize:o=7,minNodeSize:a=5,maxNodeSize:c=15,lassoType:l="none",glOptions:u={},edges:h,children:f,nodes:d,minDistance:m,maxDistance:v,onCanvasClick:g,disabled:p,onLasso:_,onLassoEnd:y,...x},b)=>{var w,S;const M=q.useRef(null),E=q.useRef(null),T=q.useRef(null);q.useImperativeHandle(b,()=>({centerGraph:(N,C)=>{var O;return(O=M.current)==null?void 0:O.centerGraph(N,C)},fitNodesInView:(N,C)=>{var O;return(O=M.current)==null?void 0:O.fitNodesInView(N,C)},zoomIn:()=>{var N;return(N=E.current)==null?void 0:N.zoomIn()},zoomOut:()=>{var N;return(N=E.current)==null?void 0:N.zoomOut()},dollyIn:N=>{var C;return(C=E.current)==null?void 0:C.dollyIn(N)},dollyOut:N=>{var C;return(C=E.current)==null?void 0:C.dollyOut(N)},panLeft:()=>{var N;return(N=E.current)==null?void 0:N.panLeft()},panRight:()=>{var N;return(N=E.current)==null?void 0:N.panRight()},panDown:()=>{var N;return(N=E.current)==null?void 0:N.panDown()},panUp:()=>{var N;return(N=E.current)==null?void 0:N.panUp()},resetControls:N=>{var C;return(C=E.current)==null?void 0:C.resetControls(N)},getControls:()=>{var N;return(N=E.current)==null?void 0:N.controls},getGraph:()=>{var N;return(N=M.current)==null?void 0:N.graph},exportCanvas:()=>(M.current.renderScene(),T.current.toDataURL()),freeze:()=>{var N;return(N=E.current)==null?void 0:N.freeze()},unFreeze:()=>{var N;return(N=E.current)==null?void 0:N.unFreeze()}}));const{selections:L,actives:P,collapsedNodeIds:A}=x,z=h.length+d.length>400?!1:s,V=q.useMemo(()=>({...u,...ek}),[u]);return Se.jsx("div",{className:QF.canvas,children:Se.jsx(XL,{legacy:!0,linear:!0,ref:T,flat:!0,gl:V,camera:tk,onPointerMissed:g,children:Se.jsxs(EF,{createStore:()=>MF({selections:L,actives:P,theme:i,collapsedNodeIds:A}),children:[((w=i.canvas)==null?void 0:w.background)&&Se.jsx("color",{attach:"background",args:[i.canvas.background]}),Se.jsx("ambientLight",{intensity:1}),f,((S=i.canvas)==null?void 0:S.fog)&&Se.jsx("fog",{attach:"fog",args:[i.canvas.fog,4e3,9e3]}),Se.jsx(PF,{mode:r,ref:E,disabled:p,minDistance:m,maxDistance:v,animated:s,children:Se.jsx(KF,{disabled:p,type:l,onLasso:_,onLassoEnd:y,children:Se.jsx(q.Suspense,{children:Se.jsx(YF,{ref:M,disabled:p,animated:z,edges:h,nodes:d,layoutType:e,sizingType:t,labelType:n,defaultNodeSize:o,minNodeSize:a,maxNodeSize:c,...x})})})})]})})})}),tu={identity:"#22d3ee",knowledge:"#6366f1",rules:"#a78bfa",events:"#fbbf24"},ik={identity:"Identität",knowledge:"Wissen",rules:"Regeln",events:"Ereignisse"},Rd=new Set(["auto","agent","hermes"]);function hk({data:r,onDelete:e}){const[t,n]=q.useState(null),i=q.useMemo(()=>{const l={};return r.edges.forEach(u=>{l[u.source]=(l[u.source]||0)+1,l[u.target]=(l[u.target]||0)+1}),l},[r]),s=q.useMemo(()=>r.nodes.map(l=>({id:l.id,label:l.content.length>26?l.content.slice(0,25)+"…":l.content,fill:tu[l.category]||"#64748b",size:6+Math.min(i[l.id]||0,6)*2})),[r,i]),o=q.useMemo(()=>r.edges.map(l=>({id:`${l.source}->${l.target}`,source:l.source,target:l.target,size:.4+l.weight})),[r]),a=t?r.nodes.find(l=>l.id===t)??null:null,c=q.useMemo(()=>{if(!t)return[];const l=new Set;return r.edges.forEach(u=>{u.source===t&&l.add(u.target),u.target===t&&l.add(u.source)}),r.nodes.filter(u=>l.has(u.id))},[t,r]);return r.nodes.length?Se.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_280px] gap-3",children:[Se.jsx("div",{className:"relative h-[480px] rounded-2xl border border-border/60 bg-[#070a0f] overflow-hidden",children:Se.jsx(nk,{nodes:s,edges:o,theme:jF,layoutType:"forceDirected2d",labelType:"nodes",edgeArrowPosition:"none",draggable:!0,onNodeClick:l=>n(l.id),onCanvasClick:()=>n(null)})}),Se.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 min-h-[480px]",children:a?Se.jsxs(Se.Fragment,{children:[Se.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[Se.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:tu[a.category],boxShadow:`0 0 0 2px ${Rd.has(a.source)?"#34d399":"#475569"}`}}),Se.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:tu[a.category]},children:ik[a.category]||a.category}),Se.jsxs("span",{className:`ml-auto text-[10px] font-mono flex items-center gap-1 ${Rd.has(a.source)?"text-emerald-400":"text-muted-foreground/70"}`,children:[Rd.has(a.source)&&Se.jsx(Qw,{className:"h-2.5 w-2.5"}),a.source]})]}),Se.jsx("div",{className:"text-sm text-foreground leading-relaxed mb-4 break-words",children:a.content}),Se.jsxs("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70 mb-2 flex items-center gap-1",children:[Se.jsx(Cg,{className:"h-3 w-3"})," verwandte Fakten"]}),Se.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:c.length?c.map(l=>Se.jsxs("button",{onClick:()=>n(l.id),className:"flex items-center gap-2 text-[11px] text-muted-foreground hover:text-foreground text-left transition-colors",children:[Se.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:tu[l.category]}}),Se.jsx("span",{className:"truncate",children:l.content})]},l.id)):Se.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"—"})}),Se.jsxs("button",{onClick:()=>{e(a.id),n(null)},className:"flex items-center gap-1.5 text-[11px] text-red-400 border border-red-500/20 rounded-lg px-2.5 py-1.5 hover:bg-red-500/5 transition-all",children:[Se.jsx(eS,{className:"h-3.5 w-3.5"})," vergessen"]})]}):Se.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center text-muted-foreground/70 gap-2 pt-24",children:[Se.jsx(Cg,{className:"h-6 w-6"}),Se.jsx("div",{className:"text-xs max-w-[180px] leading-relaxed",children:"Einen Knoten wählen, um den Fakt und seine semantischen Nachbarn zu sehen."})]})})]}):Se.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Noch keine Fakten — der Graph füllt sich, sobald Hermes lernt oder du Einträge anlegst."})}export{hk as GraphView}; diff --git a/frontend/dist/assets/index--0Qg2tjI.css b/frontend/dist/assets/index--0Qg2tjI.css deleted file mode 100644 index 8a03c32..0000000 --- a/frontend/dist/assets/index--0Qg2tjI.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap";/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-200:oklch(89.4% .057 293.283);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-500:oklch(62.7% .265 303.9);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-400:oklch(71.2% .194 13.428);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-500:oklch(55.4% .046 257.417);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-normal:1.5;--leading-relaxed:1.625;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--default-mono-font-family:"JetBrains Mono", ui-monospace, SFMono-Regular, monospace}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.visible\!{visibility:visible!important}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{inset-inline:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-\[-10\%\]{top:-10%}.top-\[30\%\]{top:30%}.right-0{right:0}.right-\[-10\%\]{right:-10%}.right-\[20\%\]{right:20%}.bottom-3{bottom:calc(var(--spacing) * 3)}.bottom-\[-10\%\]{bottom:-10%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-\[-10\%\]{left:-10%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.-z-50{z-index:-50}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[60\]{z-index:60}.z-\[99\]{z-index:99}.col-span-full{grid-column:1/-1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.mx-auto{margin-inline:auto}.-mt-1{margin-top:calc(var(--spacing) * -1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-3\.5{margin-top:calc(var(--spacing) * 3.5)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-auto{margin-top:auto}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:var(--spacing)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-4\.5{height:calc(var(--spacing) * 4.5)}.h-5{height:calc(var(--spacing) * 5)}.h-5\.5{height:calc(var(--spacing) * 5.5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-44{height:calc(var(--spacing) * 44)}.h-96{height:calc(var(--spacing) * 96)}.h-\[40\%\]{height:40%}.h-\[50\%\]{height:50%}.h-\[150px\]{height:150px}.h-\[480px\]{height:480px}.h-full{height:100%}.max-h-20{max-height:calc(var(--spacing) * 20)}.max-h-36{max-height:calc(var(--spacing) * 36)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\[80vh\]{max-height:80vh}.min-h-0{min-height:0}.min-h-\[68vh\]{min-height:68vh}.min-h-\[90px\]{min-height:90px}.min-h-\[300px\]{min-height:300px}.min-h-\[480px\]{min-height:480px}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-4\.5{width:calc(var(--spacing) * 4.5)}.w-5{width:calc(var(--spacing) * 5)}.w-5\.5{width:calc(var(--spacing) * 5.5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-28{width:calc(var(--spacing) * 28)}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-52{width:calc(var(--spacing) * 52)}.w-60{width:calc(var(--spacing) * 60)}.w-80{width:calc(var(--spacing) * 80)}.w-\[40\%\]{width:40%}.w-\[50\%\]{width:50%}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[88\%\]{max-width:88%}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[260px\]{max-width:260px}.max-w-\[280px\]{max-width:280px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:0;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-full{--tw-translate-x:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.scroll-mt-20{scroll-margin-top:calc(var(--spacing) * 20)}.scrollbar-thin{scrollbar-width:thin}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-7>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 7) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 7) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-1{row-gap:var(--spacing)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-br-sm{border-bottom-right-radius:calc(var(--radius) - 4px)}.rounded-bl{border-bottom-left-radius:.25rem}.rounded-bl-sm{border-bottom-left-radius:calc(var(--radius) - 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/25{border-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/25{border-color:color-mix(in oklab,var(--color-amber-500) 25%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500) 40%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500) 30%,transparent)}}.border-border,.border-border\/10{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/10{border-color:color-mix(in oklab,hsl(var(--border)) 10%,transparent)}}.border-border\/20{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/20{border-color:color-mix(in oklab,hsl(var(--border)) 20%,transparent)}}.border-border\/30{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/30{border-color:color-mix(in oklab,hsl(var(--border)) 30%,transparent)}}.border-border\/40{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/40{border-color:color-mix(in oklab,hsl(var(--border)) 40%,transparent)}}.border-border\/50{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,hsl(var(--border)) 50%,transparent)}}.border-border\/60{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/60{border-color:color-mix(in oklab,hsl(var(--border)) 60%,transparent)}}.border-border\/70{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/70{border-color:color-mix(in oklab,hsl(var(--border)) 70%,transparent)}}.border-border\/80{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/80{border-color:color-mix(in oklab,hsl(var(--border)) 80%,transparent)}}.border-cyan-500\/20{border-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/20{border-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.border-cyan-500\/25{border-color:#00b7d740}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/25{border-color:color-mix(in oklab,var(--color-cyan-500) 25%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500) 30%,transparent)}}.border-emerald-500\/10{border-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/10{border-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.border-emerald-500\/15{border-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/15{border-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/20{border-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-emerald-500\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/40{border-color:color-mix(in oklab,var(--color-emerald-500) 40%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500) 50%,transparent)}}.border-indigo-500\/25{border-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/25{border-color:color-mix(in oklab,var(--color-indigo-500) 25%,transparent)}}.border-indigo-500\/30{border-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/30{border-color:color-mix(in oklab,var(--color-indigo-500) 30%,transparent)}}.border-indigo-500\/40{border-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/40{border-color:color-mix(in oklab,var(--color-indigo-500) 40%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500) 30%,transparent)}}.border-pink-500\/25{border-color:#f6339a40}@supports (color:color-mix(in lab,red,red)){.border-pink-500\/25{border-color:color-mix(in oklab,var(--color-pink-500) 25%,transparent)}}.border-primary,.border-primary\/20{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/20{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.border-primary\/25{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/25{border-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.border-primary\/30{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/30{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.border-primary\/40{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/40{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.border-primary\/45{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/45{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.border-primary\/50{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/50{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.border-primary\/60{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/60{border-color:color-mix(in oklab,hsl(var(--primary)) 60%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500) 30%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.border-red-500\/25{border-color:#fb2c3640}@supports (color:color-mix(in lab,red,red)){.border-red-500\/25{border-color:color-mix(in oklab,var(--color-red-500) 25%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab,red,red)){.border-red-500\/40{border-color:color-mix(in oklab,var(--color-red-500) 40%,transparent)}}.border-slate-500\/25{border-color:#62748e40}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/25{border-color:color-mix(in oklab,var(--color-slate-500) 25%,transparent)}}.border-slate-500\/30{border-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/30{border-color:color-mix(in oklab,var(--color-slate-500) 30%,transparent)}}.border-teal-500\/25{border-color:#00baa740}@supports (color:color-mix(in lab,red,red)){.border-teal-500\/25{border-color:color-mix(in oklab,var(--color-teal-500) 25%,transparent)}}.border-transparent{border-color:#0000}.border-violet-500\/20{border-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/20{border-color:color-mix(in oklab,var(--color-violet-500) 20%,transparent)}}.border-violet-500\/25{border-color:#8d54ff40}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/25{border-color:color-mix(in oklab,var(--color-violet-500) 25%,transparent)}}.border-t-primary\/70{border-top-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-t-primary\/70{border-top-color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.border-t-violet-500\/70{border-top-color:#8d54ffb3}@supports (color:color-mix(in lab,red,red)){.border-t-violet-500\/70{border-top-color:color-mix(in oklab,var(--color-violet-500) 70%,transparent)}}.border-l-amber-500\/80{border-left-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.border-l-amber-500\/80{border-left-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.border-l-cyan-500\/80{border-left-color:#00b7d7cc}@supports (color:color-mix(in lab,red,red)){.border-l-cyan-500\/80{border-left-color:color-mix(in oklab,var(--color-cyan-500) 80%,transparent)}}.border-l-indigo-500\/80{border-left-color:#625fffcc}@supports (color:color-mix(in lab,red,red)){.border-l-indigo-500\/80{border-left-color:color-mix(in oklab,var(--color-indigo-500) 80%,transparent)}}.border-l-muted{border-left-color:hsl(var(--muted))}.border-l-violet-500\/80{border-left-color:#8d54ffcc}@supports (color:color-mix(in lab,red,red)){.border-l-violet-500\/80{border-left-color:color-mix(in oklab,var(--color-violet-500) 80%,transparent)}}.bg-\[\#070a0f\]{background-color:#070a0f}.bg-\[hsl\(224\,30\%\,6\%\)\]{background-color:#0b0d14}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.bg-amber-500\/80{background-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/80{background-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.bg-amber-500\/\[0\.06\]{background-color:#f99c000f}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/\[0\.06\]{background-color:color-mix(in oklab,var(--color-amber-500) 6%,transparent)}}.bg-background\/10{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/10{background-color:color-mix(in oklab,hsl(var(--background)) 10%,transparent)}}.bg-background\/20{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/20{background-color:color-mix(in oklab,hsl(var(--background)) 20%,transparent)}}.bg-background\/25{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/25{background-color:color-mix(in oklab,hsl(var(--background)) 25%,transparent)}}.bg-background\/30{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/30{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.bg-background\/35{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/35{background-color:color-mix(in oklab,hsl(var(--background)) 35%,transparent)}}.bg-background\/40{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/40{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.bg-background\/50{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/50{background-color:color-mix(in oklab,hsl(var(--background)) 50%,transparent)}}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/25{background-color:#00000040}@supports (color:color-mix(in lab,red,red)){.bg-black\/25{background-color:color-mix(in oklab,var(--color-black) 25%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500) 20%,transparent)}}.bg-card,.bg-card\/10{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/10{background-color:color-mix(in oklab,hsl(var(--card)) 10%,transparent)}}.bg-card\/20{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/20{background-color:color-mix(in oklab,hsl(var(--card)) 20%,transparent)}}.bg-card\/30{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/30{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.bg-card\/40{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/40{background-color:color-mix(in oklab,hsl(var(--card)) 40%,transparent)}}.bg-card\/45{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/45{background-color:color-mix(in oklab,hsl(var(--card)) 45%,transparent)}}.bg-card\/50{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/50{background-color:color-mix(in oklab,hsl(var(--card)) 50%,transparent)}}.bg-card\/70{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/70{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.bg-card\/75{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/75{background-color:color-mix(in oklab,hsl(var(--card)) 75%,transparent)}}.bg-card\/85{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/85{background-color:color-mix(in oklab,hsl(var(--card)) 85%,transparent)}}.bg-card\/90{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/90{background-color:color-mix(in oklab,hsl(var(--card)) 90%,transparent)}}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/10{background-color:color-mix(in oklab,var(--color-cyan-500) 10%,transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500) 15%,transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/5{background-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/5{background-color:color-mix(in oklab,var(--color-emerald-500) 5%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.bg-emerald-500\/80{background-color:#00bb7fcc}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/80{background-color:color-mix(in oklab,var(--color-emerald-500) 80%,transparent)}}.bg-emerald-500\/\[0\.07\]{background-color:#00bb7f12}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/\[0\.07\]{background-color:color-mix(in oklab,var(--color-emerald-500) 7%,transparent)}}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500) 10%,transparent)}}.bg-indigo-500\/15{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground,.bg-muted-foreground\/40{background-color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.bg-muted-foreground\/40{background-color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.bg-muted\/10{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/10{background-color:color-mix(in oklab,hsl(var(--muted)) 10%,transparent)}}.bg-muted\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,hsl(var(--muted)) 20%,transparent)}}.bg-muted\/40{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/40{background-color:color-mix(in oklab,hsl(var(--muted)) 40%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500) 20%,transparent)}}.bg-pink-500\/15{background-color:#f6339a26}@supports (color:color-mix(in lab,red,red)){.bg-pink-500\/15{background-color:color-mix(in oklab,var(--color-pink-500) 15%,transparent)}}.bg-popover,.bg-popover\/95{background-color:hsl(var(--popover))}@supports (color:color-mix(in lab,red,red)){.bg-popover\/95{background-color:color-mix(in oklab,hsl(var(--popover)) 95%,transparent)}}.bg-primary,.bg-primary\/5{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.bg-primary\/10{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.bg-primary\/15{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/15{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.bg-primary\/\[0\.06\]{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/\[0\.06\]{background-color:color-mix(in oklab,hsl(var(--primary)) 6%,transparent)}}.bg-purple-500\/15{background-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/15{background-color:color-mix(in oklab,var(--color-purple-500) 15%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500) 20%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/5{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500) 15%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500) 80%,transparent)}}.bg-slate-500\/15{background-color:#62748e26}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/15{background-color:color-mix(in oklab,var(--color-slate-500) 15%,transparent)}}.bg-slate-500\/20{background-color:#62748e33}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/20{background-color:color-mix(in oklab,var(--color-slate-500) 20%,transparent)}}.bg-teal-500\/15{background-color:#00baa726}@supports (color:color-mix(in lab,red,red)){.bg-teal-500\/15{background-color:color-mix(in oklab,var(--color-teal-500) 15%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/5{background-color:#8d54ff0d}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/5{background-color:color-mix(in oklab,var(--color-violet-500) 5%,transparent)}}.bg-violet-500\/10{background-color:#8d54ff1a}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/10{background-color:color-mix(in oklab,var(--color-violet-500) 10%,transparent)}}.bg-violet-500\/15{background-color:#8d54ff26}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/15{background-color:color-mix(in oklab,var(--color-violet-500) 15%,transparent)}}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-tr{--tw-gradient-position:to top right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-cyan-500{--tw-gradient-from:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-foreground{--tw-gradient-from:hsl(var(--foreground));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-500{--tw-gradient-from:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500{--tw-gradient-from:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500\/20{--tw-gradient-from:#00baa733}@supports (color:color-mix(in lab,red,red)){.from-teal-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-teal-500) 20%, transparent)}}.from-teal-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-foreground{--tw-gradient-via:hsl(var(--foreground));--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-indigo-500\/15{--tw-gradient-via:#625fff26}@supports (color:color-mix(in lab,red,red)){.via-indigo-500\/15{--tw-gradient-via:color-mix(in oklab, var(--color-indigo-500) 15%, transparent)}}.via-indigo-500\/15{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-blue-500{--tw-gradient-to:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-500{--tw-gradient-to:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary{--tw-gradient-to:hsl(var(--primary));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-purple-500\/20{--tw-gradient-to:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-purple-500) 20%, transparent)}}.to-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-500{--tw-gradient-to:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.bg-repeat{background-repeat:repeat}.fill-primary\/20{fill:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.fill-primary\/20{fill:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-12{padding:calc(var(--spacing) * 12)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[12vh\]{padding-top:12vh}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:JetBrains Mono,ui-monospace,SFMono-Regular,monospace}.font-sans{font-family:Inter,ui-sans-serif,system-ui,-apple-system,sans-serif}.font-space{font-family:Space Grotesk,sans-serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[7px\]{font-size:7px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400) 80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400) 90%,transparent)}}.text-amber-500{color:var(--color-amber-500)}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-cyan-200\/90{color:#a2f4fde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-200\/90{color:color-mix(in oklab,var(--color-cyan-200) 90%,transparent)}}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-300\/90{color:#53eafde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-300\/90{color:color-mix(in oklab,var(--color-cyan-300) 90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/90{color:#00d294e6}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/90{color:color-mix(in oklab,var(--color-emerald-400) 90%,transparent)}}.text-foreground,.text-foreground\/90{color:hsl(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.text-foreground\/90{color:color-mix(in oklab,hsl(var(--foreground)) 90%,transparent)}}.text-indigo-300{color:var(--color-indigo-300)}.text-indigo-400{color:var(--color-indigo-400)}.text-muted-foreground,.text-muted-foreground\/40{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.text-muted-foreground\/50{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/50{color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.text-muted-foreground\/55{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/55{color:color-mix(in oklab,hsl(var(--muted-foreground)) 55%,transparent)}}.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.text-muted-foreground\/70{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,hsl(var(--muted-foreground)) 70%,transparent)}}.text-muted-foreground\/75{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/75{color:color-mix(in oklab,hsl(var(--muted-foreground)) 75%,transparent)}}.text-muted-foreground\/80{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/80{color:color-mix(in oklab,hsl(var(--muted-foreground)) 80%,transparent)}}.text-orange-300{color:var(--color-orange-300)}.text-pink-400{color:var(--color-pink-400)}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/70{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/70{color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.text-primary\/80{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/80{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-400\/80{color:#ff6568cc}@supports (color:color-mix(in lab,red,red)){.text-red-400\/80{color:color-mix(in oklab,var(--color-red-400) 80%,transparent)}}.text-rose-400{color:var(--color-rose-400)}.text-sky-400{color:var(--color-sky-400)}.text-slate-300{color:var(--color-slate-300)}.text-teal-400{color:var(--color-teal-400)}.text-transparent{color:#0000}.text-violet-200\/90{color:#ddd6ffe6}@supports (color:color-mix(in lab,red,red)){.text-violet-200\/90{color:color-mix(in oklab,var(--color-violet-200) 90%,transparent)}}.text-violet-300{color:var(--color-violet-300)}.text-violet-300\/80{color:#c4b4ffcc}@supports (color:color-mix(in lab,red,red)){.text-violet-300\/80{color:color-mix(in oklab,var(--color-violet-300) 80%,transparent)}}.text-violet-400{color:var(--color-violet-400)}.text-violet-400\/70{color:#a685ffb3}@supports (color:color-mix(in lab,red,red)){.text-violet-400\/70{color:color-mix(in oklab,var(--color-violet-400) 70%,transparent)}}.text-white{color:var(--color-white)}.text-white\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\/95{color:color-mix(in oklab,var(--color-white) 95%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-primary{accent-color:hsl(var(--primary))}.opacity-0{opacity:0}.opacity-35{opacity:.35}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow\!{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-500\/10{--tw-shadow-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.shadow-amber-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/5{--tw-shadow-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.shadow-black\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/10{--tw-shadow-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.shadow-black\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/15{--tw-shadow-color:#00000026}@supports (color:color-mix(in lab,red,red)){.shadow-black\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/20{--tw-shadow-color:#0003}@supports (color:color-mix(in lab,red,red)){.shadow-black\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/25{--tw-shadow-color:#00000040}@supports (color:color-mix(in lab,red,red)){.shadow-black\/25{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 25%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/5{--tw-shadow-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/5{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/10{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/20{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/10{--tw-shadow-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/30{--tw-shadow-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-black\/40{--tw-ring-color:#0006}@supports (color:color-mix(in lab,red,red)){.ring-black\/40{--tw-ring-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[130px\]{--tw-blur:blur(130px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[140px\]{--tw-blur:blur(140px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[160px\]{--tw-blur:blur(160px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a)) drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.sepia{--tw-sepia:sepia(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\!filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.select-text{-webkit-user-select:text;user-select:text}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-primary:is(:where(.group):hover *){color:hsl(var(--primary))}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}@media(hover:hover){.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:border-primary:hover,.hover\:border-primary\/20:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/20:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:border-primary\/30:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/30:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.hover\:border-primary\/40:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.hover\:border-primary\/45:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/45:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-400:hover{background-color:var(--color-amber-400)}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.hover\:bg-amber-500\/15:hover{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/15:hover{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.hover\:bg-background\/30:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/30:hover{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.hover\:bg-background\/40:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/40:hover{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.hover\:bg-background\/60:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/60:hover{background-color:color-mix(in oklab,hsl(var(--background)) 60%,transparent)}}.hover\:bg-background\/80:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/80:hover{background-color:color-mix(in oklab,hsl(var(--background)) 80%,transparent)}}.hover\:bg-card\/30:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/30:hover{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.hover\:bg-card\/70:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/70:hover{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.hover\:bg-emerald-500\/10:hover{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/10:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.hover\:bg-emerald-500\/15:hover{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/15:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.hover\:bg-indigo-500\/15:hover{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/15:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.hover\:bg-primary\/5:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/5:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/10:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.hover\:bg-primary\/15:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/15:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.hover\:bg-primary\/20:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/20:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:bg-primary\/25:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/25:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 90%,transparent)}}.hover\:bg-primary\/95:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/95:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 95%,transparent)}}.hover\:bg-red-400:hover{background-color:var(--color-red-400)}.hover\:bg-red-500\/5:hover{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/5:hover{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}}.focus\:border-primary:focus,.focus\:border-primary\/50:focus{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:border-primary\/50:focus{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-primary:focus,.focus\:ring-primary\/50:focus{--tw-ring-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:ring-primary\/50:focus{--tw-ring-color:color-mix(in oklab, hsl(var(--primary)) 50%, transparent)}}.focus\:ring-violet-500\/50:focus{--tw-ring-color:#8d54ff80}@supports (color:color-mix(in lab,red,red)){.focus\:ring-violet-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:w-\[640px\]{width:640px}.sm\:max-w-\[400px\]{max-width:400px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-auto{align-self:auto}.sm\:p-10{padding:calc(var(--spacing) * 10)}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-\[170px_1fr\]{grid-template-columns:170px 1fr}}@media(min-width:64rem){.lg\:flex{display:flex}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-\[1fr_280px\]{grid-template-columns:1fr 280px}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}}}:root{--background:224 30% 6%;--foreground:210 20% 92%;--card:224 25% 10%;--card-foreground:210 20% 94%;--popover:224 28% 9%;--popover-foreground:210 20% 94%;--primary:172 72% 50%;--primary-foreground:224 47% 8%;--muted:220 16% 14%;--muted-foreground:215 14% 64%;--accent:220 16% 16%;--accent-foreground:210 20% 94%;--border:222 18% 23%;--input:222 18% 23%;--ring:172 72% 50%;--radius:.75rem}.light{--background:0 0% 100%;--foreground:222 22% 12%;--card:0 0% 100%;--card-foreground:222 22% 12%;--popover:0 0% 100%;--popover-foreground:222 22% 12%;--primary:172 70% 38%;--primary-foreground:0 0% 100%;--muted:220 14% 95%;--muted-foreground:220 9% 42%;--accent:220 14% 94%;--accent-foreground:222 22% 12%;--border:220 13% 88%;--input:220 13% 88%;--ring:172 66% 50%}@keyframes aurora{0%{background-position:0%}50%{background-position:100%}to{background-position:0%}}.animate-aurora{background-size:200% 200%;animation:25s infinite aurora}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:9999px}*{border-color:hsl(var(--border) / .85);outline-color:hsl(var(--primary) / .5)}html,body,#root{height:100%;overflow:hidden}body{background-color:hsl(var(--background));color:hsl(var(--foreground));font-family:var(--font-sans);-webkit-font-smoothing:antialiased;margin:0}@keyframes flow-cyan{0%{stroke-dasharray:6 3;stroke-dashoffset:18px}to{stroke-dasharray:6 3;stroke-dashoffset:0}}.animate-flow-cyan{animation:1.2s linear infinite flow-cyan}.rounded-2xl.border.bg-card\/45{position:relative;overflow:hidden;background-color:hsl(var(--card) / .85)!important;border-color:hsl(var(--border) / .95)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;box-shadow:0 10px 30px -15px #00000073,inset 0 1px #ffffff0d!important}.rounded-2xl.border.bg-card\/45:before{content:"";background:linear-gradient(90deg,hsl(var(--primary)),#6366f1,#a855f7);opacity:.75;height:3.5px;position:absolute;top:0;left:0;right:0;transition:opacity .3s!important}.rounded-2xl.border.bg-card\/45:hover{transform:translateY(-3px);background-color:hsl(var(--card) / .92)!important;border-color:hsl(var(--primary) / .35)!important;box-shadow:0 20px 40px -20px #000000a6,0 0 18px 2px hsl(var(--primary) / .05)!important}.rounded-2xl.border.bg-card\/45:hover:before{opacity:1}.rounded-xl.border.bg-card\/45{background-color:hsl(var(--card) / .88)!important;border-color:hsl(var(--border) / .9)!important;transition:all .2s!important}.rounded-xl.border.bg-card\/45:hover{background-color:hsl(var(--card) / .95)!important;border-color:hsl(var(--primary) / .3)!important}aside nav button[class*="bg-primary/15"]:not([class*=justify-center]){background:linear-gradient(90deg,hsl(var(--primary) / .18),#6366f11f)!important;color:hsl(var(--primary))!important;border-left:3.5px solid hsl(var(--primary))!important;border-radius:0 var(--radius) var(--radius) 0!important;padding-left:calc(.75rem - 3.5px)!important;box-shadow:inset 0 1px #ffffff05!important}aside nav button[class*="bg-primary/15"][class*=justify-center]{background:hsl(var(--primary) / .18)!important;color:hsl(var(--primary))!important;box-shadow:0 0 12px 1px hsl(var(--primary) / .1)!important;border:1px solid hsl(var(--primary) / .3)!important}::-webkit-scrollbar-thumb{border-radius:9999px;background:hsl(var(--primary) / .25)!important}::-webkit-scrollbar-thumb:hover{background:hsl(var(--primary) / .5)!important}input:focus,textarea:focus,select:focus{outline:none;border-color:hsl(var(--primary))!important;box-shadow:0 0 0 2px hsl(var(--primary) / .15)!important}@media(min-width:1440px){html{font-size:16.5px}}@media(min-width:1920px){html{font-size:17.5px}}@media(min-width:2560px){html{font-size:19px}}@media(min-width:3440px){html{font-size:20px}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}} diff --git a/frontend/dist/assets/index-BQ6s_c3E.css b/frontend/dist/assets/index-BQ6s_c3E.css new file mode 100644 index 0000000..0e8a065 --- /dev/null +++ b/frontend/dist/assets/index-BQ6s_c3E.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap";/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-200:oklch(89.4% .057 293.283);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-500:oklch(62.7% .265 303.9);--color-fuchsia-400:oklch(74% .238 322.16);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-400:oklch(71.2% .194 13.428);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-500:oklch(55.4% .046 257.417);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-normal:1.5;--leading-relaxed:1.625;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--default-mono-font-family:"JetBrains Mono", ui-monospace, SFMono-Regular, monospace}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.visible\!{visibility:visible!important}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{inset-inline:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-\[-10\%\]{top:-10%}.top-\[30\%\]{top:30%}.right-0{right:0}.right-\[-10\%\]{right:-10%}.right-\[20\%\]{right:20%}.bottom-3{bottom:calc(var(--spacing) * 3)}.bottom-\[-10\%\]{bottom:-10%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-\[-10\%\]{left:-10%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.-z-50{z-index:-50}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[60\]{z-index:60}.z-\[99\]{z-index:99}.col-span-full{grid-column:1/-1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.mx-auto{margin-inline:auto}.-mt-1{margin-top:calc(var(--spacing) * -1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-3\.5{margin-top:calc(var(--spacing) * 3.5)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-auto{margin-top:auto}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:var(--spacing)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-4\.5{height:calc(var(--spacing) * 4.5)}.h-5{height:calc(var(--spacing) * 5)}.h-5\.5{height:calc(var(--spacing) * 5.5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-44{height:calc(var(--spacing) * 44)}.h-96{height:calc(var(--spacing) * 96)}.h-\[40\%\]{height:40%}.h-\[50\%\]{height:50%}.h-\[150px\]{height:150px}.h-\[480px\]{height:480px}.h-full{height:100%}.h-px{height:1px}.max-h-20{max-height:calc(var(--spacing) * 20)}.max-h-36{max-height:calc(var(--spacing) * 36)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\[80vh\]{max-height:80vh}.min-h-0{min-height:0}.min-h-\[68vh\]{min-height:68vh}.min-h-\[90px\]{min-height:90px}.min-h-\[300px\]{min-height:300px}.min-h-\[480px\]{min-height:480px}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-4\.5{width:calc(var(--spacing) * 4.5)}.w-5{width:calc(var(--spacing) * 5)}.w-5\.5{width:calc(var(--spacing) * 5.5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-28{width:calc(var(--spacing) * 28)}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-52{width:calc(var(--spacing) * 52)}.w-60{width:calc(var(--spacing) * 60)}.w-80{width:calc(var(--spacing) * 80)}.w-\[40\%\]{width:40%}.w-\[50\%\]{width:50%}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[88\%\]{max-width:88%}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[260px\]{max-width:260px}.max-w-\[280px\]{max-width:280px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:0;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-full{--tw-translate-x:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.scroll-mt-20{scroll-margin-top:calc(var(--spacing) * 20)}.scrollbar-thin{scrollbar-width:thin}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-7>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 7) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 7) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-1{row-gap:var(--spacing)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-br-sm{border-bottom-right-radius:calc(var(--radius) - 4px)}.rounded-bl{border-bottom-left-radius:.25rem}.rounded-bl-sm{border-bottom-left-radius:calc(var(--radius) - 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/25{border-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/25{border-color:color-mix(in oklab,var(--color-amber-500) 25%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500) 40%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500) 30%,transparent)}}.border-border,.border-border\/10{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/10{border-color:color-mix(in oklab,hsl(var(--border)) 10%,transparent)}}.border-border\/20{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/20{border-color:color-mix(in oklab,hsl(var(--border)) 20%,transparent)}}.border-border\/30{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/30{border-color:color-mix(in oklab,hsl(var(--border)) 30%,transparent)}}.border-border\/40{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/40{border-color:color-mix(in oklab,hsl(var(--border)) 40%,transparent)}}.border-border\/50{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,hsl(var(--border)) 50%,transparent)}}.border-border\/60{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/60{border-color:color-mix(in oklab,hsl(var(--border)) 60%,transparent)}}.border-border\/70{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/70{border-color:color-mix(in oklab,hsl(var(--border)) 70%,transparent)}}.border-border\/80{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/80{border-color:color-mix(in oklab,hsl(var(--border)) 80%,transparent)}}.border-cyan-500\/20{border-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/20{border-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.border-cyan-500\/25{border-color:#00b7d740}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/25{border-color:color-mix(in oklab,var(--color-cyan-500) 25%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500) 30%,transparent)}}.border-emerald-500\/10{border-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/10{border-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.border-emerald-500\/15{border-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/15{border-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/20{border-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-emerald-500\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/40{border-color:color-mix(in oklab,var(--color-emerald-500) 40%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500) 50%,transparent)}}.border-indigo-500\/25{border-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/25{border-color:color-mix(in oklab,var(--color-indigo-500) 25%,transparent)}}.border-indigo-500\/30{border-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/30{border-color:color-mix(in oklab,var(--color-indigo-500) 30%,transparent)}}.border-indigo-500\/40{border-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/40{border-color:color-mix(in oklab,var(--color-indigo-500) 40%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500) 30%,transparent)}}.border-pink-500\/25{border-color:#f6339a40}@supports (color:color-mix(in lab,red,red)){.border-pink-500\/25{border-color:color-mix(in oklab,var(--color-pink-500) 25%,transparent)}}.border-primary,.border-primary\/20{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/20{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.border-primary\/25{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/25{border-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.border-primary\/30{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/30{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.border-primary\/40{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/40{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.border-primary\/45{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/45{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.border-primary\/50{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/50{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.border-primary\/60{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/60{border-color:color-mix(in oklab,hsl(var(--primary)) 60%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500) 30%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.border-red-500\/25{border-color:#fb2c3640}@supports (color:color-mix(in lab,red,red)){.border-red-500\/25{border-color:color-mix(in oklab,var(--color-red-500) 25%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab,red,red)){.border-red-500\/40{border-color:color-mix(in oklab,var(--color-red-500) 40%,transparent)}}.border-slate-500\/25{border-color:#62748e40}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/25{border-color:color-mix(in oklab,var(--color-slate-500) 25%,transparent)}}.border-slate-500\/30{border-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/30{border-color:color-mix(in oklab,var(--color-slate-500) 30%,transparent)}}.border-teal-500\/25{border-color:#00baa740}@supports (color:color-mix(in lab,red,red)){.border-teal-500\/25{border-color:color-mix(in oklab,var(--color-teal-500) 25%,transparent)}}.border-transparent{border-color:#0000}.border-violet-500\/20{border-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/20{border-color:color-mix(in oklab,var(--color-violet-500) 20%,transparent)}}.border-violet-500\/25{border-color:#8d54ff40}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/25{border-color:color-mix(in oklab,var(--color-violet-500) 25%,transparent)}}.border-t-primary\/70{border-top-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-t-primary\/70{border-top-color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.border-t-violet-500\/70{border-top-color:#8d54ffb3}@supports (color:color-mix(in lab,red,red)){.border-t-violet-500\/70{border-top-color:color-mix(in oklab,var(--color-violet-500) 70%,transparent)}}.border-l-amber-500\/80{border-left-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.border-l-amber-500\/80{border-left-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.border-l-cyan-500\/80{border-left-color:#00b7d7cc}@supports (color:color-mix(in lab,red,red)){.border-l-cyan-500\/80{border-left-color:color-mix(in oklab,var(--color-cyan-500) 80%,transparent)}}.border-l-indigo-500\/80{border-left-color:#625fffcc}@supports (color:color-mix(in lab,red,red)){.border-l-indigo-500\/80{border-left-color:color-mix(in oklab,var(--color-indigo-500) 80%,transparent)}}.border-l-muted{border-left-color:hsl(var(--muted))}.border-l-violet-500\/80{border-left-color:#8d54ffcc}@supports (color:color-mix(in lab,red,red)){.border-l-violet-500\/80{border-left-color:color-mix(in oklab,var(--color-violet-500) 80%,transparent)}}.bg-\[\#070a0f\]{background-color:#070a0f}.bg-\[hsl\(224\,30\%\,6\%\)\]{background-color:#0b0d14}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.bg-amber-500\/80{background-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/80{background-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.bg-amber-500\/\[0\.06\]{background-color:#f99c000f}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/\[0\.06\]{background-color:color-mix(in oklab,var(--color-amber-500) 6%,transparent)}}.bg-background\/10{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/10{background-color:color-mix(in oklab,hsl(var(--background)) 10%,transparent)}}.bg-background\/20{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/20{background-color:color-mix(in oklab,hsl(var(--background)) 20%,transparent)}}.bg-background\/25{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/25{background-color:color-mix(in oklab,hsl(var(--background)) 25%,transparent)}}.bg-background\/30{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/30{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.bg-background\/35{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/35{background-color:color-mix(in oklab,hsl(var(--background)) 35%,transparent)}}.bg-background\/40{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/40{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.bg-background\/50{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/50{background-color:color-mix(in oklab,hsl(var(--background)) 50%,transparent)}}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/25{background-color:#00000040}@supports (color:color-mix(in lab,red,red)){.bg-black\/25{background-color:color-mix(in oklab,var(--color-black) 25%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500) 20%,transparent)}}.bg-border\/30{background-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.bg-border\/30{background-color:color-mix(in oklab,hsl(var(--border)) 30%,transparent)}}.bg-card,.bg-card\/10{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/10{background-color:color-mix(in oklab,hsl(var(--card)) 10%,transparent)}}.bg-card\/20{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/20{background-color:color-mix(in oklab,hsl(var(--card)) 20%,transparent)}}.bg-card\/30{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/30{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.bg-card\/40{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/40{background-color:color-mix(in oklab,hsl(var(--card)) 40%,transparent)}}.bg-card\/45{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/45{background-color:color-mix(in oklab,hsl(var(--card)) 45%,transparent)}}.bg-card\/50{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/50{background-color:color-mix(in oklab,hsl(var(--card)) 50%,transparent)}}.bg-card\/70{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/70{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.bg-card\/75{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/75{background-color:color-mix(in oklab,hsl(var(--card)) 75%,transparent)}}.bg-card\/85{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/85{background-color:color-mix(in oklab,hsl(var(--card)) 85%,transparent)}}.bg-card\/90{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/90{background-color:color-mix(in oklab,hsl(var(--card)) 90%,transparent)}}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/10{background-color:color-mix(in oklab,var(--color-cyan-500) 10%,transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500) 15%,transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/5{background-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/5{background-color:color-mix(in oklab,var(--color-emerald-500) 5%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.bg-emerald-500\/80{background-color:#00bb7fcc}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/80{background-color:color-mix(in oklab,var(--color-emerald-500) 80%,transparent)}}.bg-emerald-500\/\[0\.07\]{background-color:#00bb7f12}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/\[0\.07\]{background-color:color-mix(in oklab,var(--color-emerald-500) 7%,transparent)}}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500) 10%,transparent)}}.bg-indigo-500\/15{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground,.bg-muted-foreground\/40{background-color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.bg-muted-foreground\/40{background-color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.bg-muted\/10{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/10{background-color:color-mix(in oklab,hsl(var(--muted)) 10%,transparent)}}.bg-muted\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,hsl(var(--muted)) 20%,transparent)}}.bg-muted\/40{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/40{background-color:color-mix(in oklab,hsl(var(--muted)) 40%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500) 20%,transparent)}}.bg-pink-500\/15{background-color:#f6339a26}@supports (color:color-mix(in lab,red,red)){.bg-pink-500\/15{background-color:color-mix(in oklab,var(--color-pink-500) 15%,transparent)}}.bg-popover,.bg-popover\/95{background-color:hsl(var(--popover))}@supports (color:color-mix(in lab,red,red)){.bg-popover\/95{background-color:color-mix(in oklab,hsl(var(--popover)) 95%,transparent)}}.bg-primary,.bg-primary\/5{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.bg-primary\/10{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.bg-primary\/15{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/15{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.bg-primary\/\[0\.06\]{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/\[0\.06\]{background-color:color-mix(in oklab,hsl(var(--primary)) 6%,transparent)}}.bg-purple-500\/15{background-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/15{background-color:color-mix(in oklab,var(--color-purple-500) 15%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500) 20%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/5{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500) 15%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500) 80%,transparent)}}.bg-slate-500\/15{background-color:#62748e26}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/15{background-color:color-mix(in oklab,var(--color-slate-500) 15%,transparent)}}.bg-slate-500\/20{background-color:#62748e33}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/20{background-color:color-mix(in oklab,var(--color-slate-500) 20%,transparent)}}.bg-teal-500\/15{background-color:#00baa726}@supports (color:color-mix(in lab,red,red)){.bg-teal-500\/15{background-color:color-mix(in oklab,var(--color-teal-500) 15%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/5{background-color:#8d54ff0d}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/5{background-color:color-mix(in oklab,var(--color-violet-500) 5%,transparent)}}.bg-violet-500\/10{background-color:#8d54ff1a}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/10{background-color:color-mix(in oklab,var(--color-violet-500) 10%,transparent)}}.bg-violet-500\/15{background-color:#8d54ff26}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/15{background-color:color-mix(in oklab,var(--color-violet-500) 15%,transparent)}}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-tr{--tw-gradient-position:to top right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-cyan-500{--tw-gradient-from:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-foreground{--tw-gradient-from:hsl(var(--foreground));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-500{--tw-gradient-from:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500{--tw-gradient-from:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500\/20{--tw-gradient-from:#00baa733}@supports (color:color-mix(in lab,red,red)){.from-teal-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-teal-500) 20%, transparent)}}.from-teal-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-foreground{--tw-gradient-via:hsl(var(--foreground));--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-indigo-500\/15{--tw-gradient-via:#625fff26}@supports (color:color-mix(in lab,red,red)){.via-indigo-500\/15{--tw-gradient-via:color-mix(in oklab, var(--color-indigo-500) 15%, transparent)}}.via-indigo-500\/15{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-blue-500{--tw-gradient-to:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-500{--tw-gradient-to:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary{--tw-gradient-to:hsl(var(--primary));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-purple-500\/20{--tw-gradient-to:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-purple-500) 20%, transparent)}}.to-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-500{--tw-gradient-to:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.bg-repeat{background-repeat:repeat}.fill-primary\/20{fill:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.fill-primary\/20{fill:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-12{padding:calc(var(--spacing) * 12)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[12vh\]{padding-top:12vh}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:JetBrains Mono,ui-monospace,SFMono-Regular,monospace}.font-sans{font-family:Inter,ui-sans-serif,system-ui,-apple-system,sans-serif}.font-space{font-family:Space Grotesk,sans-serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[7px\]{font-size:7px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400) 80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400) 90%,transparent)}}.text-amber-500{color:var(--color-amber-500)}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-cyan-200\/90{color:#a2f4fde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-200\/90{color:color-mix(in oklab,var(--color-cyan-200) 90%,transparent)}}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-300\/90{color:#53eafde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-300\/90{color:color-mix(in oklab,var(--color-cyan-300) 90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/90{color:#00d294e6}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/90{color:color-mix(in oklab,var(--color-emerald-400) 90%,transparent)}}.text-foreground,.text-foreground\/90{color:hsl(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.text-foreground\/90{color:color-mix(in oklab,hsl(var(--foreground)) 90%,transparent)}}.text-fuchsia-400{color:var(--color-fuchsia-400)}.text-indigo-300{color:var(--color-indigo-300)}.text-indigo-400{color:var(--color-indigo-400)}.text-muted-foreground,.text-muted-foreground\/40{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.text-muted-foreground\/50{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/50{color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.text-muted-foreground\/55{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/55{color:color-mix(in oklab,hsl(var(--muted-foreground)) 55%,transparent)}}.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.text-muted-foreground\/70{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,hsl(var(--muted-foreground)) 70%,transparent)}}.text-muted-foreground\/75{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/75{color:color-mix(in oklab,hsl(var(--muted-foreground)) 75%,transparent)}}.text-muted-foreground\/80{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/80{color:color-mix(in oklab,hsl(var(--muted-foreground)) 80%,transparent)}}.text-orange-300{color:var(--color-orange-300)}.text-pink-400{color:var(--color-pink-400)}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/70{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/70{color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.text-primary\/80{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/80{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-400\/80{color:#ff6568cc}@supports (color:color-mix(in lab,red,red)){.text-red-400\/80{color:color-mix(in oklab,var(--color-red-400) 80%,transparent)}}.text-rose-400{color:var(--color-rose-400)}.text-sky-400{color:var(--color-sky-400)}.text-slate-300{color:var(--color-slate-300)}.text-teal-400{color:var(--color-teal-400)}.text-transparent{color:#0000}.text-violet-200\/90{color:#ddd6ffe6}@supports (color:color-mix(in lab,red,red)){.text-violet-200\/90{color:color-mix(in oklab,var(--color-violet-200) 90%,transparent)}}.text-violet-300{color:var(--color-violet-300)}.text-violet-300\/80{color:#c4b4ffcc}@supports (color:color-mix(in lab,red,red)){.text-violet-300\/80{color:color-mix(in oklab,var(--color-violet-300) 80%,transparent)}}.text-violet-400{color:var(--color-violet-400)}.text-violet-400\/70{color:#a685ffb3}@supports (color:color-mix(in lab,red,red)){.text-violet-400\/70{color:color-mix(in oklab,var(--color-violet-400) 70%,transparent)}}.text-white{color:var(--color-white)}.text-white\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\/95{color:color-mix(in oklab,var(--color-white) 95%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.accent-primary{accent-color:hsl(var(--primary))}.opacity-0{opacity:0}.opacity-35{opacity:.35}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow\!{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-500\/10{--tw-shadow-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.shadow-amber-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/5{--tw-shadow-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.shadow-black\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/10{--tw-shadow-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.shadow-black\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/15{--tw-shadow-color:#00000026}@supports (color:color-mix(in lab,red,red)){.shadow-black\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/20{--tw-shadow-color:#0003}@supports (color:color-mix(in lab,red,red)){.shadow-black\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/25{--tw-shadow-color:#00000040}@supports (color:color-mix(in lab,red,red)){.shadow-black\/25{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 25%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/5{--tw-shadow-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/5{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/10{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/20{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/10{--tw-shadow-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/30{--tw-shadow-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-black\/40{--tw-ring-color:#0006}@supports (color:color-mix(in lab,red,red)){.ring-black\/40{--tw-ring-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[130px\]{--tw-blur:blur(130px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[140px\]{--tw-blur:blur(140px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.blur-\[160px\]{--tw-blur:blur(160px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a)) drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.invert{--tw-invert:invert(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.sepia{--tw-sepia:sepia(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.\!filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.select-text{-webkit-user-select:text;user-select:text}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-primary:is(:where(.group):hover *){color:hsl(var(--primary))}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}@media(hover:hover){.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:border-primary:hover,.hover\:border-primary\/20:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/20:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:border-primary\/30:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/30:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.hover\:border-primary\/40:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.hover\:border-primary\/45:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/45:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-400:hover{background-color:var(--color-amber-400)}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.hover\:bg-amber-500\/15:hover{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/15:hover{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.hover\:bg-background\/30:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/30:hover{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.hover\:bg-background\/40:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/40:hover{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.hover\:bg-background\/60:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/60:hover{background-color:color-mix(in oklab,hsl(var(--background)) 60%,transparent)}}.hover\:bg-background\/80:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/80:hover{background-color:color-mix(in oklab,hsl(var(--background)) 80%,transparent)}}.hover\:bg-card\/30:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/30:hover{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.hover\:bg-card\/70:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/70:hover{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.hover\:bg-emerald-500\/10:hover{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/10:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.hover\:bg-emerald-500\/15:hover{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/15:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.hover\:bg-indigo-500\/15:hover{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/15:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.hover\:bg-primary\/5:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/5:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/10:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.hover\:bg-primary\/15:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/15:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.hover\:bg-primary\/20:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/20:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:bg-primary\/25:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/25:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 90%,transparent)}}.hover\:bg-primary\/95:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/95:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 95%,transparent)}}.hover\:bg-red-400:hover{background-color:var(--color-red-400)}.hover\:bg-red-500\/5:hover{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/5:hover{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}}.focus\:border-primary:focus,.focus\:border-primary\/50:focus{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:border-primary\/50:focus{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-primary:focus,.focus\:ring-primary\/50:focus{--tw-ring-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:ring-primary\/50:focus{--tw-ring-color:color-mix(in oklab, hsl(var(--primary)) 50%, transparent)}}.focus\:ring-violet-500\/50:focus{--tw-ring-color:#8d54ff80}@supports (color:color-mix(in lab,red,red)){.focus\:ring-violet-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}@media(min-width:40rem){.sm\:w-\[640px\]{width:640px}.sm\:max-w-\[400px\]{max-width:400px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-auto{align-self:auto}.sm\:p-10{padding:calc(var(--spacing) * 10)}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-\[170px_1fr\]{grid-template-columns:170px 1fr}}@media(min-width:64rem){.lg\:flex{display:flex}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-\[1fr_280px\]{grid-template-columns:1fr 280px}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}}}:root{--background:224 30% 6%;--foreground:210 20% 92%;--card:224 25% 10%;--card-foreground:210 20% 94%;--popover:224 28% 9%;--popover-foreground:210 20% 94%;--primary:172 72% 50%;--primary-foreground:224 47% 8%;--muted:220 16% 14%;--muted-foreground:215 14% 64%;--accent:220 16% 16%;--accent-foreground:210 20% 94%;--border:222 18% 23%;--input:222 18% 23%;--ring:172 72% 50%;--radius:.75rem}.light{--background:0 0% 100%;--foreground:222 22% 12%;--card:0 0% 100%;--card-foreground:222 22% 12%;--popover:0 0% 100%;--popover-foreground:222 22% 12%;--primary:172 70% 38%;--primary-foreground:0 0% 100%;--muted:220 14% 95%;--muted-foreground:220 9% 42%;--accent:220 14% 94%;--accent-foreground:222 22% 12%;--border:220 13% 88%;--input:220 13% 88%;--ring:172 66% 50%}@keyframes aurora{0%{background-position:0%}50%{background-position:100%}to{background-position:0%}}.animate-aurora{background-size:200% 200%;animation:25s infinite aurora}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:9999px}*{border-color:hsl(var(--border) / .85);outline-color:hsl(var(--primary) / .5)}html,body,#root{height:100%;overflow:hidden}body{background-color:hsl(var(--background));color:hsl(var(--foreground));font-family:var(--font-sans);-webkit-font-smoothing:antialiased;margin:0}@keyframes flow-cyan{0%{stroke-dasharray:6 3;stroke-dashoffset:18px}to{stroke-dasharray:6 3;stroke-dashoffset:0}}.animate-flow-cyan{animation:1.2s linear infinite flow-cyan}.rounded-2xl.border.bg-card\/45{position:relative;overflow:hidden;background-color:hsl(var(--card) / .85)!important;border-color:hsl(var(--border) / .95)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;box-shadow:0 10px 30px -15px #00000073,inset 0 1px #ffffff0d!important}.rounded-2xl.border.bg-card\/45:before{content:"";background:linear-gradient(90deg,hsl(var(--primary)),#6366f1,#a855f7);opacity:.75;height:3.5px;position:absolute;top:0;left:0;right:0;transition:opacity .3s!important}.rounded-2xl.border.bg-card\/45:hover{transform:translateY(-3px);background-color:hsl(var(--card) / .92)!important;border-color:hsl(var(--primary) / .35)!important;box-shadow:0 20px 40px -20px #000000a6,0 0 18px 2px hsl(var(--primary) / .05)!important}.rounded-2xl.border.bg-card\/45:hover:before{opacity:1}.rounded-xl.border.bg-card\/45{background-color:hsl(var(--card) / .88)!important;border-color:hsl(var(--border) / .9)!important;transition:all .2s!important}.rounded-xl.border.bg-card\/45:hover{background-color:hsl(var(--card) / .95)!important;border-color:hsl(var(--primary) / .3)!important}aside nav button[class*="bg-primary/15"]:not([class*=justify-center]){background:linear-gradient(90deg,hsl(var(--primary) / .18),#6366f11f)!important;color:hsl(var(--primary))!important;border-left:3.5px solid hsl(var(--primary))!important;border-radius:0 var(--radius) var(--radius) 0!important;padding-left:calc(.75rem - 3.5px)!important;box-shadow:inset 0 1px #ffffff05!important}aside nav button[class*="bg-primary/15"][class*=justify-center]{background:hsl(var(--primary) / .18)!important;color:hsl(var(--primary))!important;box-shadow:0 0 12px 1px hsl(var(--primary) / .1)!important;border:1px solid hsl(var(--primary) / .3)!important}::-webkit-scrollbar-thumb{border-radius:9999px;background:hsl(var(--primary) / .25)!important}::-webkit-scrollbar-thumb:hover{background:hsl(var(--primary) / .5)!important}input:focus,textarea:focus,select:focus{outline:none;border-color:hsl(var(--primary))!important;box-shadow:0 0 0 2px hsl(var(--primary) / .15)!important}@media(min-width:1440px){html{font-size:16.5px}}@media(min-width:1920px){html{font-size:17.5px}}@media(min-width:2560px){html{font-size:19px}}@media(min-width:3440px){html{font-size:20px}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}} diff --git a/frontend/dist/assets/index-Qs-v42ar.js b/frontend/dist/assets/index-BhNoAezr.js similarity index 66% rename from frontend/dist/assets/index-Qs-v42ar.js rename to frontend/dist/assets/index-BhNoAezr.js index 30cf41b..8fd8618 100644 --- a/frontend/dist/assets/index-Qs-v42ar.js +++ b/frontend/dist/assets/index-BhNoAezr.js @@ -1,4 +1,4 @@ -var xW=Object.defineProperty;var zN=t=>{throw TypeError(t)};var bW=(t,e,n)=>e in t?xW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Gs=(t,e,n)=>bW(t,typeof e!="symbol"?e+"":e,n),ZM=(t,e,n)=>e.has(t)||zN("Cannot "+n);var me=(t,e,n)=>(ZM(t,e,"read from private field"),n?n.call(t):e.get(t)),$t=(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),St=(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 cb=(t,e,n,r)=>({set _(i){St(t,e,i,n)},get _(){return me(t,e,r)}});function _W(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function H1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var QM={exports:{}},n0={},JM={exports:{}},gn={};/** +var bW=Object.defineProperty;var BN=t=>{throw TypeError(t)};var _W=(t,e,n)=>e in t?bW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Gs=(t,e,n)=>_W(t,typeof e!="symbol"?e+"":e,n),QM=(t,e,n)=>e.has(t)||BN("Cannot "+n);var ge=(t,e,n)=>(QM(t,e,"read from private field"),n?n.call(t):e.get(t)),$t=(t,e,n)=>e.has(t)?BN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),St=(t,e,n,r)=>(QM(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),_n=(t,e,n)=>(QM(t,e,"access private method"),n);var db=(t,e,n,r)=>({set _(i){St(t,e,i,n)},get _(){return ge(t,e,r)}});function wW(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();function V1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var JM={exports:{}},n0={},eE={exports:{}},gn={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var xW=Object.defineProperty;var zN=t=>{throw TypeError(t)};var bW=(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 wW(){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"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function m($){return $===null||typeof $!="object"?null:($=f&&$[f]||$["@@iterator"],typeof $=="function"?$:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,S={};function w($,Z,ge){this.props=$,this.context=Z,this.refs=S,this.updater=ge||y}w.prototype.isReactComponent={},w.prototype.setState=function($,Z){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,Z,"setState")},w.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function _(){}_.prototype=w.prototype;function E($,Z,ge){this.props=$,this.context=Z,this.refs=S,this.updater=ge||y}var T=E.prototype=new _;T.constructor=E,x(T,w.prototype),T.isPureReactComponent=!0;var C=Array.isArray,O=Object.prototype.hasOwnProperty,N={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function F($,Z,ge){var le,ue={},_e=null,Se=null;if(Z!=null)for(le in Z.ref!==void 0&&(Se=Z.ref),Z.key!==void 0&&(_e=""+Z.key),Z)O.call(Z,le)&&!D.hasOwnProperty(le)&&(ue[le]=Z[le]);var qe=arguments.length-2;if(qe===1)ue.children=ge;else if(1{throw TypeError(t)};var bW=(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 SW(){if(VN)return n0;VN=1;var t=Wh(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,c){var d,f={},m=null,y=null;c!==void 0&&(m=""+c),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(y=l.ref);for(d in l)r.call(l,d)&&!s.hasOwnProperty(d)&&(f[d]=l[d]);if(a&&a.defaultProps)for(d in l=a.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:e,type:a,key:m,ref:y,props:f,_owner:i.current}}return n0.Fragment=n,n0.jsx=o,n0.jsxs=o,n0}var GN;function MW(){return GN||(GN=1,QM.exports=SW()),QM.exports}var g=MW(),R=Wh();const GU=H1(R),V1=_W({__proto__:null,default:GU},[R]);var ub={},eE={exports:{}},Ws={},tE={exports:{}},nE={};/** + */var GN;function MW(){if(GN)return n0;GN=1;var t=Wh(),e=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function o(a,l,c){var d,f={},m=null,y=null;c!==void 0&&(m=""+c),l.key!==void 0&&(m=""+l.key),l.ref!==void 0&&(y=l.ref);for(d in l)r.call(l,d)&&!s.hasOwnProperty(d)&&(f[d]=l[d]);if(a&&a.defaultProps)for(d in l=a.defaultProps,l)f[d]===void 0&&(f[d]=l[d]);return{$$typeof:e,type:a,key:m,ref:y,props:f,_owner:i.current}}return n0.Fragment=n,n0.jsx=o,n0.jsxs=o,n0}var WN;function EW(){return WN||(WN=1,JM.exports=MW()),JM.exports}var g=EW(),R=Wh();const WU=V1(R),G1=wW({__proto__:null,default:WU},[R]);var fb={},tE={exports:{}},Ws={},nE={exports:{}},rE={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var xW=Object.defineProperty;var zN=t=>{throw TypeError(t)};var bW=(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 EW(){return WN||(WN=1,(function(t){function e(B,q){var K=B.length;B.push(q);e:for(;0>>1,Z=B[$];if(0>>1;$i(ue,K))_ei(Se,ue)?(B[$]=Se,B[_e]=K,$=_e):(B[$]=ue,B[le]=K,$=le);else if(_ei(Se,K))B[$]=Se,B[_e]=K,$=_e;else break e}}return q}function i(B,q){var K=B.sortIndex-q.sortIndex;return K!==0?K:B.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var q=n(c);q!==null;){if(q.callback===null)r(c);else if(q.startTime<=B)r(c),q.sortIndex=q.expirationTime,e(l,q);else break;q=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,oe(O);else{var q=n(c);q!==null&&fe(C,q.startTime-B)}}function O(B,q){x=!1,S&&(S=!1,_(F),F=-1),y=!0;var K=m;try{for(T(q),f=n(l);f!==null&&(!(f.expirationTime>q)||B&&!U());){var $=f.callback;if(typeof $=="function"){f.callback=null,m=f.priorityLevel;var Z=$(f.expirationTime<=q);q=t.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),T(q)}else r(l);f=n(l)}if(f!==null)var ge=!0;else{var le=n(c);le!==null&&fe(C,le.startTime-q),ge=!1}return ge}finally{f=null,m=K,y=!1}}var N=!1,D=null,F=-1,V=5,k=-1;function U(){return!(t.unstable_now()-kB||125$?(B.sortIndex=K,e(c,B),n(l)===null&&B===n(c)&&(S?(_(F),F=-1):S=!0,fe(C,K-$))):(B.sortIndex=Z,e(l,B),x||y||(x=!0,oe(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var q=m;return function(){var K=m;m=q;try{return B.apply(this,arguments)}finally{m=K}}}})(nE)),nE}var $N;function AW(){return $N||($N=1,tE.exports=EW()),tE.exports}/** + */var $N;function AW(){return $N||($N=1,(function(t){function e(B,J){var Y=B.length;B.push(J);e:for(;0>>1,q=B[V];if(0>>1;Vi(le,Y))bei(Se,le)?(B[V]=Se,B[be]=Y,V=be):(B[V]=le,B[ae]=Y,V=ae);else if(bei(Se,Y))B[V]=Se,B[be]=Y,V=be;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 o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var 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 C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,se(O);else{var J=n(c);J!==null&&fe(C,J.startTime-B)}}function O(B,J){x=!1,S&&(S=!1,_(F),F=-1),y=!0;var Y=m;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!U());){var V=f.callback;if(typeof V=="function"){f.callback=null,m=f.priorityLevel;var q=V(f.expirationTime<=J);J=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var pe=!0;else{var ae=n(c);ae!==null&&fe(C,ae.startTime-J),pe=!1}return pe}finally{f=null,m=Y,y=!1}}var N=!1,D=null,F=-1,G=5,k=-1;function U(){return!(t.unstable_now()-kB||125V?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(_(F),F=-1):S=!0,fe(C,Y-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,se(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var J=m;return function(){var Y=m;m=J;try{return B.apply(this,arguments)}finally{m=Y}}}})(rE)),rE}var XN;function TW(){return XN||(XN=1,nE.exports=AW()),nE.exports}/** * @license React * react-dom.production.min.js * @@ -30,415 +30,420 @@ var xW=Object.defineProperty;var zN=t=>{throw TypeError(t)};var bW=(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 TW(){if(XN)return Ws;XN=1;var t=Wh(),e=AW();function n(u){for(var h="https://reactjs.org/docs/error-decoder.html?invariant="+u,b=1;b"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,c=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,d={},f={};function m(u){return l.call(f,u)?!0:l.call(d,u)?!1:c.test(u)?f[u]=!0:(d[u]=!0,!1)}function y(u,h,b,A){if(b!==null&&b.type===0)return!1;switch(typeof h){case"function":case"symbol":return!0;case"boolean":return A?!1:b!==null?!b.acceptsBooleans:(u=u.toLowerCase().slice(0,5),u!=="data-"&&u!=="aria-");default:return!1}}function x(u,h,b,A){if(h===null||typeof h>"u"||y(u,h,b,A))return!0;if(A)return!1;if(b!==null)switch(b.type){case 3:return!h;case 4:return h===!1;case 5:return isNaN(h);case 6:return isNaN(h)||1>h}return!1}function S(u,h,b,A,I,j,G){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=A,this.attributeNamespace=I,this.mustUseProperty=b,this.propertyName=u,this.type=h,this.sanitizeURL=j,this.removeEmptyString=G}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 _=/[\-:]([a-z])/g;function E(u){return u[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(u){var h=u.replace(_,E);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(_,E);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(_,E);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,b,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 m(u){return l.call(f,u)?!0:l.call(d,u)?!1:c.test(u)?f[u]=!0:(d[u]=!0,!1)}function y(u,h,b,A){if(b!==null&&b.type===0)return!1;switch(typeof h){case"function":case"symbol":return!0;case"boolean":return A?!1:b!==null?!b.acceptsBooleans:(u=u.toLowerCase().slice(0,5),u!=="data-"&&u!=="aria-");default:return!1}}function x(u,h,b,A){if(h===null||typeof h>"u"||y(u,h,b,A))return!0;if(A)return!1;if(b!==null)switch(b.type){case 3:return!h;case 4:return h===!1;case 5:return isNaN(h);case 6:return isNaN(h)||1>h}return!1}function S(u,h,b,A,I,j,W){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=A,this.attributeNamespace=I,this.mustUseProperty=b,this.propertyName=u,this.type=h,this.sanitizeURL=j,this.removeEmptyString=W}var 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 _=/[\-:]([a-z])/g;function E(u){return u[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(u){var h=u.replace(_,E);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(_,E);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(_,E);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,b,A){var I=w.hasOwnProperty(h)?w[h]:null;(I!==null?I.type!==0:A||!(2ae||I[G]!==j[ae]){var pe=` -`+I[G].replace(" at new "," at ");return u.displayName&&pe.includes("")&&(pe=pe.replace("",u.displayName)),pe}while(1<=G&&0<=ae);break}}}finally{ge=!1,Error.prepareStackTrace=b}return(u=u?u.displayName||u.name:"")?Z(u):""}function ue(u){switch(u.tag){case 5:return Z(u.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return u=le(u.type,!1),u;case 11:return u=le(u.type.render,!1),u;case 1:return u=le(u.type,!0),u;default:return""}}function _e(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 F:return"StrictMode";case ne:return"Suspense";case te:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case U:return(u.displayName||"Context")+".Consumer";case k:return(u._context.displayName||"Context")+".Provider";case H:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case he:return h=u.displayName||null,h!==null?h:_e(u.type)||"Memo";case oe:h=u._payload,u=u._init;try{return _e(u(h))}catch{}}return null}function Se(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 _e(h);case 8:return h===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function qe(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Me(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function We(u){var h=Me(u)?"checked":"value",b=Object.getOwnPropertyDescriptor(u.constructor.prototype,h),A=""+u[h];if(!u.hasOwnProperty(h)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var I=b.get,j=b.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function(G){A=""+G,j.call(this,G)}}),Object.defineProperty(u,h,{enumerable:b.enumerable}),{getValue:function(){return A},setValue:function(G){A=""+G},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function Ke(u){u._valueTracker||(u._valueTracker=We(u))}function ce(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var b=h.getValue(),A="";return u&&(A=Me(u)?u.checked?"true":"false":u.value),u=A,u!==b?(h.setValue(u),!0):!1}function Q(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}function Ge(u,h){var b=h.checked;return K({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:b??u._wrapperState.initialChecked})}function De(u,h){var b=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;b=qe(h.value!=null?h.value:b),u._wrapperState={initialChecked:A,initialValue:b,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function Xe(u,h){h=h.checked,h!=null&&T(u,"checked",h,!1)}function Je(u,h){Xe(u,h);var b=qe(h.value),A=h.type;if(b!=null)A==="number"?(b===0&&u.value===""||u.value!=b)&&(u.value=""+b):u.value!==""+b&&(u.value=""+b);else if(A==="submit"||A==="reset"){u.removeAttribute("value");return}h.hasOwnProperty("value")?at(u,h.type,b):h.hasOwnProperty("defaultValue")&&at(u,h.type,qe(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(u.defaultChecked=!!h.defaultChecked)}function bt(u,h,b){if(h.hasOwnProperty("value")||h.hasOwnProperty("defaultValue")){var A=h.type;if(!(A!=="submit"&&A!=="reset"||h.value!==void 0&&h.value!==null))return;h=""+u._wrapperState.initialValue,b||h===u.value||(u.value=h),u.defaultValue=h}b=u.name,b!==""&&(u.name=""),u.defaultChecked=!!u._wrapperState.initialChecked,b!==""&&(u.name=b)}function at(u,h,b){(h!=="number"||Q(u.ownerDocument)!==u)&&(b==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+b&&(u.defaultValue=""+b))}var ee=Array.isArray;function W(u,h,b,A){if(u=u.options,h){h={};for(var I=0;I"+h.valueOf().toString()+"",h=se.firstChild;u.firstChild;)u.removeChild(u.firstChild);for(;h.firstChild;)u.appendChild(h.firstChild)}});function $e(u,h){if(h){var b=u.firstChild;if(b&&b===u.lastChild&&b.nodeType===3){b.nodeValue=h;return}}u.textContent=h}var ut={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},Dt=["Webkit","ms","Moz","O"];Object.keys(ut).forEach(function(u){Dt.forEach(function(h){h=h+u.charAt(0).toUpperCase()+u.substring(1),ut[h]=ut[u]})});function Et(u,h,b){return h==null||typeof h=="boolean"||h===""?"":b||typeof h!="number"||h===0||ut.hasOwnProperty(u)&&ut[u]?(""+h).trim():h+"px"}function mt(u,h){u=u.style;for(var b in h)if(h.hasOwnProperty(b)){var A=b.indexOf("--")===0,I=Et(b,h[b],A);b==="float"&&(b="cssFloat"),A?u.setProperty(b,I):u[b]=I}}var de=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function J(u,h){if(h){if(de[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 Ae(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 re=null;function Ue(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Te=null,Oe=null,Ye=null;function ft(u){if(u=pa(u)){if(typeof Te!="function")throw Error(n(280));var h=u.stateNode;h&&(h=Dp(h),Te(u.stateNode,u.type,h))}}function Yt(u){Oe?Ye?Ye.push(u):Ye=[u]:Oe=u}function un(){if(Oe){var u=Oe,h=Ye;if(Ye=Oe=null,ft(u),h)for(u=0;u>>=0,u===0?32:31-(xn(u)/tn|0)|0}var li=64,kn=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 b=u.pendingLanes;if(b===0)return 0;var A=0,I=u.suspendedLanes,j=u.pingedLanes,G=b&268435455;if(G!==0){var ae=G&~I;ae!==0?A=Is(ae):(j&=G,j!==0&&(A=Is(j)))}else G=b&~I,G!==0?A=Is(G):j!==0&&(A=Is(j));if(A===0)return 0;if(h!==0&&h!==A&&(h&I)===0&&(I=A&-A,j=h&-h,I>=j||I===16&&(j&4194240)!==0))return h;if((A&4)!==0&&(A|=b&16),h=u.entangledLanes,h!==0)for(u=u.entanglements,h&=A;0b;b++)h.push(u);return h}function Za(u,h,b){u.pendingLanes|=h,h!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,h=31-gt(h),u[h]=b}function _M(u,h){var b=u.pendingLanes&~h;u.pendingLanes=h,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=h,u.mutableReadLanes&=h,u.entangledLanes&=h,h=u.entanglements;var A=u.eventTimes;for(u=u.expirationTimes;0=qr),Us=" ",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 xp(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var tl=!1;function Mx(u,h){switch(u){case"compositionend":return xp(h);case"keypress":return h.which!==32?null:(vv=!0,Us);case"textInput":return u=h.data,u===Us&&vv?null:u;default:return null}}function Hd(u,h){if(tl)return u==="compositionend"||!Ci&&yv(u,h)?(u=zd(),Wi=uv=no=null,tl=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1=h)return{node:b,offset:h-u};u=A}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=Vd(b)}}function nc(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?nc(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function nr(){for(var u=window,h=Q();h instanceof u.HTMLIFrameElement;){try{var b=typeof h.contentWindow.location.href=="string"}catch{b=!1}if(b)u=h.contentWindow;else break;h=Q(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 jr(u){var h=nr(),b=u.focusedElem,A=u.selectionRange;if(h!==b&&b&&b.ownerDocument&&nc(b.ownerDocument.documentElement,b)){if(A!==null&&Dr(b)){if(h=A.start,u=A.end,u===void 0&&(u=h),"selectionStart"in b)b.selectionStart=h,b.selectionEnd=Math.min(u,b.value.length);else if(u=(h=b.ownerDocument||document)&&h.defaultView||window,u.getSelection){u=u.getSelection();var I=b.textContent.length,j=Math.min(A.start,I);A=A.end===void 0?j:Math.min(A.end,I),!u.extend&&j>A&&(I=A,A=j,j=I),I=fs(b,j);var G=fs(b,A);I&&G&&(u.rangeCount!==1||u.anchorNode!==I.node||u.anchorOffset!==I.offset||u.focusNode!==G.node||u.focusOffset!==G.offset)&&(h=h.createRange(),h.setStart(I.node,I.offset),u.removeAllRanges(),j>A?(u.addRange(h),u.extend(G.node,G.offset)):(h.setEnd(G.node,G.offset),u.addRange(h)))}}for(h=[],u=b;u=u.parentNode;)u.nodeType===1&&h.push({element:u,left:u.scrollLeft,top:u.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b=document.documentMode,Ro=null,rc=null,Gd=null,Ur=!1;function Mp(u,h,b){var A=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;Ur||Ro==null||Ro!==Q(A)||(A=Ro,"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}),Gd&&tc(Gd,A)||(Gd=A,A=Np(rc,"onSelect"),0Fr||(u.current=Rv[Fr],Rv[Fr]=null,Fr--)}function Gn(u,h){Fr++,Rv[Fr]=u.current,u.current=h}var ma={},Kr=ar(ma),Pi=ar(!1),ga=ma;function ac(u,h){var b=u.type.contextTypes;if(!b)return ma;var A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var I={},j;for(j in b)I[j]=h[j];return A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=h,u.__reactInternalMemoizedMaskedChildContext=I),I}function ui(u){return u=u.childContextTypes,u!=null}function Qd(){$n(Pi),$n(Kr)}function Nv(u,h,b){if(Kr.current!==ma)throw Error(n(168));Gn(Kr,h),Gn(Pi,b)}function Jd(u,h,b){var A=u.stateNode;if(h=h.childContextTypes,typeof A.getChildContext!="function")return b;A=A.getChildContext();for(var I in A)if(!(I in h))throw Error(n(108,Se(u)||"Unknown",I));return K({},b,A)}function lc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||ma,ga=Kr.current,Gn(Kr,u),Gn(Pi,Pi.current),!0}function Iv(u,h,b){var A=u.stateNode;if(!A)throw Error(n(169));b?(u=Jd(u,h,ga),A.__reactInternalMemoizedMergedChildContext=u,$n(Pi),$n(Kr),Gn(Kr,u)):$n(Pi),Gn(Pi,b)}var oo=null,ef=!1,jp=!1;function tf(u){oo===null?oo=[u]:oo.push(u)}function Ix(u){ef=!0,tf(u)}function Io(){if(!jp&&oo!==null){jp=!0;var u=0,h=Pn;try{var b=oo;for(Pn=1;u>=G,I-=G,dt=1<<32-gt(h)+I|b<nn?(pi=Wt,Wt=null):pi=Wt.sibling;var Dn=Ze(Ce,Wt,Re[nn],ot);if(Dn===null){Wt===null&&(Wt=pi);break}u&&Wt&&Dn.alternate===null&&h(Ce,Wt),ve=j(Dn,ve,nn),Gt===null?jt=Dn:Gt.sibling=Dn,Gt=Dn,Wt=pi}if(nn===Re.length)return b(Ce,Wt),qn&&va(Ce,nn),jt;if(Wt===null){for(;nnnn?(pi=Wt,Wt=null):pi=Wt.sibling;var Vu=Ze(Ce,Wt,Dn.value,ot);if(Vu===null){Wt===null&&(Wt=pi);break}u&&Wt&&Vu.alternate===null&&h(Ce,Wt),ve=j(Vu,ve,nn),Gt===null?jt=Vu:Gt.sibling=Vu,Gt=Vu,Wt=pi}if(Dn.done)return b(Ce,Wt),qn&&va(Ce,nn),jt;if(Wt===null){for(;!Dn.done;nn++,Dn=Re.next())Dn=et(Ce,Dn.value,ot),Dn!==null&&(ve=j(Dn,ve,nn),Gt===null?jt=Dn:Gt.sibling=Dn,Gt=Dn);return qn&&va(Ce,nn),jt}for(Wt=A(Ce,Wt);!Dn.done;nn++,Dn=Re.next())Dn=wt(Wt,Ce,nn,Dn.value,ot),Dn!==null&&(u&&Dn.alternate!==null&&Wt.delete(Dn.key===null?nn:Dn.key),ve=j(Dn,ve,nn),Gt===null?jt=Dn:Gt.sibling=Dn,Gt=Dn);return u&&Wt.forEach(function(yW){return h(Ce,yW)}),qn&&va(Ce,nn),jt}function Ir(Ce,ve,Re,ot){if(typeof Re=="object"&&Re!==null&&Re.type===D&&Re.key===null&&(Re=Re.props.children),typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case O:e:{for(var jt=Re.key,Gt=ve;Gt!==null;){if(Gt.key===jt){if(jt=Re.type,jt===D){if(Gt.tag===7){b(Ce,Gt.sibling),ve=I(Gt,Re.props.children),ve.return=Ce,Ce=ve;break e}}else if(Gt.elementType===jt||typeof jt=="object"&&jt!==null&&jt.$$typeof===oe&&Uv(jt)===Gt.type){b(Ce,Gt.sibling),ve=I(Gt,Re.props),ve.ref=nf(Ce,Gt,Re),ve.return=Ce,Ce=ve;break e}b(Ce,Gt);break}else h(Ce,Gt);Gt=Gt.sibling}Re.type===D?(ve=_f(Re.props.children,Ce.mode,ot,Re.key),ve.return=Ce,Ce=ve):(ot=tb(Re.type,Re.key,Re.props,null,Ce.mode,ot),ot.ref=nf(Ce,ve,Re),ot.return=Ce,Ce=ot)}return G(Ce);case N:e:{for(Gt=Re.key;ve!==null;){if(ve.key===Gt)if(ve.tag===4&&ve.stateNode.containerInfo===Re.containerInfo&&ve.stateNode.implementation===Re.implementation){b(Ce,ve.sibling),ve=I(ve,Re.children||[]),ve.return=Ce,Ce=ve;break e}else{b(Ce,ve);break}else h(Ce,ve);ve=ve.sibling}ve=$M(Re,Ce.mode,ot),ve.return=Ce,Ce=ve}return G(Ce);case oe:return Gt=Re._init,Ir(Ce,ve,Gt(Re._payload),ot)}if(ee(Re))return Pt(Ce,ve,Re,ot);if(q(Re))return It(Ce,ve,Re,ot);rf(Ce,Re)}return typeof Re=="string"&&Re!==""||typeof Re=="number"?(Re=""+Re,ve!==null&&ve.tag===6?(b(Ce,ve.sibling),ve=I(ve,Re),ve.return=Ce,Ce=ve):(b(Ce,ve),ve=WM(Re,Ce.mode,ot),ve.return=Ce,Ce=ve),G(Ce)):b(Ce,ve)}return Ir}var dc=Fv(!0),sf=Fv(!1),fc=ar(null),hc=null,xa=null,Iu=null;function pc(){Iu=xa=hc=null}function of(u){var h=fc.current;$n(fc),u._currentValue=h}function af(u,h,b){for(;u!==null;){var A=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,A!==null&&(A.childLanes|=h)):A!==null&&(A.childLanes&h)!==h&&(A.childLanes|=h),u===b)break;u=u.return}}function al(u,h){hc=u,Iu=xa=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(Iu!==u)if(u={context:u,memoizedValue:h,next:null},xa===null){if(hc===null)throw Error(n(308));xa=u,hc.dependencies={lanes:0,firstContext:u}}else xa=xa.next=u;return h}var ba=null;function zv(u){ba===null?ba=[u]:ba.push(u)}function lf(u,h,b,A){var I=h.interleaved;return I===null?(b.next=b,zv(h)):(b.next=I.next,I.next=b),h.interleaved=b,ao(u,A)}function ao(u,h){u.lanes|=h;var b=u.alternate;for(b!==null&&(b.lanes|=h),b=u,u=u.return;u!==null;)u.childLanes|=h,b=u.alternate,b!==null&&(b.childLanes|=h),b=u,u=u.return;return b.tag===3?b.stateNode:null}var Fn=!1;function an(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mr(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 Qn(u,h,b){var A=u.updateQueue;if(A===null)return null;if(A=A.shared,(On&2)!==0){var I=A.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),A.pending=h,ao(u,b)}return I=A.interleaved,I===null?(h.next=h,zv(A)):(h.next=I.next,I.next=h),A.interleaved=h,ao(u,b)}function di(u,h,b){if(h=h.updateQueue,h!==null&&(h=h.shared,(b&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,b|=A,h.lanes=b,fu(u,b)}}function mc(u,h){var b=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,b===A)){var I=null,j=null;if(b=b.firstBaseUpdate,b!==null){do{var G={eventTime:b.eventTime,lane:b.lane,tag:b.tag,payload:b.payload,callback:b.callback,next:null};j===null?I=j=G:j=j.next=G,b=b.next}while(b!==null);j===null?I=j=h:j=j.next=h}else I=j=h;b={baseState:A.baseState,firstBaseUpdate:I,lastBaseUpdate:j,shared:A.shared,effects:A.effects},u.updateQueue=b;return}u=b.lastBaseUpdate,u===null?b.firstBaseUpdate=h:u.next=h,b.lastBaseUpdate=h}function lr(u,h,b,A){var I=u.updateQueue;Fn=!1;var j=I.firstBaseUpdate,G=I.lastBaseUpdate,ae=I.shared.pending;if(ae!==null){I.shared.pending=null;var pe=ae,Le=pe.next;pe.next=null,G===null?j=Le:G.next=Le,G=pe;var Qe=u.alternate;Qe!==null&&(Qe=Qe.updateQueue,ae=Qe.lastBaseUpdate,ae!==G&&(ae===null?Qe.firstBaseUpdate=Le:ae.next=Le,Qe.lastBaseUpdate=pe))}if(j!==null){var et=I.baseState;G=0,Qe=Le=pe=null,ae=j;do{var Ze=ae.lane,wt=ae.eventTime;if((A&Ze)===Ze){Qe!==null&&(Qe=Qe.next={eventTime:wt,lane:0,tag:ae.tag,payload:ae.payload,callback:ae.callback,next:null});e:{var Pt=u,It=ae;switch(Ze=h,wt=b,It.tag){case 1:if(Pt=It.payload,typeof Pt=="function"){et=Pt.call(wt,et,Ze);break e}et=Pt;break e;case 3:Pt.flags=Pt.flags&-65537|128;case 0:if(Pt=It.payload,Ze=typeof Pt=="function"?Pt.call(wt,et,Ze):Pt,Ze==null)break e;et=K({},et,Ze);break e;case 2:Fn=!0}}ae.callback!==null&&ae.lane!==0&&(u.flags|=64,Ze=I.effects,Ze===null?I.effects=[ae]:Ze.push(ae))}else wt={eventTime:wt,lane:Ze,tag:ae.tag,payload:ae.payload,callback:ae.callback,next:null},Qe===null?(Le=Qe=wt,pe=et):Qe=Qe.next=wt,G|=Ze;if(ae=ae.next,ae===null){if(ae=I.shared.pending,ae===null)break;Ze=ae,ae=Ze.next,Ze.next=null,I.lastBaseUpdate=Ze,I.shared.pending=null}}while(!0);if(Qe===null&&(pe=et),I.baseState=pe,I.firstBaseUpdate=Le,I.lastBaseUpdate=Qe,h=I.shared.interleaved,h!==null){I=h;do G|=I.lane,I=I.next;while(I!==h)}else j===null&&(I.shared.lanes=0);vf|=G,u.lanes=G,u.memoizedState=et}}function ku(u,h,b){if(u=h.effects,h.effects=null,u!==null)for(h=0;hb?b:4,u(!0);var A=xc.transition;xc.transition={};try{u(!1),h()}finally{Pn=b,xc.transition=A}}function Ma(){return gs().memoizedState}function $p(u,h,b){var A=zu(u);if(b={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null},mf(u))Xp(h,b);else if(b=lf(u,h,b,A),b!==null){var I=xs();Ca(b,u,A,I),qp(b,h,A)}}function bc(u,h,b){var A=zu(u),I={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null};if(mf(u))Xp(h,I);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=h.lastRenderedReducer,j!==null))try{var G=h.lastRenderedState,ae=j(G,b);if(I.hasEagerState=!0,I.eagerState=ae,ds(ae,G)){var pe=h.interleaved;pe===null?(I.next=I,zv(h)):(I.next=pe.next,pe.next=I),h.interleaved=I;return}}catch{}finally{}b=lf(u,h,I,A),b!==null&&(I=xs(),Ca(b,u,A,I),qp(b,h,A))}}function mf(u){var h=u.alternate;return u===Xn||h!==null&&h===Xn}function Xp(u,h){fi=co=!0;var b=u.pending;b===null?h.next=h:(h.next=b.next,b.next=h),u.pending=h}function qp(u,h,b){if((b&4194240)!==0){var A=h.lanes;A&=u.pendingLanes,b|=A,h.lanes=b,fu(u,b)}}var Kp={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},Fx={readContext:ps,useCallback:function(u,h){return Qr().memoizedState=[u,h===void 0?null:h],u},useContext:ps,useEffect:Ii,useImperativeHandle:function(u,h,b){return b=b!=null?b.concat([u]):null,Lo(4194308,4,jx.bind(null,h,u),b)},useLayoutEffect:function(u,h){return Lo(4194308,4,u,h)},useInsertionEffect:function(u,h){return Lo(4,2,u,h)},useMemo:function(u,h){var b=Qr();return h=h===void 0?null:h,u=u(),b.memoizedState=[u,h],u},useReducer:function(u,h,b){var A=Qr();return h=b!==void 0?b(h):h,A.memoizedState=A.baseState=h,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:h},A.queue=u,u=u.dispatch=$p.bind(null,Xn,u),[A.memoizedState,u]},useRef:function(u){var h=Qr();return u={current:u},h.memoizedState=u},useState:Wv,useDebugValue:Gp,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,b){var A=Xn,I=Qr();if(qn){if(b===void 0)throw Error(n(407));b=b()}else{if(b=h(),hi===null)throw Error(n(349));(wa&30)!==0||Vp(A,h,b)}I.memoizedState=b;var j={value:b,getSnapshot:h};return I.queue=j,Ii(kx.bind(null,A,j,u),[u]),A.flags|=2048,uo(9,hf.bind(null,A,j,b,h),void 0,null),b},useId:function(){var u=Qr(),h=hi.identifierPrefix;if(qn){var b=Fs,A=dt;b=(A&~(1<<32-gt(A)-1)).toString(32)+b,h=":"+h+"R"+b,b=cl++,0oe||I[W]!==j[oe]){var me=` +`+I[W].replace(" at new "," at ");return u.displayName&&me.includes("")&&(me=me.replace("",u.displayName)),me}while(1<=W&&0<=oe);break}}}finally{pe=!1,Error.prepareStackTrace=b}return(u=u?u.displayName||u.name:"")?q(u):""}function le(u){switch(u.tag){case 5:return q(u.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return u=ae(u.type,!1),u;case 11:return u=ae(u.type.render,!1),u;case 1:return u=ae(u.type,!0),u;default:return""}}function be(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 G:return"Profiler";case F:return"StrictMode";case ne:return"Suspense";case te:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case U:return(u.displayName||"Context")+".Consumer";case k:return(u._context.displayName||"Context")+".Provider";case H:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case he:return h=u.displayName||null,h!==null?h:be(u.type)||"Memo";case se:h=u._payload,u=u._init;try{return be(u(h))}catch{}}return null}function Se(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 be(h);case 8:return h===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function qe(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Me(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function $e(u){var h=Me(u)?"checked":"value",b=Object.getOwnPropertyDescriptor(u.constructor.prototype,h),A=""+u[h];if(!u.hasOwnProperty(h)&&typeof b<"u"&&typeof b.get=="function"&&typeof b.set=="function"){var I=b.get,j=b.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function(W){A=""+W,j.call(this,W)}}),Object.defineProperty(u,h,{enumerable:b.enumerable}),{getValue:function(){return A},setValue:function(W){A=""+W},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function Ke(u){u._valueTracker||(u._valueTracker=$e(u))}function ce(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var b=h.getValue(),A="";return u&&(A=Me(u)?u.checked?"true":"false":u.value),u=A,u!==b?(h.setValue(u),!0):!1}function Z(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}function We(u,h){var b=h.checked;return Y({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:b??u._wrapperState.initialChecked})}function je(u,h){var b=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;b=qe(h.value!=null?h.value:b),u._wrapperState={initialChecked:A,initialValue:b,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function Xe(u,h){h=h.checked,h!=null&&T(u,"checked",h,!1)}function Je(u,h){Xe(u,h);var b=qe(h.value),A=h.type;if(b!=null)A==="number"?(b===0&&u.value===""||u.value!=b)&&(u.value=""+b):u.value!==""+b&&(u.value=""+b);else if(A==="submit"||A==="reset"){u.removeAttribute("value");return}h.hasOwnProperty("value")?ut(u,h.type,b):h.hasOwnProperty("defaultValue")&&ut(u,h.type,qe(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(u.defaultChecked=!!h.defaultChecked)}function bt(u,h,b){if(h.hasOwnProperty("value")||h.hasOwnProperty("defaultValue")){var A=h.type;if(!(A!=="submit"&&A!=="reset"||h.value!==void 0&&h.value!==null))return;h=""+u._wrapperState.initialValue,b||h===u.value||(u.value=h),u.defaultValue=h}b=u.name,b!==""&&(u.name=""),u.defaultChecked=!!u._wrapperState.initialChecked,b!==""&&(u.name=b)}function ut(u,h,b){(h!=="number"||Z(u.ownerDocument)!==u)&&(b==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+b&&(u.defaultValue=""+b))}var ee=Array.isArray;function $(u,h,b,A){if(u=u.options,h){h={};for(var I=0;I"+h.valueOf().toString()+"",h=dt.firstChild;u.firstChild;)u.removeChild(u.firstChild);for(;h.firstChild;)u.appendChild(h.firstChild)}});function Ne(u,h){if(h){var b=u.firstChild;if(b&&b===u.lastChild&&b.nodeType===3){b.nodeValue=h;return}}u.textContent=h}var tt={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},jt=["Webkit","ms","Moz","O"];Object.keys(tt).forEach(function(u){jt.forEach(function(h){h=h+u.charAt(0).toUpperCase()+u.substring(1),tt[h]=tt[u]})});function Lt(u,h,b){return h==null||typeof h=="boolean"||h===""?"":b||typeof h!="number"||h===0||tt.hasOwnProperty(u)&&tt[u]?(""+h).trim():h+"px"}function ct(u,h){u=u.style;for(var b in h)if(h.hasOwnProperty(b)){var A=b.indexOf("--")===0,I=Lt(b,h[b],A);b==="float"&&(b="cssFloat"),A?u.setProperty(b,I):u[b]=I}}var ue=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 Q(u,h){if(h){if(ue[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 Ae(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 re=null;function Fe(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Te=null,Le=null,Ye=null;function ht(u){if(u=pa(u)){if(typeof Te!="function")throw Error(n(280));var h=u.stateNode;h&&(h=Dp(h),Te(u.stateNode,u.type,h))}}function Yt(u){Le?Ye?Ye.push(u):Ye=[u]:Le=u}function un(){if(Le){var u=Le,h=Ye;if(Ye=Le=null,ht(u),h)for(u=0;u>>=0,u===0?32:31-(xn(u)/tn|0)|0}var li=64,kn=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 b=u.pendingLanes;if(b===0)return 0;var A=0,I=u.suspendedLanes,j=u.pingedLanes,W=b&268435455;if(W!==0){var oe=W&~I;oe!==0?A=Is(oe):(j&=W,j!==0&&(A=Is(j)))}else W=b&~I,W!==0?A=Is(W):j!==0&&(A=Is(j));if(A===0)return 0;if(h!==0&&h!==A&&(h&I)===0&&(I=A&-A,j=h&-h,I>=j||I===16&&(j&4194240)!==0))return h;if((A&4)!==0&&(A|=b&16),h=u.entangledLanes,h!==0)for(u=u.entanglements,h&=A;0b;b++)h.push(u);return h}function Za(u,h,b){u.pendingLanes|=h,h!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,h=31-vt(h),u[h]=b}function wM(u,h){var b=u.pendingLanes&~h;u.pendingLanes=h,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=h,u.mutableReadLanes&=h,u.entangledLanes&=h,h=u.entanglements;var A=u.eventTimes;for(u=u.expirationTimes;0=qr),Us=" ",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 xp(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var tl=!1;function Ax(u,h){switch(u){case"compositionend":return xp(h);case"keypress":return h.which!==32?null:(vv=!0,Us);case"textInput":return u=h.data,u===Us&&vv?null:u;default:return null}}function Hd(u,h){if(tl)return u==="compositionend"||!Ci&&yv(u,h)?(u=zd(),Wi=uv=no=null,tl=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1=h)return{node:b,offset:h-u};u=A}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=Vd(b)}}function nc(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?nc(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function nr(){for(var u=window,h=Z();h instanceof u.HTMLIFrameElement;){try{var b=typeof h.contentWindow.location.href=="string"}catch{b=!1}if(b)u=h.contentWindow;else break;h=Z(u.document)}return h}function 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 jr(u){var h=nr(),b=u.focusedElem,A=u.selectionRange;if(h!==b&&b&&b.ownerDocument&&nc(b.ownerDocument.documentElement,b)){if(A!==null&&Dr(b)){if(h=A.start,u=A.end,u===void 0&&(u=h),"selectionStart"in b)b.selectionStart=h,b.selectionEnd=Math.min(u,b.value.length);else if(u=(h=b.ownerDocument||document)&&h.defaultView||window,u.getSelection){u=u.getSelection();var I=b.textContent.length,j=Math.min(A.start,I);A=A.end===void 0?j:Math.min(A.end,I),!u.extend&&j>A&&(I=A,A=j,j=I),I=fs(b,j);var W=fs(b,A);I&&W&&(u.rangeCount!==1||u.anchorNode!==I.node||u.anchorOffset!==I.offset||u.focusNode!==W.node||u.focusOffset!==W.offset)&&(h=h.createRange(),h.setStart(I.node,I.offset),u.removeAllRanges(),j>A?(u.addRange(h),u.extend(W.node,W.offset)):(h.setEnd(W.node,W.offset),u.addRange(h)))}}for(h=[],u=b;u=u.parentNode;)u.nodeType===1&&h.push({element:u,left:u.scrollLeft,top:u.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b=document.documentMode,Ro=null,rc=null,Gd=null,Ur=!1;function Mp(u,h,b){var A=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;Ur||Ro==null||Ro!==Z(A)||(A=Ro,"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}),Gd&&tc(Gd,A)||(Gd=A,A=Np(rc,"onSelect"),0Fr||(u.current=Rv[Fr],Rv[Fr]=null,Fr--)}function Gn(u,h){Fr++,Rv[Fr]=u.current,u.current=h}var ma={},Kr=ar(ma),Pi=ar(!1),ga=ma;function ac(u,h){var b=u.type.contextTypes;if(!b)return ma;var A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var I={},j;for(j in b)I[j]=h[j];return A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=h,u.__reactInternalMemoizedMaskedChildContext=I),I}function ui(u){return u=u.childContextTypes,u!=null}function Qd(){$n(Pi),$n(Kr)}function Nv(u,h,b){if(Kr.current!==ma)throw Error(n(168));Gn(Kr,h),Gn(Pi,b)}function Jd(u,h,b){var A=u.stateNode;if(h=h.childContextTypes,typeof A.getChildContext!="function")return b;A=A.getChildContext();for(var I in A)if(!(I in h))throw Error(n(108,Se(u)||"Unknown",I));return Y({},b,A)}function lc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||ma,ga=Kr.current,Gn(Kr,u),Gn(Pi,Pi.current),!0}function Iv(u,h,b){var A=u.stateNode;if(!A)throw Error(n(169));b?(u=Jd(u,h,ga),A.__reactInternalMemoizedMergedChildContext=u,$n(Pi),$n(Kr),Gn(Kr,u)):$n(Pi),Gn(Pi,b)}var oo=null,ef=!1,jp=!1;function tf(u){oo===null?oo=[u]:oo.push(u)}function Ox(u){ef=!0,tf(u)}function Io(){if(!jp&&oo!==null){jp=!0;var u=0,h=Pn;try{var b=oo;for(Pn=1;u>=W,I-=W,ft=1<<32-vt(h)+I|b<nn?(pi=Wt,Wt=null):pi=Wt.sibling;var Dn=Ze(Ce,Wt,Re[nn],ot);if(Dn===null){Wt===null&&(Wt=pi);break}u&&Wt&&Dn.alternate===null&&h(Ce,Wt),ve=j(Dn,ve,nn),Gt===null?Dt=Dn:Gt.sibling=Dn,Gt=Dn,Wt=pi}if(nn===Re.length)return b(Ce,Wt),qn&&va(Ce,nn),Dt;if(Wt===null){for(;nnnn?(pi=Wt,Wt=null):pi=Wt.sibling;var Vu=Ze(Ce,Wt,Dn.value,ot);if(Vu===null){Wt===null&&(Wt=pi);break}u&&Wt&&Vu.alternate===null&&h(Ce,Wt),ve=j(Vu,ve,nn),Gt===null?Dt=Vu:Gt.sibling=Vu,Gt=Vu,Wt=pi}if(Dn.done)return b(Ce,Wt),qn&&va(Ce,nn),Dt;if(Wt===null){for(;!Dn.done;nn++,Dn=Re.next())Dn=et(Ce,Dn.value,ot),Dn!==null&&(ve=j(Dn,ve,nn),Gt===null?Dt=Dn:Gt.sibling=Dn,Gt=Dn);return qn&&va(Ce,nn),Dt}for(Wt=A(Ce,Wt);!Dn.done;nn++,Dn=Re.next())Dn=wt(Wt,Ce,nn,Dn.value,ot),Dn!==null&&(u&&Dn.alternate!==null&&Wt.delete(Dn.key===null?nn:Dn.key),ve=j(Dn,ve,nn),Gt===null?Dt=Dn:Gt.sibling=Dn,Gt=Dn);return u&&Wt.forEach(function(xW){return h(Ce,xW)}),qn&&va(Ce,nn),Dt}function Ir(Ce,ve,Re,ot){if(typeof Re=="object"&&Re!==null&&Re.type===D&&Re.key===null&&(Re=Re.props.children),typeof Re=="object"&&Re!==null){switch(Re.$$typeof){case O:e:{for(var Dt=Re.key,Gt=ve;Gt!==null;){if(Gt.key===Dt){if(Dt=Re.type,Dt===D){if(Gt.tag===7){b(Ce,Gt.sibling),ve=I(Gt,Re.props.children),ve.return=Ce,Ce=ve;break e}}else if(Gt.elementType===Dt||typeof Dt=="object"&&Dt!==null&&Dt.$$typeof===se&&Uv(Dt)===Gt.type){b(Ce,Gt.sibling),ve=I(Gt,Re.props),ve.ref=nf(Ce,Gt,Re),ve.return=Ce,Ce=ve;break e}b(Ce,Gt);break}else h(Ce,Gt);Gt=Gt.sibling}Re.type===D?(ve=_f(Re.props.children,Ce.mode,ot,Re.key),ve.return=Ce,Ce=ve):(ot=rb(Re.type,Re.key,Re.props,null,Ce.mode,ot),ot.ref=nf(Ce,ve,Re),ot.return=Ce,Ce=ot)}return W(Ce);case N:e:{for(Gt=Re.key;ve!==null;){if(ve.key===Gt)if(ve.tag===4&&ve.stateNode.containerInfo===Re.containerInfo&&ve.stateNode.implementation===Re.implementation){b(Ce,ve.sibling),ve=I(ve,Re.children||[]),ve.return=Ce,Ce=ve;break e}else{b(Ce,ve);break}else h(Ce,ve);ve=ve.sibling}ve=XM(Re,Ce.mode,ot),ve.return=Ce,Ce=ve}return W(Ce);case se:return Gt=Re._init,Ir(Ce,ve,Gt(Re._payload),ot)}if(ee(Re))return Ct(Ce,ve,Re,ot);if(J(Re))return Nt(Ce,ve,Re,ot);rf(Ce,Re)}return typeof Re=="string"&&Re!==""||typeof Re=="number"?(Re=""+Re,ve!==null&&ve.tag===6?(b(Ce,ve.sibling),ve=I(ve,Re),ve.return=Ce,Ce=ve):(b(Ce,ve),ve=$M(Re,Ce.mode,ot),ve.return=Ce,Ce=ve),W(Ce)):b(Ce,ve)}return Ir}var dc=Fv(!0),sf=Fv(!1),fc=ar(null),hc=null,xa=null,Iu=null;function pc(){Iu=xa=hc=null}function of(u){var h=fc.current;$n(fc),u._currentValue=h}function af(u,h,b){for(;u!==null;){var A=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,A!==null&&(A.childLanes|=h)):A!==null&&(A.childLanes&h)!==h&&(A.childLanes|=h),u===b)break;u=u.return}}function al(u,h){hc=u,Iu=xa=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(Iu!==u)if(u={context:u,memoizedValue:h,next:null},xa===null){if(hc===null)throw Error(n(308));xa=u,hc.dependencies={lanes:0,firstContext:u}}else xa=xa.next=u;return h}var ba=null;function zv(u){ba===null?ba=[u]:ba.push(u)}function lf(u,h,b,A){var I=h.interleaved;return I===null?(b.next=b,zv(h)):(b.next=I.next,I.next=b),h.interleaved=b,ao(u,A)}function ao(u,h){u.lanes|=h;var b=u.alternate;for(b!==null&&(b.lanes|=h),b=u,u=u.return;u!==null;)u.childLanes|=h,b=u.alternate,b!==null&&(b.childLanes|=h),b=u,u=u.return;return b.tag===3?b.stateNode:null}var Fn=!1;function an(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mr(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 Qn(u,h,b){var A=u.updateQueue;if(A===null)return null;if(A=A.shared,(On&2)!==0){var I=A.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),A.pending=h,ao(u,b)}return I=A.interleaved,I===null?(h.next=h,zv(A)):(h.next=I.next,I.next=h),A.interleaved=h,ao(u,b)}function di(u,h,b){if(h=h.updateQueue,h!==null&&(h=h.shared,(b&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,b|=A,h.lanes=b,fu(u,b)}}function mc(u,h){var b=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,b===A)){var I=null,j=null;if(b=b.firstBaseUpdate,b!==null){do{var W={eventTime:b.eventTime,lane:b.lane,tag:b.tag,payload:b.payload,callback:b.callback,next:null};j===null?I=j=W:j=j.next=W,b=b.next}while(b!==null);j===null?I=j=h:j=j.next=h}else I=j=h;b={baseState:A.baseState,firstBaseUpdate:I,lastBaseUpdate:j,shared:A.shared,effects:A.effects},u.updateQueue=b;return}u=b.lastBaseUpdate,u===null?b.firstBaseUpdate=h:u.next=h,b.lastBaseUpdate=h}function lr(u,h,b,A){var I=u.updateQueue;Fn=!1;var j=I.firstBaseUpdate,W=I.lastBaseUpdate,oe=I.shared.pending;if(oe!==null){I.shared.pending=null;var me=oe,De=me.next;me.next=null,W===null?j=De:W.next=De,W=me;var Qe=u.alternate;Qe!==null&&(Qe=Qe.updateQueue,oe=Qe.lastBaseUpdate,oe!==W&&(oe===null?Qe.firstBaseUpdate=De:oe.next=De,Qe.lastBaseUpdate=me))}if(j!==null){var et=I.baseState;W=0,Qe=De=me=null,oe=j;do{var Ze=oe.lane,wt=oe.eventTime;if((A&Ze)===Ze){Qe!==null&&(Qe=Qe.next={eventTime:wt,lane:0,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null});e:{var Ct=u,Nt=oe;switch(Ze=h,wt=b,Nt.tag){case 1:if(Ct=Nt.payload,typeof Ct=="function"){et=Ct.call(wt,et,Ze);break e}et=Ct;break e;case 3:Ct.flags=Ct.flags&-65537|128;case 0:if(Ct=Nt.payload,Ze=typeof Ct=="function"?Ct.call(wt,et,Ze):Ct,Ze==null)break e;et=Y({},et,Ze);break e;case 2:Fn=!0}}oe.callback!==null&&oe.lane!==0&&(u.flags|=64,Ze=I.effects,Ze===null?I.effects=[oe]:Ze.push(oe))}else wt={eventTime:wt,lane:Ze,tag:oe.tag,payload:oe.payload,callback:oe.callback,next:null},Qe===null?(De=Qe=wt,me=et):Qe=Qe.next=wt,W|=Ze;if(oe=oe.next,oe===null){if(oe=I.shared.pending,oe===null)break;Ze=oe,oe=Ze.next,Ze.next=null,I.lastBaseUpdate=Ze,I.shared.pending=null}}while(!0);if(Qe===null&&(me=et),I.baseState=me,I.firstBaseUpdate=De,I.lastBaseUpdate=Qe,h=I.shared.interleaved,h!==null){I=h;do W|=I.lane,I=I.next;while(I!==h)}else j===null&&(I.shared.lanes=0);vf|=W,u.lanes=W,u.memoizedState=et}}function ku(u,h,b){if(u=h.effects,h.effects=null,u!==null)for(h=0;hb?b:4,u(!0);var A=xc.transition;xc.transition={};try{u(!1),h()}finally{Pn=b,xc.transition=A}}function Ma(){return gs().memoizedState}function $p(u,h,b){var A=zu(u);if(b={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null},mf(u))Xp(h,b);else if(b=lf(u,h,b,A),b!==null){var I=xs();Ca(b,u,A,I),qp(b,h,A)}}function bc(u,h,b){var A=zu(u),I={lane:A,action:b,hasEagerState:!1,eagerState:null,next:null};if(mf(u))Xp(h,I);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=h.lastRenderedReducer,j!==null))try{var W=h.lastRenderedState,oe=j(W,b);if(I.hasEagerState=!0,I.eagerState=oe,ds(oe,W)){var me=h.interleaved;me===null?(I.next=I,zv(h)):(I.next=me.next,me.next=I),h.interleaved=I;return}}catch{}finally{}b=lf(u,h,I,A),b!==null&&(I=xs(),Ca(b,u,A,I),qp(b,h,A))}}function mf(u){var h=u.alternate;return u===Xn||h!==null&&h===Xn}function Xp(u,h){fi=co=!0;var b=u.pending;b===null?h.next=h:(h.next=b.next,b.next=h),u.pending=h}function qp(u,h,b){if((b&4194240)!==0){var A=h.lanes;A&=u.pendingLanes,b|=A,h.lanes=b,fu(u,b)}}var Kp={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},Bx={readContext:ps,useCallback:function(u,h){return Qr().memoizedState=[u,h===void 0?null:h],u},useContext:ps,useEffect:Ii,useImperativeHandle:function(u,h,b){return b=b!=null?b.concat([u]):null,Lo(4194308,4,Fx.bind(null,h,u),b)},useLayoutEffect:function(u,h){return Lo(4194308,4,u,h)},useInsertionEffect:function(u,h){return Lo(4,2,u,h)},useMemo:function(u,h){var b=Qr();return h=h===void 0?null:h,u=u(),b.memoizedState=[u,h],u},useReducer:function(u,h,b){var A=Qr();return h=b!==void 0?b(h):h,A.memoizedState=A.baseState=h,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:h},A.queue=u,u=u.dispatch=$p.bind(null,Xn,u),[A.memoizedState,u]},useRef:function(u){var h=Qr();return u={current:u},h.memoizedState=u},useState:Wv,useDebugValue:Gp,useDeferredValue:function(u){return Qr().memoizedState=u},useTransition:function(){var u=Wv(!1),h=u[0];return u=CM.bind(null,u[1]),Qr().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,b){var A=Xn,I=Qr();if(qn){if(b===void 0)throw Error(n(407));b=b()}else{if(b=h(),hi===null)throw Error(n(349));(wa&30)!==0||Vp(A,h,b)}I.memoizedState=b;var j={value:b,getSnapshot:h};return I.queue=j,Ii(Lx.bind(null,A,j,u),[u]),A.flags|=2048,uo(9,hf.bind(null,A,j,b,h),void 0,null),b},useId:function(){var u=Qr(),h=hi.identifierPrefix;if(qn){var b=Fs,A=ft;b=(A&~(1<<32-vt(A)-1)).toString(32)+b,h=":"+h+"R"+b,b=cl++,0<\/script>",u=u.removeChild(u.firstChild)):typeof A.is=="string"?u=G.createElement(b,{is:A.is}):(u=G.createElement(b),b==="select"&&(G=u,A.multiple?G.multiple=!0:A.size&&(G.size=A.size))):u=G.createElementNS(u,b),u[Nr]=h,u[Pu]=A,dN(u,h,!1,!1),h.stateNode=u;e:{switch(G=Ae(b,A),b){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;IJp&&(h.flags|=128,A=!0,Yv(j,!1),h.lanes=4194304)}else{if(!A)if(u=lo(G),u!==null){if(h.flags|=128,A=!0,b=u.updateQueue,b!==null&&(h.updateQueue=b,h.flags|=4),Yv(j,!0),j.tail===null&&j.tailMode==="hidden"&&!G.alternate&&!qn)return Yi(h),null}else 2*lt()-j.renderingStartTime>Jp&&b!==1073741824&&(h.flags|=128,A=!0,Yv(j,!1),h.lanes=4194304);j.isBackwards?(G.sibling=h.child,h.child=G):(b=j.last,b!==null?b.sibling=G:h.child=G,j.last=G)}return j.tail!==null?(h=j.tail,j.rendering=h,j.tail=h.sibling,j.renderingStartTime=lt(),h.sibling=null,b=Kn.current,Gn(Kn,A?b&1|2:b&1),h):(Yi(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?(fo&1073741824)!==0&&(Yi(h),h.subtreeFlags&6&&(h.flags|=8192)):Yi(h),null;case 24:return null;case 25:return null}throw Error(n(156,h.tag))}function QG(u,h){switch(ya(h),h.tag){case 1:return ui(h.type)&&Qd(),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return ll(),$n(Pi),$n(Kr),Oo(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 5:return Ou(h),null;case 13:if($n(Kn),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(n(340));ol()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return $n(Kn),null;case 4:return ll(),null;case 10:return of(h.type._context),null;case 22:case 23:return HM(),null;case 24:return null;default:return null}}var Wx=!1,Zi=!1,JG=typeof WeakSet=="function"?WeakSet:Set,Tt=null;function Zp(u,h){var b=u.ref;if(b!==null)if(typeof b=="function")try{b(null)}catch(A){_r(u,h,A)}else b.current=null}function RM(u,h,b){try{b()}catch(A){_r(u,h,A)}}var pN=!1;function eW(u,h){if(Cu=ks,u=nr(),Dr(u)){if("selectionStart"in u)var b={start:u.selectionStart,end:u.selectionEnd};else e:{b=(b=u.ownerDocument)&&b.defaultView||window;var A=b.getSelection&&b.getSelection();if(A&&A.rangeCount!==0){b=A.anchorNode;var I=A.anchorOffset,j=A.focusNode;A=A.focusOffset;try{b.nodeType,j.nodeType}catch{b=null;break e}var G=0,ae=-1,pe=-1,Le=0,Qe=0,et=u,Ze=null;t:for(;;){for(var wt;et!==b||I!==0&&et.nodeType!==3||(ae=G+I),et!==j||A!==0&&et.nodeType!==3||(pe=G+A),et.nodeType===3&&(G+=et.nodeValue.length),(wt=et.firstChild)!==null;)Ze=et,et=wt;for(;;){if(et===u)break t;if(Ze===b&&++Le===I&&(ae=G),Ze===j&&++Qe===A&&(pe=G),(wt=et.nextSibling)!==null)break;et=Ze,Ze=et.parentNode}et=wt}b=ae===-1||pe===-1?null:{start:ae,end:pe}}else b=null}b=b||{start:0,end:0}}else b=null;for(Ev={focusedElem:u,selectionRange:b},ks=!1,Tt=h;Tt!==null;)if(h=Tt,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,Tt=u;else for(;Tt!==null;){h=Tt;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 It=Pt.memoizedProps,Ir=Pt.memoizedState,Ce=h.stateNode,ve=Ce.getSnapshotBeforeUpdate(h.elementType===h.type?It:Bs(h.type,It),Ir);Ce.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var Re=h.stateNode.containerInfo;Re.nodeType===1?Re.textContent="":Re.nodeType===9&&Re.documentElement&&Re.removeChild(Re.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ot){_r(h,h.return,ot)}if(u=h.sibling,u!==null){u.return=h.return,Tt=u;break}Tt=h.return}return Pt=pN,pN=!1,Pt}function Zv(u,h,b){var A=h.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var I=A=A.next;do{if((I.tag&u)===u){var j=I.destroy;I.destroy=void 0,j!==void 0&&RM(h,b,j)}I=I.next}while(I!==A)}}function $x(u,h){if(h=h.updateQueue,h=h!==null?h.lastEffect:null,h!==null){var b=h=h.next;do{if((b.tag&u)===u){var A=b.create;b.destroy=A()}b=b.next}while(b!==h)}}function NM(u){var h=u.ref;if(h!==null){var b=u.stateNode;switch(u.tag){case 5:u=b;break;default:u=b}typeof h=="function"?h(u):h.current=u}}function 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[Nr],delete h[Pu],delete h[oc],delete h[Op],delete h[Lp])),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,b){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?b.nodeType===8?b.parentNode.insertBefore(u,h):b.insertBefore(u,h):(b.nodeType===8?(h=b.parentNode,h.insertBefore(u,b)):(h=b,h.appendChild(u)),b=b._reactRootContainer,b!=null||h.onclick!==null||(h.onclick=Zd));else if(A!==4&&(u=u.child,u!==null))for(IM(u,h,b),u=u.sibling;u!==null;)IM(u,h,b),u=u.sibling}function kM(u,h,b){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?b.insertBefore(u,h):b.appendChild(u);else if(A!==4&&(u=u.child,u!==null))for(kM(u,h,b),u=u.sibling;u!==null;)kM(u,h,b),u=u.sibling}var ki=null,Aa=!1;function ju(u,h,b){for(b=b.child;b!==null;)yN(u,h,b),b=b.sibling}function yN(u,h,b){if(Zt&&typeof Zt.onCommitFiberUnmount=="function")try{Zt.onCommitFiberUnmount(yn,b)}catch{}switch(b.tag){case 5:Zi||Zp(b,h);case 6:var A=ki,I=Aa;ki=null,ju(u,h,b),ki=A,Aa=I,ki!==null&&(Aa?(u=ki,b=b.stateNode,u.nodeType===8?u.parentNode.removeChild(b):u.removeChild(b)):ki.removeChild(b.stateNode));break;case 18:ki!==null&&(Aa?(u=ki,b=b.stateNode,u.nodeType===8?kp(u.parentNode,b):u.nodeType===1&&kp(u,b),Fd(u)):kp(ki,b.stateNode));break;case 4:A=ki,I=Aa,ki=b.stateNode.containerInfo,Aa=!0,ju(u,h,b),ki=A,Aa=I;break;case 0:case 11:case 14:case 15:if(!Zi&&(A=b.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){I=A=A.next;do{var j=I,G=j.destroy;j=j.tag,G!==void 0&&((j&2)!==0||(j&4)!==0)&&RM(b,h,G),I=I.next}while(I!==A)}ju(u,h,b);break;case 1:if(!Zi&&(Zp(b,h),A=b.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=b.memoizedProps,A.state=b.memoizedState,A.componentWillUnmount()}catch(ae){_r(b,h,ae)}ju(u,h,b);break;case 21:ju(u,h,b);break;case 22:b.mode&1?(Zi=(A=Zi)||b.memoizedState!==null,ju(u,h,b),Zi=A):ju(u,h,b);break;default:ju(u,h,b)}}function xN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var b=u.stateNode;b===null&&(b=u.stateNode=new JG),h.forEach(function(A){var I=cW.bind(null,u,A);b.has(A)||(b.add(A),A.then(I,I))})}}function Ta(u,h){var b=h.deletions;if(b!==null)for(var A=0;AI&&(I=G),A&=~j}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*nW(A/1960))-A,10u?16:u,Fu===null)var A=!1;else{if(u=Fu,Fu=null,Zx=0,(On&6)!==0)throw Error(n(331));var I=On;for(On|=4,Tt=u.current;Tt!==null;){var j=Tt,G=j.child;if((Tt.flags&16)!==0){var ae=j.deletions;if(ae!==null){for(var pe=0;pelt()-DM?xf(u,0):LM|=b),Vs(u,h)}function IN(u,h){h===0&&((u.mode&1)===0?h=1:(h=kn,kn<<=1,(kn&130023424)===0&&(kn=4194304)));var b=xs();u=ao(u,h),u!==null&&(Za(u,h,b),Vs(u,b))}function lW(u){var h=u.memoizedState,b=0;h!==null&&(b=h.retryLane),IN(u,b)}function cW(u,h){var b=0;switch(u.tag){case 13:var A=u.stateNode,I=u.memoizedState;I!==null&&(b=I.retryLane);break;case 19:A=u.stateNode;break;default:throw Error(n(314))}A!==null&&A.delete(h),IN(u,b)}var kN;kN=function(u,h,b){if(u!==null)if(u.memoizedProps!==h.pendingProps||Pi.current)ln=!0;else{if((u.lanes&b)===0&&(h.flags&128)===0)return ln=!1,YG(u,h,b);ln=(u.flags&131072)!==0}else ln=!1,qn&&(h.flags&1048576)!==0&&kv(h,Fp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;Gx(u,h),u=h.pendingProps;var I=ac(h,Kr.current);al(h,b),I=df(null,h,A,u,I,b);var j=Bv();return h.flags|=1,typeof I=="object"&&I!==null&&typeof I.render=="function"&&I.$$typeof===void 0?(h.tag=1,h.memoizedState=null,h.updateQueue=null,ui(A)?(j=!0,lc(h)):j=!1,h.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,an(h),I.updater=Yp,h.stateNode=I,I._reactInternals=h,M(h,A,u,b),h=on(null,h,A,!0,j,b)):(h.tag=0,qn&&j&&Ov(h),_t(null,h,I,b),h=h.child),h;case 16:A=h.elementType;e:{switch(Gx(u,h),u=h.pendingProps,I=A._init,A=I(A._payload),h.type=A,I=h.tag=dW(A),u=Bs(A,u),I){case 0:h=vt(null,h,A,u,b);break e;case 1:h=Ot(null,h,A,u,b);break e;case 11:h=Jr(null,h,A,u,b);break e;case 14:h=ys(null,h,A,Bs(A.type,u),b);break e}throw Error(n(306,A,""))}return h;case 0:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),vt(u,h,A,I,b);case 1:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Ot(u,h,A,I,b);case 3:e:{if(sn(h),u===null)throw Error(n(387));A=h.pendingProps,j=h.memoizedState,I=j.element,mr(u,h),lr(h,A,null,b);var G=h.memoizedState;if(A=G.element,j.isDehydrated)if(j={element:A,isDehydrated:!1,cache:G.cache,pendingSuspenseBoundaries:G.pendingSuspenseBoundaries,transitions:G.transitions},h.updateQueue.baseState=j,h.memoizedState=j,h.flags&256){I=P(Error(n(423)),h),h=En(u,h,A,b,I);break e}else if(A!==I){I=P(Error(n(424)),h),h=En(u,h,A,b,I);break e}else for(Ni=ha(h.stateNode.containerInfo.firstChild),Yr=h,qn=!0,zs=null,b=sf(h,null,A,b),h.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(ol(),A===I){h=_c(u,h,b);break e}_t(u,h,A,b)}h=h.child}return h;case 5:return vc(h),u===null&&Bp(h),A=h.type,I=h.pendingProps,j=u!==null?u.memoizedProps:null,G=I.children,Av(A,I)?G=null:j!==null&&Av(A,j)&&(h.flags|=32),je(u,h),_t(u,h,G,b),h.child;case 6:return u===null&&Bp(h),null;case 13:return Ea(u,h,b);case 4:return cf(h,h.stateNode.containerInfo),A=h.pendingProps,u===null?h.child=dc(h,null,A,b):_t(u,h,A,b),h.child;case 11:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Jr(u,h,A,I,b);case 7:return _t(u,h,h.pendingProps,b),h.child;case 8:return _t(u,h,h.pendingProps.children,b),h.child;case 12:return _t(u,h,h.pendingProps.children,b),h.child;case 10:e:{if(A=h.type._context,I=h.pendingProps,j=h.memoizedProps,G=I.value,Gn(fc,A._currentValue),A._currentValue=G,j!==null)if(ds(j.value,G)){if(j.children===I.children&&!Pi.current){h=_c(u,h,b);break e}}else for(j=h.child,j!==null&&(j.return=h);j!==null;){var ae=j.dependencies;if(ae!==null){G=j.child;for(var pe=ae.firstContext;pe!==null;){if(pe.context===A){if(j.tag===1){pe=zn(-1,b&-b),pe.tag=2;var Le=j.updateQueue;if(Le!==null){Le=Le.shared;var Qe=Le.pending;Qe===null?pe.next=pe:(pe.next=Qe.next,Qe.next=pe),Le.pending=pe}}j.lanes|=b,pe=j.alternate,pe!==null&&(pe.lanes|=b),af(j.return,b,h),ae.lanes|=b;break}pe=pe.next}}else if(j.tag===10)G=j.type===h.type?null:j.child;else if(j.tag===18){if(G=j.return,G===null)throw Error(n(341));G.lanes|=b,ae=G.alternate,ae!==null&&(ae.lanes|=b),af(G,b,h),G=j.sibling}else G=j.child;if(G!==null)G.return=j;else for(G=j;G!==null;){if(G===h){G=null;break}if(j=G.sibling,j!==null){j.return=G.return,G=j;break}G=G.return}j=G}_t(u,h,I.children,b),h=h.child}return h;case 9:return I=h.type,A=h.pendingProps.children,al(h,b),I=ps(I),A=A(I),h.flags|=1,_t(u,h,A,b),h.child;case 14:return A=h.type,I=Bs(A,h.pendingProps),I=Bs(A.type,I),ys(u,h,A,I,b);case 15:return Ne(u,h,h.type,h.pendingProps,b);case 17:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Gx(u,h),h.tag=1,ui(A)?(u=!0,lc(h)):u=!1,al(h,b),p(h,A,I),M(h,A,I,b),on(null,h,A,!0,u,b);case 19:return uN(u,h,b);case 22:return be(u,h,b)}throw Error(n(156,h.tag))};function ON(u,h){return Ie(u,h)}function uW(u,h,b,A){this.tag=u,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=A,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jo(u,h,b,A){return new uW(u,h,b,A)}function GM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function dW(u){if(typeof u=="function")return GM(u)?1:0;if(u!=null){if(u=u.$$typeof,u===H)return 11;if(u===he)return 14}return 2}function Hu(u,h){var b=u.alternate;return b===null?(b=jo(u.tag,h,u.key,u.mode),b.elementType=u.elementType,b.type=u.type,b.stateNode=u.stateNode,b.alternate=u,u.alternate=b):(b.pendingProps=h,b.type=u.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=u.flags&14680064,b.childLanes=u.childLanes,b.lanes=u.lanes,b.child=u.child,b.memoizedProps=u.memoizedProps,b.memoizedState=u.memoizedState,b.updateQueue=u.updateQueue,h=u.dependencies,b.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},b.sibling=u.sibling,b.index=u.index,b.ref=u.ref,b}function tb(u,h,b,A,I,j){var G=2;if(A=u,typeof u=="function")GM(u)&&(G=1);else if(typeof u=="string")G=5;else e:switch(u){case D:return _f(b.children,I,j,h);case F:G=8,I|=8;break;case V:return u=jo(12,b,h,I|2),u.elementType=V,u.lanes=j,u;case ne:return u=jo(13,b,h,I),u.elementType=ne,u.lanes=j,u;case te:return u=jo(19,b,h,I),u.elementType=te,u.lanes=j,u;case fe:return nb(b,I,j,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:G=10;break e;case U:G=9;break e;case H:G=11;break e;case he:G=14;break e;case oe:G=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=jo(G,b,h,I),h.elementType=u,h.type=A,h.lanes=j,h}function _f(u,h,b,A){return u=jo(7,u,A,h),u.lanes=b,u}function nb(u,h,b,A){return u=jo(22,u,A,h),u.elementType=fe,u.lanes=b,u.stateNode={isHidden:!1},u}function WM(u,h,b){return u=jo(6,u,null,h),u.lanes=b,u}function $M(u,h,b){return h=jo(4,u.children!==null?u.children:[],u.key,h),h.lanes=b,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function fW(u,h,b,A,I){this.tag=h,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ld(0),this.expirationTimes=Ld(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ld(0),this.identifierPrefix=A,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function XM(u,h,b,A,I,j,G,ae,pe){return u=new fW(u,h,b,ae,pe),h===1?(h=1,j===!0&&(h|=8)):h=0,j=jo(3,null,null,h),u.current=j,j.stateNode=u,j.memoizedState={element:A,isDehydrated:b,cache:null,transitions:null,pendingSuspenseBoundaries:null},an(j),u}function hW(u,h,b){var A=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),eE.exports=TW(),eE.exports}var KN;function CW(){if(KN)return ub;KN=1;var t=WU();return ub.createRoot=t.createRoot,ub.hydrateRoot=t.hydrateRoot,ub}var PW=CW();const RW=H1(PW);var Hy=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(){}},uh,dd,og,OU,NW=(OU=class extends Hy{constructor(){super();$t(this,uh);$t(this,dd);$t(this,og);St(this,og,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){me(this,dd)||this.setEventListener(me(this,og))}onUnsubscribe(){var e;this.hasListeners()||((e=me(this,dd))==null||e.call(this),St(this,dd,void 0))}setEventListener(e){var n;St(this,og,e),(n=me(this,dd))==null||n.call(this),St(this,dd,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){me(this,uh)!==e&&(St(this,uh,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof me(this,uh)=="boolean"?me(this,uh):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},uh=new WeakMap,dd=new WeakMap,og=new WeakMap,OU),gP=new NW,IW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},fd,mP,LU,kW=(LU=class{constructor(){$t(this,fd,IW);$t(this,mP,!1)}setTimeoutProvider(t){St(this,fd,t)}setTimeout(t,e){return me(this,fd).setTimeout(t,e)}clearTimeout(t){me(this,fd).clearTimeout(t)}setInterval(t,e){return me(this,fd).setInterval(t,e)}clearInterval(t){me(this,fd).clearInterval(t)}},fd=new WeakMap,mP=new WeakMap,LU),Qf=new kW;function OW(t){setTimeout(t,0)}var LW=typeof window>"u"||"Deno"in globalThis;function qs(){}function DW(t,e){return typeof t=="function"?t(e):t}function pT(t){return typeof t=="number"&&t>=0&&t!==1/0}function $U(t,e){return Math.max(t+(e||0)-Date.now(),0)}function bd(t,e){return typeof t=="function"?t(e):t}function vo(t,e){return typeof t=="function"?t(e):t}function YN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==vP(o,e.options))return!1}else if(!ry(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function ZN(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(ny(e.options.mutationKey)!==ny(s))return!1}else if(!ry(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function vP(t,e){return((e==null?void 0:e.queryKeyHashFn)||ny)(t)}function ny(t){return JSON.stringify(t,(e,n)=>gT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function ry(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>ry(t[n],e[n])):!1}var jW=Object.prototype.hasOwnProperty;function XU(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=QN(t)&&QN(e);if(!r&&!(gT(t)&&gT(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let c=0;for(let d=0;d{Qf.setTimeout(e,t)})}function vT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?XU(t,e):e}function FW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function zW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var yP=Symbol();function qU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===yP?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function KU(t,e){return typeof t=="function"?t(...e):!!t}function BW(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 iy=(()=>{let t=()=>LW;return{isServer(){return t()},setIsServer(e){t=e}}})();function yT(){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 HW=OW;function VW(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=HW;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Fi=VW(),ag,hd,lg,DU,GW=(DU=class extends Hy{constructor(){super();$t(this,ag,!0);$t(this,hd);$t(this,lg);St(this,lg,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){me(this,hd)||this.setEventListener(me(this,lg))}onUnsubscribe(){var e;this.hasListeners()||((e=me(this,hd))==null||e.call(this),St(this,hd,void 0))}setEventListener(e){var n;St(this,lg,e),(n=me(this,hd))==null||n.call(this),St(this,hd,e(this.setOnline.bind(this)))}setOnline(e){me(this,ag)!==e&&(St(this,ag,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return me(this,ag)}},ag=new WeakMap,hd=new WeakMap,lg=new WeakMap,DU),Q_=new GW;function WW(t){return Math.min(1e3*2**t,3e4)}function YU(t){return(t??"online")==="online"?Q_.isOnline():!0}var xT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function ZU(t){let e=!1,n=0,r;const i=yT(),s=()=>i.status!=="pending",o=S=>{var w;if(!s()){const _=new xT(S);m(_),(w=t.onCancel)==null||w.call(t,_)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>gP.isFocused()&&(t.networkMode==="always"||Q_.isOnline())&&t.canRun(),d=()=>YU(t.networkMode)&&t.canRun(),f=S=>{s()||(r==null||r(),i.resolve(S))},m=S=>{s()||(r==null||r(),i.reject(S))},y=()=>new Promise(S=>{var w;r=_=>{(s()||c())&&S(_)},(w=t.onPause)==null||w.call(t)}).then(()=>{var S;r=void 0,s()||(S=t.onContinue)==null||S.call(t)}),x=()=>{if(s())return;let S;const w=n===0?t.initialPromise:void 0;try{S=w??t.fn()}catch(_){S=Promise.reject(_)}Promise.resolve(S).then(f).catch(_=>{var N;if(s())return;const E=t.retry??(iy.isServer()?0:3),T=t.retryDelay??WW,C=typeof T=="function"?T(n,_):T,O=E===!0||typeof E=="number"&&nc()?void 0:y()).then(()=>{e?m(_):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?x():y().then(x),i)}}var dh,jU,QU=(jU=class{constructor(){$t(this,dh)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),pT(this.gcTime)&&St(this,dh,Qf.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(iy.isServer()?1/0:300*1e3))}clearGcTimeout(){me(this,dh)!==void 0&&(Qf.clearTimeout(me(this,dh)),St(this,dh,void 0))}},dh=new WeakMap,jU);function $W(t){return{onFetch:(e,n)=>{var d,f,m,y,x;const r=e.options,i=(m=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let S=!1;const w=T=>{BW(T,()=>e.signal,()=>S=!0)},_=qU(e.options,e.fetchOptions),E=async(T,C,O)=>{if(S)return Promise.reject(e.signal.reason);if(C==null&&T.pages.length)return Promise.resolve(T);const D=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:C,direction:O?"backward":"forward",meta:e.options.meta};return w(U),U})(),F=await _(D),{maxPages:V}=e.options,k=O?zW:FW;return{pages:k(T.pages,F,V),pageParams:k(T.pageParams,C,V)}};if(i&&s.length){const T=i==="backward",C=T?XW:eI,O={pages:s,pageParams:o},N=C(r,O);a=await E(O,N,T)}else{const T=t??s.length;do{const C=l===0?o[0]??r.initialPageParam:eI(r,a);if(l>0&&C==null)break;a=await E(a,C),l++}while(l{var S,w;return(w=(S=e.options).persister)==null?void 0:w.call(S,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function 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 XW(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var cg,fh,ug,Vo,hh,gi,jy,ph,go,JU,Rc,UU,qW=(UU=class extends QU{constructor(e){super();$t(this,go);$t(this,cg);$t(this,fh);$t(this,ug);$t(this,Vo);$t(this,hh);$t(this,gi);$t(this,jy);$t(this,ph);St(this,ph,!1),St(this,jy,e.defaultOptions),this.setOptions(e.options),this.observers=[],St(this,hh,e.client),St(this,Vo,me(this,hh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,St(this,fh,nI(this.options)),this.state=e.state??me(this,fh),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return me(this,cg)}get promise(){var e;return(e=me(this,gi))==null?void 0:e.promise}setOptions(e){if(this.options={...me(this,jy),...e},e!=null&&e._type&&St(this,cg,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)),St(this,fh,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&me(this,Vo).remove(this)}setData(e,n){const r=vT(this.state.data,e,this.options);return _n(this,go,Rc).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,go,Rc).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=me(this,gi))==null?void 0:r.promise;return(i=me(this,gi))==null||i.cancel(e),n?n.then(qs).catch(qs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return me(this,fh)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>vo(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===yP||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>bd(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!$U(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=me(this,gi))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=me(this,gi))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),me(this,Vo).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(me(this,gi)&&(me(this,ph)||_n(this,go,JU).call(this)?me(this,gi).cancel({revert:!0}):me(this,gi).cancelRetry()),this.scheduleGc()),me(this,Vo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_n(this,go,Rc).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,m,y,x,S,w,_,E,T;if(this.state.fetchStatus!=="idle"&&((c=me(this,gi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(me(this,gi))return me(this,gi).continueRetry(),me(this,gi).promise}if(e&&this.setOptions(e),!this.options.queryFn){const C=this.observers.find(O=>O.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,i=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(St(this,ph,!0),r.signal)})},s=()=>{const C=qU(this.options,n),N=(()=>{const D={client:me(this,hh),queryKey:this.queryKey,meta:this.meta};return i(D),D})();return St(this,ph,!1),this.options.persister?this.options.persister(C,N,this):C(N)},a=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:me(this,hh),state:this.state,fetchFn:s};return i(C),C})(),l=me(this,cg)==="infinite"?$W(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),St(this,ug,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&_n(this,go,Rc).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),St(this,gi,ZU({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:C=>{C instanceof xT&&C.revert&&this.setState({...me(this,ug),fetchStatus:"idle"}),r.abort()},onFail:(C,O)=>{_n(this,go,Rc).call(this,{type:"failed",failureCount:C,error:O})},onPause:()=>{_n(this,go,Rc).call(this,{type:"pause"})},onContinue:()=>{_n(this,go,Rc).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const C=await me(this,gi).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(y=(m=me(this,Vo).config).onSuccess)==null||y.call(m,C,this),(S=(x=me(this,Vo).config).onSettled)==null||S.call(x,C,this.state.error,this),C}catch(C){if(C instanceof xT){if(C.silent)return me(this,gi).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw _n(this,go,Rc).call(this,{type:"error",error:C}),(_=(w=me(this,Vo).config).onError)==null||_.call(w,C,this),(T=(E=me(this,Vo).config).onSettled)==null||T.call(E,this.state.data,C,this),C}finally{this.scheduleGc()}}},cg=new WeakMap,fh=new WeakMap,ug=new WeakMap,Vo=new WeakMap,hh=new WeakMap,gi=new WeakMap,jy=new WeakMap,ph=new WeakMap,go=new WeakSet,JU=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Rc=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...eF(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 St(this,ug,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Fi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),me(this,Vo).notify({query:this,type:"updated",action:e})})},UU);function eF(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:YU(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,Uy,ws,mh,dg,Oc,pd,Fy,fg,hg,gh,vh,md,pg,Bn,j0,bT,_T,wT,ST,MT,ET,AT,tF,FU,KW=(FU=class extends Hy{constructor(e,n){super();$t(this,Bn);$t(this,Xs);$t(this,An);$t(this,Uy);$t(this,ws);$t(this,mh);$t(this,dg);$t(this,Oc);$t(this,pd);$t(this,Fy);$t(this,fg);$t(this,hg);$t(this,gh);$t(this,vh);$t(this,md);$t(this,pg,new Set);this.options=n,St(this,Xs,e),St(this,pd,null),St(this,Oc,yT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(me(this,An).addObserver(this),rI(me(this,An),this.options)?_n(this,Bn,j0).call(this):this.updateResult(),_n(this,Bn,ST).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return TT(me(this,An),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return TT(me(this,An),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_n(this,Bn,MT).call(this),_n(this,Bn,ET).call(this),me(this,An).removeObserver(this)}setOptions(e){const n=this.options,r=me(this,An);if(this.options=me(this,Xs).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof vo(this.options.enabled,me(this,An))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_n(this,Bn,AT).call(this),me(this,An).setOptions(this.options),n._defaulted&&!mT(this.options,n)&&me(this,Xs).getQueryCache().notify({type:"observerOptionsUpdated",query:me(this,An),observer:this});const i=this.hasListeners();i&&iI(me(this,An),r,this.options,n)&&_n(this,Bn,j0).call(this),this.updateResult(),i&&(me(this,An)!==r||vo(this.options.enabled,me(this,An))!==vo(n.enabled,me(this,An))||bd(this.options.staleTime,me(this,An))!==bd(n.staleTime,me(this,An)))&&_n(this,Bn,bT).call(this);const s=_n(this,Bn,_T).call(this);i&&(me(this,An)!==r||vo(this.options.enabled,me(this,An))!==vo(n.enabled,me(this,An))||s!==me(this,md))&&_n(this,Bn,wT).call(this,s)}getOptimisticResult(e){const n=me(this,Xs).getQueryCache().build(me(this,Xs),e),r=this.createResult(n,e);return ZW(this,r)&&(St(this,ws,r),St(this,dg,this.options),St(this,mh,me(this,An).state)),r}getCurrentResult(){return me(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&&me(this,Oc).status==="pending"&&me(this,Oc).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){me(this,pg).add(e)}getCurrentQuery(){return me(this,An)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=me(this,Xs).defaultQueryOptions(e),r=me(this,Xs).getQueryCache().build(me(this,Xs),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return _n(this,Bn,j0).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),me(this,ws)))}createResult(e,n){var V;const r=me(this,An),i=this.options,s=me(this,ws),o=me(this,mh),a=me(this,dg),c=e!==r?e.state:me(this,Uy),{state:d}=e;let f={...d},m=!1,y;if(n._optimisticResults){const k=this.hasListeners(),U=!k&&rI(e,n),H=k&&iI(e,r,n,i);(U||H)&&(f={...f,...eF(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:w}=f;y=f.data;let _=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(k=s.data,_=!0):k=typeof n.placeholderData=="function"?n.placeholderData((V=me(this,hg))==null?void 0:V.state.data,me(this,hg)):n.placeholderData,k!==void 0&&(w="success",y=vT(s==null?void 0:s.data,k,n),m=!0)}if(n.select&&y!==void 0&&!_)if(s&&y===(o==null?void 0:o.data)&&n.select===me(this,Fy))y=me(this,fg);else try{St(this,Fy,n.select),y=n.select(y),y=vT(s==null?void 0:s.data,y,n),St(this,fg,y),St(this,pd,null)}catch(k){St(this,pd,k)}me(this,pd)&&(x=me(this,pd),y=me(this,fg),S=Date.now(),w="error");const E=f.fetchStatus==="fetching",T=w==="pending",C=w==="error",O=T&&E,N=y!==void 0,F={status:w,fetchStatus:f.fetchStatus,isPending:T,isSuccess:w==="success",isError:C,isInitialLoading:O,isLoading:O,data:y,dataUpdatedAt:f.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:E,isRefetching:E&&!T,isLoadingError:C&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&N,isStale:xP(e,n),refetch:this.refetch,promise:me(this,Oc),isEnabled:vo(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=F.data!==void 0,U=F.status==="error"&&!k,H=he=>{U?he.reject(F.error):k&&he.resolve(F.data)},ne=()=>{const he=St(this,Oc,F.promise=yT());H(he)},te=me(this,Oc);switch(te.status){case"pending":e.queryHash===r.queryHash&&H(te);break;case"fulfilled":(U||F.data!==te.value)&&ne();break;case"rejected":(!U||F.error!==te.reason)&&ne();break}}return F}updateResult(){const e=me(this,ws),n=this.createResult(me(this,An),this.options);if(St(this,mh,me(this,An).state),St(this,dg,this.options),me(this,mh).data!==void 0&&St(this,hg,me(this,An)),mT(n,e))return;St(this,ws,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!me(this,pg).size)return!0;const o=new Set(s??me(this,pg));return this.options.throwOnError&&o.add("error"),Object.keys(me(this,ws)).some(a=>{const l=a;return me(this,ws)[l]!==e[l]&&o.has(l)})};_n(this,Bn,tF).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_n(this,Bn,ST).call(this)}},Xs=new WeakMap,An=new WeakMap,Uy=new WeakMap,ws=new WeakMap,mh=new WeakMap,dg=new WeakMap,Oc=new WeakMap,pd=new WeakMap,Fy=new WeakMap,fg=new WeakMap,hg=new WeakMap,gh=new WeakMap,vh=new WeakMap,md=new WeakMap,pg=new WeakMap,Bn=new WeakSet,j0=function(e){_n(this,Bn,AT).call(this);let n=me(this,An).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(qs)),n},bT=function(){_n(this,Bn,MT).call(this);const e=bd(this.options.staleTime,me(this,An));if(iy.isServer()||me(this,ws).isStale||!pT(e))return;const r=$U(me(this,ws).dataUpdatedAt,e)+1;St(this,gh,Qf.setTimeout(()=>{me(this,ws).isStale||this.updateResult()},r))},_T=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(me(this,An)):this.options.refetchInterval)??!1},wT=function(e){_n(this,Bn,ET).call(this),St(this,md,e),!(iy.isServer()||vo(this.options.enabled,me(this,An))===!1||!pT(me(this,md))||me(this,md)===0)&&St(this,vh,Qf.setInterval(()=>{(this.options.refetchIntervalInBackground||gP.isFocused())&&_n(this,Bn,j0).call(this)},me(this,md)))},ST=function(){_n(this,Bn,bT).call(this),_n(this,Bn,wT).call(this,_n(this,Bn,_T).call(this))},MT=function(){me(this,gh)!==void 0&&(Qf.clearTimeout(me(this,gh)),St(this,gh,void 0))},ET=function(){me(this,vh)!==void 0&&(Qf.clearInterval(me(this,vh)),St(this,vh,void 0))},AT=function(){const e=me(this,Xs).getQueryCache().build(me(this,Xs),this.options);if(e===me(this,An))return;const n=me(this,An);St(this,An,e),St(this,Uy,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},tF=function(e){Fi.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(me(this,ws))}),me(this,Xs).getQueryCache().notify({query:me(this,An),type:"observerResultsUpdated"})})},FU);function YW(t,e){return vo(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&vo(e.retryOnMount,t)===!1)}function rI(t,e){return YW(t,e)||t.state.data!==void 0&&TT(t,e,e.refetchOnMount)}function TT(t,e,n){if(vo(e.enabled,t)!==!1&&bd(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&xP(t,e)}return!1}function iI(t,e,n,r){return(t!==e||vo(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&xP(t,n)}function xP(t,e){return vo(e.enabled,t)!==!1&&t.isStaleByTime(bd(e.staleTime,t))}function ZW(t,e){return!mT(t.getCurrentResult(),e)}var zy,yl,ts,yh,xl,sd,zU,QW=(zU=class extends QU{constructor(e){super();$t(this,xl);$t(this,zy);$t(this,yl);$t(this,ts);$t(this,yh);St(this,zy,e.client),this.mutationId=e.mutationId,St(this,ts,e.mutationCache),St(this,yl,[]),this.state=e.state||JW(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){me(this,yl).includes(e)||(me(this,yl).push(e),this.clearGcTimeout(),me(this,ts).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){St(this,yl,me(this,yl).filter(n=>n!==e)),this.scheduleGc(),me(this,ts).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){me(this,yl).length||(this.state.status==="pending"?this.scheduleGc():me(this,ts).remove(this))}continue(){var e;return((e=me(this,yh))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,d,f,m,y,x,S,w,_,E,T,C,O,N,D;const n=()=>{_n(this,xl,sd).call(this,{type:"continue"})},r={client:me(this,zy),meta:this.options.meta,mutationKey:this.options.mutationKey};St(this,yh,ZU({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(F,V)=>{_n(this,xl,sd).call(this,{type:"failed",failureCount:F,error:V})},onPause:()=>{_n(this,xl,sd).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>me(this,ts).canRun(this)}));const i=this.state.status==="pending",s=!me(this,yh).canStart();try{if(i)n();else{_n(this,xl,sd).call(this,{type:"pending",variables:e,isPaused:s}),me(this,ts).config.onMutate&&await me(this,ts).config.onMutate(e,this,r);const V=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));V!==this.state.context&&_n(this,xl,sd).call(this,{type:"pending",context:V,variables:e,isPaused:s})}const F=await me(this,yh).start();return await((c=(l=me(this,ts).config).onSuccess)==null?void 0:c.call(l,F,e,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,F,e,this.state.context,r)),await((y=(m=me(this,ts).config).onSettled)==null?void 0:y.call(m,F,null,this.state.variables,this.state.context,this,r)),await((S=(x=this.options).onSettled)==null?void 0:S.call(x,F,null,e,this.state.context,r)),_n(this,xl,sd).call(this,{type:"success",data:F}),F}catch(F){try{await((_=(w=me(this,ts).config).onError)==null?void 0:_.call(w,F,e,this.state.context,this,r))}catch(V){Promise.reject(V)}try{await((T=(E=this.options).onError)==null?void 0:T.call(E,F,e,this.state.context,r))}catch(V){Promise.reject(V)}try{await((O=(C=me(this,ts).config).onSettled)==null?void 0:O.call(C,void 0,F,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,F,e,this.state.context,r))}catch(V){Promise.reject(V)}throw _n(this,xl,sd).call(this,{type:"error",error:F}),F}finally{me(this,ts).runNext(this)}}},zy=new WeakMap,yl=new WeakMap,ts=new WeakMap,yh=new WeakMap,xl=new WeakSet,sd=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fi.batch(()=>{me(this,yl).forEach(r=>{r.onMutationUpdate(e)}),me(this,ts).notify({mutation:this,type:"updated",action:e})})},zU);function JW(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Lc,La,By,BU,e8=(BU=class extends Hy{constructor(e={}){super();$t(this,Lc);$t(this,La);$t(this,By);this.config=e,St(this,Lc,new Set),St(this,La,new Map),St(this,By,0)}build(e,n,r){const i=new QW({client:e,mutationCache:this,mutationId:++cb(this,By)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){me(this,Lc).add(e);const n=db(e);if(typeof n=="string"){const r=me(this,La).get(n);r?r.push(e):me(this,La).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(me(this,Lc).delete(e)){const n=db(e);if(typeof n=="string"){const r=me(this,La).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&me(this,La).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=db(e);if(typeof n=="string"){const r=me(this,La).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=db(e);if(typeof n=="string"){const i=(r=me(this,La).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(){Fi.batch(()=>{me(this,Lc).forEach(e=>{this.notify({type:"removed",mutation:e})}),me(this,Lc).clear(),me(this,La).clear()})}getAll(){return Array.from(me(this,Lc))}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){Fi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Fi.batch(()=>Promise.all(e.map(n=>n.continue().catch(qs))))}},Lc=new WeakMap,La=new WeakMap,By=new WeakMap,BU);function db(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,HU,t8=(HU=class extends Hy{constructor(e={}){super();$t(this,bl);this.config=e,St(this,bl,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??vP(i,n);let o=this.get(s);return o||(o=new qW({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){me(this,bl).has(e.queryHash)||(me(this,bl).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=me(this,bl).get(e.queryHash);n&&(e.destroy(),n===e&&me(this,bl).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Fi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return me(this,bl).get(e)}getAll(){return[...me(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){Fi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Fi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bl=new WeakMap,HU),Sr,gd,vd,mg,gg,yd,vg,yg,VU,n8=(VU=class{constructor(t={}){$t(this,Sr);$t(this,gd);$t(this,vd);$t(this,mg);$t(this,gg);$t(this,yd);$t(this,vg);$t(this,yg);St(this,Sr,t.queryCache||new t8),St(this,gd,t.mutationCache||new e8),St(this,vd,t.defaultOptions||{}),St(this,mg,new Map),St(this,gg,new Map),St(this,yd,0)}mount(){cb(this,yd)._++,me(this,yd)===1&&(St(this,vg,gP.subscribe(async t=>{t&&(await this.resumePausedMutations(),me(this,Sr).onFocus())})),St(this,yg,Q_.subscribe(async t=>{t&&(await this.resumePausedMutations(),me(this,Sr).onOnline())})))}unmount(){var t,e;cb(this,yd)._--,me(this,yd)===0&&((t=me(this,vg))==null||t.call(this),St(this,vg,void 0),(e=me(this,yg))==null||e.call(this),St(this,yg,void 0))}isFetching(t){return me(this,Sr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return me(this,gd).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=me(this,Sr).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=me(this,Sr).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(bd(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return me(this,Sr).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=me(this,Sr).get(r.queryHash),s=i==null?void 0:i.state.data,o=DW(e,s);if(o!==void 0)return me(this,Sr).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Fi.batch(()=>me(this,Sr).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=me(this,Sr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=me(this,Sr);Fi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=me(this,Sr);return Fi.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Fi.batch(()=>me(this,Sr).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(qs).catch(qs)}invalidateQueries(t,e={}){return Fi.batch(()=>(me(this,Sr).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=Fi.batch(()=>me(this,Sr).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=me(this,Sr).build(this,e);return n.isStaleByTime(bd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(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 Q_.isOnline()?me(this,gd).resumePausedMutations():Promise.resolve()}getQueryCache(){return me(this,Sr)}getMutationCache(){return me(this,gd)}getDefaultOptions(){return me(this,vd)}setDefaultOptions(t){St(this,vd,t)}setQueryDefaults(t,e){me(this,mg).set(ny(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...me(this,mg).values()],n={};return e.forEach(r=>{ry(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){me(this,gg).set(ny(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...me(this,gg).values()],n={};return e.forEach(r=>{ry(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...me(this,vd).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=vP(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===yP&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...me(this,vd).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){me(this,Sr).clear(),me(this,gd).clear()}},Sr=new WeakMap,gd=new WeakMap,vd=new WeakMap,mg=new WeakMap,gg=new WeakMap,yd=new WeakMap,vg=new WeakMap,yg=new WeakMap,VU),nF=R.createContext(void 0),$h=t=>{const e=R.useContext(nF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},r8=({client:t,children:e})=>(R.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(nF.Provider,{value:t,children:e})),rF=R.createContext(!1),i8=()=>R.useContext(rF);rF.Provider;function s8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var o8=R.createContext(s8()),a8=()=>R.useContext(o8),l8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?KU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},c8=t=>{R.useEffect(()=>{t.clearReset()},[t])},u8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||KU(n,[t.error,r])),d8=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))}},f8=(t,e)=>t.isLoading&&t.isFetching&&!e,h8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,sI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function p8(t,e,n){var y,x,S,w;const r=i8(),i=a8(),s=$h(),o=s.defaultQueryOptions(t);(x=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,o);const a=s.getQueryCache().get(o.queryHash),l=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,d8(o),l8(o,i,a),c8(i);const c=!s.getQueryCache().get(o.queryHash),[d]=R.useState(()=>new e(s,o)),f=d.getOptimisticResult(o),m=!r&&l;if(R.useSyncExternalStore(R.useCallback(_=>{const E=m?d.subscribe(Fi.batchCalls(_)):qs;return d.updateResult(),E},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(o)},[o,d]),h8(o,f))throw sI(o,d,i);if(u8({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((w=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,o,f),o.experimental_prefetchInRender&&!iy.isServer()&&f8(f,r)){const _=c?sI(o,d,i):a==null?void 0:a.promise;_==null||_.catch(qs).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function ls(t,e){return p8(t,KW)}/** +`+j.stack}return{value:u,source:h,stack:I,digest:null}}function L(u,h,b){return{value:u,source:null,stack:b??null,digest:h??null}}function z(u,h){try{console.error(h.value)}catch(b){setTimeout(function(){throw b})}}var ie=typeof WeakMap=="function"?WeakMap:Map;function ye(u,h,b){b=zn(-1,b),b.tag=3,b.payload={element:null};var A=h.value;return b.callback=function(){Zx||(Zx=!0,UM=A),z(u,h)},b}function ze(u,h,b){b=zn(-1,b),b.tag=3;var A=u.type.getDerivedStateFromError;if(typeof A=="function"){var I=h.value;b.payload=function(){return A(I)},b.callback=function(){z(u,h)}}var j=u.stateNode;return j!==null&&typeof j.componentDidCatch=="function"&&(b.callback=function(){z(u,h),typeof A!="function"&&(Uu===null?Uu=new Set([this]):Uu.add(this));var W=h.stack;this.componentDidCatch(h.value,{componentStack:W!==null?W:""})}),b}function st(u,h,b){var A=u.pingCache;if(A===null){A=u.pingCache=new ie;var I=new Set;A.set(h,I)}else I=A.get(h),I===void 0&&(I=new Set,A.set(h,I));I.has(b)||(I.add(b),u=lW.bind(null,u,h,b),h.then(u,u))}function Mt(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,b,A,I){return(u.mode&1)===0?(u===h?u.flags|=65536:(u.flags|=128,b.flags|=131072,b.flags&=-52805,b.tag===1&&(b.alternate===null?b.tag=17:(h=zn(-1,1),h.tag=2,Qn(b,h,1))),b.lanes|=1),u):(u.flags|=65536,u.lanes=I,u)}var Ht=C.ReactCurrentOwner,ln=!1;function _t(u,h,b,A){h.child=u===null?sf(h,null,b,A):dc(h,u.child,b,A)}function Jr(u,h,b,A,I){b=b.render;var j=h.ref;return al(h,I),A=df(u,h,b,A,j,I),b=Bv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,_c(u,h,I)):(qn&&b&&Ov(h),h.flags|=1,_t(u,h,A,I),h.child)}function ys(u,h,b,A,I){if(u===null){var j=b.type;return typeof j=="function"&&!WM(j)&&j.defaultProps===void 0&&b.compare===null&&b.defaultProps===void 0?(h.tag=15,h.type=j,Ie(u,h,j,A,I)):(u=rb(b.type,null,A,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(j=u.child,(u.lanes&I)===0){var W=j.memoizedProps;if(b=b.compare,b=b!==null?b:tc,b(W,A)&&u.ref===h.ref)return _c(u,h,I)}return h.flags|=1,u=Hu(j,A),u.ref=h.ref,u.return=h,h.child=u}function Ie(u,h,b,A,I){if(u!==null){var j=u.memoizedProps;if(tc(j,A)&&u.ref===h.ref)if(ln=!1,h.pendingProps=A=j,(u.lanes&I)!==0)(u.flags&131072)!==0&&(ln=!0);else return h.lanes=u.lanes,_c(u,h,I)}return yt(u,h,b,A,I)}function _e(u,h,b){var A=h.pendingProps,I=A.children,j=u!==null?u.memoizedState:null;if(A.mode==="hidden")if((h.mode&1)===0)h.memoizedState={baseLanes:0,cachePool:null,transitions:null},Gn(Qp,fo),fo|=b;else{if((b&1073741824)===0)return u=j!==null?j.baseLanes|b:b,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:u,cachePool:null,transitions:null},h.updateQueue=null,Gn(Qp,fo),fo|=u,null;h.memoizedState={baseLanes:0,cachePool:null,transitions:null},A=j!==null?j.baseLanes:b,Gn(Qp,fo),fo|=A}else j!==null?(A=j.baseLanes|b,h.memoizedState=null):A=b,Gn(Qp,fo),fo|=A;return _t(u,h,I,b),h.child}function Ue(u,h){var b=h.ref;(u===null&&b!==null||u!==null&&u.ref!==b)&&(h.flags|=512,h.flags|=2097152)}function yt(u,h,b,A,I){var j=ui(b)?ga:Kr.current;return j=ac(h,j),al(h,I),b=df(u,h,b,A,j,I),A=Bv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,_c(u,h,I)):(qn&&A&&Ov(h),h.flags|=1,_t(u,h,b,I),h.child)}function kt(u,h,b,A,I){if(ui(b)){var j=!0;lc(h)}else j=!1;if(al(h,I),h.stateNode===null)$x(u,h),p(h,b,A),M(h,b,A,I),A=!0;else if(u===null){var W=h.stateNode,oe=h.memoizedProps;W.props=oe;var me=W.context,De=b.contextType;typeof De=="object"&&De!==null?De=ps(De):(De=ui(b)?ga:Kr.current,De=ac(h,De));var Qe=b.getDerivedStateFromProps,et=typeof Qe=="function"||typeof W.getSnapshotBeforeUpdate=="function";et||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(oe!==A||me!==De)&&v(h,W,A,De),Fn=!1;var Ze=h.memoizedState;W.state=Ze,lr(h,A,W,I),me=h.memoizedState,oe!==A||Ze!==me||Pi.current||Fn?(typeof Qe=="function"&&(gf(h,b,Qe,A),me=h.memoizedState),(oe=Fn||Gx(h,b,oe,A,Ze,me,De))?(et||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(h.flags|=4194308)):(typeof W.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=A,h.memoizedState=me),W.props=A,W.state=me,W.context=De,A=oe):(typeof W.componentDidMount=="function"&&(h.flags|=4194308),A=!1)}else{W=h.stateNode,mr(u,h),oe=h.memoizedProps,De=h.type===h.elementType?oe:Bs(h.type,oe),W.props=De,et=h.pendingProps,Ze=W.context,me=b.contextType,typeof me=="object"&&me!==null?me=ps(me):(me=ui(b)?ga:Kr.current,me=ac(h,me));var wt=b.getDerivedStateFromProps;(Qe=typeof wt=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(oe!==et||Ze!==me)&&v(h,W,A,me),Fn=!1,Ze=h.memoizedState,W.state=Ze,lr(h,A,W,I);var Ct=h.memoizedState;oe!==et||Ze!==Ct||Pi.current||Fn?(typeof wt=="function"&&(gf(h,b,wt,A),Ct=h.memoizedState),(De=Fn||Gx(h,b,De,A,Ze,Ct,me)||!1)?(Qe||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(A,Ct,me),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(A,Ct,me)),typeof W.componentDidUpdate=="function"&&(h.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof W.componentDidUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=1024),h.memoizedProps=A,h.memoizedState=Ct),W.props=A,W.state=Ct,W.context=me,A=De):(typeof W.componentDidUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||oe===u.memoizedProps&&Ze===u.memoizedState||(h.flags|=1024),A=!1)}return on(u,h,b,A,j,I)}function on(u,h,b,A,I,j){Ue(u,h);var W=(h.flags&128)!==0;if(!A&&!W)return I&&Iv(h,b,!1),_c(u,h,j);A=h.stateNode,Ht.current=h;var oe=W&&typeof b.getDerivedStateFromError!="function"?null:A.render();return h.flags|=1,u!==null&&W?(h.child=dc(h,u.child,null,j),h.child=dc(h,null,oe,j)):_t(u,h,oe,j),h.memoizedState=A.state,I&&Iv(h,b,!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),cf(u,h.containerInfo)}function En(u,h,b,A,I){return ol(),Nu(I),h.flags|=256,_t(u,h,b,A),h.child}var br={dehydrated:null,treeContext:null,retryLane:0};function bn(u){return{baseLanes:u,cachePool:null,transitions:null}}function Ea(u,h,b){var A=h.pendingProps,I=Kn.current,j=!1,W=(h.flags&128)!==0,oe;if((oe=W)||(oe=u!==null&&u.memoizedState===null?!1:(I&2)!==0),oe?(j=!0,h.flags&=-129):(u===null||u.memoizedState!==null)&&(I|=1),Gn(Kn,I&1),u===null)return Bp(h),u=h.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?((h.mode&1)===0?h.lanes=1:u.data==="$!"?h.lanes=8:h.lanes=1073741824,null):(W=A.children,u=A.fallback,j?(A=h.mode,j=h.child,W={mode:"hidden",children:W},(A&1)===0&&j!==null?(j.childLanes=0,j.pendingProps=W):j=ib(W,A,0,null),u=_f(u,A,b,null),j.return=h,u.return=h,j.sibling=u,h.child=j,h.child.memoizedState=bn(b),h.memoizedState=br,u):Kv(h,W));if(I=u.memoizedState,I!==null&&(oe=I.dehydrated,oe!==null))return YG(u,h,W,A,oe,I,b);if(j){j=A.fallback,W=h.mode,I=u.child,oe=I.sibling;var me={mode:"hidden",children:A.children};return(W&1)===0&&h.child!==I?(A=h.child,A.childLanes=0,A.pendingProps=me,h.deletions=null):(A=Hu(I,me),A.subtreeFlags=I.subtreeFlags&14680064),oe!==null?j=Hu(oe,j):(j=_f(j,W,b,null),j.flags|=2),j.return=h,A.return=h,A.sibling=j,h.child=A,A=j,j=h.child,W=u.child.memoizedState,W=W===null?bn(b):{baseLanes:W.baseLanes|b,cachePool:null,transitions:W.transitions},j.memoizedState=W,j.childLanes=u.childLanes&~b,h.memoizedState=br,A}return j=u.child,u=j.sibling,A=Hu(j,{mode:"visible",children:A.children}),(h.mode&1)===0&&(A.lanes=b),A.return=h,A.sibling=null,u!==null&&(b=h.deletions,b===null?(h.deletions=[u],h.flags|=16):b.push(u)),h.child=A,h.memoizedState=null,A}function Kv(u,h){return h=ib({mode:"visible",children:h},u.mode,0,null),h.return=u,u.child=h}function Wx(u,h,b,A){return A!==null&&Nu(A),dc(h,u.child,null,b),u=Kv(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function YG(u,h,b,A,I,j,W){if(b)return h.flags&256?(h.flags&=-257,A=L(Error(n(422))),Wx(u,h,W,A)):h.memoizedState!==null?(h.child=u.child,h.flags|=128,null):(j=A.fallback,I=h.mode,A=ib({mode:"visible",children:A.children},I,0,null),j=_f(j,I,W,null),j.flags|=2,A.return=h,j.return=h,A.sibling=j,h.child=A,(h.mode&1)!==0&&dc(h,u.child,null,W),h.child.memoizedState=bn(W),h.memoizedState=br,j);if((h.mode&1)===0)return Wx(u,h,W,null);if(I.data==="$!"){if(A=I.nextSibling&&I.nextSibling.dataset,A)var oe=A.dgst;return A=oe,j=Error(n(419)),A=L(j,A,void 0),Wx(u,h,W,A)}if(oe=(W&u.childLanes)!==0,ln||oe){if(A=hi,A!==null){switch(W&-W){case 4:I=2;break;case 16:I=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:I=32;break;case 536870912:I=268435456;break;default:I=0}I=(I&(A.suspendedLanes|W))!==0?0:I,I!==0&&I!==j.retryLane&&(j.retryLane=I,ao(u,I),Ca(A,u,I,-1))}return GM(),A=L(Error(n(421))),Wx(u,h,W,A)}return I.data==="$?"?(h.flags|=128,h.child=u.child,h=cW.bind(null,u),I._reactRetry=h,null):(u=j.treeContext,Ni=ha(I.nextSibling),Yr=h,qn=!0,zs=null,u!==null&&(Ri[zr++]=ft,Ri[zr++]=Fs,Ri[zr++]=uc,ft=u.id,Fs=u.overflow,uc=h),h=Kv(h,A.children),h.flags|=4096,h)}function uN(u,h,b){u.lanes|=h;var A=u.alternate;A!==null&&(A.lanes|=h),af(u.return,h,b)}function PM(u,h,b,A,I){var j=u.memoizedState;j===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:A,tail:b,tailMode:I}:(j.isBackwards=h,j.rendering=null,j.renderingStartTime=0,j.last=A,j.tail=b,j.tailMode=I)}function dN(u,h,b){var A=h.pendingProps,I=A.revealOrder,j=A.tail;if(_t(u,h,A.children,b),A=Kn.current,(A&2)!==0)A=A&1|2,h.flags|=128;else{if(u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&uN(u,b,h);else if(u.tag===19)uN(u,b,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break e;for(;u.sibling===null;){if(u.return===null||u.return===h)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}A&=1}if(Gn(Kn,A),(h.mode&1)===0)h.memoizedState=null;else switch(I){case"forwards":for(b=h.child,I=null;b!==null;)u=b.alternate,u!==null&&lo(u)===null&&(I=b),b=b.sibling;b=I,b===null?(I=h.child,h.child=null):(I=b.sibling,b.sibling=null),PM(h,!1,I,b,j);break;case"backwards":for(b=null,I=h.child,h.child=null;I!==null;){if(u=I.alternate,u!==null&&lo(u)===null){h.child=I;break}u=I.sibling,I.sibling=b,b=I,I=u}PM(h,!0,b,null,j);break;case"together":PM(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function $x(u,h){(h.mode&1)===0&&u!==null&&(u.alternate=null,h.alternate=null,h.flags|=2)}function _c(u,h,b){if(u!==null&&(h.dependencies=u.dependencies),vf|=h.lanes,(b&h.childLanes)===0)return null;if(u!==null&&h.child!==u.child)throw Error(n(153));if(h.child!==null){for(u=h.child,b=Hu(u,u.pendingProps),h.child=b,b.return=h;u.sibling!==null;)u=u.sibling,b=b.sibling=Hu(u,u.pendingProps),b.return=h;b.sibling=null}return h.child}function ZG(u,h,b){switch(h.tag){case 3:sn(h),ol();break;case 5:vc(h);break;case 1:ui(h.type)&&lc(h);break;case 4:cf(h,h.stateNode.containerInfo);break;case 10:var A=h.type._context,I=h.memoizedProps.value;Gn(fc,A._currentValue),A._currentValue=I;break;case 13:if(A=h.memoizedState,A!==null)return A.dehydrated!==null?(Gn(Kn,Kn.current&1),h.flags|=128,null):(b&h.child.childLanes)!==0?Ea(u,h,b):(Gn(Kn,Kn.current&1),u=_c(u,h,b),u!==null?u.sibling:null);Gn(Kn,Kn.current&1);break;case 19:if(A=(b&h.childLanes)!==0,(u.flags&128)!==0){if(A)return dN(u,h,b);h.flags|=128}if(I=h.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),Gn(Kn,Kn.current),A)break;return null;case 22:case 23:return h.lanes=0,_e(u,h,b)}return _c(u,h,b)}var fN,RM,hN,pN;fN=function(u,h){for(var b=h.child;b!==null;){if(b.tag===5||b.tag===6)u.appendChild(b.stateNode);else if(b.tag!==4&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===h)break;for(;b.sibling===null;){if(b.return===null||b.return===h)return;b=b.return}b.sibling.return=b.return,b=b.sibling}},RM=function(){},hN=function(u,h,b,A){var I=u.memoizedProps;if(I!==A){u=h.stateNode,xr(ms.current);var j=null;switch(b){case"input":I=We(u,I),A=We(u,A),j=[];break;case"select":I=Y({},I,{value:void 0}),A=Y({},A,{value:void 0}),j=[];break;case"textarea":I=Ee(u,I),A=Ee(u,A),j=[];break;default:typeof I.onClick!="function"&&typeof A.onClick=="function"&&(u.onclick=Zd)}Q(b,A);var W;b=null;for(De in I)if(!A.hasOwnProperty(De)&&I.hasOwnProperty(De)&&I[De]!=null)if(De==="style"){var oe=I[De];for(W in oe)oe.hasOwnProperty(W)&&(b||(b={}),b[W]="")}else De!=="dangerouslySetInnerHTML"&&De!=="children"&&De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&De!=="autoFocus"&&(i.hasOwnProperty(De)?j||(j=[]):(j=j||[]).push(De,null));for(De in A){var me=A[De];if(oe=I!=null?I[De]:void 0,A.hasOwnProperty(De)&&me!==oe&&(me!=null||oe!=null))if(De==="style")if(oe){for(W in oe)!oe.hasOwnProperty(W)||me&&me.hasOwnProperty(W)||(b||(b={}),b[W]="");for(W in me)me.hasOwnProperty(W)&&oe[W]!==me[W]&&(b||(b={}),b[W]=me[W])}else b||(j||(j=[]),j.push(De,b)),b=me;else De==="dangerouslySetInnerHTML"?(me=me?me.__html:void 0,oe=oe?oe.__html:void 0,me!=null&&oe!==me&&(j=j||[]).push(De,me)):De==="children"?typeof me!="string"&&typeof me!="number"||(j=j||[]).push(De,""+me):De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&(i.hasOwnProperty(De)?(me!=null&&De==="onScroll"&&Wn("scroll",u),j||oe===me||(j=[])):(j=j||[]).push(De,me))}b&&(j=j||[]).push("style",b);var De=j;(h.updateQueue=De)&&(h.flags|=4)}},pN=function(u,h,b,A){b!==A&&(h.flags|=4)};function Yv(u,h){if(!qn)switch(u.tailMode){case"hidden":h=u.tail;for(var b=null;h!==null;)h.alternate!==null&&(b=h),h=h.sibling;b===null?u.tail=null:b.sibling=null;break;case"collapsed":b=u.tail;for(var A=null;b!==null;)b.alternate!==null&&(A=b),b=b.sibling;A===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:A.sibling=null}}function Yi(u){var h=u.alternate!==null&&u.alternate.child===u.child,b=0,A=0;if(h)for(var I=u.child;I!==null;)b|=I.lanes|I.childLanes,A|=I.subtreeFlags&14680064,A|=I.flags&14680064,I.return=u,I=I.sibling;else for(I=u.child;I!==null;)b|=I.lanes|I.childLanes,A|=I.subtreeFlags,A|=I.flags,I.return=u,I=I.sibling;return u.subtreeFlags|=A,u.childLanes=b,h}function QG(u,h,b){var A=h.pendingProps;switch(ya(h),h.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yi(h),null;case 1:return ui(h.type)&&Qd(),Yi(h),null;case 3:return A=h.stateNode,ll(),$n(Pi),$n(Kr),Oo(),A.pendingContext&&(A.context=A.pendingContext,A.pendingContext=null),(u===null||u.child===null)&&(Ru(h)?h.flags|=4:u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,zs!==null&&(BM(zs),zs=null))),RM(u,h),Yi(h),null;case 5:Ou(h);var I=xr(_a.current);if(b=h.type,u!==null&&h.stateNode!=null)hN(u,h,b,A,I),u.ref!==h.ref&&(h.flags|=512,h.flags|=2097152);else{if(!A){if(h.stateNode===null)throw Error(n(166));return Yi(h),null}if(u=xr(ms.current),Ru(h)){A=h.stateNode,b=h.type;var j=h.memoizedProps;switch(A[Nr]=h,A[Pu]=j,u=(h.mode&1)!==0,b){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=W.createElement(b,{is:A.is}):(u=W.createElement(b),b==="select"&&(W=u,A.multiple?W.multiple=!0:A.size&&(W.size=A.size))):u=W.createElementNS(u,b),u[Nr]=h,u[Pu]=A,fN(u,h,!1,!1),h.stateNode=u;e:{switch(W=Ae(b,A),b){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;IJp&&(h.flags|=128,A=!0,Yv(j,!1),h.lanes=4194304)}else{if(!A)if(u=lo(W),u!==null){if(h.flags|=128,A=!0,b=u.updateQueue,b!==null&&(h.updateQueue=b,h.flags|=4),Yv(j,!0),j.tail===null&&j.tailMode==="hidden"&&!W.alternate&&!qn)return Yi(h),null}else 2*at()-j.renderingStartTime>Jp&&b!==1073741824&&(h.flags|=128,A=!0,Yv(j,!1),h.lanes=4194304);j.isBackwards?(W.sibling=h.child,h.child=W):(b=j.last,b!==null?b.sibling=W:h.child=W,j.last=W)}return j.tail!==null?(h=j.tail,j.rendering=h,j.tail=h.sibling,j.renderingStartTime=at(),h.sibling=null,b=Kn.current,Gn(Kn,A?b&1|2:b&1),h):(Yi(h),null);case 22:case 23:return VM(),A=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==A&&(h.flags|=8192),A&&(h.mode&1)!==0?(fo&1073741824)!==0&&(Yi(h),h.subtreeFlags&6&&(h.flags|=8192)):Yi(h),null;case 24:return null;case 25:return null}throw Error(n(156,h.tag))}function JG(u,h){switch(ya(h),h.tag){case 1:return ui(h.type)&&Qd(),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return ll(),$n(Pi),$n(Kr),Oo(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 5:return Ou(h),null;case 13:if($n(Kn),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(n(340));ol()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return $n(Kn),null;case 4:return ll(),null;case 10:return of(h.type._context),null;case 22:case 23:return VM(),null;case 24:return null;default:return null}}var Xx=!1,Zi=!1,eW=typeof WeakSet=="function"?WeakSet:Set,At=null;function Zp(u,h){var b=u.ref;if(b!==null)if(typeof b=="function")try{b(null)}catch(A){_r(u,h,A)}else b.current=null}function NM(u,h,b){try{b()}catch(A){_r(u,h,A)}}var mN=!1;function tW(u,h){if(Cu=ks,u=nr(),Dr(u)){if("selectionStart"in u)var b={start:u.selectionStart,end:u.selectionEnd};else e:{b=(b=u.ownerDocument)&&b.defaultView||window;var A=b.getSelection&&b.getSelection();if(A&&A.rangeCount!==0){b=A.anchorNode;var I=A.anchorOffset,j=A.focusNode;A=A.focusOffset;try{b.nodeType,j.nodeType}catch{b=null;break e}var W=0,oe=-1,me=-1,De=0,Qe=0,et=u,Ze=null;t:for(;;){for(var wt;et!==b||I!==0&&et.nodeType!==3||(oe=W+I),et!==j||A!==0&&et.nodeType!==3||(me=W+A),et.nodeType===3&&(W+=et.nodeValue.length),(wt=et.firstChild)!==null;)Ze=et,et=wt;for(;;){if(et===u)break t;if(Ze===b&&++De===I&&(oe=W),Ze===j&&++Qe===A&&(me=W),(wt=et.nextSibling)!==null)break;et=Ze,Ze=et.parentNode}et=wt}b=oe===-1||me===-1?null:{start:oe,end:me}}else b=null}b=b||{start:0,end:0}}else b=null;for(Ev={focusedElem:u,selectionRange:b},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 Ct=h.alternate;if((h.flags&1024)!==0)switch(h.tag){case 0:case 11:case 15:break;case 1:if(Ct!==null){var Nt=Ct.memoizedProps,Ir=Ct.memoizedState,Ce=h.stateNode,ve=Ce.getSnapshotBeforeUpdate(h.elementType===h.type?Nt:Bs(h.type,Nt),Ir);Ce.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var Re=h.stateNode.containerInfo;Re.nodeType===1?Re.textContent="":Re.nodeType===9&&Re.documentElement&&Re.removeChild(Re.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ot){_r(h,h.return,ot)}if(u=h.sibling,u!==null){u.return=h.return,At=u;break}At=h.return}return Ct=mN,mN=!1,Ct}function Zv(u,h,b){var A=h.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var I=A=A.next;do{if((I.tag&u)===u){var j=I.destroy;I.destroy=void 0,j!==void 0&&NM(h,b,j)}I=I.next}while(I!==A)}}function qx(u,h){if(h=h.updateQueue,h=h!==null?h.lastEffect:null,h!==null){var b=h=h.next;do{if((b.tag&u)===u){var A=b.create;b.destroy=A()}b=b.next}while(b!==h)}}function IM(u){var h=u.ref;if(h!==null){var b=u.stateNode;switch(u.tag){case 5:u=b;break;default:u=b}typeof h=="function"?h(u):h.current=u}}function gN(u){var h=u.alternate;h!==null&&(u.alternate=null,gN(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&(delete h[Nr],delete h[Pu],delete h[oc],delete h[Op],delete h[Lp])),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function vN(u){return u.tag===5||u.tag===3||u.tag===4}function yN(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||vN(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function kM(u,h,b){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?b.nodeType===8?b.parentNode.insertBefore(u,h):b.insertBefore(u,h):(b.nodeType===8?(h=b.parentNode,h.insertBefore(u,b)):(h=b,h.appendChild(u)),b=b._reactRootContainer,b!=null||h.onclick!==null||(h.onclick=Zd));else if(A!==4&&(u=u.child,u!==null))for(kM(u,h,b),u=u.sibling;u!==null;)kM(u,h,b),u=u.sibling}function OM(u,h,b){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?b.insertBefore(u,h):b.appendChild(u);else if(A!==4&&(u=u.child,u!==null))for(OM(u,h,b),u=u.sibling;u!==null;)OM(u,h,b),u=u.sibling}var ki=null,Aa=!1;function ju(u,h,b){for(b=b.child;b!==null;)xN(u,h,b),b=b.sibling}function xN(u,h,b){if(Zt&&typeof Zt.onCommitFiberUnmount=="function")try{Zt.onCommitFiberUnmount(yn,b)}catch{}switch(b.tag){case 5:Zi||Zp(b,h);case 6:var A=ki,I=Aa;ki=null,ju(u,h,b),ki=A,Aa=I,ki!==null&&(Aa?(u=ki,b=b.stateNode,u.nodeType===8?u.parentNode.removeChild(b):u.removeChild(b)):ki.removeChild(b.stateNode));break;case 18:ki!==null&&(Aa?(u=ki,b=b.stateNode,u.nodeType===8?kp(u.parentNode,b):u.nodeType===1&&kp(u,b),Fd(u)):kp(ki,b.stateNode));break;case 4:A=ki,I=Aa,ki=b.stateNode.containerInfo,Aa=!0,ju(u,h,b),ki=A,Aa=I;break;case 0:case 11:case 14:case 15:if(!Zi&&(A=b.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){I=A=A.next;do{var j=I,W=j.destroy;j=j.tag,W!==void 0&&((j&2)!==0||(j&4)!==0)&&NM(b,h,W),I=I.next}while(I!==A)}ju(u,h,b);break;case 1:if(!Zi&&(Zp(b,h),A=b.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=b.memoizedProps,A.state=b.memoizedState,A.componentWillUnmount()}catch(oe){_r(b,h,oe)}ju(u,h,b);break;case 21:ju(u,h,b);break;case 22:b.mode&1?(Zi=(A=Zi)||b.memoizedState!==null,ju(u,h,b),Zi=A):ju(u,h,b);break;default:ju(u,h,b)}}function bN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var b=u.stateNode;b===null&&(b=u.stateNode=new eW),h.forEach(function(A){var I=uW.bind(null,u,A);b.has(A)||(b.add(A),A.then(I,I))})}}function Ta(u,h){var b=h.deletions;if(b!==null)for(var A=0;AI&&(I=W),A&=~j}if(A=I,A=at()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*rW(A/1960))-A,10u?16:u,Fu===null)var A=!1;else{if(u=Fu,Fu=null,Jx=0,(On&6)!==0)throw Error(n(331));var I=On;for(On|=4,At=u.current;At!==null;){var j=At,W=j.child;if((At.flags&16)!==0){var oe=j.deletions;if(oe!==null){for(var me=0;meat()-jM?xf(u,0):DM|=b),Vs(u,h)}function kN(u,h){h===0&&((u.mode&1)===0?h=1:(h=kn,kn<<=1,(kn&130023424)===0&&(kn=4194304)));var b=xs();u=ao(u,h),u!==null&&(Za(u,h,b),Vs(u,b))}function cW(u){var h=u.memoizedState,b=0;h!==null&&(b=h.retryLane),kN(u,b)}function uW(u,h){var b=0;switch(u.tag){case 13:var A=u.stateNode,I=u.memoizedState;I!==null&&(b=I.retryLane);break;case 19:A=u.stateNode;break;default:throw Error(n(314))}A!==null&&A.delete(h),kN(u,b)}var ON;ON=function(u,h,b){if(u!==null)if(u.memoizedProps!==h.pendingProps||Pi.current)ln=!0;else{if((u.lanes&b)===0&&(h.flags&128)===0)return ln=!1,ZG(u,h,b);ln=(u.flags&131072)!==0}else ln=!1,qn&&(h.flags&1048576)!==0&&kv(h,Fp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;$x(u,h),u=h.pendingProps;var I=ac(h,Kr.current);al(h,b),I=df(null,h,A,u,I,b);var j=Bv();return h.flags|=1,typeof I=="object"&&I!==null&&typeof I.render=="function"&&I.$$typeof===void 0?(h.tag=1,h.memoizedState=null,h.updateQueue=null,ui(A)?(j=!0,lc(h)):j=!1,h.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,an(h),I.updater=Yp,h.stateNode=I,I._reactInternals=h,M(h,A,u,b),h=on(null,h,A,!0,j,b)):(h.tag=0,qn&&j&&Ov(h),_t(null,h,I,b),h=h.child),h;case 16:A=h.elementType;e:{switch($x(u,h),u=h.pendingProps,I=A._init,A=I(A._payload),h.type=A,I=h.tag=fW(A),u=Bs(A,u),I){case 0:h=yt(null,h,A,u,b);break e;case 1:h=kt(null,h,A,u,b);break e;case 11:h=Jr(null,h,A,u,b);break e;case 14:h=ys(null,h,A,Bs(A.type,u),b);break e}throw Error(n(306,A,""))}return h;case 0:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),yt(u,h,A,I,b);case 1:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),kt(u,h,A,I,b);case 3:e:{if(sn(h),u===null)throw Error(n(387));A=h.pendingProps,j=h.memoizedState,I=j.element,mr(u,h),lr(h,A,null,b);var W=h.memoizedState;if(A=W.element,j.isDehydrated)if(j={element:A,isDehydrated:!1,cache:W.cache,pendingSuspenseBoundaries:W.pendingSuspenseBoundaries,transitions:W.transitions},h.updateQueue.baseState=j,h.memoizedState=j,h.flags&256){I=P(Error(n(423)),h),h=En(u,h,A,b,I);break e}else if(A!==I){I=P(Error(n(424)),h),h=En(u,h,A,b,I);break e}else for(Ni=ha(h.stateNode.containerInfo.firstChild),Yr=h,qn=!0,zs=null,b=sf(h,null,A,b),h.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(ol(),A===I){h=_c(u,h,b);break e}_t(u,h,A,b)}h=h.child}return h;case 5:return vc(h),u===null&&Bp(h),A=h.type,I=h.pendingProps,j=u!==null?u.memoizedProps:null,W=I.children,Av(A,I)?W=null:j!==null&&Av(A,j)&&(h.flags|=32),Ue(u,h),_t(u,h,W,b),h.child;case 6:return u===null&&Bp(h),null;case 13:return Ea(u,h,b);case 4:return cf(h,h.stateNode.containerInfo),A=h.pendingProps,u===null?h.child=dc(h,null,A,b):_t(u,h,A,b),h.child;case 11:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Jr(u,h,A,I,b);case 7:return _t(u,h,h.pendingProps,b),h.child;case 8:return _t(u,h,h.pendingProps.children,b),h.child;case 12:return _t(u,h,h.pendingProps.children,b),h.child;case 10:e:{if(A=h.type._context,I=h.pendingProps,j=h.memoizedProps,W=I.value,Gn(fc,A._currentValue),A._currentValue=W,j!==null)if(ds(j.value,W)){if(j.children===I.children&&!Pi.current){h=_c(u,h,b);break e}}else for(j=h.child,j!==null&&(j.return=h);j!==null;){var oe=j.dependencies;if(oe!==null){W=j.child;for(var me=oe.firstContext;me!==null;){if(me.context===A){if(j.tag===1){me=zn(-1,b&-b),me.tag=2;var De=j.updateQueue;if(De!==null){De=De.shared;var Qe=De.pending;Qe===null?me.next=me:(me.next=Qe.next,Qe.next=me),De.pending=me}}j.lanes|=b,me=j.alternate,me!==null&&(me.lanes|=b),af(j.return,b,h),oe.lanes|=b;break}me=me.next}}else if(j.tag===10)W=j.type===h.type?null:j.child;else if(j.tag===18){if(W=j.return,W===null)throw Error(n(341));W.lanes|=b,oe=W.alternate,oe!==null&&(oe.lanes|=b),af(W,b,h),W=j.sibling}else W=j.child;if(W!==null)W.return=j;else for(W=j;W!==null;){if(W===h){W=null;break}if(j=W.sibling,j!==null){j.return=W.return,W=j;break}W=W.return}j=W}_t(u,h,I.children,b),h=h.child}return h;case 9:return I=h.type,A=h.pendingProps.children,al(h,b),I=ps(I),A=A(I),h.flags|=1,_t(u,h,A,b),h.child;case 14:return A=h.type,I=Bs(A,h.pendingProps),I=Bs(A.type,I),ys(u,h,A,I,b);case 15:return Ie(u,h,h.type,h.pendingProps,b);case 17:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),$x(u,h),h.tag=1,ui(A)?(u=!0,lc(h)):u=!1,al(h,b),p(h,A,I),M(h,A,I,b),on(null,h,A,!0,u,b);case 19:return dN(u,h,b);case 22:return _e(u,h,b)}throw Error(n(156,h.tag))};function LN(u,h){return ke(u,h)}function dW(u,h,b,A){this.tag=u,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=A,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jo(u,h,b,A){return new dW(u,h,b,A)}function WM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function fW(u){if(typeof u=="function")return WM(u)?1:0;if(u!=null){if(u=u.$$typeof,u===H)return 11;if(u===he)return 14}return 2}function Hu(u,h){var b=u.alternate;return b===null?(b=jo(u.tag,h,u.key,u.mode),b.elementType=u.elementType,b.type=u.type,b.stateNode=u.stateNode,b.alternate=u,u.alternate=b):(b.pendingProps=h,b.type=u.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=u.flags&14680064,b.childLanes=u.childLanes,b.lanes=u.lanes,b.child=u.child,b.memoizedProps=u.memoizedProps,b.memoizedState=u.memoizedState,b.updateQueue=u.updateQueue,h=u.dependencies,b.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},b.sibling=u.sibling,b.index=u.index,b.ref=u.ref,b}function rb(u,h,b,A,I,j){var W=2;if(A=u,typeof u=="function")WM(u)&&(W=1);else if(typeof u=="string")W=5;else e:switch(u){case D:return _f(b.children,I,j,h);case F:W=8,I|=8;break;case G:return u=jo(12,b,h,I|2),u.elementType=G,u.lanes=j,u;case ne:return u=jo(13,b,h,I),u.elementType=ne,u.lanes=j,u;case te:return u=jo(19,b,h,I),u.elementType=te,u.lanes=j,u;case fe:return ib(b,I,j,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:W=10;break e;case U:W=9;break e;case H:W=11;break e;case he:W=14;break e;case se:W=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=jo(W,b,h,I),h.elementType=u,h.type=A,h.lanes=j,h}function _f(u,h,b,A){return u=jo(7,u,A,h),u.lanes=b,u}function ib(u,h,b,A){return u=jo(22,u,A,h),u.elementType=fe,u.lanes=b,u.stateNode={isHidden:!1},u}function $M(u,h,b){return u=jo(6,u,null,h),u.lanes=b,u}function XM(u,h,b){return h=jo(4,u.children!==null?u.children:[],u.key,h),h.lanes=b,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function hW(u,h,b,A,I){this.tag=h,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ld(0),this.expirationTimes=Ld(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ld(0),this.identifierPrefix=A,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function qM(u,h,b,A,I,j,W,oe,me){return u=new hW(u,h,b,oe,me),h===1?(h=1,j===!0&&(h|=8)):h=0,j=jo(3,null,null,h),u.current=j,j.stateNode=u,j.memoizedState={element:A,isDehydrated:b,cache:null,transitions:null,pendingSuspenseBoundaries:null},an(j),u}function pW(u,h,b){var A=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),tE.exports=CW(),tE.exports}var YN;function PW(){if(YN)return fb;YN=1;var t=$U();return fb.createRoot=t.createRoot,fb.hydrateRoot=t.hydrateRoot,fb}var RW=PW();const NW=V1(RW);var Gy=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},uh,dd,og,LU,IW=(LU=class extends Gy{constructor(){super();$t(this,uh);$t(this,dd);$t(this,og);St(this,og,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ge(this,dd)||this.setEventListener(ge(this,og))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,dd))==null||e.call(this),St(this,dd,void 0))}setEventListener(e){var n;St(this,og,e),(n=ge(this,dd))==null||n.call(this),St(this,dd,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ge(this,uh)!==e&&(St(this,uh,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ge(this,uh)=="boolean"?ge(this,uh):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},uh=new WeakMap,dd=new WeakMap,og=new WeakMap,LU),vP=new IW,kW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},fd,gP,DU,OW=(DU=class{constructor(){$t(this,fd,kW);$t(this,gP,!1)}setTimeoutProvider(t){St(this,fd,t)}setTimeout(t,e){return ge(this,fd).setTimeout(t,e)}clearTimeout(t){ge(this,fd).clearTimeout(t)}setInterval(t,e){return ge(this,fd).setInterval(t,e)}clearInterval(t){ge(this,fd).clearInterval(t)}},fd=new WeakMap,gP=new WeakMap,DU),Qf=new OW;function LW(t){setTimeout(t,0)}var DW=typeof window>"u"||"Deno"in globalThis;function qs(){}function jW(t,e){return typeof t=="function"?t(e):t}function mT(t){return typeof t=="number"&&t>=0&&t!==1/0}function XU(t,e){return Math.max(t+(e||0)-Date.now(),0)}function bd(t,e){return typeof t=="function"?t(e):t}function vo(t,e){return typeof t=="function"?t(e):t}function ZN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==yP(o,e.options))return!1}else if(!sy(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function QN(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(iy(e.options.mutationKey)!==iy(s))return!1}else if(!sy(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function yP(t,e){return((e==null?void 0:e.queryKeyHashFn)||iy)(t)}function iy(t){return JSON.stringify(t,(e,n)=>vT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function sy(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>sy(t[n],e[n])):!1}var UW=Object.prototype.hasOwnProperty;function qU(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=JN(t)&&JN(e);if(!r&&!(vT(t)&&vT(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let c=0;for(let d=0;d{Qf.setTimeout(e,t)})}function yT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?qU(t,e):e}function zW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function BW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var xP=Symbol();function KU(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===xP?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function YU(t,e){return typeof t=="function"?t(...e):!!t}function HW(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var oy=(()=>{let t=()=>DW;return{isServer(){return t()},setIsServer(e){t=e}}})();function xT(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var VW=LW;function GW(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=VW;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var Fi=GW(),ag,hd,lg,jU,WW=(jU=class extends Gy{constructor(){super();$t(this,ag,!0);$t(this,hd);$t(this,lg);St(this,lg,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ge(this,hd)||this.setEventListener(ge(this,lg))}onUnsubscribe(){var e;this.hasListeners()||((e=ge(this,hd))==null||e.call(this),St(this,hd,void 0))}setEventListener(e){var n;St(this,lg,e),(n=ge(this,hd))==null||n.call(this),St(this,hd,e(this.setOnline.bind(this)))}setOnline(e){ge(this,ag)!==e&&(St(this,ag,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ge(this,ag)}},ag=new WeakMap,hd=new WeakMap,lg=new WeakMap,jU),J_=new WW;function $W(t){return Math.min(1e3*2**t,3e4)}function ZU(t){return(t??"online")==="online"?J_.isOnline():!0}var bT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function QU(t){let e=!1,n=0,r;const i=xT(),s=()=>i.status!=="pending",o=S=>{var w;if(!s()){const _=new bT(S);m(_),(w=t.onCancel)==null||w.call(t,_)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>vP.isFocused()&&(t.networkMode==="always"||J_.isOnline())&&t.canRun(),d=()=>ZU(t.networkMode)&&t.canRun(),f=S=>{s()||(r==null||r(),i.resolve(S))},m=S=>{s()||(r==null||r(),i.reject(S))},y=()=>new Promise(S=>{var w;r=_=>{(s()||c())&&S(_)},(w=t.onPause)==null||w.call(t)}).then(()=>{var S;r=void 0,s()||(S=t.onContinue)==null||S.call(t)}),x=()=>{if(s())return;let S;const w=n===0?t.initialPromise:void 0;try{S=w??t.fn()}catch(_){S=Promise.reject(_)}Promise.resolve(S).then(f).catch(_=>{var N;if(s())return;const E=t.retry??(oy.isServer()?0:3),T=t.retryDelay??$W,C=typeof T=="function"?T(n,_):T,O=E===!0||typeof E=="number"&&nc()?void 0:y()).then(()=>{e?m(_):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?x():y().then(x),i)}}var dh,UU,JU=(UU=class{constructor(){$t(this,dh)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),mT(this.gcTime)&&St(this,dh,Qf.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(oy.isServer()?1/0:300*1e3))}clearGcTimeout(){ge(this,dh)!==void 0&&(Qf.clearTimeout(ge(this,dh)),St(this,dh,void 0))}},dh=new WeakMap,UU);function XW(t){return{onFetch:(e,n)=>{var d,f,m,y,x;const r=e.options,i=(m=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let S=!1;const w=T=>{HW(T,()=>e.signal,()=>S=!0)},_=KU(e.options,e.fetchOptions),E=async(T,C,O)=>{if(S)return Promise.reject(e.signal.reason);if(C==null&&T.pages.length)return Promise.resolve(T);const D=(()=>{const U={client:e.client,queryKey:e.queryKey,pageParam:C,direction:O?"backward":"forward",meta:e.options.meta};return w(U),U})(),F=await _(D),{maxPages:G}=e.options,k=O?BW:zW;return{pages:k(T.pages,F,G),pageParams:k(T.pageParams,C,G)}};if(i&&s.length){const T=i==="backward",C=T?qW:tI,O={pages:s,pageParams:o},N=C(r,O);a=await E(O,N,T)}else{const T=t??s.length;do{const C=l===0?o[0]??r.initialPageParam:tI(r,a);if(l>0&&C==null)break;a=await E(a,C),l++}while(l{var S,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 tI(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function qW(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var cg,fh,ug,Vo,hh,gi,Fy,ph,go,eF,Rc,FU,KW=(FU=class extends JU{constructor(e){super();$t(this,go);$t(this,cg);$t(this,fh);$t(this,ug);$t(this,Vo);$t(this,hh);$t(this,gi);$t(this,Fy);$t(this,ph);St(this,ph,!1),St(this,Fy,e.defaultOptions),this.setOptions(e.options),this.observers=[],St(this,hh,e.client),St(this,Vo,ge(this,hh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,St(this,fh,rI(this.options)),this.state=e.state??ge(this,fh),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return ge(this,cg)}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&&St(this,cg,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=rI(this.options);n.data!==void 0&&(this.setState(nI(n.data,n.dataUpdatedAt)),St(this,fh,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ge(this,Vo).remove(this)}setData(e,n){const r=yT(this.state.data,e,this.options);return _n(this,go,Rc).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,go,Rc).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,fh)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>vo(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===xP||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>bd(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!XU(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ge(this,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,Vo).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,ph)||_n(this,go,eF).call(this)?ge(this,gi).cancel({revert:!0}):ge(this,gi).cancelRetry()),this.scheduleGc()),ge(this,Vo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_n(this,go,Rc).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,m,y,x,S,w,_,E,T;if(this.state.fetchStatus!=="idle"&&((c=ge(this,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 C=this.observers.find(O=>O.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,i=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(St(this,ph,!0),r.signal)})},s=()=>{const C=KU(this.options,n),N=(()=>{const D={client:ge(this,hh),queryKey:this.queryKey,meta:this.meta};return i(D),D})();return St(this,ph,!1),this.options.persister?this.options.persister(C,N,this):C(N)},a=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:ge(this,hh),state:this.state,fetchFn:s};return i(C),C})(),l=ge(this,cg)==="infinite"?XW(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),St(this,ug,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&_n(this,go,Rc).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),St(this,gi,QU({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:C=>{C instanceof bT&&C.revert&&this.setState({...ge(this,ug),fetchStatus:"idle"}),r.abort()},onFail:(C,O)=>{_n(this,go,Rc).call(this,{type:"failed",failureCount:C,error:O})},onPause:()=>{_n(this,go,Rc).call(this,{type:"pause"})},onContinue:()=>{_n(this,go,Rc).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const C=await ge(this,gi).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(y=(m=ge(this,Vo).config).onSuccess)==null||y.call(m,C,this),(S=(x=ge(this,Vo).config).onSettled)==null||S.call(x,C,this.state.error,this),C}catch(C){if(C instanceof bT){if(C.silent)return ge(this,gi).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw _n(this,go,Rc).call(this,{type:"error",error:C}),(_=(w=ge(this,Vo).config).onError)==null||_.call(w,C,this),(T=(E=ge(this,Vo).config).onSettled)==null||T.call(E,this.state.data,C,this),C}finally{this.scheduleGc()}}},cg=new WeakMap,fh=new WeakMap,ug=new WeakMap,Vo=new WeakMap,hh=new WeakMap,gi=new WeakMap,Fy=new WeakMap,ph=new WeakMap,go=new WeakSet,eF=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Rc=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...tF(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...nI(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return St(this,ug,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Fi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ge(this,Vo).notify({query:this,type:"updated",action:e})})},FU);function tF(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ZU(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function nI(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function rI(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Xs,An,zy,ws,mh,dg,Oc,pd,By,fg,hg,gh,vh,md,pg,Bn,F0,_T,wT,ST,MT,ET,AT,TT,nF,zU,YW=(zU=class extends Gy{constructor(e,n){super();$t(this,Bn);$t(this,Xs);$t(this,An);$t(this,zy);$t(this,ws);$t(this,mh);$t(this,dg);$t(this,Oc);$t(this,pd);$t(this,By);$t(this,fg);$t(this,hg);$t(this,gh);$t(this,vh);$t(this,md);$t(this,pg,new Set);this.options=n,St(this,Xs,e),St(this,pd,null),St(this,Oc,xT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ge(this,An).addObserver(this),iI(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 CT(ge(this,An),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return CT(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 vo(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&&sI(ge(this,An),r,this.options,n)&&_n(this,Bn,F0).call(this),this.updateResult(),i&&(ge(this,An)!==r||vo(this.options.enabled,ge(this,An))!==vo(n.enabled,ge(this,An))||bd(this.options.staleTime,ge(this,An))!==bd(n.staleTime,ge(this,An)))&&_n(this,Bn,_T).call(this);const s=_n(this,Bn,wT).call(this);i&&(ge(this,An)!==r||vo(this.options.enabled,ge(this,An))!==vo(n.enabled,ge(this,An))||s!==ge(this,md))&&_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 QW(this,r)&&(St(this,ws,r),St(this,dg,this.options),St(this,mh,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,Oc).status==="pending"&&ge(this,Oc).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){ge(this,pg).add(e)}getCurrentQuery(){return ge(this,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 G;const r=ge(this,An),i=this.options,s=ge(this,ws),o=ge(this,mh),a=ge(this,dg),c=e!==r?e.state:ge(this,zy),{state:d}=e;let f={...d},m=!1,y;if(n._optimisticResults){const k=this.hasListeners(),U=!k&&iI(e,n),H=k&&sI(e,r,n,i);(U||H)&&(f={...f,...tF(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:w}=f;y=f.data;let _=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(k=s.data,_=!0):k=typeof n.placeholderData=="function"?n.placeholderData((G=ge(this,hg))==null?void 0:G.state.data,ge(this,hg)):n.placeholderData,k!==void 0&&(w="success",y=yT(s==null?void 0:s.data,k,n),m=!0)}if(n.select&&y!==void 0&&!_)if(s&&y===(o==null?void 0:o.data)&&n.select===ge(this,By))y=ge(this,fg);else try{St(this,By,n.select),y=n.select(y),y=yT(s==null?void 0:s.data,y,n),St(this,fg,y),St(this,pd,null)}catch(k){St(this,pd,k)}ge(this,pd)&&(x=ge(this,pd),y=ge(this,fg),S=Date.now(),w="error");const E=f.fetchStatus==="fetching",T=w==="pending",C=w==="error",O=T&&E,N=y!==void 0,F={status:w,fetchStatus:f.fetchStatus,isPending:T,isSuccess:w==="success",isError:C,isInitialLoading:O,isLoading:O,data:y,dataUpdatedAt:f.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:E,isRefetching:E&&!T,isLoadingError:C&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&N,isStale:bP(e,n),refetch:this.refetch,promise:ge(this,Oc),isEnabled:vo(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=F.data!==void 0,U=F.status==="error"&&!k,H=he=>{U?he.reject(F.error):k&&he.resolve(F.data)},ne=()=>{const he=St(this,Oc,F.promise=xT());H(he)},te=ge(this,Oc);switch(te.status){case"pending":e.queryHash===r.queryHash&&H(te);break;case"fulfilled":(U||F.data!==te.value)&&ne();break;case"rejected":(!U||F.error!==te.reason)&&ne();break}}return F}updateResult(){const e=ge(this,ws),n=this.createResult(ge(this,An),this.options);if(St(this,mh,ge(this,An).state),St(this,dg,this.options),ge(this,mh).data!==void 0&&St(this,hg,ge(this,An)),gT(n,e))return;St(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,pg).size)return!0;const o=new Set(s??ge(this,pg));return this.options.throwOnError&&o.add("error"),Object.keys(ge(this,ws)).some(a=>{const l=a;return ge(this,ws)[l]!==e[l]&&o.has(l)})};_n(this,Bn,nF).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,mh=new WeakMap,dg=new WeakMap,Oc=new WeakMap,pd=new WeakMap,By=new WeakMap,fg=new WeakMap,hg=new WeakMap,gh=new WeakMap,vh=new WeakMap,md=new WeakMap,pg=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=bd(this.options.staleTime,ge(this,An));if(oy.isServer()||ge(this,ws).isStale||!mT(e))return;const r=XU(ge(this,ws).dataUpdatedAt,e)+1;St(this,gh,Qf.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),St(this,md,e),!(oy.isServer()||vo(this.options.enabled,ge(this,An))===!1||!mT(ge(this,md))||ge(this,md)===0)&&St(this,vh,Qf.setInterval(()=>{(this.options.refetchIntervalInBackground||vP.isFocused())&&_n(this,Bn,F0).call(this)},ge(this,md)))},MT=function(){_n(this,Bn,_T).call(this),_n(this,Bn,ST).call(this,_n(this,Bn,wT).call(this))},ET=function(){ge(this,gh)!==void 0&&(Qf.clearTimeout(ge(this,gh)),St(this,gh,void 0))},AT=function(){ge(this,vh)!==void 0&&(Qf.clearInterval(ge(this,vh)),St(this,vh,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);St(this,An,e),St(this,zy,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},nF=function(e){Fi.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(ge(this,ws))}),ge(this,Xs).getQueryCache().notify({query:ge(this,An),type:"observerResultsUpdated"})})},zU);function ZW(t,e){return vo(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&vo(e.retryOnMount,t)===!1)}function iI(t,e){return ZW(t,e)||t.state.data!==void 0&&CT(t,e,e.refetchOnMount)}function CT(t,e,n){if(vo(e.enabled,t)!==!1&&bd(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&bP(t,e)}return!1}function sI(t,e,n,r){return(t!==e||vo(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&bP(t,n)}function bP(t,e){return vo(e.enabled,t)!==!1&&t.isStaleByTime(bd(e.staleTime,t))}function QW(t,e){return!gT(t.getCurrentResult(),e)}var Hy,yl,ts,yh,xl,sd,BU,JW=(BU=class extends JU{constructor(e){super();$t(this,xl);$t(this,Hy);$t(this,yl);$t(this,ts);$t(this,yh);St(this,Hy,e.client),this.mutationId=e.mutationId,St(this,ts,e.mutationCache),St(this,yl,[]),this.state=e.state||e8(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ge(this,yl).includes(e)||(ge(this,yl).push(e),this.clearGcTimeout(),ge(this,ts).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){St(this,yl,ge(this,yl).filter(n=>n!==e)),this.scheduleGc(),ge(this,ts).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ge(this,yl).length||(this.state.status==="pending"?this.scheduleGc():ge(this,ts).remove(this))}continue(){var e;return((e=ge(this,yh))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,d,f,m,y,x,S,w,_,E,T,C,O,N,D;const n=()=>{_n(this,xl,sd).call(this,{type:"continue"})},r={client:ge(this,Hy),meta:this.options.meta,mutationKey:this.options.mutationKey};St(this,yh,QU({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(F,G)=>{_n(this,xl,sd).call(this,{type:"failed",failureCount:F,error:G})},onPause:()=>{_n(this,xl,sd).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ge(this,ts).canRun(this)}));const i=this.state.status==="pending",s=!ge(this,yh).canStart();try{if(i)n();else{_n(this,xl,sd).call(this,{type:"pending",variables:e,isPaused:s}),ge(this,ts).config.onMutate&&await ge(this,ts).config.onMutate(e,this,r);const G=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));G!==this.state.context&&_n(this,xl,sd).call(this,{type:"pending",context:G,variables:e,isPaused:s})}const F=await ge(this,yh).start();return await((c=(l=ge(this,ts).config).onSuccess)==null?void 0:c.call(l,F,e,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,F,e,this.state.context,r)),await((y=(m=ge(this,ts).config).onSettled)==null?void 0:y.call(m,F,null,this.state.variables,this.state.context,this,r)),await((S=(x=this.options).onSettled)==null?void 0:S.call(x,F,null,e,this.state.context,r)),_n(this,xl,sd).call(this,{type:"success",data:F}),F}catch(F){try{await((_=(w=ge(this,ts).config).onError)==null?void 0:_.call(w,F,e,this.state.context,this,r))}catch(G){Promise.reject(G)}try{await((T=(E=this.options).onError)==null?void 0:T.call(E,F,e,this.state.context,r))}catch(G){Promise.reject(G)}try{await((O=(C=ge(this,ts).config).onSettled)==null?void 0:O.call(C,void 0,F,this.state.variables,this.state.context,this,r))}catch(G){Promise.reject(G)}try{await((D=(N=this.options).onSettled)==null?void 0:D.call(N,void 0,F,e,this.state.context,r))}catch(G){Promise.reject(G)}throw _n(this,xl,sd).call(this,{type:"error",error:F}),F}finally{ge(this,ts).runNext(this)}}},Hy=new WeakMap,yl=new WeakMap,ts=new WeakMap,yh=new WeakMap,xl=new WeakSet,sd=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Fi.batch(()=>{ge(this,yl).forEach(r=>{r.onMutationUpdate(e)}),ge(this,ts).notify({mutation:this,type:"updated",action:e})})},BU);function e8(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Lc,La,Vy,HU,t8=(HU=class extends Gy{constructor(e={}){super();$t(this,Lc);$t(this,La);$t(this,Vy);this.config=e,St(this,Lc,new Set),St(this,La,new Map),St(this,Vy,0)}build(e,n,r){const i=new JW({client:e,mutationCache:this,mutationId:++db(this,Vy)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){ge(this,Lc).add(e);const n=hb(e);if(typeof n=="string"){const r=ge(this,La).get(n);r?r.push(e):ge(this,La).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(ge(this,Lc).delete(e)){const n=hb(e);if(typeof n=="string"){const r=ge(this,La).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,La).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=hb(e);if(typeof n=="string"){const r=ge(this,La).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=hb(e);if(typeof n=="string"){const i=(r=ge(this,La).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(){Fi.batch(()=>{ge(this,Lc).forEach(e=>{this.notify({type:"removed",mutation:e})}),ge(this,Lc).clear(),ge(this,La).clear()})}getAll(){return Array.from(ge(this,Lc))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>QN(n,r))}findAll(e={}){return this.getAll().filter(n=>QN(e,n))}notify(e){Fi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Fi.batch(()=>Promise.all(e.map(n=>n.continue().catch(qs))))}},Lc=new WeakMap,La=new WeakMap,Vy=new WeakMap,HU);function hb(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,VU,n8=(VU=class extends Gy{constructor(e={}){super();$t(this,bl);this.config=e,St(this,bl,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??yP(i,n);let o=this.get(s);return o||(o=new KW({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){ge(this,bl).has(e.queryHash)||(ge(this,bl).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ge(this,bl).get(e.queryHash);n&&(e.destroy(),n===e&&ge(this,bl).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Fi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ge(this,bl).get(e)}getAll(){return[...ge(this,bl).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>ZN(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>ZN(e,r)):n}notify(e){Fi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Fi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bl=new WeakMap,VU),Sr,gd,vd,mg,gg,yd,vg,yg,GU,r8=(GU=class{constructor(t={}){$t(this,Sr);$t(this,gd);$t(this,vd);$t(this,mg);$t(this,gg);$t(this,yd);$t(this,vg);$t(this,yg);St(this,Sr,t.queryCache||new n8),St(this,gd,t.mutationCache||new t8),St(this,vd,t.defaultOptions||{}),St(this,mg,new Map),St(this,gg,new Map),St(this,yd,0)}mount(){db(this,yd)._++,ge(this,yd)===1&&(St(this,vg,vP.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Sr).onFocus())})),St(this,yg,J_.subscribe(async t=>{t&&(await this.resumePausedMutations(),ge(this,Sr).onOnline())})))}unmount(){var t,e;db(this,yd)._--,ge(this,yd)===0&&((t=ge(this,vg))==null||t.call(this),St(this,vg,void 0),(e=ge(this,yg))==null||e.call(this),St(this,yg,void 0))}isFetching(t){return ge(this,Sr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ge(this,gd).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ge(this,Sr).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=ge(this,Sr).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(bd(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return ge(this,Sr).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,Sr).get(r.queryHash),s=i==null?void 0:i.state.data,o=jW(e,s);if(o!==void 0)return ge(this,Sr).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Fi.batch(()=>ge(this,Sr).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,Sr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ge(this,Sr);Fi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ge(this,Sr);return Fi.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Fi.batch(()=>ge(this,Sr).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(qs).catch(qs)}invalidateQueries(t,e={}){return Fi.batch(()=>(ge(this,Sr).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=Fi.batch(()=>ge(this,Sr).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,Sr).build(this,e);return n.isStaleByTime(bd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(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 J_.isOnline()?ge(this,gd).resumePausedMutations():Promise.resolve()}getQueryCache(){return ge(this,Sr)}getMutationCache(){return ge(this,gd)}getDefaultOptions(){return ge(this,vd)}setDefaultOptions(t){St(this,vd,t)}setQueryDefaults(t,e){ge(this,mg).set(iy(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ge(this,mg).values()],n={};return e.forEach(r=>{sy(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){ge(this,gg).set(iy(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ge(this,gg).values()],n={};return e.forEach(r=>{sy(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ge(this,vd).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=yP(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===xP&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ge(this,vd).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ge(this,Sr).clear(),ge(this,gd).clear()}},Sr=new WeakMap,gd=new WeakMap,vd=new WeakMap,mg=new WeakMap,gg=new WeakMap,yd=new WeakMap,vg=new WeakMap,yg=new WeakMap,GU),rF=R.createContext(void 0),$h=t=>{const e=R.useContext(rF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},i8=({client:t,children:e})=>(R.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(rF.Provider,{value:t,children:e})),iF=R.createContext(!1),s8=()=>R.useContext(iF);iF.Provider;function o8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var a8=R.createContext(o8()),l8=()=>R.useContext(a8),c8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?YU(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},u8=t=>{R.useEffect(()=>{t.clearReset()},[t])},d8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||YU(n,[t.error,r])),f8=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},h8=(t,e)=>t.isLoading&&t.isFetching&&!e,p8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,oI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function m8(t,e,n){var y,x,S,w;const r=s8(),i=l8(),s=$h(),o=s.defaultQueryOptions(t);(x=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,o);const a=s.getQueryCache().get(o.queryHash),l=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,f8(o),c8(o,i,a),u8(i);const c=!s.getQueryCache().get(o.queryHash),[d]=R.useState(()=>new e(s,o)),f=d.getOptimisticResult(o),m=!r&&l;if(R.useSyncExternalStore(R.useCallback(_=>{const E=m?d.subscribe(Fi.batchCalls(_)):qs;return d.updateResult(),E},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(o)},[o,d]),p8(o,f))throw oI(o,d,i);if(d8({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((w=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,o,f),o.experimental_prefetchInRender&&!oy.isServer()&&h8(f,r)){const _=c?oI(o,d,i):a==null?void 0:a.promise;_==null||_.catch(qs).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function ls(t,e){return m8(t,YW)}/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const m8=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),iF=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** + */const g8=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),sF=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** * @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 g8={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 v8={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @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=R.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>R.createElement("svg",{ref:l,...g8,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:iF("lucide",i),...a},[...o.map(([c,d])=>R.createElement(c,d)),...Array.isArray(s)?s:[s]]));/** + */const y8=R.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>R.createElement("svg",{ref:l,...v8,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:sF("lucide",i),...a},[...o.map(([c,d])=>R.createElement(c,d)),...Array.isArray(s)?s:[s]]));/** * @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 yt=(t,e)=>{const n=R.forwardRef(({className:r,...i},s)=>R.createElement(v8,{ref:s,iconNode:e,className:iF(`lucide-${m8(t)}`,r),...i}));return n.displayName=`${t}`,n};/** + */const gt=(t,e)=>{const n=R.forwardRef(({className:r,...i},s)=>R.createElement(y8,{ref:s,iconNode:e,className:sF(`lucide-${g8(t)}`,r),...i}));return n.displayName=`${t}`,n};/** * @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 sy=yt("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + */const ay=gt("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @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 J_=yt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + */const ew=gt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const y8=yt("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** + */const x8=gt("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const CT=yt("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + */const PT=gt("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Il=yt("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + */const Il=gt("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @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=yt("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 b8=gt("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const PT=yt("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + */const RT=gt("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @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 G1=yt("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + */const W1=gt("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const b8=yt("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 _8=gt("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @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 Go=yt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + */const Go=gt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _8=yt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const w8=gt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const w8=yt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + */const S8=gt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const sF=yt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + */const oF=gt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const S8=yt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + */const M8=gt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const M8=yt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + */const E8=gt("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 E8=yt("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 A8=gt("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @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=yt("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 T8=gt("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const T8=yt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + */const C8=gt("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 oF=yt("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + */const aF=gt("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const C8=yt("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 P8=gt("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const RT=yt("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + */const NT=gt("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const P8=yt("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 R8=gt("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ew=yt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const tw=gt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const El=yt("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + */const El=gt("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @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=yt("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 N8=gt("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const xg=yt("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + */const xg=gt("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const bg=yt("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + */const bg=gt("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @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 oI=yt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + */const aI=gt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NT=yt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const IT=gt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @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=yt("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 I8=gt("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @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=yt("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 k8=gt("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @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=yt("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** + */const O8=gt("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const O8=yt("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 L8=gt("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const L8=yt("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 D8=gt("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @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 rE=yt("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** + */const iE=gt("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aI=yt("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + */const lI=gt("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const D8=yt("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 j8=gt("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @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=yt("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 U8=gt("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @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=yt("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + */const $1=gt("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @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=yt("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 F8=gt("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const F8=yt("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 z8=gt("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @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=yt("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 B8=gt("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const B8=yt("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 H8=gt("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** * @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 bP=yt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + */const _P=gt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const H8=yt("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 V8=gt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @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=yt("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 G8=gt("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const aF=yt("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** + */const lF=gt("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const G8=yt("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** + */const W8=gt("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** * @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=yt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** + */const $8=gt("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 $8=yt("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 X8=gt("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @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=yt("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 q8=gt("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** * @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=yt("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 K8=gt("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IT=yt("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** + */const kT=gt("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kT=yt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const OT=gt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const K8=yt("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** + */const Y8=gt("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @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=yt("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 Z8=gt("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** * @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 Vm=yt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + */const Vm=gt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @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=yt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + */const Q8=gt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @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=yt("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 J8=gt("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _P=yt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + */const wP=gt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const J8=yt("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 e9=gt("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const tw=yt("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + */const nw=gt("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @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=yt("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 t9=gt("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const t9=yt("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 n9=gt("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Zm=yt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + */const Zm=gt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Gm=yt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + */const cI=gt("Shuffle",[["path",{d:"M2 18h1.4c1.3 0 2.5-.6 3.3-1.7l6.1-8.6c.7-1.1 2-1.7 3.3-1.7H22",key:"1wmou1"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 6h1.9c1.5 0 2.9.9 3.6 2.2",key:"10bdb2"}],["path",{d:"M22 18h-5.9c-1.3 0-2.6-.7-3.3-1.8l-.5-.8",key:"vgxac0"}],["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const lF=yt("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** + */const Gm=gt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @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=yt("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 cF=gt("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const cF=yt("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + */const r9=gt("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OT=yt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const uF=gt("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _g=yt("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + */const LT=gt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const r9=yt("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 _g=gt("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LT=yt("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** + */const i9=gt("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const nw=yt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + */const DT=gt("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Al=yt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + */const rw=gt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @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 xh=yt("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"}]]),DT=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:U8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:PT},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:G1},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:IT},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:Il},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:lF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:aF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:E8}];var lI=1,i9=.9,s9=.8,o9=.17,iE=.1,sE=.999,a9=.9999,l9=.99,c9=/[\\\/_+.#"@\[\(\{&]/,u9=/[\\\/_+.#"@\[\(\{&]/g,d9=/[\s-]/,uF=/[\s-]/g;function jT(t,e,n,r,i,s,o){if(s===e.length)return i===t.length?lI:l9;var a=`${i},${s}`;if(o[a]!==void 0)return o[a];for(var l=r.charAt(s),c=n.indexOf(l,i),d=0,f,m,y,x;c>=0;)f=jT(t,e,n,r,c+1,s+1,o),f>d&&(c===i?f*=lI:c9.test(t.charAt(c-1))?(f*=s9,y=t.slice(i,c-1).match(u9),y&&i>0&&(f*=Math.pow(sE,y.length))):d9.test(t.charAt(c-1))?(f*=i9,x=t.slice(i,c-1).match(uF),x&&i>0&&(f*=Math.pow(sE,x.length))):(f*=o9,i>0&&(f*=Math.pow(sE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=a9)),(ff&&(f=m*iE)),f>d&&(d=f),c=n.indexOf(l,c+1);return o[a]=d,d}function cI(t){return t.toLowerCase().replace(uF," ")}function f9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,jT(t,e,cI(t),cI(e),0,0,{})}function _d(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function uI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function wg(...t){return e=>{let n=!1;const r=t.map(i=>{const s=uI(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i{var _;const{scope:m,children:y,...x}=f,S=((_=m==null?void 0:m[t])==null?void 0:_[l])||a,w=R.useMemo(()=>x,Object.values(x));return g.jsx(S.Provider,{value:w,children:y})};c.displayName=s+"Provider";function d(f,m){var S;const y=((S=m==null?void 0:m[t])==null?void 0:S[l])||a,x=R.useContext(y);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(o=>R.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return R.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,p9(i,...e)]}function p9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var oy=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},m9=V1[" useId ".trim().toString()]||(()=>{}),g9=0;function Vc(t){const[e,n]=R.useState(m9());return oy(()=>{n(r=>r??String(g9++))},[t]),e?`radix-${e}`:""}var v9=V1[" useInsertionEffect ".trim().toString()]||oy;function y9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=x9({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=R.useRef(t!==void 0);R.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const c=R.useCallback(d=>{var f;if(a){const m=b9(d)?d(t):d;m!==t&&((f=o.current)==null||f.call(o,m))}else s(d)},[a,t,s,o]);return[l,c]}function x9({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return v9(()=>{s.current=e},[e]),R.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function b9(t){return typeof t=="function"}var $1=WU();function dF(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];dI(i)&&typeof fb=="function"&&(i=fb(i._payload)),R.Children.forEach(i,m=>{var y;if(E9(m)){a=!0;const x=m;let S="child"in x.props?x.props.child:x.props.children;dI(S)&&typeof fb=="function"&&(S=fb(S._payload)),o=w9(x,S),l.push((y=o==null?void 0:o.props)==null?void 0:y.children)}else l.push(m)}),o?o=R.cloneElement(o,void 0,l):!a&&R.Children.count(i)===1&&R.isValidElement(i)&&(o=i);const c=o?M9(o):void 0,d=Xh(r,c);if(!o){if(i||i===0)throw new Error(a?P9(t):C9(t));return i}const f=S9(s,o.props??{});return o.type!==R.Fragment&&(f.ref=r?d:c),R.cloneElement(o,f)});return e.displayName=`${t}.Slot`,e}var _9=Symbol.for("radix.slottable"),w9=(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 S9(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function M9(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 E9(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===_9}var A9=Symbol.for("react.lazy");function dI(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===A9&&"_payload"in t&&T9(t._payload)}function T9(t){return typeof t=="object"&&t!==null&&"then"in t}var C9=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,P9=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,fb=V1[" use ".trim().toString()],R9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vi=R9.reduce((t,e)=>{const n=dF(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function N9(t,e){t&&$1.flushSync(()=>t.dispatchEvent(e))}function ay(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 I9(t,e=globalThis==null?void 0:globalThis.document){const n=ay(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 k9="DismissableLayer",UT="dismissableLayer.update",O9="dismissableLayer.pointerDownOutside",L9="dismissableLayer.focusOutside",fI,wP=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),fF=R.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,d=R.useContext(wP),[f,m]=R.useState(null),y=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=R.useState({}),S=Xh(e,V=>m(V)),w=Array.from(d.layers),[_]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(_),T=f?w.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=E,N=R.useRef(!1),D=F9(V=>{const k=V.target;if(!(k instanceof Node))return;const U=[...d.branches].some(H=>H.contains(k));!O||U||(s==null||s(V),a==null||a(V),V.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),F=z9(V=>{if(r&&N.current)return;const k=V.target;[...d.branches].some(H=>H.contains(k))||(o==null||o(V),a==null||a(V),V.defaultPrevented||l==null||l())},y);return I9(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&&(fI=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),hI(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=fI))}},[f,y,n,d]),R.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),hI())},[f,d]),R.useEffect(()=>{const V=()=>x({});return document.addEventListener(UT,V),()=>document.removeEventListener(UT,V)},[]),g.jsx(Vi.div,{...c,ref:S,style:{pointerEvents:C?O?"auto":"none":void 0,...t.style},onFocusCapture:_d(t.onFocusCapture,F.onFocusCapture),onBlurCapture:_d(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:_d(t.onPointerDownCapture,D.onPointerDownCapture)})});fF.displayName=k9;var D9="DismissableLayerBranch",j9=R.forwardRef((t,e)=>{const n=R.useContext(wP),r=R.useRef(null),i=Xh(e,r);return R.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),g.jsx(Vi.div,{...t,ref:i})});j9.displayName=D9;function U9(){const t=R.useContext(wP),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function F9(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,o=ay(t),a=R.useRef(!1),l=R.useRef(!1),c=R.useRef(new Map),d=R.useRef(()=>{});return R.useEffect(()=>{function f(){l.current=!1,i.current=!1,c.current.clear()}function m(){return Array.from(c.current.values()).some(Boolean)}function y(E){if(!l.current)return;const T=E.target;T instanceof Node&&[...s].some(O=>O.contains(T))||c.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}function x(E){l.current&&c.current.set(E.type,!1)}const S=E=>{if(E.target&&!a.current){let T=function(){n.removeEventListener("click",d.current);const O=m();f(),O||hF(O9,o,C,{discrete:!0})};const C={originalEvent:E};l.current=!0,i.current=r&&E.button===0,c.current.clear(),!r||E.button!==0?T():(n.removeEventListener("click",d.current),d.current=T,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();a.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const E of w)n.addEventListener(E,y,!0),n.addEventListener(E,x);const _=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(_),n.removeEventListener("pointerdown",S),n.removeEventListener("click",d.current);for(const E of w)n.removeEventListener(E,y,!0),n.removeEventListener(E,x)}},[n,o,r,i,s]),{onPointerDownCapture:()=>a.current=!0}}function z9(t,e=globalThis==null?void 0:globalThis.document){const n=ay(t),r=R.useRef(!1);return R.useEffect(()=>{const i=s=>{s.target&&!r.current&&hF(L9,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 hI(){const t=new CustomEvent(UT);document.dispatchEvent(t)}function hF(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?N9(i,s):i.dispatchEvent(s)}var oE="focusScope.autoFocusOnMount",aE="focusScope.autoFocusOnUnmount",pI={bubbles:!1,cancelable:!0},B9="FocusScope",pF=R.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=R.useState(null),c=ay(i),d=ay(s),f=R.useRef(null),m=Xh(e,S=>l(S)),y=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let S=function(T){if(y.paused||!a)return;const C=T.target;a.contains(C)?f.current=C:od(f.current,{select:!0})},w=function(T){if(y.paused||!a)return;const C=T.relatedTarget;C!==null&&(a.contains(C)||od(f.current,{select:!0}))},_=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&od(a)};document.addEventListener("focusin",S),document.addEventListener("focusout",w);const E=new MutationObserver(_);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",w),E.disconnect()}}},[r,a,y.paused]),R.useEffect(()=>{if(a){gI.add(y);const S=document.activeElement;if(!a.contains(S)){const _=new CustomEvent(oE,pI);a.addEventListener(oE,c),a.dispatchEvent(_),_.defaultPrevented||(H9(X9(mF(a)),{select:!0}),document.activeElement===S&&od(a))}return()=>{a.removeEventListener(oE,c),setTimeout(()=>{const _=new CustomEvent(aE,pI);a.addEventListener(aE,d),a.dispatchEvent(_),_.defaultPrevented||od(S??document.body,{select:!0}),a.removeEventListener(aE,d),gI.remove(y)},0)}}},[a,c,d,y]);const x=R.useCallback(S=>{if(!n&&!r||y.paused)return;const w=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,_=document.activeElement;if(w&&_){const E=S.currentTarget,[T,C]=V9(E);T&&C?!S.shiftKey&&_===C?(S.preventDefault(),n&&od(T,{select:!0})):S.shiftKey&&_===T&&(S.preventDefault(),n&&od(C,{select:!0})):_===E&&S.preventDefault()}},[n,r,y.paused]);return g.jsx(Vi.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});pF.displayName=B9;function H9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(od(r,{select:e}),document.activeElement!==n)return}function V9(t){const e=mF(t),n=mI(e,t),r=mI(e.reverse(),t);return[n,r]}function mF(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 mI(t,e){for(const n of t)if(!G9(n,{upTo:e}))return n}function G9(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 W9(t){return t instanceof HTMLInputElement&&"select"in t}function od(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&W9(t)&&e&&t.select()}}var gI=$9();function $9(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=vI(t,e),t.unshift(e)},remove(e){var n;t=vI(t,e),(n=t[0])==null||n.resume()}}}function vI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function X9(t){return t.filter(e=>e.tagName!=="A")}var q9="Portal",gF=R.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=R.useState(!1);oy(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?$1.createPortal(g.jsx(Vi.div,{...r,ref:e}),o):null});gF.displayName=q9;function K9(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}var X1=t=>{const{present:e,children:n}=t,r=Y9(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=Z9(r.ref,Q9(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null};X1.displayName="Presence";function Y9(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),o=t?"mounted":"unmounted",[a,l]=K9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=hb(r.current);s.current=a==="mounted"?c:"none"},[a]),oy(()=>{const c=r.current,d=i.current;if(d!==t){const m=s.current,y=hb(c);t?l("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&m!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),oy(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=hb(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)})}},m=y=>{y.target===e&&(s.current=hb(r.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:R.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function yI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Z9(...t){const e=R.useRef(t);return e.current=t,R.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(o=>{const a=yI(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o{dl||(dl={start:xI(),end:xI()});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),pb++,()=>{pb===1&&(dl==null||dl.start.remove(),dl==null||dl.end.remove(),dl=null),pb=Math.max(0,pb-1)}},[])}function xI(){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 g$;var e=v$(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])}},x$=bF(),Qm="data-scroll-locked",b$=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),` - .`.concat(t$,` { + */const Al=gt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xh=gt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),jT=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:F8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:RT},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:W1},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:kT},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:Il},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:cF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:lF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:A8}];var uI=1,s9=.9,o9=.8,a9=.17,sE=.1,oE=.999,l9=.9999,c9=.99,u9=/[\\\/_+.#"@\[\(\{&]/,d9=/[\\\/_+.#"@\[\(\{&]/g,f9=/[\s-]/,dF=/[\s-]/g;function UT(t,e,n,r,i,s,o){if(s===e.length)return i===t.length?uI:c9;var a=`${i},${s}`;if(o[a]!==void 0)return o[a];for(var l=r.charAt(s),c=n.indexOf(l,i),d=0,f,m,y,x;c>=0;)f=UT(t,e,n,r,c+1,s+1,o),f>d&&(c===i?f*=uI:u9.test(t.charAt(c-1))?(f*=o9,y=t.slice(i,c-1).match(d9),y&&i>0&&(f*=Math.pow(oE,y.length))):f9.test(t.charAt(c-1))?(f*=s9,x=t.slice(i,c-1).match(dF),x&&i>0&&(f*=Math.pow(oE,x.length))):(f*=a9,i>0&&(f*=Math.pow(oE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=l9)),(ff&&(f=m*sE)),f>d&&(d=f),c=n.indexOf(l,c+1);return o[a]=d,d}function dI(t){return t.toLowerCase().replace(dF," ")}function h9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,UT(t,e,dI(t),dI(e),0,0,{})}function _d(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function fI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function wg(...t){return e=>{let n=!1;const r=t.map(i=>{const s=fI(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i{var _;const{scope:m,children:y,...x}=f,S=((_=m==null?void 0:m[t])==null?void 0:_[l])||a,w=R.useMemo(()=>x,Object.values(x));return g.jsx(S.Provider,{value:w,children:y})};c.displayName=s+"Provider";function d(f,m){var S;const y=((S=m==null?void 0:m[t])==null?void 0:S[l])||a,x=R.useContext(y);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(o=>R.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return R.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,m9(i,...e)]}function m9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var ly=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},g9=G1[" useId ".trim().toString()]||(()=>{}),v9=0;function Vc(t){const[e,n]=R.useState(g9());return ly(()=>{n(r=>r??String(v9++))},[t]),e?`radix-${e}`:""}var y9=G1[" useInsertionEffect ".trim().toString()]||ly;function x9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=b9({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=R.useRef(t!==void 0);R.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const c=R.useCallback(d=>{var f;if(a){const m=_9(d)?d(t):d;m!==t&&((f=o.current)==null||f.call(o,m))}else s(d)},[a,t,s,o]);return[l,c]}function b9({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return y9(()=>{s.current=e},[e]),R.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function _9(t){return typeof t=="function"}var X1=$U();function fF(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];hI(i)&&typeof pb=="function"&&(i=pb(i._payload)),R.Children.forEach(i,m=>{var y;if(A9(m)){a=!0;const x=m;let S="child"in x.props?x.props.child:x.props.children;hI(S)&&typeof pb=="function"&&(S=pb(S._payload)),o=S9(x,S),l.push((y=o==null?void 0:o.props)==null?void 0:y.children)}else l.push(m)}),o?o=R.cloneElement(o,void 0,l):!a&&R.Children.count(i)===1&&R.isValidElement(i)&&(o=i);const c=o?E9(o):void 0,d=Xh(r,c);if(!o){if(i||i===0)throw new Error(a?R9(t):P9(t));return i}const f=M9(s,o.props??{});return o.type!==R.Fragment&&(f.ref=r?d:c),R.cloneElement(o,f)});return e.displayName=`${t}.Slot`,e}var w9=Symbol.for("radix.slottable"),S9=(t,e)=>{if("child"in t.props){const n=t.props.child;return R.isValidElement(n)?R.cloneElement(n,void 0,t.props.children(n.props.children)):null}return R.isValidElement(e)?e:null};function M9(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function E9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function A9(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===w9}var T9=Symbol.for("react.lazy");function hI(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===T9&&"_payload"in t&&C9(t._payload)}function C9(t){return typeof t=="object"&&t!==null&&"then"in t}var P9=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,R9=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,pb=G1[" use ".trim().toString()],N9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vi=N9.reduce((t,e)=>{const n=fF(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),g.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function I9(t,e){t&&X1.flushSync(()=>t.dispatchEvent(e))}function cy(t){const e=R.useRef(t);return R.useEffect(()=>{e.current=t}),R.useMemo(()=>((...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)}),[])}function k9(t,e=globalThis==null?void 0:globalThis.document){const n=cy(t);R.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var O9="DismissableLayer",FT="dismissableLayer.update",L9="dismissableLayer.pointerDownOutside",D9="dismissableLayer.focusOutside",pI,SP=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),hF=R.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,d=R.useContext(SP),[f,m]=R.useState(null),y=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=R.useState({}),S=Xh(e,G=>m(G)),w=Array.from(d.layers),[_]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(_),T=f?w.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=E,N=R.useRef(!1),D=z9(G=>{const k=G.target;if(!(k instanceof Node))return;const U=[...d.branches].some(H=>H.contains(k));!O||U||(s==null||s(G),a==null||a(G),G.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),F=B9(G=>{if(r&&N.current)return;const k=G.target;[...d.branches].some(H=>H.contains(k))||(o==null||o(G),a==null||a(G),G.defaultPrevented||l==null||l())},y);return k9(G=>{T===d.layers.size-1&&(i==null||i(G),!G.defaultPrevented&&l&&(G.preventDefault(),l()))},y),R.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(pI=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),mI(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=pI))}},[f,y,n,d]),R.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),mI())},[f,d]),R.useEffect(()=>{const G=()=>x({});return document.addEventListener(FT,G),()=>document.removeEventListener(FT,G)},[]),g.jsx(Vi.div,{...c,ref:S,style:{pointerEvents:C?O?"auto":"none":void 0,...t.style},onFocusCapture:_d(t.onFocusCapture,F.onFocusCapture),onBlurCapture:_d(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:_d(t.onPointerDownCapture,D.onPointerDownCapture)})});hF.displayName=O9;var j9="DismissableLayerBranch",U9=R.forwardRef((t,e)=>{const n=R.useContext(SP),r=R.useRef(null),i=Xh(e,r);return R.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),g.jsx(Vi.div,{...t,ref:i})});U9.displayName=j9;function F9(){const t=R.useContext(SP),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function z9(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,o=cy(t),a=R.useRef(!1),l=R.useRef(!1),c=R.useRef(new Map),d=R.useRef(()=>{});return R.useEffect(()=>{function f(){l.current=!1,i.current=!1,c.current.clear()}function m(){return Array.from(c.current.values()).some(Boolean)}function y(E){if(!l.current)return;const T=E.target;T instanceof Node&&[...s].some(O=>O.contains(T))||c.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}function x(E){l.current&&c.current.set(E.type,!1)}const S=E=>{if(E.target&&!a.current){let T=function(){n.removeEventListener("click",d.current);const O=m();f(),O||pF(L9,o,C,{discrete:!0})};const C={originalEvent:E};l.current=!0,i.current=r&&E.button===0,c.current.clear(),!r||E.button!==0?T():(n.removeEventListener("click",d.current),d.current=T,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();a.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const E of w)n.addEventListener(E,y,!0),n.addEventListener(E,x);const _=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(_),n.removeEventListener("pointerdown",S),n.removeEventListener("click",d.current);for(const E of w)n.removeEventListener(E,y,!0),n.removeEventListener(E,x)}},[n,o,r,i,s]),{onPointerDownCapture:()=>a.current=!0}}function B9(t,e=globalThis==null?void 0:globalThis.document){const n=cy(t),r=R.useRef(!1);return R.useEffect(()=>{const i=s=>{s.target&&!r.current&&pF(D9,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function mI(){const t=new CustomEvent(FT);document.dispatchEvent(t)}function pF(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?I9(i,s):i.dispatchEvent(s)}var aE="focusScope.autoFocusOnMount",lE="focusScope.autoFocusOnUnmount",gI={bubbles:!1,cancelable:!0},H9="FocusScope",mF=R.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=R.useState(null),c=cy(i),d=cy(s),f=R.useRef(null),m=Xh(e,S=>l(S)),y=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let S=function(T){if(y.paused||!a)return;const C=T.target;a.contains(C)?f.current=C:od(f.current,{select:!0})},w=function(T){if(y.paused||!a)return;const C=T.relatedTarget;C!==null&&(a.contains(C)||od(f.current,{select:!0}))},_=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&od(a)};document.addEventListener("focusin",S),document.addEventListener("focusout",w);const E=new MutationObserver(_);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",w),E.disconnect()}}},[r,a,y.paused]),R.useEffect(()=>{if(a){yI.add(y);const S=document.activeElement;if(!a.contains(S)){const _=new CustomEvent(aE,gI);a.addEventListener(aE,c),a.dispatchEvent(_),_.defaultPrevented||(V9(q9(gF(a)),{select:!0}),document.activeElement===S&&od(a))}return()=>{a.removeEventListener(aE,c),setTimeout(()=>{const _=new CustomEvent(lE,gI);a.addEventListener(lE,d),a.dispatchEvent(_),_.defaultPrevented||od(S??document.body,{select:!0}),a.removeEventListener(lE,d),yI.remove(y)},0)}}},[a,c,d,y]);const x=R.useCallback(S=>{if(!n&&!r||y.paused)return;const w=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,_=document.activeElement;if(w&&_){const E=S.currentTarget,[T,C]=G9(E);T&&C?!S.shiftKey&&_===C?(S.preventDefault(),n&&od(T,{select:!0})):S.shiftKey&&_===T&&(S.preventDefault(),n&&od(C,{select:!0})):_===E&&S.preventDefault()}},[n,r,y.paused]);return g.jsx(Vi.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});mF.displayName=H9;function V9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(od(r,{select:e}),document.activeElement!==n)return}function G9(t){const e=gF(t),n=vI(e,t),r=vI(e.reverse(),t);return[n,r]}function gF(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function vI(t,e){for(const n of t)if(!W9(n,{upTo:e}))return n}function W9(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function $9(t){return t instanceof HTMLInputElement&&"select"in t}function od(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&$9(t)&&e&&t.select()}}var yI=X9();function X9(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=xI(t,e),t.unshift(e)},remove(e){var n;t=xI(t,e),(n=t[0])==null||n.resume()}}}function xI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function q9(t){return t.filter(e=>e.tagName!=="A")}var K9="Portal",vF=R.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=R.useState(!1);ly(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?X1.createPortal(g.jsx(Vi.div,{...r,ref:e}),o):null});vF.displayName=K9;function Y9(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}var q1=t=>{const{present:e,children:n}=t,r=Z9(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=Q9(r.ref,J9(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null};q1.displayName="Presence";function Z9(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Y9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=mb(r.current);s.current=a==="mounted"?c:"none"},[a]),ly(()=>{const c=r.current,d=i.current;if(d!==t){const m=s.current,y=mb(c);t?l("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&m!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),ly(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=mb(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&S&&(l("ANIMATION_END"),!i.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},m=y=>{y.target===e&&(s.current=mb(r.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:R.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function bI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Q9(...t){const e=R.useRef(t);return e.current=t,R.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(o=>{const a=bI(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o{dl||(dl={start:_I(),end:_I()});const{start:t,end:e}=dl;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),gb++,()=>{gb===1&&(dl==null||dl.start.remove(),dl==null||dl.end.remove(),dl=null),gb=Math.max(0,gb-1)}},[])}function _I(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var _l=function(){return _l=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return v$;var e=y$(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},b$=_F(),Qm="data-scroll-locked",_$=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),` + .`.concat(n$,` { overflow: hidden `).concat(r,`; padding-right: `).concat(a,"px ").concat(r,`; } @@ -455,29 +460,29 @@ Error generating stack: `+j.message+` `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` } - .`).concat(D_,` { + .`).concat(j_,` { right: `).concat(a,"px ").concat(r,`; } - .`).concat(j_,` { + .`).concat(U_,` { margin-right: `).concat(a,"px ").concat(r,`; } - .`).concat(D_," .").concat(D_,` { + .`).concat(j_," .").concat(j_,` { right: 0 `).concat(r,`; } - .`).concat(j_," .").concat(j_,` { + .`).concat(U_," .").concat(U_,` { margin-right: 0 `).concat(r,`; } body[`).concat(Qm,`] { - `).concat(n$,": ").concat(a,`px; + `).concat(r$,": ").concat(a,`px; } -`)},_I=function(){var t=parseInt(document.body.getAttribute(Qm)||"0",10);return isFinite(t)?t:0},_$=function(){R.useEffect(function(){return document.body.setAttribute(Qm,(_I()+1).toString()),function(){var t=_I()-1;t<=0?document.body.removeAttribute(Qm):document.body.setAttribute(Qm,t.toString())}},[])},w$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;_$();var s=R.useMemo(function(){return y$(i)},[i]);return R.createElement(x$,{styles:b$(s,!e,i,n?"":"!important")})},FT=!1;if(typeof window<"u")try{var mb=Object.defineProperty({},"passive",{get:function(){return FT=!0,!0}});window.addEventListener("test",mb,mb),window.removeEventListener("test",mb,mb)}catch{FT=!1}var tm=FT?{passive:!1}:!1,S$=function(t){return t.tagName==="TEXTAREA"},_F=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!S$(t)&&n[e]==="visible")},M$=function(t){return _F(t,"overflowY")},E$=function(t){return _F(t,"overflowX")},wI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=wF(t,r);if(i){var s=SF(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},A$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},T$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},wF=function(t,e){return t==="v"?M$(e):E$(e)},SF=function(t,e){return t==="v"?A$(e):T$(e)},C$=function(t,e){return t==="h"&&e==="rtl"?-1:1},P$=function(t,e,n,r,i){var s=C$(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,d=o>0,f=0,m=0;do{if(!a)break;var y=SF(t,a),x=y[0],S=y[1],w=y[2],_=S-w-s*x;(x||_)&&wF(t,a)&&(f+=_,m+=x);var E=a.parentNode;a=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(c=!0),c},gb=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},SI=function(t){return[t.deltaX,t.deltaY]},MI=function(t){return t&&"current"in t?t.current:t},R$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},N$=function(t){return` +`)},SI=function(){var t=parseInt(document.body.getAttribute(Qm)||"0",10);return isFinite(t)?t:0},w$=function(){R.useEffect(function(){return document.body.setAttribute(Qm,(SI()+1).toString()),function(){var t=SI()-1;t<=0?document.body.removeAttribute(Qm):document.body.setAttribute(Qm,t.toString())}},[])},S$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;w$();var s=R.useMemo(function(){return x$(i)},[i]);return R.createElement(b$,{styles:_$(s,!e,i,n?"":"!important")})},zT=!1;if(typeof window<"u")try{var vb=Object.defineProperty({},"passive",{get:function(){return zT=!0,!0}});window.addEventListener("test",vb,vb),window.removeEventListener("test",vb,vb)}catch{zT=!1}var tm=zT?{passive:!1}:!1,M$=function(t){return t.tagName==="TEXTAREA"},wF=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!M$(t)&&n[e]==="visible")},E$=function(t){return wF(t,"overflowY")},A$=function(t){return wF(t,"overflowX")},MI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=SF(t,r);if(i){var s=MF(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},T$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},C$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},SF=function(t,e){return t==="v"?E$(e):A$(e)},MF=function(t,e){return t==="v"?T$(e):C$(e)},P$=function(t,e){return t==="h"&&e==="rtl"?-1:1},R$=function(t,e,n,r,i){var s=P$(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,d=o>0,f=0,m=0;do{if(!a)break;var y=MF(t,a),x=y[0],S=y[1],w=y[2],_=S-w-s*x;(x||_)&&SF(t,a)&&(f+=_,m+=x);var E=a.parentNode;a=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(c=!0),c},yb=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},EI=function(t){return[t.deltaX,t.deltaY]},AI=function(t){return t&&"current"in t?t.current:t},N$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},I$=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},I$=0,nm=[];function k$(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(I$++)[0],s=R.useState(bF)[0],o=R.useRef(t);R.useEffect(function(){o.current=t},[t]),R.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=e$([t.lockRef.current],(t.shards||[]).map(MI),!0).filter(Boolean);return S.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=R.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!o.current.allowPinchZoom;var _=gb(S),E=n.current,T="deltaX"in S?S.deltaX:E[0]-_[0],C="deltaY"in S?S.deltaY:E[1]-_[1],O,N=S.target,D=Math.abs(T)>Math.abs(C)?"h":"v";if("touches"in S&&D==="h"&&N.type==="range")return!1;var F=window.getSelection(),V=F&&F.anchorNode,k=V?V===N||V.contains(N):!1;if(k)return!1;var U=wI(D,N);if(!U)return!0;if(U?O=D:(O=D==="v"?"h":"v",U=wI(D,N)),!U)return!1;if(!r.current&&"changedTouches"in S&&(T||C)&&(r.current=O),!O)return!0;var H=r.current||O;return P$(H,w,S,H==="h"?T:C)},[]),l=R.useCallback(function(S){var w=S;if(!(!nm.length||nm[nm.length-1]!==s)){var _="deltaY"in w?SI(w):gb(w),E=e.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&R$(O.delta,_)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var T=(o.current.shards||[]).map(MI).filter(Boolean).filter(function(O){return O.contains(w.target)}),C=T.length>0?a(w,T[0]):!o.current.noIsolation;C&&w.cancelable&&w.preventDefault()}}},[]),c=R.useCallback(function(S,w,_,E){var T={name:S,delta:w,target:_,should:E,shadowParent:O$(_)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(C){return C!==T})},1)},[]),d=R.useCallback(function(S){n.current=gb(S),r.current=void 0},[]),f=R.useCallback(function(S){c(S.type,SI(S),S.target,a(S,t.lockRef.current))},[]),m=R.useCallback(function(S){c(S.type,gb(S),S.target,a(S,t.lockRef.current))},[]);R.useEffect(function(){return nm.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,tm),document.addEventListener("touchmove",l,tm),document.addEventListener("touchstart",d,tm),function(){nm=nm.filter(function(S){return S!==s}),document.removeEventListener("wheel",l,tm),document.removeEventListener("touchmove",l,tm),document.removeEventListener("touchstart",d,tm)}},[]);var y=t.removeScrollBar,x=t.inert;return R.createElement(R.Fragment,null,x?R.createElement(s,{styles:N$(i)}):null,y?R.createElement(w$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function O$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const L$=c$(xF,k$);var MF=R.forwardRef(function(t,e){return R.createElement(q1,_l({},t,{ref:e,sideCar:L$}))});MF.classNames=q1.classNames;var D$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rm=new WeakMap,vb=new WeakMap,yb={},dE=0,EF=function(t){return t&&(t.host||EF(t.parentNode))},j$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=EF(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})},U$=function(t,e,n,r){var i=j$(e,Array.isArray(t)?t:[t]);yb[n]||(yb[n]=new WeakMap);var s=yb[n],o=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))d(m);else try{var y=m.getAttribute(r),x=y!==null&&y!=="false",S=(rm.get(m)||0)+1,w=(s.get(m)||0)+1;rm.set(m,S),s.set(m,w),o.push(m),S===1&&x&&vb.set(m,!0),w===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(_){console.error("aria-hidden: cannot operate on ",m,_)}})};return d(e),a.clear(),dE++,function(){o.forEach(function(f){var m=rm.get(f)-1,y=s.get(f)-1;rm.set(f,m),s.set(f,y),m||(vb.has(f)||f.removeAttribute(r),vb.delete(f)),y||f.removeAttribute(n)}),dE--,dE||(rm=new WeakMap,rm=new WeakMap,vb=new WeakMap,yb={})}},F$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=D$(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),U$(r,i,n,"aria-hidden")):function(){return null}},K1="Dialog",[AF]=h9(K1),[z$,Wa]=AF(K1),TF=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=R.useRef(null),l=R.useRef(null),[c,d]=y9({prop:r,defaultProp:i??!1,onChange:s,caller:K1});return g.jsx(z$,{scope:e,triggerRef:a,contentRef:l,contentId:Vc(),titleId:Vc(),descriptionId:Vc(),open:c,onOpenChange:d,onOpenToggle:R.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};TF.displayName=K1;var CF="DialogTrigger",B$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(CF,n),s=Xh(e,i.triggerRef);return g.jsx(Vi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":MP(i.open),...r,ref:s,onClick:_d(t.onClick,i.onOpenToggle)})});B$.displayName=CF;var SP="DialogPortal",[H$,PF]=AF(SP,{forceMount:void 0}),RF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Wa(SP,e);return g.jsx(H$,{scope:e,forceMount:n,children:R.Children.map(r,o=>g.jsx(X1,{present:n||s.open,children:g.jsx(gF,{asChild:!0,container:i,children:o})}))})};RF.displayName=SP;var rw="DialogOverlay",NF=R.forwardRef((t,e)=>{const n=PF(rw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wa(rw,t.__scopeDialog);return s.modal?g.jsx(X1,{present:r||s.open,children:g.jsx(G$,{...i,ref:e})}):null});NF.displayName=rw;var V$=dF("DialogOverlay.RemoveScroll"),G$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(rw,n),s=U9(),o=Xh(e,s);return g.jsx(MF,{as:V$,allowPinchZoom:!0,shards:[i.contentRef],children:g.jsx(Vi.div,{"data-state":MP(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),Sg="DialogContent",IF=R.forwardRef((t,e)=>{const n=PF(Sg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wa(Sg,t.__scopeDialog);return g.jsx(X1,{present:r||s.open,children:s.modal?g.jsx(W$,{...i,ref:e}):g.jsx($$,{...i,ref:e})})});IF.displayName=Sg;var W$=R.forwardRef((t,e)=>{const n=Wa(Sg,t.__scopeDialog),r=R.useRef(null),i=Xh(e,n.contentRef,r);return R.useEffect(()=>{const s=r.current;if(s)return F$(s)},[]),g.jsx(kF,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_d(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:_d(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:_d(t.onFocusOutside,s=>s.preventDefault())})}),$$=R.forwardRef((t,e)=>{const n=Wa(Sg,t.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return g.jsx(kF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),kF=R.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Wa(Sg,n);return J9(),g.jsx(g.Fragment,{children:g.jsx(pF,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:g.jsx(fF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":MP(a.open),...o,ref:e,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),OF="DialogTitle",X$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(OF,n);return g.jsx(Vi.h2,{id:i.titleId,...r,ref:e})});X$.displayName=OF;var LF="DialogDescription",q$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(LF,n);return g.jsx(Vi.p,{id:i.descriptionId,...r,ref:e})});q$.displayName=LF;var DF="DialogClose",K$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(DF,n);return g.jsx(Vi.button,{type:"button",...r,ref:e,onClick:_d(t.onClick,()=>i.onOpenChange(!1))})});K$.displayName=DF;function MP(t){return t?"open":"closed"}var r0='[cmdk-group=""]',fE='[cmdk-group-items=""]',Y$='[cmdk-group-heading=""]',jF='[cmdk-item=""]',EI=`${jF}:not([aria-disabled="true"])`,zT="cmdk-item-select",Dm="data-value",Z$=(t,e,n)=>f9(t,e,n),UF=R.createContext(void 0),Vy=()=>R.useContext(UF),FF=R.createContext(void 0),EP=()=>R.useContext(FF),zF=R.createContext(void 0),BF=R.forwardRef((t,e)=>{let n=jm(()=>{var Z,ge;return{search:"",value:(ge=(Z=t.value)!=null?Z:t.defaultValue)!=null?ge:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=jm(()=>new Set),i=jm(()=>new Map),s=jm(()=>new Map),o=jm(()=>new Set),a=HF(t),{label:l,children:c,value:d,onValueChange:f,filter:m,shouldFilter:y,loop:x,disablePointerSelection:S=!1,vimBindings:w=!0,..._}=t,E=Vc(),T=Vc(),C=Vc(),O=R.useRef(null),N=l7();Ch(()=>{if(d!==void 0){let Z=d.trim();n.current.value=Z,D.emit()}},[d]),Ch(()=>{N(6,ne)},[]);let D=R.useMemo(()=>({subscribe:Z=>(o.current.add(Z),()=>o.current.delete(Z)),snapshot:()=>n.current,setState:(Z,ge,le)=>{var ue,_e,Se,qe;if(!Object.is(n.current[Z],ge)){if(n.current[Z]=ge,Z==="search")H(),k(),N(1,U);else if(Z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Me=document.getElementById(C);Me?Me.focus():(ue=document.getElementById(E))==null||ue.focus()}if(N(7,()=>{var Me;n.current.selectedItemId=(Me=te())==null?void 0:Me.id,D.emit()}),le||N(5,ne),((_e=a.current)==null?void 0:_e.value)!==void 0){let Me=ge??"";(qe=(Se=a.current).onValueChange)==null||qe.call(Se,Me);return}}D.emit()}},emit:()=>{o.current.forEach(Z=>Z())}}),[]),F=R.useMemo(()=>({value:(Z,ge,le)=>{var ue;ge!==((ue=s.current.get(Z))==null?void 0:ue.value)&&(s.current.set(Z,{value:ge,keywords:le}),n.current.filtered.items.set(Z,V(ge,le)),N(2,()=>{k(),D.emit()}))},item:(Z,ge)=>(r.current.add(Z),ge&&(i.current.has(ge)?i.current.get(ge).add(Z):i.current.set(ge,new Set([Z]))),N(3,()=>{H(),k(),n.current.value||U(),D.emit()}),()=>{s.current.delete(Z),r.current.delete(Z),n.current.filtered.items.delete(Z);let le=te();N(4,()=>{H(),(le==null?void 0:le.getAttribute("id"))===Z&&U(),D.emit()})}),group:Z=>(i.current.has(Z)||i.current.set(Z,new Set),()=>{s.current.delete(Z),i.current.delete(Z)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:E,inputId:C,labelId:T,listInnerRef:O}),[]);function V(Z,ge){var le,ue;let _e=(ue=(le=a.current)==null?void 0:le.filter)!=null?ue:Z$;return Z?_e(Z,n.current.search,ge):0}function k(){if(!n.current.search||a.current.shouldFilter===!1)return;let Z=n.current.filtered.items,ge=[];n.current.filtered.groups.forEach(ue=>{let _e=i.current.get(ue),Se=0;_e.forEach(qe=>{let Me=Z.get(qe);Se=Math.max(Me,Se)}),ge.push([ue,Se])});let le=O.current;he().sort((ue,_e)=>{var Se,qe;let Me=ue.getAttribute("id"),We=_e.getAttribute("id");return((Se=Z.get(We))!=null?Se:0)-((qe=Z.get(Me))!=null?qe:0)}).forEach(ue=>{let _e=ue.closest(fE);_e?_e.appendChild(ue.parentElement===_e?ue:ue.closest(`${fE} > *`)):le.appendChild(ue.parentElement===le?ue:ue.closest(`${fE} > *`))}),ge.sort((ue,_e)=>_e[1]-ue[1]).forEach(ue=>{var _e;let Se=(_e=O.current)==null?void 0:_e.querySelector(`${r0}[${Dm}="${encodeURIComponent(ue[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function U(){let Z=he().find(le=>le.getAttribute("aria-disabled")!=="true"),ge=Z==null?void 0:Z.getAttribute(Dm);D.setState("value",ge||void 0)}function H(){var Z,ge,le,ue;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let _e=0;for(let Se of r.current){let qe=(ge=(Z=s.current.get(Se))==null?void 0:Z.value)!=null?ge:"",Me=(ue=(le=s.current.get(Se))==null?void 0:le.keywords)!=null?ue:[],We=V(qe,Me);n.current.filtered.items.set(Se,We),We>0&&_e++}for(let[Se,qe]of i.current)for(let Me of qe)if(n.current.filtered.items.get(Me)>0){n.current.filtered.groups.add(Se);break}n.current.filtered.count=_e}function ne(){var Z,ge,le;let ue=te();ue&&(((Z=ue.parentElement)==null?void 0:Z.firstChild)===ue&&((le=(ge=ue.closest(r0))==null?void 0:ge.querySelector(Y$))==null||le.scrollIntoView({block:"nearest"})),ue.scrollIntoView({block:"nearest"}))}function te(){var Z;return(Z=O.current)==null?void 0:Z.querySelector(`${jF}[aria-selected="true"]`)}function he(){var Z;return Array.from(((Z=O.current)==null?void 0:Z.querySelectorAll(EI))||[])}function oe(Z){let ge=he()[Z];ge&&D.setState("value",ge.getAttribute(Dm))}function fe(Z){var ge;let le=te(),ue=he(),_e=ue.findIndex(qe=>qe===le),Se=ue[_e+Z];(ge=a.current)!=null&&ge.loop&&(Se=_e+Z<0?ue[ue.length-1]:_e+Z===ue.length?ue[0]:ue[_e+Z]),Se&&D.setState("value",Se.getAttribute(Dm))}function B(Z){let ge=te(),le=ge==null?void 0:ge.closest(r0),ue;for(;le&&!ue;)le=Z>0?o7(le,r0):a7(le,r0),ue=le==null?void 0:le.querySelector(EI);ue?D.setState("value",ue.getAttribute(Dm)):fe(Z)}let q=()=>oe(he().length-1),K=Z=>{Z.preventDefault(),Z.metaKey?q():Z.altKey?B(1):fe(1)},$=Z=>{Z.preventDefault(),Z.metaKey?oe(0):Z.altKey?B(-1):fe(-1)};return R.createElement(Vi.div,{ref:e,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:Z=>{var ge;(ge=_.onKeyDown)==null||ge.call(_,Z);let le=Z.nativeEvent.isComposing||Z.keyCode===229;if(!(Z.defaultPrevented||le))switch(Z.key){case"n":case"j":{w&&Z.ctrlKey&&K(Z);break}case"ArrowDown":{K(Z);break}case"p":case"k":{w&&Z.ctrlKey&&$(Z);break}case"ArrowUp":{$(Z);break}case"Home":{Z.preventDefault(),oe(0);break}case"End":{Z.preventDefault(),q();break}case"Enter":{Z.preventDefault();let ue=te();if(ue){let _e=new Event(zT);ue.dispatchEvent(_e)}}}}},R.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:u7},l),Y1(t,Z=>R.createElement(FF.Provider,{value:D},R.createElement(UF.Provider,{value:F},Z))))}),Q$=R.forwardRef((t,e)=>{var n,r;let i=Vc(),s=R.useRef(null),o=R.useContext(zF),a=Vy(),l=HF(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Ch(()=>{if(!c)return a.item(i,o==null?void 0:o.id)},[c]);let d=VF(i,s,[t.value,t.children,s],t.keywords),f=EP(),m=Ed(N=>N.value&&N.value===d.current),y=Ed(N=>c||a.filter()===!1?!0:N.search?N.filtered.items.get(i)>0:!0);R.useEffect(()=>{let N=s.current;if(!(!N||t.disabled))return N.addEventListener(zT,x),()=>N.removeEventListener(zT,x)},[y,t.onSelect,t.disabled]);function x(){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:_,onSelect:E,forceMount:T,keywords:C,...O}=t;return R.createElement(Vi.div,{ref:wg(s,e),...O,id:i,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!m,"data-disabled":!!w,"data-selected":!!m,onPointerMove:w||a.getDisablePointerSelection()?void 0:S,onClick:w?void 0:x},t.children)}),J$=R.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,o=Vc(),a=R.useRef(null),l=R.useRef(null),c=Vc(),d=Vy(),f=Ed(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(o):!0);Ch(()=>d.group(o),[]),VF(o,a,[t.value,t.heading,l]);let m=R.useMemo(()=>({id:o,forceMount:i}),[i]);return R.createElement(Vi.div,{ref:wg(a,e),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&R.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),Y1(t,y=>R.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},R.createElement(zF.Provider,{value:m},y))))}),e7=R.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=R.useRef(null),s=Ed(o=>!o.search);return!n&&!s?null:R.createElement(Vi.div,{ref:wg(i,e),...r,"cmdk-separator":"",role:"separator"})}),t7=R.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=EP(),o=Ed(c=>c.search),a=Ed(c=>c.selectedItemId),l=Vy();return R.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),R.createElement(Vi.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?t.value:o,onChange:c=>{i||s.setState("search",c.target.value),n==null||n(c.target.value)}})}),n7=R.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=R.useRef(null),o=R.useRef(null),a=Ed(c=>c.selectedItemId),l=Vy();return R.useEffect(()=>{if(o.current&&s.current){let c=o.current,d=s.current,f,m=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let y=c.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return m.observe(c),()=>{cancelAnimationFrame(f),m.unobserve(c)}}},[]),R.createElement(Vi.div,{ref:wg(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},Y1(t,c=>R.createElement("div",{ref:wg(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),r7=R.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=t;return R.createElement(TF,{open:n,onOpenChange:r},R.createElement(RF,{container:o},R.createElement(NF,{"cmdk-overlay":"",className:i}),R.createElement(IF,{"aria-label":t.label,"cmdk-dialog":"",className:s},R.createElement(BF,{ref:e,...a}))))}),i7=R.forwardRef((t,e)=>Ed(n=>n.filtered.count===0)?R.createElement(Vi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),s7=R.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return R.createElement(Vi.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Y1(t,o=>R.createElement("div",{"aria-hidden":!0},o)))}),im=Object.assign(BF,{List:n7,Item:Q$,Input:t7,Group:J$,Separator:e7,Dialog:r7,Empty:i7,Loading:s7});function o7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function a7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function HF(t){let e=R.useRef(t);return Ch(()=>{e.current=t}),e}var Ch=typeof window>"u"?R.useEffect:R.useLayoutEffect;function jm(t){let e=R.useRef();return e.current===void 0&&(e.current=t()),e}function Ed(t){let e=EP(),n=()=>t(e.snapshot());return R.useSyncExternalStore(e.subscribe,n,n)}function VF(t,e,n,r=[]){let i=R.useRef(),s=Vy();return Ch(()=>{var o;let a=(()=>{var c;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(c=d.current.textContent)==null?void 0:c.trim():i.current}})(),l=r.map(c=>c.trim());s.value(t,a,l),(o=e.current)==null||o.setAttribute(Dm,a),i.current=a}),i}var l7=()=>{let[t,e]=R.useState(),n=jm(()=>new Map);return Ch(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function c7(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Y1({asChild:t,children:e},n){return t&&R.isValidElement(e)?R.cloneElement(c7(e),{ref:e.ref},n(e.props.children)):n(e)}var u7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function d7({onNavigate:t}){const[e,n]=R.useState(!1);return R.useEffect(()=>{const r=i=>{(i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"&&(i.preventDefault(),n(s=>!s))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),g.jsx(im.Dialog,{open:e,onOpenChange:n,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>n(!1),children:g.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:r=>r.stopPropagation(),children:[g.jsx(im.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),g.jsxs(im.List,{className:"max-h-80 overflow-y-auto p-2",children:[g.jsx(im.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),g.jsx(im.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:DT.map(r=>g.jsxs(im.Item,{value:`${r.label} ${r.hint}`,onSelect:()=>{t(r.id),n(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[g.jsx(r.icon,{className:"h-4 w-4 text-primary"}),g.jsx("span",{children:r.label}),g.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:r.hint})]},r.id))})]})]})})}async function Ft(t,e){var l;const n={"Content-Type":"application/json",...e==null?void 0:e.headers},r=localStorage.getItem("mc_sudo_password"),i=localStorage.getItem("mc_hf_token");r&&(n["X-Sudo-Password"]=r);let s=e==null?void 0:e.body;if((((l=e==null?void 0:e.method)==null?void 0:l.toUpperCase())||"GET")==="POST"){if(typeof s=="string")try{const c=JSON.parse(s);let d=!1;r&&!("sudo_password"in c)&&(c.sudo_password=r,d=!0),i&&!("hf_token"in c)&&(c.hf_token=i,d=!0),d&&(s=JSON.stringify(c))}catch{}else if(!s){const c={};r&&(c.sudo_password=r),i&&(c.hf_token=i),Object.keys(c).length>0&&(s=JSON.stringify(c))}}const a=await fetch(t,{...e,headers:n,body:s});if(!a.ok)throw new Error(`${a.status} ${a.statusText}`);return a.json()}const Lr={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:t=>["drafts",t??""],connect:t=>["connect",t??""],connectHealth:["connect-health"],memory:(t,e)=>["memory",t??"",e??""],memoryGraph:["memory-graph"]},f7=(t=!0)=>ls({queryKey:Lr.memoryGraph,queryFn:()=>Ft("/api/memory/graph"),enabled:t}),h7=()=>ls({queryKey:Lr.health,queryFn:()=>Ft("/api/health"),refetchInterval:1e4}),Z1=(t=5e3)=>ls({queryKey:Lr.systemStatus,queryFn:()=>Ft("/api/system/status"),refetchInterval:t}),p7=(t=3e3)=>ls({queryKey:Lr.services,queryFn:()=>Ft("/api/system/services"),refetchInterval:t}),qh=(t=4e3)=>ls({queryKey:Lr.models,queryFn:()=>Ft("/api/models"),refetchInterval:t}),m7=(t=4e3)=>ls({queryKey:Lr.routing,queryFn:()=>Ft("/api/routing"),refetchInterval:t}),g7=(t=2e3)=>ls({queryKey:Lr.jobs,queryFn:()=>Ft("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),AP=(t=3e3)=>ls({queryKey:Lr.tokenStats,queryFn:()=>Ft("/api/system/token-stats"),refetchInterval:t}),TP=(t=5e3)=>ls({queryKey:Lr.agentStatus,queryFn:()=>Ft("/api/agent/status"),refetchInterval:t}),v7=(t=6e4)=>ls({queryKey:Lr.hermesBrain,queryFn:()=>Ft("/api/agent/brain"),refetchInterval:t}),CP=t=>ls({queryKey:Lr.updates,queryFn:()=>Ft("/api/maintenance/updates"),refetchInterval:t}),y7=()=>ls({queryKey:Lr.discover,queryFn:()=>Ft("/api/discover")}),x7=t=>ls({queryKey:Lr.drafts(t),queryFn:()=>Ft(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),GF=t=>ls({queryKey:Lr.connect(t),queryFn:()=>Ft(t?`/api/connect?${t}`:"/api/connect")}),b7=()=>ls({queryKey:Lr.connectHealth,queryFn:()=>Ft("/api/connect/health"),refetchInterval:15e3}),BT=t=>ls({queryKey:Lr.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),Ft(`/api/memory?${e}`)},select:e=>t!=null&&t.limit?e.slice(0,t.limit):e});function sm(t){return(t/1024**3).toFixed(1)}function HT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Bo(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function _7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function AI(t){return t?`${Math.round(t/1024)}k`:"—"}function WF(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=M7(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(PP);return a[0]===""&&a.length!==1&&a.shift(),$F(a,e)||S7(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},$F=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?$F(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(PP);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},TI=/^\[(.+)\]$/,S7=t=>{if(TI.test(t)){const e=TI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},M7=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return A7(Object.entries(t.classGroups),n).forEach(([s,o])=>{VT(o,r,s,e)}),r},VT=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:CI(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(E7(i)){VT(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{VT(o,CI(e,s),n,r)})})},CI=(t,e)=>{let n=t;return e.split(PP).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},E7=t=>t.isThemeGetter,A7=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[n,i]}):t,T7=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},XF="!",C7=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=a=>{const l=[];let c=0,d=0,f;for(let w=0;wd?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:S}};return n?a=>n({className:a,parseClassName:o}):o},P7=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},R7=t=>({cache:T7(t.cacheSize),parseClassName:C7(t),...w7(t)}),N7=/\s+/,I7=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(N7);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:y}=n(c);let x=!!y,S=r(x?m.substring(0,y):m);if(!S){if(!x){a=c+(a.length>0?" "+a:a);continue}if(S=r(m),!S){a=c+(a.length>0?" "+a:a);continue}x=!1}const w=P7(d).join(":"),_=f?w+XF:w,E=_+S;if(s.includes(E))continue;s.push(E);const T=i(S,x);for(let C=0;C0?" "+a:a)}return a};function k7(){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=R7(c),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=I7(l,n);return i(l,d),d}return function(){return s(k7.apply(null,arguments))}}const rr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},KF=/^\[(?:([a-z-]+):)?(.+)\]$/i,L7=/^\d+\/\d+$/,D7=new Set(["px","full","screen"]),j7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,U7=/\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$/,F7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,z7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,B7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sc=t=>Jm(t)||D7.has(t)||L7.test(t),Gu=t=>Hg(t,"length",K7),Jm=t=>!!t&&!Number.isNaN(Number(t)),hE=t=>Hg(t,"number",Jm),i0=t=>!!t&&Number.isInteger(Number(t)),H7=t=>t.endsWith("%")&&Jm(t.slice(0,-1)),fn=t=>KF.test(t),Wu=t=>j7.test(t),V7=new Set(["length","size","percentage"]),G7=t=>Hg(t,V7,YF),W7=t=>Hg(t,"position",YF),$7=new Set(["image","url"]),X7=t=>Hg(t,$7,Z7),q7=t=>Hg(t,"",Y7),s0=()=>!0,Hg=(t,e,n)=>{const r=KF.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},K7=t=>U7.test(t)&&!F7.test(t),YF=()=>!1,Y7=t=>z7.test(t),Z7=t=>B7.test(t),Q7=()=>{const t=rr("colors"),e=rr("spacing"),n=rr("blur"),r=rr("brightness"),i=rr("borderColor"),s=rr("borderRadius"),o=rr("borderSpacing"),a=rr("borderWidth"),l=rr("contrast"),c=rr("grayscale"),d=rr("hueRotate"),f=rr("invert"),m=rr("gap"),y=rr("gradientColorStops"),x=rr("gradientColorStopPositions"),S=rr("inset"),w=rr("margin"),_=rr("opacity"),E=rr("padding"),T=rr("saturate"),C=rr("scale"),O=rr("sepia"),N=rr("skew"),D=rr("space"),F=rr("translate"),V=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",fn,e],H=()=>[fn,e],ne=()=>["",Sc,Gu],te=()=>["auto",Jm,fn],he=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],oe=()=>["solid","dashed","dotted","double","none"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],q=()=>["","0",fn],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[Jm,fn];return{cacheSize:500,separator:":",theme:{colors:[s0],spacing:[Sc,Gu],blur:["none","",Wu,fn],brightness:$(),borderColor:[t],borderRadius:["none","","full",Wu,fn],borderSpacing:H(),borderWidth:ne(),contrast:$(),grayscale:q(),hueRotate:$(),invert:q(),gap:H(),gradientColorStops:[t],gradientColorStopPositions:[H7,Gu],inset:U(),margin:U(),opacity:$(),padding:H(),saturate:$(),scale:$(),sepia:q(),skew:$(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",fn]}],container:["container"],columns:[{columns:[Wu]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...he(),fn]}],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",i0,fn]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",fn]}],grow:[{grow:q()}],shrink:[{shrink:q()}],order:[{order:["first","last","none",i0,fn]}],"grid-cols":[{"grid-cols":[s0]}],"col-start-end":[{col:["auto",{span:["full",i0,fn]},fn]}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":[s0]}],"row-start-end":[{row:["auto",{span:[i0,fn]},fn]}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",fn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",fn]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[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",fn,e]}],"min-w":[{"min-w":[fn,e,"min","max","fit"]}],"max-w":[{"max-w":[fn,e,"none","full","min","max","fit","prose",{screen:[Wu]},Wu]}],h:[{h:[fn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[fn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Wu,Gu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",hE]}],"font-family":[{font:[s0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",fn]}],"line-clamp":[{"line-clamp":["none",Jm,hE]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Sc,fn]}],"list-image":[{"list-image":["none",fn]}],"list-style-type":[{list:["none","disc","decimal",fn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Sc,Gu]}],"underline-offset":[{"underline-offset":["auto",Sc,fn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fn]}],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",fn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...he(),W7]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",G7]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},X7]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...oe(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:oe()}],"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:["",...oe()]}],"outline-offset":[{"outline-offset":[Sc,fn]}],"outline-w":[{outline:[Sc,Gu]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Sc,Gu]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Wu,q7]}],"shadow-color":[{shadow:[s0]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...fe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":fe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wu,fn]}],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":[_]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",fn]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",fn]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",fn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[i0,fn]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",fn]}],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",fn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Sc,Gu,hE]}],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"]}}},J7=O7(Q7);function tt(...t){return J7(er(t))}function Mg(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const ZF=["fast","heavy","coder","vision","scout"],eX={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"},RP=t=>t&&eX[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function tX({fit:t}){const e={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[t.level];return g.jsxs("span",{className:tt("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",e),children:[t.text," • ",t.req_gb," GB RAM"]})}function PI(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 nX(){const{data:t}=qh(2e3),{data:e}=AP(2e3),n=(t==null?void 0:t.models)??[],r=(t==null?void 0:t.running)??[],i=n.filter(l=>r.includes(l.name)),s=R.useRef(null),[o,a]=R.useState(!1);return R.useEffect(()=>{if(!e)return;const l=e.total_tokens;if(s.current!==null&&l>s.current){a(!0);const c=setTimeout(()=>a(!1),4e3);return s.current=l,()=>clearTimeout(c)}s.current=l},[e==null?void 0:e.total_tokens]),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"flex items-center justify-between mb-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(sy,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),g.jsxs("span",{className:tt("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",o?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[o?g.jsx(xh,{className:"h-3 w-3 animate-pulse"}):g.jsx(W8,{className:"h-3 w-3"}),o?"Inferenz aktiv":"Idle"]})]}),i.length===0?g.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):g.jsx("div",{className:"grid gap-2",children:i.map(l=>{var c;return g.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.role&&g.jsx("span",{className:tt("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",RP(l.role)),children:l.role}),g.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(c=l.name.split("/").pop())==null?void 0:c.replace(/\.gguf$/i,"")})]}),g.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[Bo(l.size_bytes)," im Unified-RAM"]})]}),g.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[g.jsx("span",{className:tt("h-1.5 w-1.5 rounded-full bg-emerald-500",o&&"animate-pulse")})," warm"]})]},l.name)})})]})}let GT=[],WT=[];const $T=new Set,QF=()=>$T.forEach(t=>t());function JF(t){return $T.add(t),()=>{$T.delete(t)}}function rX(t){GT=[...GT,t].slice(-40),QF()}function iX(t){WT=[...WT,t].slice(-40),QF()}const sX=()=>R.useSyncExternalStore(JF,()=>GT),oX=()=>R.useSyncExternalStore(JF,()=>WT);function aX(){const{data:t,dataUpdatedAt:e}=Z1(3e3),{data:n,dataUpdatedAt:r}=AP(3e3),i=R.useRef(null);R.useEffect(()=>{var s,o,a,l;t&&rX({t:Date.now(),cpu:((s=t.cpu)==null?void 0:s.percent)??0,ram:((o=t.ram)==null?void 0:o.percent)??0,gpu:((a=t.gpu)==null?void 0:a.busy_percent)??null,disk:((l=t.disk)==null?void 0:l.percent)??null})},[e]),R.useEffect(()=>{if(!n)return;const s=Date.now(),o=n.prompt_tokens,a=n.completion_tokens;if(i.current){const l=Math.max((s-i.current.t)/1e3,.001);iX({t:s,prompt:Math.max(0,(o-i.current.p)/l),completion:Math.max(0,(a-i.current.c)/l)})}i.current={p:o,c:a,t:s}},[r])}function lX(){const{data:t,error:e}=Z1(3e3),n=sX();return{sys:t,hist:n,error:e}}var cX=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function NP(t){if(typeof t!="string")return!1;var e=cX;return e.includes(t)}var uX=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],dX=new Set(uX);function e5(t){return typeof t!="string"?!1:dX.has(t)}function t5(t){return typeof t=="string"&&t.startsWith("data-")}function za(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e5(n)||t5(n))&&(e[n]=t[n]);return e}function Q1(t){if(t==null)return null;if(R.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return za(e)}return typeof t=="object"&&!Array.isArray(t)?za(t):null}function Ko(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e5(n)||t5(n)||NP(n))&&(e[n]=t[n]);return e}function fX(t){return t==null?null:R.isValidElement(t)?Ko(t.props):typeof t=="object"&&!Array.isArray(t)?Ko(t):null}var hX=["children","width","height","viewBox","className","style","title","desc"];function XT(){return XT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.width,i=t.height,s=t.viewBox,o=t.className,a=t.style,l=t.title,c=t.desc,d=pX(t,hX),f=s||{width:r,height:i,x:0,y:0},m=er("recharts-surface",o);return R.createElement("svg",XT({},Ko(d),{className:m,width:r,height:i,style:a,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),R.createElement("title",null,l),R.createElement("desc",null,c),n)}),gX=["children","className"];function qT(){return qT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.className,i=vX(t,gX),s=er("recharts-layer",r);return R.createElement("g",qT({className:s},Ko(i),{ref:e}),n)}),xX=R.createContext(null);function Mr(t){return function(){return t}}const KT=Math.PI,YT=2*KT,Gf=1e-6,bX=YT-Gf;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;iGf)if(!(Math.abs(f*l-c*d)>Gf)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let y=r-o,x=i-a,S=l*l+c*c,w=y*y+x*x,_=Math.sqrt(S),E=Math.sqrt(m),T=s*Math.tan((KT-Math.acos((S+m-w)/(2*_*E)))/2),C=T/E,O=T/_;Math.abs(C-1)>Gf&&this._append`L${e+C*d},${n+C*f}`,this._append`A${s},${s},0,0,${+(f*y>d*x)},${this._x1=e+O*l},${this._y1=n+O*c}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),l=r*Math.sin(i),c=e+a,d=n+l,f=1^o,m=o?i-s:s-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Gf||Math.abs(this._y1-d)>Gf)&&this._append`L${c},${d}`,r&&(m<0&&(m=m%YT+YT),m>bX?this._append`A${r},${r},0,1,${f},${e-a},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=d}`:m>Gf&&this._append`A${r},${r},0,${+(m>=KT)},${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 wX(e)}function IP(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 o5(t){return t[0]}function a5(t){return t[1]}function l5(t,e){var n=Mr(!0),r=null,i=J1,s=null,o=i5(a);t=typeof t=="function"?t:t===void 0?o5:Mr(t),e=typeof e=="function"?e:e===void 0?a5:Mr(e);function a(l){var c,d=(l=IP(l)).length,f,m=!1,y;for(r==null&&(s=i(y=o())),c=0;c<=d;++c)!(c=y;--x)a.point(T[x],C[x]);a.lineEnd(),a.areaEnd()}_&&(T[m]=+t(w,m,f),C[m]=+e(w,m,f),a.point(r?+r(w,m,f):T[m],n?+n(w,m,f):C[m]))}if(E)return a=null,E+""||null}function d(){return l5().defined(i).curve(o).context(s)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:Mr(+f),r=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Mr(+f),c):t},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Mr(+f),c):r},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:Mr(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Mr(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Mr(+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:Mr(!!f),c):i},c.curve=function(f){return arguments.length?(o=f,s!=null&&(a=o(s)),c):o},c.context=function(f){return arguments.length?(f==null?s=a=null:a=o(s=f),c):s},c}class 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 SX(t){return new c5(t,!0)}function MX(t){return new c5(t,!1)}function iw(){}function sw(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:sw(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:sw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function EX(t){return new u5(t)}function d5(t){this._context=t}d5.prototype={areaStart:iw,areaEnd:iw,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:sw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function AX(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:sw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function TX(t){return new f5(t)}function h5(t){this._context=t}h5.prototype={areaStart:iw,areaEnd:iw,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 CX(t){return new h5(t)}function RI(t){return t<0?-1:1}function NI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),a=(s*i+o*r)/(r+i);return(RI(s)+RI(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function II(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function pE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-r)/3;t._context.bezierCurveTo(r+a,i+a*e,s-a,o-a*n,s,o)}function 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:pE(this,this._t0,II(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,pE(this,II(this,n=NI(this,t,e)),n);break;default:pE(this,this._t0,n=NI(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 PX(t){return new ow(t)}function RX(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=kI(t),i=kI(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function IX(t){return new eS(t,.5)}function kX(t){return new eS(t,0)}function OX(t){return new eS(t,1)}function Ph(t,e){if((o=t.length)>1)for(var n=1,r,i,s=t[e[0]],o,a=s.length;n=0;)n[e]=e;return n}function LX(t,e){return t[e]}function DX(t){const e=[];return e.key=t,e}function jX(){var t=Mr([]),e=ZT,n=Ph,r=LX;function i(s){var o=Array.from(t.apply(this,arguments),DX),a,l=o.length,c=-1,d;for(const f of s)for(a=0,++c;a0){for(var n,r,i=0,s=t[0].length,o;i0){for(var n=0,r=t[e[0]],i,s=r.length;n0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:HX,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function Di(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{var a=n[o-1];return typeof a=="string"?i+a+s:a!==void 0?i+xd(a)+s:i+s},"")}var Wo=t=>t===0?0:t>0?1:-1,kl=t=>typeof t=="number"&&t!=+t,Rh=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,kt=t=>(typeof t=="number"||t instanceof Number)&&!kl(t),Ol=t=>kt(t)||typeof t=="string",VX=0,ly=t=>{var e=++VX;return"".concat(t||"").concat(e)},Ad=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!kt(e)&&typeof e!="string")return r;var s;if(Rh(e)){if(n==null)return r;var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return kl(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},x5=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;rr&&(typeof e=="function"?e(r):Kh(r,e))===n)}var Hi=t=>t===null||typeof t>"u",LP=t=>Hi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Ys(t){return t!=null}function Vg(){}var _5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,DP=(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=>{NP(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},GX=(t,e,n)=>r=>(t(e,n,r),null),WX=(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];NP(i)&&typeof s=="function"&&(r||(r={}),r[i]=GX(s,e,n))}),r};function OI(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 $X(t){for(var e=1;e(o[a]===void 0&&r[a]!==void 0&&(o[a]=r[a]),o),n);return s}function YX(t,e){const n=new Map;for(let r=0;rObject.prototype.propertyIsEnumerable.call(t,e))}function jP(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const tq="[object RegExp]",S5="[object String]",M5="[object Number]",E5="[object Boolean]",A5="[object Arguments]",nq="[object Symbol]",rq="[object Date]",iq="[object Map]",sq="[object Set]",oq="[object Array]",aq="[object ArrayBuffer]",lq="[object Object]",cq="[object DataView]",uq="[object Uint8Array]",dq="[object Uint8ClampedArray]",fq="[object Uint16Array]",hq="[object Uint32Array]",pq="[object Int8Array]",mq="[object Int16Array]",gq="[object Int32Array]",vq="[object Float32Array]",yq="[object Float64Array]",LI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function xq(t){return typeof LI.Buffer<"u"&&LI.Buffer.isBuffer(t)}function bq(t,e){return Jf(t,void 0,t,new Map,e)}function Jf(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(JT(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const o=new Array(t.length);r.set(t,o);for(let a=0;a{}):eC(t,e,function r(i,s,o,a,l,c){const d=n(i,s,o,a,l,c);return d!==void 0?!!d:eC(i,s,r,c,!1)},new Map,!0)}function eC(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return Sq(t,e,n,r);case"function":return Object.keys(e).length>0?eC(t,{...e},n,r,i):U_(t,e);default:return T5(t)&&i?typeof e=="string"?e==="":!0:U_(t,e)}}function Sq(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return P5(t,e,n,r);if(e instanceof Map)return Mq(t,e,n,r);if(e instanceof Set)return Eq(t,e,n,r);const i=Object.keys(e);if(t==null||JT(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 Aq(t){return t=wq(t),e=>R5(e,t)}function Tq(t,e){return bq(t,(n,r,i,s)=>{if(typeof t=="object"){if(jP(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),ka(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case M5:case S5:case E5:{const o=new t.constructor(t==null?void 0:t.valueOf());return ka(o,t),o}case A5:{const o={};return ka(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function Cq(t){return Tq(t)}const Pq=/^(?: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"&&Oq(t.length)}function Lq(t){return typeof t=="object"&&t!==null}function Dq(t){return Lq(t)&&I5(t)}function DI(t,e=w5){return Dq(t)?YX(Array.from(t),ZX(kq(e),1)):[]}function jq(t,e,n){return e===!0?DI(t,n):typeof e=="function"?DI(t,e):t}var mE={exports:{}},gE={},vE={exports:{}},yE={};/** +`)},k$=0,nm=[];function O$(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(k$++)[0],s=R.useState(_F)[0],o=R.useRef(t);R.useEffect(function(){o.current=t},[t]),R.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=t$([t.lockRef.current],(t.shards||[]).map(AI),!0).filter(Boolean);return S.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=R.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!o.current.allowPinchZoom;var _=yb(S),E=n.current,T="deltaX"in S?S.deltaX:E[0]-_[0],C="deltaY"in S?S.deltaY:E[1]-_[1],O,N=S.target,D=Math.abs(T)>Math.abs(C)?"h":"v";if("touches"in S&&D==="h"&&N.type==="range")return!1;var F=window.getSelection(),G=F&&F.anchorNode,k=G?G===N||G.contains(N):!1;if(k)return!1;var U=MI(D,N);if(!U)return!0;if(U?O=D:(O=D==="v"?"h":"v",U=MI(D,N)),!U)return!1;if(!r.current&&"changedTouches"in S&&(T||C)&&(r.current=O),!O)return!0;var H=r.current||O;return R$(H,w,S,H==="h"?T:C)},[]),l=R.useCallback(function(S){var w=S;if(!(!nm.length||nm[nm.length-1]!==s)){var _="deltaY"in w?EI(w):yb(w),E=e.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&N$(O.delta,_)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var T=(o.current.shards||[]).map(AI).filter(Boolean).filter(function(O){return O.contains(w.target)}),C=T.length>0?a(w,T[0]):!o.current.noIsolation;C&&w.cancelable&&w.preventDefault()}}},[]),c=R.useCallback(function(S,w,_,E){var T={name:S,delta:w,target:_,should:E,shadowParent:L$(_)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(C){return C!==T})},1)},[]),d=R.useCallback(function(S){n.current=yb(S),r.current=void 0},[]),f=R.useCallback(function(S){c(S.type,EI(S),S.target,a(S,t.lockRef.current))},[]),m=R.useCallback(function(S){c(S.type,yb(S),S.target,a(S,t.lockRef.current))},[]);R.useEffect(function(){return nm.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,tm),document.addEventListener("touchmove",l,tm),document.addEventListener("touchstart",d,tm),function(){nm=nm.filter(function(S){return S!==s}),document.removeEventListener("wheel",l,tm),document.removeEventListener("touchmove",l,tm),document.removeEventListener("touchstart",d,tm)}},[]);var y=t.removeScrollBar,x=t.inert;return R.createElement(R.Fragment,null,x?R.createElement(s,{styles:I$(i)}):null,y?R.createElement(S$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function L$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const D$=u$(bF,O$);var EF=R.forwardRef(function(t,e){return R.createElement(K1,_l({},t,{ref:e,sideCar:D$}))});EF.classNames=K1.classNames;var j$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rm=new WeakMap,xb=new WeakMap,bb={},fE=0,AF=function(t){return t&&(t.host||AF(t.parentNode))},U$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=AF(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},F$=function(t,e,n,r){var i=U$(e,Array.isArray(t)?t:[t]);bb[n]||(bb[n]=new WeakMap);var s=bb[n],o=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))d(m);else try{var y=m.getAttribute(r),x=y!==null&&y!=="false",S=(rm.get(m)||0)+1,w=(s.get(m)||0)+1;rm.set(m,S),s.set(m,w),o.push(m),S===1&&x&&xb.set(m,!0),w===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(_){console.error("aria-hidden: cannot operate on ",m,_)}})};return d(e),a.clear(),fE++,function(){o.forEach(function(f){var m=rm.get(f)-1,y=s.get(f)-1;rm.set(f,m),s.set(f,y),m||(xb.has(f)||f.removeAttribute(r),xb.delete(f)),y||f.removeAttribute(n)}),fE--,fE||(rm=new WeakMap,rm=new WeakMap,xb=new WeakMap,bb={})}},z$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=j$(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),F$(r,i,n,"aria-hidden")):function(){return null}},Y1="Dialog",[TF]=p9(Y1),[B$,Wa]=TF(Y1),CF=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=R.useRef(null),l=R.useRef(null),[c,d]=x9({prop:r,defaultProp:i??!1,onChange:s,caller:Y1});return g.jsx(B$,{scope:e,triggerRef:a,contentRef:l,contentId:Vc(),titleId:Vc(),descriptionId:Vc(),open:c,onOpenChange:d,onOpenToggle:R.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};CF.displayName=Y1;var PF="DialogTrigger",H$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(PF,n),s=Xh(e,i.triggerRef);return g.jsx(Vi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":EP(i.open),...r,ref:s,onClick:_d(t.onClick,i.onOpenToggle)})});H$.displayName=PF;var MP="DialogPortal",[V$,RF]=TF(MP,{forceMount:void 0}),NF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Wa(MP,e);return g.jsx(V$,{scope:e,forceMount:n,children:R.Children.map(r,o=>g.jsx(q1,{present:n||s.open,children:g.jsx(vF,{asChild:!0,container:i,children:o})}))})};NF.displayName=MP;var iw="DialogOverlay",IF=R.forwardRef((t,e)=>{const n=RF(iw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wa(iw,t.__scopeDialog);return s.modal?g.jsx(q1,{present:r||s.open,children:g.jsx(W$,{...i,ref:e})}):null});IF.displayName=iw;var G$=fF("DialogOverlay.RemoveScroll"),W$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(iw,n),s=F9(),o=Xh(e,s);return g.jsx(EF,{as:G$,allowPinchZoom:!0,shards:[i.contentRef],children:g.jsx(Vi.div,{"data-state":EP(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),Sg="DialogContent",kF=R.forwardRef((t,e)=>{const n=RF(Sg,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Wa(Sg,t.__scopeDialog);return g.jsx(q1,{present:r||s.open,children:s.modal?g.jsx($$,{...i,ref:e}):g.jsx(X$,{...i,ref:e})})});kF.displayName=Sg;var $$=R.forwardRef((t,e)=>{const n=Wa(Sg,t.__scopeDialog),r=R.useRef(null),i=Xh(e,n.contentRef,r);return R.useEffect(()=>{const s=r.current;if(s)return z$(s)},[]),g.jsx(OF,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_d(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:_d(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:_d(t.onFocusOutside,s=>s.preventDefault())})}),X$=R.forwardRef((t,e)=>{const n=Wa(Sg,t.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return g.jsx(OF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),OF=R.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Wa(Sg,n);return e$(),g.jsx(g.Fragment,{children:g.jsx(mF,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:g.jsx(hF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":EP(a.open),...o,ref:e,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),LF="DialogTitle",q$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(LF,n);return g.jsx(Vi.h2,{id:i.titleId,...r,ref:e})});q$.displayName=LF;var DF="DialogDescription",K$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(DF,n);return g.jsx(Vi.p,{id:i.descriptionId,...r,ref:e})});K$.displayName=DF;var jF="DialogClose",Y$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Wa(jF,n);return g.jsx(Vi.button,{type:"button",...r,ref:e,onClick:_d(t.onClick,()=>i.onOpenChange(!1))})});Y$.displayName=jF;function EP(t){return t?"open":"closed"}var r0='[cmdk-group=""]',hE='[cmdk-group-items=""]',Z$='[cmdk-group-heading=""]',UF='[cmdk-item=""]',TI=`${UF}:not([aria-disabled="true"])`,BT="cmdk-item-select",Dm="data-value",Q$=(t,e,n)=>h9(t,e,n),FF=R.createContext(void 0),Wy=()=>R.useContext(FF),zF=R.createContext(void 0),AP=()=>R.useContext(zF),BF=R.createContext(void 0),HF=R.forwardRef((t,e)=>{let n=jm(()=>{var q,pe;return{search:"",value:(pe=(q=t.value)!=null?q:t.defaultValue)!=null?pe:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=jm(()=>new Set),i=jm(()=>new Map),s=jm(()=>new Map),o=jm(()=>new Set),a=VF(t),{label:l,children:c,value:d,onValueChange:f,filter:m,shouldFilter:y,loop:x,disablePointerSelection:S=!1,vimBindings:w=!0,..._}=t,E=Vc(),T=Vc(),C=Vc(),O=R.useRef(null),N=c7();Ch(()=>{if(d!==void 0){let q=d.trim();n.current.value=q,D.emit()}},[d]),Ch(()=>{N(6,ne)},[]);let D=R.useMemo(()=>({subscribe:q=>(o.current.add(q),()=>o.current.delete(q)),snapshot:()=>n.current,setState:(q,pe,ae)=>{var le,be,Se,qe;if(!Object.is(n.current[q],pe)){if(n.current[q]=pe,q==="search")H(),k(),N(1,U);else if(q==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Me=document.getElementById(C);Me?Me.focus():(le=document.getElementById(E))==null||le.focus()}if(N(7,()=>{var Me;n.current.selectedItemId=(Me=te())==null?void 0:Me.id,D.emit()}),ae||N(5,ne),((be=a.current)==null?void 0:be.value)!==void 0){let Me=pe??"";(qe=(Se=a.current).onValueChange)==null||qe.call(Se,Me);return}}D.emit()}},emit:()=>{o.current.forEach(q=>q())}}),[]),F=R.useMemo(()=>({value:(q,pe,ae)=>{var le;pe!==((le=s.current.get(q))==null?void 0:le.value)&&(s.current.set(q,{value:pe,keywords:ae}),n.current.filtered.items.set(q,G(pe,ae)),N(2,()=>{k(),D.emit()}))},item:(q,pe)=>(r.current.add(q),pe&&(i.current.has(pe)?i.current.get(pe).add(q):i.current.set(pe,new Set([q]))),N(3,()=>{H(),k(),n.current.value||U(),D.emit()}),()=>{s.current.delete(q),r.current.delete(q),n.current.filtered.items.delete(q);let ae=te();N(4,()=>{H(),(ae==null?void 0:ae.getAttribute("id"))===q&&U(),D.emit()})}),group:q=>(i.current.has(q)||i.current.set(q,new Set),()=>{s.current.delete(q),i.current.delete(q)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:E,inputId:C,labelId:T,listInnerRef:O}),[]);function G(q,pe){var ae,le;let be=(le=(ae=a.current)==null?void 0:ae.filter)!=null?le:Q$;return q?be(q,n.current.search,pe):0}function k(){if(!n.current.search||a.current.shouldFilter===!1)return;let q=n.current.filtered.items,pe=[];n.current.filtered.groups.forEach(le=>{let be=i.current.get(le),Se=0;be.forEach(qe=>{let Me=q.get(qe);Se=Math.max(Me,Se)}),pe.push([le,Se])});let ae=O.current;he().sort((le,be)=>{var Se,qe;let Me=le.getAttribute("id"),$e=be.getAttribute("id");return((Se=q.get($e))!=null?Se:0)-((qe=q.get(Me))!=null?qe:0)}).forEach(le=>{let be=le.closest(hE);be?be.appendChild(le.parentElement===be?le:le.closest(`${hE} > *`)):ae.appendChild(le.parentElement===ae?le:le.closest(`${hE} > *`))}),pe.sort((le,be)=>be[1]-le[1]).forEach(le=>{var be;let Se=(be=O.current)==null?void 0:be.querySelector(`${r0}[${Dm}="${encodeURIComponent(le[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function U(){let q=he().find(ae=>ae.getAttribute("aria-disabled")!=="true"),pe=q==null?void 0:q.getAttribute(Dm);D.setState("value",pe||void 0)}function H(){var q,pe,ae,le;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let be=0;for(let Se of r.current){let qe=(pe=(q=s.current.get(Se))==null?void 0:q.value)!=null?pe:"",Me=(le=(ae=s.current.get(Se))==null?void 0:ae.keywords)!=null?le:[],$e=G(qe,Me);n.current.filtered.items.set(Se,$e),$e>0&&be++}for(let[Se,qe]of i.current)for(let Me of qe)if(n.current.filtered.items.get(Me)>0){n.current.filtered.groups.add(Se);break}n.current.filtered.count=be}function ne(){var q,pe,ae;let le=te();le&&(((q=le.parentElement)==null?void 0:q.firstChild)===le&&((ae=(pe=le.closest(r0))==null?void 0:pe.querySelector(Z$))==null||ae.scrollIntoView({block:"nearest"})),le.scrollIntoView({block:"nearest"}))}function te(){var q;return(q=O.current)==null?void 0:q.querySelector(`${UF}[aria-selected="true"]`)}function he(){var q;return Array.from(((q=O.current)==null?void 0:q.querySelectorAll(TI))||[])}function se(q){let pe=he()[q];pe&&D.setState("value",pe.getAttribute(Dm))}function fe(q){var pe;let ae=te(),le=he(),be=le.findIndex(qe=>qe===ae),Se=le[be+q];(pe=a.current)!=null&&pe.loop&&(Se=be+q<0?le[le.length-1]:be+q===le.length?le[0]:le[be+q]),Se&&D.setState("value",Se.getAttribute(Dm))}function B(q){let pe=te(),ae=pe==null?void 0:pe.closest(r0),le;for(;ae&&!le;)ae=q>0?a7(ae,r0):l7(ae,r0),le=ae==null?void 0:ae.querySelector(TI);le?D.setState("value",le.getAttribute(Dm)):fe(q)}let J=()=>se(he().length-1),Y=q=>{q.preventDefault(),q.metaKey?J():q.altKey?B(1):fe(1)},V=q=>{q.preventDefault(),q.metaKey?se(0):q.altKey?B(-1):fe(-1)};return R.createElement(Vi.div,{ref:e,tabIndex:-1,..._,"cmdk-root":"",onKeyDown:q=>{var pe;(pe=_.onKeyDown)==null||pe.call(_,q);let ae=q.nativeEvent.isComposing||q.keyCode===229;if(!(q.defaultPrevented||ae))switch(q.key){case"n":case"j":{w&&q.ctrlKey&&Y(q);break}case"ArrowDown":{Y(q);break}case"p":case"k":{w&&q.ctrlKey&&V(q);break}case"ArrowUp":{V(q);break}case"Home":{q.preventDefault(),se(0);break}case"End":{q.preventDefault(),J();break}case"Enter":{q.preventDefault();let le=te();if(le){let be=new Event(BT);le.dispatchEvent(be)}}}}},R.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:d7},l),Z1(t,q=>R.createElement(zF.Provider,{value:D},R.createElement(FF.Provider,{value:F},q))))}),J$=R.forwardRef((t,e)=>{var n,r;let i=Vc(),s=R.useRef(null),o=R.useContext(BF),a=Wy(),l=VF(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Ch(()=>{if(!c)return a.item(i,o==null?void 0:o.id)},[c]);let d=GF(i,s,[t.value,t.children,s],t.keywords),f=AP(),m=Ed(N=>N.value&&N.value===d.current),y=Ed(N=>c||a.filter()===!1?!0:N.search?N.filtered.items.get(i)>0:!0);R.useEffect(()=>{let N=s.current;if(!(!N||t.disabled))return N.addEventListener(BT,x),()=>N.removeEventListener(BT,x)},[y,t.onSelect,t.disabled]);function x(){var N,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:_,onSelect:E,forceMount:T,keywords:C,...O}=t;return R.createElement(Vi.div,{ref:wg(s,e),...O,id:i,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!m,"data-disabled":!!w,"data-selected":!!m,onPointerMove:w||a.getDisablePointerSelection()?void 0:S,onClick:w?void 0:x},t.children)}),e7=R.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,o=Vc(),a=R.useRef(null),l=R.useRef(null),c=Vc(),d=Wy(),f=Ed(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(o):!0);Ch(()=>d.group(o),[]),GF(o,a,[t.value,t.heading,l]);let m=R.useMemo(()=>({id:o,forceMount:i}),[i]);return R.createElement(Vi.div,{ref:wg(a,e),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&R.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),Z1(t,y=>R.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},R.createElement(BF.Provider,{value:m},y))))}),t7=R.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=R.useRef(null),s=Ed(o=>!o.search);return!n&&!s?null:R.createElement(Vi.div,{ref:wg(i,e),...r,"cmdk-separator":"",role:"separator"})}),n7=R.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=AP(),o=Ed(c=>c.search),a=Ed(c=>c.selectedItemId),l=Wy();return R.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),R.createElement(Vi.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?t.value:o,onChange:c=>{i||s.setState("search",c.target.value),n==null||n(c.target.value)}})}),r7=R.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=R.useRef(null),o=R.useRef(null),a=Ed(c=>c.selectedItemId),l=Wy();return R.useEffect(()=>{if(o.current&&s.current){let c=o.current,d=s.current,f,m=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let y=c.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return m.observe(c),()=>{cancelAnimationFrame(f),m.unobserve(c)}}},[]),R.createElement(Vi.div,{ref:wg(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},Z1(t,c=>R.createElement("div",{ref:wg(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),i7=R.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=t;return R.createElement(CF,{open:n,onOpenChange:r},R.createElement(NF,{container:o},R.createElement(IF,{"cmdk-overlay":"",className:i}),R.createElement(kF,{"aria-label":t.label,"cmdk-dialog":"",className:s},R.createElement(HF,{ref:e,...a}))))}),s7=R.forwardRef((t,e)=>Ed(n=>n.filtered.count===0)?R.createElement(Vi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),o7=R.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return R.createElement(Vi.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},Z1(t,o=>R.createElement("div",{"aria-hidden":!0},o)))}),im=Object.assign(HF,{List:r7,Item:J$,Input:n7,Group:e7,Separator:t7,Dialog:i7,Empty:s7,Loading:o7});function a7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function l7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function VF(t){let e=R.useRef(t);return Ch(()=>{e.current=t}),e}var Ch=typeof window>"u"?R.useEffect:R.useLayoutEffect;function jm(t){let e=R.useRef();return e.current===void 0&&(e.current=t()),e}function Ed(t){let e=AP(),n=()=>t(e.snapshot());return R.useSyncExternalStore(e.subscribe,n,n)}function GF(t,e,n,r=[]){let i=R.useRef(),s=Wy();return Ch(()=>{var o;let a=(()=>{var c;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(c=d.current.textContent)==null?void 0:c.trim():i.current}})(),l=r.map(c=>c.trim());s.value(t,a,l),(o=e.current)==null||o.setAttribute(Dm,a),i.current=a}),i}var c7=()=>{let[t,e]=R.useState(),n=jm(()=>new Map);return Ch(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function u7(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function Z1({asChild:t,children:e},n){return t&&R.isValidElement(e)?R.cloneElement(u7(e),{ref:e.ref},n(e.props.children)):n(e)}var d7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function f7({onNavigate:t}){const[e,n]=R.useState(!1);return R.useEffect(()=>{const r=i=>{(i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"&&(i.preventDefault(),n(s=>!s))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),g.jsx(im.Dialog,{open:e,onOpenChange:n,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>n(!1),children:g.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:r=>r.stopPropagation(),children:[g.jsx(im.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),g.jsxs(im.List,{className:"max-h-80 overflow-y-auto p-2",children:[g.jsx(im.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),g.jsx(im.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:jT.map(r=>g.jsxs(im.Item,{value:`${r.label} ${r.hint}`,onSelect:()=>{t(r.id),n(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[g.jsx(r.icon,{className:"h-4 w-4 text-primary"}),g.jsx("span",{children:r.label}),g.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:r.hint})]},r.id))})]})]})})}async function Ft(t,e){var l;const n={"Content-Type":"application/json",...e==null?void 0:e.headers},r=localStorage.getItem("mc_sudo_password"),i=localStorage.getItem("mc_hf_token");r&&(n["X-Sudo-Password"]=r);let s=e==null?void 0:e.body;if((((l=e==null?void 0:e.method)==null?void 0:l.toUpperCase())||"GET")==="POST"){if(typeof s=="string")try{const c=JSON.parse(s);let d=!1;r&&!("sudo_password"in c)&&(c.sudo_password=r,d=!0),i&&!("hf_token"in c)&&(c.hf_token=i,d=!0),d&&(s=JSON.stringify(c))}catch{}else if(!s){const c={};r&&(c.sudo_password=r),i&&(c.hf_token=i),Object.keys(c).length>0&&(s=JSON.stringify(c))}}const a=await fetch(t,{...e,headers:n,body:s});if(!a.ok)throw new Error(`${a.status} ${a.statusText}`);return a.json()}const Lr={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:t=>["drafts",t??""],connect:t=>["connect",t??""],connectHealth:["connect-health"],memory:(t,e)=>["memory",t??"",e??""],memoryGraph:["memory-graph"]},h7=(t=!0)=>ls({queryKey:Lr.memoryGraph,queryFn:()=>Ft("/api/memory/graph"),enabled:t}),p7=()=>ls({queryKey:Lr.health,queryFn:()=>Ft("/api/health"),refetchInterval:1e4}),Q1=(t=5e3)=>ls({queryKey:Lr.systemStatus,queryFn:()=>Ft("/api/system/status"),refetchInterval:t}),m7=(t=3e3)=>ls({queryKey:Lr.services,queryFn:()=>Ft("/api/system/services"),refetchInterval:t}),qh=(t=4e3)=>ls({queryKey:Lr.models,queryFn:()=>Ft("/api/models"),refetchInterval:t}),g7=(t=4e3)=>ls({queryKey:Lr.routing,queryFn:()=>Ft("/api/routing"),refetchInterval:t}),v7=(t=2e3)=>ls({queryKey:Lr.jobs,queryFn:()=>Ft("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),TP=(t=3e3)=>ls({queryKey:Lr.tokenStats,queryFn:()=>Ft("/api/system/token-stats"),refetchInterval:t}),CP=(t=5e3)=>ls({queryKey:Lr.agentStatus,queryFn:()=>Ft("/api/agent/status"),refetchInterval:t}),y7=(t=6e4)=>ls({queryKey:Lr.hermesBrain,queryFn:()=>Ft("/api/agent/brain"),refetchInterval:t}),PP=t=>ls({queryKey:Lr.updates,queryFn:()=>Ft("/api/maintenance/updates"),refetchInterval:t}),x7=()=>ls({queryKey:Lr.discover,queryFn:()=>Ft("/api/discover")}),b7=t=>ls({queryKey:Lr.drafts(t),queryFn:()=>Ft(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),WF=t=>ls({queryKey:Lr.connect(t),queryFn:()=>Ft(t?`/api/connect?${t}`:"/api/connect")}),_7=()=>ls({queryKey:Lr.connectHealth,queryFn:()=>Ft("/api/connect/health"),refetchInterval:15e3}),HT=t=>ls({queryKey:Lr.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),Ft(`/api/memory?${e}`)},select:e=>t!=null&&t.limit?e.slice(0,t.limit):e});function sm(t){return(t/1024**3).toFixed(1)}function VT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Bo(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function w7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function CI(t){return t?`${Math.round(t/1024)}k`:"—"}function $F(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=E7(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(RP);return a[0]===""&&a.length!==1&&a.shift(),XF(a,e)||M7(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},XF=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?XF(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(RP);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},PI=/^\[(.+)\]$/,M7=t=>{if(PI.test(t)){const e=PI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},E7=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return T7(Object.entries(t.classGroups),n).forEach(([s,o])=>{GT(o,r,s,e)}),r},GT=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:RI(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(A7(i)){GT(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{GT(o,RI(e,s),n,r)})})},RI=(t,e)=>{let n=t;return e.split(RP).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},A7=t=>t.isThemeGetter,T7=(t,e)=>e?t.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[n,i]}):t,C7=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},qF="!",P7=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=a=>{const l=[];let c=0,d=0,f;for(let w=0;wd?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:S}};return n?a=>n({className:a,parseClassName:o}):o},R7=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},N7=t=>({cache:C7(t.cacheSize),parseClassName:P7(t),...S7(t)}),I7=/\s+/,k7=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(I7);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:y}=n(c);let x=!!y,S=r(x?m.substring(0,y):m);if(!S){if(!x){a=c+(a.length>0?" "+a:a);continue}if(S=r(m),!S){a=c+(a.length>0?" "+a:a);continue}x=!1}const w=R7(d).join(":"),_=f?w+qF:w,E=_+S;if(s.includes(E))continue;s.push(E);const T=i(S,x);for(let C=0;C0?" "+a:a)}return a};function O7(){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=N7(c),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=k7(l,n);return i(l,d),d}return function(){return s(O7.apply(null,arguments))}}const rr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},YF=/^\[(?:([a-z-]+):)?(.+)\]$/i,D7=/^\d+\/\d+$/,j7=new Set(["px","full","screen"]),U7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,F7=/\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$/,z7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,B7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,H7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sc=t=>Jm(t)||j7.has(t)||D7.test(t),Gu=t=>Hg(t,"length",Y7),Jm=t=>!!t&&!Number.isNaN(Number(t)),pE=t=>Hg(t,"number",Jm),i0=t=>!!t&&Number.isInteger(Number(t)),V7=t=>t.endsWith("%")&&Jm(t.slice(0,-1)),fn=t=>YF.test(t),Wu=t=>U7.test(t),G7=new Set(["length","size","percentage"]),W7=t=>Hg(t,G7,ZF),$7=t=>Hg(t,"position",ZF),X7=new Set(["image","url"]),q7=t=>Hg(t,X7,Q7),K7=t=>Hg(t,"",Z7),s0=()=>!0,Hg=(t,e,n)=>{const r=YF.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},Y7=t=>F7.test(t)&&!z7.test(t),ZF=()=>!1,Z7=t=>B7.test(t),Q7=t=>H7.test(t),J7=()=>{const t=rr("colors"),e=rr("spacing"),n=rr("blur"),r=rr("brightness"),i=rr("borderColor"),s=rr("borderRadius"),o=rr("borderSpacing"),a=rr("borderWidth"),l=rr("contrast"),c=rr("grayscale"),d=rr("hueRotate"),f=rr("invert"),m=rr("gap"),y=rr("gradientColorStops"),x=rr("gradientColorStopPositions"),S=rr("inset"),w=rr("margin"),_=rr("opacity"),E=rr("padding"),T=rr("saturate"),C=rr("scale"),O=rr("sepia"),N=rr("skew"),D=rr("space"),F=rr("translate"),G=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",fn,e],H=()=>[fn,e],ne=()=>["",Sc,Gu],te=()=>["auto",Jm,fn],he=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],se=()=>["solid","dashed","dotted","double","none"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",fn],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>[Jm,fn];return{cacheSize:500,separator:":",theme:{colors:[s0],spacing:[Sc,Gu],blur:["none","",Wu,fn],brightness:V(),borderColor:[t],borderRadius:["none","","full",Wu,fn],borderSpacing:H(),borderWidth:ne(),contrast:V(),grayscale:J(),hueRotate:V(),invert:J(),gap:H(),gradientColorStops:[t],gradientColorStopPositions:[V7,Gu],inset:U(),margin:U(),opacity:V(),padding:H(),saturate:V(),scale:V(),sepia:J(),skew:V(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",fn]}],container:["container"],columns:[{columns:[Wu]}],"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:[...he(),fn]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",i0,fn]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",fn]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",i0,fn]}],"grid-cols":[{"grid-cols":[s0]}],"col-start-end":[{col:["auto",{span:["full",i0,fn]},fn]}],"col-start":[{"col-start":te()}],"col-end":[{"col-end":te()}],"grid-rows":[{"grid-rows":[s0]}],"row-start-end":[{row:["auto",{span:[i0,fn]},fn]}],"row-start":[{"row-start":te()}],"row-end":[{"row-end":te()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",fn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",fn]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[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",fn,e]}],"min-w":[{"min-w":[fn,e,"min","max","fit"]}],"max-w":[{"max-w":[fn,e,"none","full","min","max","fit","prose",{screen:[Wu]},Wu]}],h:[{h:[fn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[fn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Wu,Gu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",pE]}],"font-family":[{font:[s0]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",fn]}],"line-clamp":[{"line-clamp":["none",Jm,pE]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Sc,fn]}],"list-image":[{"list-image":["none",fn]}],"list-style-type":[{list:["none","disc","decimal",fn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Sc,Gu]}],"underline-offset":[{"underline-offset":["auto",Sc,fn]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fn]}],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",fn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...he(),$7]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",W7]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},q7]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...se(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:se()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...se()]}],"outline-offset":[{"outline-offset":[Sc,fn]}],"outline-w":[{outline:[Sc,Gu]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Sc,Gu]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Wu,K7]}],"shadow-color":[{shadow:[s0]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...fe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":fe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wu,fn]}],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":[_]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",fn]}],duration:[{duration:V()}],ease:[{ease:["linear","in","out","in-out",fn]}],delay:[{delay:V()}],animate:[{animate:["none","spin","ping","pulse","bounce",fn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[i0,fn]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",fn]}],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",fn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Sc,Gu,pE]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},eX=L7(J7);function nt(...t){return eX(er(t))}function Mg(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const QF=["fast","heavy","coder","vision","scout"],tX={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"},NP=t=>t&&tX[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function nX({fit:t}){const e={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[t.level];return g.jsxs("span",{className:nt("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",e),children:[t.text," • ",t.req_gb," GB RAM"]})}function NI(t){const e=t.toLowerCase();return e.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:e.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:e.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:e.includes("mistral")||e.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:e.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:e.includes("hermes")||e.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:e.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function rX(){const{data:t}=qh(2e3),{data:e}=TP(2e3),n=(t==null?void 0:t.models)??[],r=(t==null?void 0:t.running)??[],i=n.filter(l=>r.includes(l.name)),s=R.useRef(null),[o,a]=R.useState(!1);return R.useEffect(()=>{if(!e)return;const l=e.total_tokens;if(s.current!==null&&l>s.current){a(!0);const c=setTimeout(()=>a(!1),4e3);return s.current=l,()=>clearTimeout(c)}s.current=l},[e==null?void 0:e.total_tokens]),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"flex items-center justify-between mb-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(ay,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),g.jsxs("span",{className:nt("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",o?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[o?g.jsx(xh,{className:"h-3 w-3 animate-pulse"}):g.jsx($8,{className:"h-3 w-3"}),o?"Inferenz aktiv":"Idle"]})]}),i.length===0?g.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):g.jsx("div",{className:"grid gap-2",children:i.map(l=>{var c;return g.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.role&&g.jsx("span",{className:nt("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",NP(l.role)),children:l.role}),g.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(c=l.name.split("/").pop())==null?void 0:c.replace(/\.gguf$/i,"")})]}),g.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[Bo(l.size_bytes)," im Unified-RAM"]})]}),g.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[g.jsx("span",{className:nt("h-1.5 w-1.5 rounded-full bg-emerald-500",o&&"animate-pulse")})," warm"]})]},l.name)})})]})}let WT=[],$T=[];const XT=new Set,JF=()=>XT.forEach(t=>t());function e5(t){return XT.add(t),()=>{XT.delete(t)}}function iX(t){WT=[...WT,t].slice(-40),JF()}function sX(t){$T=[...$T,t].slice(-40),JF()}const oX=()=>R.useSyncExternalStore(e5,()=>WT),aX=()=>R.useSyncExternalStore(e5,()=>$T);function lX(){const{data:t,dataUpdatedAt:e}=Q1(3e3),{data:n,dataUpdatedAt:r}=TP(3e3),i=R.useRef(null);R.useEffect(()=>{var s,o,a,l;t&&iX({t:Date.now(),cpu:((s=t.cpu)==null?void 0:s.percent)??0,ram:((o=t.ram)==null?void 0:o.percent)??0,gpu:((a=t.gpu)==null?void 0:a.busy_percent)??null,disk:((l=t.disk)==null?void 0:l.percent)??null})},[e]),R.useEffect(()=>{if(!n)return;const s=Date.now(),o=n.prompt_tokens,a=n.completion_tokens;if(i.current){const l=Math.max((s-i.current.t)/1e3,.001);sX({t:s,prompt:Math.max(0,(o-i.current.p)/l),completion:Math.max(0,(a-i.current.c)/l)})}i.current={p:o,c:a,t:s}},[r])}function cX(){const{data:t,error:e}=Q1(3e3),n=oX();return{sys:t,hist:n,error:e}}var uX=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function IP(t){if(typeof t!="string")return!1;var e=uX;return e.includes(t)}var dX=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],fX=new Set(dX);function t5(t){return typeof t!="string"?!1:fX.has(t)}function n5(t){return typeof t=="string"&&t.startsWith("data-")}function za(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t5(n)||n5(n))&&(e[n]=t[n]);return e}function J1(t){if(t==null)return null;if(R.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return za(e)}return typeof t=="object"&&!Array.isArray(t)?za(t):null}function Ko(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t5(n)||n5(n)||IP(n))&&(e[n]=t[n]);return e}function hX(t){return t==null?null:R.isValidElement(t)?Ko(t.props):typeof t=="object"&&!Array.isArray(t)?Ko(t):null}var pX=["children","width","height","viewBox","className","style","title","desc"];function qT(){return qT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.width,i=t.height,s=t.viewBox,o=t.className,a=t.style,l=t.title,c=t.desc,d=mX(t,pX),f=s||{width:r,height:i,x:0,y:0},m=er("recharts-surface",o);return R.createElement("svg",qT({},Ko(d),{className:m,width:r,height:i,style:a,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),R.createElement("title",null,l),R.createElement("desc",null,c),n)}),vX=["children","className"];function KT(){return KT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.className,i=yX(t,vX),s=er("recharts-layer",r);return R.createElement("g",KT({className:s},Ko(i),{ref:e}),n)}),bX=R.createContext(null);function Mr(t){return function(){return t}}const YT=Math.PI,ZT=2*YT,Gf=1e-6,_X=ZT-Gf;function i5(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return i5;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;iGf)if(!(Math.abs(f*l-c*d)>Gf)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let y=r-o,x=i-a,S=l*l+c*c,w=y*y+x*x,_=Math.sqrt(S),E=Math.sqrt(m),T=s*Math.tan((YT-Math.acos((S+m-w)/(2*_*E)))/2),C=T/E,O=T/_;Math.abs(C-1)>Gf&&this._append`L${e+C*d},${n+C*f}`,this._append`A${s},${s},0,0,${+(f*y>d*x)},${this._x1=e+O*l},${this._y1=n+O*c}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),l=r*Math.sin(i),c=e+a,d=n+l,f=1^o,m=o?i-s:s-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Gf||Math.abs(this._y1-d)>Gf)&&this._append`L${c},${d}`,r&&(m<0&&(m=m%ZT+ZT),m>_X?this._append`A${r},${r},0,1,${f},${e-a},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=d}`:m>Gf&&this._append`A${r},${r},0,${+(m>=YT)},${f},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function s5(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new SX(e)}function kP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function o5(t){this._context=t}o5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function eS(t){return new o5(t)}function a5(t){return t[0]}function l5(t){return t[1]}function c5(t,e){var n=Mr(!0),r=null,i=eS,s=null,o=s5(a);t=typeof t=="function"?t:t===void 0?a5:Mr(t),e=typeof e=="function"?e:e===void 0?l5:Mr(e);function a(l){var c,d=(l=kP(l)).length,f,m=!1,y;for(r==null&&(s=i(y=o())),c=0;c<=d;++c)!(c=y;--x)a.point(T[x],C[x]);a.lineEnd(),a.areaEnd()}_&&(T[m]=+t(w,m,f),C[m]=+e(w,m,f),a.point(r?+r(w,m,f):T[m],n?+n(w,m,f):C[m]))}if(E)return a=null,E+""||null}function d(){return c5().defined(i).curve(o).context(s)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:Mr(+f),r=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Mr(+f),c):t},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Mr(+f),c):r},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:Mr(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Mr(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Mr(+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:Mr(!!f),c):i},c.curve=function(f){return arguments.length?(o=f,s!=null&&(a=o(s)),c):o},c.context=function(f){return arguments.length?(f==null?s=a=null:a=o(s=f),c):s},c}class u5{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function MX(t){return new u5(t,!0)}function EX(t){return new u5(t,!1)}function sw(){}function ow(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function d5(t){this._context=t}d5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:ow(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:ow(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function AX(t){return new d5(t)}function f5(t){this._context=t}f5.prototype={areaStart:sw,areaEnd:sw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:ow(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function TX(t){return new f5(t)}function h5(t){this._context=t}h5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:ow(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function CX(t){return new h5(t)}function p5(t){this._context=t}p5.prototype={areaStart:sw,areaEnd:sw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function PX(t){return new p5(t)}function II(t){return t<0?-1:1}function kI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),a=(s*i+o*r)/(r+i);return(II(s)+II(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function OI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function mE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-r)/3;t._context.bezierCurveTo(r+a,i+a*e,s-a,o-a*n,s,o)}function aw(t){this._context=t}aw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:mE(this,this._t0,OI(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,mE(this,OI(this,n=kI(this,t,e)),n);break;default:mE(this,this._t0,n=kI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function m5(t){this._context=new g5(t)}(m5.prototype=Object.create(aw.prototype)).point=function(t,e){aw.prototype.point.call(this,e,t)};function g5(t){this._context=t}g5.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}};function RX(t){return new aw(t)}function NX(t){return new m5(t)}function v5(t){this._context=t}v5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=LI(t),i=LI(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function kX(t){return new tS(t,.5)}function OX(t){return new tS(t,0)}function LX(t){return new tS(t,1)}function Ph(t,e){if((o=t.length)>1)for(var n=1,r,i,s=t[e[0]],o,a=s.length;n=0;)n[e]=e;return n}function DX(t,e){return t[e]}function jX(t){const e=[];return e.key=t,e}function UX(){var t=Mr([]),e=QT,n=Ph,r=DX;function i(s){var o=Array.from(t.apply(this,arguments),jX),a,l=o.length,c=-1,d;for(const f of s)for(a=0,++c;a0){for(var n,r,i=0,s=t[0].length,o;i0){for(var n=0,r=t[e[0]],i,s=r.length;n0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:VX,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function Di(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{var a=n[o-1];return typeof a=="string"?i+a+s:a!==void 0?i+xd(a)+s:i+s},"")}var Wo=t=>t===0?0:t>0?1:-1,kl=t=>typeof t=="number"&&t!=+t,Rh=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,It=t=>(typeof t=="number"||t instanceof Number)&&!kl(t),Ol=t=>It(t)||typeof t=="string",GX=0,uy=t=>{var e=++GX;return"".concat(t||"").concat(e)},Ad=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!It(e)&&typeof e!="string")return r;var s;if(Rh(e)){if(n==null)return r;var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return kl(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},b5=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;rr&&(typeof e=="function"?e(r):Kh(r,e))===n)}var Hi=t=>t===null||typeof t>"u",DP=t=>Hi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Ys(t){return t!=null}function Vg(){}var w5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,jP=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(R.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{IP(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},WX=(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];IP(i)&&typeof s=="function"&&(r||(r={}),r[i]=WX(s,e,n))}),r};function DI(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function XX(t){for(var e=1;e(o[a]===void 0&&r[a]!==void 0&&(o[a]=r[a]),o),n);return s}function ZX(t,e){const n=new Map;for(let r=0;rObject.prototype.propertyIsEnumerable.call(t,e))}function UP(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const nq="[object RegExp]",M5="[object String]",E5="[object Number]",A5="[object Boolean]",T5="[object Arguments]",rq="[object Symbol]",iq="[object Date]",sq="[object Map]",oq="[object Set]",aq="[object Array]",lq="[object ArrayBuffer]",cq="[object Object]",uq="[object DataView]",dq="[object Uint8Array]",fq="[object Uint8ClampedArray]",hq="[object Uint16Array]",pq="[object Uint32Array]",mq="[object Int8Array]",gq="[object Int16Array]",vq="[object Int32Array]",yq="[object Float32Array]",xq="[object Float64Array]",jI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function bq(t){return typeof jI.Buffer<"u"&&jI.Buffer.isBuffer(t)}function _q(t,e){return Jf(t,void 0,t,new Map,e)}function Jf(t,e,n,r=new Map,i=void 0){const s=i==null?void 0:i(t,e,n,r);if(s!==void 0)return s;if(eC(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const o=new Array(t.length);r.set(t,o);for(let a=0;a{}):tC(t,e,function r(i,s,o,a,l,c){const d=n(i,s,o,a,l,c);return d!==void 0?!!d:tC(i,s,r,c,!1)},new Map,!0)}function tC(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return Mq(t,e,n,r);case"function":return Object.keys(e).length>0?tC(t,{...e},n,r,i):F_(t,e);default:return C5(t)&&i?typeof e=="string"?e==="":!0:F_(t,e)}}function Mq(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return R5(t,e,n,r);if(e instanceof Map)return Eq(t,e,n,r);if(e instanceof Set)return Aq(t,e,n,r);const i=Object.keys(e);if(t==null||eC(t))return i.length===0;if(i.length===0)return!0;if(r!=null&&r.has(e))return r.get(e)===t;r==null||r.set(e,t);try{for(let s=0;s{})}function Tq(t){return t=Sq(t),e=>N5(e,t)}function Cq(t,e){return _q(t,(n,r,i,s)=>{if(typeof t=="object"){if(UP(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),ka(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case E5:case M5:case A5:{const o=new t.constructor(t==null?void 0:t.valueOf());return ka(o,t),o}case T5:{const o={};return ka(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function Pq(t){return Cq(t)}const Rq=/^(?:0|[1-9]\d*)$/;function I5(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t=0}function k5(t){return t!=null&&typeof t!="function"&&Lq(t.length)}function Dq(t){return typeof t=="object"&&t!==null}function jq(t){return Dq(t)&&k5(t)}function UI(t,e=S5){return jq(t)?ZX(Array.from(t),QX(Oq(e),1)):[]}function Uq(t,e,n){return e===!0?UI(t,n):typeof e=="function"?UI(t,e):t}var gE={exports:{}},vE={},yE={exports:{}},xE={};/** * @license React * use-sync-external-store-shim.production.js * @@ -485,7 +490,7 @@ Error generating stack: `+j.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var jI;function Uq(){if(jI)return yE;jI=1;var t=Wh();function e(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(f,m){var y=m(),x=r({inst:{value:y,getSnapshot:m}}),S=x[0].inst,w=x[1];return s(function(){S.value=y,S.getSnapshot=m,l(S)&&w({inst:S})},[f,y,m]),i(function(){return l(S)&&w({inst:S}),f(function(){l(S)&&w({inst:S})})},[f]),o(y),y}function l(f){var m=f.getSnapshot;f=f.value;try{var y=m();return!n(f,y)}catch{return!0}}function c(f,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return yE.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,yE}var UI;function Fq(){return UI||(UI=1,vE.exports=Uq()),vE.exports}/** + */var FI;function Fq(){if(FI)return xE;FI=1;var t=Wh();function e(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(f,m){var y=m(),x=r({inst:{value:y,getSnapshot:m}}),S=x[0].inst,w=x[1];return s(function(){S.value=y,S.getSnapshot=m,l(S)&&w({inst:S})},[f,y,m]),i(function(){return l(S)&&w({inst:S}),f(function(){l(S)&&w({inst:S})})},[f]),o(y),y}function l(f){var m=f.getSnapshot;f=f.value;try{var y=m();return!n(f,y)}catch{return!0}}function c(f,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return xE.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,xE}var zI;function zq(){return zI||(zI=1,yE.exports=Fq()),yE.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -493,12 +498,12 @@ Error generating stack: `+j.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var FI;function zq(){if(FI)return gE;FI=1;var t=Wh(),e=Fq();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return gE.useSyncExternalStoreWithSelector=function(c,d,f,m,y){var x=s(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=a(function(){function _(N){if(!E){if(E=!0,T=N,N=m(N),y!==void 0&&S.hasValue){var D=S.value;if(y(D,N))return C=D}return C=N}if(D=C,r(T,N))return D;var F=m(N);return y!==void 0&&y(D,F)?(T=N,D):(T=N,C=F)}var E=!1,T,C,O=f===void 0?null:f;return[function(){return _(d())},O===null?void 0:function(){return _(O())}]},[d,f,m,y]);var w=i(c,x[0],x[1]);return o(function(){S.hasValue=!0,S.value=w},[w]),l(w),w},gE}var zI;function Bq(){return zI||(zI=1,mE.exports=zq()),mE.exports}var Hq=Bq(),UP=R.createContext(null),Vq=t=>t,Wr=()=>{var t=R.useContext(UP);return t?t.store.dispatch:Vq},F_=()=>{},Gq=()=>F_,Wq=(t,e)=>t===e;function Bt(t){var e=R.useContext(UP),n=R.useMemo(()=>e?r=>{if(r!=null)return t(r)}:F_,[e,t]);return Hq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:Gq,e?e.store.getState:F_,e?e.store.getState:F_,n,Wq)}function $q(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Xq(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 BI=t=>Array.isArray(t)?t:[t];function qq(t){const e=Array.isArray(t[0])?t[0]:t;return Xq(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function Kq(t,e){const n=[],{length:r}=t;for(let i=0;itypeof WeakRef>"u"?Yq:WeakRef,k5=Zq(),Qq=0,HI=1;function bb(){return{s:Qq,v:void 0,o:null,p:null}}function Jq(t){return t instanceof k5?t.deref():t}function O5(t,e={}){let n=bb();const{resultEqualityCheck:r}=e;let i,s=0;function o(){let a=n;const{length:l}=arguments;for(let f=0,m=l;f{n=bb(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function eK(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,o=0,a,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),$q(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:m=[],argsMemoize:y=O5,argsMemoizeOptions:x=[]}=d,S=BI(m),w=BI(x),_=qq(i),E=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){o++;const O=Kq(_,arguments);return a=E.apply(null,O),a},...w);return Object.assign(T,{resultFunc:c,memoizedResultFunc:E,dependencies:_,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var ke=eK(O5);function tK(t,e=1){const n=[],r=Math.floor(e),i=(s,o)=>{for(let a=0;a{if(t!==e){const r=VI(t),i=VI(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 rK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,iK=/^\w*$/;function sK(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||L5(t)?!0:typeof t=="string"&&(iK.test(t)||!rK.test(t))||e!=null}function oK(t,e,n,r){if(t==null)return[];n=n,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(a=>String(a));const i=(a,l)=>{let c=a;for(let d=0;dl==null||a==null?l:typeof a=="object"&&"key"in a?Object.hasOwn(l,a.key)?l[a.key]:i(l,a.path):typeof a=="function"?a(l):Array.isArray(a)?i(l,a):typeof l=="object"?l[a]:l,o=e.map(a=>(Array.isArray(a)&&a.length===1&&(a=a[0]),a==null||typeof a=="function"||Array.isArray(a)||sK(a)?a:{key:a,path:OP(a)}));return t.map(a=>({original:a,criteria:o.map(l=>s(l,a))})).slice().sort((a,l)=>{for(let c=0;ca.original)}function tS(t,...e){const n=e.length;return n>1&&tC(t,e[0],e[1])?e=[]:n>2&&tC(e[0],e[1],e[2])&&(e=[e[0]]),oK(t,tK(e),["asc"])}var D5=t=>t.legend.settings,aK=t=>t.legend.size,lK=t=>t.legend.payload;ke([lK,D5],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?tS(r,n):r});function cK(t,e){return hK(t)||fK(t,e)||dK(t,e)||uK()}function uK(){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 dK(t,e){if(t){if(typeof t=="string")return GI(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)?GI(t,e):void 0}}function GI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n_b||Math.abs(t.left-e.left)>_b||Math.abs(t.top-e.top)>_b||Math.abs(t.width-e.width)>_b}function $I(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function pK(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=R.useState({height:0,left:0,top:0,width:0}),n=cK(e,2),r=n[0],i=n[1],s=R.useRef(null),o=R.useRef(r);o.current=r;var a=R.useCallback(l=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),l!=null){var c=$I(l);if(WI(c,o.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=$I(l);WI(f,o.current)&&i(f)});d.observe(l),s.current=d}}},[...t]);return R.useEffect(()=>()=>{var l;(l=s.current)===null||l===void 0||l.disconnect()},[]),[r,a]}function Li(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 mK=typeof Symbol=="function"&&Symbol.observable||"@@observable",XI=mK,xE=()=>Math.random().toString(36).substring(7).split("").join("."),gK={INIT:`@@redux/INIT${xE()}`,REPLACE:`@@redux/REPLACE${xE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${xE()}`},aw=gK;function FP(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 j5(t,e,n){if(typeof t!="function")throw new Error(Li(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Li(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Li(1));return n(j5)(t,e)}let r=t,i=e,s=new Map,o=s,a=0,l=!1;function c(){o===s&&(o=new Map,s.forEach((w,_)=>{o.set(_,w)}))}function d(){if(l)throw new Error(Li(3));return i}function f(w){if(typeof w!="function")throw new Error(Li(4));if(l)throw new Error(Li(5));let _=!0;c();const E=a++;return o.set(E,w),function(){if(_){if(l)throw new Error(Li(6));_=!1,c(),o.delete(E),s=null}}}function m(w){if(!FP(w))throw new Error(Li(7));if(typeof w.type>"u")throw new Error(Li(8));if(typeof w.type!="string")throw new Error(Li(17));if(l)throw new Error(Li(9));try{l=!0,i=r(i,w)}finally{l=!1}return(s=o).forEach(E=>{E()}),w}function y(w){if(typeof w!="function")throw new Error(Li(10));r=w,m({type:aw.REPLACE})}function x(){const w=f;return{subscribe(_){if(typeof _!="object"||_===null)throw new Error(Li(11));function E(){const C=_;C.next&&C.next(d())}return E(),{unsubscribe:w(E)}},[XI](){return this}}}return m({type:aw.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:y,[XI]:x}}function vK(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:aw.INIT})>"u")throw new Error(Li(12));if(typeof n(void 0,{type:aw.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Li(13))})}function U5(t){const e=Object.keys(t),n={};for(let s=0;s"u")throw a&&a.type,new Error(Li(14));c[f]=x,l=l||x!==y}return l=l||r.length!==Object.keys(o).length,l?c:o}}function lw(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function yK(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(Li(15))};const o={getState:i.getState,dispatch:(l,...c)=>s(l,...c)},a=t.map(l=>l(o));return s=lw(...a)(i.dispatch),{...i,dispatch:s}}}function F5(t){return FP(t)&&"type"in t&&typeof t.type=="string"}var z5=Symbol.for("immer-nothing"),qI=Symbol.for("immer-draftable"),Cs=Symbol.for("immer-state");function ja(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var bo=Object,Eg=bo.getPrototypeOf,cw="constructor",nS="prototype",nC="configurable",uw="enumerable",z_="writable",cy="value",Kc=t=>!!t&&!!t[Cs];function Ba(t){var e;return t?B5(t)||iS(t)||!!t[qI]||!!((e=t[cw])!=null&&e[qI])||sS(t)||oS(t):!1}var xK=bo[nS][cw].toString(),KI=new WeakMap;function B5(t){if(!t||!zP(t))return!1;const e=Eg(t);if(e===null||e===bo[nS])return!0;const n=bo.hasOwnProperty.call(e,cw)&&e[cw];if(n===Object)return!0;if(!Um(n))return!1;let r=KI.get(n);return r===void 0&&(r=Function.toString.call(n),KI.set(n,r)),r===xK}function rS(t,e,n=!0){Gy(t)===0?(n?Reflect.ownKeys(t):bo.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function Gy(t){const e=t[Cs];return e?e.type_:iS(t)?1:sS(t)?2:oS(t)?3:0}var YI=(t,e,n=Gy(t))=>n===2?t.has(e):bo[nS].hasOwnProperty.call(t,e),rC=(t,e,n=Gy(t))=>n===2?t.get(e):t[e],dw=(t,e,n,r=Gy(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function bK(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var iS=Array.isArray,sS=t=>t instanceof Map,oS=t=>t instanceof Set,zP=t=>typeof t=="object",Um=t=>typeof t=="function",bE=t=>typeof t=="boolean";function _K(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Ic=t=>t.copy_||t.base_,BP=t=>t.modified_?t.copy_:t.base_;function iC(t,e){if(sS(t))return new Map(t);if(oS(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=bo.getOwnPropertyDescriptors(t);delete r[Cs];let i=Reflect.ownKeys(r);for(let s=0;s1&&bo.defineProperties(t,{set:wb,add:wb,clear:wb,delete:wb}),bo.freeze(t),e&&rS(t,(n,r)=>{HP(r,!0)},!1)),t}function wK(){ja(2)}var wb={[cy]:wK};function aS(t){return t===null||!zP(t)?!0:bo.isFrozen(t)}var fw="MapSet",sC="Patches",ZI="ArrayMethods",H5={};function Nh(t){const e=H5[t];return e||ja(0,t),e}var QI=t=>!!H5[t],uy,V5=()=>uy,SK=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:QI(fw)?Nh(fw):void 0,arrayMethodsPlugin_:QI(ZI)?Nh(ZI):void 0});function JI(t,e){e&&(t.patchPlugin_=Nh(sC),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function oC(t){aC(t),t.drafts_.forEach(MK),t.drafts_=null}function aC(t){t===uy&&(uy=t.parent_)}var ek=t=>uy=SK(uy,t);function MK(t){const e=t[Cs];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function tk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Cs].modified_&&(oC(e),ja(4)),Ba(t)&&(t=nk(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Cs].base_,t,e)}else t=nk(e,n);return EK(e,t,!0),oC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==z5?t:void 0}function nk(t,e){if(aS(e))return e;const n=e[Cs];if(!n)return hw(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 EK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&HP(e,n)}function G5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var lS=(t,e)=>t.scope_===e,AK=[];function W5(t,e,n,r){const i=Ic(t),s=t.type_;if(r!==void 0&&rC(i,r,s)===e){dw(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;rS(i,(l,c)=>{if(Kc(c)){const d=a.get(c)||[];d.push(l),a.set(c,d)}})}const o=t.draftLocations_.get(e)??AK;for(const a of o)dw(i,a,n,s)}function TK(t,e,n){t.callbacks_.push(function(i){var a;const s=e;if(!s||!lS(s,i))return;(a=i.mapSetPlugin_)==null||a.fixSetContents(s);const o=BP(s);W5(t,s.draft_??s,o,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 CK(t,e,n){const{scope_:r}=t;if(Kc(n)){const i=n[Cs];lS(i,r)&&i.callbacks_.push(function(){B_(t);const o=BP(i);W5(t,n,o,e)})}else Ba(n)&&t.callbacks_.push(function(){const s=Ic(t);t.type_===3?s.has(n)&&hw(n,r.handledSet_,r):rC(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&hw(rC(t.copy_,e,t.type_),r.handledSet_,r)})}function hw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Kc(t)||e.has(t)||!Ba(t)||aS(t)||(e.add(t),rS(t,(r,i)=>{if(Kc(i)){const s=i[Cs];if(lS(s,n)){const o=BP(s);dw(t,r,o,t.type_),G5(s)}}else Ba(i)&&hw(i,e,n)})),t}function PK(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=pw;n&&(i=[r],s=dy);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var pw={get(t,e){if(e===Cs)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n!=null&&n.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=Ic(t);if(!YI(i,e,t.type_))return RK(t,i,e);const s=i[e];if(t.finalized_||!Ba(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&_K(e))return s;if(s===_E(t.base_,e)){B_(t);const o=t.type_===1?+e:e,a=cC(t.scope_,s,t,o);return t.copy_[o]=a}return s},has(t,e){return e in Ic(t)},ownKeys(t){return Reflect.ownKeys(Ic(t))},set(t,e,n){const r=X5(Ic(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=_E(Ic(t),e),s=i==null?void 0:i[Cs];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(bK(n,i)&&(n!==void 0||YI(t.base_,e,t.type_)))return!0;B_(t),lC(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),CK(t,e,n)),!0},deleteProperty(t,e){return B_(t),_E(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),lC(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Ic(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[z_]:!0,[nC]:t.type_!==1||e!=="length",[uw]:r[uw],[cy]:n[e]}},defineProperty(){ja(11)},getPrototypeOf(t){return Eg(t.base_)},setPrototypeOf(){ja(12)}},dy={};for(let t in pw){let e=pw[t];dy[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}dy.deleteProperty=function(t,e){return dy.set.call(this,t,e,void 0)};dy.set=function(t,e,n){return pw.set.call(this,t[0],e,n,t[0])};function _E(t,e){const n=t[Cs];return(n?Ic(n):t)[e]}function RK(t,e,n){var i;const r=X5(e,n);return r?cy in r?r[cy]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function X5(t,e){if(!(e in t))return;let n=Eg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Eg(n)}}function lC(t){t.modified_||(t.modified_=!0,t.parent_&&lC(t.parent_))}function B_(t){t.copy_||(t.assigned_=new Map,t.copy_=iC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var NK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Um(n)&&!Um(r)){const o=r;r=n;const a=this;return function(c=o,...d){return a.produce(c,f=>r.call(this,f,...d))}}Um(r)||ja(6),i!==void 0&&!Um(i)&&ja(7);let s;if(Ba(n)){const o=ek(this),a=cC(o,n,void 0);let l=!0;try{s=r(a),l=!1}finally{l?oC(o):aC(o)}return JI(o,i),tk(s,o)}else if(!n||!zP(n)){if(s=r(n),s===void 0&&(s=n),s===z5&&(s=void 0),this.autoFreeze_&&HP(s,!0),i){const o=[],a=[];Nh(sC).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:a}),i(o,a)}return s}else ja(1,n)},this.produceWithPatches=(n,r)=>{if(Um(n))return(a,...l)=>this.produceWithPatches(a,c=>n(c,...l));let i,s;return[this.produce(n,r,(a,l)=>{i=a,s=l}),i,s]},bE(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),bE(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),bE(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ba(e)||ja(8),Kc(e)&&(e=$o(e));const n=ek(this),r=cC(n,e,void 0);return r[Cs].isManual_=!0,aC(n),r}finishDraft(e,n){const r=e&&e[Cs];(!r||!r.isManual_)&&ja(9);const{scope_:i}=r;return JI(i,n),tk(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=Nh(sC).applyPatches_;return Kc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function cC(t,e,n,r){const[i,s]=sS(e)?Nh(fw).proxyMap_(e,n):oS(e)?Nh(fw).proxySet_(e,n):PK(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?TK(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 $o(t){return Kc(t)||ja(10,t),q5(t)}function q5(t){if(!Ba(t)||aS(t))return t;const e=t[Cs];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=iC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=iC(t,!0);return rS(n,(i,s)=>{dw(n,i,q5(s))},r),e&&(e.finalized_=!1),n}var IK=new NK,K5=IK.produce;function Y5(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var kK=Y5(),OK=Y5,LK=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?lw:lw.apply(null,arguments)};function Mo(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(wo(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 U0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,U0.prototype)}static get[Symbol.species](){return U0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new U0(...e[0].concat(this)):new U0(...e.concat(this))}};function rk(t){return Ba(t)?K5(t,()=>{}):t}function Sb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function DK(t){return typeof t=="boolean"}var jK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new Z5;return n&&(DK(n)?o.push(kK):o.push(OK(n.extraArgument))),o},Q5="RTK_autoBatch",sr=()=>t=>({payload:t,meta:{[Q5]:!0}}),ik=t=>e=>{setTimeout(e,t)},UK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(o),n())},s=t(i),o=setTimeout(i,e)},J5=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,o=!1;const a=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?UK(window.requestAnimationFrame,100):ik(10):t.type==="callback"?t.queueNotification:ik(t.timeout),c=()=>{o=!1,s&&(s=!1,a.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),m=r.subscribe(f);return a.add(d),()=>{m(),a.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[Q5]),s=!i,s&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},FK=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 zK(t){const e=jK(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let a;if(typeof n=="function")a=n;else if(FP(n))a=U5(n);else throw new Error(wo(1));let l;typeof r=="function"?l=r(e):l=e();let c=lw;i&&(c=LK({trace:!1,...typeof i=="object"&&i}));const d=yK(...l),f=FK(d);let m=typeof o=="function"?o(f):f();const y=c(...m);return j5(a,s,y)}function e4(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(wo(28));if(a in e)throw new Error(wo(29));return e[a]=o,i},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function BK(t){return typeof t=="function"}function HK(t,e){let[n,r,i]=e4(e),s;if(BK(t))s=()=>rk(t());else{const a=rk(t);s=()=>a}function o(a=s(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[i]),c.reduce((d,f)=>{if(f)if(Kc(d)){const y=f(d,l);return y===void 0?d:y}else{if(Ba(d))return K5(d,m=>f(m,l));{const m=f(d,l);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},a)}return o.getInitialState=s,o}var VK="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",GK=(t=21)=>{let e="",n=t;for(;n--;)e+=VK[Math.random()*64|0];return e},WK=Symbol.for("rtk-slice-createasyncthunk");function $K(t,e){return`${t}/${e}`}function XK({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[WK];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(wo(11));const a=(typeof i.reducers=="function"?i.reducers(KK()):i.reducers)||{},l=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(C,O){const N=typeof C=="string"?C:C.type;if(!N)throw new Error(wo(12));if(N in c.sliceCaseReducersByType)throw new Error(wo(13));return c.sliceCaseReducersByType[N]=O,d},addMatcher(C,O){return c.sliceMatchers.push({matcher:C,reducer:O}),d},exposeAction(C,O){return c.actionCreators[C]=O,d},exposeCaseReducer(C,O){return c.sliceCaseReducersByName[C]=O,d}};l.forEach(C=>{const O=a[C],N={reducerName:C,type:$K(s,C),createNotation:typeof i.reducers=="function"};ZK(O)?JK(N,O,d,e):YK(N,O,d)});function f(){const[C={},O=[],N=void 0]=typeof i.extraReducers=="function"?e4(i.extraReducers):[i.extraReducers],D={...C,...c.sliceCaseReducersByType};return HK(i.initialState,F=>{for(let V in D)F.addCase(V,D[V]);for(let V of c.sliceMatchers)F.addMatcher(V.matcher,V.reducer);for(let V of O)F.addMatcher(V.matcher,V.reducer);N&&F.addDefaultCase(N)})}const m=C=>C,y=new Map,x=new WeakMap;let S;function w(C,O){return S||(S=f()),S(C,O)}function _(){return S||(S=f()),S.getInitialState()}function E(C,O=!1){function N(F){let V=F[C];return typeof V>"u"&&O&&(V=Sb(x,N,_)),V}function D(F=m){const V=Sb(y,O,()=>new WeakMap);return Sb(V,F,()=>{const k={};for(const[U,H]of Object.entries(i.selectors??{}))k[U]=qK(H,F,()=>Sb(x,F,_),O);return k})}return{reducerPath:C,getSelectors:D,get selectors(){return D(N)},selectSlice:N}}const T={name:s,reducer:w,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:_,...E(o),injectInto(C,{reducerPath:O,...N}={}){const D=O??o;return C.inject({reducerPath:D,reducer:w},N),{...T,...E(D,!0)}}};return T}}function qK(t,e,n,r){function i(s,...o){let a=e(s);return typeof a>"u"&&r&&(a=n()),t(a,...o)}return i.unwrapped=t,i}var cs=XK();function KK(){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 YK({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!QK(r))throw new Error(wo(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Mo(t,o):Mo(t))}function ZK(t){return t._reducerDefinitionType==="asyncThunk"}function QK(t){return t._reducerDefinitionType==="reducerWithPrepare"}function JK({type:t,reducerName:e},n,r,i){if(!i)throw new Error(wo(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:l,settled:c,options:d}=n,f=i(t,s,d);r.exposeAction(e,f),o&&r.addCase(f.fulfilled,o),a&&r.addCase(f.pending,a),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:o||Mb,pending:a||Mb,rejected:l||Mb,settled:c||Mb})}function Mb(){}var eY="task",t4="listener",n4="completed",VP="cancelled",tY=`task-${VP}`,nY=`task-${n4}`,uC=`${t4}-${VP}`,rY=`${t4}-${n4}`,cS=class{constructor(t){Gs(this,"code");Gs(this,"name","TaskAbortError");Gs(this,"message");this.code=t,this.message=`${eY} ${VP} (reason: ${t})`}},GP=(t,e)=>{if(typeof t!="function")throw new TypeError(wo(32))},mw=()=>{},r4=(t,e=mw)=>(t.catch(e),t),i4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),bh=t=>{if(t.aborted)throw new cS(t.reason)};function s4(t,e){let n=mw;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=mw})}var iY=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()}},gw=t=>e=>r4(s4(t,e).then(n=>(bh(t),n))),o4=t=>{const e=gw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:eg}=Object,sk={},uS="listenerMiddleware",sY=(t,e)=>{const n=r=>i4(t,()=>r.abort(t.reason));return(r,i)=>{GP(r);const s=new AbortController;n(s);const o=iY(async()=>{bh(t),bh(s.signal);const a=await r({pause:gw(s.signal),delay:o4(s.signal),signal:s.signal});return bh(s.signal),a},()=>s.abort(nY));return i!=null&&i.autoJoin&&e.push(o.catch(mw)),{result:gw(t)(o),cancel(){s.abort(tY)}}}},oY=(t,e)=>{const n=async(r,i)=>{bh(e);let s=()=>{};const a=[new Promise((l,c)=>{let d=t({predicate:r,effect:(f,m)=>{m.unsubscribe(),l([f,m.getState(),m.getOriginalState()])}});s=()=>{d(),c()}})];i!=null&&a.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await s4(e,Promise.race(a));return bh(e),l}finally{s()}};return((r,i)=>r4(n(r,i)))},a4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Mo(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(wo(21));return GP(s),{predicate:i,type:e,effect:s}},l4=eg(t=>{const{type:e,predicate:n,effect:r}=a4(t);return{id:GK(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(wo(22))}}},{withTypes:()=>l4}),ok=(t,e)=>{const{type:n,effect:r,predicate:i}=a4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},dC=t=>{t.pending.forEach(e=>{e.abort(uC)})},aY=(t,e)=>()=>{for(const n of e.keys())dC(n);t.clear()},ak=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},c4=eg(Mo(`${uS}/add`),{withTypes:()=>c4}),lY=Mo(`${uS}/removeAll`),u4=eg(Mo(`${uS}/remove`),{withTypes:()=>u4}),cY=(...t)=>{console.error(`${uS}/error`,...t)},Wy=(t={})=>{const e=new Map,n=new Map,r=y=>{const x=n.get(y)??0;n.set(y,x+1)},i=y=>{const x=n.get(y)??1;x===1?n.delete(y):n.set(y,x-1)},{extra:s,onError:o=cY}=t;GP(o);const a=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),x=>{y.unsubscribe(),x!=null&&x.cancelActive&&dC(y)}),l=(y=>{const x=ok(e,y)??l4(y);return a(x)});eg(l,{withTypes:()=>l});const c=y=>{const x=ok(e,y);return x&&(x.unsubscribe(),y.cancelActive&&dC(x)),!!x};eg(c,{withTypes:()=>c});const d=async(y,x,S,w)=>{const _=new AbortController,E=oY(l,_.signal),T=[];try{y.pending.add(_),r(y),await Promise.resolve(y.effect(x,eg({},S,{getOriginalState:w,condition:(C,O)=>E(C,O).then(Boolean),take:E,delay:o4(_.signal),pause:gw(_.signal),extra:s,signal:_.signal,fork:sY(_.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((C,O,N)=>{C!==_&&(C.abort(uC),N.delete(C))})},cancel:()=>{_.abort(uC),y.pending.delete(_)},throwIfCancelled:()=>{bh(_.signal)}})))}catch(C){C instanceof cS||ak(o,C,{raisedBy:"effect"})}finally{await Promise.all(T),_.abort(rY),i(y),y.pending.delete(_)}},f=aY(e,n);return{middleware:y=>x=>S=>{if(!F5(S))return x(S);if(c4.match(S))return l(S.payload);if(lY.match(S)){f();return}if(u4.match(S))return c(S.payload);let w=y.getState();const _=()=>{if(w===sk)throw new Error(wo(23));return w};let E;try{if(E=x(S),e.size>0){const T=y.getState(),C=Array.from(e.values());for(const O of C){let N=!1;try{N=O.predicate(S,T,w)}catch(D){N=!1,ak(o,D,{raisedBy:"predicate"})}N&&d(O,S,y,_)}}}finally{w=sk}return E},startListening:l,stopListening:c,clearListeners:f}};function wo(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 uY={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},d4=cs({name:"chartLayout",initialState:uY,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,dY=dS.setMargin,fY=dS.setLayout,hY=dS.setChartSize,pY=dS.setScale,mY=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 Ll(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function lk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wm(t){for(var e=1;e{if(e&&n){var r=n.width,i=n.height,s=e.align,o=e.verticalAlign,a=e.layout;if((a==="vertical"||a==="horizontal"&&o==="middle")&&s!=="center"&&kt(t[s]))return Wm(Wm({},t),{},{[s]:t[s]+(r||0)});if((a==="horizontal"||a==="vertical"&&s==="center")&&o!=="middle"&&kt(t[o]))return Wm(Wm({},t),{},{[o]:t[o]+(i||0)})}return t},Bl=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",h4=(t,e,n,r)=>{if(r)return t.map(a=>a.coordinate);var i,s,o=t.map(a=>(a.coordinate===e&&(i=!0),a.coordinate===n&&(s=!0),a.coordinate));return i||o.push(e),s||o.push(n),o},p4=(t,e,n)=>{if(!t)return null;var r=t.duplicateDomain,i=t.type,s=t.range,o=t.scale,a=t.realScaleType,l=t.isCategorical,c=t.categoricalDomain,d=t.tickCount,f=t.ticks,m=t.niceTicks,y=t.axisType;if(!o)return null;var x=a==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,S=i==="category"&&o.bandwidth?o.bandwidth()/x:0;if(S=y==="angleAxis"&&s&&s.length>=2?Wo(s[0]-s[1])*2*S:S,f||m){var w=(f||m||[]).map((_,E)=>{var T=r?r.indexOf(_):_,C=o.map(T);return wn(C)?{coordinate:C+S,value:_,offset:S,index:E}:null}).filter(Ys);return w}return l&&c?c.map((_,E)=>{var T=o.map(_);return wn(T)?{coordinate:T+S,value:_,index:E,offset:S}:null}).filter(Ys):o.ticks&&d!=null?o.ticks(d).map((_,E)=>{var T=o.map(_);return wn(T)?{coordinate:T+S,value:_,index:E,offset:S}:null}).filter(Ys):o.domain().map((_,E)=>{var T=o.map(_);return wn(T)?{coordinate:T+S,value:r?r[_]:_,index:E,offset:S}:null}).filter(Ys)},bY=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=m,c[1]=s):(c[0]=o,o+=m,c[1]=o)}}}},_Y=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)}}}},wY={sign:bY,expand:UX,none:Ph,silhouette:FX,wiggle:zX,positive:_Y},SY=(t,e,n)=>{var r,i=(r=wY[n])!==null&&r!==void 0?r:Ph,s=jX().keys(e).value((a,l)=>Number(yi(a,l,0))).order(ZT).offset(i),o=s(t);return o.forEach((a,l)=>{a.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])})}),o};function MY(t){return t==null?void 0:String(t)}function ck(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Hi(i[e.dataKey])){var a=b5(n,"value",i[e.dataKey]);if(a)return a.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var l=yi(i,Hi(o)?e.dataKey:o),c=e.scale.map(l);return kt(c)?c:null}var EY=t=>{var e=t.flat(2).filter(kt);return[Math.min(...e),Math.max(...e)]},AY=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],TY=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return AY(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var o=s.stackedData,a=o.reduce((l,c)=>{var d=f4(c,e,n),f=EY(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(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]))},uk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,dk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vw=(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,o=1,a=i.length;o{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},PY=(t,e)=>e==="centric"?t.angle:t.radius,tu=t=>t.layout.width,nu=t=>t.layout.height,RY=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)),NY="data-recharts-item-index",IY="data-recharts-item-id",$y=60;function hk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Eb(t){for(var e=1;et.brush.height;function jY(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:$y;return n+i}return n},0)}function UY(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:$y;return n+i}return n},0)}function FY(t){var e=fS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function zY(t){var e=fS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Gi=ke([tu,nu,g4,DY,jY,UY,FY,zY,D5,aK],(t,e,n,r,i,s,o,a,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+a},m=Eb(Eb({},f),d),y=m.bottom;m.bottom+=r,m=xY(m,l,c);var x=t-m.left-m.right,S=e-m.top-m.bottom;return Eb(Eb({brushBottom:y},m),{},{width:Math.max(x,0),height:Math.max(S,0)})}),BY=ke(Gi,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),v4=ke(tu,nu,(t,e)=>({x:0,y:0,width:t,height:e})),HY=R.createContext(null),Js=()=>R.useContext(HY)!=null,pS=t=>t.brush,mS=ke([pS,Gi,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 VY(t,e,{signal:n,edges:r}={}){let i,s=null;const o=r!=null&&r.includes("leading"),a=r==null||r.includes("trailing"),l=()=>{s!==null&&(t.apply(i,s),i=void 0,s=null)},c=()=>{a&&l(),y()};let d=null;const f=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},e)},m=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{m(),i=void 0,s=null},x=()=>{l()},S=function(...w){if(n!=null&&n.aborted)return;i=this,s=w;const _=d==null;f(),o&&_&&l()};return S.schedule=f,S.cancel=y,S.flush=x,n==null||n.addEventListener("abort",y,{once:!0}),S}function GY(t,e=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:s}=n,o=Array(2);r&&(o[0]="leading"),i&&(o[1]="trailing");let a,l=null;const c=VY(function(...m){a=t.apply(this,m),l=null},e,{edges:o}),d=function(...m){return s!=null&&(l===null&&(l=Date.now()),Date.now()-l>=s)?(a=t.apply(this,m),l=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,m),a)},f=()=>(c.flush(),a);return d.cancel=c.cancel,d.flush=f,d}function WY(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return GY(t,e,{leading:r,maxWait:e,trailing:i})}var yw=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},y4=(t,e,n)=>{var r=n.width,i=r===void 0?wl.width:r,s=n.height,o=s===void 0?wl.height:s,a=n.aspect,l=n.maxHeight,c=Rh(i)?t:Number(i),d=Rh(o)?e:Number(o);return a&&a>0&&(c?d=c/a:d&&(c=d*a),l&&d!=null&&d>l&&(d=l)),{calculatedWidth:c,calculatedHeight:d}},$Y={width:0,height:0,overflow:"visible"},XY={width:0,overflowX:"visible"},qY={height:0,overflowY:"visible"},KY={},YY=t=>{var e=t.width,n=t.height,r=Rh(e),i=Rh(n);return r&&i?$Y:r?XY:i?qY:KY};function ZY(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 QY=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function xw(){return xw=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 cZ(i)?R.createElement(x4.Provider,{value:i},e):null}var WP=()=>R.useContext(x4),uZ=R.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,i=r===void 0?wl.initialDimension:r,s=t.width,o=t.height,a=t.minWidth,l=a===void 0?wl.minWidth:a,c=t.minHeight,d=t.maxHeight,f=t.children,m=t.debounce,y=m===void 0?wl.debounce:m,x=t.id,S=t.className,w=t.onResize,_=t.style,E=_===void 0?{}:_,T=aZ(t,QY),C=R.useRef(null),O=R.useRef();O.current=w,R.useImperativeHandle(e,()=>C.current);var N=R.useState({containerWidth:i.width,containerHeight:i.height}),D=nZ(N,2),F=D[0],V=D[1],k=R.useCallback((oe,fe)=>{V(B=>{var q=Math.round(oe),K=Math.round(fe);return B.containerWidth===q&&B.containerHeight===K?B:{containerWidth:q,containerHeight:K}})},[]);R.useEffect(()=>{if(C.current==null||typeof ResizeObserver>"u")return Vg;var oe=$=>{var Z,ge=$[0];if(ge!=null){var le=ge.contentRect,ue=le.width,_e=le.height;k(ue,_e),(Z=O.current)===null||Z===void 0||Z.call(O,ue,_e)}};y>0&&(oe=WY(oe,y,{trailing:!0,leading:!1}));var fe=new ResizeObserver(oe),B=C.current.getBoundingClientRect(),q=B.width,K=B.height;return k(q,K),fe.observe(C.current),()=>{fe.disconnect()}},[k,y]);var U=F.containerWidth,H=F.containerHeight;yw(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ne=y4(U,H,{width:s,height:o,aspect:n,maxHeight:d}),te=ne.calculatedWidth,he=ne.calculatedHeight;return yw(U<0||H<0||te!=null&&te>0||he!=null&&he>0,`The width(%s) and height(%s) of chart should be greater than 0, + */var BI;function Bq(){if(BI)return vE;BI=1;var t=Wh(),e=zq();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return vE.useSyncExternalStoreWithSelector=function(c,d,f,m,y){var x=s(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=a(function(){function _(N){if(!E){if(E=!0,T=N,N=m(N),y!==void 0&&S.hasValue){var D=S.value;if(y(D,N))return C=D}return C=N}if(D=C,r(T,N))return D;var F=m(N);return y!==void 0&&y(D,F)?(T=N,D):(T=N,C=F)}var E=!1,T,C,O=f===void 0?null:f;return[function(){return _(d())},O===null?void 0:function(){return _(O())}]},[d,f,m,y]);var w=i(c,x[0],x[1]);return o(function(){S.hasValue=!0,S.value=w},[w]),l(w),w},vE}var HI;function Hq(){return HI||(HI=1,gE.exports=Bq()),gE.exports}var Vq=Hq(),FP=R.createContext(null),Gq=t=>t,Wr=()=>{var t=R.useContext(FP);return t?t.store.dispatch:Gq},z_=()=>{},Wq=()=>z_,$q=(t,e)=>t===e;function Bt(t){var e=R.useContext(FP),n=R.useMemo(()=>e?r=>{if(r!=null)return t(r)}:z_,[e,t]);return Vq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:Wq,e?e.store.getState:z_,e?e.store.getState:z_,n,$q)}function Xq(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function qq(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var VI=t=>Array.isArray(t)?t:[t];function Kq(t){const e=Array.isArray(t[0])?t[0]:t;return qq(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function Yq(t,e){const n=[],{length:r}=t;for(let i=0;itypeof WeakRef>"u"?Zq:WeakRef,O5=Qq(),Jq=0,GI=1;function wb(){return{s:Jq,v:void 0,o:null,p:null}}function eK(t){return t instanceof O5?t.deref():t}function L5(t,e={}){let n=wb();const{resultEqualityCheck:r}=e;let i,s=0;function o(){let a=n;const{length:l}=arguments;for(let f=0,m=l;f{n=wb(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function tK(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,o=0,a,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),Xq(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:m=[],argsMemoize:y=L5,argsMemoizeOptions:x=[]}=d,S=VI(m),w=VI(x),_=Kq(i),E=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){o++;const O=Yq(_,arguments);return a=E.apply(null,O),a},...w);return Object.assign(T,{resultFunc:c,memoizedResultFunc:E,dependencies:_,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var Oe=tK(L5);function nK(t,e=1){const n=[],r=Math.floor(e),i=(s,o)=>{for(let a=0;a{if(t!==e){const r=WI(t),i=WI(e);if(r===i&&r===0){if(te)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function D5(t){return typeof t=="symbol"||t instanceof Symbol}const iK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,sK=/^\w*$/;function oK(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||D5(t)?!0:typeof t=="string"&&(sK.test(t)||!iK.test(t))||e!=null}function aK(t,e,n,r){if(t==null)return[];n=n,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(a=>String(a));const i=(a,l)=>{let c=a;for(let d=0;dl==null||a==null?l:typeof a=="object"&&"key"in a?Object.hasOwn(l,a.key)?l[a.key]:i(l,a.path):typeof a=="function"?a(l):Array.isArray(a)?i(l,a):typeof l=="object"?l[a]:l,o=e.map(a=>(Array.isArray(a)&&a.length===1&&(a=a[0]),a==null||typeof a=="function"||Array.isArray(a)||oK(a)?a:{key:a,path:LP(a)}));return t.map(a=>({original:a,criteria:o.map(l=>s(l,a))})).slice().sort((a,l)=>{for(let c=0;ca.original)}function nS(t,...e){const n=e.length;return n>1&&nC(t,e[0],e[1])?e=[]:n>2&&nC(e[0],e[1],e[2])&&(e=[e[0]]),aK(t,nK(e),["asc"])}var j5=t=>t.legend.settings,lK=t=>t.legend.size,cK=t=>t.legend.payload;Oe([cK,j5],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?nS(r,n):r});function uK(t,e){return pK(t)||hK(t,e)||fK(t,e)||dK()}function dK(){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 fK(t,e){if(t){if(typeof t=="string")return $I(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$I(t,e):void 0}}function $I(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nSb||Math.abs(t.left-e.left)>Sb||Math.abs(t.top-e.top)>Sb||Math.abs(t.width-e.width)>Sb}function qI(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function mK(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=R.useState({height:0,left:0,top:0,width:0}),n=uK(e,2),r=n[0],i=n[1],s=R.useRef(null),o=R.useRef(r);o.current=r;var a=R.useCallback(l=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),l!=null){var c=qI(l);if(XI(c,o.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=qI(l);XI(f,o.current)&&i(f)});d.observe(l),s.current=d}}},[...t]);return R.useEffect(()=>()=>{var l;(l=s.current)===null||l===void 0||l.disconnect()},[]),[r,a]}function Li(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 gK=typeof Symbol=="function"&&Symbol.observable||"@@observable",KI=gK,bE=()=>Math.random().toString(36).substring(7).split("").join("."),vK={INIT:`@@redux/INIT${bE()}`,REPLACE:`@@redux/REPLACE${bE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${bE()}`},lw=vK;function zP(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function U5(t,e,n){if(typeof t!="function")throw new Error(Li(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Li(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Li(1));return n(U5)(t,e)}let r=t,i=e,s=new Map,o=s,a=0,l=!1;function c(){o===s&&(o=new Map,s.forEach((w,_)=>{o.set(_,w)}))}function d(){if(l)throw new Error(Li(3));return i}function f(w){if(typeof w!="function")throw new Error(Li(4));if(l)throw new Error(Li(5));let _=!0;c();const E=a++;return o.set(E,w),function(){if(_){if(l)throw new Error(Li(6));_=!1,c(),o.delete(E),s=null}}}function m(w){if(!zP(w))throw new Error(Li(7));if(typeof w.type>"u")throw new Error(Li(8));if(typeof w.type!="string")throw new Error(Li(17));if(l)throw new Error(Li(9));try{l=!0,i=r(i,w)}finally{l=!1}return(s=o).forEach(E=>{E()}),w}function y(w){if(typeof w!="function")throw new Error(Li(10));r=w,m({type:lw.REPLACE})}function x(){const w=f;return{subscribe(_){if(typeof _!="object"||_===null)throw new Error(Li(11));function E(){const C=_;C.next&&C.next(d())}return E(),{unsubscribe:w(E)}},[KI](){return this}}}return m({type:lw.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:y,[KI]:x}}function yK(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:lw.INIT})>"u")throw new Error(Li(12));if(typeof n(void 0,{type:lw.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Li(13))})}function F5(t){const e=Object.keys(t),n={};for(let s=0;s"u")throw a&&a.type,new Error(Li(14));c[f]=x,l=l||x!==y}return l=l||r.length!==Object.keys(o).length,l?c:o}}function cw(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function xK(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(Li(15))};const o={getState:i.getState,dispatch:(l,...c)=>s(l,...c)},a=t.map(l=>l(o));return s=cw(...a)(i.dispatch),{...i,dispatch:s}}}function z5(t){return zP(t)&&"type"in t&&typeof t.type=="string"}var B5=Symbol.for("immer-nothing"),YI=Symbol.for("immer-draftable"),Cs=Symbol.for("immer-state");function ja(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var bo=Object,Eg=bo.getPrototypeOf,uw="constructor",rS="prototype",rC="configurable",dw="enumerable",B_="writable",dy="value",Kc=t=>!!t&&!!t[Cs];function Ba(t){var e;return t?H5(t)||sS(t)||!!t[YI]||!!((e=t[uw])!=null&&e[YI])||oS(t)||aS(t):!1}var bK=bo[rS][uw].toString(),ZI=new WeakMap;function H5(t){if(!t||!BP(t))return!1;const e=Eg(t);if(e===null||e===bo[rS])return!0;const n=bo.hasOwnProperty.call(e,uw)&&e[uw];if(n===Object)return!0;if(!Um(n))return!1;let r=ZI.get(n);return r===void 0&&(r=Function.toString.call(n),ZI.set(n,r)),r===bK}function iS(t,e,n=!0){$y(t)===0?(n?Reflect.ownKeys(t):bo.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function $y(t){const e=t[Cs];return e?e.type_:sS(t)?1:oS(t)?2:aS(t)?3:0}var QI=(t,e,n=$y(t))=>n===2?t.has(e):bo[rS].hasOwnProperty.call(t,e),iC=(t,e,n=$y(t))=>n===2?t.get(e):t[e],fw=(t,e,n,r=$y(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function _K(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var sS=Array.isArray,oS=t=>t instanceof Map,aS=t=>t instanceof Set,BP=t=>typeof t=="object",Um=t=>typeof t=="function",_E=t=>typeof t=="boolean";function wK(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Ic=t=>t.copy_||t.base_,HP=t=>t.modified_?t.copy_:t.base_;function sC(t,e){if(oS(t))return new Map(t);if(aS(t))return new Set(t);if(sS(t))return Array[rS].slice.call(t);const n=H5(t);if(e===!0||e==="class_only"&&!n){const r=bo.getOwnPropertyDescriptors(t);delete r[Cs];let i=Reflect.ownKeys(r);for(let s=0;s1&&bo.defineProperties(t,{set:Mb,add:Mb,clear:Mb,delete:Mb}),bo.freeze(t),e&&iS(t,(n,r)=>{VP(r,!0)},!1)),t}function SK(){ja(2)}var Mb={[dy]:SK};function lS(t){return t===null||!BP(t)?!0:bo.isFrozen(t)}var hw="MapSet",oC="Patches",JI="ArrayMethods",V5={};function Nh(t){const e=V5[t];return e||ja(0,t),e}var ek=t=>!!V5[t],fy,G5=()=>fy,MK=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:ek(hw)?Nh(hw):void 0,arrayMethodsPlugin_:ek(JI)?Nh(JI):void 0});function tk(t,e){e&&(t.patchPlugin_=Nh(oC),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function aC(t){lC(t),t.drafts_.forEach(EK),t.drafts_=null}function lC(t){t===fy&&(fy=t.parent_)}var nk=t=>fy=MK(fy,t);function EK(t){const e=t[Cs];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function rk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Cs].modified_&&(aC(e),ja(4)),Ba(t)&&(t=ik(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Cs].base_,t,e)}else t=ik(e,n);return AK(e,t,!0),aC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==B5?t:void 0}function ik(t,e){if(lS(e))return e;const n=e[Cs];if(!n)return pw(e,t.handledSet_,t);if(!cS(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);X5(n,t)}return n.copy_}function AK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&VP(e,n)}function W5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var cS=(t,e)=>t.scope_===e,TK=[];function $5(t,e,n,r){const i=Ic(t),s=t.type_;if(r!==void 0&&iC(i,r,s)===e){fw(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;iS(i,(l,c)=>{if(Kc(c)){const d=a.get(c)||[];d.push(l),a.set(c,d)}})}const o=t.draftLocations_.get(e)??TK;for(const a of o)fw(i,a,n,s)}function CK(t,e,n){t.callbacks_.push(function(i){var a;const s=e;if(!s||!cS(s,i))return;(a=i.mapSetPlugin_)==null||a.fixSetContents(s);const o=HP(s);$5(t,s.draft_??s,o,n),X5(s,i)})}function X5(t,e){var r;if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(((r=t.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=e;if(i){const s=i.getPath(t);s&&i.generatePatches_(t,s,e)}W5(t)}}function PK(t,e,n){const{scope_:r}=t;if(Kc(n)){const i=n[Cs];cS(i,r)&&i.callbacks_.push(function(){H_(t);const o=HP(i);$5(t,n,o,e)})}else Ba(n)&&t.callbacks_.push(function(){const s=Ic(t);t.type_===3?s.has(n)&&pw(n,r.handledSet_,r):iC(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&pw(iC(t.copy_,e,t.type_),r.handledSet_,r)})}function pw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Kc(t)||e.has(t)||!Ba(t)||lS(t)||(e.add(t),iS(t,(r,i)=>{if(Kc(i)){const s=i[Cs];if(cS(s,n)){const o=HP(s);fw(t,r,o,t.type_),W5(s)}}else Ba(i)&&pw(i,e,n)})),t}function RK(t,e){const n=sS(t),r={type_:n?1:0,scope_:e?e.scope_:G5(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=mw;n&&(i=[r],s=hy);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var mw={get(t,e){if(e===Cs)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n!=null&&n.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=Ic(t);if(!QI(i,e,t.type_))return NK(t,i,e);const s=i[e];if(t.finalized_||!Ba(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&wK(e))return s;if(s===wE(t.base_,e)){H_(t);const o=t.type_===1?+e:e,a=uC(t.scope_,s,t,o);return t.copy_[o]=a}return s},has(t,e){return e in Ic(t)},ownKeys(t){return Reflect.ownKeys(Ic(t))},set(t,e,n){const r=q5(Ic(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=wE(Ic(t),e),s=i==null?void 0:i[Cs];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(_K(n,i)&&(n!==void 0||QI(t.base_,e,t.type_)))return!0;H_(t),cC(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),PK(t,e,n)),!0},deleteProperty(t,e){return H_(t),wE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),cC(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Ic(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[B_]:!0,[rC]:t.type_!==1||e!=="length",[dw]:r[dw],[dy]:n[e]}},defineProperty(){ja(11)},getPrototypeOf(t){return Eg(t.base_)},setPrototypeOf(){ja(12)}},hy={};for(let t in mw){let e=mw[t];hy[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}hy.deleteProperty=function(t,e){return hy.set.call(this,t,e,void 0)};hy.set=function(t,e,n){return mw.set.call(this,t[0],e,n,t[0])};function wE(t,e){const n=t[Cs];return(n?Ic(n):t)[e]}function NK(t,e,n){var i;const r=q5(e,n);return r?dy in r?r[dy]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function q5(t,e){if(!(e in t))return;let n=Eg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Eg(n)}}function cC(t){t.modified_||(t.modified_=!0,t.parent_&&cC(t.parent_))}function H_(t){t.copy_||(t.assigned_=new Map,t.copy_=sC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var IK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(Um(n)&&!Um(r)){const o=r;r=n;const a=this;return function(c=o,...d){return a.produce(c,f=>r.call(this,f,...d))}}Um(r)||ja(6),i!==void 0&&!Um(i)&&ja(7);let s;if(Ba(n)){const o=nk(this),a=uC(o,n,void 0);let l=!0;try{s=r(a),l=!1}finally{l?aC(o):lC(o)}return tk(o,i),rk(s,o)}else if(!n||!BP(n)){if(s=r(n),s===void 0&&(s=n),s===B5&&(s=void 0),this.autoFreeze_&&VP(s,!0),i){const o=[],a=[];Nh(oC).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:a}),i(o,a)}return s}else ja(1,n)},this.produceWithPatches=(n,r)=>{if(Um(n))return(a,...l)=>this.produceWithPatches(a,c=>n(c,...l));let i,s;return[this.produce(n,r,(a,l)=>{i=a,s=l}),i,s]},_E(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),_E(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),_E(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ba(e)||ja(8),Kc(e)&&(e=$o(e));const n=nk(this),r=uC(n,e,void 0);return r[Cs].isManual_=!0,lC(n),r}finishDraft(e,n){const r=e&&e[Cs];(!r||!r.isManual_)&&ja(9);const{scope_:i}=r;return tk(i,n),rk(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}r>-1&&(n=n.slice(r+1));const i=Nh(oC).applyPatches_;return Kc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function uC(t,e,n,r){const[i,s]=oS(e)?Nh(hw).proxyMap_(e,n):aS(e)?Nh(hw).proxySet_(e,n):RK(e,n);return((n==null?void 0:n.scope_)??G5()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?CK(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 $o(t){return Kc(t)||ja(10,t),K5(t)}function K5(t){if(!Ba(t)||lS(t))return t;const e=t[Cs];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=sC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=sC(t,!0);return iS(n,(i,s)=>{fw(n,i,K5(s))},r),e&&(e.finalized_=!1),n}var kK=new IK,Y5=kK.produce;function Z5(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var OK=Z5(),LK=Z5,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 Mo(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(wo(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>z5(r)&&r.type===t,n}var Q5=class z0 extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,z0.prototype)}static get[Symbol.species](){return z0}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new z0(...e[0].concat(this)):new z0(...e.concat(this))}};function sk(t){return Ba(t)?Y5(t,()=>{}):t}function Eb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function jK(t){return typeof t=="boolean"}var UK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new Q5;return n&&(jK(n)?o.push(OK):o.push(LK(n.extraArgument))),o},J5="RTK_autoBatch",sr=()=>t=>({payload:t,meta:{[J5]:!0}}),ok=t=>e=>{setTimeout(e,t)},FK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(o),n())},s=t(i),o=setTimeout(i,e)},e4=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,o=!1;const a=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?FK(window.requestAnimationFrame,100):ok(10):t.type==="callback"?t.queueNotification:ok(t.timeout),c=()=>{o=!1,s&&(s=!1,a.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),m=r.subscribe(f);return a.add(d),()=>{m(),a.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[J5]),s=!i,s&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},zK=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new Q5(t);return r&&i.push(e4(typeof r=="object"?r:void 0)),i};function BK(t){const e=UK(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let a;if(typeof n=="function")a=n;else if(zP(n))a=F5(n);else throw new Error(wo(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=xK(...l),f=zK(d);let m=typeof o=="function"?o(f):f();const y=c(...m);return U5(a,s,y)}function t4(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(wo(28));if(a in e)throw new Error(wo(29));return e[a]=o,i},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function HK(t){return typeof t=="function"}function VK(t,e){let[n,r,i]=t4(e),s;if(HK(t))s=()=>sk(t());else{const a=sk(t);s=()=>a}function o(a=s(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[i]),c.reduce((d,f)=>{if(f)if(Kc(d)){const y=f(d,l);return y===void 0?d:y}else{if(Ba(d))return Y5(d,m=>f(m,l));{const m=f(d,l);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},a)}return o.getInitialState=s,o}var GK="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",WK=(t=21)=>{let e="",n=t;for(;n--;)e+=GK[Math.random()*64|0];return e},$K=Symbol.for("rtk-slice-createasyncthunk");function XK(t,e){return`${t}/${e}`}function qK({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:o=s}=i;if(!s)throw new Error(wo(11));const a=(typeof i.reducers=="function"?i.reducers(YK()):i.reducers)||{},l=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(C,O){const N=typeof C=="string"?C:C.type;if(!N)throw new Error(wo(12));if(N in c.sliceCaseReducersByType)throw new Error(wo(13));return c.sliceCaseReducersByType[N]=O,d},addMatcher(C,O){return c.sliceMatchers.push({matcher:C,reducer:O}),d},exposeAction(C,O){return c.actionCreators[C]=O,d},exposeCaseReducer(C,O){return c.sliceCaseReducersByName[C]=O,d}};l.forEach(C=>{const O=a[C],N={reducerName:C,type:XK(s,C),createNotation:typeof i.reducers=="function"};QK(O)?eY(N,O,d,e):ZK(N,O,d)});function f(){const[C={},O=[],N=void 0]=typeof i.extraReducers=="function"?t4(i.extraReducers):[i.extraReducers],D={...C,...c.sliceCaseReducersByType};return VK(i.initialState,F=>{for(let G in D)F.addCase(G,D[G]);for(let G of c.sliceMatchers)F.addMatcher(G.matcher,G.reducer);for(let G of O)F.addMatcher(G.matcher,G.reducer);N&&F.addDefaultCase(N)})}const m=C=>C,y=new Map,x=new WeakMap;let S;function w(C,O){return S||(S=f()),S(C,O)}function _(){return S||(S=f()),S.getInitialState()}function E(C,O=!1){function N(F){let G=F[C];return typeof G>"u"&&O&&(G=Eb(x,N,_)),G}function D(F=m){const G=Eb(y,O,()=>new WeakMap);return Eb(G,F,()=>{const k={};for(const[U,H]of Object.entries(i.selectors??{}))k[U]=KK(H,F,()=>Eb(x,F,_),O);return k})}return{reducerPath:C,getSelectors:D,get selectors(){return D(N)},selectSlice:N}}const T={name:s,reducer:w,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:_,...E(o),injectInto(C,{reducerPath:O,...N}={}){const D=O??o;return C.inject({reducerPath:D,reducer:w},N),{...T,...E(D,!0)}}};return T}}function KK(t,e,n,r){function i(s,...o){let a=e(s);return typeof a>"u"&&r&&(a=n()),t(a,...o)}return i.unwrapped=t,i}var cs=qK();function YK(){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 ZK({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!JK(r))throw new Error(wo(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Mo(t,o):Mo(t))}function QK(t){return t._reducerDefinitionType==="asyncThunk"}function JK(t){return t._reducerDefinitionType==="reducerWithPrepare"}function eY({type:t,reducerName:e},n,r,i){if(!i)throw new Error(wo(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:l,settled:c,options:d}=n,f=i(t,s,d);r.exposeAction(e,f),o&&r.addCase(f.fulfilled,o),a&&r.addCase(f.pending,a),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:o||Ab,pending:a||Ab,rejected:l||Ab,settled:c||Ab})}function Ab(){}var tY="task",n4="listener",r4="completed",GP="cancelled",nY=`task-${GP}`,rY=`task-${r4}`,dC=`${n4}-${GP}`,iY=`${n4}-${r4}`,uS=class{constructor(t){Gs(this,"code");Gs(this,"name","TaskAbortError");Gs(this,"message");this.code=t,this.message=`${tY} ${GP} (reason: ${t})`}},WP=(t,e)=>{if(typeof t!="function")throw new TypeError(wo(32))},gw=()=>{},i4=(t,e=gw)=>(t.catch(e),t),s4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),bh=t=>{if(t.aborted)throw new uS(t.reason)};function o4(t,e){let n=gw;return new Promise((r,i)=>{const s=()=>i(new uS(t.reason));if(t.aborted){s();return}n=s4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=gw})}var sY=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof uS?"cancelled":"rejected",error:n}}finally{e==null||e()}},vw=t=>e=>i4(o4(t,e).then(n=>(bh(t),n))),a4=t=>{const e=vw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:eg}=Object,ak={},dS="listenerMiddleware",oY=(t,e)=>{const n=r=>s4(t,()=>r.abort(t.reason));return(r,i)=>{WP(r);const s=new AbortController;n(s);const o=sY(async()=>{bh(t),bh(s.signal);const a=await r({pause:vw(s.signal),delay:a4(s.signal),signal:s.signal});return bh(s.signal),a},()=>s.abort(rY));return i!=null&&i.autoJoin&&e.push(o.catch(gw)),{result:vw(t)(o),cancel(){s.abort(nY)}}}},aY=(t,e)=>{const n=async(r,i)=>{bh(e);let s=()=>{};const a=[new Promise((l,c)=>{let d=t({predicate:r,effect:(f,m)=>{m.unsubscribe(),l([f,m.getState(),m.getOriginalState()])}});s=()=>{d(),c()}})];i!=null&&a.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await o4(e,Promise.race(a));return bh(e),l}finally{s()}};return((r,i)=>i4(n(r,i)))},l4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Mo(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(wo(21));return WP(s),{predicate:i,type:e,effect:s}},c4=eg(t=>{const{type:e,predicate:n,effect:r}=l4(t);return{id:WK(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(wo(22))}}},{withTypes:()=>c4}),lk=(t,e)=>{const{type:n,effect:r,predicate:i}=l4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},fC=t=>{t.pending.forEach(e=>{e.abort(dC)})},lY=(t,e)=>()=>{for(const n of e.keys())fC(n);t.clear()},ck=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},u4=eg(Mo(`${dS}/add`),{withTypes:()=>u4}),cY=Mo(`${dS}/removeAll`),d4=eg(Mo(`${dS}/remove`),{withTypes:()=>d4}),uY=(...t)=>{console.error(`${dS}/error`,...t)},Xy=(t={})=>{const e=new Map,n=new Map,r=y=>{const x=n.get(y)??0;n.set(y,x+1)},i=y=>{const x=n.get(y)??1;x===1?n.delete(y):n.set(y,x-1)},{extra:s,onError:o=uY}=t;WP(o);const a=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),x=>{y.unsubscribe(),x!=null&&x.cancelActive&&fC(y)}),l=(y=>{const x=lk(e,y)??c4(y);return a(x)});eg(l,{withTypes:()=>l});const c=y=>{const x=lk(e,y);return x&&(x.unsubscribe(),y.cancelActive&&fC(x)),!!x};eg(c,{withTypes:()=>c});const d=async(y,x,S,w)=>{const _=new AbortController,E=aY(l,_.signal),T=[];try{y.pending.add(_),r(y),await Promise.resolve(y.effect(x,eg({},S,{getOriginalState:w,condition:(C,O)=>E(C,O).then(Boolean),take:E,delay:a4(_.signal),pause:vw(_.signal),extra:s,signal:_.signal,fork:oY(_.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((C,O,N)=>{C!==_&&(C.abort(dC),N.delete(C))})},cancel:()=>{_.abort(dC),y.pending.delete(_)},throwIfCancelled:()=>{bh(_.signal)}})))}catch(C){C instanceof uS||ck(o,C,{raisedBy:"effect"})}finally{await Promise.all(T),_.abort(iY),i(y),y.pending.delete(_)}},f=lY(e,n);return{middleware:y=>x=>S=>{if(!z5(S))return x(S);if(u4.match(S))return l(S.payload);if(cY.match(S)){f();return}if(d4.match(S))return c(S.payload);let w=y.getState();const _=()=>{if(w===ak)throw new Error(wo(23));return w};let E;try{if(E=x(S),e.size>0){const T=y.getState(),C=Array.from(e.values());for(const O of C){let N=!1;try{N=O.predicate(S,T,w)}catch(D){N=!1,ck(o,D,{raisedBy:"predicate"})}N&&d(O,S,y,_)}}}finally{w=ak}return E},startListening:l,stopListening:c,clearListeners:f}};function wo(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 dY={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},f4=cs({name:"chartLayout",initialState:dY,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){var n,r,i,s;t.margin.top=(n=e.payload.top)!==null&&n!==void 0?n:0,t.margin.right=(r=e.payload.right)!==null&&r!==void 0?r:0,t.margin.bottom=(i=e.payload.bottom)!==null&&i!==void 0?i:0,t.margin.left=(s=e.payload.left)!==null&&s!==void 0?s:0},setScale(t,e){t.scale=e.payload}}}),fS=f4.actions,fY=fS.setMargin,hY=fS.setLayout,pY=fS.setChartSize,mY=fS.setScale,gY=f4.reducer;function h4(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 Ll(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function uk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Wm(t){for(var e=1;e{if(e&&n){var r=n.width,i=n.height,s=e.align,o=e.verticalAlign,a=e.layout;if((a==="vertical"||a==="horizontal"&&o==="middle")&&s!=="center"&&It(t[s]))return Wm(Wm({},t),{},{[s]:t[s]+(r||0)});if((a==="horizontal"||a==="vertical"&&s==="center")&&o!=="middle"&&It(t[o]))return Wm(Wm({},t),{},{[o]:t[o]+(i||0)})}return t},Bl=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",p4=(t,e,n,r)=>{if(r)return t.map(a=>a.coordinate);var i,s,o=t.map(a=>(a.coordinate===e&&(i=!0),a.coordinate===n&&(s=!0),a.coordinate));return i||o.push(e),s||o.push(n),o},m4=(t,e,n)=>{if(!t)return null;var r=t.duplicateDomain,i=t.type,s=t.range,o=t.scale,a=t.realScaleType,l=t.isCategorical,c=t.categoricalDomain,d=t.tickCount,f=t.ticks,m=t.niceTicks,y=t.axisType;if(!o)return null;var x=a==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,S=i==="category"&&o.bandwidth?o.bandwidth()/x:0;if(S=y==="angleAxis"&&s&&s.length>=2?Wo(s[0]-s[1])*2*S:S,f||m){var w=(f||m||[]).map((_,E)=>{var T=r?r.indexOf(_):_,C=o.map(T);return wn(C)?{coordinate:C+S,value:_,offset:S,index:E}:null}).filter(Ys);return w}return l&&c?c.map((_,E)=>{var T=o.map(_);return wn(T)?{coordinate:T+S,value:_,index:E,offset:S}:null}).filter(Ys):o.ticks&&d!=null?o.ticks(d).map((_,E)=>{var T=o.map(_);return wn(T)?{coordinate:T+S,value:_,index:E,offset:S}:null}).filter(Ys):o.domain().map((_,E)=>{var T=o.map(_);return wn(T)?{coordinate:T+S,value:r?r[_]:_,index:E,offset:S}:null}).filter(Ys)},_Y=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=m,c[1]=s):(c[0]=o,o+=m,c[1]=o)}}}},wY=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)}}}},SY={sign:_Y,expand:FX,none:Ph,silhouette:zX,wiggle:BX,positive:wY},MY=(t,e,n)=>{var r,i=(r=SY[n])!==null&&r!==void 0?r:Ph,s=UX().keys(e).value((a,l)=>Number(yi(a,l,0))).order(QT).offset(i),o=s(t);return o.forEach((a,l)=>{a.forEach((c,d)=>{var f=yi(t[d],e[l],0);Array.isArray(f)&&f.length===2&&It(f[0])&&It(f[1])&&(c[0]=f[0],c[1]=f[1])})}),o};function EY(t){return t==null?void 0:String(t)}function dk(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Hi(i[e.dataKey])){var a=_5(n,"value",i[e.dataKey]);if(a)return a.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var l=yi(i,Hi(o)?e.dataKey:o),c=e.scale.map(l);return It(c)?c:null}var AY=t=>{var e=t.flat(2).filter(It);return[Math.min(...e),Math.max(...e)]},TY=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],CY=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return TY(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var o=s.stackedData,a=o.reduce((l,c)=>{var d=h4(c,e,n),f=AY(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(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]))},fk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,hk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,yw=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var i=nS(e,d=>d.coordinate),s=1/0,o=1,a=i.length;o{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},RY=(t,e)=>e==="centric"?t.angle:t.radius,tu=t=>t.layout.width,nu=t=>t.layout.height,NY=t=>t.layout.scale,v4=t=>t.layout.margin,hS=Oe(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),pS=Oe(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),IY="data-recharts-item-index",kY="data-recharts-item-id",qy=60;function mk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Tb(t){for(var e=1;et.brush.height;function UY(t){var e=pS(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:qy;return n+i}return n},0)}function FY(t){var e=pS(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:qy;return n+i}return n},0)}function zY(t){var e=hS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function BY(t){var e=hS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Gi=Oe([tu,nu,v4,jY,UY,FY,zY,BY,j5,lK],(t,e,n,r,i,s,o,a,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+a},m=Tb(Tb({},f),d),y=m.bottom;m.bottom+=r,m=bY(m,l,c);var x=t-m.left-m.right,S=e-m.top-m.bottom;return Tb(Tb({brushBottom:y},m),{},{width:Math.max(x,0),height:Math.max(S,0)})}),HY=Oe(Gi,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),y4=Oe(tu,nu,(t,e)=>({x:0,y:0,width:t,height:e})),VY=R.createContext(null),Js=()=>R.useContext(VY)!=null,mS=t=>t.brush,gS=Oe([mS,Gi,v4],(t,e,n)=>({height:t.height,x:It(t.x)?t.x:e.left,y:It(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:It(t.width)?t.width:e.width}));function GY(t,e,{signal:n,edges:r}={}){let i,s=null;const o=r!=null&&r.includes("leading"),a=r==null||r.includes("trailing"),l=()=>{s!==null&&(t.apply(i,s),i=void 0,s=null)},c=()=>{a&&l(),y()};let d=null;const f=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},e)},m=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{m(),i=void 0,s=null},x=()=>{l()},S=function(...w){if(n!=null&&n.aborted)return;i=this,s=w;const _=d==null;f(),o&&_&&l()};return S.schedule=f,S.cancel=y,S.flush=x,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,o=Array(2);r&&(o[0]="leading"),i&&(o[1]="trailing");let a,l=null;const c=GY(function(...m){a=t.apply(this,m),l=null},e,{edges:o}),d=function(...m){return s!=null&&(l===null&&(l=Date.now()),Date.now()-l>=s)?(a=t.apply(this,m),l=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,m),a)},f=()=>(c.flush(),a);return d.cancel=c.cancel,d.flush=f,d}function $Y(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[o++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},x4=(t,e,n)=>{var r=n.width,i=r===void 0?wl.width:r,s=n.height,o=s===void 0?wl.height:s,a=n.aspect,l=n.maxHeight,c=Rh(i)?t:Number(i),d=Rh(o)?e:Number(o);return a&&a>0&&(c?d=c/a:d&&(c=d*a),l&&d!=null&&d>l&&(d=l)),{calculatedWidth:c,calculatedHeight:d}},XY={width:0,height:0,overflow:"visible"},qY={width:0,overflowX:"visible"},KY={height:0,overflowY:"visible"},YY={},ZY=t=>{var e=t.width,n=t.height,r=Rh(e),i=Rh(n);return r&&i?XY:r?qY:i?KY:YY};function QY(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 JY=["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 uZ(i)?R.createElement(b4.Provider,{value:i},e):null}var $P=()=>R.useContext(b4),dZ=R.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,i=r===void 0?wl.initialDimension:r,s=t.width,o=t.height,a=t.minWidth,l=a===void 0?wl.minWidth:a,c=t.minHeight,d=t.maxHeight,f=t.children,m=t.debounce,y=m===void 0?wl.debounce:m,x=t.id,S=t.className,w=t.onResize,_=t.style,E=_===void 0?{}:_,T=lZ(t,JY),C=R.useRef(null),O=R.useRef();O.current=w,R.useImperativeHandle(e,()=>C.current);var N=R.useState({containerWidth:i.width,containerHeight:i.height}),D=rZ(N,2),F=D[0],G=D[1],k=R.useCallback((se,fe)=>{G(B=>{var J=Math.round(se),Y=Math.round(fe);return B.containerWidth===J&&B.containerHeight===Y?B:{containerWidth:J,containerHeight:Y}})},[]);R.useEffect(()=>{if(C.current==null||typeof ResizeObserver>"u")return Vg;var se=V=>{var q,pe=V[0];if(pe!=null){var ae=pe.contentRect,le=ae.width,be=ae.height;k(le,be),(q=O.current)===null||q===void 0||q.call(O,le,be)}};y>0&&(se=$Y(se,y,{trailing:!0,leading:!1}));var fe=new ResizeObserver(se),B=C.current.getBoundingClientRect(),J=B.width,Y=B.height;return k(J,Y),fe.observe(C.current),()=>{fe.disconnect()}},[k,y]);var U=F.containerWidth,H=F.containerHeight;xw(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ne=x4(U,H,{width:s,height:o,aspect:n,maxHeight:d}),te=ne.calculatedWidth,he=ne.calculatedHeight;return xw(U<0||H<0||te!=null&&te>0||he!=null&&he>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.`,te,he,s,o,l,c,n),R.createElement("div",xw({id:x?"".concat(x):void 0,className:er("recharts-responsive-container",S),style:mk(mk({},E),{},{width:s,height:o,minWidth:l,minHeight:c,maxHeight:d}),ref:C},T),R.createElement("div",{style:YY({width:s,height:o})},R.createElement(b4,{width:te,height:he},f)))}),dZ=R.forwardRef((t,e)=>{var n=WP();if(Ll(n.width)&&Ll(n.height))return t.children;var r=ZY({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,o=y4(void 0,void 0,{width:i,height:s,aspect:t.aspect,maxHeight:t.maxHeight}),a=o.calculatedWidth,l=o.calculatedHeight;return kt(a)&&kt(l)?R.createElement(b4,{width:a,height:l},t.children):R.createElement(uZ,xw({},t,{width:i,height:s,ref:e}))});function $P(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=Bt(BY),r=Bt(mS),i=(t=Bt(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}},fZ={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},_4=()=>{var t;return(t=Bt(Gi))!==null&&t!==void 0?t:fZ},w4=()=>Bt(tu),S4=()=>Bt(nu),fr=t=>t.layout.layoutType,Gg=()=>Bt(fr),XP=()=>{var t=Gg();if(t==="horizontal"||t==="vertical")return t},M4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},hZ=()=>{var t=Gg();return t!==void 0},Xy=t=>{var e=Wr(),n=Js(),r=t.width,i=t.height,s=WP(),o=r,a=i;return s&&(o=s.width>0?s.width:r,a=s.height>0?s.height:i),R.useEffect(()=>{!n&&Ll(o)&&Ll(a)&&e(hY({width:o,height:a}))},[e,n,o,a]),null},E4=Symbol.for("immer-nothing"),vk=Symbol.for("immer-draftable"),Eo=Symbol.for("immer-state");function Ua(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var fy=Object.getPrototypeOf;function Ag(t){return!!t&&!!t[Eo]}function Ih(t){var e;return t?A4(t)||Array.isArray(t)||!!t[vk]||!!((e=t.constructor)!=null&&e[vk])||qy(t)||yS(t):!1}var pZ=Object.prototype.constructor.toString(),yk=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=yk.get(n);return r===void 0&&(r=Function.toString.call(n),yk.set(n,r)),r===pZ}function bw(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[Eo];return e?e.type_:Array.isArray(t)?1:qy(t)?2:yS(t)?3:0}function fC(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 mZ(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function qy(t){return t instanceof Map}function yS(t){return t instanceof Set}function Wf(t){return t.copy_||t.base_}function hC(t,e){if(qy(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[Eo];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(t,{set:Ab,add:Ab,clear:Ab,delete:Ab}),Object.freeze(t),e&&Object.values(t).forEach(n=>qP(n,!0))),t}function gZ(){Ua(2)}var Ab={value:gZ};function xS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var vZ={};function kh(t){const e=vZ[t];return e||Ua(0,t),e}var hy;function C4(){return hy}function yZ(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function xk(t,e){e&&(kh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function pC(t){mC(t),t.drafts_.forEach(xZ),t.drafts_=null}function mC(t){t===hy&&(hy=t.parent_)}function bk(t){return hy=yZ(hy,t)}function xZ(t){const e=t[Eo];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function _k(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Eo].modified_&&(pC(e),Ua(4)),Ih(t)&&(t=_w(e,t),e.parent_||ww(e,t)),e.patches_&&kh("Patches").generateReplacementPatches_(n[Eo].base_,t,e.patches_,e.inversePatches_)):t=_w(e,n,[]),pC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==E4?t:void 0}function _w(t,e,n){if(xS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Eo];if(!i)return bw(e,(s,o)=>wk(t,i,e,s,o,n),r),e;if(i.scope_!==t)return e;if(!i.modified_)return ww(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,a=!1;i.type_===3&&(o=new Set(s),s.clear(),a=!0),bw(o,(l,c)=>wk(t,i,s,l,c,n,a),r),ww(t,s,!1),n&&t.patches_&&kh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function wk(t,e,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const a=xS(i);if(!(a&&!o)){if(Ag(i)){const l=s&&e&&e.type_!==3&&!fC(e.assigned_,r)?s.concat(r):void 0,c=_w(t,i,l);if(T4(n,r,c),Ag(c))t.canAutoFreeze_=!1;else return}else o&&n.add(i);if(Ih(i)&&!a){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===i&&a)return;_w(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(qy(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&ww(t,i)}}}function ww(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&qP(e,n)}function bZ(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:C4(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=KP;n&&(i=[r],s=py);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,a}var KP={get(t,e){if(e===Eo)return t;const n=Wf(t);if(!fC(n,e))return _Z(t,n,e);const r=n[e];return t.finalized_||!Ih(r)?r:r===wE(t.base_,e)?(SE(t),t.copy_[e]=vC(r,t)):r},has(t,e){return e in Wf(t)},ownKeys(t){return Reflect.ownKeys(Wf(t))},set(t,e,n){const r=P4(Wf(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=wE(Wf(t),e),s=i==null?void 0:i[Eo];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(mZ(n,i)&&(n!==void 0||fC(t.base_,e)))return!0;SE(t),gC(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 wE(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,SE(t),gC(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Wf(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){Ua(11)},getPrototypeOf(t){return fy(t.base_)},setPrototypeOf(){Ua(12)}},py={};bw(KP,(t,e)=>{py[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});py.deleteProperty=function(t,e){return py.set.call(this,t,e,void 0)};py.set=function(t,e,n){return KP.set.call(this,t[0],e,n,t[0])};function wE(t,e){const n=t[Eo];return(n?Wf(n):t)[e]}function _Z(t,e,n){var i;const r=P4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function P4(t,e){if(!(e in t))return;let n=fy(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=fy(n)}}function gC(t){t.modified_||(t.modified_=!0,t.parent_&&gC(t.parent_))}function SE(t){t.copy_||(t.copy_=hC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var wZ=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const s=n;n=e;const o=this;return function(l=s,...c){return o.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&Ua(6),r!==void 0&&typeof r!="function"&&Ua(7);let i;if(Ih(e)){const s=bk(this),o=vC(e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?pC(s):mC(s)}return xk(s,r),_k(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===E4&&(i=void 0),this.autoFreeze_&&qP(i,!0),r){const s=[],o=[];kh("Patches").generateReplacementPatches_(e,i,s,o),r(s,o)}return i}else Ua(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(o,...a)=>this.produceWithPatches(o,l=>e(l,...a));let r,i;return[this.produce(e,n,(o,a)=>{r=o,i=a}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Ih(t)||Ua(8),Ag(t)&&(t=SZ(t));const e=bk(this),n=vC(t,void 0);return n[Eo].isManual_=!0,mC(e),n}finishDraft(t,e){const n=t&&t[Eo];(!n||!n.isManual_)&&Ua(9);const{scope_:r}=n;return xk(r,e),_k(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=kh("Patches").applyPatches_;return Ag(t)?r(t,e):this.produce(t,i=>r(i,e))}};function vC(t,e){const n=qy(t)?kh("MapSet").proxyMap_(t,e):yS(t)?kh("MapSet").proxySet_(t,e):bZ(t,e);return(e?e.scope_:C4()).drafts_.push(n),n}function SZ(t){return Ag(t)||Ua(10,t),R4(t)}function R4(t){if(!Ih(t)||xS(t))return t;const e=t[Eo];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=hC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=hC(t,!0);return bw(n,(i,s)=>{T4(n,i,R4(s))},r),e&&(e.finalized_=!1),n}var MZ=new wZ;MZ.produce;var EZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},N4=cs({name:"legend",initialState:EZ,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:sr()},replaceLegendPayload:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).payload.indexOf(r);s>-1&&(t.payload[s]=i)},prepare:sr()},removeLegendPayload:{reducer(t,e){var n=$o(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:sr()}}}),Ky=N4.actions;Ky.setLegendSize;Ky.setLegendSettings;var AZ=Ky.addLegendPayload,TZ=Ky.replaceLegendPayload,CZ=Ky.removeLegendPayload,PZ=N4.reducer,ME={exports:{}},EE={};/** + height and width.`,te,he,s,o,l,c,n),R.createElement("div",bw({id:x?"".concat(x):void 0,className:er("recharts-responsive-container",S),style:vk(vk({},E),{},{width:s,height:o,minWidth:l,minHeight:c,maxHeight:d}),ref:C},T),R.createElement("div",{style:ZY({width:s,height:o})},R.createElement(_4,{width:te,height:he},f)))}),fZ=R.forwardRef((t,e)=>{var n=$P();if(Ll(n.width)&&Ll(n.height))return t.children;var r=QY({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,o=x4(void 0,void 0,{width:i,height:s,aspect:t.aspect,maxHeight:t.maxHeight}),a=o.calculatedWidth,l=o.calculatedHeight;return It(a)&&It(l)?R.createElement(_4,{width:a,height:l},t.children):R.createElement(dZ,bw({},t,{width:i,height:s,ref:e}))});function XP(t){if(t)return{x:t.x,y:t.y,upperWidth:"upperWidth"in t?t.upperWidth:t.width,lowerWidth:"lowerWidth"in t?t.lowerWidth:t.width,width:t.width,height:t.height}}var vS=()=>{var t,e=Js(),n=Bt(HY),r=Bt(gS),i=(t=Bt(mS))===null||t===void 0?void 0:t.padding;return!e||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},hZ={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},w4=()=>{var t;return(t=Bt(Gi))!==null&&t!==void 0?t:hZ},S4=()=>Bt(tu),M4=()=>Bt(nu),fr=t=>t.layout.layoutType,Gg=()=>Bt(fr),qP=()=>{var t=Gg();if(t==="horizontal"||t==="vertical")return t},E4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},pZ=()=>{var t=Gg();return t!==void 0},Ky=t=>{var e=Wr(),n=Js(),r=t.width,i=t.height,s=$P(),o=r,a=i;return s&&(o=s.width>0?s.width:r,a=s.height>0?s.height:i),R.useEffect(()=>{!n&&Ll(o)&&Ll(a)&&e(pY({width:o,height:a}))},[e,n,o,a]),null},A4=Symbol.for("immer-nothing"),xk=Symbol.for("immer-draftable"),Eo=Symbol.for("immer-state");function Ua(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var py=Object.getPrototypeOf;function Ag(t){return!!t&&!!t[Eo]}function Ih(t){var e;return t?T4(t)||Array.isArray(t)||!!t[xk]||!!((e=t.constructor)!=null&&e[xk])||Yy(t)||xS(t):!1}var mZ=Object.prototype.constructor.toString(),bk=new WeakMap;function T4(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=bk.get(n);return r===void 0&&(r=Function.toString.call(n),bk.set(n,r)),r===mZ}function _w(t,e,n=!0){yS(t)===0?(n?Reflect.ownKeys(t):Object.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function yS(t){const e=t[Eo];return e?e.type_:Array.isArray(t)?1:Yy(t)?2:xS(t)?3:0}function hC(t,e){return yS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function C4(t,e,n){const r=yS(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function gZ(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function Yy(t){return t instanceof Map}function xS(t){return t instanceof Set}function Wf(t){return t.copy_||t.base_}function pC(t,e){if(Yy(t))return new Map(t);if(xS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=T4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Eo];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(t,{set:Cb,add:Cb,clear:Cb,delete:Cb}),Object.freeze(t),e&&Object.values(t).forEach(n=>KP(n,!0))),t}function vZ(){Ua(2)}var Cb={value:vZ};function bS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var yZ={};function kh(t){const e=yZ[t];return e||Ua(0,t),e}var my;function P4(){return my}function xZ(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function _k(t,e){e&&(kh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function mC(t){gC(t),t.drafts_.forEach(bZ),t.drafts_=null}function gC(t){t===my&&(my=t.parent_)}function wk(t){return my=xZ(my,t)}function bZ(t){const e=t[Eo];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function Sk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Eo].modified_&&(mC(e),Ua(4)),Ih(t)&&(t=ww(e,t),e.parent_||Sw(e,t)),e.patches_&&kh("Patches").generateReplacementPatches_(n[Eo].base_,t,e.patches_,e.inversePatches_)):t=ww(e,n,[]),mC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==A4?t:void 0}function ww(t,e,n){if(bS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Eo];if(!i)return _w(e,(s,o)=>Mk(t,i,e,s,o,n),r),e;if(i.scope_!==t)return e;if(!i.modified_)return Sw(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,a=!1;i.type_===3&&(o=new Set(s),s.clear(),a=!0),_w(o,(l,c)=>Mk(t,i,s,l,c,n,a),r),Sw(t,s,!1),n&&t.patches_&&kh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function Mk(t,e,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const a=bS(i);if(!(a&&!o)){if(Ag(i)){const l=s&&e&&e.type_!==3&&!hC(e.assigned_,r)?s.concat(r):void 0,c=ww(t,i,l);if(C4(n,r,c),Ag(c))t.canAutoFreeze_=!1;else return}else o&&n.add(i);if(Ih(i)&&!a){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===i&&a)return;ww(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(Yy(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&Sw(t,i)}}}function Sw(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&KP(e,n)}function _Z(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:P4(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=YP;n&&(i=[r],s=gy);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,a}var YP={get(t,e){if(e===Eo)return t;const n=Wf(t);if(!hC(n,e))return wZ(t,n,e);const r=n[e];return t.finalized_||!Ih(r)?r:r===SE(t.base_,e)?(ME(t),t.copy_[e]=yC(r,t)):r},has(t,e){return e in Wf(t)},ownKeys(t){return Reflect.ownKeys(Wf(t))},set(t,e,n){const r=R4(Wf(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=SE(Wf(t),e),s=i==null?void 0:i[Eo];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(gZ(n,i)&&(n!==void 0||hC(t.base_,e)))return!0;ME(t),vC(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return SE(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,ME(t),vC(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Wf(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){Ua(11)},getPrototypeOf(t){return py(t.base_)},setPrototypeOf(){Ua(12)}},gy={};_w(YP,(t,e)=>{gy[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});gy.deleteProperty=function(t,e){return gy.set.call(this,t,e,void 0)};gy.set=function(t,e,n){return YP.set.call(this,t[0],e,n,t[0])};function SE(t,e){const n=t[Eo];return(n?Wf(n):t)[e]}function wZ(t,e,n){var i;const r=R4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function R4(t,e){if(!(e in t))return;let n=py(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=py(n)}}function vC(t){t.modified_||(t.modified_=!0,t.parent_&&vC(t.parent_))}function ME(t){t.copy_||(t.copy_=pC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var SZ=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const s=n;n=e;const o=this;return function(l=s,...c){return o.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&Ua(6),r!==void 0&&typeof r!="function"&&Ua(7);let i;if(Ih(e)){const s=wk(this),o=yC(e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?mC(s):gC(s)}return _k(s,r),Sk(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===A4&&(i=void 0),this.autoFreeze_&&KP(i,!0),r){const s=[],o=[];kh("Patches").generateReplacementPatches_(e,i,s,o),r(s,o)}return i}else Ua(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(o,...a)=>this.produceWithPatches(o,l=>e(l,...a));let r,i;return[this.produce(e,n,(o,a)=>{r=o,i=a}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Ih(t)||Ua(8),Ag(t)&&(t=MZ(t));const e=wk(this),n=yC(t,void 0);return n[Eo].isManual_=!0,gC(e),n}finishDraft(t,e){const n=t&&t[Eo];(!n||!n.isManual_)&&Ua(9);const{scope_:r}=n;return _k(r,e),Sk(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=kh("Patches").applyPatches_;return Ag(t)?r(t,e):this.produce(t,i=>r(i,e))}};function yC(t,e){const n=Yy(t)?kh("MapSet").proxyMap_(t,e):xS(t)?kh("MapSet").proxySet_(t,e):_Z(t,e);return(e?e.scope_:P4()).drafts_.push(n),n}function MZ(t){return Ag(t)||Ua(10,t),N4(t)}function N4(t){if(!Ih(t)||bS(t))return t;const e=t[Eo];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=pC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=pC(t,!0);return _w(n,(i,s)=>{C4(n,i,N4(s))},r),e&&(e.finalized_=!1),n}var EZ=new SZ;EZ.produce;var AZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},I4=cs({name:"legend",initialState:AZ,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:sr()},replaceLegendPayload:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).payload.indexOf(r);s>-1&&(t.payload[s]=i)},prepare:sr()},removeLegendPayload:{reducer(t,e){var n=$o(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:sr()}}}),Zy=I4.actions;Zy.setLegendSize;Zy.setLegendSettings;var TZ=Zy.addLegendPayload,CZ=Zy.replaceLegendPayload,PZ=Zy.removeLegendPayload,RZ=I4.reducer,EE={exports:{}},AE={};/** * @license React * use-sync-external-store-with-selector.production.js * @@ -506,56 +511,56 @@ 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 Sk;function RZ(){if(Sk)return EE;Sk=1;var t=Wh();function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,s=t.useEffect,o=t.useMemo,a=t.useDebugValue;return EE.useSyncExternalStoreWithSelector=function(l,c,d,f,m){var y=i(null);if(y.current===null){var x={hasValue:!1,value:null};y.current=x}else x=y.current;y=o(function(){function w(O){if(!_){if(_=!0,E=O,O=f(O),m!==void 0&&x.hasValue){var N=x.value;if(m(N,O))return T=N}return T=O}if(N=T,n(E,O))return N;var D=f(O);return m!==void 0&&m(N,D)?(E=O,N):(E=O,T=D)}var _=!1,E,T,C=d===void 0?null:d;return[function(){return w(c())},C===null?void 0:function(){return w(C())}]},[c,d,f,m]);var S=r(l,y[0],y[1]);return s(function(){x.hasValue=!0,x.value=S},[S]),a(S),S},EE}var Mk;function NZ(){return Mk||(Mk=1,ME.exports=RZ()),ME.exports}NZ();function IZ(t){t()}function kZ(){let t=null,e=null;return{clear(){t=null,e=null},notify(){IZ(()=>{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 Ek={notify(){},get:()=>[]};function OZ(t,e){let n,r=Ek,i=0,s=!1;function o(S){d();const w=r.subscribe(S);let _=!1;return()=>{_||(_=!0,w(),f())}}function a(){r.notify()}function l(){x.onStateChange&&x.onStateChange()}function c(){return s}function d(){i++,n||(n=t.subscribe(l),r=kZ())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Ek)}function m(){s||(s=!0,d())}function y(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:m,tryUnsubscribe:y,getListeners:()=>r};return x}var LZ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",DZ=LZ(),jZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",UZ=jZ(),FZ=()=>DZ||UZ?R.useLayoutEffect:R.useEffect,zZ=FZ();function Ak(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function BZ(t,e){if(Ak(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=OZ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),o=R.useMemo(()=>i.getState(),[i]);zZ(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,o]);const a=n||VZ;return R.createElement(a.Provider,{value:s},e)}var WZ=GZ,$Z=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function XZ(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($Z.has(r)){if(t[r]==null&&e[r]==null)continue;if(!BZ(t[r],e[r]))return!1}else if(!XZ(t[r],e[r]))return!1;return!0}function yC(){return yC=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?om.separator:e,r=t.contentStyle,i=t.itemStyle,s=t.labelStyle,o=s===void 0?om.labelStyle:s,a=t.payload,l=t.formatter,c=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,m=t.label,y=t.labelFormatter,x=t.accessibilityLayer,S=x===void 0?om.accessibilityLayer:x,w=()=>{if(a&&a.length){var F={padding:0,margin:0},V=rQ(a,c),k=V.map((U,H)=>{if(!U||U.type==="none")return null;var ne=U.formatter||l||nQ,te=U.value,he=U.name,oe=te,fe=he;if(ne){var B=ne(te,he,U,H,a);if(Array.isArray(B)){var q=ZZ(B,2);oe=q[0],fe=q[1]}else if(B!=null)oe=B;else return null}var K=o0(o0({},om.itemStyle),{},{color:U.color||om.itemStyle.color},i);return R.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(H),style:K},Ol(fe)?R.createElement("span",{className:"recharts-tooltip-item-name"},fe):null,Ol(fe)?R.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,R.createElement("span",{className:"recharts-tooltip-item-value"},oe),R.createElement("span",{className:"recharts-tooltip-item-unit"},U.unit||""))});return R.createElement("ul",{className:"recharts-tooltip-item-list",style:F},k)}return null},_=o0(o0({},om.contentStyle),r),E=o0({margin:0},o),T=!Hi(m),C=T?m:"",O=er("recharts-default-tooltip",d),N=er("recharts-tooltip-label",f);T&&y&&a!==void 0&&a!==null&&(C=y(m,a));var D=S?{role:"status","aria-live":"assertive"}:{};return R.createElement("div",yC({className:O,style:_},D),R.createElement("p",{className:N,style:E},R.isValidElement(C)?C:"".concat(C)),w())},a0="recharts-tooltip-wrapper",sQ={visibility:"hidden"};function oQ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return er(a0,{["".concat(a0,"-right")]:kt(n)&&e&&kt(e.x)&&n>=e.x,["".concat(a0,"-left")]:kt(n)&&e&&kt(e.x)&&n=e.y,["".concat(a0,"-top")]:kt(r)&&e&&kt(e.y)&&r0?i:0),f=n[r]+i;if(e[r])return o[r]?d:f;var m=l[r];if(m==null)return 0;if(o[r]){var y=d,x=m;return yw?Math.max(d,m):Math.max(f,m)}function aQ(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 lQ(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,i=t.offsetLeft,s=t.position,o=t.reverseDirection,a=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,f,m;return a.height>0&&a.width>0&&n?(f=Pk({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:a.width,viewBox:c,viewBoxDimension:c.width}),m=Pk({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:a.height,viewBox:c,viewBoxDimension:c.height}),d=aQ({translateX:f,translateY:m,useTranslate3d:l})):d=sQ,{cssProperties:d,cssClasses:oQ({translateX:f,translateY:m,coordinate:n})}}var cQ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Yy={isSsr:cQ()};function uQ(t,e){return pQ(t)||hQ(t,e)||fQ(t,e)||dQ()}function dQ(){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 fQ(t,e){if(t){if(typeof t=="string")return Rk(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)?Rk(t,e):void 0}}function Rk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nYy.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=uQ(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 Nk(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 am(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=yQ(l,2),d=c[0],f=c[1];R.useEffect(()=>{var _=E=>{if(E.key==="Escape"){var T,C,O,N;f({dismissed:!0,dismissedAtCoordinate:{x:(T=(C=t.coordinate)===null||C===void 0?void 0:C.x)!==null&&T!==void 0?T:0,y:(O=(N=t.coordinate)===null||N===void 0?void 0:N.y)!==null&&O!==void 0?O:0}})}};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[(e=t.coordinate)===null||e===void 0?void 0:e.x,(n=t.coordinate)===null||n===void 0?void 0:n.y]),d.dismissed&&(((r=(i=t.coordinate)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)!==d.dismissedAtCoordinate.x||((s=(o=t.coordinate)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)!==d.dismissedAtCoordinate.y)&&f(am(am({},d),{},{dismissed:!1}));var m=lQ({allowEscapeViewBox:t.allowEscapeViewBox,coordinate:t.coordinate,offsetLeft:typeof t.offset=="number"?t.offset:t.offset.x,offsetTop:typeof t.offset=="number"?t.offset:t.offset.y,position:t.position,reverseDirection:t.reverseDirection,tooltipBox:{height:t.lastBoundingBox.height,width:t.lastBoundingBox.width},useTranslate3d:t.useTranslate3d,viewBox:t.viewBox}),y=m.cssClasses,x=m.cssProperties,S=t.hasPortalFromProps?{}:am(am({transition:SQ({prefersReducedMotion:a,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},x),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),w=am(am({},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 EQ=R.memo(MQ),k4=()=>{var t;return(t=Bt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function xC(){return xC=Object.assign?Object.assign.bind():function(t){for(var e=1;ewn(t.x)&&wn(t.y),Dk=t=>t.base!=null&&Sw(t.base)&&Sw(t),l0=t=>t.x,c0=t=>t.y,PQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(LP(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=Lk["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return Lk[n]||J1},jk={connectNulls:!1,type:"linear"},RQ=t=>{var e=t.type,n=e===void 0?jk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,o=t.layout,a=t.connectNulls,l=a===void 0?jk.connectNulls:a,c=PQ(n,o),d=l?i.filter(Sw):i;if(Array.isArray(s)){var f,m=i.map((_,E)=>Ok(Ok({},_),{},{base:s[E]}));o==="vertical"?f=xb().y(c0).x1(l0).x0(_=>_.base.x):f=xb().x(l0).y1(c0).y0(_=>_.base.y);var y=f.defined(Dk).curve(c),x=l?m.filter(Dk):m;return y(x)}var S;o==="vertical"&&kt(s)?S=xb().y(c0).x1(l0).x0(s):kt(s)?S=xb().x(l0).y1(c0).y0(s):S=l5().x(l0).y(c0);var w=S.defined(Sw).curve(c);return w(d)},H_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Gg();if((!n||!n.length)&&!r)return null;var o={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},a=n&&n.length?RQ(o):r;return R.createElement("path",xC({},za(t),DP(t),{className:er("recharts-curve",e),d:a===null?void 0:a,ref:i}))},NQ=["x","y","top","left","width","height","className"];function bC(){return bC=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),FQ=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,i=r===void 0?0:r,s=t.top,o=s===void 0?0:s,a=t.left,l=a===void 0?0:a,c=t.width,d=c===void 0?0:c,f=t.height,m=f===void 0?0:f,y=t.className,x=DQ(t,NQ),S=IQ({x:n,y:i,top:o,left:l,width:d,height:m},x);return!kt(n)||!kt(i)||!kt(d)||!kt(m)||!kt(o)||!kt(l)?null:R.createElement("path",bC({},Ko(S),{className:er("recharts-cross",y),d:UQ(n,i,d,m,o,l)}))};function zQ(t,e,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-i,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}var Mw=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),Fk=(t,e)=>n=>{var r=O4(t,e);return L4(r,n)},BQ=(t,e)=>n=>{var r=O4(t,e),i=[...r.map((s,o)=>s*o).slice(1),0];return L4(i,n)},HQ=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]]},VQ=function(){for(var e=arguments.length,n=new Array(e),r=0;r{var i=Fk(t,n),s=Fk(e,r),o=BQ(t,n),a=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,m=0;m<8;++m){var y=i(f)-d,x=o(f);if(Math.abs(y-d)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,s=i===void 0?8:i,o=e.dt,a=o===void 0?16.67:o,l=1,c=[0],d=0,f=0,m=1e4,y=0;y{var E,T,C;if(_<=0)return 0;if(_>=1)return l;var O=_*w,N=Math.floor(O),D=O-N;return((E=c[N])!==null&&E!==void 0?E:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((C=c[N])!==null&&C!==void 0?C:0))*D}},$Q=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return zk(t);case"spring":return WQ();default:if(t.split("(")[0]==="cubic-bezier")return zk(t)}return typeof t=="function"?t:null},XQ=(t,e,n)=>{var r,i=s=>{var o=e.tick(s);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(i,o);return}r=t.setTimeout(i,o)};return r=t.setTimeout(i,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},D4=R.createContext(XQ);D4.Provider;function qQ(t){var e=R.useContext(D4);return R.useMemo(()=>t??e,[t,e])}function KQ(t,e,n){return(e=YQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function YQ(t){var e=ZQ(t,"string");return typeof e=="symbol"?e:e+""}function ZQ(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 Bk="init",Hk="pending",Vk="active",QQ="completed";function CE(t){return Math.max(0,t)}class JQ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;KQ(this,"state",Bk),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=CE(e.animationDuration),this.animationBegin=CE(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()===Bk)return this.state=Hk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===Hk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Vk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):CE(this.animationBegin-n)}if(this.getState()===Vk){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=QQ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class eJ extends JQ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Fc(this.getFrom(),this.getTo(),this.getProgress()))}}class tJ{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?e(o):i=requestAnimationFrame(s)};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function nJ(t,e){return oJ(t)||sJ(t,e)||iJ(t,e)||rJ()}function rJ(){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 iJ(t,e){if(t){if(typeof t=="string")return Gk(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)?Gk(t,e):void 0}}function Gk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{},onAnimationStart:()=>{}},Wk=0,PE=1;function j4(t){var e=Jo(t,aJ),n=e.animationId,r=e.isActive,i=e.canBegin,s=e.duration,o=e.easing,a=e.begin,l=e.onAnimationEnd,c=e.onAnimationStart,d=e.children,f=I4(),m=r==="auto"?!Yy.isSsr&&!f:r,y=qQ(e.animationController),x=R.useState(m?Wk:PE),S=nJ(x,2),w=S[0],_=S[1];return R.useEffect(()=>{m||_(PE)},[m]),R.useEffect(()=>{var E=$Q(o);if(!m||!i||E==null)return Vg;var T=new tJ,C=new eJ({animationId:n,easing:E,animationDuration:s,animationBegin:a,onAnimationStart:c,onAnimationEnd:l,from:Wk,to:PE});return y(T,C,_)},[y,n,m,i,s,o,a,c,l]),d(Number(w))}function U4(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=R.useRef(ly(e)),r=R.useRef(t);return r.current!==t&&(n.current=ly(e),r.current=t),n.current}var lJ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),cJ=(t,e,n)=>t.map(r=>"".concat(lJ(r)," ").concat(e,"ms ").concat(n)).join(","),uJ=["radius"],dJ=["radius"],$k,Xk,qk,Kk,Yk,Zk,Qk,Jk,eO,tO;function nO(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 rO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var s=xd(n),o=xd(r),a=Math.min(Math.abs(s)/2,Math.abs(o)/2),l=o>=0?1:-1,c=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(a>0&&Array.isArray(i)){for(var m=[0,0,0,0],y=0,x=4;ya?a:w}f=Di($k||($k=fl(["M",",",""])),t,e+l*m[0]),m[0]>0&&(f+=Di(Xk||(Xk=fl(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,t+c*m[0],e)),f+=Di(qk||(qk=fl(["L ",",",""])),t+n-c*m[1],e),m[1]>0&&(f+=Di(Kk||(Kk=fl(["A ",",",",0,0,",`, - `,",",""])),m[1],m[1],d,t+n,e+l*m[1])),f+=Di(Yk||(Yk=fl(["L ",",",""])),t+n,e+r-l*m[2]),m[2]>0&&(f+=Di(Zk||(Zk=fl(["A ",",",",0,0,",`, - `,",",""])),m[2],m[2],d,t+n-c*m[2],e+r)),f+=Di(Qk||(Qk=fl(["L ",",",""])),t+c*m[3],e+r),m[3]>0&&(f+=Di(Jk||(Jk=fl(["A ",",",",0,0,",`, - `,",",""])),m[3],m[3],d,t,e+r-l*m[3])),f+="Z"}else if(a>0&&i===+i&&i>0){var _=Math.min(a,i);f=Di(eO||(eO=fl(["M ",",",` + */var Ek;function NZ(){if(Ek)return AE;Ek=1;var t=Wh();function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,s=t.useEffect,o=t.useMemo,a=t.useDebugValue;return AE.useSyncExternalStoreWithSelector=function(l,c,d,f,m){var y=i(null);if(y.current===null){var x={hasValue:!1,value:null};y.current=x}else x=y.current;y=o(function(){function w(O){if(!_){if(_=!0,E=O,O=f(O),m!==void 0&&x.hasValue){var N=x.value;if(m(N,O))return T=N}return T=O}if(N=T,n(E,O))return N;var D=f(O);return m!==void 0&&m(N,D)?(E=O,N):(E=O,T=D)}var _=!1,E,T,C=d===void 0?null:d;return[function(){return w(c())},C===null?void 0:function(){return w(C())}]},[c,d,f,m]);var S=r(l,y[0],y[1]);return s(function(){x.hasValue=!0,x.value=S},[S]),a(S),S},AE}var Ak;function IZ(){return Ak||(Ak=1,EE.exports=NZ()),EE.exports}IZ();function kZ(t){t()}function OZ(){let t=null,e=null;return{clear(){t=null,e=null},notify(){kZ(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var Tk={notify(){},get:()=>[]};function LZ(t,e){let n,r=Tk,i=0,s=!1;function o(S){d();const w=r.subscribe(S);let _=!1;return()=>{_||(_=!0,w(),f())}}function a(){r.notify()}function l(){x.onStateChange&&x.onStateChange()}function c(){return s}function d(){i++,n||(n=t.subscribe(l),r=OZ())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Tk)}function m(){s||(s=!0,d())}function y(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:m,tryUnsubscribe:y,getListeners:()=>r};return x}var DZ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",jZ=DZ(),UZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",FZ=UZ(),zZ=()=>jZ||FZ?R.useLayoutEffect:R.useEffect,BZ=zZ();function Ck(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function HZ(t,e){if(Ck(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i{const l=LZ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),o=R.useMemo(()=>i.getState(),[i]);BZ(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,o]);const a=n||GZ;return R.createElement(a.Provider,{value:s},e)}var $Z=WZ,XZ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function qZ(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function _S(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(XZ.has(r)){if(t[r]==null&&e[r]==null)continue;if(!HZ(t[r],e[r]))return!1}else if(!qZ(t[r],e[r]))return!1;return!0}function xC(){return xC=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.separator,n=e===void 0?om.separator:e,r=t.contentStyle,i=t.itemStyle,s=t.labelStyle,o=s===void 0?om.labelStyle:s,a=t.payload,l=t.formatter,c=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,m=t.label,y=t.labelFormatter,x=t.accessibilityLayer,S=x===void 0?om.accessibilityLayer:x,w=()=>{if(a&&a.length){var F={padding:0,margin:0},G=iQ(a,c),k=G.map((U,H)=>{if(!U||U.type==="none")return null;var ne=U.formatter||l||rQ,te=U.value,he=U.name,se=te,fe=he;if(ne){var B=ne(te,he,U,H,a);if(Array.isArray(B)){var J=QZ(B,2);se=J[0],fe=J[1]}else if(B!=null)se=B;else return null}var Y=o0(o0({},om.itemStyle),{},{color:U.color||om.itemStyle.color},i);return R.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(H),style:Y},Ol(fe)?R.createElement("span",{className:"recharts-tooltip-item-name"},fe):null,Ol(fe)?R.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,R.createElement("span",{className:"recharts-tooltip-item-value"},se),R.createElement("span",{className:"recharts-tooltip-item-unit"},U.unit||""))});return R.createElement("ul",{className:"recharts-tooltip-item-list",style:F},k)}return null},_=o0(o0({},om.contentStyle),r),E=o0({margin:0},o),T=!Hi(m),C=T?m:"",O=er("recharts-default-tooltip",d),N=er("recharts-tooltip-label",f);T&&y&&a!==void 0&&a!==null&&(C=y(m,a));var D=S?{role:"status","aria-live":"assertive"}:{};return R.createElement("div",xC({className:O,style:_},D),R.createElement("p",{className:N,style:E},R.isValidElement(C)?C:"".concat(C)),w())},a0="recharts-tooltip-wrapper",oQ={visibility:"hidden"};function aQ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return er(a0,{["".concat(a0,"-right")]:It(n)&&e&&It(e.x)&&n>=e.x,["".concat(a0,"-left")]:It(n)&&e&&It(e.x)&&n=e.y,["".concat(a0,"-top")]:It(r)&&e&&It(e.y)&&r0?i:0),f=n[r]+i;if(e[r])return o[r]?d:f;var m=l[r];if(m==null)return 0;if(o[r]){var y=d,x=m;return yw?Math.max(d,m):Math.max(f,m)}function lQ(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 cQ(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,i=t.offsetLeft,s=t.position,o=t.reverseDirection,a=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,f,m;return a.height>0&&a.width>0&&n?(f=Nk({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:a.width,viewBox:c,viewBoxDimension:c.width}),m=Nk({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:a.height,viewBox:c,viewBoxDimension:c.height}),d=lQ({translateX:f,translateY:m,useTranslate3d:l})):d=oQ,{cssProperties:d,cssClasses:aQ({translateX:f,translateY:m,coordinate:n})}}var uQ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Qy={isSsr:uQ()};function dQ(t,e){return mQ(t)||pQ(t,e)||hQ(t,e)||fQ()}function fQ(){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 hQ(t,e){if(t){if(typeof t=="string")return Ik(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ik(t,e):void 0}}function Ik(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nQy.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=dQ(t,2),n=e[0],r=e[1];return R.useEffect(()=>{if(window.matchMedia){var i=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{r(i.matches)};return i.addEventListener("change",s),()=>{i.removeEventListener("change",s)}}},[]),n}function kk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function am(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=xQ(l,2),d=c[0],f=c[1];R.useEffect(()=>{var _=E=>{if(E.key==="Escape"){var T,C,O,N;f({dismissed:!0,dismissedAtCoordinate:{x:(T=(C=t.coordinate)===null||C===void 0?void 0:C.x)!==null&&T!==void 0?T:0,y:(O=(N=t.coordinate)===null||N===void 0?void 0:N.y)!==null&&O!==void 0?O:0}})}};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_)}},[(e=t.coordinate)===null||e===void 0?void 0:e.x,(n=t.coordinate)===null||n===void 0?void 0:n.y]),d.dismissed&&(((r=(i=t.coordinate)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)!==d.dismissedAtCoordinate.x||((s=(o=t.coordinate)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)!==d.dismissedAtCoordinate.y)&&f(am(am({},d),{},{dismissed:!1}));var m=cQ({allowEscapeViewBox:t.allowEscapeViewBox,coordinate:t.coordinate,offsetLeft:typeof t.offset=="number"?t.offset:t.offset.x,offsetTop:typeof t.offset=="number"?t.offset:t.offset.y,position:t.position,reverseDirection:t.reverseDirection,tooltipBox:{height:t.lastBoundingBox.height,width:t.lastBoundingBox.width},useTranslate3d:t.useTranslate3d,viewBox:t.viewBox}),y=m.cssClasses,x=m.cssProperties,S=t.hasPortalFromProps?{}:am(am({transition:MQ({prefersReducedMotion:a,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},x),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),w=am(am({},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 AQ=R.memo(EQ),O4=()=>{var t;return(t=Bt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function bC(){return bC=Object.assign?Object.assign.bind():function(t){for(var e=1;ewn(t.x)&&wn(t.y),Uk=t=>t.base!=null&&Mw(t.base)&&Mw(t),l0=t=>t.x,c0=t=>t.y,RQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(DP(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=jk["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return jk[n]||eS},Fk={connectNulls:!1,type:"linear"},NQ=t=>{var e=t.type,n=e===void 0?Fk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,o=t.layout,a=t.connectNulls,l=a===void 0?Fk.connectNulls:a,c=RQ(n,o),d=l?i.filter(Mw):i;if(Array.isArray(s)){var f,m=i.map((_,E)=>Dk(Dk({},_),{},{base:s[E]}));o==="vertical"?f=_b().y(c0).x1(l0).x0(_=>_.base.x):f=_b().x(l0).y1(c0).y0(_=>_.base.y);var y=f.defined(Uk).curve(c),x=l?m.filter(Uk):m;return y(x)}var S;o==="vertical"&&It(s)?S=_b().y(c0).x1(l0).x0(s):It(s)?S=_b().x(l0).y1(c0).y0(s):S=c5().x(l0).y(c0);var w=S.defined(Mw).curve(c);return w(d)},V_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Gg();if((!n||!n.length)&&!r)return null;var o={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},a=n&&n.length?NQ(o):r;return R.createElement("path",bC({},za(t),jP(t),{className:er("recharts-curve",e),d:a===null?void 0:a,ref:i}))},IQ=["x","y","top","left","width","height","className"];function _C(){return _C=Object.assign?Object.assign.bind():function(t){for(var e=1;e"M".concat(t,",").concat(i,"v").concat(r,"M").concat(s,",").concat(e,"h").concat(n),zQ=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,i=r===void 0?0:r,s=t.top,o=s===void 0?0:s,a=t.left,l=a===void 0?0:a,c=t.width,d=c===void 0?0:c,f=t.height,m=f===void 0?0:f,y=t.className,x=jQ(t,IQ),S=kQ({x:n,y:i,top:o,left:l,width:d,height:m},x);return!It(n)||!It(i)||!It(d)||!It(m)||!It(o)||!It(l)?null:R.createElement("path",_C({},Ko(S),{className:er("recharts-cross",y),d:FQ(n,i,d,m,o,l)}))};function BQ(t,e,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-i,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}var Ew=1e-4,L4=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],D4=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),Bk=(t,e)=>n=>{var r=L4(t,e);return D4(r,n)},HQ=(t,e)=>n=>{var r=L4(t,e),i=[...r.map((s,o)=>s*o).slice(1),0];return D4(i,n)},VQ=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]]},GQ=function(){for(var e=arguments.length,n=new Array(e),r=0;r{var i=Bk(t,n),s=Bk(e,r),o=HQ(t,n),a=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,m=0;m<8;++m){var y=i(f)-d,x=o(f);if(Math.abs(y-d)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,s=i===void 0?8:i,o=e.dt,a=o===void 0?16.67:o,l=1,c=[0],d=0,f=0,m=1e4,y=0;y{var E,T,C;if(_<=0)return 0;if(_>=1)return l;var O=_*w,N=Math.floor(O),D=O-N;return((E=c[N])!==null&&E!==void 0?E:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((C=c[N])!==null&&C!==void 0?C:0))*D}},XQ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return Hk(t);case"spring":return $Q();default:if(t.split("(")[0]==="cubic-bezier")return Hk(t)}return typeof t=="function"?t:null},qQ=(t,e,n)=>{var r,i=s=>{var o=e.tick(s);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(i,o);return}r=t.setTimeout(i,o)};return r=t.setTimeout(i,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},j4=R.createContext(qQ);j4.Provider;function KQ(t){var e=R.useContext(j4);return R.useMemo(()=>t??e,[t,e])}function YQ(t,e,n){return(e=ZQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZQ(t){var e=QQ(t,"string");return typeof e=="symbol"?e:e+""}function QQ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Vk="init",Gk="pending",Wk="active",JQ="completed";function PE(t){return Math.max(0,t)}class eJ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;YQ(this,"state",Vk),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=PE(e.animationDuration),this.animationBegin=PE(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(n=e.onAnimationStart)===null||n===void 0||n.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===Vk)return this.state=Gk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===Gk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Wk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):PE(this.animationBegin-n)}if(this.getState()===Wk){if(this.animationStartedTime==null)throw new Error;var r=e-this.animationStartedTime;return this.setProgress(r/this.animationDuration),this.nextAnimationUpdate(r)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var e;(e=this.onAnimationEnd)===null||e===void 0||e.call(this)}this.state=JQ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class tJ extends eJ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Fc(this.getFrom(),this.getTo(),this.getProgress()))}}class nJ{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?e(o):i=requestAnimationFrame(s)};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function rJ(t,e){return aJ(t)||oJ(t,e)||sJ(t,e)||iJ()}function iJ(){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 sJ(t,e){if(t){if(typeof t=="string")return $k(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$k(t,e):void 0}}function $k(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{},onAnimationStart:()=>{}},Xk=0,RE=1;function U4(t){var e=Jo(t,lJ),n=e.animationId,r=e.isActive,i=e.canBegin,s=e.duration,o=e.easing,a=e.begin,l=e.onAnimationEnd,c=e.onAnimationStart,d=e.children,f=k4(),m=r==="auto"?!Qy.isSsr&&!f:r,y=KQ(e.animationController),x=R.useState(m?Xk:RE),S=rJ(x,2),w=S[0],_=S[1];return R.useEffect(()=>{m||_(RE)},[m]),R.useEffect(()=>{var E=XQ(o);if(!m||!i||E==null)return Vg;var T=new nJ,C=new tJ({animationId:n,easing:E,animationDuration:s,animationBegin:a,onAnimationStart:c,onAnimationEnd:l,from:Xk,to:RE});return y(T,C,_)},[y,n,m,i,s,o,a,c,l]),d(Number(w))}function F4(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=R.useRef(uy(e)),r=R.useRef(t);return r.current!==t&&(n.current=uy(e),r.current=t),n.current}var cJ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),uJ=(t,e,n)=>t.map(r=>"".concat(cJ(r)," ").concat(e,"ms ").concat(n)).join(","),dJ=["radius"],fJ=["radius"],qk,Kk,Yk,Zk,Qk,Jk,eO,tO,nO,rO;function iO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function sO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var s=xd(n),o=xd(r),a=Math.min(Math.abs(s)/2,Math.abs(o)/2),l=o>=0?1:-1,c=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(a>0&&Array.isArray(i)){for(var m=[0,0,0,0],y=0,x=4;ya?a:w}f=Di(qk||(qk=fl(["M",",",""])),t,e+l*m[0]),m[0]>0&&(f+=Di(Kk||(Kk=fl(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,t+c*m[0],e)),f+=Di(Yk||(Yk=fl(["L ",",",""])),t+n-c*m[1],e),m[1]>0&&(f+=Di(Zk||(Zk=fl(["A ",",",",0,0,",`, + `,",",""])),m[1],m[1],d,t+n,e+l*m[1])),f+=Di(Qk||(Qk=fl(["L ",",",""])),t+n,e+r-l*m[2]),m[2]>0&&(f+=Di(Jk||(Jk=fl(["A ",",",",0,0,",`, + `,",",""])),m[2],m[2],d,t+n-c*m[2],e+r)),f+=Di(eO||(eO=fl(["L ",",",""])),t+c*m[3],e+r),m[3]>0&&(f+=Di(tO||(tO=fl(["A ",",",",0,0,",`, + `,",",""])),m[3],m[3],d,t,e+r-l*m[3])),f+="Z"}else if(a>0&&i===+i&&i>0){var _=Math.min(a,i);f=Di(nO||(nO=fl(["M ",",",` A `,",",",0,0,",",",",",` L `,",",` A `,",",",0,0,",",",",",` L `,",",` A `,",",",0,0,",",",",",` L `,",",` - A `,",",",0,0,",",",","," Z"])),t,e+l*_,_,_,d,t+c*_,e,t+n-c*_,e,_,_,d,t+n,e+l*_,t+n,e+r-l*_,_,_,d,t+n-c*_,e+r,t+c*_,e+r,_,_,d,t,e+r-l*_)}else f=Di(tO||(tO=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"},_J=t=>{var e=Jo(t,aO),n=R.useRef(null),r=R.useState(-1),i=gJ(r,2),s=i[0],o=i[1];R.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var B=n.current.getTotalLength();B&&o(B)}catch{}},[]);var a=e.x,l=e.y,c=e.width,d=e.height,f=e.radius,m=e.className,y=e.animationEasing,x=e.animationDuration,S=e.animationBegin,w=e.isAnimationActive,_=e.isUpdateAnimationActive,E=R.useRef(c),T=R.useRef(d),C=R.useRef(a),O=R.useRef(l),N=R.useMemo(()=>({x:a,y:l,width:c,height:d,radius:f}),[a,l,c,d,f]),D=U4(N,"rectangle-");if(a!==+a||l!==+l||c!==+c||d!==+d||c===0||d===0)return null;var F=er("recharts-rectangle",m);if(!_){var V=Ko(e);V.radius;var k=iO(V,uJ);return R.createElement("path",Ew({},k,{x:xd(a),y:xd(l),width:xd(c),height:xd(d),radius:typeof f=="number"?f:void 0,className:F,d:oO(a,l,c,d,f)}))}var U=E.current,H=T.current,ne=C.current,te=O.current,he="0px ".concat(s===-1?1:s,"px"),oe="".concat(s,"px ").concat(s,"px"),fe=cJ(["strokeDasharray"],x,typeof y=="string"?y:aO.animationEasing);return R.createElement(j4,{animationId:D,key:D,canBegin:s>0,duration:x,easing:y,isActive:_,begin:S},B=>{var q=Fc(U,c,B),K=Fc(H,d,B),$=Fc(ne,a,B),Z=Fc(te,l,B);n.current&&(E.current=q,T.current=K,C.current=$,O.current=Z);var ge;w?B>0?ge={transition:fe,strokeDasharray:oe}:ge={strokeDasharray:he}:ge={strokeDasharray:oe};var le=Ko(e);le.radius;var ue=iO(le,dJ);return R.createElement("path",Ew({},ue,{radius:typeof f=="number"?f:void 0,className:F,d:oO($,Z,q,K,f),ref:n,style:rO(rO({},ge),e.style)}))})};function lO(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 cO(t){for(var e=1;et*180/Math.PI,zi=(t,e,n,r)=>({x:t+Math.cos(-Aw*r)*n,y:e+Math.sin(-Aw*r)*n}),AJ=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},TJ=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},CJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,o=TJ({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var a=(n-i)/o,l=Math.acos(a);return r>s&&(l=2*Math.PI-l),{radius:o,angle:EJ(l),angleInRadian:l}},PJ=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}},RJ=(t,e)=>{var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return t+o*360},NJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=CJ({x:n,y:r},e),s=i.radius,o=i.angle,a=e.innerRadius,l=e.outerRadius;if(sl||s===0)return null;var c=PJ(e),d=c.startAngle,f=c.endAngle,m=o,y;if(d<=f){for(;m>f;)m-=360;for(;m=d&&m<=f}else{for(;m>d;)m-=360;for(;m=f&&m<=d}return y?cO(cO({},e),{},{radius:s,angle:RJ(m,e)}):null};function F4(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,o=zi(e,n,r,i),a=zi(e,n,r,s);return{points:[o,a],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}var uO,dO,fO,hO,pO,mO,gO;function _C(){return _C=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=Wo(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Tb=t=>{var e=t.cx,n=t.cy,r=t.radius,i=t.angle,s=t.sign,o=t.isExternal,a=t.cornerRadius,l=t.cornerIsExternal,c=a*(o?1:-1)+r,d=Math.asin(a/c)/Aw,f=l?i:i+s*d,m=zi(e,n,c,f),y=zi(e,n,r,f),x=l?i-s*d:i,S=zi(e,n,c*Math.cos(d*Aw),x);return{center:m,circleTangency:y,lineTangency:S,theta:d}},z4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,o=t.endAngle,a=IJ(s,o),l=s+a,c=zi(e,n,i,s),d=zi(e,n,i,l),f=Di(uO||(uO=eh(["M ",",",` + A `,",",",0,0,",",",","," Z"])),t,e+l*_,_,_,d,t+c*_,e,t+n-c*_,e,_,_,d,t+n,e+l*_,t+n,e+r-l*_,_,_,d,t+n-c*_,e+r,t+c*_,e+r,_,_,d,t,e+r-l*_)}else f=Di(rO||(rO=fl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},cO={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},wJ=t=>{var e=Jo(t,cO),n=R.useRef(null),r=R.useState(-1),i=vJ(r,2),s=i[0],o=i[1];R.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var B=n.current.getTotalLength();B&&o(B)}catch{}},[]);var a=e.x,l=e.y,c=e.width,d=e.height,f=e.radius,m=e.className,y=e.animationEasing,x=e.animationDuration,S=e.animationBegin,w=e.isAnimationActive,_=e.isUpdateAnimationActive,E=R.useRef(c),T=R.useRef(d),C=R.useRef(a),O=R.useRef(l),N=R.useMemo(()=>({x:a,y:l,width:c,height:d,radius:f}),[a,l,c,d,f]),D=F4(N,"rectangle-");if(a!==+a||l!==+l||c!==+c||d!==+d||c===0||d===0)return null;var F=er("recharts-rectangle",m);if(!_){var G=Ko(e);G.radius;var k=oO(G,dJ);return R.createElement("path",Aw({},k,{x:xd(a),y:xd(l),width:xd(c),height:xd(d),radius:typeof f=="number"?f:void 0,className:F,d:lO(a,l,c,d,f)}))}var U=E.current,H=T.current,ne=C.current,te=O.current,he="0px ".concat(s===-1?1:s,"px"),se="".concat(s,"px ").concat(s,"px"),fe=uJ(["strokeDasharray"],x,typeof y=="string"?y:cO.animationEasing);return R.createElement(U4,{animationId:D,key:D,canBegin:s>0,duration:x,easing:y,isActive:_,begin:S},B=>{var J=Fc(U,c,B),Y=Fc(H,d,B),V=Fc(ne,a,B),q=Fc(te,l,B);n.current&&(E.current=J,T.current=Y,C.current=V,O.current=q);var pe;w?B>0?pe={transition:fe,strokeDasharray:se}:pe={strokeDasharray:he}:pe={strokeDasharray:se};var ae=Ko(e);ae.radius;var le=oO(ae,fJ);return R.createElement("path",Aw({},le,{radius:typeof f=="number"?f:void 0,className:F,d:lO(V,q,J,Y,f),ref:n,style:sO(sO({},pe),e.style)}))})};function uO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function dO(t){for(var e=1;et*180/Math.PI,zi=(t,e,n,r)=>({x:t+Math.cos(-Tw*r)*n,y:e+Math.sin(-Tw*r)*n}),TJ=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},CJ=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},PJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,o=CJ({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var a=(n-i)/o,l=Math.acos(a);return r>s&&(l=2*Math.PI-l),{radius:o,angle:AJ(l),angleInRadian:l}},RJ=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}},NJ=(t,e)=>{var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return t+o*360},IJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=PJ({x:n,y:r},e),s=i.radius,o=i.angle,a=e.innerRadius,l=e.outerRadius;if(sl||s===0)return null;var c=RJ(e),d=c.startAngle,f=c.endAngle,m=o,y;if(d<=f){for(;m>f;)m-=360;for(;m=d&&m<=f}else{for(;m>d;)m-=360;for(;m=f&&m<=d}return y?dO(dO({},e),{},{radius:s,angle:NJ(m,e)}):null};function z4(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,o=zi(e,n,r,i),a=zi(e,n,r,s);return{points:[o,a],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}var fO,hO,pO,mO,gO,vO,yO;function wC(){return wC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=Wo(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Pb=t=>{var e=t.cx,n=t.cy,r=t.radius,i=t.angle,s=t.sign,o=t.isExternal,a=t.cornerRadius,l=t.cornerIsExternal,c=a*(o?1:-1)+r,d=Math.asin(a/c)/Tw,f=l?i:i+s*d,m=zi(e,n,c,f),y=zi(e,n,r,f),x=l?i-s*d:i,S=zi(e,n,c*Math.cos(d*Tw),x);return{center:m,circleTangency:y,lineTangency:S,theta:d}},B4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,o=t.endAngle,a=kJ(s,o),l=s+a,c=zi(e,n,i,s),d=zi(e,n,i,l),f=Di(fO||(fO=eh(["M ",",",` A `,",",`,0, `,",",`, `,",",` - `])),c.x,c.y,i,i,+(Math.abs(a)>180),+(s>l),d.x,d.y);if(r>0){var m=zi(e,n,r,s),y=zi(e,n,r,l);f+=Di(dO||(dO=eh(["L ",",",` + `])),c.x,c.y,i,i,+(Math.abs(a)>180),+(s>l),d.x,d.y);if(r>0){var m=zi(e,n,r,s),y=zi(e,n,r,l);f+=Di(hO||(hO=eh(["L ",",",` A `,",",`,0, `,",",`, - `,","," Z"])),y.x,y.y,r,r,+(Math.abs(a)>180),+(s<=l),m.x,m.y)}else f+=Di(fO||(fO=eh(["L ",","," Z"])),e,n);return f},kJ=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,o=t.forceCornerRadius,a=t.cornerIsExternal,l=t.startAngle,c=t.endAngle,d=Wo(c-l),f=Tb({cx:e,cy:n,radius:i,angle:l,sign:d,cornerRadius:s,cornerIsExternal:a}),m=f.circleTangency,y=f.lineTangency,x=f.theta,S=Tb({cx:e,cy:n,radius:i,angle:c,sign:-d,cornerRadius:s,cornerIsExternal:a}),w=S.circleTangency,_=S.lineTangency,E=S.theta,T=a?Math.abs(l-c):Math.abs(l-c)-x-E;if(T<0)return o?Di(hO||(hO=eh(["M ",",",` + `,","," Z"])),y.x,y.y,r,r,+(Math.abs(a)>180),+(s<=l),m.x,m.y)}else f+=Di(pO||(pO=eh(["L ",","," Z"])),e,n);return f},OJ=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,o=t.forceCornerRadius,a=t.cornerIsExternal,l=t.startAngle,c=t.endAngle,d=Wo(c-l),f=Pb({cx:e,cy:n,radius:i,angle:l,sign:d,cornerRadius:s,cornerIsExternal:a}),m=f.circleTangency,y=f.lineTangency,x=f.theta,S=Pb({cx:e,cy:n,radius:i,angle:c,sign:-d,cornerRadius:s,cornerIsExternal:a}),w=S.circleTangency,_=S.lineTangency,E=S.theta,T=a?Math.abs(l-c):Math.abs(l-c)-x-E;if(T<0)return o?Di(mO||(mO=eh(["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 C=Di(pO||(pO=eh(["M ",",",` + `])),y.x,y.y,s,s,s*2,s,s,-s*2):B4({cx:e,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var C=Di(gO||(gO=eh(["M ",",",` A`,",",",0,0,",",",",",` A`,",",",0,",",",",",",",` A`,",",",0,0,",",",",",` - `])),y.x,y.y,s,s,+(d<0),m.x,m.y,i,i,+(T>180),+(d<0),w.x,w.y,s,s,+(d<0),_.x,_.y);if(r>0){var O=Tb({cx:e,cy:n,radius:r,angle:l,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),N=O.circleTangency,D=O.lineTangency,F=O.theta,V=Tb({cx:e,cy:n,radius:r,angle:c,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),k=V.circleTangency,U=V.lineTangency,H=V.theta,ne=a?Math.abs(l-c):Math.abs(l-c)-F-H;if(ne<0&&s===0)return"".concat(C,"L").concat(e,",").concat(n,"Z");C+=Di(mO||(mO=eh(["L",",",` + `])),y.x,y.y,s,s,+(d<0),m.x,m.y,i,i,+(T>180),+(d<0),w.x,w.y,s,s,+(d<0),_.x,_.y);if(r>0){var O=Pb({cx:e,cy:n,radius:r,angle:l,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),N=O.circleTangency,D=O.lineTangency,F=O.theta,G=Pb({cx:e,cy:n,radius:r,angle:c,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),k=G.circleTangency,U=G.lineTangency,H=G.theta,ne=a?Math.abs(l-c):Math.abs(l-c)-F-H;if(ne<0&&s===0)return"".concat(C,"L").concat(e,",").concat(n,"Z");C+=Di(vO||(vO=eh(["L",",",` A`,",",",0,0,",",",",",` A`,",",",0,",",",",",",",` - A`,",",",0,0,",",",",","Z"])),U.x,U.y,s,s,+(d<0),k.x,k.y,r,r,+(ne>180),+(d>0),N.x,N.y,s,s,+(d<0),D.x,D.y)}else C+=Di(gO||(gO=eh(["L",",","Z"])),e,n);return C},OJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},LJ=t=>{var e=Jo(t,OJ),n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,o=e.cornerRadius,a=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,d=e.endAngle,f=e.className;if(s0&&Math.abs(c-d)<360?S=kJ({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:a,cornerIsExternal:l,startAngle:c,endAngle:d}):S=z4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),R.createElement("path",_C({},Ko(e),{className:m,d:S}))};function DJ(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,o=e.outerRadius,a=e.angle,l=zi(r,i,s,a),c=zi(r,i,o,a);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return F4(e)}}function jJ(t){return L5(t)?NaN:Number(t)}function RE(t){return t?(t=jJ(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"&&tC(t,e,n)&&(e=n=void 0),t=RE(t),e===void 0?(e=t,t=0):e=RE(e),n=n===void 0?tt.chartData,YP=ke([$a],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?YP(t):$a(t),UJ=(t,e,n)=>n?YP(t):$a(t),FJ=ke([_S],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});ke([YP],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var zJ=ke([$a],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function ZP(t,e){return GJ(t)||VJ(t,e)||HJ(t,e)||BJ()}function BJ(){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 HJ(t,e){if(t){if(typeof t=="string")return vO(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)?vO(t,e):void 0}}function vO(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};Ct.decimalPlaces=Ct.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};Ct.dividedBy=Ct.div=function(t){return Gc(this,new this.constructor(t))};Ct.dividedToIntegerBy=Ct.idiv=function(t){var e=this,n=e.constructor;return Yn(Gc(e,new n(t),0,1),n.precision)};Ct.equals=Ct.eq=function(t){return!this.cmp(t)};Ct.exponent=function(){return Vr(this)};Ct.greaterThan=Ct.gt=function(t){return this.cmp(t)>0};Ct.greaterThanOrEqualTo=Ct.gte=function(t){return this.cmp(t)>=0};Ct.isInteger=Ct.isint=function(){return this.e>this.d.length-2};Ct.isNegative=Ct.isneg=function(){return this.s<0};Ct.isPositive=Ct.ispos=function(){return this.s>0};Ct.isZero=function(){return this.s===0};Ct.lessThan=Ct.lt=function(t){return this.cmp(t)<0};Ct.lessThanOrEqualTo=Ct.lte=function(t){return this.cmp(t)<1};Ct.logarithm=Ct.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(yo))throw Error(Zo+"NaN");if(n.s<1)throw Error(Zo+(n.s?"NaN":"-Infinity"));return n.eq(yo)?new r(0):(ur=!1,e=Gc(my(n,s),my(t,s),s),ur=!0,Yn(e,i))};Ct.minus=Ct.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))};Ct.modulo=Ct.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(Zo+"NaN");return n.s?(ur=!1,e=Gc(n,t,0,1).times(t),ur=!0,n.minus(e)):Yn(new r(n),i)};Ct.naturalExponential=Ct.exp=function(){return W4(this)};Ct.naturalLogarithm=Ct.ln=function(){return my(this)};Ct.negated=Ct.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Ct.plus=Ct.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))};Ct.precision=Ct.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(_h+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};Ct.squareRoot=Ct.sqrt=function(){var t,e,n,r,i,s,o,a=this,l=a.constructor;if(a.s<1){if(!a.s)return new l(0);throw Error(Zo+"NaN")}for(t=Vr(a),ur=!1,i=Math.sqrt(+a),i==0||i==1/0?(e=Sl(a.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=$g((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=o=n+3;;)if(s=r,r=s.plus(Gc(a,s,o+2)).times(.5),Sl(s.d).slice(0,o)===(e=Sl(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(Yn(s,n+1,0),s.times(s).eq(a)){r=s;break}}else if(e!="9999")break;o+=4}return ur=!0,Yn(r,n)};Ct.times=Ct.mul=function(t){var e,n,r,i,s,o,a,l,c,d=this,f=d.constructor,m=d.d,y=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=m.length,c=y.length,l=0;){for(e=0,i=l+r;i>r;)a=s[i]+y[r]*m[i-r-1]+e,s[i--]=a%vi|0,e=a/vi|0;s[i]=(s[i]+e)%vi|0}for(;!s[--o];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,ur?Yn(t,f.precision):t};Ct.toDecimalPlaces=Ct.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Dl(t,0,Wg),e===void 0?e=r.rounding:Dl(e,0,8),Yn(n,t+Vr(n)+1,e))};Ct.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Oh(r,!0):(Dl(t,0,Wg),e===void 0?e=i.rounding:Dl(e,0,8),r=Yn(new i(r),t+1,e),n=Oh(r,!0,t+1)),n};Ct.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Oh(i):(Dl(t,0,Wg),e===void 0?e=s.rounding:Dl(e,0,8),r=Yn(new s(i),t+Vr(i)+1,e),n=Oh(r.abs(),!1,t+Vr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Ct.toInteger=Ct.toint=function(){var t=this,e=t.constructor;return Yn(new e(t),Vr(t)+1,e.rounding)};Ct.toNumber=function(){return+this};Ct.toPower=Ct.pow=function(t){var e,n,r,i,s,o,a=this,l=a.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(yo);if(a=new l(a),!a.s){if(t.s<1)throw Error(Zo+"Infinity");return a}if(a.eq(yo))return a;if(r=l.precision,t.eq(yo))return Yn(a,r);if(e=t.e,n=t.d.length-1,o=e>=n,s=a.s,o){if((n=d<0?-d:d)<=V4){for(i=new l(yo),e=Math.ceil(r/or+4),ur=!1;n%2&&(i=i.times(a),bO(i.d,e)),n=$g(n/2),n!==0;)a=a.times(a),bO(a.d,e);return ur=!0,t.s<0?new l(yo).div(i):Yn(i,r)}}else if(s<0)throw Error(Zo+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,a.s=1,ur=!1,i=t.times(my(a,r+c)),ur=!0,i=W4(i),i.s=s,i};Ct.toPrecision=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?(n=Vr(i),r=Oh(i,n<=s.toExpNeg||n>=s.toExpPos)):(Dl(t,1,Wg),e===void 0?e=s.rounding:Dl(e,0,8),i=Yn(new s(i),t,e),n=Vr(i),r=Oh(i,t<=n||n<=s.toExpNeg,t)),r};Ct.toSignificantDigits=Ct.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Dl(t,1,Wg),e===void 0?e=r.rounding:Dl(e,0,8)),Yn(new r(n),t,e)};Ct.toString=Ct.valueOf=Ct.val=Ct.toJSON=Ct[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Vr(t),n=t.constructor;return Oh(t,e<=n.toExpNeg||e>=n.toExpPos)};function G4(t,e){var n,r,i,s,o,a,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),ur?Yn(e,f):e;if(l=t.d,c=e.d,o=t.e,i=e.e,l=l.slice(),s=o-i,s){for(s<0?(r=l,s=-s,a=c.length):(r=c,i=o,a=l.length),o=Math.ceil(f/or),a=o>a?o+1:a+1,s>a&&(s=a,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(a=l.length,s=c.length,a-s<0&&(s=a,r=c,c=l,l=r),n=0;s;)n=(l[--s]=l[s]+c[s]+n)/vi|0,l[s]%=vi;for(n&&(l.unshift(n),++i),a=l.length;l[--a]==0;)l.pop();return e.d=l,e.e=i,ur?Yn(e,f):e}function Dl(t,e,n){if(t!==~~t||tn)throw Error(_h+t)}function Sl(t){var e,n,r,i=t.length-1,s="",o=t[0];if(i>0){for(s+=o,e=1;eo?1:-1;else for(a=l=0;ai[a]?1:-1;break}return l}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var a,l,c,d,f,m,y,x,S,w,_,E,T,C,O,N,D,F,V=r.constructor,k=r.s==i.s?1:-1,U=r.d,H=i.d;if(!r.s)return new V(r);if(!i.s)throw Error(Zo+"Division by zero");for(l=r.e-i.e,D=H.length,O=U.length,y=new V(k),x=y.d=[],c=0;H[c]==(U[c]||0);)++c;if(H[c]>(U[c]||0)&&--l,s==null?E=s=V.precision:o?E=s+(Vr(r)-Vr(i))+1:E=s,E<0)return new V(0);if(E=E/or+2|0,c=0,D==1)for(d=0,H=H[0],E++;(c1&&(H=t(H,d),U=t(U,d),D=H.length,O=U.length),C=D,S=U.slice(0,D),w=S.length;w=vi/2&&++N;do d=0,a=e(H,S,D,w),a<0?(_=S[0],D!=w&&(_=_*vi+(S[1]||0)),d=_/N|0,d>1?(d>=vi&&(d=vi-1),f=t(H,d),m=f.length,w=S.length,a=e(f,S,m,w),a==1&&(d--,n(f,D16)throw Error(QP+Vr(t));if(!t.s)return new d(yo);for(ur=!1,a=f,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),c+=5;for(r=Math.log($f(2,c))/Math.LN10*2+5|0,a+=r,n=i=s=new d(yo),d.precision=a;;){if(i=Yn(i.times(t),a),n=n.times(++l),o=s.plus(Gc(i,n,a)),Sl(o.d).slice(0,a)===Sl(s.d).slice(0,a)){for(;c--;)s=Yn(s.times(s),a);return d.precision=f,e==null?(ur=!0,Yn(s,f)):s}s=o}}function Vr(t){for(var e=t.e*or,n=t.d[0];n>=10;n/=10)e++;return e}function NE(t,e,n){if(e>t.LN10.sd())throw ur=!0,n&&(t.precision=n),Error(Zo+"LN10 precision limit exceeded");return Yn(new t(t.LN10),e)}function ad(t){for(var e="";t--;)e+="0";return e}function my(t,e){var n,r,i,s,o,a,l,c,d,f=1,m=10,y=t,x=y.d,S=y.constructor,w=S.precision;if(y.s<1)throw Error(Zo+(y.s?"NaN":"-Infinity"));if(y.eq(yo))return new S(0);if(e==null?(ur=!1,c=w):c=e,y.eq(10))return e==null&&(ur=!0),NE(S,c);if(c+=m,S.precision=c,n=Sl(x),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=NE(S,c+2,w).times(s+""),y=my(new S(r+"."+n.slice(1)),c-m).plus(l),S.precision=w,e==null?(ur=!0,Yn(y,w)):y;for(a=o=y=Gc(y.minus(yo),y.plus(yo),c),d=Yn(y.times(y),c),i=3;;){if(o=Yn(o.times(d),c),l=a.plus(Gc(o,new S(i),c)),Sl(l.d).slice(0,c)===Sl(a.d).slice(0,c))return a=a.times(2),s!==0&&(a=a.plus(NE(S,c+2,w).times(s+""))),a=Gc(a,new S(f),c),S.precision=w,e==null?(ur=!0,Yn(a,w)):a;a=l,i+=2}}function xO(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=$g(n/or),t.d=[],r=(n+1)%or,n<0&&(r+=or),rTw||t.e<-Tw))throw Error(QP+n)}else t.s=0,t.e=0,t.d=[0];return t}function Yn(t,e,n){var r,i,s,o,a,l,c,d,f=t.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=e-o,r<0)r+=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],o=1;s>=10;s/=10)o++;r%=or,i=r-or+o}if(n!==void 0&&(s=$f(10,o-i-1),a=c/s%10|0,l=e<0||f[d+1]!==void 0||c%s,l=n<4?(a||l)&&(n==0||n==(t.s<0?3:2)):a>5||a==5&&(n==4||l||n==6&&(r>0?i>0?c/$f(10,o-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=Vr(t),f.length=1,e=e-s-1,f[0]=$f(10,(or-e%or)%or),t.e=$g(-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=$f(10,or-r),f[d]=i>0?(c/$f(10,o-i)%$f(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(ur&&(t.e>Tw||t.e<-Tw))throw Error(QP+Vr(t));return t}function $4(t,e){var n,r,i,s,o,a,l,c,d,f,m=t.constructor,y=m.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new m(t),ur?Yn(e,y):e;if(l=t.d,f=e.d,r=e.e,c=t.e,l=l.slice(),o=c-r,o){for(d=o<0,d?(n=l,o=-o,a=f.length):(n=f,r=c,a=l.length),i=Math.max(Math.ceil(y/or),a)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=l.length,a=f.length,d=i0;--i)l[a++]=0;for(i=f.length;i>o;){if(l[--i]0?s=s.charAt(0)+"."+s.slice(1)+ad(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ad(-i-1)+s,n&&(r=n-o)>0&&(s+=ad(r))):i>=o?(s+=ad(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ad(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ad(r))),t.s<0?"-"+s:s}function bO(t,e){if(t.length>e)return t.length=e,!0}function X4(t){var e,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(_h+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return xO(o,s.toString())}else if(typeof s!="string")throw Error(_h+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,XJ.test(s))xO(o,s);else throw Error(_h+s)}if(i.prototype=Ct,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=qJ,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(_h+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(_h+n+": "+r);return this}var JP=X4($J);yo=new JP(1);const Tn=JP;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 gy(t,e){return QJ(t)||ZJ(t,e)||YJ(t,e)||KJ()}function KJ(){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 _O(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)?_O(t,e):void 0}}function _O(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=gy(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]},e2=(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),o=r!==1?.05:.1,a=new Tn(Math.ceil(s.div(o).toNumber())).add(n).mul(o),l=a.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(),o=Math.floor(new Tn(s).abs().log(10).toNumber()),a=new Tn(10).pow(o),l=t.div(a).toNumber(),c=i.findIndex(y=>y>=l-1e-10);if(c===-1&&(a=a.mul(10),c=0),c+=n,c>=i.length){var d=Math.floor(c/i.length);c%=i.length,a=a.mul(new Tn(10).pow(d))}var f=(r=i[c])!==null&&r!==void 0?r:1,m=new Tn(f).mul(a);return e?m:new Tn(Math.ceil(m.toNumber()))},JJ=(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 o=Math.floor((e-1)/2),a=[],l=0;l4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:e2;if(!Number.isFinite((n-e)/(r-1)))return{step:new Tn(0),tickMin:new Tn(0),tickMax:new Tn(0)};var a=o(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(a)));var c=Math.ceil(l.sub(e).div(a).toNumber()),d=Math.ceil(new Tn(n).sub(l).div(a).toNumber()),f=c+d+1;return f>r?Q4(e,n,r,i,s+1,o):(f0?d+(r-f):d,c=n>0?c:c+(r-f)),{step:a,tickMin:l.sub(new Tn(c).mul(a)),tickMax:l.add(new Tn(d).mul(a))})},wO=function(e){var n=gy(e,2),r=n[0],i=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),c=Y4([r,i]),d=gy(c,2),f=d[0],m=d[1];if(f===-1/0||m===1/0){var y=m===1/0?[f,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),m];return r>i?y.reverse():y}if(f===m)return JJ(f,s,o);var x=a==="snap125"?Z4:e2,S=Q4(f,m,l,o,0,x),w=S.step,_=S.tickMin,E=S.tickMax,T=K4(_,E.add(new Tn(.1).mul(w)),w);return r>i?T.reverse():T},SO=function(e,n){var r=gy(e,2),i=r[0],s=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Y4([i,s]),c=gy(l,2),d=c[0],f=c[1];if(d===-1/0||f===1/0)return[i,s];if(d===f)return[d];var m=a==="snap125"?Z4:e2,y=Math.max(n,2),x=m(new Tn(f).sub(d).div(y-1),o,0),S=[...K4(new Tn(d),new Tn(f),x),f];return o===!1&&(S=S.map(w=>Math.round(w))),i>s?S.reverse():S},eee=t=>t.rootProps.barCategoryGap,wS=t=>t.rootProps.stackOffset,J4=t=>t.rootProps.reverseStackOrder,t2=t=>t.options.chartName,n2=t=>t.rootProps.syncId,ez=t=>t.rootProps.syncMethod,r2=t=>t.options.eventEmitter,tee=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},wf={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},hl={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},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 Bl(t,e)?"category":"number"}function MO(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]},i2=ke([see,M4],(t,e)=>{var n;if(t!=null)return t;var r=(n=MS(e,"angleAxis",EO.type))!==null&&n!==void 0?n:"category";return Cw(Cw({},EO),{},{type:r})}),oee=(t,e)=>t.polarAxis.radiusAxis[e],s2=ke([oee,M4],(t,e)=>{var n;if(t!=null)return t;var r=(n=MS(e,"radiusAxis",AO.type))!==null&&n!==void 0?n:"category";return Cw(Cw({},AO),{},{type:r})}),ES=t=>t.polarOptions,o2=ke([tu,nu,Gi],AJ),tz=ke([ES,o2],(t,e)=>{if(t!=null)return Ad(t.innerRadius,e,0)}),nz=ke([ES,o2],(t,e)=>{if(t!=null)return Ad(t.outerRadius,e,e*.8)}),aee=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},rz=ke([ES],aee);ke([i2,rz],SS);var iz=ke([o2,tz,nz],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});ke([s2,iz],SS);var sz=ke([fr,ES,tz,nz,tu,nu],(t,e,n,r,i,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var o=e.cx,a=e.cy,l=e.startAngle,c=e.endAngle;return{cx:Ad(o,i,i/2),cy:Ad(a,s,s/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),bi=(t,e)=>e,AS=(t,e,n)=>n;function a2(t){return t==null?void 0:t.id}function oz(t,e,n){var r=e.chartData,i=r===void 0?[]:r,s=n.allowDuplicatedCategory,o=n.dataKey,a=new Map;return t.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:i;if(!(d==null||d.length===0)){var f=a2(l);d.forEach((m,y)=>{var x=o==null||s?y:String(yi(m,o,null)),S=yi(m,l.dataKey,0),w;a.has(x)?w=a.get(x):w={},Object.assign(w,{[f]:S}),a.set(x,w)})}}),Array.from(a.values())}function l2(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 CS(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function lee(t,e){if(t.length===e.length){for(var n=0;n{var e=fr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Xg=t=>t.tooltip.settings.axisId;function c2(t){if(t!=null){var e=t.ticks,n=t.bandwidth,r=t.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>t.domain(),range:(function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],a=i[1];return o<=a?s>=o&&s<=a:s>=a&&s<=o},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,o)=>{var a=t(s);if(a!=null){if(t.bandwidth&&o!==null&&o!==void 0&&o.position){var l=t.bandwidth();switch(o.position){case"middle":a+=l/2;break;case"end":a+=l;break}}return a}}}}}var cee=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!Tl(e)){for(var n,r,i=0;ir)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return e}default:return e}};function wd(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function uee(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function u2(t){let e,n,r;t.length!==2?(e=wd,n=(a,l)=>wd(t(a),l),r=(a,l)=>t(a)-l):(e=t===wd||t===uee?t:dee,n=t,r=t);function i(a,l,c=0,d=a.length){if(c>>1;n(a[f],l)<0?c=f+1:d=f}while(c>>1;n(a[f],l)<=0?c=f+1:d=f}while(cc&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function dee(){return 0}function az(t){return t===null?NaN:+t}function*fee(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const hee=u2(wd),Zy=hee.right;u2(az).center;class TO extends Map{constructor(e,n=gee){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(CO(this,e))}has(e){return super.has(CO(this,e))}set(e,n){return super.set(pee(this,e),n)}delete(e){return super.delete(mee(this,e))}}function CO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function pee({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function mee({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function gee(t){return t!==null&&typeof t=="object"?t.valueOf():t}function vee(t=wd){if(t===wd)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 yee=Math.sqrt(50),xee=Math.sqrt(10),bee=Math.sqrt(2);function Pw(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=yee?10:s>=xee?5:s>=bee?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/o,a=Math.round(t*c),l=Math.round(e*c),a/ce&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(t/c),l=Math.round(e/c),a*ce&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let c=0;c=r)&&(n=r);return n}function RO(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:vee(i);r>n;){if(r-n>600){const l=r-n+1,c=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),y=Math.max(n,Math.floor(e-c*f/l+m)),x=Math.min(r,Math.floor(e+(l-c)*f/l+m));cz(t,e,y,x,i)}const s=t[e];let o=n,a=r;for(u0(t,n,e),i(t[r],s)>0&&u0(t,n,r);o0;)--a}i(t[n],s)===0?u0(t,n,a):(++a,u0(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function u0(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function _ee(t,e,n){if(t=Float64Array.from(fee(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return RO(t);if(e>=1)return PO(t);var r,i=(r-1)*e,s=Math.floor(i),o=PO(cz(t,s).subarray(0,s+1)),a=RO(t.subarray(s+1));return o+(a-o)*(i-s)}}function wee(t,e,n=az){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,s=Math.floor(i),o=+n(t[s],s,t),a=+n(t[s+1],s+1,t);return o+(a-o)*(i-s)}}function See(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?Cb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Cb(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=Aee.exec(t))?new Zs(e[1],e[2],e[3],1):(e=Tee.exec(t))?new Zs(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Cee.exec(t))?Cb(e[1],e[2],e[3],e[4]):(e=Pee.exec(t))?Cb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Ree.exec(t))?jO(e[1],e[2]/100,e[3]/100,1):(e=Nee.exec(t))?jO(e[1],e[2]/100,e[3]/100,e[4]):NO.hasOwnProperty(t)?OO(NO[t]):t==="transparent"?new Zs(NaN,NaN,NaN,0):null}function OO(t){return new Zs(t>>16&255,t>>8&255,t&255,1)}function Cb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Zs(t,e,n,r)}function Oee(t){return t instanceof Qy||(t=xy(t)),t?(t=t.rgb(),new Zs(t.r,t.g,t.b,t.opacity)):new Zs}function AC(t,e,n,r){return arguments.length===1?Oee(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}h2(Zs,AC,dz(Qy,{brighter(t){return t=t==null?Rw:Math.pow(Rw,t),new Zs(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?vy:Math.pow(vy,t),new Zs(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Zs(wh(this.r),wh(this.g),wh(this.b),Nw(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:LO,formatHex:LO,formatHex8:Lee,formatRgb:DO,toString:DO}));function LO(){return`#${th(this.r)}${th(this.g)}${th(this.b)}`}function Lee(){return`#${th(this.r)}${th(this.g)}${th(this.b)}${th((isNaN(this.opacity)?1:this.opacity)*255)}`}function DO(){const t=Nw(this.opacity);return`${t===1?"rgb(":"rgba("}${wh(this.r)}, ${wh(this.g)}, ${wh(this.b)}${t===1?")":`, ${t})`}`}function Nw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function wh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function th(t){return t=wh(t),(t<16?"0":"")+t.toString(16)}function jO(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Fa(t,e,n,r)}function fz(t){if(t instanceof Fa)return new Fa(t.h,t.s,t.l,t.opacity);if(t instanceof Qy||(t=xy(t)),!t)return new Fa;if(t instanceof Fa)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n0&&l<1?0:o,new Fa(o,a,l,t.opacity)}function Dee(t,e,n,r){return arguments.length===1?fz(t):new Fa(t,e,n,r??1)}function Fa(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}h2(Fa,Dee,dz(Qy,{brighter(t){return t=t==null?Rw:Math.pow(Rw,t),new Fa(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?vy:Math.pow(vy,t),new Fa(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(IE(t>=240?t-240:t+120,i,r),IE(t,i,r),IE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Fa(UO(this.h),Pb(this.s),Pb(this.l),Nw(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=Nw(this.opacity);return`${t===1?"hsl(":"hsla("}${UO(this.h)}, ${Pb(this.s)*100}%, ${Pb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function UO(t){return t=(t||0)%360,t<0?t+360:t}function Pb(t){return Math.max(0,Math.min(1,t||0))}function IE(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 p2=t=>()=>t;function jee(t,e){return function(n){return t+n*e}}function Uee(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 Fee(t){return(t=+t)==1?hz:function(e,n){return n-e?Uee(e,n,t):p2(isNaN(e)?n:e)}}function hz(t,e){var n=e-t;return n?jee(t,n):p2(isNaN(t)?e:t)}const FO=(function t(e){var n=Fee(e);function r(i,s){var o=n((i=AC(i)).r,(s=AC(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=hz(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=a(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=t,r})(1);function zee(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;in&&(s=e.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:Iw(r,i)})),n=kE.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function Zee(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i2?Qee:Zee,l=c=null,f}function f(m){return m==null||isNaN(m=+m)?s:(l||(l=a(t.map(r),e,n)))(r(o(m)))}return f.invert=function(m){return o(i((c||(c=a(e,t.map(r),Iw)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,kw),d()):t.slice()},f.range=function(m){return arguments.length?(e=Array.from(m),d()):e.slice()},f.rangeRound=function(m){return e=Array.from(m),n=m2,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Es,d()):o!==Es},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(s=m,f):s},function(m,y){return r=m,i=y,d()}}function g2(){return PS()(Es,Es)}function Jee(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Ow(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Tg(t){return t=Ow(Math.abs(t)),t?t[1]:NaN}function ete(t,e){return function(n,r){for(var i=n.length,s=[],o=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=t[o=(o+1)%t.length];return s.reverse().join(e)}}function tte(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var nte=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function by(t){if(!(e=nte.exec(t)))throw new Error("invalid format: "+t);var e;return new v2({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]})}by.prototype=v2.prototype;function v2(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+""}v2.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 rte(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 Lw;function ite(t,e){var n=Ow(t,e);if(!n)return Lw=void 0,t.toPrecision(e);var r=n[0],i=n[1],s=i-(Lw=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Ow(t,Math.max(0,e+s-1))[0]}function BO(t,e){var n=Ow(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 HO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Jee,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)=>BO(t*100,e),r:BO,s:ite,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function VO(t){return t}var GO=Array.prototype.map,WO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ste(t){var e=t.grouping===void 0||t.thousands===void 0?VO:ete(GO.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?VO:tte(GO.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f,m){f=by(f);var y=f.fill,x=f.align,S=f.sign,w=f.symbol,_=f.zero,E=f.width,T=f.comma,C=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):HO[N]||(C===void 0&&(C=12),O=!0,N="g"),(_||y==="0"&&x==="=")&&(_=!0,y="0",x="=");var D=(m&&m.prefix!==void 0?m.prefix:"")+(w==="$"?n:w==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),F=(w==="$"?r:/[%p]/.test(N)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),V=HO[N],k=/[defgprs%]/.test(N);C=C===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function U(H){var ne=D,te=F,he,oe,fe;if(N==="c")te=V(H)+te,H="";else{H=+H;var B=H<0||1/H<0;if(H=isNaN(H)?l:V(Math.abs(H),C),O&&(H=rte(H)),B&&+H==0&&S!=="+"&&(B=!1),ne=(B?S==="("?S:a:S==="-"||S==="("?"":S)+ne,te=(N==="s"&&!isNaN(H)&&Lw!==void 0?WO[8+Lw/3]:"")+te+(B&&S==="("?")":""),k){for(he=-1,oe=H.length;++hefe||fe>57){te=(fe===46?i+H.slice(he+1):H.slice(he))+te,H=H.slice(0,he);break}}}T&&!_&&(H=e(H,1/0));var q=ne.length+H.length+te.length,K=q>1)+ne+H+te+K.slice(q);break;default:H=K+ne+H+te;break}return s(H)}return U.toString=function(){return f+""},U}function d(f,m){var y=Math.max(-8,Math.min(8,Math.floor(Tg(m)/3)))*3,x=Math.pow(10,-y),S=c((f=by(f),f.type="f",f),{suffix:WO[8+y/3]});return function(w){return S(x*w)}}return{format:c,formatPrefix:d}}var Rb,y2,pz;ote({thousands:",",grouping:[3],currency:["$",""]});function ote(t){return Rb=ste(t),y2=Rb.format,pz=Rb.formatPrefix,Rb}function ate(t){return Math.max(0,-Tg(Math.abs(t)))}function lte(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Tg(e)/3)))*3-Tg(Math.abs(t)))}function cte(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Tg(e)-Tg(t))+1}function mz(t,e,n,r){var i=MC(t,e,n),s;switch(r=by(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=lte(i,o))&&(r.precision=s),pz(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=cte(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=ate(i))&&(r.precision=s-(r.type==="%")*2);break}}return y2(r)}function Rd(t){var e=t.domain;return t.ticks=function(n){var r=e();return wC(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,o=r[i],a=r[s],l,c,d=10;for(a0;){if(c=SC(o,a,n),c===l)return r[i]=o,r[s]=a,e(r);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return t},t}function gz(){var t=g2();return t.copy=function(){return Jy(t,gz())},ea.apply(t,arguments),Rd(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,kw),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,kw):[0,1],Rd(n)}function yz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return sMath.pow(t,e)}function pte(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 qO(t){return(e,n)=>-t(-e,n)}function x2(t){const e=t($O,XO),n=e.domain;let r=10,i,s;function o(){return i=pte(r),s=hte(r),n()[0]<0?(i=qO(i),s=qO(s),t(ute,dte)):t($O,XO),e}return e.base=function(a){return arguments.length?(r=+a,o()):r},e.domain=function(a){return arguments.length?(n(a),o()):n()},e.ticks=a=>{const l=n();let c=l[0],d=l[l.length-1];const f=d0){for(;m<=y;++m)for(x=1;xd)break;_.push(S)}}else for(;m<=y;++m)for(x=r-1;x>=1;--x)if(S=m>0?x/s(-m):x*s(m),!(Sd)break;_.push(S)}_.length*2{if(a==null&&(a=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=by(l)).precision==null&&(l.trim=!0),l=y2(l)),a===1/0)return l;const c=Math.max(1,r*a/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(yz(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),e}function xz(){const t=x2(PS()).domain([1,10]);return t.copy=()=>Jy(t,xz()).base(t.base()),ea.apply(t,arguments),t}function KO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function YO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function b2(t){var e=1,n=t(KO(e),YO(e));return n.constant=function(r){return arguments.length?t(KO(e=+r),YO(e)):e},Rd(n)}function bz(){var t=b2(PS());return t.copy=function(){return Jy(t,bz()).constant(t.constant())},ea.apply(t,arguments)}function ZO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function mte(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function gte(t){return t<0?-t*t:t*t}function _2(t){var e=t(Es,Es),n=1;function r(){return n===1?t(Es,Es):n===.5?t(mte,gte):t(ZO(n),ZO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Rd(e)}function w2(){var t=_2(PS());return t.copy=function(){return Jy(t,w2()).exponent(t.exponent())},ea.apply(t,arguments),t}function vte(){return w2.apply(null,arguments).exponent(.5)}function QO(t){return Math.sign(t)*t*t}function yte(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function _z(){var t=g2(),e=[0,1],n=!1,r;function i(s){var o=yte(t(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return t.invert(QO(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,kw)).map(QO)),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)},ea.apply(i,arguments),Rd(i)}function wz(){var t=[],e=[],n=[],r;function i(){var o=0,a=Math.max(1,e.length);for(n=new Array(a-1);++o0?n[a-1]:t[0],a=n?[r[n-1],e]:[r[c-1],r[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Sz().domain([t,e]).range(i).unknown(s)},ea.apply(Rd(o),arguments)}function Mz(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[Zy(t,s,0,r)]:n}return i.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var o=e.indexOf(s);return[t[o-1],t[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return Mz().domain(t).range(e).unknown(n)},ea.apply(i,arguments)}const OE=new Date,LE=new Date;function oi(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const o=i(s),a=i.ceil(s);return s-o(e(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,a)=>{const l=[];if(s=i.ceil(s),a=a==null?1:Math.floor(a),!(s0))return l;let c;do l.push(c=new Date(+s)),e(s,a),t(s);while(coi(o=>{if(o>=o)for(;t(o),!s(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;e(o,-1),!s(o););else for(;--a>=0;)for(;e(o,1),!s(o););}),n&&(i.count=(s,o)=>(OE.setTime(+s),LE.setTime(+o),t(OE),t(LE),Math.floor(n(OE,LE))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Dw=oi(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Dw.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?oi(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Dw);Dw.range;const zc=1e3,Xo=zc*60,Bc=Xo*60,Yc=Bc*24,S2=Yc*7,JO=Yc*30,DE=Yc*365,nh=oi(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*zc)},(t,e)=>(e-t)/zc,t=>t.getUTCSeconds());nh.range;const M2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zc)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getMinutes());M2.range;const E2=oi(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getUTCMinutes());E2.range;const A2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zc-t.getMinutes()*Xo)},(t,e)=>{t.setTime(+t+e*Bc)},(t,e)=>(e-t)/Bc,t=>t.getHours());A2.range;const T2=oi(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Bc)},(t,e)=>(e-t)/Bc,t=>t.getUTCHours());T2.range;const ex=oi(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Xo)/Yc,t=>t.getDate()-1);ex.range;const RS=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>t.getUTCDate()-1);RS.range;const Ez=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>Math.floor(t/Yc));Ez.range;function Yh(t){return oi(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())*Xo)/S2)}const NS=Yh(0),jw=Yh(1),xte=Yh(2),bte=Yh(3),Cg=Yh(4),_te=Yh(5),wte=Yh(6);NS.range;jw.range;xte.range;bte.range;Cg.range;_te.range;wte.range;function Zh(t){return oi(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)/S2)}const IS=Zh(0),Uw=Zh(1),Ste=Zh(2),Mte=Zh(3),Pg=Zh(4),Ete=Zh(5),Ate=Zh(6);IS.range;Uw.range;Ste.range;Mte.range;Pg.range;Ete.range;Ate.range;const C2=oi(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());C2.range;const P2=oi(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 Zc=oi(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Zc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:oi(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Zc.range;const Qc=oi(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Qc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:oi(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Qc.range;function Az(t,e,n,r,i,s){const o=[[nh,1,zc],[nh,5,5*zc],[nh,15,15*zc],[nh,30,30*zc],[s,1,Xo],[s,5,5*Xo],[s,15,15*Xo],[s,30,30*Xo],[i,1,Bc],[i,3,3*Bc],[i,6,6*Bc],[i,12,12*Bc],[r,1,Yc],[r,2,2*Yc],[n,1,S2],[e,1,JO],[e,3,3*JO],[t,1,DE]];function a(c,d,f){const m=dw).right(o,m);if(y===o.length)return t.every(MC(c/DE,d/DE,f));if(y===0)return Dw.every(Math.max(MC(c,d,f),1));const[x,S]=o[m/o[y-1][2]53)return null;"w"in ce||(ce.w=1),"Z"in ce?(Ge=UE(d0(ce.y,0,1)),De=Ge.getUTCDay(),Ge=De>4||De===0?Uw.ceil(Ge):Uw(Ge),Ge=RS.offset(Ge,(ce.V-1)*7),ce.y=Ge.getUTCFullYear(),ce.m=Ge.getUTCMonth(),ce.d=Ge.getUTCDate()+(ce.w+6)%7):(Ge=jE(d0(ce.y,0,1)),De=Ge.getDay(),Ge=De>4||De===0?jw.ceil(Ge):jw(Ge),Ge=ex.offset(Ge,(ce.V-1)*7),ce.y=Ge.getFullYear(),ce.m=Ge.getMonth(),ce.d=Ge.getDate()+(ce.w+6)%7)}else("W"in ce||"U"in ce)&&("w"in ce||(ce.w="u"in ce?ce.u%7:"W"in ce?1:0),De="Z"in ce?UE(d0(ce.y,0,1)).getUTCDay():jE(d0(ce.y,0,1)).getDay(),ce.m=0,ce.d="W"in ce?(ce.w+6)%7+ce.W*7-(De+5)%7:ce.w+ce.U*7-(De+6)%7);return"Z"in ce?(ce.H+=ce.Z/100|0,ce.M+=ce.Z%100,UE(ce)):jE(ce)}}function F(Me,We,Ke,ce){for(var Q=0,Ge=We.length,De=Ke.length,Xe,Je;Q=De)return-1;if(Xe=We.charCodeAt(Q++),Xe===37){if(Xe=We.charAt(Q++),Je=O[Xe in eL?We.charAt(Q++):Xe],!Je||(ce=Je(Me,Ke,ce))<0)return-1}else if(Xe!=Ke.charCodeAt(ce++))return-1}return ce}function V(Me,We,Ke){var ce=c.exec(We.slice(Ke));return ce?(Me.p=d.get(ce[0].toLowerCase()),Ke+ce[0].length):-1}function k(Me,We,Ke){var ce=y.exec(We.slice(Ke));return ce?(Me.w=x.get(ce[0].toLowerCase()),Ke+ce[0].length):-1}function U(Me,We,Ke){var ce=f.exec(We.slice(Ke));return ce?(Me.w=m.get(ce[0].toLowerCase()),Ke+ce[0].length):-1}function H(Me,We,Ke){var ce=_.exec(We.slice(Ke));return ce?(Me.m=E.get(ce[0].toLowerCase()),Ke+ce[0].length):-1}function ne(Me,We,Ke){var ce=S.exec(We.slice(Ke));return ce?(Me.m=w.get(ce[0].toLowerCase()),Ke+ce[0].length):-1}function te(Me,We,Ke){return F(Me,e,We,Ke)}function he(Me,We,Ke){return F(Me,n,We,Ke)}function oe(Me,We,Ke){return F(Me,r,We,Ke)}function fe(Me){return o[Me.getDay()]}function B(Me){return s[Me.getDay()]}function q(Me){return l[Me.getMonth()]}function K(Me){return a[Me.getMonth()]}function $(Me){return i[+(Me.getHours()>=12)]}function Z(Me){return 1+~~(Me.getMonth()/3)}function ge(Me){return o[Me.getUTCDay()]}function le(Me){return s[Me.getUTCDay()]}function ue(Me){return l[Me.getUTCMonth()]}function _e(Me){return a[Me.getUTCMonth()]}function Se(Me){return i[+(Me.getUTCHours()>=12)]}function qe(Me){return 1+~~(Me.getUTCMonth()/3)}return{format:function(Me){var We=N(Me+="",T);return We.toString=function(){return Me},We},parse:function(Me){var We=D(Me+="",!1);return We.toString=function(){return Me},We},utcFormat:function(Me){var We=N(Me+="",C);return We.toString=function(){return Me},We},utcParse:function(Me){var We=D(Me+="",!0);return We.toString=function(){return Me},We}}}var eL={"-":"",_:" ",0:"0"},wi=/^\s*\d+/,Ite=/^%/,kte=/[\\^$*+?|[\]().{}]/g;function Un(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Lte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Dte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function jte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Ute(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Fte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function tL(t,e,n){var r=wi.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function nL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function zte(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Bte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Hte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function rL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Vte(t,e,n){var r=wi.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function iL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Gte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Wte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function $te(t,e,n){var r=wi.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Xte(t,e,n){var r=wi.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function qte(t,e,n){var r=Ite.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Kte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Yte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function sL(t,e){return Un(t.getDate(),e,2)}function Zte(t,e){return Un(t.getHours(),e,2)}function Qte(t,e){return Un(t.getHours()%12||12,e,2)}function Jte(t,e){return Un(1+ex.count(Zc(t),t),e,3)}function Tz(t,e){return Un(t.getMilliseconds(),e,3)}function ene(t,e){return Tz(t,e)+"000"}function tne(t,e){return Un(t.getMonth()+1,e,2)}function nne(t,e){return Un(t.getMinutes(),e,2)}function rne(t,e){return Un(t.getSeconds(),e,2)}function ine(t){var e=t.getDay();return e===0?7:e}function sne(t,e){return Un(NS.count(Zc(t)-1,t),e,2)}function Cz(t){var e=t.getDay();return e>=4||e===0?Cg(t):Cg.ceil(t)}function one(t,e){return t=Cz(t),Un(Cg.count(Zc(t),t)+(Zc(t).getDay()===4),e,2)}function ane(t){return t.getDay()}function lne(t,e){return Un(jw.count(Zc(t)-1,t),e,2)}function cne(t,e){return Un(t.getFullYear()%100,e,2)}function une(t,e){return t=Cz(t),Un(t.getFullYear()%100,e,2)}function dne(t,e){return Un(t.getFullYear()%1e4,e,4)}function fne(t,e){var n=t.getDay();return t=n>=4||n===0?Cg(t):Cg.ceil(t),Un(t.getFullYear()%1e4,e,4)}function hne(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Un(e/60|0,"0",2)+Un(e%60,"0",2)}function oL(t,e){return Un(t.getUTCDate(),e,2)}function pne(t,e){return Un(t.getUTCHours(),e,2)}function mne(t,e){return Un(t.getUTCHours()%12||12,e,2)}function gne(t,e){return Un(1+RS.count(Qc(t),t),e,3)}function Pz(t,e){return Un(t.getUTCMilliseconds(),e,3)}function vne(t,e){return Pz(t,e)+"000"}function yne(t,e){return Un(t.getUTCMonth()+1,e,2)}function xne(t,e){return Un(t.getUTCMinutes(),e,2)}function bne(t,e){return Un(t.getUTCSeconds(),e,2)}function _ne(t){var e=t.getUTCDay();return e===0?7:e}function wne(t,e){return Un(IS.count(Qc(t)-1,t),e,2)}function Rz(t){var e=t.getUTCDay();return e>=4||e===0?Pg(t):Pg.ceil(t)}function Sne(t,e){return t=Rz(t),Un(Pg.count(Qc(t),t)+(Qc(t).getUTCDay()===4),e,2)}function Mne(t){return t.getUTCDay()}function Ene(t,e){return Un(Uw.count(Qc(t)-1,t),e,2)}function Ane(t,e){return Un(t.getUTCFullYear()%100,e,2)}function Tne(t,e){return t=Rz(t),Un(t.getUTCFullYear()%100,e,2)}function Cne(t,e){return Un(t.getUTCFullYear()%1e4,e,4)}function Pne(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Pg(t):Pg.ceil(t),Un(t.getUTCFullYear()%1e4,e,4)}function Rne(){return"+0000"}function aL(){return"%"}function lL(t){return+t}function cL(t){return Math.floor(+t/1e3)}var lm,Nz,Iz;Nne({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 Nne(t){return lm=Nte(t),Nz=lm.format,lm.parse,Iz=lm.utcFormat,lm.utcParse,lm}function Ine(t){return new Date(t)}function kne(t){return t instanceof Date?+t:+new Date(+t)}function R2(t,e,n,r,i,s,o,a,l,c){var d=g2(),f=d.invert,m=d.domain,y=c(".%L"),x=c(":%S"),S=c("%I:%M"),w=c("%I %p"),_=c("%a %d"),E=c("%b %d"),T=c("%B"),C=c("%Y");function O(N){return(l(N)e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>_ee(t,s/r))},n.copy=function(){return Dz(e).domain(t)},ru.apply(n,arguments)}function OS(){var t=0,e=.5,n=1,r=1,i,s,o,a,l,c=Es,d,f=!1,m;function y(S){return isNaN(S=+S)?m:(S=.5+((S=+d(S))-s)*(r*S{if(t!=null){var r=t.scale,i=t.type;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!e)?"point":i==="category"?"band":"linear";if(typeof r=="string")return zne(r)?r:"point"}};function Bne(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 o;return(o=t(s))!==null&&o!==void 0?o:0}),i=t.range();if(!(n.length===0||i.length<2))return s=>{var o,a,l=Bne(r,s);if(l<=0)return n[0];if(l>=n.length)return n[n.length-1];var c=(o=r[l-1])!==null&&o!==void 0?o:0,d=(a=r[l])!==null&&a!==void 0?a:0;return Math.abs(s-c)<=Math.abs(s-d)?n[l-1]:n[l]}}}function Hne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Hz(t,void 0)}function dL(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 Fw(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);nt.cartesianAxis.xAxis[e],iu=(t,e)=>{var n=Gz(t,e);return n??ti},ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:PC,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:$y},Wz=(t,e)=>t.cartesianAxis.yAxis[e],su=(t,e)=>{var n=Wz(t,e);return n??ni},Yne={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:""},O2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Yne},Ps=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"zAxis":return O2(t,n);case"angleAxis":return i2(t,n);case"radiusAxis":return s2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Zne=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},tx=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"angleAxis":return i2(t,n);case"radiusAxis":return s2(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,Qne=ke([bi,AS],Xz),Kz=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),Kg=ke([qz,Ps,Qne],Kz,{memoizeOptions:{resultEqualityCheck:CS}}),Yz=ke([Kg],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(l2)),Zz=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),Jne=ke([Kg],Zz),Qz=t=>t.map(e=>e.data).filter(Boolean).flat(1),ere=ke([Kg],t=>t.some(e=>!e.data)),Jz=ke([Kg],Qz,{memoizeOptions:{resultEqualityCheck:CS}}),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)},L2=ke([Jz,_S],eB),tre=(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 o=r.chartData,a=o===void 0?[]:o,l=r.dataStartIndex,c=r.dataEndIndex,d=tre(t,e,n);if(i&&(e==null?void 0:e.dataKey)!=null&&s.length>0){var f=a.slice(l,c+1),m=f.map(y=>({value:yi(y,e.dataKey)})).filter(y=>y.value!=null);return[...m,...d]}return d},nx=ke([L2,Ps,Kg,_S,ere,Jz],tB);function ng(t){if(Ol(t)||t instanceof Date){var e=Number(t);if(wn(e))return e}}function hL(t){if(Array.isArray(t)){var e=[ng(t[0]),ng(t[1])];return Tl(e)?e:void 0}var n=ng(t);if(n!=null)return[n,n]}function jl(t){return t.map(ng).filter(Ys)}function nre(t,e){var n=ng(t),r=ng(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var rre=ke([nx],t=>t==null?void 0:t.map(e=>e.value).sort(nre));function nB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function ire(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!kl(e))r=e;else if(Array.isArray(e)){var i=jl(e);i.length>0&&(r=Math.max(...i))}return r==null?[]:jl(n.flatMap(s=>{var o=yi(t,s.dataKey),a,l;if(Array.isArray(o)){var c=Vz(o,2);a=c[0],l=c[1]}else a=l=o;if(!(!wn(a)||!wn(l)))return[r-a,r+l]}))}var ai=t=>{var e=_i(t),n=Xg(t);return tx(t,e,n)},Rg=ke([ai],t=>t==null?void 0:t.dataKey),sre=ke([Yz,_S,ai],oz),rB=(t,e,n,r)=>{var i={},s=e.reduce((o,a)=>{if(a.stackId==null)return o;var l=o[a.stackId];return l==null&&(l=[]),l.push(a),o[a.stackId]=l,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var a=Vz(o,2),l=a[0],c=a[1],d=r?[...c].reverse():c,f=d.map(a2);return[l,{stackedData:SY(t,f,n),graphicalItems:d}]}))},iB=ke([sre,Yz,wS,J4],rB),sB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return TY(t,i,s)},ore=ke([Ps],t=>t.allowDataOverflow),D2=t=>{var e;if(t==null||!("domain"in t))return PC;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=jl(t.ticks);return[Math.min(...n),Math.max(...n)]}if(t.type==="category")return t.ticks.map(String)}return(e=t==null?void 0:t.domain)!==null&&e!==void 0?e:PC},oB=ke([Ps],D2),aB=ke([oB,ore],H4),are=ke([iB,$a,bi,aB],sB,{memoizeOptions:{resultEqualityCheck:TS}}),j2=t=>t.errorBars,lre=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>nB(n,r)),zw=function(){for(var e=arguments.length,n=new Array(e),r=0;r5&&arguments[5]!==void 0?arguments[5]:[],a,l;if(r.length>0&&r.forEach(c=>{var d,f=c.data!=null?[...c.data]:o,m=(d=i[c.id])===null||d===void 0?void 0:d.filter(y=>nB(s,y));f.forEach(y=>{var x,S=yi(y,(x=n.dataKey)!==null&&x!==void 0?x:c.dataKey),w=ire(y,S,m);if(w.length>=2){var _=Math.min(...w),E=Math.max(...w);(a==null||_l)&&(l=E)}var T=hL(S);T!=null&&(a=a==null?T[0]:Math.min(a,T[0]),l=l==null?T[1]:Math.max(l,T[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&e.forEach(c=>{var d=hL(yi(c,n.dataKey));d!=null&&(a=a==null?d[0]:Math.min(a,d[0]),l=l==null?d[1]:Math.max(l,d[1]))}),wn(a)&&wn(l))return[a,l]},cre=ke([L2,Ps,Jne,j2,bi,FJ],lB,{memoizeOptions:{resultEqualityCheck:TS}});function ure(t){var e=t.value;if(Ol(e)||e instanceof Date)return e}var dre=(t,e,n)=>{var r=t.map(ure).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,Yg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),fre=ke([cB,bi,AS],Yg),uB=t=>t.referenceElements.areas,hre=ke([uB,bi,AS],Yg),dB=t=>t.referenceElements.lines,pre=ke([dB,bi,AS],Yg),fB=(t,e)=>{if(t!=null){var n=jl(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},mre=ke(fre,bi,fB),hB=(t,e)=>{if(t!=null){var n=jl(t.flatMap(r=>[e==="xAxis"?r.x1:r.y1,e==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},gre=ke([hre,bi],hB);function vre(t){var e;if(t.x!=null)return jl([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:jl(n)}function yre(t){var e;if(t.y!=null)return jl([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:jl(n)}var pB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?vre(r):yre(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},xre=ke([pre,bi],pB),bre=ke(mre,xre,gre,(t,e,n)=>zw(t,n,e)),mB=(t,e,n,r,i,s,o,a)=>{if(n!=null)return n;var l=o==="vertical"&&a==="xAxis"||o==="horizontal"&&a==="yAxis",c=l?zw(r,s,i):zw(s,i);return WJ(e,c,t.allowDataOverflow)},_re=ke([Ps,oB,aB,are,cre,bre,fr,bi],mB,{memoizeOptions:{resultEqualityCheck:TS}}),wre=[0,1],gB=(t,e,n,r,i,s,o)=>{if(!((t==null||n==null||n.length===0)&&o===void 0)){var a=t.dataKey,l=t.type,c=Bl(e,s);if(c&&a==null){var d;return B4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?dre(r,t,c):i==="expand"&&!c?wre:o}},U2=ke([Ps,fr,L2,nx,wS,bi,_re],gB),Zg=ke([Ps,$z,t2],Bz),vB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=D2(e),s=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&Tl(t)){if(s)return wO(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return SO(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&Tl(t))return wO(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&Tl(t))return SO(t,e.tickCount,e.allowDecimals,"adaptive")}}},F2=ke([U2,tx,Zg],vB),yB=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&Tl(e)&&Array.isArray(n)&&n.length>0){var i,s,o=e[0],a=(i=n[0])!==null&&i!==void 0?i:0,l=e[1],c=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,a),Math.max(l,c)]}return e},Sre=ke([Ps,U2,F2,bi],yB),Mre=ke(nx,Ps,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(jl(t.map(f=>f.value))).sort((f,m)=>f-m),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var a=0;ai,(t,e,n,r,i)=>{if(!wn(t))return 0;var s=e==="vertical"?r.height:r.width;if(i==="gap")return t*s/2;if(i==="no-gap"){var o=Ad(n,t*s),a=t*s/2;return a-o-(a-o)/s*o}return 0}),Ere=(t,e,n)=>{var r=iu(t,e);return r==null||typeof r.padding!="string"?0:xB(t,"xAxis",e,n,r.padding)},Are=(t,e,n)=>{var r=su(t,e);return r==null||typeof r.padding!="string"?0:xB(t,"yAxis",e,n,r.padding)},Tre=ke(iu,Ere,(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}}),Cre=ke(su,Are,(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([Gi,Tre,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([Gi,fr,Cre,mS,pS,(t,e,n)=>n],(t,e,n,r,i,s)=>{var o=i.padding;return s?[r.height-o.bottom,o.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),rx=(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=O2(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([Ps,rx],SS),Pre=ke([Zg,Sre],cee),z2=ke([Ps,Zg,Pre,wB],k2),SB=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var i=n.type,s=n.scale,o=Bl(t,r);if(o&&(i==="number"||s!=="auto"))return e.map(a=>a.value)}},B2=ke([fr,nx,tx,bi],SB),LS=ke([z2],c2);ke([z2],Hne);ke([z2,rre],Hz);ke([Kg,j2,bi],lre);function MB(t,e){return t.ide.id?1:0}var DS=(t,e)=>e,jS=(t,e,n)=>n,Rre=ke(fS,DS,jS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(MB)),Nre=ke(hS,DS,jS,(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}),Ire=(t,e)=>{var n=typeof e.width=="number"?e.width:$y;return{width:n,height:t.height}},kre=ke(Gi,iu,EB),Ore=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},Lre=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},Dre=ke(nu,Gi,Rre,DS,jS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=EB(e,a);o==null&&(o=Ore(e,r,t));var c=r==="top"&&!i||r==="bottom"&&i;s[a.id]=o-Number(c)*l.height,o+=(c?-1:1)*l.height}),s}),jre=ke(tu,Gi,Nre,DS,jS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=Ire(e,a);o==null&&(o=Lre(e,r,t));var c=r==="left"&&!i||r==="right"&&i;s[a.id]=o-Number(c)*l.width,o+=(c?-1:1)*l.width}),s}),Ure=(t,e)=>{var n=iu(t,e);if(n!=null)return Dre(t,n.orientation,n.mirror)},Fre=ke([Gi,iu,Ure,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n==null?void 0:n[r];return i==null?{x:t.left,y:0}:{x:t.left,y:i}}}),zre=(t,e)=>{var n=su(t,e);if(n!=null)return jre(t,n.orientation,n.mirror)},Bre=ke([Gi,su,zre,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:t.top}:{x:i,y:t.top}}}),Hre=ke(Gi,su,(t,e)=>{var n=typeof e.width=="number"?e.width:$y;return{width:n,height:t.height}}),AB=(t,e,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,s=n.type,o=n.dataKey,a=Bl(t,r),l=e.map(d=>d.value),c=l.filter(d=>d!=null);if(o&&a&&s==="category"&&i&&x5(c))return l}},H2=ke([fr,nx,Ps,bi],AB),pL=ke([fr,Zne,Zg,LS,H2,B2,rx,F2,bi],(t,e,n,r,i,s,o,a,l)=>{if(e!=null){var c=Bl(t,l);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:l,categoricalDomain:s,duplicateDomain:i,isCategorical:c,niceTicks:a,range:o,realScaleType:n,scale:r}}}),Vre=(t,e,n,r,i,s,o,a,l)=>{if(!(e==null||r==null)){var c=Bl(t,l),d=e.type,f=e.ticks,m=e.tickCount,y=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/y:0;x=l==="angleAxis"&&s!=null&&s.length>=2?Wo(s[0]-s[1])*2*x:x;var S=f||i;return S?S.map((w,_)=>{var E=o?o.indexOf(w):w,T=r.map(E);return wn(T)?{index:_,coordinate:T+x,value:w,offset:x}:null}).filter(Ys):c&&a?a.map((w,_)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:w,index:_,offset:x}:null}).filter(Ys):r.ticks?r.ticks(m).map((w,_)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:w,index:_,offset:x}:null}).filter(Ys):r.domain().map((w,_)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:o?o[w]:w,index:_,offset:x}:null}).filter(Ys)}},TB=ke([fr,tx,Zg,LS,F2,rx,H2,B2,bi],Vre),Gre=(t,e,n,r,i,s,o)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var a=Bl(t,o),l=e.tickCount,c=0;return c=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Wo(r[0]-r[1])*2*c:c,a&&s?s.map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:d,index:f,offset:c}:null}).filter(Ys):n.ticks?n.ticks(l).map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:d,index:f,offset:c}:null}).filter(Ys):n.domain().map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:i?i[d]:d,index:f,offset:c}:null}).filter(Ys)}},CB=ke([fr,tx,LS,rx,H2,B2,bi],Gre),PB=ke(Ps,LS,(t,e)=>{if(!(t==null||e==null))return Fw(Fw({},t),{},{scale:e})}),Wre=ke([Ps,Zg,U2,wB],k2),$re=ke([Wre],c2);ke((t,e,n)=>O2(t,n),$re,(t,e)=>{if(!(t==null||e==null))return Fw(Fw({},t),{},{scale:e})});var Xre=ke([fr,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}}),qre=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};ke([qre],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,i=t[0];for(var s of t){var o=Math.abs(s.coordinate-e);ot.options.defaultTooltipEventType,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 ix(t,e){var n=RB(t),r=NB(t);return IB(e,n,r)}function Kre(t){return Bt(e=>ix(e,t))}var kB=(t,e)=>{var n,r=Number(e);if(!(kl(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},Yre=t=>t.tooltip.settings,cd={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Zre={itemInteraction:{click:cd,hover:cd},axisInteraction:{click:cd,hover:cd},keyboardInteraction:cd,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},OB=cs({name:"tooltip",initialState:Zre,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:sr()},replaceTooltipEntrySettings:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).tooltipItemPayloads.indexOf(r);s>-1&&(t.tooltipItemPayloads[s]=i)},prepare:sr()},removeTooltipEntrySettings:{reducer(t,e){var n=$o(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:sr()},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}}}),ta=OB.actions,Qre=ta.addTooltipEntrySettings,Jre=ta.replaceTooltipEntrySettings,eie=ta.removeTooltipEntrySettings,tie=ta.setTooltipSettingsState,nie=ta.setActiveMouseOverItemIndex;ta.mouseLeaveItem;var LB=ta.mouseLeaveChart;ta.setActiveClickItemIndex;var DB=ta.setMouseOverAxisIndex,rie=ta.setMouseClickAxisIndex,F0=ta.setSyncInteraction,Bw=ta.setKeyboardInteraction,iie=OB.reducer;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 Nb(t){for(var e=1;e{if(e==null)return cd;var i=lie(t,e,n);if(i==null)return cd;if(i.active)return i;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&t.syncInteraction.index!=null)return t.syncInteraction;var s=t.settings.active===!0;if(cie(i)){if(s)return Nb(Nb({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Nb(Nb({},cd),{},{coordinate:i.coordinate})};function uie(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 die(t,e){var n=uie(t),r=e[0],i=e[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function fie(t,e,n){if(n==null||e==null)return!0;var r=yi(t,e);return r==null||!Tl(n)?!0:die(r,n)}var G0=(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 o=0,a=1/0;e.length>0&&(a=e.length-1);var l=Math.max(o,Math.min(s,a)),c=e[l];return c==null||fie(c,n,r)?String(l):null},UB=(t,e,n,r,i,s,o)=>{if(s!=null){var a=o[0],l=a==null?void 0:a.getPosition(s);if(l!=null)return l;var c=i==null?void 0:i[Number(s)];if(c)switch(n){case"horizontal":return{x:c.coordinate,y:(r.top+e)/2};default:return{x:(r.left+t)/2,y:c.coordinate}}}},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(o=>{var a;return((a=o.settings)===null||a===void 0?void 0:a.graphicalItemId)===i})},zB=t=>t.options.tooltipPayloadSearcher,Qg=t=>t.tooltip;function gL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vL(t){for(var e=1;et(e)}function yL(t){if(typeof t=="string")return t}function xie(t){if(!(t==null||typeof t!="object")){var e="name"in t?gie(t.name):void 0,n="unit"in t?vie(t.unit):void 0,r="dataKey"in t?yie(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?yL(t.color):void 0,o="fill"in t?yL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:o}}}function bie(t,e){return t??e}var BB=(t,e,n,r,i,s,o)=>{if(!(e==null||s==null)){var a=n.chartData,l=n.computedData,c=n.dataStartIndex,d=n.dataEndIndex,f=[];return t.reduce((m,y)=>{var x,S=y.dataDefinedOnItem,w=y.settings,_=bie(S,a),E=Array.isArray(_)?f4(_,c,d):_,T=(x=w==null?void 0:w.dataKey)!==null&&x!==void 0?x:r,C=w==null?void 0:w.nameKey,O;if(r&&Array.isArray(E)&&!Array.isArray(E[0])&&o==="axis"?O=b5(E,r,i):O=s(E,e,l,C),Array.isArray(O))O.forEach(D=>{var F,V,k=xie(D),U=k==null?void 0:k.name,H=k==null?void 0:k.dataKey,ne=k==null?void 0:k.payload,te=vL(vL({},w),{},{name:U,unit:k==null?void 0:k.unit,color:(F=k==null?void 0:k.color)!==null&&F!==void 0?F:w==null?void 0:w.color,fill:(V=k==null?void 0:k.fill)!==null&&V!==void 0?V:w==null?void 0:w.fill});m.push(fk({tooltipEntrySettings:te,dataKey:H,payload:ne,value:yi(ne,H),name:U==null?void 0:String(U)}))});else{var N;m.push(fk({tooltipEntrySettings:w,dataKey:T,payload:O,value:yi(O,T),name:(N=yi(O,C))!==null&&N!==void 0?N:w==null?void 0:w.name}))}return m},f)}},V2=ke([ai,$z,t2],Bz),_ie=ke([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),wie=ke([_i,Xg],Xz),Qh=ke([_ie,ai,wie],Kz,{memoizeOptions:{resultEqualityCheck:CS}}),Sie=ke([Qh],t=>t.filter(l2)),HB=ke([Qh],Qz,{memoizeOptions:{resultEqualityCheck:CS}}),Mie=ke([Qh],t=>t.some(e=>!e.data)),Lh=ke([HB,$a],eB),Eie=ke([Sie,$a,ai],oz),G2=ke([Lh,ai,Qh,$a,Mie,HB],tB),VB=ke([ai],D2),Aie=ke([ai],t=>t.allowDataOverflow),GB=ke([VB,Aie],H4),Tie=ke([Qh],t=>t.filter(l2)),Cie=ke([Eie,Tie,wS,J4],rB),Pie=ke([Cie,$a,_i,GB],sB),Rie=ke([Qh],Zz),Nie=ke([Lh,ai,Rie,j2,_i,zJ],lB,{memoizeOptions:{resultEqualityCheck:TS}}),Iie=ke([cB,_i,Xg],Yg),kie=ke([Iie,_i],fB),Oie=ke([uB,_i,Xg],Yg),Lie=ke([Oie,_i],hB),Die=ke([dB,_i,Xg],Yg),jie=ke([Die,_i],pB),Uie=ke([kie,jie,Lie],zw),Fie=ke([ai,VB,GB,Pie,Nie,Uie,fr,_i],mB),Ng=ke([ai,fr,Lh,G2,wS,_i,Fie],gB),zie=ke([Ng,ai,V2],vB),Bie=ke([ai,Ng,zie,_i],yB),WB=t=>{var e=_i(t),n=Xg(t),r=!1;return rx(t,e,n,r)},$B=ke([ai,WB],SS),Hie=ke([ai,V2,Bie,$B],k2),XB=ke([Hie],c2),Vie=ke([fr,G2,ai,_i],AB),Gie=ke([fr,G2,ai,_i],SB),Wie=(t,e,n,r,i,s,o,a)=>{if(e){var l=e.type,c=Bl(t,a);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=l==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=a==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Wo(i[0]-i[1])*2*f:f,c&&o?o.map((m,y)=>{var x=r.map(m);return wn(x)?{coordinate:x+f,value:m,index:y,offset:f}:null}).filter(Ys):r.domain().map((m,y)=>{var x=r.map(m);return wn(x)?{coordinate:x+f,value:s?s[m]:m,index:y,offset:f}:null}).filter(Ys)}}},ou=ke([fr,ai,V2,XB,WB,Vie,Gie,_i],Wie),W2=ke([RB,NB,Yre],(t,e,n)=>IB(n.shared,t,e)),qB=t=>t.tooltip.settings.trigger,$2=t=>t.tooltip.settings.defaultIndex,sx=ke([Qg,W2,qB,$2],jB),_y=ke([sx,Lh,Rg,Ng],G0),KB=ke([ou,_y],kB),$ie=ke([sx],t=>{if(t)return t.dataKey}),Xie=ke([sx],t=>{if(t)return t.graphicalItemId}),YB=ke([Qg,W2,qB,$2],FB),qie=ke([tu,nu,fr,Gi,ou,$2,YB],UB),Kie=ke([sx,qie],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Yie=ke([sx],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),Zie=ke([YB,_y,$a,Rg,KB,zB,W2],BB),Qie=ke([Zie],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function xL(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 bL(t){for(var e=1;eBt(ai),rse=()=>{var t=nse(),e=Bt(ou),n=Bt(XB);return vw(!t||!n?void 0:bL(bL({},t),{},{scale:n}),e)};function _L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function 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}},lse=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="centric"){var s=i.coordinate,o=r.radius;return cm(cm(cm({},r),zi(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var a=i.coordinate,l=r.angle;return cm(cm(cm({},r),zi(r.cx,r.cy,a,l)),{},{angle:l,radius:a})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function cse(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,o=(s=e==null?void 0:e.length)!==null&&s!==void 0?s:0;if(o<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var a=0;a0?(l=n[a-1])===null||l===void 0?void 0:l.coordinate:(c=n[o-1])===null||c===void 0?void 0:c.coordinate,x=(d=n[a])===null||d===void 0?void 0:d.coordinate,S=a>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(m=n[a+1])===null||m===void 0?void 0:m.coordinate,w=void 0;if(!(y==null||x==null||S==null))if(Wo(x-y)!==Wo(S-x)){var _=[];if(Wo(S-x)===Wo(i[1]-i[0])){w=S;var E=x+i[1]-i[0];_[0]=Math.min(E,(E+y)/2),_[1]=Math.max(E,(E+y)/2)}else{w=y;var T=S+i[1]-i[0];_[0]=Math.min(x,(T+x)/2),_[1]=Math.max(x,(T+x)/2)}var C=[Math.min(x,(w+x)/2),Math.max(x,(w+x)/2)];if(t>C[0]&&t<=C[1]||t>=_[0]&&t<=_[1]){var O;return(O=n[a])===null||O===void 0?void 0:O.index}}else{var N=Math.min(y,S),D=Math.max(y,S);if(t>(N+x)/2&&t<=(D+x)/2){var F;return(F=n[a])===null||F===void 0?void 0:F.index}}}else if(e)for(var V=0;V(k.coordinate+H.coordinate)/2||V>0&&V(k.coordinate+H.coordinate)/2&&t<=(k.coordinate+U.coordinate)/2)return k.index}}return-1},QB=()=>Bt(t2),X2=(t,e)=>e,JB=(t,e,n)=>n,q2=(t,e,n,r)=>r,use=ke(ou,t=>tS(t,e=>e.coordinate)),K2=ke([Qg,X2,JB,q2],jB),Y2=ke([K2,Lh,Rg,Ng],G0),dse=(t,e,n)=>{if(e!=null){var r=Qg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},eH=ke([Qg,X2,JB,q2],FB),Hw=ke([tu,nu,fr,Gi,ou,q2,eH],UB),fse=ke([K2,Hw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),tH=ke([ou,Y2],kB),hse=ke([eH,Y2,$a,Rg,tH,zB,X2],BB),pse=ke([K2,Y2],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),mse=(t,e,n,r,i,s,o)=>{if(!(!t||!n||!r||!i)&&cse(t,o)){var a=CY(t,e),l=ZB(a,s,i,n,r),c=ase(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},gse=(t,e,n,r,i,s,o)=>{if(!(!t||!r||!i||!s||!n)){var a=NJ(t,n);if(a){var l=PY(a,e),c=ZB(l,o,s,r,i),d=lse(e,s,c,a);return{activeIndex:String(c),activeCoordinate:d}}}},vse=(t,e,n,r,i,s,o,a)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?mse(t,e,r,i,s,o,a):gse(t,e,n,r,i,s,o)},yse=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}}),xse=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:lee}});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 SL(t){for(var e=1;eSL(SL({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),Sse)},Ese=new Set(Object.values(Ms));function Ase(t){return Ese.has(t)}var nH=cs({name:"zIndex",initialState:Mse,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:sr()},unregisterZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!Ase(n)&&delete t.zIndexMap[n])},prepare:sr()},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:sr()},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:sr()}}}),US=nH.actions,Tse=US.registerZIndexPortal,FE=US.unregisterZIndexPortal,Cse=US.registerZIndexPortalElement,Pse=US.unregisterZIndexPortalElement,Rse=nH.reducer;function au(t){var e=t.zIndex,n=t.children,r=hZ(),i=r&&e!==void 0&&e!==0,s=Js(),o=R.useRef(void 0),a=R.useRef(new Set),l=Wr(),c=Bt(f=>yse(f,e,s));if(R.useLayoutEffect(()=>{if(!i){var f=a.current;f.forEach(y=>{l(FE({zIndex:y}))}),f.clear(),o.current=void 0;return}if(a.current.has(e)||(l(Tse({zIndex:e})),a.current.add(e)),c){o.current=c;var m=a.current;m.forEach(y=>{y!==e&&(l(FE({zIndex:y})),m.delete(y))})}},[l,e,i,c]),R.useLayoutEffect(()=>{var f=a.current;return()=>{f.forEach(m=>{l(FE({zIndex:m}))}),f.clear()}},[l]),!i)return n;var d=c??o.current;return d?$1.createPortal(n,d):null}function RC(){return RC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.useContext(rH),zE={exports:{}},EL;function Use(){return EL||(EL=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function s(l,c,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new i(d,f||l,m),x=n?n+c:c;return l._events[x]?l._events[x].fn?l._events[x]=[l._events[x],y]:l._events[x].push(y):(l._events[x]=y,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],d,f;if(this._eventsCount===0)return c;for(f in d=this._events)e.call(d,f)&&c.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},a.prototype.listeners=function(c){var d=n?n+c:c,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,y=f.length,x=new Array(y);m{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!kl(n))return t[n]}},Hse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},iH=cs({name:"options",initialState:Hse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Vse=iH.reducer,Gse=iH.actions.createEventEmitter;function Wse(t){return t.tooltip.syncInteraction}var $se={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},sH=cs({name:"chartData",initialState:$se,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)}}}),Z2=sH.actions,TL=Z2.setChartData,Xse=Z2.setDataStartEndIndexes;Z2.setComputedData;var qse=sH.reducer,Kse=["x","y"];function CL(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 Vg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(F0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var m;if(o&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var y=d.payload.coordinate,x=y.x,S=y.y,w=Jse(y,Kse),_=d.payload.sourceViewBox,E=_.x,T=_.y,C=_.width,O=_.height,N=um(um({},w),{},{x:o.x+(C?(x-E)/C:0)*o.width,y:o.y+(O?(S-T)/O:0)*o.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 F={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},V=r(i,F);D=i[V]}else r==="value"&&(D=i.find(fe=>String(fe.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||o==null){n(F0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(D==null){n(F0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var U=k.x,H=k.y,ne=Math.min(U,o.x+o.width),te=Math.min(H,o.y+o.height),he={x:s==="horizontal"?D.coordinate:ne,y:s==="horizontal"?te:D.coordinate},oe=F0({active:d.payload.active,coordinate:he,dataKey:d.payload.dataKey,index:String(D.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(oe)}}};return wy.on(NC,l),()=>{wy.off(NC,l)}},[a,n,e,t,r,i,s,o])}function noe(){var t=Bt(n2),e=Bt(r2),n=Wr();R.useEffect(()=>{if(t==null)return Vg;var r=(i,s,o)=>{e!==o&&t===i&&n(Xse(s))};return wy.on(AL,r),()=>{wy.off(AL,r)}},[n,e,t])}function roe(){var t=Wr();R.useEffect(()=>{t(Gse())},[t]),toe(),noe()}function ioe(t,e,n,r,i,s){var o=Bt(x=>dse(x,t,e)),a=Bt(Xie),l=Bt(r2),c=Bt(n2),d=Bt(ez),f=Bt(Wse),m=(f==null?void 0:f.sourceViewBox)!=null,y=gS();R.useEffect(()=>{if(!m&&c!=null&&l!=null){var x=F0({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:a});wy.emit(NC,c,x,l)}},[m,n,o,a,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 RL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{D(tie({shared:E,trigger:T,axisId:N,active:i,defaultIndex:F}))},[D,E,T,N,i,F]);var V=gS(),k=k4(),U=Kre(E),H=(e=Bt(Ke=>pse(Ke,U,T,F)))!==null&&e!==void 0?e:{},ne=H.activeIndex,te=H.isActive,he=Bt(Ke=>hse(Ke,U,T,F)),oe=Bt(Ke=>tH(Ke,U,T,F)),fe=Bt(Ke=>fse(Ke,U,T,F)),B=he,q=jse(),K=(n=i??te)!==null&&n!==void 0?n:!1,$=pK([B,K]),Z=loe($,2),ge=Z[0],le=Z[1],ue=U==="axis"?oe:void 0;ioe(U,T,fe,ue,ne,K);var _e=O??q;if(_e==null||V==null||U==null)return null;var Se=B??IL;K||(Se=IL),c&&Se.length&&(Se=jq(Se.filter(Ke=>Ke.value!=null&&(Ke.hide!==!0||r.includeHidden)),m,hoe));var qe=Se.length>0,Me=RL(RL({},r),{},{payload:Se,label:ue,active:K,activeIndex:ne,coordinate:fe,accessibilityLayer:k}),We=R.createElement(EQ,{allowEscapeViewBox:s,animationDuration:o,animationEasing:a,isAnimationActive:d,active:K,coordinate:fe,hasPayload:qe,offset:f,position:y,reverseDirection:x,useTranslate3d:S,viewBox:V,wrapperStyle:w,lastBoundingBox:ge,innerRef:le,hasPortalFromProps:!!O},poe(l,Me));return R.createElement(R.Fragment,null,$1.createPortal(We,_e),K&&R.createElement(Dse,{cursor:_,tooltipEventType:U,coordinate:fe,payload:Se,index:ne}))}function voe(t,e,n){return(e=yoe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function yoe(t){var e=xoe(t,"string");return typeof e=="symbol"?e:e+""}function xoe(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 boe{constructor(e){voe(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 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 _oe(t){for(var e=1;e{try{var n=document.getElementById(LL);n||(n=document.createElement("span"),n.setAttribute("id",LL),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Aoe,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},W0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Yy.isSsr)return{width:0,height:0};if(!oH.enableCache)return DL(e,n);var r=Toe(e,n),i=OL.get(r);if(i)return i;var s=DL(e,n);return OL.set(r,s),s},aH;function Vw(t,e){return Noe(t)||Roe(t,e)||Poe(t,e)||Coe()}function Coe(){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 Poe(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);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=[];Hi(e)||(n?i=e.toString().split(""):i=e.toString().split(cH));var s=i.map(a=>({word:a,width:W0(a,r).width})),o=n?0:W0(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function dH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function Zoe(t){return Hi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var fH=(t,e,n,r)=>t.reduce((i,s)=>{var o=s.word,a=s.width,l=i[i.length-1];if(l&&a!=null&&(e==null||r||l.width+a+nt.reduce((e,n)=>e.width>n.width?e:n),Qoe="…",GL=(t,e,n,r,i,s,o,a)=>{var l=t.slice(0,e),c=uH({breakAll:n,style:r,children:l+Qoe});if(!c)return[!1,[]];var d=fH(c.wordsWithComputedWidth,s,o,a),f=d.length>i||hH(d).width>Number(s);return[f,d]},Joe=(t,e,n,r,i)=>{var s=t.maxLines,o=t.children,a=t.style,l=t.breakAll,c=kt(s),d=String(o),f=fH(e,r,n,i);if(!c||i)return f;var m=f.length>s||hH(f).width>Number(r);if(!m)return f;for(var y=0,x=d.length-1,S=0,w;y<=x&&S<=d.length-1;){var _=Math.floor((y+x)/2),E=_-1,T=GL(d,E,l,a,s,r,n,i),C=HL(T,2),O=C[0],N=C[1],D=GL(d,_,l,a,s,r,n,i),F=HL(D,1),V=F[0];if(!O&&!V&&(y=_+1),O&&V&&(x=_-1),!O&&V){w=N;break}S++}return w||f},WL=t=>{var e=Hi(t)?[]:t.toString().split(cH);return[{words:e,width:void 0}]},eae=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,o=t.maxLines;if((e||n)&&!Yy.isSsr){var a,l,c=uH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;a=d,l=f}else return WL(r);return Joe({breakAll:s,children:r,maxLines:o,style:i},a,l,e,!!n)}return WL(r)},pH="#808080",tae={angle:0,breakAll:!1,capHeight:"0.71em",fill:pH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Q2=R.forwardRef((t,e)=>{var n=Jo(t,tae),r=n.x,i=n.y,s=n.lineHeight,o=n.capHeight,a=n.fill,l=n.scaleToFit,c=n.textAnchor,d=n.verticalAnchor,f=BL(n,Goe),m=R.useMemo(()=>eae({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),y=f.dx,x=f.dy,S=f.angle,w=f.className,_=f.breakAll,E=BL(f,Woe);if(!Ol(r)||!Ol(i)||m.length===0)return null;var T=Number(r)+(kt(y)?y:0),C=Number(i)+(kt(x)?x:0);if(!wn(T)||!wn(C))return null;var O;switch(d){case"start":O=BE("calc(".concat(o,")"));break;case"middle":O=BE("calc(".concat((m.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:O=BE("calc(".concat(m.length-1," * -").concat(s,")"));break}var N=[],D=m[0];if(l&&D!=null){var F=D.width,V=f.width;N.push("scale(".concat(kt(V)&&kt(F)?V/F:1,")"))}return S&&N.push("rotate(".concat(S,", ").concat(T,", ").concat(C,")")),N.length&&(E.transform=N.join(" ")),R.createElement("text",IC({},Ko(E),{ref:e,x:T,y:C,className:er("recharts-text",w),textAnchor:c,fill:a.includes("url")?pH:a}),m.map((k,U)=>{var H=k.words.join(_?"":" ");return R.createElement("tspan",{x:T,dy:U===0?O:s,key:"".concat(H,"-").concat(U)},H)}))});Q2.displayName="Text";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 pl(t){for(var e=1;e{var e=t.viewBox,n=t.position,r=t.offset,i=r===void 0?0:r,s=t.parentViewBox,o=$P(e),a=o.x,l=o.y,c=o.height,d=o.upperWidth,f=o.lowerWidth,m=a,y=a+(d-f)/2,x=(m+y)/2,S=(d+f)/2,w=m+d/2,_=c>=0?1:-1,E=_*i,T=_>0?"end":"start",C=_>0?"start":"end",O=d>=0?1:-1,N=O*i,D=O>0?"end":"start",F=O>0?"start":"end",V=s;if(n==="top"){var k={x:m+d/2,y:l-E,horizontalAnchor:"middle",verticalAnchor:T};return V&&(k.height=Math.max(l-V.y,0),k.width=d),k}if(n==="bottom"){var U={x:y+f/2,y:l+c+E,horizontalAnchor:"middle",verticalAnchor:C};return V&&(U.height=Math.max(V.y+V.height-(l+c),0),U.width=f),U}if(n==="left"){var H={x:x-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"};return V&&(H.width=Math.max(H.x-V.x,0),H.height=c),H}if(n==="right"){var ne={x:x+S+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"};return V&&(ne.width=Math.max(V.x+V.width-ne.x,0),ne.height=c),ne}var te=V?{width:S,height:c}:{};return n==="insideLeft"?pl({x:x+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"},te):n==="insideRight"?pl({x:x+S-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"},te):n==="insideTop"?pl({x:m+d/2,y:l+E,horizontalAnchor:"middle",verticalAnchor:C},te):n==="insideBottom"?pl({x:y+f/2,y:l+c-E,horizontalAnchor:"middle",verticalAnchor:T},te):n==="insideTopLeft"?pl({x:m+N,y:l+E,horizontalAnchor:F,verticalAnchor:C},te):n==="insideTopRight"?pl({x:m+d-N,y:l+E,horizontalAnchor:D,verticalAnchor:C},te):n==="insideBottomLeft"?pl({x:y+N,y:l+c-E,horizontalAnchor:F,verticalAnchor:T},te):n==="insideBottomRight"?pl({x:y+f-N,y:l+c-E,horizontalAnchor:D,verticalAnchor:T},te):n&&typeof n=="object"&&(kt(n.x)||Rh(n.x))&&(kt(n.y)||Rh(n.y))?pl({x:a+Ad(n.x,S),y:l+Ad(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},te):pl({x:w,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},te)},oae=["labelRef"],aae=["content"];function XL(t,e){if(t==null)return{};var n,r,i=lae(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var e=t.x,n=t.y,r=t.upperWidth,i=t.lowerWidth,s=t.width,o=t.height,a=t.children,l=R.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:i,width:s,height:o}),[e,n,r,i,s,o]);return R.createElement(mH.Provider,{value:l},a)},gH=()=>{var t=R.useContext(mH),e=gS();return t||(e?$P(e):void 0)},hae=R.createContext(null),pae=()=>{var t=R.useContext(hae),e=Bt(sz);return t||e},mae=t=>{var e=t.value,n=t.formatter,r=Hi(t.children)?e:t.children;return typeof n=="function"?n(r):r},J2=t=>t!=null&&typeof t=="function",gae=(t,e)=>{var n=Wo(e-t),r=Math.min(Math.abs(e-t),360);return n*r},vae=(t,e,n,r,i)=>{var s=t.offset,o=t.className,a=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,m=i.endAngle,y=i.clockWise,x=(c+d)/2,S=gae(f,m),w=S>=0?1:-1,_,E;switch(e){case"insideStart":_=f+w*s,E=y;break;case"insideEnd":_=m-w*s,E=!y;break;case"end":_=m+w*s,E=y;break;default:throw new Error("Unsupported position ".concat(e))}E=S<=0?E:!E;var T=zi(a,l,x,_),C=zi(a,l,x,_+(E?1:-1)*359),O="M".concat(T.x,",").concat(T.y,` + A`,",",",0,0,",",",",","Z"])),U.x,U.y,s,s,+(d<0),k.x,k.y,r,r,+(ne>180),+(d>0),N.x,N.y,s,s,+(d<0),D.x,D.y)}else C+=Di(yO||(yO=eh(["L",",","Z"])),e,n);return C},LJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},DJ=t=>{var e=Jo(t,LJ),n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,o=e.cornerRadius,a=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,d=e.endAngle,f=e.className;if(s0&&Math.abs(c-d)<360?S=OJ({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:a,cornerIsExternal:l,startAngle:c,endAngle:d}):S=B4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),R.createElement("path",wC({},Ko(e),{className:m,d:S}))};function jJ(t,e,n){if(t==="horizontal")return[{x:e.x,y:n.top},{x:e.x,y:n.top+n.height}];if(t==="vertical")return[{x:n.left,y:e.y},{x:n.left+n.width,y:e.y}];if(w5(e)){if(t==="centric"){var r=e.cx,i=e.cy,s=e.innerRadius,o=e.outerRadius,a=e.angle,l=zi(r,i,s,a),c=zi(r,i,o,a);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return z4(e)}}function UJ(t){return D5(t)?NaN:Number(t)}function NE(t){return t?(t=UJ(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function H4(t,e,n){n&&typeof n!="number"&&nC(t,e,n)&&(e=n=void 0),t=NE(t),e===void 0?(e=t,t=0):e=NE(e),n=n===void 0?tt.chartData,ZP=Oe([$a],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),wS=(t,e,n,r)=>r?ZP(t):$a(t),FJ=(t,e,n)=>n?ZP(t):$a(t),zJ=Oe([wS],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});Oe([ZP],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var BJ=Oe([$a],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function QP(t,e){return WJ(t)||GJ(t,e)||VJ(t,e)||HJ()}function HJ(){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 VJ(t,e){if(t){if(typeof t=="string")return xO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xO(t,e):void 0}}function xO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.e^s.s<0?1:-1;for(r=s.d.length,i=t.d.length,e=0,n=rt.d[e]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};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 Gc(this,new this.constructor(t))};Tt.dividedToIntegerBy=Tt.idiv=function(t){var e=this,n=e.constructor;return Yn(Gc(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(yo))throw Error(Zo+"NaN");if(n.s<1)throw Error(Zo+(n.s?"NaN":"-Infinity"));return n.eq(yo)?new r(0):(ur=!1,e=Gc(vy(n,s),vy(t,s),s),ur=!0,Yn(e,i))};Tt.minus=Tt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?X4(e,t):W4(e,(t.s=-t.s,t))};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(Zo+"NaN");return n.s?(ur=!1,e=Gc(n,t,0,1).times(t),ur=!0,n.minus(e)):Yn(new r(n),i)};Tt.naturalExponential=Tt.exp=function(){return $4(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?W4(e,t):X4(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(_h+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,o,a=this,l=a.constructor;if(a.s<1){if(!a.s)return new l(0);throw Error(Zo+"NaN")}for(t=Vr(a),ur=!1,i=Math.sqrt(+a),i==0||i==1/0?(e=Sl(a.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=$g((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=o=n+3;;)if(s=r,r=s.plus(Gc(a,s,o+2)).times(.5),Sl(s.d).slice(0,o)===(e=Sl(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(Yn(s,n+1,0),s.times(s).eq(a)){r=s;break}}else if(e!="9999")break;o+=4}return ur=!0,Yn(r,n)};Tt.times=Tt.mul=function(t){var e,n,r,i,s,o,a,l,c,d=this,f=d.constructor,m=d.d,y=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=m.length,c=y.length,l=0;){for(e=0,i=l+r;i>r;)a=s[i]+y[r]*m[i-r-1]+e,s[i--]=a%vi|0,e=a/vi|0;s[i]=(s[i]+e)%vi|0}for(;!s[--o];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,ur?Yn(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:(Dl(t,0,Wg),e===void 0?e=r.rounding:Dl(e,0,8),Yn(n,t+Vr(n)+1,e))};Tt.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Oh(r,!0):(Dl(t,0,Wg),e===void 0?e=i.rounding:Dl(e,0,8),r=Yn(new i(r),t+1,e),n=Oh(r,!0,t+1)),n};Tt.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Oh(i):(Dl(t,0,Wg),e===void 0?e=s.rounding:Dl(e,0,8),r=Yn(new s(i),t+Vr(i)+1,e),n=Oh(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 Yn(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,o,a=this,l=a.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(yo);if(a=new l(a),!a.s){if(t.s<1)throw Error(Zo+"Infinity");return a}if(a.eq(yo))return a;if(r=l.precision,t.eq(yo))return Yn(a,r);if(e=t.e,n=t.d.length-1,o=e>=n,s=a.s,o){if((n=d<0?-d:d)<=G4){for(i=new l(yo),e=Math.ceil(r/or+4),ur=!1;n%2&&(i=i.times(a),wO(i.d,e)),n=$g(n/2),n!==0;)a=a.times(a),wO(a.d,e);return ur=!0,t.s<0?new l(yo).div(i):Yn(i,r)}}else if(s<0)throw Error(Zo+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,a.s=1,ur=!1,i=t.times(vy(a,r+c)),ur=!0,i=$4(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=Oh(i,n<=s.toExpNeg||n>=s.toExpPos)):(Dl(t,1,Wg),e===void 0?e=s.rounding:Dl(e,0,8),i=Yn(new s(i),t,e),n=Vr(i),r=Oh(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):(Dl(t,1,Wg),e===void 0?e=r.rounding:Dl(e,0,8)),Yn(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 Oh(t,e<=n.toExpNeg||e>=n.toExpPos)};function W4(t,e){var n,r,i,s,o,a,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),ur?Yn(e,f):e;if(l=t.d,c=e.d,o=t.e,i=e.e,l=l.slice(),s=o-i,s){for(s<0?(r=l,s=-s,a=c.length):(r=c,i=o,a=l.length),o=Math.ceil(f/or),a=o>a?o+1:a+1,s>a&&(s=a,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(a=l.length,s=c.length,a-s<0&&(s=a,r=c,c=l,l=r),n=0;s;)n=(l[--s]=l[s]+c[s]+n)/vi|0,l[s]%=vi;for(n&&(l.unshift(n),++i),a=l.length;l[--a]==0;)l.pop();return e.d=l,e.e=i,ur?Yn(e,f):e}function Dl(t,e,n){if(t!==~~t||tn)throw Error(_h+t)}function Sl(t){var e,n,r,i=t.length-1,s="",o=t[0];if(i>0){for(s+=o,e=1;eo?1:-1;else for(a=l=0;ai[a]?1:-1;break}return l}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var a,l,c,d,f,m,y,x,S,w,_,E,T,C,O,N,D,F,G=r.constructor,k=r.s==i.s?1:-1,U=r.d,H=i.d;if(!r.s)return new G(r);if(!i.s)throw Error(Zo+"Division by zero");for(l=r.e-i.e,D=H.length,O=U.length,y=new G(k),x=y.d=[],c=0;H[c]==(U[c]||0);)++c;if(H[c]>(U[c]||0)&&--l,s==null?E=s=G.precision:o?E=s+(Vr(r)-Vr(i))+1:E=s,E<0)return new G(0);if(E=E/or+2|0,c=0,D==1)for(d=0,H=H[0],E++;(c1&&(H=t(H,d),U=t(U,d),D=H.length,O=U.length),C=D,S=U.slice(0,D),w=S.length;w=vi/2&&++N;do d=0,a=e(H,S,D,w),a<0?(_=S[0],D!=w&&(_=_*vi+(S[1]||0)),d=_/N|0,d>1?(d>=vi&&(d=vi-1),f=t(H,d),m=f.length,w=S.length,a=e(f,S,m,w),a==1&&(d--,n(f,D16)throw Error(JP+Vr(t));if(!t.s)return new d(yo);for(ur=!1,a=f,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),c+=5;for(r=Math.log($f(2,c))/Math.LN10*2+5|0,a+=r,n=i=s=new d(yo),d.precision=a;;){if(i=Yn(i.times(t),a),n=n.times(++l),o=s.plus(Gc(i,n,a)),Sl(o.d).slice(0,a)===Sl(s.d).slice(0,a)){for(;c--;)s=Yn(s.times(s),a);return d.precision=f,e==null?(ur=!0,Yn(s,f)):s}s=o}}function Vr(t){for(var e=t.e*or,n=t.d[0];n>=10;n/=10)e++;return e}function IE(t,e,n){if(e>t.LN10.sd())throw ur=!0,n&&(t.precision=n),Error(Zo+"LN10 precision limit exceeded");return Yn(new t(t.LN10),e)}function ad(t){for(var e="";t--;)e+="0";return e}function vy(t,e){var n,r,i,s,o,a,l,c,d,f=1,m=10,y=t,x=y.d,S=y.constructor,w=S.precision;if(y.s<1)throw Error(Zo+(y.s?"NaN":"-Infinity"));if(y.eq(yo))return new S(0);if(e==null?(ur=!1,c=w):c=e,y.eq(10))return e==null&&(ur=!0),IE(S,c);if(c+=m,S.precision=c,n=Sl(x),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=IE(S,c+2,w).times(s+""),y=vy(new S(r+"."+n.slice(1)),c-m).plus(l),S.precision=w,e==null?(ur=!0,Yn(y,w)):y;for(a=o=y=Gc(y.minus(yo),y.plus(yo),c),d=Yn(y.times(y),c),i=3;;){if(o=Yn(o.times(d),c),l=a.plus(Gc(o,new S(i),c)),Sl(l.d).slice(0,c)===Sl(a.d).slice(0,c))return a=a.times(2),s!==0&&(a=a.plus(IE(S,c+2,w).times(s+""))),a=Gc(a,new S(f),c),S.precision=w,e==null?(ur=!0,Yn(a,w)):a;a=l,i+=2}}function _O(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=$g(n/or),t.d=[],r=(n+1)%or,n<0&&(r+=or),rCw||t.e<-Cw))throw Error(JP+n)}else t.s=0,t.e=0,t.d=[0];return t}function Yn(t,e,n){var r,i,s,o,a,l,c,d,f=t.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=e-o,r<0)r+=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],o=1;s>=10;s/=10)o++;r%=or,i=r-or+o}if(n!==void 0&&(s=$f(10,o-i-1),a=c/s%10|0,l=e<0||f[d+1]!==void 0||c%s,l=n<4?(a||l)&&(n==0||n==(t.s<0?3:2)):a>5||a==5&&(n==4||l||n==6&&(r>0?i>0?c/$f(10,o-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=Vr(t),f.length=1,e=e-s-1,f[0]=$f(10,(or-e%or)%or),t.e=$g(-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=$f(10,or-r),f[d]=i>0?(c/$f(10,o-i)%$f(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(ur&&(t.e>Cw||t.e<-Cw))throw Error(JP+Vr(t));return t}function X4(t,e){var n,r,i,s,o,a,l,c,d,f,m=t.constructor,y=m.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new m(t),ur?Yn(e,y):e;if(l=t.d,f=e.d,r=e.e,c=t.e,l=l.slice(),o=c-r,o){for(d=o<0,d?(n=l,o=-o,a=f.length):(n=f,r=c,a=l.length),i=Math.max(Math.ceil(y/or),a)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=l.length,a=f.length,d=i0;--i)l[a++]=0;for(i=f.length;i>o;){if(l[--i]0?s=s.charAt(0)+"."+s.slice(1)+ad(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ad(-i-1)+s,n&&(r=n-o)>0&&(s+=ad(r))):i>=o?(s+=ad(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ad(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ad(r))),t.s<0?"-"+s:s}function wO(t,e){if(t.length>e)return t.length=e,!0}function q4(t){var e,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(_h+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return _O(o,s.toString())}else if(typeof s!="string")throw Error(_h+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,qJ.test(s))_O(o,s);else throw Error(_h+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=q4,i.config=i.set=KJ,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(_h+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(_h+n+": "+r);return this}var e2=q4(XJ);yo=new e2(1);const Tn=e2;function K4(t){var e;return t===0?e=1:e=Math.floor(new Tn(t).abs().log(10).toNumber())+1,e}function Y4(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 JJ(t)||QJ(t,e)||ZJ(t,e)||YJ()}function YJ(){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 ZJ(t,e){if(t){if(typeof t=="string")return SO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?SO(t,e):void 0}}function SO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=yy(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]},t2=(t,e,n)=>{if(t.lte(0))return new Tn(0);var r=K4(t.toNumber()),i=new Tn(10).pow(r),s=t.div(i),o=r!==1?.05:.1,a=new Tn(Math.ceil(s.div(o).toNumber())).add(n).mul(o),l=a.mul(i);return e?new Tn(l.toNumber()):new Tn(Math.ceil(l.toNumber()))},Q4=(t,e,n)=>{var r;if(t.lte(0))return new Tn(0);var i=[1,2,2.5,5],s=t.toNumber(),o=Math.floor(new Tn(s).abs().log(10).toNumber()),a=new Tn(10).pow(o),l=t.div(a).toNumber(),c=i.findIndex(y=>y>=l-1e-10);if(c===-1&&(a=a.mul(10),c=0),c+=n,c>=i.length){var d=Math.floor(c/i.length);c%=i.length,a=a.mul(new Tn(10).pow(d))}var f=(r=i[c])!==null&&r!==void 0?r:1,m=new Tn(f).mul(a);return e?m:new Tn(Math.ceil(m.toNumber()))},eee=(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(K4(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 o=Math.floor((e-1)/2),a=[],l=0;l4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:t2;if(!Number.isFinite((n-e)/(r-1)))return{step:new Tn(0),tickMin:new Tn(0),tickMax:new Tn(0)};var a=o(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(a)));var c=Math.ceil(l.sub(e).div(a).toNumber()),d=Math.ceil(new Tn(n).sub(l).div(a).toNumber()),f=c+d+1;return f>r?J4(e,n,r,i,s+1,o):(f0?d+(r-f):d,c=n>0?c:c+(r-f)),{step:a,tickMin:l.sub(new Tn(c).mul(a)),tickMax:l.add(new Tn(d).mul(a))})},MO=function(e){var n=yy(e,2),r=n[0],i=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),c=Z4([r,i]),d=yy(c,2),f=d[0],m=d[1];if(f===-1/0||m===1/0){var y=m===1/0?[f,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),m];return r>i?y.reverse():y}if(f===m)return eee(f,s,o);var x=a==="snap125"?Q4:t2,S=J4(f,m,l,o,0,x),w=S.step,_=S.tickMin,E=S.tickMax,T=Y4(_,E.add(new Tn(.1).mul(w)),w);return r>i?T.reverse():T},EO=function(e,n){var r=yy(e,2),i=r[0],s=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Z4([i,s]),c=yy(l,2),d=c[0],f=c[1];if(d===-1/0||f===1/0)return[i,s];if(d===f)return[d];var m=a==="snap125"?Q4:t2,y=Math.max(n,2),x=m(new Tn(f).sub(d).div(y-1),o,0),S=[...Y4(new Tn(d),new Tn(f),x),f];return o===!1&&(S=S.map(w=>Math.round(w))),i>s?S.reverse():S},tee=t=>t.rootProps.barCategoryGap,SS=t=>t.rootProps.stackOffset,ez=t=>t.rootProps.reverseStackOrder,n2=t=>t.options.chartName,r2=t=>t.rootProps.syncId,tz=t=>t.rootProps.syncMethod,i2=t=>t.options.eventEmitter,nee=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},wf={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},hl={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},MS=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function ES(t,e,n){if(n!=="auto")return n;if(t!=null)return Bl(t,e)?"category":"number"}function AO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Pw(t){for(var e=1;e{if(e!=null)return t.polarAxis.angleAxis[e]},s2=Oe([oee,E4],(t,e)=>{var n;if(t!=null)return t;var r=(n=ES(e,"angleAxis",TO.type))!==null&&n!==void 0?n:"category";return Pw(Pw({},TO),{},{type:r})}),aee=(t,e)=>t.polarAxis.radiusAxis[e],o2=Oe([aee,E4],(t,e)=>{var n;if(t!=null)return t;var r=(n=ES(e,"radiusAxis",CO.type))!==null&&n!==void 0?n:"category";return Pw(Pw({},CO),{},{type:r})}),AS=t=>t.polarOptions,a2=Oe([tu,nu,Gi],TJ),nz=Oe([AS,a2],(t,e)=>{if(t!=null)return Ad(t.innerRadius,e,0)}),rz=Oe([AS,a2],(t,e)=>{if(t!=null)return Ad(t.outerRadius,e,e*.8)}),lee=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},iz=Oe([AS],lee);Oe([s2,iz],MS);var sz=Oe([a2,nz,rz],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});Oe([o2,sz],MS);var oz=Oe([fr,AS,nz,rz,tu,nu],(t,e,n,r,i,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var o=e.cx,a=e.cy,l=e.startAngle,c=e.endAngle;return{cx:Ad(o,i,i/2),cy:Ad(a,s,s/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),bi=(t,e)=>e,TS=(t,e,n)=>n;function l2(t){return t==null?void 0:t.id}function az(t,e,n){var r=e.chartData,i=r===void 0?[]:r,s=n.allowDuplicatedCategory,o=n.dataKey,a=new Map;return t.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:i;if(!(d==null||d.length===0)){var f=l2(l);d.forEach((m,y)=>{var x=o==null||s?y:String(yi(m,o,null)),S=yi(m,l.dataKey,0),w;a.has(x)?w=a.get(x):w={},Object.assign(w,{[f]:S}),a.set(x,w)})}}),Array.from(a.values())}function c2(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var CS=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function PS(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function cee(t,e){if(t.length===e.length){for(var n=0;n{var e=fr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Xg=t=>t.tooltip.settings.axisId;function u2(t){if(t!=null){var e=t.ticks,n=t.bandwidth,r=t.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>t.domain(),range:(function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],a=i[1];return o<=a?s>=o&&s<=a:s>=a&&s<=o},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,o)=>{var a=t(s);if(a!=null){if(t.bandwidth&&o!==null&&o!==void 0&&o.position){var l=t.bandwidth();switch(o.position){case"middle":a+=l/2;break;case"end":a+=l;break}}return a}}}}}var uee=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!Tl(e)){for(var n,r,i=0;ir)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return e}default:return e}};function wd(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function dee(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function d2(t){let e,n,r;t.length!==2?(e=wd,n=(a,l)=>wd(t(a),l),r=(a,l)=>t(a)-l):(e=t===wd||t===dee?t:fee,n=t,r=t);function i(a,l,c=0,d=a.length){if(c>>1;n(a[f],l)<0?c=f+1:d=f}while(c>>1;n(a[f],l)<=0?c=f+1:d=f}while(cc&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function fee(){return 0}function lz(t){return t===null?NaN:+t}function*hee(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const pee=d2(wd),Jy=pee.right;d2(lz).center;class PO extends Map{constructor(e,n=vee){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(RO(this,e))}has(e){return super.has(RO(this,e))}set(e,n){return super.set(mee(this,e),n)}delete(e){return super.delete(gee(this,e))}}function RO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function mee({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function gee({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function vee(t){return t!==null&&typeof t=="object"?t.valueOf():t}function yee(t=wd){if(t===wd)return cz;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function cz(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const xee=Math.sqrt(50),bee=Math.sqrt(10),_ee=Math.sqrt(2);function Rw(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=xee?10:s>=bee?5:s>=_ee?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/o,a=Math.round(t*c),l=Math.round(e*c),a/ce&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(t/c),l=Math.round(e/c),a*ce&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let c=0;c=r)&&(n=r);return n}function IO(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function uz(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?cz:yee(i);r>n;){if(r-n>600){const l=r-n+1,c=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),y=Math.max(n,Math.floor(e-c*f/l+m)),x=Math.min(r,Math.floor(e+(l-c)*f/l+m));uz(t,e,y,x,i)}const s=t[e];let o=n,a=r;for(u0(t,n,e),i(t[r],s)>0&&u0(t,n,r);o0;)--a}i(t[n],s)===0?u0(t,n,a):(++a,u0(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function u0(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function wee(t,e,n){if(t=Float64Array.from(hee(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return IO(t);if(e>=1)return NO(t);var r,i=(r-1)*e,s=Math.floor(i),o=NO(uz(t,s).subarray(0,s+1)),a=IO(t.subarray(s+1));return o+(a-o)*(i-s)}}function See(t,e,n=lz){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,s=Math.floor(i),o=+n(t[s],s,t),a=+n(t[s+1],s+1,t);return o+(a-o)*(i-s)}}function Mee(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,s=new Array(i);++r>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Rb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Rb(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Tee.exec(t))?new Zs(e[1],e[2],e[3],1):(e=Cee.exec(t))?new Zs(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Pee.exec(t))?Rb(e[1],e[2],e[3],e[4]):(e=Ree.exec(t))?Rb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Nee.exec(t))?FO(e[1],e[2]/100,e[3]/100,1):(e=Iee.exec(t))?FO(e[1],e[2]/100,e[3]/100,e[4]):kO.hasOwnProperty(t)?DO(kO[t]):t==="transparent"?new Zs(NaN,NaN,NaN,0):null}function DO(t){return new Zs(t>>16&255,t>>8&255,t&255,1)}function Rb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Zs(t,e,n,r)}function Lee(t){return t instanceof ex||(t=_y(t)),t?(t=t.rgb(),new Zs(t.r,t.g,t.b,t.opacity)):new Zs}function TC(t,e,n,r){return arguments.length===1?Lee(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}p2(Zs,TC,fz(ex,{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(wh(this.r),wh(this.g),wh(this.b),Iw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:jO,formatHex:jO,formatHex8:Dee,formatRgb:UO,toString:UO}));function jO(){return`#${th(this.r)}${th(this.g)}${th(this.b)}`}function Dee(){return`#${th(this.r)}${th(this.g)}${th(this.b)}${th((isNaN(this.opacity)?1:this.opacity)*255)}`}function UO(){const t=Iw(this.opacity);return`${t===1?"rgb(":"rgba("}${wh(this.r)}, ${wh(this.g)}, ${wh(this.b)}${t===1?")":`, ${t})`}`}function Iw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function wh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function th(t){return t=wh(t),(t<16?"0":"")+t.toString(16)}function FO(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Fa(t,e,n,r)}function hz(t){if(t instanceof Fa)return new Fa(t.h,t.s,t.l,t.opacity);if(t instanceof ex||(t=_y(t)),!t)return new Fa;if(t instanceof Fa)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n0&&l<1?0:o,new Fa(o,a,l,t.opacity)}function jee(t,e,n,r){return arguments.length===1?hz(t):new Fa(t,e,n,r??1)}function Fa(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}p2(Fa,jee,fz(ex,{brighter(t){return t=t==null?Nw:Math.pow(Nw,t),new Fa(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?xy:Math.pow(xy,t),new Fa(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(kE(t>=240?t-240:t+120,i,r),kE(t,i,r),kE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Fa(zO(this.h),Nb(this.s),Nb(this.l),Iw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Iw(this.opacity);return`${t===1?"hsl(":"hsla("}${zO(this.h)}, ${Nb(this.s)*100}%, ${Nb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function zO(t){return t=(t||0)%360,t<0?t+360:t}function Nb(t){return Math.max(0,Math.min(1,t||0))}function kE(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const m2=t=>()=>t;function Uee(t,e){return function(n){return t+n*e}}function Fee(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 zee(t){return(t=+t)==1?pz:function(e,n){return n-e?Fee(e,n,t):m2(isNaN(e)?n:e)}}function pz(t,e){var n=e-t;return n?Uee(t,n):m2(isNaN(t)?e:t)}const BO=(function t(e){var n=zee(e);function r(i,s){var o=n((i=TC(i)).r,(s=TC(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=pz(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=a(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=t,r})(1);function Bee(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;in&&(s=e.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:kw(r,i)})),n=OE.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function Qee(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i2?Jee:Qee,l=c=null,f}function f(m){return m==null||isNaN(m=+m)?s:(l||(l=a(t.map(r),e,n)))(r(o(m)))}return f.invert=function(m){return o(i((c||(c=a(e,t.map(r),kw)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,Ow),d()):t.slice()},f.range=function(m){return arguments.length?(e=Array.from(m),d()):e.slice()},f.rangeRound=function(m){return e=Array.from(m),n=g2,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Es,d()):o!==Es},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(s=m,f):s},function(m,y){return r=m,i=y,d()}}function v2(){return RS()(Es,Es)}function ete(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Lw(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Tg(t){return t=Lw(Math.abs(t)),t?t[1]:NaN}function tte(t,e){return function(n,r){for(var i=n.length,s=[],o=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=t[o=(o+1)%t.length];return s.reverse().join(e)}}function nte(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var rte=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wy(t){if(!(e=rte.exec(t)))throw new Error("invalid format: "+t);var e;return new y2({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}wy.prototype=y2.prototype;function y2(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}y2.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function ite(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 ste(t,e){var n=Lw(t,e);if(!n)return Dw=void 0,t.toPrecision(e);var r=n[0],i=n[1],s=i-(Dw=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Lw(t,Math.max(0,e+s-1))[0]}function VO(t,e){var n=Lw(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const GO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:ete,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>VO(t*100,e),r:VO,s:ste,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function WO(t){return t}var $O=Array.prototype.map,XO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function ote(t){var e=t.grouping===void 0||t.thousands===void 0?WO:tte($O.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?WO:nte($O.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f,m){f=wy(f);var y=f.fill,x=f.align,S=f.sign,w=f.symbol,_=f.zero,E=f.width,T=f.comma,C=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):GO[N]||(C===void 0&&(C=12),O=!0,N="g"),(_||y==="0"&&x==="=")&&(_=!0,y="0",x="=");var D=(m&&m.prefix!==void 0?m.prefix:"")+(w==="$"?n:w==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),F=(w==="$"?r:/[%p]/.test(N)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),G=GO[N],k=/[defgprs%]/.test(N);C=C===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function U(H){var ne=D,te=F,he,se,fe;if(N==="c")te=G(H)+te,H="";else{H=+H;var B=H<0||1/H<0;if(H=isNaN(H)?l:G(Math.abs(H),C),O&&(H=ite(H)),B&&+H==0&&S!=="+"&&(B=!1),ne=(B?S==="("?S:a:S==="-"||S==="("?"":S)+ne,te=(N==="s"&&!isNaN(H)&&Dw!==void 0?XO[8+Dw/3]:"")+te+(B&&S==="("?")":""),k){for(he=-1,se=H.length;++hefe||fe>57){te=(fe===46?i+H.slice(he+1):H.slice(he))+te,H=H.slice(0,he);break}}}T&&!_&&(H=e(H,1/0));var J=ne.length+H.length+te.length,Y=J>1)+ne+H+te+Y.slice(J);break;default:H=Y+ne+H+te;break}return s(H)}return U.toString=function(){return f+""},U}function d(f,m){var y=Math.max(-8,Math.min(8,Math.floor(Tg(m)/3)))*3,x=Math.pow(10,-y),S=c((f=wy(f),f.type="f",f),{suffix:XO[8+y/3]});return function(w){return S(x*w)}}return{format:c,formatPrefix:d}}var Ib,x2,mz;ate({thousands:",",grouping:[3],currency:["$",""]});function ate(t){return Ib=ote(t),x2=Ib.format,mz=Ib.formatPrefix,Ib}function lte(t){return Math.max(0,-Tg(Math.abs(t)))}function cte(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Tg(e)/3)))*3-Tg(Math.abs(t)))}function ute(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Tg(e)-Tg(t))+1}function gz(t,e,n,r){var i=EC(t,e,n),s;switch(r=wy(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=cte(i,o))&&(r.precision=s),mz(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=ute(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=lte(i))&&(r.precision=s-(r.type==="%")*2);break}}return x2(r)}function Rd(t){var e=t.domain;return t.ticks=function(n){var r=e();return SC(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return gz(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,s=r.length-1,o=r[i],a=r[s],l,c,d=10;for(a0;){if(c=MC(o,a,n),c===l)return r[i]=o,r[s]=a,e(r);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return t},t}function vz(){var t=v2();return t.copy=function(){return tx(t,vz())},ea.apply(t,arguments),Rd(t)}function yz(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Ow),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return yz(t).unknown(e)},t=arguments.length?Array.from(t,Ow):[0,1],Rd(n)}function xz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return sMath.pow(t,e)}function mte(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function YO(t){return(e,n)=>-t(-e,n)}function b2(t){const e=t(qO,KO),n=e.domain;let r=10,i,s;function o(){return i=mte(r),s=pte(r),n()[0]<0?(i=YO(i),s=YO(s),t(dte,fte)):t(qO,KO),e}return e.base=function(a){return arguments.length?(r=+a,o()):r},e.domain=function(a){return arguments.length?(n(a),o()):n()},e.ticks=a=>{const l=n();let c=l[0],d=l[l.length-1];const f=d0){for(;m<=y;++m)for(x=1;xd)break;_.push(S)}}else for(;m<=y;++m)for(x=r-1;x>=1;--x)if(S=m>0?x/s(-m):x*s(m),!(Sd)break;_.push(S)}_.length*2{if(a==null&&(a=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=wy(l)).precision==null&&(l.trim=!0),l=x2(l)),a===1/0)return l;const c=Math.max(1,r*a/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(xz(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),e}function bz(){const t=b2(RS()).domain([1,10]);return t.copy=()=>tx(t,bz()).base(t.base()),ea.apply(t,arguments),t}function ZO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function QO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function _2(t){var e=1,n=t(ZO(e),QO(e));return n.constant=function(r){return arguments.length?t(ZO(e=+r),QO(e)):e},Rd(n)}function _z(){var t=_2(RS());return t.copy=function(){return tx(t,_z()).constant(t.constant())},ea.apply(t,arguments)}function JO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function gte(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function vte(t){return t<0?-t*t:t*t}function w2(t){var e=t(Es,Es),n=1;function r(){return n===1?t(Es,Es):n===.5?t(gte,vte):t(JO(n),JO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Rd(e)}function S2(){var t=w2(RS());return t.copy=function(){return tx(t,S2()).exponent(t.exponent())},ea.apply(t,arguments),t}function yte(){return S2.apply(null,arguments).exponent(.5)}function eL(t){return Math.sign(t)*t*t}function xte(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function wz(){var t=v2(),e=[0,1],n=!1,r;function i(s){var o=xte(t(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return t.invert(eL(s))},i.domain=function(s){return arguments.length?(t.domain(s),i):t.domain()},i.range=function(s){return arguments.length?(t.range((e=Array.from(s,Ow)).map(eL)),i):e.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(t.clamp(s),i):t.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return wz(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},ea.apply(i,arguments),Rd(i)}function Sz(){var t=[],e=[],n=[],r;function i(){var o=0,a=Math.max(1,e.length);for(n=new Array(a-1);++o0?n[a-1]:t[0],a=n?[r[n-1],e]:[r[c-1],r[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Mz().domain([t,e]).range(i).unknown(s)},ea.apply(Rd(o),arguments)}function Ez(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[Jy(t,s,0,r)]:n}return i.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var o=e.indexOf(s);return[t[o-1],t[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return Ez().domain(t).range(e).unknown(n)},ea.apply(i,arguments)}const LE=new Date,DE=new Date;function oi(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const o=i(s),a=i.ceil(s);return s-o(e(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,a)=>{const l=[];if(s=i.ceil(s),a=a==null?1:Math.floor(a),!(s0))return l;let c;do l.push(c=new Date(+s)),e(s,a),t(s);while(coi(o=>{if(o>=o)for(;t(o),!s(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;e(o,-1),!s(o););else for(;--a>=0;)for(;e(o,1),!s(o););}),n&&(i.count=(s,o)=>(LE.setTime(+s),DE.setTime(+o),t(LE),t(DE),Math.floor(n(LE,DE))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const jw=oi(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);jw.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?oi(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):jw);jw.range;const zc=1e3,Xo=zc*60,Bc=Xo*60,Yc=Bc*24,M2=Yc*7,tL=Yc*30,jE=Yc*365,nh=oi(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*zc)},(t,e)=>(e-t)/zc,t=>t.getUTCSeconds());nh.range;const E2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zc)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getMinutes());E2.range;const A2=oi(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getUTCMinutes());A2.range;const T2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zc-t.getMinutes()*Xo)},(t,e)=>{t.setTime(+t+e*Bc)},(t,e)=>(e-t)/Bc,t=>t.getHours());T2.range;const C2=oi(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Bc)},(t,e)=>(e-t)/Bc,t=>t.getUTCHours());C2.range;const nx=oi(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Xo)/Yc,t=>t.getDate()-1);nx.range;const NS=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>t.getUTCDate()-1);NS.range;const Az=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>Math.floor(t/Yc));Az.range;function Yh(t){return oi(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())*Xo)/M2)}const IS=Yh(0),Uw=Yh(1),bte=Yh(2),_te=Yh(3),Cg=Yh(4),wte=Yh(5),Ste=Yh(6);IS.range;Uw.range;bte.range;_te.range;Cg.range;wte.range;Ste.range;function Zh(t){return oi(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/M2)}const kS=Zh(0),Fw=Zh(1),Mte=Zh(2),Ete=Zh(3),Pg=Zh(4),Ate=Zh(5),Tte=Zh(6);kS.range;Fw.range;Mte.range;Ete.range;Pg.range;Ate.range;Tte.range;const P2=oi(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());P2.range;const R2=oi(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());R2.range;const Zc=oi(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Zc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:oi(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Zc.range;const Qc=oi(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Qc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:oi(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Qc.range;function Tz(t,e,n,r,i,s){const o=[[nh,1,zc],[nh,5,5*zc],[nh,15,15*zc],[nh,30,30*zc],[s,1,Xo],[s,5,5*Xo],[s,15,15*Xo],[s,30,30*Xo],[i,1,Bc],[i,3,3*Bc],[i,6,6*Bc],[i,12,12*Bc],[r,1,Yc],[r,2,2*Yc],[n,1,M2],[e,1,tL],[e,3,3*tL],[t,1,jE]];function a(c,d,f){const m=dw).right(o,m);if(y===o.length)return t.every(EC(c/jE,d/jE,f));if(y===0)return jw.every(Math.max(EC(c,d,f),1));const[x,S]=o[m/o[y-1][2]53)return null;"w"in ce||(ce.w=1),"Z"in ce?(We=FE(d0(ce.y,0,1)),je=We.getUTCDay(),We=je>4||je===0?Fw.ceil(We):Fw(We),We=NS.offset(We,(ce.V-1)*7),ce.y=We.getUTCFullYear(),ce.m=We.getUTCMonth(),ce.d=We.getUTCDate()+(ce.w+6)%7):(We=UE(d0(ce.y,0,1)),je=We.getDay(),We=je>4||je===0?Uw.ceil(We):Uw(We),We=nx.offset(We,(ce.V-1)*7),ce.y=We.getFullYear(),ce.m=We.getMonth(),ce.d=We.getDate()+(ce.w+6)%7)}else("W"in ce||"U"in ce)&&("w"in ce||(ce.w="u"in ce?ce.u%7:"W"in ce?1:0),je="Z"in ce?FE(d0(ce.y,0,1)).getUTCDay():UE(d0(ce.y,0,1)).getDay(),ce.m=0,ce.d="W"in ce?(ce.w+6)%7+ce.W*7-(je+5)%7:ce.w+ce.U*7-(je+6)%7);return"Z"in ce?(ce.H+=ce.Z/100|0,ce.M+=ce.Z%100,FE(ce)):UE(ce)}}function F(Me,$e,Ke,ce){for(var Z=0,We=$e.length,je=Ke.length,Xe,Je;Z=je)return-1;if(Xe=$e.charCodeAt(Z++),Xe===37){if(Xe=$e.charAt(Z++),Je=O[Xe in nL?$e.charAt(Z++):Xe],!Je||(ce=Je(Me,Ke,ce))<0)return-1}else if(Xe!=Ke.charCodeAt(ce++))return-1}return ce}function G(Me,$e,Ke){var ce=c.exec($e.slice(Ke));return ce?(Me.p=d.get(ce[0].toLowerCase()),Ke+ce[0].length):-1}function k(Me,$e,Ke){var ce=y.exec($e.slice(Ke));return ce?(Me.w=x.get(ce[0].toLowerCase()),Ke+ce[0].length):-1}function U(Me,$e,Ke){var ce=f.exec($e.slice(Ke));return ce?(Me.w=m.get(ce[0].toLowerCase()),Ke+ce[0].length):-1}function H(Me,$e,Ke){var ce=_.exec($e.slice(Ke));return ce?(Me.m=E.get(ce[0].toLowerCase()),Ke+ce[0].length):-1}function ne(Me,$e,Ke){var ce=S.exec($e.slice(Ke));return ce?(Me.m=w.get(ce[0].toLowerCase()),Ke+ce[0].length):-1}function te(Me,$e,Ke){return F(Me,e,$e,Ke)}function he(Me,$e,Ke){return F(Me,n,$e,Ke)}function se(Me,$e,Ke){return F(Me,r,$e,Ke)}function fe(Me){return o[Me.getDay()]}function B(Me){return s[Me.getDay()]}function J(Me){return l[Me.getMonth()]}function Y(Me){return a[Me.getMonth()]}function V(Me){return i[+(Me.getHours()>=12)]}function q(Me){return 1+~~(Me.getMonth()/3)}function pe(Me){return o[Me.getUTCDay()]}function ae(Me){return s[Me.getUTCDay()]}function le(Me){return l[Me.getUTCMonth()]}function be(Me){return a[Me.getUTCMonth()]}function Se(Me){return i[+(Me.getUTCHours()>=12)]}function qe(Me){return 1+~~(Me.getUTCMonth()/3)}return{format:function(Me){var $e=N(Me+="",T);return $e.toString=function(){return Me},$e},parse:function(Me){var $e=D(Me+="",!1);return $e.toString=function(){return Me},$e},utcFormat:function(Me){var $e=N(Me+="",C);return $e.toString=function(){return Me},$e},utcParse:function(Me){var $e=D(Me+="",!0);return $e.toString=function(){return Me},$e}}}var nL={"-":"",_:" ",0:"0"},wi=/^\s*\d+/,kte=/^%/,Ote=/[\\^$*+?|[\]().{}]/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=wi.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function jte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Ute(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Fte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function zte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function rL(t,e,n){var r=wi.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function iL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Bte(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 Hte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Vte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function sL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Gte(t,e,n){var r=wi.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function oL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Wte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function $te(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Xte(t,e,n){var r=wi.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function qte(t,e,n){var r=wi.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Kte(t,e,n){var r=kte.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Yte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Zte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function aL(t,e){return Un(t.getDate(),e,2)}function Qte(t,e){return Un(t.getHours(),e,2)}function Jte(t,e){return Un(t.getHours()%12||12,e,2)}function ene(t,e){return Un(1+nx.count(Zc(t),t),e,3)}function Cz(t,e){return Un(t.getMilliseconds(),e,3)}function tne(t,e){return Cz(t,e)+"000"}function nne(t,e){return Un(t.getMonth()+1,e,2)}function rne(t,e){return Un(t.getMinutes(),e,2)}function ine(t,e){return Un(t.getSeconds(),e,2)}function sne(t){var e=t.getDay();return e===0?7:e}function one(t,e){return Un(IS.count(Zc(t)-1,t),e,2)}function Pz(t){var e=t.getDay();return e>=4||e===0?Cg(t):Cg.ceil(t)}function ane(t,e){return t=Pz(t),Un(Cg.count(Zc(t),t)+(Zc(t).getDay()===4),e,2)}function lne(t){return t.getDay()}function cne(t,e){return Un(Uw.count(Zc(t)-1,t),e,2)}function une(t,e){return Un(t.getFullYear()%100,e,2)}function dne(t,e){return t=Pz(t),Un(t.getFullYear()%100,e,2)}function fne(t,e){return Un(t.getFullYear()%1e4,e,4)}function hne(t,e){var n=t.getDay();return t=n>=4||n===0?Cg(t):Cg.ceil(t),Un(t.getFullYear()%1e4,e,4)}function pne(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+Un(e/60|0,"0",2)+Un(e%60,"0",2)}function lL(t,e){return Un(t.getUTCDate(),e,2)}function mne(t,e){return Un(t.getUTCHours(),e,2)}function gne(t,e){return Un(t.getUTCHours()%12||12,e,2)}function vne(t,e){return Un(1+NS.count(Qc(t),t),e,3)}function Rz(t,e){return Un(t.getUTCMilliseconds(),e,3)}function yne(t,e){return Rz(t,e)+"000"}function xne(t,e){return Un(t.getUTCMonth()+1,e,2)}function bne(t,e){return Un(t.getUTCMinutes(),e,2)}function _ne(t,e){return Un(t.getUTCSeconds(),e,2)}function wne(t){var e=t.getUTCDay();return e===0?7:e}function Sne(t,e){return Un(kS.count(Qc(t)-1,t),e,2)}function Nz(t){var e=t.getUTCDay();return e>=4||e===0?Pg(t):Pg.ceil(t)}function Mne(t,e){return t=Nz(t),Un(Pg.count(Qc(t),t)+(Qc(t).getUTCDay()===4),e,2)}function Ene(t){return t.getUTCDay()}function Ane(t,e){return Un(Fw.count(Qc(t)-1,t),e,2)}function Tne(t,e){return Un(t.getUTCFullYear()%100,e,2)}function Cne(t,e){return t=Nz(t),Un(t.getUTCFullYear()%100,e,2)}function Pne(t,e){return Un(t.getUTCFullYear()%1e4,e,4)}function Rne(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Pg(t):Pg.ceil(t),Un(t.getUTCFullYear()%1e4,e,4)}function Nne(){return"+0000"}function cL(){return"%"}function uL(t){return+t}function dL(t){return Math.floor(+t/1e3)}var lm,Iz,kz;Ine({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 Ine(t){return lm=Ite(t),Iz=lm.format,lm.parse,kz=lm.utcFormat,lm.utcParse,lm}function kne(t){return new Date(t)}function One(t){return t instanceof Date?+t:+new Date(+t)}function N2(t,e,n,r,i,s,o,a,l,c){var d=v2(),f=d.invert,m=d.domain,y=c(".%L"),x=c(":%S"),S=c("%I:%M"),w=c("%I %p"),_=c("%a %d"),E=c("%b %d"),T=c("%B"),C=c("%Y");function O(N){return(l(N)e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>wee(t,s/r))},n.copy=function(){return jz(e).domain(t)},ru.apply(n,arguments)}function LS(){var t=0,e=.5,n=1,r=1,i,s,o,a,l,c=Es,d,f=!1,m;function y(S){return isNaN(S=+S)?m:(S=.5+((S=+d(S))-s)*(r*S{if(t!=null){var r=t.scale,i=t.type;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!e)?"point":i==="category"?"band":"linear";if(typeof r=="string")return Bne(r)?r:"point"}};function Hne(t,e){for(var n=0,r=t.length,i=t[0]e)?n=s+1:r=s}return n}function Vz(t,e){if(t){var n=e??t.domain(),r=n.map(s=>{var o;return(o=t(s))!==null&&o!==void 0?o:0}),i=t.range();if(!(n.length===0||i.length<2))return s=>{var o,a,l=Hne(r,s);if(l<=0)return n[0];if(l>=n.length)return n[n.length-1];var c=(o=r[l-1])!==null&&o!==void 0?o:0,d=(a=r[l])!==null&&a!==void 0?a:0;return Math.abs(s-c)<=Math.abs(s-d)?n[l-1]:n[l]}}}function Vne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Vz(t,void 0)}function hL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function zw(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);nt.cartesianAxis.xAxis[e],iu=(t,e)=>{var n=Wz(t,e);return n??ti},ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:RC,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:qy},$z=(t,e)=>t.cartesianAxis.yAxis[e],su=(t,e)=>{var n=$z(t,e);return n??ni},Zne={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},L2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Zne},Ps=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"zAxis":return L2(t,n);case"angleAxis":return s2(t,n);case"radiusAxis":return o2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Qne=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},rx=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"angleAxis":return s2(t,n);case"radiusAxis":return o2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Xz=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function qz(t,e){return n=>{switch(t){case"xAxis":return"xAxisId"in n&&n.xAxisId===e;case"yAxis":return"yAxisId"in n&&n.yAxisId===e;case"zAxis":return"zAxisId"in n&&n.zAxisId===e;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===e;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===e;default:return!1}}}var Kz=t=>t.graphicalItems.cartesianItems,Jne=Oe([bi,TS],qz),Yz=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),Kg=Oe([Kz,Ps,Jne],Yz,{memoizeOptions:{resultEqualityCheck:PS}}),Zz=Oe([Kg],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(c2)),Qz=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),ere=Oe([Kg],Qz),Jz=t=>t.map(e=>e.data).filter(Boolean).flat(1),tre=Oe([Kg],t=>t.some(e=>!e.data)),eB=Oe([Kg],Jz,{memoizeOptions:{resultEqualityCheck:PS}}),tB=(t,e)=>{var n=e.chartData,r=n===void 0?[]:n,i=e.dataStartIndex,s=e.dataEndIndex;return t.length>0?t:r.slice(i,s+1)},D2=Oe([eB,wS],tB),nre=(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})),nB=(t,e,n,r,i,s)=>{var o=r.chartData,a=o===void 0?[]:o,l=r.dataStartIndex,c=r.dataEndIndex,d=nre(t,e,n);if(i&&(e==null?void 0:e.dataKey)!=null&&s.length>0){var f=a.slice(l,c+1),m=f.map(y=>({value:yi(y,e.dataKey)})).filter(y=>y.value!=null);return[...m,...d]}return d},ix=Oe([D2,Ps,Kg,wS,tre,eB],nB);function ng(t){if(Ol(t)||t instanceof Date){var e=Number(t);if(wn(e))return e}}function mL(t){if(Array.isArray(t)){var e=[ng(t[0]),ng(t[1])];return Tl(e)?e:void 0}var n=ng(t);if(n!=null)return[n,n]}function jl(t){return t.map(ng).filter(Ys)}function rre(t,e){var n=ng(t),r=ng(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var ire=Oe([ix],t=>t==null?void 0:t.map(e=>e.value).sort(rre));function rB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function sre(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!kl(e))r=e;else if(Array.isArray(e)){var i=jl(e);i.length>0&&(r=Math.max(...i))}return r==null?[]:jl(n.flatMap(s=>{var o=yi(t,s.dataKey),a,l;if(Array.isArray(o)){var c=Gz(o,2);a=c[0],l=c[1]}else a=l=o;if(!(!wn(a)||!wn(l)))return[r-a,r+l]}))}var ai=t=>{var e=_i(t),n=Xg(t);return rx(t,e,n)},Rg=Oe([ai],t=>t==null?void 0:t.dataKey),ore=Oe([Zz,wS,ai],az),iB=(t,e,n,r)=>{var i={},s=e.reduce((o,a)=>{if(a.stackId==null)return o;var l=o[a.stackId];return l==null&&(l=[]),l.push(a),o[a.stackId]=l,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var a=Gz(o,2),l=a[0],c=a[1],d=r?[...c].reverse():c,f=d.map(l2);return[l,{stackedData:MY(t,f,n),graphicalItems:d}]}))},sB=Oe([ore,Zz,SS,ez],iB),oB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return CY(t,i,s)},are=Oe([Ps],t=>t.allowDataOverflow),j2=t=>{var e;if(t==null||!("domain"in t))return RC;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=jl(t.ticks);return[Math.min(...n),Math.max(...n)]}if(t.type==="category")return t.ticks.map(String)}return(e=t==null?void 0:t.domain)!==null&&e!==void 0?e:RC},aB=Oe([Ps],j2),lB=Oe([aB,are],V4),lre=Oe([sB,$a,bi,lB],oB,{memoizeOptions:{resultEqualityCheck:CS}}),U2=t=>t.errorBars,cre=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>rB(n,r)),Bw=function(){for(var e=arguments.length,n=new Array(e),r=0;r5&&arguments[5]!==void 0?arguments[5]:[],a,l;if(r.length>0&&r.forEach(c=>{var d,f=c.data!=null?[...c.data]:o,m=(d=i[c.id])===null||d===void 0?void 0:d.filter(y=>rB(s,y));f.forEach(y=>{var x,S=yi(y,(x=n.dataKey)!==null&&x!==void 0?x:c.dataKey),w=sre(y,S,m);if(w.length>=2){var _=Math.min(...w),E=Math.max(...w);(a==null||_l)&&(l=E)}var T=mL(S);T!=null&&(a=a==null?T[0]:Math.min(a,T[0]),l=l==null?T[1]:Math.max(l,T[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&e.forEach(c=>{var d=mL(yi(c,n.dataKey));d!=null&&(a=a==null?d[0]:Math.min(a,d[0]),l=l==null?d[1]:Math.max(l,d[1]))}),wn(a)&&wn(l))return[a,l]},ure=Oe([D2,Ps,ere,U2,bi,zJ],cB,{memoizeOptions:{resultEqualityCheck:CS}});function dre(t){var e=t.value;if(Ol(e)||e instanceof Date)return e}var fre=(t,e,n)=>{var r=t.map(dre).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&b5(r))?H4(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},uB=t=>t.referenceElements.dots,Yg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),hre=Oe([uB,bi,TS],Yg),dB=t=>t.referenceElements.areas,pre=Oe([dB,bi,TS],Yg),fB=t=>t.referenceElements.lines,mre=Oe([fB,bi,TS],Yg),hB=(t,e)=>{if(t!=null){var n=jl(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},gre=Oe(hre,bi,hB),pB=(t,e)=>{if(t!=null){var n=jl(t.flatMap(r=>[e==="xAxis"?r.x1:r.y1,e==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},vre=Oe([pre,bi],pB);function yre(t){var e;if(t.x!=null)return jl([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:jl(n)}function xre(t){var e;if(t.y!=null)return jl([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:jl(n)}var mB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?yre(r):xre(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},bre=Oe([mre,bi],mB),_re=Oe(gre,bre,vre,(t,e,n)=>Bw(t,n,e)),gB=(t,e,n,r,i,s,o,a)=>{if(n!=null)return n;var l=o==="vertical"&&a==="xAxis"||o==="horizontal"&&a==="yAxis",c=l?Bw(r,s,i):Bw(s,i);return $J(e,c,t.allowDataOverflow)},wre=Oe([Ps,aB,lB,lre,ure,_re,fr,bi],gB,{memoizeOptions:{resultEqualityCheck:CS}}),Sre=[0,1],vB=(t,e,n,r,i,s,o)=>{if(!((t==null||n==null||n.length===0)&&o===void 0)){var a=t.dataKey,l=t.type,c=Bl(e,s);if(c&&a==null){var d;return H4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?fre(r,t,c):i==="expand"&&!c?Sre:o}},F2=Oe([Ps,fr,D2,ix,SS,bi,wre],vB),Zg=Oe([Ps,Xz,n2],Hz),yB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=j2(e),s=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&Tl(t)){if(s)return MO(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return EO(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&Tl(t))return MO(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&Tl(t))return EO(t,e.tickCount,e.allowDecimals,"adaptive")}}},z2=Oe([F2,rx,Zg],yB),xB=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&Tl(e)&&Array.isArray(n)&&n.length>0){var i,s,o=e[0],a=(i=n[0])!==null&&i!==void 0?i:0,l=e[1],c=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,a),Math.max(l,c)]}return e},Mre=Oe([Ps,F2,z2,bi],xB),Ere=Oe(ix,Ps,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(jl(t.map(f=>f.value))).sort((f,m)=>f-m),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var a=0;ai,(t,e,n,r,i)=>{if(!wn(t))return 0;var s=e==="vertical"?r.height:r.width;if(i==="gap")return t*s/2;if(i==="no-gap"){var o=Ad(n,t*s),a=t*s/2;return a-o-(a-o)/s*o}return 0}),Are=(t,e,n)=>{var r=iu(t,e);return r==null||typeof r.padding!="string"?0:bB(t,"xAxis",e,n,r.padding)},Tre=(t,e,n)=>{var r=su(t,e);return r==null||typeof r.padding!="string"?0:bB(t,"yAxis",e,n,r.padding)},Cre=Oe(iu,Are,(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}}),Pre=Oe(su,Tre,(t,e)=>{var n,r;if(t==null)return{top:0,bottom:0};var i=t.padding;return typeof i=="string"?{top:e,bottom:e}:{top:((n=i.top)!==null&&n!==void 0?n:0)+e,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+e}}),_B=Oe([Gi,Cre,gS,mS,(t,e,n)=>n],(t,e,n,r,i)=>{var s=r.padding;return i?[s.left,n.width-s.right]:[t.left+e.left,t.left+t.width-e.right]}),wB=Oe([Gi,fr,Pre,gS,mS,(t,e,n)=>n],(t,e,n,r,i,s)=>{var o=i.padding;return s?[r.height-o.bottom,o.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),sx=(t,e,n,r)=>{var i;switch(e){case"xAxis":return _B(t,n,r);case"yAxis":return wB(t,n,r);case"zAxis":return(i=L2(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return iz(t);case"radiusAxis":return sz(t,n);default:return}},SB=Oe([Ps,sx],MS),Rre=Oe([Zg,Mre],uee),B2=Oe([Ps,Zg,Rre,SB],O2),MB=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var i=n.type,s=n.scale,o=Bl(t,r);if(o&&(i==="number"||s!=="auto"))return e.map(a=>a.value)}},H2=Oe([fr,ix,rx,bi],MB),DS=Oe([B2],u2);Oe([B2],Vne);Oe([B2,ire],Vz);Oe([Kg,U2,bi],cre);function EB(t,e){return t.ide.id?1:0}var jS=(t,e)=>e,US=(t,e,n)=>n,Nre=Oe(hS,jS,US,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(EB)),Ire=Oe(pS,jS,US,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(EB)),AB=(t,e)=>({width:t.width,height:e.height}),kre=(t,e)=>{var n=typeof e.width=="number"?e.width:qy;return{width:n,height:t.height}},Ore=Oe(Gi,iu,AB),Lre=(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}},jre=Oe(nu,Gi,Nre,jS,US,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=AB(e,a);o==null&&(o=Lre(e,r,t));var c=r==="top"&&!i||r==="bottom"&&i;s[a.id]=o-Number(c)*l.height,o+=(c?-1:1)*l.height}),s}),Ure=Oe(tu,Gi,Ire,jS,US,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=kre(e,a);o==null&&(o=Dre(e,r,t));var c=r==="left"&&!i||r==="right"&&i;s[a.id]=o-Number(c)*l.width,o+=(c?-1:1)*l.width}),s}),Fre=(t,e)=>{var n=iu(t,e);if(n!=null)return jre(t,n.orientation,n.mirror)},zre=Oe([Gi,iu,Fre,(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}}}),Bre=(t,e)=>{var n=su(t,e);if(n!=null)return Ure(t,n.orientation,n.mirror)},Hre=Oe([Gi,su,Bre,(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}}}),Vre=Oe(Gi,su,(t,e)=>{var n=typeof e.width=="number"?e.width:qy;return{width:n,height:t.height}}),TB=(t,e,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,s=n.type,o=n.dataKey,a=Bl(t,r),l=e.map(d=>d.value),c=l.filter(d=>d!=null);if(o&&a&&s==="category"&&i&&b5(c))return l}},V2=Oe([fr,ix,Ps,bi],TB),gL=Oe([fr,Qne,Zg,DS,V2,H2,sx,z2,bi],(t,e,n,r,i,s,o,a,l)=>{if(e!=null){var c=Bl(t,l);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:l,categoricalDomain:s,duplicateDomain:i,isCategorical:c,niceTicks:a,range:o,realScaleType:n,scale:r}}}),Gre=(t,e,n,r,i,s,o,a,l)=>{if(!(e==null||r==null)){var c=Bl(t,l),d=e.type,f=e.ticks,m=e.tickCount,y=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/y:0;x=l==="angleAxis"&&s!=null&&s.length>=2?Wo(s[0]-s[1])*2*x:x;var S=f||i;return S?S.map((w,_)=>{var E=o?o.indexOf(w):w,T=r.map(E);return wn(T)?{index:_,coordinate:T+x,value:w,offset:x}:null}).filter(Ys):c&&a?a.map((w,_)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:w,index:_,offset:x}:null}).filter(Ys):r.ticks?r.ticks(m).map((w,_)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:w,index:_,offset:x}:null}).filter(Ys):r.domain().map((w,_)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:o?o[w]:w,index:_,offset:x}:null}).filter(Ys)}},CB=Oe([fr,rx,Zg,DS,z2,sx,V2,H2,bi],Gre),Wre=(t,e,n,r,i,s,o)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var a=Bl(t,o),l=e.tickCount,c=0;return c=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Wo(r[0]-r[1])*2*c:c,a&&s?s.map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:d,index:f,offset:c}:null}).filter(Ys):n.ticks?n.ticks(l).map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:d,index:f,offset:c}:null}).filter(Ys):n.domain().map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:i?i[d]:d,index:f,offset:c}:null}).filter(Ys)}},PB=Oe([fr,rx,DS,sx,V2,H2,bi],Wre),RB=Oe(Ps,DS,(t,e)=>{if(!(t==null||e==null))return zw(zw({},t),{},{scale:e})}),$re=Oe([Ps,Zg,F2,SB],O2),Xre=Oe([$re],u2);Oe((t,e,n)=>L2(t,n),Xre,(t,e)=>{if(!(t==null||e==null))return zw(zw({},t),{},{scale:e})});var qre=Oe([fr,hS,pS],(t,e,n)=>{switch(t){case"horizontal":return e.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),Kre=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};Oe([Kre],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,i=t[0];for(var s of t){var o=Math.abs(s.coordinate-e);ot.options.defaultTooltipEventType,IB=t=>t.options.validateTooltipEventTypes;function kB(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function ox(t,e){var n=NB(t),r=IB(t);return kB(e,n,r)}function Yre(t){return Bt(e=>ox(e,t))}var OB=(t,e)=>{var n,r=Number(e);if(!(kl(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},Zre=t=>t.tooltip.settings,cd={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},Qre={itemInteraction:{click:cd,hover:cd},axisInteraction:{click:cd,hover:cd},keyboardInteraction:cd,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},LB=cs({name:"tooltip",initialState:Qre,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:sr()},replaceTooltipEntrySettings:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).tooltipItemPayloads.indexOf(r);s>-1&&(t.tooltipItemPayloads[s]=i)},prepare:sr()},removeTooltipEntrySettings:{reducer(t,e){var n=$o(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:sr()},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}}}),ta=LB.actions,Jre=ta.addTooltipEntrySettings,eie=ta.replaceTooltipEntrySettings,tie=ta.removeTooltipEntrySettings,nie=ta.setTooltipSettingsState,rie=ta.setActiveMouseOverItemIndex;ta.mouseLeaveItem;var DB=ta.mouseLeaveChart;ta.setActiveClickItemIndex;var jB=ta.setMouseOverAxisIndex,iie=ta.setMouseClickAxisIndex,B0=ta.setSyncInteraction,Hw=ta.setKeyboardInteraction,sie=LB.reducer;function vL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function kb(t){for(var e=1;e{if(e==null)return cd;var i=cie(t,e,n);if(i==null)return cd;if(i.active)return i;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&t.syncInteraction.index!=null)return t.syncInteraction;var s=t.settings.active===!0;if(uie(i)){if(s)return kb(kb({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return kb(kb({},cd),{},{coordinate:i.coordinate})};function die(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 fie(t,e){var n=die(t),r=e[0],i=e[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function hie(t,e,n){if(n==null||e==null)return!0;var r=yi(t,e);return r==null||!Tl(n)?!0:fie(r,n)}var $0=(t,e,n,r)=>{var i=t==null?void 0:t.index;if(i==null)return null;var s=Number(i);if(!wn(s))return i;var o=0,a=1/0;e.length>0&&(a=e.length-1);var l=Math.max(o,Math.min(s,a)),c=e[l];return c==null||hie(c,n,r)?String(l):null},FB=(t,e,n,r,i,s,o)=>{if(s!=null){var a=o[0],l=a==null?void 0:a.getPosition(s);if(l!=null)return l;var c=i==null?void 0:i[Number(s)];if(c)switch(n){case"horizontal":return{x:c.coordinate,y:(r.top+e)/2};default:return{x:(r.left+t)/2,y:c.coordinate}}}},zB=(t,e,n,r)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=t.itemInteraction.hover.graphicalItemId:i=t.itemInteraction.click.graphicalItemId,t.syncInteraction.active&&i==null)return t.tooltipItemPayloads;if(i==null&&(r!=null||t.keyboardInteraction.active)){var s=t.tooltipItemPayloads[0];return s!=null?[s]:[]}return t.tooltipItemPayloads.filter(o=>{var a;return((a=o.settings)===null||a===void 0?void 0:a.graphicalItemId)===i})},BB=t=>t.options.tooltipPayloadSearcher,Qg=t=>t.tooltip;function yL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function xL(t){for(var e=1;et(e)}function bL(t){if(typeof t=="string")return t}function bie(t){if(!(t==null||typeof t!="object")){var e="name"in t?vie(t.name):void 0,n="unit"in t?yie(t.unit):void 0,r="dataKey"in t?xie(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?bL(t.color):void 0,o="fill"in t?bL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:o}}}function _ie(t,e){return t??e}var HB=(t,e,n,r,i,s,o)=>{if(!(e==null||s==null)){var a=n.chartData,l=n.computedData,c=n.dataStartIndex,d=n.dataEndIndex,f=[];return t.reduce((m,y)=>{var x,S=y.dataDefinedOnItem,w=y.settings,_=_ie(S,a),E=Array.isArray(_)?h4(_,c,d):_,T=(x=w==null?void 0:w.dataKey)!==null&&x!==void 0?x:r,C=w==null?void 0:w.nameKey,O;if(r&&Array.isArray(E)&&!Array.isArray(E[0])&&o==="axis"?O=_5(E,r,i):O=s(E,e,l,C),Array.isArray(O))O.forEach(D=>{var F,G,k=bie(D),U=k==null?void 0:k.name,H=k==null?void 0:k.dataKey,ne=k==null?void 0:k.payload,te=xL(xL({},w),{},{name:U,unit:k==null?void 0:k.unit,color:(F=k==null?void 0:k.color)!==null&&F!==void 0?F:w==null?void 0:w.color,fill:(G=k==null?void 0:k.fill)!==null&&G!==void 0?G:w==null?void 0:w.fill});m.push(pk({tooltipEntrySettings:te,dataKey:H,payload:ne,value:yi(ne,H),name:U==null?void 0:String(U)}))});else{var N;m.push(pk({tooltipEntrySettings:w,dataKey:T,payload:O,value:yi(O,T),name:(N=yi(O,C))!==null&&N!==void 0?N:w==null?void 0:w.name}))}return m},f)}},G2=Oe([ai,Xz,n2],Hz),wie=Oe([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),Sie=Oe([_i,Xg],qz),Qh=Oe([wie,ai,Sie],Yz,{memoizeOptions:{resultEqualityCheck:PS}}),Mie=Oe([Qh],t=>t.filter(c2)),VB=Oe([Qh],Jz,{memoizeOptions:{resultEqualityCheck:PS}}),Eie=Oe([Qh],t=>t.some(e=>!e.data)),Lh=Oe([VB,$a],tB),Aie=Oe([Mie,$a,ai],az),W2=Oe([Lh,ai,Qh,$a,Eie,VB],nB),GB=Oe([ai],j2),Tie=Oe([ai],t=>t.allowDataOverflow),WB=Oe([GB,Tie],V4),Cie=Oe([Qh],t=>t.filter(c2)),Pie=Oe([Aie,Cie,SS,ez],iB),Rie=Oe([Pie,$a,_i,WB],oB),Nie=Oe([Qh],Qz),Iie=Oe([Lh,ai,Nie,U2,_i,BJ],cB,{memoizeOptions:{resultEqualityCheck:CS}}),kie=Oe([uB,_i,Xg],Yg),Oie=Oe([kie,_i],hB),Lie=Oe([dB,_i,Xg],Yg),Die=Oe([Lie,_i],pB),jie=Oe([fB,_i,Xg],Yg),Uie=Oe([jie,_i],mB),Fie=Oe([Oie,Uie,Die],Bw),zie=Oe([ai,GB,WB,Rie,Iie,Fie,fr,_i],gB),Ng=Oe([ai,fr,Lh,W2,SS,_i,zie],vB),Bie=Oe([Ng,ai,G2],yB),Hie=Oe([ai,Ng,Bie,_i],xB),$B=t=>{var e=_i(t),n=Xg(t),r=!1;return sx(t,e,n,r)},XB=Oe([ai,$B],MS),Vie=Oe([ai,G2,Hie,XB],O2),qB=Oe([Vie],u2),Gie=Oe([fr,W2,ai,_i],TB),Wie=Oe([fr,W2,ai,_i],MB),$ie=(t,e,n,r,i,s,o,a)=>{if(e){var l=e.type,c=Bl(t,a);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=l==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=a==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Wo(i[0]-i[1])*2*f:f,c&&o?o.map((m,y)=>{var x=r.map(m);return wn(x)?{coordinate:x+f,value:m,index:y,offset:f}:null}).filter(Ys):r.domain().map((m,y)=>{var x=r.map(m);return wn(x)?{coordinate:x+f,value:s?s[m]:m,index:y,offset:f}:null}).filter(Ys)}}},ou=Oe([fr,ai,G2,qB,$B,Gie,Wie,_i],$ie),$2=Oe([NB,IB,Zre],(t,e,n)=>kB(n.shared,t,e)),KB=t=>t.tooltip.settings.trigger,X2=t=>t.tooltip.settings.defaultIndex,ax=Oe([Qg,$2,KB,X2],UB),Sy=Oe([ax,Lh,Rg,Ng],$0),YB=Oe([ou,Sy],OB),Xie=Oe([ax],t=>{if(t)return t.dataKey}),qie=Oe([ax],t=>{if(t)return t.graphicalItemId}),ZB=Oe([Qg,$2,KB,X2],zB),Kie=Oe([tu,nu,fr,Gi,ou,X2,ZB],FB),Yie=Oe([ax,Kie],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Zie=Oe([ax],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),Qie=Oe([ZB,Sy,$a,Rg,YB,BB,$2],HB),Jie=Oe([Qie],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function _L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wL(t){for(var e=1;eBt(ai),ise=()=>{var t=rse(),e=Bt(ou),n=Bt(qB);return yw(!t||!n?void 0:wL(wL({},t),{},{scale:n}),e)};function SL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function 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}},cse=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="centric"){var s=i.coordinate,o=r.radius;return cm(cm(cm({},r),zi(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var a=i.coordinate,l=r.angle;return cm(cm(cm({},r),zi(r.cx,r.cy,a,l)),{},{angle:l,radius:a})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function use(t,e){var n=t.relativeX,r=t.relativeY;return n>=e.left&&n<=e.left+e.width&&r>=e.top&&r<=e.top+e.height}var QB=(t,e,n,r,i)=>{var s,o=(s=e==null?void 0:e.length)!==null&&s!==void 0?s:0;if(o<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var a=0;a0?(l=n[a-1])===null||l===void 0?void 0:l.coordinate:(c=n[o-1])===null||c===void 0?void 0:c.coordinate,x=(d=n[a])===null||d===void 0?void 0:d.coordinate,S=a>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(m=n[a+1])===null||m===void 0?void 0:m.coordinate,w=void 0;if(!(y==null||x==null||S==null))if(Wo(x-y)!==Wo(S-x)){var _=[];if(Wo(S-x)===Wo(i[1]-i[0])){w=S;var E=x+i[1]-i[0];_[0]=Math.min(E,(E+y)/2),_[1]=Math.max(E,(E+y)/2)}else{w=y;var T=S+i[1]-i[0];_[0]=Math.min(x,(T+x)/2),_[1]=Math.max(x,(T+x)/2)}var C=[Math.min(x,(w+x)/2),Math.max(x,(w+x)/2)];if(t>C[0]&&t<=C[1]||t>=_[0]&&t<=_[1]){var O;return(O=n[a])===null||O===void 0?void 0:O.index}}else{var N=Math.min(y,S),D=Math.max(y,S);if(t>(N+x)/2&&t<=(D+x)/2){var F;return(F=n[a])===null||F===void 0?void 0:F.index}}}else if(e)for(var G=0;G(k.coordinate+H.coordinate)/2||G>0&&G(k.coordinate+H.coordinate)/2&&t<=(k.coordinate+U.coordinate)/2)return k.index}}return-1},JB=()=>Bt(n2),q2=(t,e)=>e,eH=(t,e,n)=>n,K2=(t,e,n,r)=>r,dse=Oe(ou,t=>nS(t,e=>e.coordinate)),Y2=Oe([Qg,q2,eH,K2],UB),Z2=Oe([Y2,Lh,Rg,Ng],$0),fse=(t,e,n)=>{if(e!=null){var r=Qg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},tH=Oe([Qg,q2,eH,K2],zB),Vw=Oe([tu,nu,fr,Gi,ou,K2,tH],FB),hse=Oe([Y2,Vw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),nH=Oe([ou,Z2],OB),pse=Oe([tH,Z2,$a,Rg,nH,BB,q2],HB),mse=Oe([Y2,Z2],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),gse=(t,e,n,r,i,s,o)=>{if(!(!t||!n||!r||!i)&&use(t,o)){var a=PY(t,e),l=QB(a,s,i,n,r),c=lse(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},vse=(t,e,n,r,i,s,o)=>{if(!(!t||!r||!i||!s||!n)){var a=IJ(t,n);if(a){var l=RY(a,e),c=QB(l,o,s,r,i),d=cse(e,s,c,a);return{activeIndex:String(c),activeCoordinate:d}}}},yse=(t,e,n,r,i,s,o,a)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?gse(t,e,r,i,s,o,a):vse(t,e,n,r,i,s,o)},xse=Oe(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}}),bse=Oe(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:cee}});function ML(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function EL(t){for(var e=1;eEL(EL({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),Mse)},Ase=new Set(Object.values(Ms));function Tse(t){return Ase.has(t)}var rH=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:sr()},unregisterZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!Tse(n)&&delete t.zIndexMap[n])},prepare:sr()},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:sr()},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:sr()}}}),FS=rH.actions,Cse=FS.registerZIndexPortal,zE=FS.unregisterZIndexPortal,Pse=FS.registerZIndexPortalElement,Rse=FS.unregisterZIndexPortalElement,Nse=rH.reducer;function au(t){var e=t.zIndex,n=t.children,r=pZ(),i=r&&e!==void 0&&e!==0,s=Js(),o=R.useRef(void 0),a=R.useRef(new Set),l=Wr(),c=Bt(f=>xse(f,e,s));if(R.useLayoutEffect(()=>{if(!i){var f=a.current;f.forEach(y=>{l(zE({zIndex:y}))}),f.clear(),o.current=void 0;return}if(a.current.has(e)||(l(Cse({zIndex:e})),a.current.add(e)),c){o.current=c;var m=a.current;m.forEach(y=>{y!==e&&(l(zE({zIndex:y})),m.delete(y))})}},[l,e,i,c]),R.useLayoutEffect(()=>{var f=a.current;return()=>{f.forEach(m=>{l(zE({zIndex:m}))}),f.clear()}},[l]),!i)return n;var d=c??o.current;return d?X1.createPortal(n,d):null}function NC(){return NC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.useContext(iH),BE={exports:{}},TL;function Fse(){return TL||(TL=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function s(l,c,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new i(d,f||l,m),x=n?n+c:c;return l._events[x]?l._events[x].fn?l._events[x]=[l._events[x],y]:l._events[x].push(y):(l._events[x]=y,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],d,f;if(this._eventsCount===0)return c;for(f in d=this._events)e.call(d,f)&&c.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},a.prototype.listeners=function(c){var d=n?n+c:c,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,y=f.length,x=new Array(y);m{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!kl(n))return t[n]}},Vse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},sH=cs({name:"options",initialState:Vse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),Gse=sH.reducer,Wse=sH.actions.createEventEmitter;function $se(t){return t.tooltip.syncInteraction}var Xse={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},oH=cs({name:"chartData",initialState:Xse,reducers:{setChartData(t,e){if(t.chartData=e.payload,e.payload==null){t.dataStartIndex=0,t.dataEndIndex=0;return}e.payload.length>0&&t.dataEndIndex!==e.payload.length-1&&(t.dataEndIndex=e.payload.length-1)},setComputedData(t,e){t.computedData=e.payload},setDataStartEndIndexes(t,e){var n=e.payload,r=n.startIndex,i=n.endIndex;r!=null&&(t.dataStartIndex=r),i!=null&&(t.dataEndIndex=i)}}}),Q2=oH.actions,PL=Q2.setChartData,qse=Q2.setDataStartEndIndexes;Q2.setComputedData;var Kse=oH.reducer,Yse=["x","y"];function RL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function um(t){for(var e=1;el.rootProps.className);R.useEffect(()=>{if(t==null)return Vg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var m;if(o&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var y=d.payload.coordinate,x=y.x,S=y.y,w=eoe(y,Yse),_=d.payload.sourceViewBox,E=_.x,T=_.y,C=_.width,O=_.height,N=um(um({},w),{},{x:o.x+(C?(x-E)/C:0)*o.width,y:o.y+(O?(S-T)/O:0)*o.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 F={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},G=r(i,F);D=i[G]}else r==="value"&&(D=i.find(fe=>String(fe.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||o==null){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(D==null){n(B0({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var U=k.x,H=k.y,ne=Math.min(U,o.x+o.width),te=Math.min(H,o.y+o.height),he={x:s==="horizontal"?D.coordinate:ne,y:s==="horizontal"?te:D.coordinate},se=B0({active:d.payload.active,coordinate:he,dataKey:d.payload.dataKey,index:String(D.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(se)}}};return My.on(IC,l),()=>{My.off(IC,l)}},[a,n,e,t,r,i,s,o])}function roe(){var t=Bt(r2),e=Bt(i2),n=Wr();R.useEffect(()=>{if(t==null)return Vg;var r=(i,s,o)=>{e!==o&&t===i&&n(qse(s))};return My.on(CL,r),()=>{My.off(CL,r)}},[n,e,t])}function ioe(){var t=Wr();R.useEffect(()=>{t(Wse())},[t]),noe(),roe()}function soe(t,e,n,r,i,s){var o=Bt(x=>fse(x,t,e)),a=Bt(qie),l=Bt(i2),c=Bt(r2),d=Bt(tz),f=Bt($se),m=(f==null?void 0:f.sourceViewBox)!=null,y=vS();R.useEffect(()=>{if(!m&&c!=null&&l!=null){var x=B0({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:a});My.emit(IC,c,x,l)}},[m,n,o,a,i,r,l,c,d,s,y])}function NL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function IL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{D(nie({shared:E,trigger:T,axisId:N,active:i,defaultIndex:F}))},[D,E,T,N,i,F]);var G=vS(),k=O4(),U=Yre(E),H=(e=Bt(Ke=>mse(Ke,U,T,F)))!==null&&e!==void 0?e:{},ne=H.activeIndex,te=H.isActive,he=Bt(Ke=>pse(Ke,U,T,F)),se=Bt(Ke=>nH(Ke,U,T,F)),fe=Bt(Ke=>hse(Ke,U,T,F)),B=he,J=Use(),Y=(n=i??te)!==null&&n!==void 0?n:!1,V=mK([B,Y]),q=coe(V,2),pe=q[0],ae=q[1],le=U==="axis"?se:void 0;soe(U,T,fe,le,ne,Y);var be=O??J;if(be==null||G==null||U==null)return null;var Se=B??OL;Y||(Se=OL),c&&Se.length&&(Se=Uq(Se.filter(Ke=>Ke.value!=null&&(Ke.hide!==!0||r.includeHidden)),m,poe));var qe=Se.length>0,Me=IL(IL({},r),{},{payload:Se,label:le,active:Y,activeIndex:ne,coordinate:fe,accessibilityLayer:k}),$e=R.createElement(AQ,{allowEscapeViewBox:s,animationDuration:o,animationEasing:a,isAnimationActive:d,active:Y,coordinate:fe,hasPayload:qe,offset:f,position:y,reverseDirection:x,useTranslate3d:S,viewBox:G,wrapperStyle:w,lastBoundingBox:pe,innerRef:ae,hasPortalFromProps:!!O},moe(l,Me));return R.createElement(R.Fragment,null,X1.createPortal($e,be),Y&&R.createElement(jse,{cursor:_,tooltipEventType:U,coordinate:fe,payload:Se,index:ne}))}function yoe(t,e,n){return(e=xoe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function xoe(t){var e=boe(t,"string");return typeof e=="symbol"?e:e+""}function boe(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 _oe{constructor(e){yoe(this,"cache",new Map),this.maxSize=e}get(e){var n=this.cache.get(e);return n!==void 0&&(this.cache.delete(e),this.cache.set(e,n)),n}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(e,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function LL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function woe(t){for(var e=1;e{try{var n=document.getElementById(jL);n||(n=document.createElement("span"),n.setAttribute("id",jL),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Toe,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},X0=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Qy.isSsr)return{width:0,height:0};if(!aH.enableCache)return UL(e,n);var r=Coe(e,n),i=DL.get(r);if(i)return i;var s=UL(e,n);return DL.set(r,s),s},lH;function Gw(t,e){return Ioe(t)||Noe(t,e)||Roe(t,e)||Poe()}function Poe(){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 Roe(t,e){if(t){if(typeof t=="string")return FL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?FL(t,e):void 0}}function FL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=t.breakAll,r=t.style;try{var i=[];Hi(e)||(n?i=e.toString().split(""):i=e.toString().split(uH));var s=i.map(a=>({word:a,width:X0(a,r).width})),o=n?0:X0(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function fH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function Qoe(t){return Hi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var hH=(t,e,n,r)=>t.reduce((i,s)=>{var o=s.word,a=s.width,l=i[i.length-1];if(l&&a!=null&&(e==null||r||l.width+a+nt.reduce((e,n)=>e.width>n.width?e:n),Joe="…",$L=(t,e,n,r,i,s,o,a)=>{var l=t.slice(0,e),c=dH({breakAll:n,style:r,children:l+Joe});if(!c)return[!1,[]];var d=hH(c.wordsWithComputedWidth,s,o,a),f=d.length>i||pH(d).width>Number(s);return[f,d]},eae=(t,e,n,r,i)=>{var s=t.maxLines,o=t.children,a=t.style,l=t.breakAll,c=It(s),d=String(o),f=hH(e,r,n,i);if(!c||i)return f;var m=f.length>s||pH(f).width>Number(r);if(!m)return f;for(var y=0,x=d.length-1,S=0,w;y<=x&&S<=d.length-1;){var _=Math.floor((y+x)/2),E=_-1,T=$L(d,E,l,a,s,r,n,i),C=GL(T,2),O=C[0],N=C[1],D=$L(d,_,l,a,s,r,n,i),F=GL(D,1),G=F[0];if(!O&&!G&&(y=_+1),O&&G&&(x=_-1),!O&&G){w=N;break}S++}return w||f},XL=t=>{var e=Hi(t)?[]:t.toString().split(uH);return[{words:e,width:void 0}]},tae=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,o=t.maxLines;if((e||n)&&!Qy.isSsr){var a,l,c=dH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;a=d,l=f}else return XL(r);return eae({breakAll:s,children:r,maxLines:o,style:i},a,l,e,!!n)}return XL(r)},mH="#808080",nae={angle:0,breakAll:!1,capHeight:"0.71em",fill:mH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},J2=R.forwardRef((t,e)=>{var n=Jo(t,nae),r=n.x,i=n.y,s=n.lineHeight,o=n.capHeight,a=n.fill,l=n.scaleToFit,c=n.textAnchor,d=n.verticalAnchor,f=VL(n,Woe),m=R.useMemo(()=>tae({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),y=f.dx,x=f.dy,S=f.angle,w=f.className,_=f.breakAll,E=VL(f,$oe);if(!Ol(r)||!Ol(i)||m.length===0)return null;var T=Number(r)+(It(y)?y:0),C=Number(i)+(It(x)?x:0);if(!wn(T)||!wn(C))return null;var O;switch(d){case"start":O=HE("calc(".concat(o,")"));break;case"middle":O=HE("calc(".concat((m.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:O=HE("calc(".concat(m.length-1," * -").concat(s,")"));break}var N=[],D=m[0];if(l&&D!=null){var F=D.width,G=f.width;N.push("scale(".concat(It(G)&&It(F)?G/F:1,")"))}return S&&N.push("rotate(".concat(S,", ").concat(T,", ").concat(C,")")),N.length&&(E.transform=N.join(" ")),R.createElement("text",kC({},Ko(E),{ref:e,x:T,y:C,className:er("recharts-text",w),textAnchor:c,fill:a.includes("url")?mH:a}),m.map((k,U)=>{var H=k.words.join(_?"":" ");return R.createElement("tspan",{x:T,dy:U===0?O:s,key:"".concat(H,"-").concat(U)},H)}))});J2.displayName="Text";function qL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function pl(t){for(var e=1;e{var e=t.viewBox,n=t.position,r=t.offset,i=r===void 0?0:r,s=t.parentViewBox,o=XP(e),a=o.x,l=o.y,c=o.height,d=o.upperWidth,f=o.lowerWidth,m=a,y=a+(d-f)/2,x=(m+y)/2,S=(d+f)/2,w=m+d/2,_=c>=0?1:-1,E=_*i,T=_>0?"end":"start",C=_>0?"start":"end",O=d>=0?1:-1,N=O*i,D=O>0?"end":"start",F=O>0?"start":"end",G=s;if(n==="top"){var k={x:m+d/2,y:l-E,horizontalAnchor:"middle",verticalAnchor:T};return G&&(k.height=Math.max(l-G.y,0),k.width=d),k}if(n==="bottom"){var U={x:y+f/2,y:l+c+E,horizontalAnchor:"middle",verticalAnchor:C};return G&&(U.height=Math.max(G.y+G.height-(l+c),0),U.width=f),U}if(n==="left"){var H={x:x-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"};return G&&(H.width=Math.max(H.x-G.x,0),H.height=c),H}if(n==="right"){var ne={x:x+S+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"};return G&&(ne.width=Math.max(G.x+G.width-ne.x,0),ne.height=c),ne}var te=G?{width:S,height:c}:{};return n==="insideLeft"?pl({x:x+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"},te):n==="insideRight"?pl({x:x+S-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"},te):n==="insideTop"?pl({x:m+d/2,y:l+E,horizontalAnchor:"middle",verticalAnchor:C},te):n==="insideBottom"?pl({x:y+f/2,y:l+c-E,horizontalAnchor:"middle",verticalAnchor:T},te):n==="insideTopLeft"?pl({x:m+N,y:l+E,horizontalAnchor:F,verticalAnchor:C},te):n==="insideTopRight"?pl({x:m+d-N,y:l+E,horizontalAnchor:D,verticalAnchor:C},te):n==="insideBottomLeft"?pl({x:y+N,y:l+c-E,horizontalAnchor:F,verticalAnchor:T},te):n==="insideBottomRight"?pl({x:y+f-N,y:l+c-E,horizontalAnchor:D,verticalAnchor:T},te):n&&typeof n=="object"&&(It(n.x)||Rh(n.x))&&(It(n.y)||Rh(n.y))?pl({x:a+Ad(n.x,S),y:l+Ad(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},te):pl({x:w,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},te)},aae=["labelRef"],lae=["content"];function KL(t,e){if(t==null)return{};var n,r,i=cae(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var e=t.x,n=t.y,r=t.upperWidth,i=t.lowerWidth,s=t.width,o=t.height,a=t.children,l=R.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:i,width:s,height:o}),[e,n,r,i,s,o]);return R.createElement(gH.Provider,{value:l},a)},vH=()=>{var t=R.useContext(gH),e=vS();return t||(e?XP(e):void 0)},pae=R.createContext(null),mae=()=>{var t=R.useContext(pae),e=Bt(oz);return t||e},gae=t=>{var e=t.value,n=t.formatter,r=Hi(t.children)?e:t.children;return typeof n=="function"?n(r):r},eR=t=>t!=null&&typeof t=="function",vae=(t,e)=>{var n=Wo(e-t),r=Math.min(Math.abs(e-t),360);return n*r},yae=(t,e,n,r,i)=>{var s=t.offset,o=t.className,a=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,m=i.endAngle,y=i.clockWise,x=(c+d)/2,S=vae(f,m),w=S>=0?1:-1,_,E;switch(e){case"insideStart":_=f+w*s,E=y;break;case"insideEnd":_=m-w*s,E=!y;break;case"end":_=m+w*s,E=y;break;default:throw new Error("Unsupported position ".concat(e))}E=S<=0?E:!E;var T=zi(a,l,x,_),C=zi(a,l,x,_+(E?1:-1)*359),O="M".concat(T.x,",").concat(T.y,` A`).concat(x,",").concat(x,",0,1,").concat(E?0:1,`, - `).concat(C.x,",").concat(C.y),N=Hi(t.id)?ly("recharts-radial-line-"):t.id;return R.createElement("text",Dc({},r,{dominantBaseline:"central",className:er("recharts-radial-bar-label",o)}),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,o=t.outerRadius,a=t.startAngle,l=t.endAngle,c=(a+l)/2;if(n==="outside"){var d=zi(r,i,o+e,c),f=d.x,m=d.y;return{x:f,y:m,textAnchor:f>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var y=(s+o)/2,x=zi(r,i,y,c),S=x.x,w=x.y;return{x:S,y:w,textAnchor:"middle",verticalAnchor:"middle"}},V_=t=>t!=null&&"cx"in t&&kt(t.cx),xae={angle:0,offset:5,zIndex:Ms.label,position:"middle",textBreakAll:!1};function bae(t){if(!V_(t))return t;var e=t.cx,n=t.cy,r=t.outerRadius,i=r*2;return{x:e-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function ld(t){var e=Jo(t,xae),n=e.viewBox,r=e.parentViewBox,i=e.position,s=e.value,o=e.children,a=e.content,l=e.className,c=l===void 0?"":l,d=e.textBreakAll,f=e.labelRef,m=pae(),y=gH(),x=i==="center"?y:m??y,S,w,_;n==null?S=x:V_(n)?S=n:S=$P(n);var E=bae(S);if(!S||Hi(s)&&Hi(o)&&!R.isValidElement(a)&&typeof a!="function")return null;var T=z0(z0({},e),{},{viewBox:S});if(R.isValidElement(a)){T.labelRef;var C=XL(T,oae);return R.cloneElement(a,C)}if(typeof a=="function"){T.content;var O=XL(T,aae);if(w=R.createElement(a,O),R.isValidElement(w))return w}else w=mae(e);var N=Ko(e);if(V_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return vae(e,i,w,N,S);_=yae(S,e.offset,e.position)}else{if(!E)return null;var D=sae({viewBox:E,position:i,offset:e.offset,parentViewBox:V_(r)?void 0:r});_=z0(z0({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(au,{zIndex:e.zIndex},R.createElement(Q2,Dc({ref:f,className:er("recharts-label",c)},N,_,{textAnchor:dH(N.textAnchor)?N.textAnchor:_.textAnchor,breakAll:d}),w))}ld.displayName="Label";var _ae=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?R.createElement(ld,Dc({key:"label-implicit"},r)):Ol(t)?R.createElement(ld,Dc({key:"label-implicit",value:t},r)):R.isValidElement(t)?t.type===ld?R.cloneElement(t,z0({key:"label-implicit"},r)):R.createElement(ld,Dc({key:"label-implicit",content:t},r)):J2(t)?R.createElement(ld,Dc({key:"label-implicit",content:t},r)):t&&typeof t=="object"?R.createElement(ld,Dc({},t,{key:"label-implicit"},r)):null};function wae(t){var e=t.label,n=t.labelRef,r=gH();return _ae(e,r,n)||null}var Sae=["valueAccessor"],Mae=["dataKey","clockWise","id","textBreakAll","zIndex"];function Gw(){return Gw=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(Zoe(e))return e},vH=R.createContext(void 0),Tae=vH.Provider,yH=R.createContext(void 0);yH.Provider;function Cae(){return R.useContext(vH)}function Pae(){return R.useContext(yH)}function G_(t){var e=t.valueAccessor,n=e===void 0?Aae:e,r=KL(t,Sae),i=r.dataKey;r.clockWise;var s=r.id,o=r.textBreakAll,a=r.zIndex,l=KL(r,Mae),c=Cae(),d=Pae(),f=c||d;return!f||!f.length?null:R.createElement(au,{zIndex:a??Ms.label},R.createElement(Yo,{className:"recharts-label-list"},f.map((m,y)=>{var x,S=Hi(i)?n(m,y):yi(m.payload,i),w=Hi(s)?{}:{id:"".concat(s,"-").concat(y)};return R.createElement(ld,Gw({key:"label-".concat(y)},Ko(m),l,w,{fill:(x=r.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:S,textBreakAll:o,viewBox:m.viewBox,index:y,zIndex:0}))})))}G_.displayName="LabelList";function Rae(t){var e=t.label;return e?e===!0?R.createElement(G_,{key:"labelList-implicit"}):R.isValidElement(e)||J2(e)?R.createElement(G_,{key:"labelList-implicit",content:e}):typeof e=="object"?R.createElement(G_,Gw({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function kC(){return kC=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=er("recharts-dot",i);return kt(e)&&kt(n)&&kt(r)?R.createElement("circle",kC({},za(t),DP(t),{className:s,cx:e,cy:n,r})):null},Nae={radiusAxis:{},angleAxis:{}},bH=cs({name:"polarAxis",initialState:Nae,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 Iae=bH.reducer;function kae(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 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 ZL(t){for(var e=1;e{r||(i.current===null?n(Qre(e)):i.current!==e&&n(Jre({prev:i.current,next:e})),i.current=e)},[e,n,r]),R.useLayoutEffect(()=>()=>{i.current&&(n(eie(i.current)),i.current=null)},[n]),null}function Vae(t){var e=t.legendPayload,n=Wr(),r=Js(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(AZ(e)):i.current!==e&&n(TZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),R.useLayoutEffect(()=>()=>{i.current&&(n(CZ(i.current)),i.current=null)},[n]),null}function Gae(t,e){return qae(t)||Xae(t,e)||$ae(t,e)||Wae()}function Wae(){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 $ae(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);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 tR(r,e)}function Zae(t,e){var n=e.map((r,i)=>t[i]);return tR(n,e)}function Qae(t,e){for(var n=new Map,r=0;r{var y=n(f,m);if(y!=null){var x=r.get(y);if(x!==void 0)return i.add(y),x}}),o=[];for(var a of r){var l=Gae(a,2),c=l[0],d=l[1];i.has(c)||o.push(d)}return tR(s,e,o)}function OC(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===eR?Yae(t,e):n===Kae?Zae(t,e):Jae(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(o,a){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(a===0){i.current=!0;return}a===1&&(r.current=o),a>0&&i.current&&l&&(e.current=o)},[e]);return{startValue:r.current,syncStepValue:s}}function ele(t,e){return ile(t)||rle(t,e)||nle(t,e)||tle()}function tle(){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 nle(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{typeof t=="function"&&t(),s(!0)},[t]),a=R.useCallback(()=>{typeof e=="function"&&e(),s(!1)},[e]);return{isAnimating:i,handleAnimationStart:o,handleAnimationEnd:a}}function ole(t){var e,n=t.animationInput,r=t.animationIdPrefix,i=t.items,s=t.previousItemsRef,o=t.isAnimationActive,a=t.animationBegin,l=t.animationDuration,c=t.animationEasing,d=t.onAnimationStart,f=t.onAnimationEnd,m=t.animationInterpolateFn,y=t.animationMatchBy,x=t.shouldUpdatePreviousRef,S=t.children,w=t.layout,_=U4(n,r),E=SH(_,s),T=(e=E.startValue)!==null&&e!==void 0?e:null,C=OC(T,i,y??eR);return R.createElement(j4,{animationId:_,begin:a,duration:l,isActive:o,easing:c,onAnimationEnd:f,onAnimationStart:d,key:_},O=>{var N=T==null,D=i==null?i:m(C,O,w),F=x?x(O):O>0;return E.syncStepValue(D,O,F),D==null?null:S(D,O,N)})}var HE;function ale(t,e){return dle(t)||ule(t,e)||cle(t,e)||lle()}function lle(){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 cle(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{var t=R.useState(()=>ly("uid-")),e=ale(t,1),n=e[0];return n},MH=(HE=V1.useId)!==null&&HE!==void 0?HE:fle;function hle(t,e){var n=MH();return e||(t?"".concat(t,"-").concat(n):n)}var ple=R.createContext(void 0),mle=t=>{var e=t.id,n=t.type,r=t.children,i=hle("recharts-".concat(n),e);return R.createElement(ple.Provider,{value:i},r(i))},gle={cartesianItems:[],polarItems:[]},EH=cs({name:"graphicalItems",initialState:gle,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:sr()},replaceCartesianGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).cartesianItems.indexOf(r);s>-1&&(t.cartesianItems[s]=i)},prepare:sr()},removeCartesianGraphicalItem:{reducer(t,e){var n=$o(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:sr()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:sr()},removePolarGraphicalItem:{reducer(t,e){var n=$o(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:sr()},replacePolarGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).polarItems.indexOf(r);s>-1&&(t.polarItems[s]=i)},prepare:sr()}}}),Jg=EH.actions,vle=Jg.addCartesianGraphicalItem,yle=Jg.replaceCartesianGraphicalItem,xle=Jg.removeCartesianGraphicalItem;Jg.addPolarGraphicalItem;Jg.removePolarGraphicalItem;Jg.replacePolarGraphicalItem;var ble=EH.reducer,_le=t=>{var e=Wr(),n=R.useRef(null);return R.useLayoutEffect(()=>{n.current===null?e(vle(t)):n.current!==t&&e(yle({prev:n.current,next:t})),n.current=t},[e,t]),R.useLayoutEffect(()=>()=>{n.current&&(e(xle(n.current)),n.current=null)},[e]),null},wle=R.memo(_le),Sle=["points"];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 VE(t){for(var e=1;e{var _,E,T=VE(VE(VE({r:3},o),m),{},{index:w,cx:(_=S.x)!==null&&_!==void 0?_:void 0,cy:(E=S.y)!==null&&E!==void 0?E:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return R.createElement(Ple,{key:"dot-".concat(w),option:n,dotProps:T,className:i})}),x={};return a&&l!=null&&(x.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(l,")")),R.createElement(au,{zIndex:d},R.createElement(Yo,Ww({className:r},x),y))}function n3(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 r3(t){for(var e=1;e({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),Wle=ke([Gle,tu,nu],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),nR=()=>Bt(Wle),$le=()=>Bt(Qie);function i3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function GE(t){for(var e=1;e{var e=t.point,n=t.childIndex,r=t.mainColor,i=t.activeDot,s=t.dataKey,o=t.clipPath;if(i===!1||e.x==null||e.y==null)return null;var a={index:n,dataKey:s,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},l=GE(GE(GE({},a),Q1(i)),DP(i)),c;return R.isValidElement(i)?c=R.cloneElement(i,l):typeof i=="function"?c=i(l):c=R.createElement(xH,l),R.createElement(Yo,{className:"recharts-active-dot",clipPath:o},c)};function s3(t){var e=t.points,n=t.mainColor,r=t.activeDot,i=t.itemDataKey,s=t.clipPath,o=t.zIndex,a=o===void 0?Ms.activeDot:o,l=Bt(_y),c=$le();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return Hi(d)?null:R.createElement(au,{zIndex:a},R.createElement(Yle,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var Zle=t=>{var e=t.chartData,n=Wr(),r=Js();return R.useEffect(()=>r?()=>{}:(n(TL(e)),()=>{n(TL(void 0))}),[e,n,r]),null},o3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},CH=cs({name:"brush",initialState:o3,reducers:{setBrushSettings(t,e){return e.payload==null?o3:e.payload}}});CH.actions.setBrushSettings;var Qle=CH.reducer;function Jle(t){return(t%180+180)%180}var ece=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=Jle(i),o=s*Math.PI/180,a=Math.atan(r/n),l=o>a&&o{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=$o(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=$o(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=$o(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),ev=PH.actions;ev.addDot;ev.removeDot;ev.addArea;ev.removeArea;ev.addLine;ev.removeLine;var nce=PH.reducer;function rce(t,e){return ace(t)||oce(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 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(ly("recharts"),"-clip")),r=rce(n,1),i=r[0],s=nR();if(s==null)return null;var o=s.x,a=s.y,l=s.width,c=s.height;return R.createElement(lce.Provider,{value:i},R.createElement("defs",null,R.createElement("clipPath",{id:i},R.createElement("rect",{x:o,y:a,height:c,width:l}))),e)};function 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 fce(t,e){return RH(t,e+1)}function hce(t,e,n,r,i){for(var s=(r||[]).slice(),o=e.start,a=e.end,l=0,c=1,d=o,f=function(){var x=r==null?void 0:r[l];if(x===void 0)return{v:RH(r,c)};var S=l,w,_=()=>(w===void 0&&(w=n(x,S)),w),E=x.coordinate,T=l===0||Sy(t,E,_,d,a);T||(l=0,d=o,c+=1),T&&(d=E+t*(_()/2+i),l+=c)},m;c<=s.length;)if(m=f(),m)return m.v;return[]}function pce(t,e,n,r,i){var s=(r||[]).slice(),o=s.length;if(o===0)return[];for(var a=e.start,l=e.end,c=1;c<=o;c++){for(var d=(o-1)%c,f=a,m=!0,y=function(){var C=r[S];if(C==null)return 0;var O=S,N,D=()=>(N===void 0&&(N=n(C,O)),N),F=C.coordinate,V=S===d||Sy(t,F,D,f,l);if(!V)return m=!1,1;V&&(f=F+t*(D()/2+i))},x,S=d;S(S===void 0&&(S=n(y,m)),S);if(m===o-1){var _=t*(x.coordinate+t*w()/2-l);s[m]=x=ns(ns({},x),{},{tickCoord:_>0?x.coordinate-_*t:x.coordinate})}else s[m]=x=ns(ns({},x),{},{tickCoord:x.coordinate});if(x.tickCoord!=null){var E=Sy(t,x.tickCoord,w,a,l);E&&(l=x.tickCoord-t*(w()/2+i),s[m]=ns(ns({},x),{},{isShow:!0}))}},d=o-1;d>=0;d--)c(d);return s}function xce(t,e,n,r,i,s){var o=(r||[]).slice(),a=o.length,l=e.start,c=e.end;if(s){var d=r[a-1];if(d!=null){var f=n(d,a-1),m=t*(d.coordinate+t*f/2-c);if(o[a-1]=d=ns(ns({},d),{},{tickCoord:m>0?d.coordinate-m*t:d.coordinate}),d.tickCoord!=null){var y=Sy(t,d.tickCoord,()=>f,l,c);y&&(c=d.tickCoord-t*(f/2+i),o[a-1]=ns(ns({},d),{},{isShow:!0}))}}}for(var x=s?a-1:a,S=function(E){var T=o[E];if(T==null)return 1;var C=T,O,N=()=>(O===void 0&&(O=n(T,E)),O);if(E===0){var D=t*(C.coordinate-t*N()/2-l);o[E]=C=ns(ns({},C),{},{tickCoord:D<0?C.coordinate-D*t:C.coordinate})}else o[E]=C=ns(ns({},C),{},{tickCoord:C.coordinate});if(C.tickCoord!=null){var F=Sy(t,C.tickCoord,N,l,c);F&&(l=C.tickCoord+t*(N()/2+i),o[E]=ns(ns({},C),{},{isShow:!0}))}},w=0;w{var D=typeof c=="function"?c(O.value,N):O.value;return x==="width"?uce(W0(D,{fontSize:e,letterSpacing:n}),S,f):W0(D,{fontSize:e,letterSpacing:n})[x]},_=i[0],E=i[1],T=i.length>=2&&_!=null&&E!=null?Wo(E.coordinate-_.coordinate):1,C=dce(s,T,x);return l==="equidistantPreserveStart"?hce(T,C,w,i,o):l==="equidistantPreserveEnd"?pce(T,C,w,i,o):(l==="preserveStart"||l==="preserveStartEnd"?y=xce(T,C,w,i,o,l==="preserveStartEnd"):y=yce(T,C,w,i,o),y.filter(O=>O.isShow))}var bce=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,i=r,s=t.tickSize,o=s===void 0?0:s,a=t.tickMargin,l=a===void 0?0:a,c=0;if(e){Array.from(e).forEach(y=>{if(y){var x=y.getBoundingClientRect();x.width>c&&(c=x.width)}});var d=n?n.getBoundingClientRect().width:0,f=o+l,m=c+f+d+(n?i:0);return Math.round(m)}return 0},_ce={xAxis:{},yAxis:{}},NH=cs({name:"renderedTicks",initialState:_ce,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,wce=IH.setRenderedTicks,Sce=IH.removeRenderedTicks,Mce=NH.reducer,Ece=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function c3(t,e){return Pce(t)||Cce(t,e)||Tce(t,e)||Ace()}function Ace(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tce(t,e){if(t){if(typeof t=="string")return u3(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)?u3(t,e):void 0}}function u3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r==null||n==null)return Vg;var s=e.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return i(wce({ticks:s,axisId:r,axisType:n})),()=>{i(Sce({axisId:r,axisType:n}))}},[i,e,r,n]),null}var Bce=R.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,i=t.tick,s=t.tickLine,o=t.stroke,a=t.tickFormatter,l=t.unit,c=t.padding,d=t.tickTextProps,f=t.orientation,m=t.mirror,y=t.x,x=t.y,S=t.width,w=t.height,_=t.tickSize,E=t.tickMargin,T=t.fontSize,C=t.letterSpacing,O=t.getTicksConfig,N=t.events,D=t.axisType,F=t.axisId,V=rR(Er(Er({},O),{},{ticks:r}),T,C),k=za(O),U=Q1(i),H=dH(k.textAnchor)?k.textAnchor:jce(f,m),ne=Uce(f,m),te={};typeof s=="object"&&(te=s);var he=Er(Er({},k),{},{fill:"none"},te),oe=V.map(q=>Er({entry:q},Dce(q,y,x,S,w,f,_,m,E))),fe=oe.map(q=>{var K=q.entry,$=q.line;return R.createElement(Yo,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(K.value,"-").concat(K.coordinate,"-").concat(K.tickCoord)},s&&R.createElement("line",Dh({},he,$,{className:er("recharts-cartesian-axis-tick-line",Kh(s,"className"))})))}),B=oe.map((q,K)=>{var $,Z,ge=q.entry,le=q.tick,ue=Er(Er(Er(Er({verticalAnchor:ne},k),{},{textAnchor:H,stroke:"none",fill:o},le),{},{index:K,payload:ge,visibleTicksCount:V.length,tickFormatter:a,padding:c},d),{},{angle:($=(Z=d==null?void 0:d.angle)!==null&&Z!==void 0?Z:k.angle)!==null&&$!==void 0?$:0}),_e=Er(Er({},ue),U);return R.createElement(Yo,Dh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(ge.value,"-").concat(ge.coordinate,"-").concat(ge.tickCoord)},WX(N,ge,K)),i&&R.createElement(Fce,{option:i,tickProps:_e,value:"".concat(typeof a=="function"?a(ge.value,K):ge.value).concat(l||"")}))});return R.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(D,"-ticks")},R.createElement(zce,{ticks:V,axisId:F,axisType:D}),B.length>0&&R.createElement(au,{zIndex:Ms.label},R.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(D,"-tick-labels"),ref:e},B)),fe.length>0&&R.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(D,"-tick-lines")},fe))}),Hce=R.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,i=t.height,s=t.className,o=t.hide,a=t.ticks,l=t.axisType,c=t.axisId,d=Rce(t,Ece),f=R.useState(""),m=c3(f,2),y=m[0],x=m[1],S=R.useState(""),w=c3(S,2),_=w[0],E=w[1],T=R.useRef(null);R.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return bce({ticks:T.current,label:(O=t.labelRef)===null||O===void 0?void 0:O.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var C=R.useCallback(O=>{if(O){var N=O.getElementsByClassName("recharts-cartesian-axis-tick-value");T.current=N;var D=N[0];if(D){var F=window.getComputedStyle(D),V=F.fontSize,k=F.letterSpacing;(V!==y||k!==_)&&(x(V),E(k))}}},[y,_]);return o||r!=null&&r<=0||i!=null&&i<=0?null:R.createElement(au,{zIndex:t.zIndex},R.createElement(Yo,{className:er("recharts-cartesian-axis",s)},R.createElement(Lce,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:za(t)}),R.createElement(Bce,{ref:C,axisType:l,events:d,fontSize:y,getTicksConfig:t,height:t.height,letterSpacing:_,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:a,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),R.createElement(fae,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},R.createElement(wae,{label:t.label,labelRef:t.labelRef}),t.children)))}),iR=R.forwardRef((t,e)=>{var n=Jo(t,Wc);return R.createElement(Hce,Dh({},n,{ref:e}))});iR.displayName="CartesianAxis";var Vce=["x1","y1","x2","y2","key"],Gce=["offset"],Wce=["xAxisId","yAxisId"],$ce=["xAxisId","yAxisId"];function f3(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 rs(t){for(var e=1;e{var e=t.fill;if(!e||e==="none")return null;var n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.ry;return R.createElement("rect",{x:r,y:i,ry:a,width:s,height:o,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function 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,o=n.y1,a=n.x2,l=n.y2,c=n.key,d=$w(n,Vce),f=(i=za(d))!==null&&i!==void 0?i:{};f.offset;var m=$w(f,Gce);r=R.createElement("line",rh({},m,{x1:s,y1:o,x2:a,y2:l,fill:"none",key:c}))}return r}function Qce(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,s=t.horizontalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=$w(t,Wce),a=s.map((l,c)=>{var d=rs(rs({},o),{},{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"},a)}function Jce(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,s=t.verticalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=$w(t,$ce),a=s.map((l,c)=>{var d=rs(rs({},o),{},{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"},a)}function eue(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.horizontalPoints,l=t.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length||a==null)return null;var d=a.map(m=>Math.round(m+i-i)).sort((m,y)=>m-y);i!==d[0]&&d.unshift(0);var f=d.map((m,y)=>{var x=d[y+1],S=x==null,w=S?i+o-m:x-m;if(w<=0)return null;var _=y%e.length;return R.createElement("rect",{key:"react-".concat(y),y:m,x:r,height:w,width:s,stroke:"none",fill:e[_],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function tue(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,o=t.y,a=t.width,l=t.height,c=t.verticalPoints;if(!n||!r||!r.length)return null;var d=c.map(m=>Math.round(m+s-s)).sort((m,y)=>m-y);s!==d[0]&&d.unshift(0);var f=d.map((m,y)=>{var x=d[y+1],S=x==null,w=S?s+a-m:x-m;if(w<=0)return null;var _=y%r.length;return R.createElement("rect",{key:"react-".concat(y),x:m,y:o,width:w,height:l,stroke:"none",fill:r[_],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var nue=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return h4(rR(rs(rs(rs({},Wc),n),{},{ticks:p4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},rue=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return h4(rR(rs(rs(rs({},Wc),n),{},{ticks:p4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},iue={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=rs(rs({},Jo(t,iue)),{},{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,o=i.yAxisId,a=i.x,l=i.y,c=i.width,d=i.height,f=i.syncWithTicks,m=i.horizontalValues,y=i.verticalValues,x=Js(),S=Bt(V=>pL(V,"xAxis",s,x)),w=Bt(V=>pL(V,"yAxis",o,x));if(!Ll(c)||!Ll(d)||!kt(a)||!kt(l))return null;var _=i.verticalCoordinatesGenerator||nue,E=i.horizontalCoordinatesGenerator||rue,T=i.horizontalPoints,C=i.verticalPoints;if((!T||!T.length)&&typeof E=="function"){var O=m&&m.length,N=E({yAxis:w?rs(rs({},w),{},{ticks:O?m:w.ticks}):void 0,width:e??c,height:n??d,offset:r},O?!0:f);yw(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(T=N)}if((!C||!C.length)&&typeof _=="function"){var D=y&&y.length,F=_({xAxis:S?rs(rs({},S),{},{ticks:D?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},D?!0:f);yw(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof F,"]")),Array.isArray(F)&&(C=F)}return R.createElement(au,{zIndex:i.zIndex},R.createElement("g",{className:"recharts-cartesian-grid"},R.createElement(Zce,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),R.createElement(eue,rh({},i,{horizontalPoints:T})),R.createElement(tue,rh({},i,{verticalPoints:C})),R.createElement(Qce,rh({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:w})),R.createElement(Jce,rh({},i,{offset:r,verticalPoints:C,xAxis:S,yAxis:w}))))}OH.displayName="CartesianGrid";var sue={},LH=cs({name:"errorBars",initialState:sue,reducers:{addErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]||(t[r]=[]),t[r].push(i)},replaceErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.prev,s=n.next;t[r]&&(t[r]=t[r].map(o=>o.dataKey===i.dataKey&&o.direction===i.direction?s:o))},removeErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]&&(t[r]=t[r].filter(s=>s.dataKey!==i.dataKey||s.direction!==i.direction))}}}),sR=LH.actions;sR.addErrorBar;sR.replaceErrorBar;sR.removeErrorBar;var oue=LH.reducer;function DH(t,e){var n,r,i=Bt(c=>iu(c,t)),s=Bt(c=>su(c,e)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:ti.allowDataOverflow,a=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:ni.allowDataOverflow,l=o||a;return{needClip:l,needClipX:o,needClipY:a}}function aue(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=nR(),s=DH(e,n),o=s.needClipX,a=s.needClipY,l=s.needClip,c=Bt(T=>bB(T,e,!1)),d=Bt(T=>_B(T,n,!1));if(!l||!i)return null;var f=i.x,m=i.y,y=i.width,x=i.height,S=o&&c?Math.min(c[0],c[1]):f-y/2,w=a&&d?Math.min(d[0],d[1]):m-x/2,_=o&&c?Math.abs(c[1]-c[0]):y*2,E=a&&d?Math.abs(d[1]-d[0]):x*2;return R.createElement("clipPath",{id:"clipPath-".concat(r)},R.createElement("rect",{x:S,y:w,width:_,height:E}))}function lue(t){var e=Q1(t),n=3,r=2;if(e!=null){var i=e.r,s=e.strokeWidth,o=Number(i),a=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(a)||a<0)&&(a=r),{r:o,strokeWidth:a}}return{r:n,strokeWidth:r}}function oR(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 jH=(t,e,n)=>PB(t,"xAxis",oR(t,e),n),UH=(t,e,n)=>CB(t,"xAxis",oR(t,e),n),FH=(t,e,n)=>PB(t,"yAxis",aR(t,e),n),zH=(t,e,n)=>CB(t,"yAxis",aR(t,e),n),cue=ke([fr,jH,FH,UH,zH],(t,e,n,r,i)=>Bl(t,"xAxis")?vw(e,r,!1):vw(n,i,!1)),uue=(t,e)=>e,BH=ke([qz,uue],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),HH=t=>{var e=fr(t),n=Bl(e,"xAxis");return n?"yAxis":"xAxis"},due=(t,e)=>{var n=HH(t);return n==="yAxis"?aR(t,e):oR(t,e)},fue=(t,e,n)=>iB(t,HH(t),due(t,e),n),hue=ke([BH,fue],(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,o=s==null?void 0:s.find(a=>a.key===i);if(o!=null)return o.map(a=>[a[0],a[1]])}}}),pue=ke([fr,jH,FH,UH,zH,hue,UJ,cue,BH,tee],(t,e,n,r,i,s,o,a,l,c)=>{var d=o.chartData,f=o.dataStartIndex,m=o.dataEndIndex;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||a==null)){var y=l.data,x;if(y&&y.length>0?x=y:x=d==null?void 0:d.slice(f,m+1),x!=null)return zue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:x,chartBaseValue:c,bandSize:a})}}),mue=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],gue=["id","baseLine"];function $0(){return $0=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:af.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:at==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Ig(Ig({},n.next),{},{x:Fc(n.prev.x,n.next.x,e),y:Fc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),GH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:eR,animationInterpolateFn:Cue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:_ue,xAxisId:0,yAxisId:0,zIndex:Ms.area};function qw(t,e){return t&&t!=="none"?t:e}var Pue=t=>{var e=t.dataKey,n=t.name,r=t.stroke,i=t.fill,s=t.legendType,o=t.hide;return[{inactive:o,dataKey:e,type:s,color:qw(r,i),value:m4(n,e),payload:t}]},Rue=R.memo(t=>{var e=t.dataKey,n=t.data,r=t.stroke,i=t.strokeWidth,s=t.fill,o=t.name,a=t.hide,l=t.unit,c=t.tooltipType,d=t.id,f={dataDefinedOnItem:n,getPosition:Vg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:m4(o,e),hide:a,type:c,color:qw(r,s),unit:l,graphicalItemId:d}};return R.createElement(Hae,{tooltipEntrySettings:f})});function Nue(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,o=r.dataKey,a=za(r);return R.createElement(Nle,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function Iue(t){var e=t.showLabels,n=t.children,r=t.points,i=r.map(s=>{var o,a,l={x:(o=s.x)!==null&&o!==void 0?o:0,y:(a=s.y)!==null&&a!==void 0?a:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Ig(Ig({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return R.createElement(Tae,{value:e?i:void 0},n)}function kue(t){var e=t.points,n=t.baseLine,r=t.needClip,i=t.clipPathId,s=t.props,o=t.animationElapsedTime,a=t.isAnimating,l=t.isEntrance,c=s.layout,d=s.type,f=s.stroke,m=s.connectNulls,y=s.isRange,x=s.shape,S=s.id,w=VH(s,wue),_=Ko(w),E=Ig(Ig({},_),{},{id:S,points:e,connectNulls:m,type:d,baseLine:n,layout:c,stroke:f,isRange:y,animationElapsedTime:o,isAnimating:a,isEntrance:l});return R.createElement(R.Fragment,null,(e==null?void 0:e.length)>1&&R.createElement(Yo,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},R.createElement(Bae,{option:x,DefaultShape:GH.shape,shapeProps:E})),R.createElement(Nue,{points:e,props:w,clipPathId:i}))}function Oue(t,e,n){if(kt(t)){var r=kt(e)?e:void 0;return Fc(r,t,n)}if(Hi(t)||kl(t)){var i=kt(e)?e:void 0;return Fc(i,0,n)}return t}function Lue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=t.previousPointsRef,s=t.previousBaselineRef,o=r.points,a=r.baseLine,l=r.isAnimationActive,c=r.animationBegin,d=r.animationDuration,f=r.animationEasing,m=r.animationMatchBy,y=r.animationInterpolateFn,x=R.useMemo(()=>({points:o,baseLine:a}),[o,a]),S=SH(x,s),w=XP(),_=sle(r.onAnimationStart,r.onAnimationEnd),E=_.isAnimating,T=_.handleAnimationStart,C=_.handleAnimationEnd,O=S.startValue;if(w==null)return null;var N;return Array.isArray(a)&&Array.isArray(O)?N=OC(O,a,m):Array.isArray(a)?N=OC(null,a,m):N=null,R.createElement(ole,{animationInput:x,animationIdPrefix:"recharts-area-",items:o,previousItemsRef:i,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:T,onAnimationEnd:C,animationInterpolateFn:y,animationMatchBy:m,layout:w},(D,F,V)=>{var k;return F===1?k=a:Array.isArray(a)?k=y(N,F,w):k=V?a:Oue(a,O,F),S.syncStepValue(k,F),R.createElement(Iue,{showLabels:!E,points:o},r.children,R.createElement(kue,{points:D,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:F,isAnimating:E||F<1,isEntrance:V}),R.createElement(Rae,{label:r.label}))})}function Due(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=R.useRef(null),s=R.useRef();return R.createElement(Lue,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class jue extends R.PureComponent{render(){var e=this.props,n=e.hide,r=e.dot,i=e.points,s=e.className,o=e.top,a=e.left,l=e.needClip,c=e.xAxisId,d=e.yAxisId,f=e.width,m=e.height,y=e.id,x=e.baseLine,S=e.zIndex;if(n)return null;var w=er("recharts-area",s),_=y,E=lue(r),T=E.r,C=E.strokeWidth,O=_H(r),N=T*2+C,D=l?"url(#clipPath-".concat(O?"":"dots-").concat(_,")"):void 0;return R.createElement(au,{zIndex:S},R.createElement(Yo,{className:w},l&&R.createElement("defs",null,R.createElement(aue,{clipPathId:_,xAxisId:c,yAxisId:d}),!O&&R.createElement("clipPath",{id:"clipPath-dots-".concat(_)},R.createElement("rect",{x:a-N/2,y:o-N/2,width:f+N,height:m+N}))),R.createElement(Due,{needClip:l,clipPathId:_,props:this.props})),R.createElement(s3,{points:i,mainColor:qw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}),this.props.isRange&&Array.isArray(x)&&R.createElement(s3,{points:x,mainColor:qw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}))}}function Uue(t){var e,n=t.activeDot,r=t.animationBegin,i=t.animationDuration,s=t.animationEasing,o=t.connectNulls,a=t.dot,l=t.fill,c=t.fillOpacity,d=t.hide,f=t.isAnimationActive,m=t.legendType,y=t.stroke,x=t.xAxisId,S=t.yAxisId,w=VH(t,Sue),_=Gg(),E=QB(),T=DH(x,S),C=T.needClip,O=Js(),N=(e=Bt(he=>pue(he,t.id,O)))!==null&&e!==void 0?e:{},D=N.points,F=N.isRange,V=N.baseLine,k=nR();if(_!=="horizontal"&&_!=="vertical"||k==null||E!=="AreaChart"&&E!=="ComposedChart")return null;var U=k.height,H=k.width,ne=k.x,te=k.y;return!D||!D.length?null:R.createElement(jue,Xw({},w,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:V,connectNulls:o,dot:a,fill:l,fillOpacity:c,height:U,hide:d,layout:_,isAnimationActive:f,isRange:F,legendType:m,needClip:C,points:D,stroke:y,width:H,left:ne,top:te,xAxisId:x,yAxisId:S}))}var Fue=(t,e,n,r,i)=>{var s=n??e;if(kt(s))return s;var o=t==="horizontal"?i:r,a=o.scale.domain();if(o.type==="number"){var l=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]);return s==="dataMin"?c:s==="dataMax"||l<0?l:Math.max(Math.min(a[0],a[1]),0)}return s==="dataMin"?a[0]:s==="dataMax"?a[1]:a[0]};function zue(t){var e=t.areaSettings,n=e.connectNulls,r=e.baseValue,i=e.dataKey,s=t.stackedData,o=t.layout,a=t.chartBaseValue,l=t.xAxis,c=t.yAxis,d=t.displayedData,f=t.dataStartIndex,m=t.xAxisTicks,y=t.yAxisTicks,x=t.bandSize,S=s&&s.length,w=Fue(o,a,r,l,c),_=o==="horizontal",E=!1,T=d.map((O,N)=>{var D,F,V,k;if(S)k=s[f+N];else{var U=yi(O,i);Array.isArray(U)?(k=U,E=!0):k=[w,U]}var H=(D=(F=k)===null||F===void 0?void 0:F[1])!==null&&D!==void 0?D:null,ne=H==null||S&&!n&&yi(O,i)==null;if(_){var te;return{x:ck({axis:l,ticks:m,bandSize:x,entry:O,index:N}),y:ne?null:(te=c.scale.map(H))!==null&&te!==void 0?te:null,value:k,payload:O}}return{x:ne?null:(V=l.scale.map(H))!==null&&V!==void 0?V:null,y:ck({axis:c,ticks:y,bandSize:x,entry:O,index:N}),value:k,payload:O}}),C;return S||E?C=T.map(O=>{var N,D=Array.isArray(O.value)?O.value[0]:null;if(_){var F;return{x:O.x,y:D!=null&&O.y!=null&&(F=c.scale.map(D))!==null&&F!==void 0?F: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}}):C=_?c.scale.map(w):l.scale.map(w),{points:T,baseLine:C??0,isRange:E}}function Bue(t){var e=Jo(t,GH),n=Js();return R.createElement(mle,{id:e.id,type:"area"},r=>R.createElement(R.Fragment,null,R.createElement(Vae,{legendPayload:Pue(e)}),R.createElement(Rue,{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(wle,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:MY(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),R.createElement(Uue,Xw({},e,{id:r}))))}var WH=R.memo(Bue,bS);WH.displayName="Area";var Hue=["domain","range"],Vue=["domain","range"];function m3(t,e){if(t==null)return{};var n,r,i=Gue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{if(o!=null)return y3(y3({},s),{},{type:o})},[s,o]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Dle(a)):n.current!==a&&e(jle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Ule(n.current)),n.current=null)},[e]),null}var Jue=t=>{var e=t.xAxisId,n=t.className,r=Bt(v4),i=Js(),s="xAxis",o=Bt(m=>TB(m,s,e,i)),a=Bt(m=>kre(m,e)),l=Bt(m=>Fre(m,e)),c=Bt(m=>Gz(m,e));if(a==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=DC(t,$ue);c.id,c.scale;var f=DC(c,Xue);return R.createElement(iR,LC({},d,f,{x:l.x,y:l.y,width:a.width,height:a.height,className:er("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:o,axisType:s,axisId:e}))},ede={allowDataOverflow:ti.allowDataOverflow,allowDecimals:ti.allowDecimals,allowDuplicatedCategory:ti.allowDuplicatedCategory,angle:ti.angle,axisLine:Wc.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:Wc.tickLine,tickSize:Wc.tickSize,type:ti.type,niceTicks:ti.niceTicks,xAxisId:0},tde=t=>{var e=Jo(t,ede);return R.createElement(R.Fragment,null,R.createElement(Que,{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(Jue,e))},XH=R.memo(tde,$H);XH.displayName="XAxis";var nde=["type"],rde=["dangerouslySetInnerHTML","ticks","scale"],ide=["id","scale"];function jC(){return jC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(o!=null)return b3(b3({},s),{},{type:o})},[o,s]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Fle(a)):n.current!==a&&e(zle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Ble(n.current)),n.current=null)},[e]),null}function ude(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=R.useRef(null),o=R.useRef(null),a=Bt(v4),l=Js(),c=Wr(),d="yAxis",f=Bt(_=>Hre(_,e)),m=Bt(_=>Bre(_,e)),y=Bt(_=>TB(_,d,e,l)),x=Bt(_=>Wz(_,e));if(R.useLayoutEffect(()=>{if(!(r!=="auto"||!f||J2(i)||R.isValidElement(i)||x==null)){var _=s.current;if(_){var E=_.getCalculatedWidth();Math.round(f.width)!==Math.round(E)&&c(Hle({id:e,width:E}))}}},[y,f,c,i,e,r,x]),f==null||m==null||x==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=UC(t,rde);x.id,x.scale;var w=UC(x,ide);return R.createElement(iR,jC({},S,w,{ref:s,labelRef:o,x:m.x,y:m.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:f.width,height:f.height,className:er("recharts-".concat(d," ").concat(d),n),viewBox:a,ticks:y,axisType:d,axisId:e}))}var dde={allowDataOverflow:ni.allowDataOverflow,allowDecimals:ni.allowDecimals,allowDuplicatedCategory:ni.allowDuplicatedCategory,angle:ni.angle,axisLine:Wc.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:Wc.tickLine,tickSize:Wc.tickSize,type:ni.type,niceTicks:ni.niceTicks,width:ni.width,yAxisId:0},fde=t=>{var e=Jo(t,dde);return R.createElement(R.Fragment,null,R.createElement(cde,{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(ude,e))},qH=R.memo(fde,$H);qH.displayName="YAxis";var hde=(t,e)=>e,lR=ke([hde,fr,sz,_i,$B,ou,use,Gi],vse);function pde(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function cR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(pde(t)){var i=t.currentTarget.getBBox();n=i.width>0?e.width/i.width:1,r=i.height>0?e.height/i.height:1}else{var s=t.currentTarget;n=s.offsetWidth>0?e.width/s.offsetWidth:1,r=s.offsetHeight>0?e.height/s.offsetHeight:1}var o=(a,l)=>({relativeX:Math.round((a-e.left)/n),relativeY:Math.round((l-e.top)/r)});return"touches"in t?Array.from(t.touches).map(a=>o(a.clientX,a.clientY)):o(t.clientX,t.clientY)}var KH=Mo("mouseClick"),YH=Wy();YH.startListening({actionCreator:KH,effect:(t,e)=>{var n=t.payload,r=lR(e.getState(),cR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(rie({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var FC=Mo("mouseMove"),ZH=Wy(),dm=null,Sf=null,WE=null;ZH.startListening({actionCreator:FC,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||(o==null?void 0:o.includes("mousemove"));dm!==null&&(cancelAnimationFrame(dm),dm=null),Sf!==null&&(typeof s!="number"||!a)&&(clearTimeout(Sf),Sf=null),WE=cR(n);var l=()=>{var c=e.getState(),d=ix(c,c.tooltip.settings.shared);if(!WE){dm=null,Sf=null;return}if(d==="axis"){var f=lR(c,WE);(f==null?void 0:f.activeIndex)!=null?e.dispatch(DB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(LB())}dm=null,Sf=null};if(!a){l();return}s==="raf"?dm=requestAnimationFrame(l):typeof s=="number"&&Sf===null&&(Sf=setTimeout(l,s))}});function mde(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 _3={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:_3,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:_3.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}}}),gde=QH.reducer,vde=QH.actions.updateOptions,yde=null,xde={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:yde,reducers:xde});JH.actions.updatePolarOptions;var bde=JH.reducer,eV=Mo("keyDown"),tV=Mo("focus"),nV=Mo("blur"),zS=Wy(),fm=null,Mf=null,kb=null;zS.startListening({actionCreator:eV,effect:(t,e)=>{kb=t.payload,fm!==null&&(cancelAnimationFrame(fm),fm=null);var n=e.getState(),r=n.eventSettings,i=r.throttleDelay,s=r.throttledEvents,o=s==="all"||s.includes("keydown");Mf!==null&&(typeof i!="number"||!o)&&(clearTimeout(Mf),Mf=null);var a=()=>{try{var l=e.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var d=l.tooltip.keyboardInteraction,f=kb;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var m=G0(d,Lh(l),Rg(l),Ng(l)),y=m==null?-1:Number(m),x=!Number.isFinite(y)||y<0,S=ou(l),w=Lh(l),_=ix(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var E=Hw(l,_,"hover",String(d.index));e.dispatch(Bw({active:!d.active,activeIndex:d.index,activeCoordinate:E}));return}var T=Xre(l),C=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(x){var D=Rg(l),F=Ng(l),V=O*C,k=he=>({active:!1,index:String(he),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(N=-1,V>0){for(var U=0;U=0;H--)if(G0(k(H),w,D,F)!=null){N=H;break}if(N<0)return}else{N=y+O*C;var ne=(S==null?void 0:S.length)||w.length;if(ne===0||N>=ne||N<0)return}var te=Hw(l,_,"hover",String(N));e.dispatch(Bw({active:!0,activeIndex:N.toString(),activeCoordinate:te}))}finally{fm=null,Mf=null}};if(!o){a();return}i==="raf"?fm=requestAnimationFrame(a):typeof i=="number"&&Mf===null&&(a(),kb=null,Mf=setTimeout(()=>{kb?a():(Mf=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",o=ix(n,n.tooltip.settings.shared),a=Hw(n,o,"hover",String(s));e.dispatch(Bw({active:!0,activeIndex:s,activeCoordinate:a}))}}}});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(Bw({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 zo=Mo("externalEvent"),iV=Wy(),Ob=new Map,p0=new Map,$E=new Map;iV.startListening({actionCreator:zo,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,o=rV(i);$E.set(s,{handler:r,reactEvent:o});var a=Ob.get(s);a!==void 0&&(cancelAnimationFrame(a),Ob.delete(s));var l=e.getState(),c=l.eventSettings,d=c.throttleDelay,f=c.throttledEvents,m=f,y=m==="all"||(m==null?void 0:m.includes(s)),x=p0.get(s);x!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(x),p0.delete(s));var S=()=>{var E=$E.get(s);try{if(!E)return;var T=E.handler,C=E.reactEvent,O=e.getState(),N={activeCoordinate:Kie(O),activeDataKey:$ie(O),activeIndex:_y(O),activeLabel:KB(O),activeTooltipIndex:_y(O),isTooltipActive:Yie(O)};T&&T(N,C)}finally{Ob.delete(s),p0.delete(s),$E.delete(s)}};if(!y){S();return}if(d==="raf"){var w=requestAnimationFrame(S);Ob.set(s,w)}else if(typeof d=="number"){if(!p0.has(s)){S();var _=setTimeout(S,d);p0.set(s,_)}}else S()}}});var _de=ke([Qg],t=>t.tooltipItemPayloads),wde=ke([_de,(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=Mo("touchMove"),oV=Wy(),Ef=null,$u=null,w3=null,m0=null;oV.startListening({actionCreator:sV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){m0=rV(n);var r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||o.includes("touchmove");Ef!==null&&(cancelAnimationFrame(Ef),Ef=null),$u!==null&&(typeof s!="number"||!a)&&(clearTimeout($u),$u=null),w3=Array.from(n.touches).map(c=>cR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(m0!=null){var c=e.getState(),d=ix(c,c.tooltip.settings.shared);if(d==="axis"){var f,m=(f=w3)===null||f===void 0?void 0:f[0];if(m==null){Ef=null,$u=null;return}var y=lR(c,m);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(DB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var x,S=m0.touches[0];if(document.elementFromPoint==null||S==null)return;var w=document.elementFromPoint(S.clientX,S.clientY);if(!w||!w.getAttribute)return;var _=w.getAttribute(NY),E=(x=w.getAttribute(IY))!==null&&x!==void 0?x:void 0,T=Qh(c).find(N=>N.id===E);if(_==null||T==null||E==null)return;var C=T.dataKey,O=wde(c,_,E);e.dispatch(nie({activeDataKey:C,activeIndex:_,activeCoordinate:O,activeGraphicalItemId:E}))}Ef=null,$u=null}};if(!a){l();return}s==="raf"?Ef=requestAnimationFrame(l):typeof s=="number"&&$u===null&&(l(),m0=null,$u=setTimeout(()=>{m0?l():($u=null,Ef=null)},s))}}});var aV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},lV=cs({name:"eventSettings",initialState:aV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),Sde=lV.actions.setEventSettings,Mde=lV.reducer,Ede=U5({brush:Qle,cartesianAxis:Vle,chartData:qse,errorBars:oue,eventSettings:Mde,graphicalItems:ble,layout:mY,legend:PZ,options:Vse,polarAxis:Iae,polarOptions:bde,referenceElements:nce,renderedTicks:Mce,rootProps:gde,tooltip:iie,zIndex:Rse}),Ade=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return zK({reducer:Ede,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,oV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(J5({type:"raf"}))},devTools:{serialize:{replacer:mde},name:"recharts-".concat(n)}})};function Tde(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=Ade(e,r));var o=UP;return R.createElement(WZ,{context:o,store:s.current},n)}function Cde(t){var e=t.layout,n=t.margin,r=Wr(),i=Js();return R.useEffect(()=>{i||(r(fY(e)),r(dY(n)))},[r,i,e,n]),null}var Pde=R.memo(Cde,bS);function Rde(t){var e=Wr();return R.useEffect(()=>{e(vde(t))},[e,t]),null}var Nde=t=>{var e=Wr();return R.useEffect(()=>{e(Sde(t))},[e,t]),null},Ide=R.memo(Nde,bS);function S3(t){var e=t.zIndex,n=t.isPanorama,r=R.useRef(null),i=Wr();return R.useLayoutEffect(()=>(r.current&&i(Cse({zIndex:e,element:r.current,isPanorama:n})),()=>{i(Pse({zIndex:e,isPanorama:n}))}),[i,e,n]),R.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function M3(t){var e=t.children,n=t.isPanorama,r=Bt(xse);if(!r||r.length===0)return e;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return R.createElement(R.Fragment,null,i.map(o=>R.createElement(S3,{key:o,zIndex:o,isPanorama:n})),e,s.map(o=>R.createElement(S3,{key:o,zIndex:o,isPanorama:n})))}var kde=["children"];function Ode(t,e){if(t==null)return{};var n,r,i=Lde(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=w4(),r=S4(),i=k4();if(!Ll(n)||!Ll(r))return null;var s=t.children,o=t.otherAttributes,a=t.title,l=t.desc,c,d;return o!=null&&(typeof o.tabIndex=="number"?c=o.tabIndex:c=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),R.createElement(n5,Kw({},o,{title:a,desc:l,role:d,tabIndex:c,width:n,height:r,style:Dde,ref:e}),s)}),Ude=t=>{var e=t.children,n=Bt(mS);if(!n)return null;var r=n.width,i=n.height,s=n.y,o=n.x;return R.createElement(n5,{width:r,height:i,x:o,y:s},e)},E3=R.forwardRef((t,e)=>{var n=t.children,r=Ode(t,kde),i=Js();return i?R.createElement(Ude,null,R.createElement(M3,{isPanorama:!0},n)):R.createElement(jde,Kw({ref:e},r),R.createElement(M3,{isPanorama:!1},n))});function Fde(t,e){return Vde(t)||Hde(t,e)||Bde(t,e)||zde()}function zde(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bde(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{if(r!=null){var o=r.getBoundingClientRect(),a=o.width/r.offsetWidth;wn(a)&&a!==s&&t(pY(a))}},[r,t,s]),i}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 Wde(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n(roe(),null);function Zw(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var efe=R.forwardRef((t,e)=>{var n,r,i=R.useRef(null),s=R.useState({containerWidth:Zw((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:Zw((r=t.style)===null||r===void 0?void 0:r.height)}),o=Yw(s,2),a=o[0],l=o[1],c=R.useCallback((f,m)=>{l(y=>{var x=Math.round(f),S=Math.round(m);return y.containerWidth===x&&y.containerHeight===S?y:{containerWidth:x,containerHeight:S}})},[]),d=R.useCallback(f=>{if(typeof e=="function"&&e(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var m=f.getBoundingClientRect(),y=m.width,x=m.height;c(y,x);var S=_=>{var E=_[0];if(E!=null){var T=E.contentRect,C=T.width,O=T.height;c(C,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(Xy,{width:a.containerWidth,height:a.containerHeight}),R.createElement("div",Sd({ref:d},t)))}),tfe=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=R.useState({containerWidth:Zw(n),containerHeight:Zw(r)}),s=Yw(i,2),o=s[0],a=s[1],l=R.useCallback((d,f)=>{a(m=>{var y=Math.round(d),x=Math.round(f);return m.containerWidth===y&&m.containerHeight===x?m:{containerWidth:y,containerHeight:x}})},[]),c=R.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var f=d.getBoundingClientRect(),m=f.width,y=f.height;l(m,y)}},[e,l]);return R.createElement(R.Fragment,null,R.createElement(Xy,{width:o.containerWidth,height:o.containerHeight}),R.createElement("div",Sd({ref:c},t)))}),nfe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return R.createElement(R.Fragment,null,R.createElement(Xy,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))}),rfe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?R.createElement(tfe,Sd({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?R.createElement(nfe,Sd({},t,{width:n,height:r,ref:e})):R.createElement(R.Fragment,null,R.createElement(Xy,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))});function ife(t){return t?efe:rfe}var sfe=R.forwardRef((t,e)=>{var n=t.children,r=t.className,i=t.height,s=t.onClick,o=t.onContextMenu,a=t.onDoubleClick,l=t.onMouseDown,c=t.onMouseEnter,d=t.onMouseLeave,f=t.onMouseMove,m=t.onMouseUp,y=t.onTouchEnd,x=t.onTouchMove,S=t.onTouchStart,w=t.style,_=t.width,E=t.responsive,T=t.dispatchTouchEvents,C=T===void 0?!0:T,O=R.useRef(null),N=Wr(),D=R.useState(null),F=Yw(D,2),V=F[0],k=F[1],U=R.useState(null),H=Yw(U,2),ne=H[0],te=H[1],he=Gde(),oe=WP(),fe=(oe==null?void 0:oe.width)>0?oe.width:_,B=(oe==null?void 0:oe.height)>0?oe.height:i,q=R.useCallback(De=>{he(De),typeof e=="function"&&e(De),k(De),te(De),De!=null&&(O.current=De)},[he,e,k,te]),K=R.useCallback(De=>{N(KH(De)),N(zo({handler:s,reactEvent:De}))},[N,s]),$=R.useCallback(De=>{N(FC(De)),N(zo({handler:c,reactEvent:De}))},[N,c]),Z=R.useCallback(De=>{N(LB()),N(zo({handler:d,reactEvent:De}))},[N,d]),ge=R.useCallback(De=>{N(FC(De)),N(zo({handler:f,reactEvent:De}))},[N,f]),le=R.useCallback(()=>{N(tV())},[N]),ue=R.useCallback(()=>{N(nV())},[N]),_e=R.useCallback(De=>{N(eV(De.key))},[N]),Se=R.useCallback(De=>{N(zo({handler:o,reactEvent:De}))},[N,o]),qe=R.useCallback(De=>{N(zo({handler:a,reactEvent:De}))},[N,a]),Me=R.useCallback(De=>{N(zo({handler:l,reactEvent:De}))},[N,l]),We=R.useCallback(De=>{N(zo({handler:m,reactEvent:De}))},[N,m]),Ke=R.useCallback(De=>{N(zo({handler:S,reactEvent:De}))},[N,S]),ce=R.useCallback(De=>{C&&N(sV(De)),N(zo({handler:x,reactEvent:De}))},[N,C,x]),Q=R.useCallback(De=>{N(zo({handler:y,reactEvent:De}))},[N,y]),Ge=ife(E);return R.createElement(rH.Provider,{value:V},R.createElement(xX.Provider,{value:ne},R.createElement(Ge,{width:fe??(w==null?void 0:w.width),height:B??(w==null?void 0:w.height),className:er("recharts-wrapper",r),style:Wde({position:"relative",cursor:"default",width:fe,height:B},w),onClick:K,onContextMenu:Se,onDoubleClick:qe,onFocus:le,onBlur:ue,onKeyDown:_e,onMouseDown:Me,onMouseEnter:$,onMouseLeave:Z,onMouseMove:ge,onMouseUp:We,onTouchEnd:Q,onTouchMove:ce,onTouchStart:Ke,ref:q},R.createElement(Jde,null),n)))}),ofe=["width","height","responsive","children","className","style","compact","title","desc"];function afe(t,e){if(t==null)return{};var n,r,i=lfe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=t.width,r=t.height,i=t.responsive,s=t.children,o=t.className,a=t.style,l=t.compact,c=t.title,d=t.desc,f=afe(t,ofe),m=za(f);return l?R.createElement(R.Fragment,null,R.createElement(Xy,{width:n,height:r}),R.createElement(E3,{otherAttributes:m,title:c,desc:d},s)):R.createElement(sfe,{className:o,style:a,width:n,height:r,responsive:i??!1,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},R.createElement(E3,{otherAttributes:m,title:c,desc:d,ref:e},R.createElement(cce,null,s)))});function zC(){return zC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.createElement(gfe,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:vfe,tooltipPayloadSearcher:Bse,categoricalChartProps:t,ref:e}));const xfe="rgba(130,130,150,0.14)",R3="rgba(130,130,150,0.85)";function bfe(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 _fe({active:t,payload:e,unit:n}){return!t||!(e!=null&&e.length)?null:g.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:g.jsx("div",{className:"space-y-1",children:e.map(r=>g.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[g.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:r.color}}),g.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:r.name}),g.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:cV(r.value,n)})]},r.dataKey))})})}function uV({data:t,series:e,unit:n="%",yMode:r="percent",height:i=176}){const s=t.reduce((a,l)=>e.reduce((c,d)=>Math.max(c,Number(l[d.key])||0),a),0),o=r==="percent"?Math.min(100,Math.max(25,Math.ceil(s*1.2/25)*25)):Math.max(bfe(s*1.15),10);return g.jsx("div",{style:{height:i},className:"w-full",children:g.jsx(dZ,{width:"100%",height:"100%",children:g.jsxs(yfe,{data:t,margin:{top:8,right:6,bottom:0,left:-12},children:[g.jsx("defs",{children:e.map(a=>g.jsxs("linearGradient",{id:`grad-${a.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:a.color,stopOpacity:.22}),g.jsx("stop",{offset:"100%",stopColor:a.color,stopOpacity:0})]},a.key))}),g.jsx(OH,{vertical:!1,stroke:xfe}),g.jsx(XH,{dataKey:"t",hide:!0}),g.jsx(qH,{domain:[0,o],ticks:[0,o/2,o],tickFormatter:a=>cV(a,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:R3}}),g.jsx(goe,{content:g.jsx(_fe,{unit:n}),cursor:{stroke:R3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(a=>g.jsx(WH,{type:"monotone",dataKey:a.key,name:a.label,stroke:a.color,strokeWidth:2,fill:`url(#grad-${a.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},a.key))]})})})}const wfe=[{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 Sfe(){var o,a,l,c;const{sys:t,hist:e}=lX(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=wfe.filter(d=>d.key!=="gpu"||n),i={cpu:(o=t==null?void 0:t.cpu)==null?void 0:o.percent,ram:(a=t==null?void 0:t.ram)==null?void 0:a.percent,gpu:n?t.gpu.busy_percent:null,disk:(l=t==null?void 0:t.disk)==null?void 0:l.percent},s={cpu:(c=t==null?void 0:t.cpu)!=null&&c.cores?`${t.cpu.cores} Cores`:"",ram:t?`${sm(t.ram.used)}/${sm(t.ram.total)} GB`:"",gpu:n?`${sm(t.gpu.gtt_used)}/${sm(t.gpu.gtt_total)} GB`:"",disk:t!=null&&t.disk?`${sm(t.disk.used)}/${sm(t.disk.total)} GB`:""};return g.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[g.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),g.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:r.map(d=>g.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:d.color}}),g.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:d.label}),g.jsxs("span",{className:"shrink-0 font-mono text-xs font-bold tabular-nums text-foreground",children:[Math.round(i[d.key]??0),"%"]}),s[d.key]&&g.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:s[d.key]})]},d.key))}),g.jsx(uV,{data:e,series:r,unit:"%",yMode:"percent",height:176})]}):g.jsx("div",{className:"flex h-44 items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(t==null?void 0:t.temp)&&(t.temp.cpu||t.temp.gpu)&&g.jsxs("div",{className:"mt-3 flex gap-4 border-t border-border/30 pt-3 font-mono text-xs text-muted-foreground/80",children:[t.temp.cpu!=null&&g.jsxs("span",{children:["CPU Temp: ",t.temp.cpu," °C"]}),t.temp.gpu!=null&&g.jsxs("span",{children:["GPU Temp: ",t.temp.gpu," °C"]})]})]})}function Lb({label:t,value:e,tone:n}){return g.jsxs("div",{className:tt("flex items-center justify-between rounded-lg border px-3 py-1.5 text-xs",n==="alert"?"border-amber-500/30 bg-amber-500/5 font-semibold text-amber-400":n==="accent"?"border-primary/30 bg-primary/5 font-semibold text-primary":"border-border/30 bg-background/25 text-muted-foreground"),children:[g.jsx("span",{className:"flex items-center gap-1.5",children:t}),g.jsx("span",{className:"font-mono text-[10px]",children:e})]})}function Mfe(){var n;const{data:t}=CP(3e3),e=()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}}));return g.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/20 pb-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(t9,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Updates & Pflege"})]}),(t==null?void 0:t.last_check)&&g.jsxs("span",{className:"font-mono text-[9px] text-muted-foreground/80",children:["Zuletzt gesucht: ",new Date(t.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),t?g.jsxs("div",{className:"space-y-1.5",children:[g.jsx(Lb,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),g.jsx(Lb,{label:"Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),g.jsx(Lb,{label:"Modell-Upgrades",tone:t.models>0?"accent":"muted",value:t.models>0?`${t.models} verfügbar`:"aktuell"}),(n=t.components)==null?void 0:n.map(r=>g.jsx(Lb,{tone:r.update===!0?"alert":"muted",label:g.jsxs(g.Fragment,{children:[r.name,r.reachable===!1&&g.jsx("span",{className:"text-[8px] font-bold uppercase text-red-400/80",children:"offline"})]}),value:r.update===!0?`Update: ${r.latest}`:r.update===!1?"aktuell":r.latest?`neueste: ${r.latest}`:"—"},r.key))]}):g.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."})]}),g.jsxs("button",{onClick:e,className:"mt-4 flex h-9 w-full items-center justify-center gap-1.5 rounded-lg bg-primary text-xs font-semibold text-primary-foreground shadow-md shadow-primary/10 transition-all hover:opacity-90 cursor-pointer",children:["Updates verwalten & Pflege ",g.jsx(sF,{className:"h-3.5 w-3.5"})]})]})}function dV({type:t,title:e,message:n,defaultValue:r,autoValue:i,autoLabel:s,onConfirm:o,onCancel:a}){const l=R.useRef(null);return g.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:e}),g.jsx("button",{onClick:a||(()=>o()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:n}),t==="prompt"&&g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{ref:l,type:"text",defaultValue:r,className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:c=>{var d;c.key==="Enter"&&o((d=l.current)==null?void 0:d.value)}}),i!==void 0&&g.jsx("button",{type:"button",onClick:()=>{l.current&&(l.current.value=i)},title:"Setup-bewussten Optimalwert eintragen",className:"h-9 px-3 shrink-0 text-xs font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg transition-colors cursor-pointer",children:s||"Auto"})]}),g.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(t==="confirm"||t==="prompt")&&g.jsx("button",{onClick:a,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),g.jsx("button",{onClick:()=>{var d;const c=t==="prompt"?(d=l.current)==null?void 0:d.value:void 0;o(c)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:t==="confirm"?"Ja, fortfahren":t==="prompt"?"Übernehmen":"OK"})]})]})})}function tv(){const[t,e]=R.useState(null),n=R.useCallback(()=>e(null),[]),r=R.useCallback((a,l,c)=>{e({type:"alert",title:a,message:l,onConfirm:()=>{e(null),c==null||c()}})},[]),i=R.useCallback((a,l,c,d)=>{e({type:"confirm",title:a,message:l,onConfirm:()=>{e(null),c()},onCancel:()=>{e(null),d==null||d()}})},[]),s=R.useCallback((a,l,c,d,f,m)=>{e({type:"prompt",title:a,message:l,defaultValue:c,autoValue:m==null?void 0:m.autoValue,autoLabel:m==null?void 0:m.autoLabel,onConfirm:y=>{e(null),d(y)},onCancel:()=>{e(null),f==null||f()}})},[]),o=t?g.jsx(dV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:o}}function Efe(){const t=$h(),{data:e}=TP(3e3),{data:n}=qh(),{showAlert:r,dialogElement:i}=tv(),[s,o]=R.useState(!1),a=(n==null?void 0:n.models)??[];async function l(c){try{await Ft("/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:Lr.agentStatus}),o(!1)}catch(d){r("Fehler",`Fehler beim Wechseln des Gehirns: ${d.message}`)}}return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center justify-between mb-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Il,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(e==null?void 0:e.terminal_url)&&g.jsxs("a",{href:Mg(e.terminal_url),target:"_blank",rel:"noopener",className:tt("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",e.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[g.jsx(bg,{className:"h-3 w-3"})," Terminal öffnen"]})]}),e?g.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[g.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[g.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),g.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[g.jsx("span",{className:tt("h-2 w-2 rounded-full",e.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-medium",children:e.gateway_reachable?"Online":"Offline"})]})]}),g.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[g.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Terminal"}),g.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[g.jsx("span",{className:tt("h-2 w-2 rounded-full",e.terminal_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-medium",children:e.terminal_reachable?"Online":"Offline"})]})]}),g.jsxs("div",{onClick:()=>o(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),g.jsx(El,{className:"h-3 w-3 text-primary"})]}),g.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[g.jsx(W1,{className:"h-3 w-3 shrink-0"}),e.brain_model||"auto"]})]}),g.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),g.jsx(nw,{className:"h-3 w-3 text-primary"})]}),g.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[g.jsxs("div",{children:["Config: ",e.has_config?g.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),g.jsxs("div",{children:["Skills: ",e.has_skills?g.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),g.jsxs("div",{children:["Memory: ",e.has_memories?g.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):g.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),e&&g.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[g.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[g.jsx("span",{children:"Telegram"}),g.jsx("span",{className:tt("font-semibold",e.telegram_enabled?"text-emerald-400":""),children:e.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),g.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[g.jsx("span",{children:"MCP-Server"}),g.jsxs("span",{className:"font-semibold text-foreground",children:[e.mcp_server_count??0," verbunden"]})]}),g.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[g.jsx("span",{children:"PC Executor"}),g.jsx("span",{className:tt("font-semibold",e.pc_executor_reachable?"text-emerald-400":""),children:e.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),e&&s&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[g.jsx(El,{className:"h-4 w-4"}),g.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),g.jsx("button",{onClick:()=>o(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',g.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),g.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...a.map(c=>{var d;return((d=c.name.split("/").pop())==null?void 0:d.replace(".gguf",""))||c.name})].map(c=>{const d=["auto","fast","heavy"].includes(c);return g.jsxs("button",{onClick:()=>l(c),className:tt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",e.brain_model===c||!e.brain_model&&c==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[g.jsxs("div",{className:"flex flex-col text-left",children:[g.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:c}),g.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:d?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(e.brain_model===c||!e.brain_model&&c==="auto")&&g.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function Afe(){const{data:t}=qh(3e3),e=(t==null?void 0:t.models)??[],n=(t==null?void 0:t.running)??[];return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[g.jsx(W1,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),g.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:ZF.map(r=>{var o;const i=e.find(a=>a.role===r),s=i?n.includes(i.name):!1;return g.jsxs("div",{className:tt("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",s?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":i?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[g.jsx("div",{className:"min-w-0 flex-1 mr-2",children:g.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[g.jsx("span",{className:tt("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",RP(r)),children:r}),g.jsxs("div",{className:"flex flex-col min-w-0",children:[g.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:i?(o=i.name.split("/").pop())==null?void 0:o.replace(/\.gguf$/i,""):"nicht zugewiesen"}),i&&g.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[i.prompt_cache&&g.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),i.spec_active&&g.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${i.spec_draft_model})`,children:"SPEC"}),i.parallel_slots>1&&g.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${i.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",i.parallel_slots]}),i.incomplete&&g.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),g.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:i?s?g.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):g.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):g.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},r)})})]}),g.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]})}function Tfe(){const t=$h(),{data:e=[]}=BT({limit:3}),[n,r]=R.useState(""),[i,s]=R.useState("stable"),[o,a]=R.useState(!1);async function l(){if(!(!n.trim()||o)){a(!0);try{await Ft("/api/memory",{method:"POST",body:JSON.stringify({content:n,category:i,source:"dashboard"})}),r(""),t.invalidateQueries({queryKey:["memory"]})}catch(c){console.error(c)}finally{a(!1)}}}return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[g.jsx(G1,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsx("textarea",{value:n,onChange:c=>r(c.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),g.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[g.jsxs("select",{value:i,onChange:c=>s(c.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[g.jsx("option",{value:"stable",children:"🔵 Fakt"}),g.jsx("option",{value:"instruction",children:"📋 Regel"}),g.jsx("option",{value:"user",children:"👤 User"}),g.jsx("option",{value:"versioned",children:"🟡 Version"})]}),g.jsxs("button",{onClick:l,disabled:!n.trim()||o,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[g.jsx(kT,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),g.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[g.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),g.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:e.length===0?g.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):e.map(c=>g.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[g.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:c.category}),g.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:c.content,children:c.content})]},c.id))})]})]}),g.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}const N3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Cfe(){const{data:t}=AP(3e3),e=oX(),n=e[e.length-1],r=n?Math.round(n.prompt+n.completion):0;return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(sy,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),g.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t&&g.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[g.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:r.toLocaleString("de-DE")}),g.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),t&&g.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[g.jsxs("div",{children:[t.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",g.jsxs("span",{className:"text-emerald-400/90",children:[t.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),g.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",t.prompt_tokens.toLocaleString("de-DE")," · Output ",t.completion_tokens.toLocaleString("de-DE")]})]})]}),g.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:N3.map(i=>g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),g.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),g.jsx("span",{className:"font-mono text-xs font-bold tabular-nums text-foreground",children:Math.round((n==null?void 0:n[i.key])??0)})]},i.key))})]}),t?g.jsx(uV,{data:e,series:N3,unit:" tok/s",yMode:"auto",height:150}):g.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),g.jsx("div",{className:"mt-2 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:"Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf."})]})}function Pfe(){const{data:t}=p7(3e3),{showAlert:e,dialogElement:n}=tv(),[r,i]=R.useState({});async function s(o){i(a=>({...a,[o]:!0}));try{const a=await Ft("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:o})});a.ok||e("Fehler",`Neustart fehlgeschlagen: ${a.err||"Unbekannt"}`)}catch(a){e("Fehler",`Fehler: ${a.message}`)}finally{i(a=>({...a,[o]:!1}))}}return g.jsxs("div",{className:"flex flex-col rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(tw,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Dienste"})]}),g.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground transition-colors hover:text-primary cursor-pointer",children:"Logs / Pflege"})]}),t?g.jsxs("div",{className:"flex flex-1 flex-col",children:[g.jsx("div",{className:"space-y-1.5",children:t.services.map(o=>g.jsxs("div",{className:"group flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[g.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[g.jsx("span",{className:tt("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",o.ok?"bg-emerald-500":"bg-amber-500")}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-xs font-bold text-foreground",children:o.name}),g.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:o.url})]})]}),g.jsx("button",{onClick:()=>s(o.name),disabled:r[o.name],className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground opacity-0 transition-all hover:bg-primary/5 hover:text-primary group-hover:opacity-100",title:"Dienst neu starten",children:g.jsx(Vm,{className:tt("h-3.5 w-3.5",r[o.name]&&"animate-spin")})})]},o.name))}),g.jsxs("div",{className:"mt-auto flex flex-wrap gap-3 border-t border-border/20 pt-2.5 text-[10px] font-semibold text-muted-foreground",children:[g.jsxs("a",{href:Mg(t.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[g.jsx(bg,{className:"h-3 w-3"})," Engine"]}),g.jsxs("a",{href:Mg(t.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[g.jsx(bg,{className:"h-3 w-3"})," Gateway"]})]})]}):g.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Dienste…"}),n]})}function I3({children:t}){return g.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t})}function Rfe(){return g.jsxs("div",{className:"space-y-7",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),g.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),g.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[g.jsx(Sfe,{}),g.jsx(Cfe,{}),g.jsx(nX,{})]}),g.jsxs("section",{children:[g.jsx(I3,{children:"Stack-Status"}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[g.jsx(Afe,{}),g.jsx(Pfe,{})]})]}),g.jsxs("section",{children:[g.jsx(I3,{children:"Betrieb & Wissen"}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[g.jsx(Mfe,{}),g.jsx(Efe,{}),g.jsx(Tfe,{})]})]})]})}function Nfe(){const t=$h(),{data:e=[]}=g7(2e3),{showAlert:n,dialogElement:r}=tv();async function i(a){try{await Ft(`/api/jobs/${a}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:Lr.jobs})}catch(l){n("Fehler",l.message)}}const s=e.filter(a=>a.state==="running"||a.state==="queued"),o=e.filter(a=>a.state!=="running"&&a.state!=="queued").slice(-3);return s.length===0&&o.length===0?null:g.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[g.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),s.map(a=>g.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[g.jsxs("div",{className:"flex justify-between items-center text-xs",children:[g.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:a.label}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("span",{className:"text-muted-foreground font-mono",children:[a.progress??0,"% • ",HT(a.done_bytes),"/",HT(a.total_bytes),a.eta_s?` • ETA ${_7(a.eta_s)}`:""]}),g.jsx("button",{onClick:()=>i(a.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),g.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:g.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${a.progress??0}%`}})})]},a.id)),o.map(a=>g.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[g.jsx("span",{className:"truncate",children:a.label}),g.jsx("span",{className:tt("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",a.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:a.state})]},a.id)),r]})}function Af({children:t,tone:e="muted"}){const n={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return g.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${n[e]}`,children:t})}function k3({caps:t}){return t?g.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&g.jsx(Af,{children:"💻 Code"}),t.vision&&g.jsx(Af,{children:"👁 Bild"}),t.reasoning&&g.jsx(Af,{children:"🧠 Reason"}),t.moe&&g.jsxs(Af,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&g.jsx(Af,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&g.jsx(Af,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&g.jsx(Af,{children:"🔢 Embed"})]}):null}function Ife({model:t,onClose:e,onChanged:n}){var S,w;const{data:r,isLoading:i}=x7(t.gguf_path),[s,o]=R.useState(null),[a,l]=R.useState(""),c=r==null?void 0:r.target_vocab,d=(r==null?void 0:r.drafts)??[],f=d.filter(_=>_.compatible===!0),m=t.spec_draft_model;async function y(_){o(_??"__clear__"),l("");try{await Ft(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:_})}),n(),e()}catch(E){l(String((E==null?void 0:E.message)||E)),o(null)}}const x=_=>{var E;return _?`${_.pre??"?"} · ${((E=_.n_vocab)==null?void 0:E.toLocaleString())??"?"} Tokens`:"—"};return g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[g.jsx(xh,{className:"h-4 w-4"})," Speculative Draft"]}),g.jsx("button",{onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',g.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),g.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:(S=t.name.split("/").pop())==null?void 0:S.replace(/\.gguf$/i,"")}),g.jsxs("span",{className:"text-foreground",children:["Vocab: ",x(c)]})]}),t.spec_active&&m&&g.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[g.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[g.jsx(Go,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",m]}),g.jsx("button",{onClick:()=>y(null),disabled:s!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(r!=null&&r.target_exists)&&g.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[g.jsx(_g,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),g.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?g.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):d.length===0?g.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",g.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):d.map(_=>{var C,O;const E=_.filename===m,T=_.compatible===!0;return g.jsxs("div",{className:tt("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",T?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",E&&"border-primary/40 bg-primary/10"),children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:_.filename}),g.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[Bo(_.size_bytes)," · Vocab: ",x(_.vocab)]})]}),T?E?g.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[g.jsx(Go,{className:"h-3.5 w-3.5"})," Aktiv"]}):g.jsx("button",{onClick:()=>y(_.path),disabled:s!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):g.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:_.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(C=_.vocab)==null?void 0:C.pre}/${(O=_.vocab)==null?void 0:O.n_vocab} ≠ Modell ${c==null?void 0:c.pre}/${c==null?void 0:c.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[g.jsx(_g,{className:"h-3.5 w-3.5"})," ",_.compatible===!1?"Vocab ≠":"n/a"]})]},_.path)})}),!i&&(r==null?void 0:r.target_exists)&&d.length>0&&f.length===0&&g.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",g.jsx("span",{className:"font-mono",children:c==null?void 0:c.pre}),", n_vocab=",g.jsx("span",{className:"font-mono",children:(w=c==null?void 0:c.n_vocab)==null?void 0:w.toLocaleString()}),")."]}),a&&g.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:a})]})})}function kfe(){var nt,se,rt,$e,ut,Dt,Et,mt;const t=$h(),{data:e,isLoading:n,error:r}=qh(4e3),{data:i}=m7(4e3),{data:s}=GF(),{data:o}=CP(4e3),{data:a}=v7(),{data:l}=Z1(),{showAlert:c,showConfirm:d,showPrompt:f,dialogElement:m}=tv(),y=(e==null?void 0:e.models)??[],x=(e==null?void 0:e.running)??[],S=r?String(r):"",w=()=>{t.invalidateQueries({queryKey:Lr.models}),t.invalidateQueries({queryKey:Lr.routing})},[_,E]=R.useState(null),[T,C]=R.useState(null),[O,N]=R.useState(null),[D,F]=R.useState(null),[V,k]=R.useState(!1),[U,H]=R.useState(!1),[ne,te]=R.useState(null),[he,oe]=R.useState("grid"),[fe,B]=R.useState("all"),q=y.filter(de=>fe==="in_use"?!!de.role||x.includes(de.name):!0),[K,$]=R.useState({width:800,height:360}),Z=R.useRef(null),ge=R.useCallback(de=>{if(Z.current&&(Z.current.disconnect(),Z.current=null),de){const J=new ResizeObserver(Ae=>{if(!Ae||Ae.length===0)return;const re=Ae[0].contentRect;$({width:re.width,height:re.height})});J.observe(de),Z.current=J}},[]),le=K.width,ue=K.height,_e=de=>{const J=le*.1,Ae=ue*de,re=le*.5,Ue=ue*.5,Te=le*.3,Oe=Ae,Ye=le*.3;return`M ${J} ${Ae} C ${Te} ${Oe}, ${Ye} ${Ue}, ${re} ${Ue}`},Se=de=>{const J=le*.5,Ae=ue*.5,re=le*.9,Ue=ue*de,Te=le*.7,Oe=Ae,Ye=le*.7;return`M ${J} ${Ae} C ${Te} ${Oe}, ${Ye} ${Ue}, ${re} ${Ue}`};async function qe(de){try{await Ft(`/api/models/${encodeURIComponent(de)}/load`,{method:"POST"}),w()}catch(J){c("Fehler",`Fehler beim Laden des Modells: ${J.message}`)}}async function Me(de){try{await Ft(`/api/models/${encodeURIComponent(de)}/unload`,{method:"POST"}),w()}catch(J){c("Fehler",`Fehler beim Entladen des Modells: ${J.message}`)}}async function We(){try{await Ft("/api/models/unload",{method:"POST"}),w()}catch(de){c("Fehler",`Fehler beim Entladen aller Modelle: ${de.message}`)}}async function Ke(de,J){try{await Ft(`/api/models/${encodeURIComponent(J)}/role`,{method:"POST",body:JSON.stringify({role:de||null})}),w()}catch(Ae){c("Fehler",`Fehler beim Zuweisen der Rolle: ${Ae.message||Ae}`)}}function ce(de){C(de),N(null),Ft(`/api/roles/${encodeURIComponent(de)}/recommend`).then(J=>N(J)).catch(()=>{})}async function Q(de,J){let Ae=null;try{Ae=await Ft(`/api/models/${encodeURIComponent(de)}/ctx/auto`)}catch{}const re=Ae?`Optimal für dein Setup: ${(Ae.ctx/1024).toFixed(0)}k (${Ae.ctx}) — GTT ${Ae.gtt_gb} GB − reserviert ${Ae.reserved_gb} GB (${Ae.mode}) → ${Ae.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";f("Kontextlänge anpassen",re,String(J||32768),async Ue=>{if(Ue)try{await Ft(`/api/models/${encodeURIComponent(de)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Ue,10)})}),w()}catch(Te){c("Fehler",`Fehler beim Setzen des Kontexts: ${Te.message||Te}`)}},void 0,Ae?{autoValue:String(Ae.ctx),autoLabel:`Auto (${(Ae.ctx/1024).toFixed(0)}k)`}:void 0)}async function Ge(de){d("Modell löschen?",`Modell '${de}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await Ft(`/api/models/${encodeURIComponent(de)}`,{method:"DELETE"}),w()}catch(J){c("Fehler",`Fehler beim Löschen: ${J.message||J}`)}})}async function De(de,J,Ae,re){try{await Ft("/api/models/install",{method:"POST",body:JSON.stringify({repo:de,role:J,quant:Ae,jinja:re})}),c("Herunterladen gestartet",`Download für '${de}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Ue){c("Fehler",`Fehler beim Starten des Upgrades: ${Ue.message||Ue}`)}}async function Xe(de){const J=a==null?void 0:a.budget,Ae=J&&!J.fits?` + `).concat(C.x,",").concat(C.y),N=Hi(t.id)?uy("recharts-radial-line-"):t.id;return R.createElement("text",Dc({},r,{dominantBaseline:"central",className:er("recharts-radial-bar-label",o)}),R.createElement("defs",null,R.createElement("path",{id:N,d:O})),R.createElement("textPath",{xlinkHref:"#".concat(N)},n))},xae=(t,e,n)=>{var r=t.cx,i=t.cy,s=t.innerRadius,o=t.outerRadius,a=t.startAngle,l=t.endAngle,c=(a+l)/2;if(n==="outside"){var d=zi(r,i,o+e,c),f=d.x,m=d.y;return{x:f,y:m,textAnchor:f>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var y=(s+o)/2,x=zi(r,i,y,c),S=x.x,w=x.y;return{x:S,y:w,textAnchor:"middle",verticalAnchor:"middle"}},G_=t=>t!=null&&"cx"in t&&It(t.cx),bae={angle:0,offset:5,zIndex:Ms.label,position:"middle",textBreakAll:!1};function _ae(t){if(!G_(t))return t;var e=t.cx,n=t.cy,r=t.outerRadius,i=r*2;return{x:e-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function ld(t){var e=Jo(t,bae),n=e.viewBox,r=e.parentViewBox,i=e.position,s=e.value,o=e.children,a=e.content,l=e.className,c=l===void 0?"":l,d=e.textBreakAll,f=e.labelRef,m=mae(),y=vH(),x=i==="center"?y:m??y,S,w,_;n==null?S=x:G_(n)?S=n:S=XP(n);var E=_ae(S);if(!S||Hi(s)&&Hi(o)&&!R.isValidElement(a)&&typeof a!="function")return null;var T=H0(H0({},e),{},{viewBox:S});if(R.isValidElement(a)){T.labelRef;var C=KL(T,aae);return R.cloneElement(a,C)}if(typeof a=="function"){T.content;var O=KL(T,lae);if(w=R.createElement(a,O),R.isValidElement(w))return w}else w=gae(e);var N=Ko(e);if(G_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return yae(e,i,w,N,S);_=xae(S,e.offset,e.position)}else{if(!E)return null;var D=oae({viewBox:E,position:i,offset:e.offset,parentViewBox:G_(r)?void 0:r});_=H0(H0({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(au,{zIndex:e.zIndex},R.createElement(J2,Dc({ref:f,className:er("recharts-label",c)},N,_,{textAnchor:fH(N.textAnchor)?N.textAnchor:_.textAnchor,breakAll:d}),w))}ld.displayName="Label";var wae=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?R.createElement(ld,Dc({key:"label-implicit"},r)):Ol(t)?R.createElement(ld,Dc({key:"label-implicit",value:t},r)):R.isValidElement(t)?t.type===ld?R.cloneElement(t,H0({key:"label-implicit"},r)):R.createElement(ld,Dc({key:"label-implicit",content:t},r)):eR(t)?R.createElement(ld,Dc({key:"label-implicit",content:t},r)):t&&typeof t=="object"?R.createElement(ld,Dc({},t,{key:"label-implicit"},r)):null};function Sae(t){var e=t.label,n=t.labelRef,r=vH();return wae(e,r,n)||null}var Mae=["valueAccessor"],Eae=["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(Qoe(e))return e},yH=R.createContext(void 0),Cae=yH.Provider,xH=R.createContext(void 0);xH.Provider;function Pae(){return R.useContext(yH)}function Rae(){return R.useContext(xH)}function W_(t){var e=t.valueAccessor,n=e===void 0?Tae:e,r=ZL(t,Mae),i=r.dataKey;r.clockWise;var s=r.id,o=r.textBreakAll,a=r.zIndex,l=ZL(r,Eae),c=Pae(),d=Rae(),f=c||d;return!f||!f.length?null:R.createElement(au,{zIndex:a??Ms.label},R.createElement(Yo,{className:"recharts-label-list"},f.map((m,y)=>{var x,S=Hi(i)?n(m,y):yi(m.payload,i),w=Hi(s)?{}:{id:"".concat(s,"-").concat(y)};return R.createElement(ld,Ww({key:"label-".concat(y)},Ko(m),l,w,{fill:(x=r.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:S,textBreakAll:o,viewBox:m.viewBox,index:y,zIndex:0}))})))}W_.displayName="LabelList";function Nae(t){var e=t.label;return e?e===!0?R.createElement(W_,{key:"labelList-implicit"}):R.isValidElement(e)||eR(e)?R.createElement(W_,{key:"labelList-implicit",content:e}):typeof e=="object"?R.createElement(W_,Ww({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function OC(){return OC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e=t.cx,n=t.cy,r=t.r,i=t.className,s=er("recharts-dot",i);return It(e)&&It(n)&&It(r)?R.createElement("circle",OC({},za(t),jP(t),{className:s,cx:e,cy:n,r})):null},Iae={radiusAxis:{},angleAxis:{}},_H=cs({name:"polarAxis",initialState:Iae,reducers:{addRadiusAxis(t,e){t.radiusAxis[e.payload.id]=e.payload},removeRadiusAxis(t,e){delete t.radiusAxis[e.payload.id]},addAngleAxis(t,e){t.angleAxis[e.payload.id]=e.payload},removeAngleAxis(t,e){delete t.angleAxis[e.payload.id]}}}),zS=_H.actions;zS.addRadiusAxis;zS.removeRadiusAxis;zS.addAngleAxis;zS.removeAngleAxis;var kae=_H.reducer;function Oae(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var wH=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;function QL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function JL(t){for(var e=1;e{r||(i.current===null?n(Jre(e)):i.current!==e&&n(eie({prev:i.current,next:e})),i.current=e)},[e,n,r]),R.useLayoutEffect(()=>()=>{i.current&&(n(tie(i.current)),i.current=null)},[n]),null}function Gae(t){var e=t.legendPayload,n=Wr(),r=Js(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(TZ(e)):i.current!==e&&n(CZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),R.useLayoutEffect(()=>()=>{i.current&&(n(PZ(i.current)),i.current=null)},[n]),null}function Wae(t,e){return Kae(t)||qae(t,e)||Xae(t,e)||$ae()}function $ae(){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 Xae(t,e){if(t){if(typeof t=="string")return e3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e3(t,e):void 0}}function e3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var i of n)r.push({status:"removed",prev:i});for(var s=0;st[Math.floor(s*n)]);return nR(r,e)}function Qae(t,e){var n=e.map((r,i)=>t[i]);return nR(n,e)}function Jae(t,e){for(var n=new Map,r=0;r{var y=n(f,m);if(y!=null){var x=r.get(y);if(x!==void 0)return i.add(y),x}}),o=[];for(var a of r){var l=Wae(a,2),c=l[0],d=l[1];i.has(c)||o.push(d)}return nR(s,e,o)}function LC(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===tR?Zae(t,e):n===Yae?Qae(t,e):ele(t,e,n)}function MH(t,e){var n=R.useRef(t),r=R.useRef(e.current),i=R.useRef(!0);n.current!==t&&(n.current=t,r.current=e.current,i.current=!1);var s=R.useCallback(function(o,a){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(a===0){i.current=!0;return}a===1&&(r.current=o),a>0&&i.current&&l&&(e.current=o)},[e]);return{startValue:r.current,syncStepValue:s}}function tle(t,e){return sle(t)||ile(t,e)||rle(t,e)||nle()}function nle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rle(t,e){if(t){if(typeof t=="string")return t3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t3(t,e):void 0}}function t3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{typeof t=="function"&&t(),s(!0)},[t]),a=R.useCallback(()=>{typeof e=="function"&&e(),s(!1)},[e]);return{isAnimating:i,handleAnimationStart:o,handleAnimationEnd:a}}function ale(t){var e,n=t.animationInput,r=t.animationIdPrefix,i=t.items,s=t.previousItemsRef,o=t.isAnimationActive,a=t.animationBegin,l=t.animationDuration,c=t.animationEasing,d=t.onAnimationStart,f=t.onAnimationEnd,m=t.animationInterpolateFn,y=t.animationMatchBy,x=t.shouldUpdatePreviousRef,S=t.children,w=t.layout,_=F4(n,r),E=MH(_,s),T=(e=E.startValue)!==null&&e!==void 0?e:null,C=LC(T,i,y??tR);return R.createElement(U4,{animationId:_,begin:a,duration:l,isActive:o,easing:c,onAnimationEnd:f,onAnimationStart:d,key:_},O=>{var N=T==null,D=i==null?i:m(C,O,w),F=x?x(O):O>0;return E.syncStepValue(D,O,F),D==null?null:S(D,O,N)})}var VE;function lle(t,e){return fle(t)||dle(t,e)||ule(t,e)||cle()}function cle(){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 n3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?n3(t,e):void 0}}function n3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var t=R.useState(()=>uy("uid-")),e=lle(t,1),n=e[0];return n},EH=(VE=G1.useId)!==null&&VE!==void 0?VE:hle;function ple(t,e){var n=EH();return e||(t?"".concat(t,"-").concat(n):n)}var mle=R.createContext(void 0),gle=t=>{var e=t.id,n=t.type,r=t.children,i=ple("recharts-".concat(n),e);return R.createElement(mle.Provider,{value:i},r(i))},vle={cartesianItems:[],polarItems:[]},AH=cs({name:"graphicalItems",initialState:vle,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:sr()},replaceCartesianGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).cartesianItems.indexOf(r);s>-1&&(t.cartesianItems[s]=i)},prepare:sr()},removeCartesianGraphicalItem:{reducer(t,e){var n=$o(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:sr()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:sr()},removePolarGraphicalItem:{reducer(t,e){var n=$o(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:sr()},replacePolarGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).polarItems.indexOf(r);s>-1&&(t.polarItems[s]=i)},prepare:sr()}}}),Jg=AH.actions,yle=Jg.addCartesianGraphicalItem,xle=Jg.replaceCartesianGraphicalItem,ble=Jg.removeCartesianGraphicalItem;Jg.addPolarGraphicalItem;Jg.removePolarGraphicalItem;Jg.replacePolarGraphicalItem;var _le=AH.reducer,wle=t=>{var e=Wr(),n=R.useRef(null);return R.useLayoutEffect(()=>{n.current===null?e(yle(t)):n.current!==t&&e(xle({prev:n.current,next:t})),n.current=t},[e,t]),R.useLayoutEffect(()=>()=>{n.current&&(e(ble(n.current)),n.current=null)},[e]),null},Sle=R.memo(wle),Mle=["points"];function r3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function GE(t){for(var e=1;e{var _,E,T=GE(GE(GE({r:3},o),m),{},{index:w,cx:(_=S.x)!==null&&_!==void 0?_:void 0,cy:(E=S.y)!==null&&E!==void 0?E:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return R.createElement(Rle,{key:"dot-".concat(w),option:n,dotProps:T,className:i})}),x={};return a&&l!=null&&(x.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(l,")")),R.createElement(au,{zIndex:d},R.createElement(Yo,$w({className:r},x),y))}function i3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function s3(t){for(var e=1;e({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),$le=Oe([Wle,tu,nu],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),rR=()=>Bt($le),Xle=()=>Bt(Jie);function o3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function WE(t){for(var e=1;e{var e=t.point,n=t.childIndex,r=t.mainColor,i=t.activeDot,s=t.dataKey,o=t.clipPath;if(i===!1||e.x==null||e.y==null)return null;var a={index:n,dataKey:s,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},l=WE(WE(WE({},a),J1(i)),jP(i)),c;return R.isValidElement(i)?c=R.cloneElement(i,l):typeof i=="function"?c=i(l):c=R.createElement(bH,l),R.createElement(Yo,{className:"recharts-active-dot",clipPath:o},c)};function a3(t){var e=t.points,n=t.mainColor,r=t.activeDot,i=t.itemDataKey,s=t.clipPath,o=t.zIndex,a=o===void 0?Ms.activeDot:o,l=Bt(Sy),c=Xle();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return Hi(d)?null:R.createElement(au,{zIndex:a},R.createElement(Zle,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var Qle=t=>{var e=t.chartData,n=Wr(),r=Js();return R.useEffect(()=>r?()=>{}:(n(PL(e)),()=>{n(PL(void 0))}),[e,n,r]),null},l3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},PH=cs({name:"brush",initialState:l3,reducers:{setBrushSettings(t,e){return e.payload==null?l3:e.payload}}});PH.actions.setBrushSettings;var Jle=PH.reducer;function ece(t){return(t%180+180)%180}var tce=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=ece(i),o=s*Math.PI/180,a=Math.atan(r/n),l=o>a&&o{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=$o(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=$o(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=$o(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),ev=RH.actions;ev.addDot;ev.removeDot;ev.addArea;ev.removeArea;ev.addLine;ev.removeLine;var rce=RH.reducer;function ice(t,e){return lce(t)||ace(t,e)||oce(t,e)||sce()}function sce(){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 oce(t,e){if(t){if(typeof t=="string")return c3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c3(t,e):void 0}}function c3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=R.useState("".concat(uy("recharts"),"-clip")),r=ice(n,1),i=r[0],s=rR();if(s==null)return null;var o=s.x,a=s.y,l=s.width,c=s.height;return R.createElement(cce.Provider,{value:i},R.createElement("defs",null,R.createElement("clipPath",{id:i},R.createElement("rect",{x:o,y:a,height:c,width:l}))),e)};function NH(t,e){if(e<1)return[];if(e===1)return t;for(var n=[],r=0;rt*i)return!1;var s=n();return t*(e-t*s/2-r)>=0&&t*(e+t*s/2-i)<=0}function hce(t,e){return NH(t,e+1)}function pce(t,e,n,r,i){for(var s=(r||[]).slice(),o=e.start,a=e.end,l=0,c=1,d=o,f=function(){var x=r==null?void 0:r[l];if(x===void 0)return{v:NH(r,c)};var S=l,w,_=()=>(w===void 0&&(w=n(x,S)),w),E=x.coordinate,T=l===0||Ey(t,E,_,d,a);T||(l=0,d=o,c+=1),T&&(d=E+t*(_()/2+i),l+=c)},m;c<=s.length;)if(m=f(),m)return m.v;return[]}function mce(t,e,n,r,i){var s=(r||[]).slice(),o=s.length;if(o===0)return[];for(var a=e.start,l=e.end,c=1;c<=o;c++){for(var d=(o-1)%c,f=a,m=!0,y=function(){var C=r[S];if(C==null)return 0;var O=S,N,D=()=>(N===void 0&&(N=n(C,O)),N),F=C.coordinate,G=S===d||Ey(t,F,D,f,l);if(!G)return m=!1,1;G&&(f=F+t*(D()/2+i))},x,S=d;S(S===void 0&&(S=n(y,m)),S);if(m===o-1){var _=t*(x.coordinate+t*w()/2-l);s[m]=x=ns(ns({},x),{},{tickCoord:_>0?x.coordinate-_*t:x.coordinate})}else s[m]=x=ns(ns({},x),{},{tickCoord:x.coordinate});if(x.tickCoord!=null){var E=Ey(t,x.tickCoord,w,a,l);E&&(l=x.tickCoord-t*(w()/2+i),s[m]=ns(ns({},x),{},{isShow:!0}))}},d=o-1;d>=0;d--)c(d);return s}function bce(t,e,n,r,i,s){var o=(r||[]).slice(),a=o.length,l=e.start,c=e.end;if(s){var d=r[a-1];if(d!=null){var f=n(d,a-1),m=t*(d.coordinate+t*f/2-c);if(o[a-1]=d=ns(ns({},d),{},{tickCoord:m>0?d.coordinate-m*t:d.coordinate}),d.tickCoord!=null){var y=Ey(t,d.tickCoord,()=>f,l,c);y&&(c=d.tickCoord-t*(f/2+i),o[a-1]=ns(ns({},d),{},{isShow:!0}))}}}for(var x=s?a-1:a,S=function(E){var T=o[E];if(T==null)return 1;var C=T,O,N=()=>(O===void 0&&(O=n(T,E)),O);if(E===0){var D=t*(C.coordinate-t*N()/2-l);o[E]=C=ns(ns({},C),{},{tickCoord:D<0?C.coordinate-D*t:C.coordinate})}else o[E]=C=ns(ns({},C),{},{tickCoord:C.coordinate});if(C.tickCoord!=null){var F=Ey(t,C.tickCoord,N,l,c);F&&(l=C.tickCoord+t*(N()/2+i),o[E]=ns(ns({},C),{},{isShow:!0}))}},w=0;w{var D=typeof c=="function"?c(O.value,N):O.value;return x==="width"?dce(X0(D,{fontSize:e,letterSpacing:n}),S,f):X0(D,{fontSize:e,letterSpacing:n})[x]},_=i[0],E=i[1],T=i.length>=2&&_!=null&&E!=null?Wo(E.coordinate-_.coordinate):1,C=fce(s,T,x);return l==="equidistantPreserveStart"?pce(T,C,w,i,o):l==="equidistantPreserveEnd"?mce(T,C,w,i,o):(l==="preserveStart"||l==="preserveStartEnd"?y=bce(T,C,w,i,o,l==="preserveStartEnd"):y=xce(T,C,w,i,o),y.filter(O=>O.isShow))}var _ce=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,i=r,s=t.tickSize,o=s===void 0?0:s,a=t.tickMargin,l=a===void 0?0:a,c=0;if(e){Array.from(e).forEach(y=>{if(y){var x=y.getBoundingClientRect();x.width>c&&(c=x.width)}});var d=n?n.getBoundingClientRect().width:0,f=o+l,m=c+f+d+(n?i:0);return Math.round(m)}return 0},wce={xAxis:{},yAxis:{}},IH=cs({name:"renderedTicks",initialState:wce,reducers:{setRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,i=n.axisId,s=n.ticks;t[r][i]=s},removeRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,i=n.axisId;delete t[r][i]}}}),kH=IH.actions,Sce=kH.setRenderedTicks,Mce=kH.removeRenderedTicks,Ece=IH.reducer,Ace=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function d3(t,e){return Rce(t)||Pce(t,e)||Cce(t,e)||Tce()}function Tce(){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 Cce(t,e){if(t){if(typeof t=="string")return f3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f3(t,e):void 0}}function f3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r==null||n==null)return Vg;var s=e.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return i(Sce({ticks:s,axisId:r,axisType:n})),()=>{i(Mce({axisId:r,axisType:n}))}},[i,e,r,n]),null}var Hce=R.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,i=t.tick,s=t.tickLine,o=t.stroke,a=t.tickFormatter,l=t.unit,c=t.padding,d=t.tickTextProps,f=t.orientation,m=t.mirror,y=t.x,x=t.y,S=t.width,w=t.height,_=t.tickSize,E=t.tickMargin,T=t.fontSize,C=t.letterSpacing,O=t.getTicksConfig,N=t.events,D=t.axisType,F=t.axisId,G=iR(Er(Er({},O),{},{ticks:r}),T,C),k=za(O),U=J1(i),H=fH(k.textAnchor)?k.textAnchor:Uce(f,m),ne=Fce(f,m),te={};typeof s=="object"&&(te=s);var he=Er(Er({},k),{},{fill:"none"},te),se=G.map(J=>Er({entry:J},jce(J,y,x,S,w,f,_,m,E))),fe=se.map(J=>{var Y=J.entry,V=J.line;return R.createElement(Yo,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(Y.value,"-").concat(Y.coordinate,"-").concat(Y.tickCoord)},s&&R.createElement("line",Dh({},he,V,{className:er("recharts-cartesian-axis-tick-line",Kh(s,"className"))})))}),B=se.map((J,Y)=>{var V,q,pe=J.entry,ae=J.tick,le=Er(Er(Er(Er({verticalAnchor:ne},k),{},{textAnchor:H,stroke:"none",fill:o},ae),{},{index:Y,payload:pe,visibleTicksCount:G.length,tickFormatter:a,padding:c},d),{},{angle:(V=(q=d==null?void 0:d.angle)!==null&&q!==void 0?q:k.angle)!==null&&V!==void 0?V:0}),be=Er(Er({},le),U);return R.createElement(Yo,Dh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(pe.value,"-").concat(pe.coordinate,"-").concat(pe.tickCoord)},$X(N,pe,Y)),i&&R.createElement(zce,{option:i,tickProps:be,value:"".concat(typeof a=="function"?a(pe.value,Y):pe.value).concat(l||"")}))});return R.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(D,"-ticks")},R.createElement(Bce,{ticks:G,axisId:F,axisType:D}),B.length>0&&R.createElement(au,{zIndex:Ms.label},R.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(D,"-tick-labels"),ref:e},B)),fe.length>0&&R.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(D,"-tick-lines")},fe))}),Vce=R.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,i=t.height,s=t.className,o=t.hide,a=t.ticks,l=t.axisType,c=t.axisId,d=Nce(t,Ace),f=R.useState(""),m=d3(f,2),y=m[0],x=m[1],S=R.useState(""),w=d3(S,2),_=w[0],E=w[1],T=R.useRef(null);R.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return _ce({ticks:T.current,label:(O=t.labelRef)===null||O===void 0?void 0:O.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var C=R.useCallback(O=>{if(O){var N=O.getElementsByClassName("recharts-cartesian-axis-tick-value");T.current=N;var D=N[0];if(D){var F=window.getComputedStyle(D),G=F.fontSize,k=F.letterSpacing;(G!==y||k!==_)&&(x(G),E(k))}}},[y,_]);return o||r!=null&&r<=0||i!=null&&i<=0?null:R.createElement(au,{zIndex:t.zIndex},R.createElement(Yo,{className:er("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:za(t)}),R.createElement(Hce,{ref:C,axisType:l,events:d,fontSize:y,getTicksConfig:t,height:t.height,letterSpacing:_,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:a,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),R.createElement(hae,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},R.createElement(Sae,{label:t.label,labelRef:t.labelRef}),t.children)))}),sR=R.forwardRef((t,e)=>{var n=Jo(t,Wc);return R.createElement(Vce,Dh({},n,{ref:e}))});sR.displayName="CartesianAxis";var Gce=["x1","y1","x2","y2","key"],Wce=["offset"],$ce=["xAxisId","yAxisId"],Xce=["xAxisId","yAxisId"];function p3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rs(t){for(var e=1;e{var e=t.fill;if(!e||e==="none")return null;var n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.ry;return R.createElement("rect",{x:r,y:i,ry:a,width:s,height:o,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function OH(t){var e=t.option,n=t.lineItemProps,r;if(R.isValidElement(e))r=R.cloneElement(e,n);else if(typeof e=="function")r=e(n);else{var i,s=n.x1,o=n.y1,a=n.x2,l=n.y2,c=n.key,d=Xw(n,Gce),f=(i=za(d))!==null&&i!==void 0?i:{};f.offset;var m=Xw(f,Wce);r=R.createElement("line",rh({},m,{x1:s,y1:o,x2:a,y2:l,fill:"none",key:c}))}return r}function Jce(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,s=t.horizontalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=Xw(t,$ce),a=s.map((l,c)=>{var d=rs(rs({},o),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return R.createElement(OH,{key:"line-".concat(c),option:i,lineItemProps:d})});return R.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function eue(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,s=t.verticalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=Xw(t,Xce),a=s.map((l,c)=>{var d=rs(rs({},o),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return R.createElement(OH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return R.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function tue(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.horizontalPoints,l=t.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length||a==null)return null;var d=a.map(m=>Math.round(m+i-i)).sort((m,y)=>m-y);i!==d[0]&&d.unshift(0);var f=d.map((m,y)=>{var x=d[y+1],S=x==null,w=S?i+o-m:x-m;if(w<=0)return null;var _=y%e.length;return R.createElement("rect",{key:"react-".concat(y),y:m,x:r,height:w,width:s,stroke:"none",fill:e[_],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function nue(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,o=t.y,a=t.width,l=t.height,c=t.verticalPoints;if(!n||!r||!r.length)return null;var d=c.map(m=>Math.round(m+s-s)).sort((m,y)=>m-y);s!==d[0]&&d.unshift(0);var f=d.map((m,y)=>{var x=d[y+1],S=x==null,w=S?s+a-m:x-m;if(w<=0)return null;var _=y%r.length;return R.createElement("rect",{key:"react-".concat(y),x:m,y:o,width:w,height:l,stroke:"none",fill:r[_],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var rue=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return p4(iR(rs(rs(rs({},Wc),n),{},{ticks:m4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},iue=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return p4(iR(rs(rs(rs({},Wc),n),{},{ticks:m4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},sue={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ms.grid};function LH(t){var e=S4(),n=M4(),r=w4(),i=rs(rs({},Jo(t,sue)),{},{x:It(t.x)?t.x:r.left,y:It(t.y)?t.y:r.top,width:It(t.width)?t.width:r.width,height:It(t.height)?t.height:r.height}),s=i.xAxisId,o=i.yAxisId,a=i.x,l=i.y,c=i.width,d=i.height,f=i.syncWithTicks,m=i.horizontalValues,y=i.verticalValues,x=Js(),S=Bt(G=>gL(G,"xAxis",s,x)),w=Bt(G=>gL(G,"yAxis",o,x));if(!Ll(c)||!Ll(d)||!It(a)||!It(l))return null;var _=i.verticalCoordinatesGenerator||rue,E=i.horizontalCoordinatesGenerator||iue,T=i.horizontalPoints,C=i.verticalPoints;if((!T||!T.length)&&typeof E=="function"){var O=m&&m.length,N=E({yAxis:w?rs(rs({},w),{},{ticks:O?m: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((!C||!C.length)&&typeof _=="function"){var D=y&&y.length,F=_({xAxis:S?rs(rs({},S),{},{ticks:D?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},D?!0:f);xw(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof F,"]")),Array.isArray(F)&&(C=F)}return R.createElement(au,{zIndex:i.zIndex},R.createElement("g",{className:"recharts-cartesian-grid"},R.createElement(Qce,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),R.createElement(tue,rh({},i,{horizontalPoints:T})),R.createElement(nue,rh({},i,{verticalPoints:C})),R.createElement(Jce,rh({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:w})),R.createElement(eue,rh({},i,{offset:r,verticalPoints:C,xAxis:S,yAxis:w}))))}LH.displayName="CartesianGrid";var oue={},DH=cs({name:"errorBars",initialState:oue,reducers:{addErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]||(t[r]=[]),t[r].push(i)},replaceErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.prev,s=n.next;t[r]&&(t[r]=t[r].map(o=>o.dataKey===i.dataKey&&o.direction===i.direction?s:o))},removeErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]&&(t[r]=t[r].filter(s=>s.dataKey!==i.dataKey||s.direction!==i.direction))}}}),oR=DH.actions;oR.addErrorBar;oR.replaceErrorBar;oR.removeErrorBar;var aue=DH.reducer;function jH(t,e){var n,r,i=Bt(c=>iu(c,t)),s=Bt(c=>su(c,e)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:ti.allowDataOverflow,a=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:ni.allowDataOverflow,l=o||a;return{needClip:l,needClipX:o,needClipY:a}}function lue(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=rR(),s=jH(e,n),o=s.needClipX,a=s.needClipY,l=s.needClip,c=Bt(T=>_B(T,e,!1)),d=Bt(T=>wB(T,n,!1));if(!l||!i)return null;var f=i.x,m=i.y,y=i.width,x=i.height,S=o&&c?Math.min(c[0],c[1]):f-y/2,w=a&&d?Math.min(d[0],d[1]):m-x/2,_=o&&c?Math.abs(c[1]-c[0]):y*2,E=a&&d?Math.abs(d[1]-d[0]):x*2;return R.createElement("clipPath",{id:"clipPath-".concat(r)},R.createElement("rect",{x:S,y:w,width:_,height:E}))}function cue(t){var e=J1(t),n=3,r=2;if(e!=null){var i=e.r,s=e.strokeWidth,o=Number(i),a=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(a)||a<0)&&(a=r),{r:o,strokeWidth:a}}return{r:n,strokeWidth:r}}function aR(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:TH}function lR(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:TH}var UH=(t,e,n)=>RB(t,"xAxis",aR(t,e),n),FH=(t,e,n)=>PB(t,"xAxis",aR(t,e),n),zH=(t,e,n)=>RB(t,"yAxis",lR(t,e),n),BH=(t,e,n)=>PB(t,"yAxis",lR(t,e),n),uue=Oe([fr,UH,zH,FH,BH],(t,e,n,r,i)=>Bl(t,"xAxis")?yw(e,r,!1):yw(n,i,!1)),due=(t,e)=>e,HH=Oe([Kz,due],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),VH=t=>{var e=fr(t),n=Bl(e,"xAxis");return n?"yAxis":"xAxis"},fue=(t,e)=>{var n=VH(t);return n==="yAxis"?lR(t,e):aR(t,e)},hue=(t,e,n)=>sB(t,VH(t),fue(t,e),n),pue=Oe([HH,hue],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=l2(t);if(!(r==null||i==null)){var s=(n=e[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(a=>a.key===i);if(o!=null)return o.map(a=>[a[0],a[1]])}}}),mue=Oe([fr,UH,zH,FH,BH,pue,FJ,uue,HH,nee],(t,e,n,r,i,s,o,a,l,c)=>{var d=o.chartData,f=o.dataStartIndex,m=o.dataEndIndex;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||a==null)){var y=l.data,x;if(y&&y.length>0?x=y:x=d==null?void 0:d.slice(f,m+1),x!=null)return Bue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:x,chartBaseValue:c,bandSize:a})}}),gue=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],vue=["id","baseLine"];function q0(){return q0=Object.assign?Object.assign.bind():function(t){for(var e=1;ef.y||0));return It(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),It(d)?R.createElement("rect",{x:af.x||0));return It(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),It(d)?R.createElement("rect",{x:0,y:at==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Ig(Ig({},n.next),{},{x:Fc(n.prev.x,n.next.x,e),y:Fc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),WH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:tR,animationInterpolateFn:Pue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:wue,xAxisId:0,yAxisId:0,zIndex:Ms.area};function Kw(t,e){return t&&t!=="none"?t:e}var Rue=t=>{var e=t.dataKey,n=t.name,r=t.stroke,i=t.fill,s=t.legendType,o=t.hide;return[{inactive:o,dataKey:e,type:s,color:Kw(r,i),value:g4(n,e),payload:t}]},Nue=R.memo(t=>{var e=t.dataKey,n=t.data,r=t.stroke,i=t.strokeWidth,s=t.fill,o=t.name,a=t.hide,l=t.unit,c=t.tooltipType,d=t.id,f={dataDefinedOnItem:n,getPosition:Vg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:g4(o,e),hide:a,type:c,color:Kw(r,s),unit:l,graphicalItemId:d}};return R.createElement(Vae,{tooltipEntrySettings:f})});function Iue(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,o=r.dataKey,a=za(r);return R.createElement(Ile,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function kue(t){var e=t.showLabels,n=t.children,r=t.points,i=r.map(s=>{var o,a,l={x:(o=s.x)!==null&&o!==void 0?o:0,y:(a=s.y)!==null&&a!==void 0?a:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Ig(Ig({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return R.createElement(Cae,{value:e?i:void 0},n)}function Oue(t){var e=t.points,n=t.baseLine,r=t.needClip,i=t.clipPathId,s=t.props,o=t.animationElapsedTime,a=t.isAnimating,l=t.isEntrance,c=s.layout,d=s.type,f=s.stroke,m=s.connectNulls,y=s.isRange,x=s.shape,S=s.id,w=GH(s,Sue),_=Ko(w),E=Ig(Ig({},_),{},{id:S,points:e,connectNulls:m,type:d,baseLine:n,layout:c,stroke:f,isRange:y,animationElapsedTime:o,isAnimating:a,isEntrance:l});return R.createElement(R.Fragment,null,(e==null?void 0:e.length)>1&&R.createElement(Yo,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},R.createElement(Hae,{option:x,DefaultShape:WH.shape,shapeProps:E})),R.createElement(Iue,{points:e,props:w,clipPathId:i}))}function Lue(t,e,n){if(It(t)){var r=It(e)?e:void 0;return Fc(r,t,n)}if(Hi(t)||kl(t)){var i=It(e)?e:void 0;return Fc(i,0,n)}return t}function Due(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=t.previousPointsRef,s=t.previousBaselineRef,o=r.points,a=r.baseLine,l=r.isAnimationActive,c=r.animationBegin,d=r.animationDuration,f=r.animationEasing,m=r.animationMatchBy,y=r.animationInterpolateFn,x=R.useMemo(()=>({points:o,baseLine:a}),[o,a]),S=MH(x,s),w=qP(),_=ole(r.onAnimationStart,r.onAnimationEnd),E=_.isAnimating,T=_.handleAnimationStart,C=_.handleAnimationEnd,O=S.startValue;if(w==null)return null;var N;return Array.isArray(a)&&Array.isArray(O)?N=LC(O,a,m):Array.isArray(a)?N=LC(null,a,m):N=null,R.createElement(ale,{animationInput:x,animationIdPrefix:"recharts-area-",items:o,previousItemsRef:i,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:T,onAnimationEnd:C,animationInterpolateFn:y,animationMatchBy:m,layout:w},(D,F,G)=>{var k;return F===1?k=a:Array.isArray(a)?k=y(N,F,w):k=G?a:Lue(a,O,F),S.syncStepValue(k,F),R.createElement(kue,{showLabels:!E,points:o},r.children,R.createElement(Oue,{points:D,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:F,isAnimating:E||F<1,isEntrance:G}),R.createElement(Nae,{label:r.label}))})}function jue(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 Uue extends R.PureComponent{render(){var e=this.props,n=e.hide,r=e.dot,i=e.points,s=e.className,o=e.top,a=e.left,l=e.needClip,c=e.xAxisId,d=e.yAxisId,f=e.width,m=e.height,y=e.id,x=e.baseLine,S=e.zIndex;if(n)return null;var w=er("recharts-area",s),_=y,E=cue(r),T=E.r,C=E.strokeWidth,O=wH(r),N=T*2+C,D=l?"url(#clipPath-".concat(O?"":"dots-").concat(_,")"):void 0;return R.createElement(au,{zIndex:S},R.createElement(Yo,{className:w},l&&R.createElement("defs",null,R.createElement(lue,{clipPathId:_,xAxisId:c,yAxisId:d}),!O&&R.createElement("clipPath",{id:"clipPath-dots-".concat(_)},R.createElement("rect",{x:a-N/2,y:o-N/2,width:f+N,height:m+N}))),R.createElement(jue,{needClip:l,clipPathId:_,props:this.props})),R.createElement(a3,{points:i,mainColor:Kw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}),this.props.isRange&&Array.isArray(x)&&R.createElement(a3,{points:x,mainColor:Kw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}))}}function Fue(t){var e,n=t.activeDot,r=t.animationBegin,i=t.animationDuration,s=t.animationEasing,o=t.connectNulls,a=t.dot,l=t.fill,c=t.fillOpacity,d=t.hide,f=t.isAnimationActive,m=t.legendType,y=t.stroke,x=t.xAxisId,S=t.yAxisId,w=GH(t,Mue),_=Gg(),E=JB(),T=jH(x,S),C=T.needClip,O=Js(),N=(e=Bt(he=>mue(he,t.id,O)))!==null&&e!==void 0?e:{},D=N.points,F=N.isRange,G=N.baseLine,k=rR();if(_!=="horizontal"&&_!=="vertical"||k==null||E!=="AreaChart"&&E!=="ComposedChart")return null;var U=k.height,H=k.width,ne=k.x,te=k.y;return!D||!D.length?null:R.createElement(Uue,qw({},w,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:G,connectNulls:o,dot:a,fill:l,fillOpacity:c,height:U,hide:d,layout:_,isAnimationActive:f,isRange:F,legendType:m,needClip:C,points:D,stroke:y,width:H,left:ne,top:te,xAxisId:x,yAxisId:S}))}var zue=(t,e,n,r,i)=>{var s=n??e;if(It(s))return s;var o=t==="horizontal"?i:r,a=o.scale.domain();if(o.type==="number"){var l=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]);return s==="dataMin"?c:s==="dataMax"||l<0?l:Math.max(Math.min(a[0],a[1]),0)}return s==="dataMin"?a[0]:s==="dataMax"?a[1]:a[0]};function Bue(t){var e=t.areaSettings,n=e.connectNulls,r=e.baseValue,i=e.dataKey,s=t.stackedData,o=t.layout,a=t.chartBaseValue,l=t.xAxis,c=t.yAxis,d=t.displayedData,f=t.dataStartIndex,m=t.xAxisTicks,y=t.yAxisTicks,x=t.bandSize,S=s&&s.length,w=zue(o,a,r,l,c),_=o==="horizontal",E=!1,T=d.map((O,N)=>{var D,F,G,k;if(S)k=s[f+N];else{var U=yi(O,i);Array.isArray(U)?(k=U,E=!0):k=[w,U]}var H=(D=(F=k)===null||F===void 0?void 0:F[1])!==null&&D!==void 0?D:null,ne=H==null||S&&!n&&yi(O,i)==null;if(_){var te;return{x:dk({axis:l,ticks:m,bandSize:x,entry:O,index:N}),y:ne?null:(te=c.scale.map(H))!==null&&te!==void 0?te:null,value:k,payload:O}}return{x:ne?null:(G=l.scale.map(H))!==null&&G!==void 0?G:null,y:dk({axis:c,ticks:y,bandSize:x,entry:O,index:N}),value:k,payload:O}}),C;return S||E?C=T.map(O=>{var N,D=Array.isArray(O.value)?O.value[0]:null;if(_){var F;return{x:O.x,y:D!=null&&O.y!=null&&(F=c.scale.map(D))!==null&&F!==void 0?F: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}}):C=_?c.scale.map(w):l.scale.map(w),{points:T,baseLine:C??0,isRange:E}}function Hue(t){var e=Jo(t,WH),n=Js();return R.createElement(gle,{id:e.id,type:"area"},r=>R.createElement(R.Fragment,null,R.createElement(Gae,{legendPayload:Rue(e)}),R.createElement(Nue,{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(Sle,{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(Fue,qw({},e,{id:r}))))}var $H=R.memo(Hue,_S);$H.displayName="Area";var Vue=["domain","range"],Gue=["domain","range"];function v3(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(o!=null)return b3(b3({},s),{},{type:o})},[s,o]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(jle(a)):n.current!==a&&e(Ule({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Fle(n.current)),n.current=null)},[e]),null}var ede=t=>{var e=t.xAxisId,n=t.className,r=Bt(y4),i=Js(),s="xAxis",o=Bt(m=>CB(m,s,e,i)),a=Bt(m=>Ore(m,e)),l=Bt(m=>zre(m,e)),c=Bt(m=>Wz(m,e));if(a==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=jC(t,Xue);c.id,c.scale;var f=jC(c,que);return R.createElement(sR,DC({},d,f,{x:l.x,y:l.y,width:a.width,height:a.height,className:er("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:o,axisType:s,axisId:e}))},tde={allowDataOverflow:ti.allowDataOverflow,allowDecimals:ti.allowDecimals,allowDuplicatedCategory:ti.allowDuplicatedCategory,angle:ti.angle,axisLine:Wc.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:Wc.tickLine,tickSize:Wc.tickSize,type:ti.type,niceTicks:ti.niceTicks,xAxisId:0},nde=t=>{var e=Jo(t,tde);return R.createElement(R.Fragment,null,R.createElement(Jue,{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(ede,e))},qH=R.memo(nde,XH);qH.displayName="XAxis";var rde=["type"],ide=["dangerouslySetInnerHTML","ticks","scale"],sde=["id","scale"];function UC(){return UC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(o!=null)return w3(w3({},s),{},{type:o})},[o,s]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(zle(a)):n.current!==a&&e(Ble({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Hle(n.current)),n.current=null)},[e]),null}function dde(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=R.useRef(null),o=R.useRef(null),a=Bt(y4),l=Js(),c=Wr(),d="yAxis",f=Bt(_=>Vre(_,e)),m=Bt(_=>Hre(_,e)),y=Bt(_=>CB(_,d,e,l)),x=Bt(_=>$z(_,e));if(R.useLayoutEffect(()=>{if(!(r!=="auto"||!f||eR(i)||R.isValidElement(i)||x==null)){var _=s.current;if(_){var E=_.getCalculatedWidth();Math.round(f.width)!==Math.round(E)&&c(Vle({id:e,width:E}))}}},[y,f,c,i,e,r,x]),f==null||m==null||x==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=FC(t,ide);x.id,x.scale;var w=FC(x,sde);return R.createElement(sR,UC({},S,w,{ref:s,labelRef:o,x:m.x,y:m.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:f.width,height:f.height,className:er("recharts-".concat(d," ").concat(d),n),viewBox:a,ticks:y,axisType:d,axisId:e}))}var fde={allowDataOverflow:ni.allowDataOverflow,allowDecimals:ni.allowDecimals,allowDuplicatedCategory:ni.allowDuplicatedCategory,angle:ni.angle,axisLine:Wc.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:Wc.tickLine,tickSize:Wc.tickSize,type:ni.type,niceTicks:ni.niceTicks,width:ni.width,yAxisId:0},hde=t=>{var e=Jo(t,fde);return R.createElement(R.Fragment,null,R.createElement(ude,{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(dde,e))},KH=R.memo(hde,XH);KH.displayName="YAxis";var pde=(t,e)=>e,cR=Oe([pde,fr,oz,_i,XB,ou,dse,Gi],yse);function mde(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function uR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(mde(t)){var i=t.currentTarget.getBBox();n=i.width>0?e.width/i.width:1,r=i.height>0?e.height/i.height:1}else{var s=t.currentTarget;n=s.offsetWidth>0?e.width/s.offsetWidth:1,r=s.offsetHeight>0?e.height/s.offsetHeight:1}var o=(a,l)=>({relativeX:Math.round((a-e.left)/n),relativeY:Math.round((l-e.top)/r)});return"touches"in t?Array.from(t.touches).map(a=>o(a.clientX,a.clientY)):o(t.clientX,t.clientY)}var YH=Mo("mouseClick"),ZH=Xy();ZH.startListening({actionCreator:YH,effect:(t,e)=>{var n=t.payload,r=cR(e.getState(),uR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(iie({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var zC=Mo("mouseMove"),QH=Xy(),dm=null,Sf=null,$E=null;QH.startListening({actionCreator:zC,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||(o==null?void 0:o.includes("mousemove"));dm!==null&&(cancelAnimationFrame(dm),dm=null),Sf!==null&&(typeof s!="number"||!a)&&(clearTimeout(Sf),Sf=null),$E=uR(n);var l=()=>{var c=e.getState(),d=ox(c,c.tooltip.settings.shared);if(!$E){dm=null,Sf=null;return}if(d==="axis"){var f=cR(c,$E);(f==null?void 0:f.activeIndex)!=null?e.dispatch(jB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(DB())}dm=null,Sf=null};if(!a){l();return}s==="raf"?dm=requestAnimationFrame(l):typeof s=="number"&&Sf===null&&(Sf=setTimeout(l,s))}});function gde(t,e){return e instanceof HTMLElement?"HTMLElement <".concat(e.tagName,' class="').concat(e.className,'">'):e===window?"global.window":t==="children"&&typeof e=="object"&&e!==null?"<>":e}var S3={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},JH=cs({name:"rootProps",initialState:S3,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:S3.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className,t.baseValue=e.payload.baseValue,t.reverseStackOrder=e.payload.reverseStackOrder}}}),vde=JH.reducer,yde=JH.actions.updateOptions,xde=null,bde={updatePolarOptions:(t,e)=>t===null?e.payload:(t.startAngle=e.payload.startAngle,t.endAngle=e.payload.endAngle,t.cx=e.payload.cx,t.cy=e.payload.cy,t.innerRadius=e.payload.innerRadius,t.outerRadius=e.payload.outerRadius,t)},eV=cs({name:"polarOptions",initialState:xde,reducers:bde});eV.actions.updatePolarOptions;var _de=eV.reducer,tV=Mo("keyDown"),nV=Mo("focus"),rV=Mo("blur"),BS=Xy(),fm=null,Mf=null,Lb=null;BS.startListening({actionCreator:tV,effect:(t,e)=>{Lb=t.payload,fm!==null&&(cancelAnimationFrame(fm),fm=null);var n=e.getState(),r=n.eventSettings,i=r.throttleDelay,s=r.throttledEvents,o=s==="all"||s.includes("keydown");Mf!==null&&(typeof i!="number"||!o)&&(clearTimeout(Mf),Mf=null);var a=()=>{try{var l=e.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var d=l.tooltip.keyboardInteraction,f=Lb;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var m=$0(d,Lh(l),Rg(l),Ng(l)),y=m==null?-1:Number(m),x=!Number.isFinite(y)||y<0,S=ou(l),w=Lh(l),_=ox(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var E=Vw(l,_,"hover",String(d.index));e.dispatch(Hw({active:!d.active,activeIndex:d.index,activeCoordinate:E}));return}var T=qre(l),C=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(x){var D=Rg(l),F=Ng(l),G=O*C,k=he=>({active:!1,index:String(he),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(N=-1,G>0){for(var U=0;U=0;H--)if($0(k(H),w,D,F)!=null){N=H;break}if(N<0)return}else{N=y+O*C;var ne=(S==null?void 0:S.length)||w.length;if(ne===0||N>=ne||N<0)return}var te=Vw(l,_,"hover",String(N));e.dispatch(Hw({active:!0,activeIndex:N.toString(),activeCoordinate:te}))}finally{fm=null,Mf=null}};if(!o){a();return}i==="raf"?fm=requestAnimationFrame(a):typeof i=="number"&&Mf===null&&(a(),Lb=null,Mf=setTimeout(()=>{Lb?a():(Mf=null,fm=null)},i))}});BS.startListening({actionCreator:nV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;if(!i.active&&i.index==null){var s="0",o=ox(n,n.tooltip.settings.shared),a=Vw(n,o,"hover",String(s));e.dispatch(Hw({active:!0,activeIndex:s,activeCoordinate:a}))}}}});BS.startListening({actionCreator:rV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;i.active&&e.dispatch(Hw({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function iV(t){t.persist();var e=t.currentTarget;return new Proxy(t,{get:(n,r)=>{if(r==="currentTarget")return e;var i=Reflect.get(n,r);return typeof i=="function"?i.bind(n):i}})}var zo=Mo("externalEvent"),sV=Xy(),Db=new Map,p0=new Map,XE=new Map;sV.startListening({actionCreator:zo,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,o=iV(i);XE.set(s,{handler:r,reactEvent:o});var a=Db.get(s);a!==void 0&&(cancelAnimationFrame(a),Db.delete(s));var l=e.getState(),c=l.eventSettings,d=c.throttleDelay,f=c.throttledEvents,m=f,y=m==="all"||(m==null?void 0:m.includes(s)),x=p0.get(s);x!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(x),p0.delete(s));var S=()=>{var E=XE.get(s);try{if(!E)return;var T=E.handler,C=E.reactEvent,O=e.getState(),N={activeCoordinate:Yie(O),activeDataKey:Xie(O),activeIndex:Sy(O),activeLabel:YB(O),activeTooltipIndex:Sy(O),isTooltipActive:Zie(O)};T&&T(N,C)}finally{Db.delete(s),p0.delete(s),XE.delete(s)}};if(!y){S();return}if(d==="raf"){var w=requestAnimationFrame(S);Db.set(s,w)}else if(typeof d=="number"){if(!p0.has(s)){S();var _=setTimeout(S,d);p0.set(s,_)}}else S()}}});var wde=Oe([Qg],t=>t.tooltipItemPayloads),Sde=Oe([wde,(t,e)=>e,(t,e,n)=>n],(t,e,n)=>{if(e!=null){var r=t.find(s=>s.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(e)}}}),oV=Mo("touchMove"),aV=Xy(),Ef=null,$u=null,M3=null,m0=null;aV.startListening({actionCreator:oV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){m0=iV(n);var r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||o.includes("touchmove");Ef!==null&&(cancelAnimationFrame(Ef),Ef=null),$u!==null&&(typeof s!="number"||!a)&&(clearTimeout($u),$u=null),M3=Array.from(n.touches).map(c=>uR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(m0!=null){var c=e.getState(),d=ox(c,c.tooltip.settings.shared);if(d==="axis"){var f,m=(f=M3)===null||f===void 0?void 0:f[0];if(m==null){Ef=null,$u=null;return}var y=cR(c,m);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(jB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var x,S=m0.touches[0];if(document.elementFromPoint==null||S==null)return;var w=document.elementFromPoint(S.clientX,S.clientY);if(!w||!w.getAttribute)return;var _=w.getAttribute(IY),E=(x=w.getAttribute(kY))!==null&&x!==void 0?x:void 0,T=Qh(c).find(N=>N.id===E);if(_==null||T==null||E==null)return;var C=T.dataKey,O=Sde(c,_,E);e.dispatch(rie({activeDataKey:C,activeIndex:_,activeCoordinate:O,activeGraphicalItemId:E}))}Ef=null,$u=null}};if(!a){l();return}s==="raf"?Ef=requestAnimationFrame(l):typeof s=="number"&&$u===null&&(l(),m0=null,$u=setTimeout(()=>{m0?l():($u=null,Ef=null)},s))}}});var lV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},cV=cs({name:"eventSettings",initialState:lV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),Mde=cV.actions.setEventSettings,Ede=cV.reducer,Ade=F5({brush:Jle,cartesianAxis:Gle,chartData:Kse,errorBars:aue,eventSettings:Ede,graphicalItems:_le,layout:gY,legend:RZ,options:Gse,polarAxis:kae,polarOptions:_de,referenceElements:rce,renderedTicks:Ece,rootProps:vde,tooltip:sie,zIndex:Nse}),Tde=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return BK({reducer:Ade,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([ZH.middleware,QH.middleware,BS.middleware,sV.middleware,aV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(e4({type:"raf"}))},devTools:{serialize:{replacer:gde},name:"recharts-".concat(n)}})};function Cde(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=Tde(e,r));var o=FP;return R.createElement($Z,{context:o,store:s.current},n)}function Pde(t){var e=t.layout,n=t.margin,r=Wr(),i=Js();return R.useEffect(()=>{i||(r(hY(e)),r(fY(n)))},[r,i,e,n]),null}var Rde=R.memo(Pde,_S);function Nde(t){var e=Wr();return R.useEffect(()=>{e(yde(t))},[e,t]),null}var Ide=t=>{var e=Wr();return R.useEffect(()=>{e(Mde(t))},[e,t]),null},kde=R.memo(Ide,_S);function E3(t){var e=t.zIndex,n=t.isPanorama,r=R.useRef(null),i=Wr();return R.useLayoutEffect(()=>(r.current&&i(Pse({zIndex:e,element:r.current,isPanorama:n})),()=>{i(Rse({zIndex:e,isPanorama:n}))}),[i,e,n]),R.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function A3(t){var e=t.children,n=t.isPanorama,r=Bt(bse);if(!r||r.length===0)return e;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return R.createElement(R.Fragment,null,i.map(o=>R.createElement(E3,{key:o,zIndex:o,isPanorama:n})),e,s.map(o=>R.createElement(E3,{key:o,zIndex:o,isPanorama:n})))}var Ode=["children"];function Lde(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=S4(),r=M4(),i=O4();if(!Ll(n)||!Ll(r))return null;var s=t.children,o=t.otherAttributes,a=t.title,l=t.desc,c,d;return o!=null&&(typeof o.tabIndex=="number"?c=o.tabIndex:c=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),R.createElement(r5,Yw({},o,{title:a,desc:l,role:d,tabIndex:c,width:n,height:r,style:jde,ref:e}),s)}),Fde=t=>{var e=t.children,n=Bt(gS);if(!n)return null;var r=n.width,i=n.height,s=n.y,o=n.x;return R.createElement(r5,{width:r,height:i,x:o,y:s},e)},T3=R.forwardRef((t,e)=>{var n=t.children,r=Lde(t,Ode),i=Js();return i?R.createElement(Fde,null,R.createElement(A3,{isPanorama:!0},n)):R.createElement(Ude,Yw({ref:e},r),R.createElement(A3,{isPanorama:!1},n))});function zde(t,e){return Gde(t)||Vde(t,e)||Hde(t,e)||Bde()}function Bde(){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 Hde(t,e){if(t){if(typeof t=="string")return C3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?C3(t,e):void 0}}function C3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r!=null){var o=r.getBoundingClientRect(),a=o.width/r.offsetWidth;wn(a)&&a!==s&&t(mY(a))}},[r,t,s]),i}function P3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function $de(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n(ioe(),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 tfe=R.forwardRef((t,e)=>{var n,r,i=R.useRef(null),s=R.useState({containerWidth:Qw((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:Qw((r=t.style)===null||r===void 0?void 0:r.height)}),o=Zw(s,2),a=o[0],l=o[1],c=R.useCallback((f,m)=>{l(y=>{var x=Math.round(f),S=Math.round(m);return y.containerWidth===x&&y.containerHeight===S?y:{containerWidth:x,containerHeight:S}})},[]),d=R.useCallback(f=>{if(typeof e=="function"&&e(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var m=f.getBoundingClientRect(),y=m.width,x=m.height;c(y,x);var S=_=>{var E=_[0];if(E!=null){var T=E.contentRect,C=T.width,O=T.height;c(C,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(Ky,{width:a.containerWidth,height:a.containerHeight}),R.createElement("div",Sd({ref:d},t)))}),nfe=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=R.useState({containerWidth:Qw(n),containerHeight:Qw(r)}),s=Zw(i,2),o=s[0],a=s[1],l=R.useCallback((d,f)=>{a(m=>{var y=Math.round(d),x=Math.round(f);return m.containerWidth===y&&m.containerHeight===x?m:{containerWidth:y,containerHeight:x}})},[]),c=R.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var f=d.getBoundingClientRect(),m=f.width,y=f.height;l(m,y)}},[e,l]);return R.createElement(R.Fragment,null,R.createElement(Ky,{width:o.containerWidth,height:o.containerHeight}),R.createElement("div",Sd({ref:c},t)))}),rfe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return R.createElement(R.Fragment,null,R.createElement(Ky,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))}),ife=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?R.createElement(nfe,Sd({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?R.createElement(rfe,Sd({},t,{width:n,height:r,ref:e})):R.createElement(R.Fragment,null,R.createElement(Ky,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))});function sfe(t){return t?tfe:ife}var ofe=R.forwardRef((t,e)=>{var n=t.children,r=t.className,i=t.height,s=t.onClick,o=t.onContextMenu,a=t.onDoubleClick,l=t.onMouseDown,c=t.onMouseEnter,d=t.onMouseLeave,f=t.onMouseMove,m=t.onMouseUp,y=t.onTouchEnd,x=t.onTouchMove,S=t.onTouchStart,w=t.style,_=t.width,E=t.responsive,T=t.dispatchTouchEvents,C=T===void 0?!0:T,O=R.useRef(null),N=Wr(),D=R.useState(null),F=Zw(D,2),G=F[0],k=F[1],U=R.useState(null),H=Zw(U,2),ne=H[0],te=H[1],he=Wde(),se=$P(),fe=(se==null?void 0:se.width)>0?se.width:_,B=(se==null?void 0:se.height)>0?se.height:i,J=R.useCallback(je=>{he(je),typeof e=="function"&&e(je),k(je),te(je),je!=null&&(O.current=je)},[he,e,k,te]),Y=R.useCallback(je=>{N(YH(je)),N(zo({handler:s,reactEvent:je}))},[N,s]),V=R.useCallback(je=>{N(zC(je)),N(zo({handler:c,reactEvent:je}))},[N,c]),q=R.useCallback(je=>{N(DB()),N(zo({handler:d,reactEvent:je}))},[N,d]),pe=R.useCallback(je=>{N(zC(je)),N(zo({handler:f,reactEvent:je}))},[N,f]),ae=R.useCallback(()=>{N(nV())},[N]),le=R.useCallback(()=>{N(rV())},[N]),be=R.useCallback(je=>{N(tV(je.key))},[N]),Se=R.useCallback(je=>{N(zo({handler:o,reactEvent:je}))},[N,o]),qe=R.useCallback(je=>{N(zo({handler:a,reactEvent:je}))},[N,a]),Me=R.useCallback(je=>{N(zo({handler:l,reactEvent:je}))},[N,l]),$e=R.useCallback(je=>{N(zo({handler:m,reactEvent:je}))},[N,m]),Ke=R.useCallback(je=>{N(zo({handler:S,reactEvent:je}))},[N,S]),ce=R.useCallback(je=>{C&&N(oV(je)),N(zo({handler:x,reactEvent:je}))},[N,C,x]),Z=R.useCallback(je=>{N(zo({handler:y,reactEvent:je}))},[N,y]),We=sfe(E);return R.createElement(iH.Provider,{value:G},R.createElement(bX.Provider,{value:ne},R.createElement(We,{width:fe??(w==null?void 0:w.width),height:B??(w==null?void 0:w.height),className:er("recharts-wrapper",r),style:$de({position:"relative",cursor:"default",width:fe,height:B},w),onClick:Y,onContextMenu:Se,onDoubleClick:qe,onFocus:ae,onBlur:le,onKeyDown:be,onMouseDown:Me,onMouseEnter:V,onMouseLeave:q,onMouseMove:pe,onMouseUp:$e,onTouchEnd:Z,onTouchMove:ce,onTouchStart:Ke,ref:J},R.createElement(efe,null),n)))}),afe=["width","height","responsive","children","className","style","compact","title","desc"];function lfe(t,e){if(t==null)return{};var n,r,i=cfe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=t.width,r=t.height,i=t.responsive,s=t.children,o=t.className,a=t.style,l=t.compact,c=t.title,d=t.desc,f=lfe(t,afe),m=za(f);return l?R.createElement(R.Fragment,null,R.createElement(Ky,{width:n,height:r}),R.createElement(T3,{otherAttributes:m,title:c,desc:d},s)):R.createElement(ofe,{className:o,style:a,width:n,height:r,responsive:i??!1,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},R.createElement(T3,{otherAttributes:m,title:c,desc:d,ref:e},R.createElement(uce,null,s)))});function BC(){return BC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.createElement(vfe,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:yfe,tooltipPayloadSearcher:Hse,categoricalChartProps:t,ref:e}));const bfe="rgba(130,130,150,0.14)",I3="rgba(130,130,150,0.85)";function _fe(t){if(t<=0)return 10;const e=Math.pow(10,Math.floor(Math.log10(t))),n=t/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function uV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function wfe({active:t,payload:e,unit:n}){return!t||!(e!=null&&e.length)?null:g.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:g.jsx("div",{className:"space-y-1",children:e.map(r=>g.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[g.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:r.color}}),g.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:r.name}),g.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:uV(r.value,n)})]},r.dataKey))})})}function dV({data:t,series:e,unit:n="%",yMode:r="percent",height:i=176}){const s=t.reduce((a,l)=>e.reduce((c,d)=>Math.max(c,Number(l[d.key])||0),a),0),o=r==="percent"?Math.min(100,Math.max(25,Math.ceil(s*1.2/25)*25)):Math.max(_fe(s*1.15),10);return g.jsx("div",{style:{height:i},className:"w-full",children:g.jsx(fZ,{width:"100%",height:"100%",children:g.jsxs(xfe,{data:t,margin:{top:8,right:6,bottom:0,left:-12},children:[g.jsx("defs",{children:e.map(a=>g.jsxs("linearGradient",{id:`grad-${a.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[g.jsx("stop",{offset:"0%",stopColor:a.color,stopOpacity:.22}),g.jsx("stop",{offset:"100%",stopColor:a.color,stopOpacity:0})]},a.key))}),g.jsx(LH,{vertical:!1,stroke:bfe}),g.jsx(qH,{dataKey:"t",hide:!0}),g.jsx(KH,{domain:[0,o],ticks:[0,o/2,o],tickFormatter:a=>uV(a,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:I3}}),g.jsx(voe,{content:g.jsx(wfe,{unit:n}),cursor:{stroke:I3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(a=>g.jsx($H,{type:"monotone",dataKey:a.key,name:a.label,stroke:a.color,strokeWidth:2,fill:`url(#grad-${a.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},a.key))]})})})}const Sfe=[{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 Mfe(){var o,a,l,c;const{sys:t,hist:e}=cX(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=Sfe.filter(d=>d.key!=="gpu"||n),i={cpu:(o=t==null?void 0:t.cpu)==null?void 0:o.percent,ram:(a=t==null?void 0:t.ram)==null?void 0:a.percent,gpu:n?t.gpu.busy_percent:null,disk:(l=t==null?void 0:t.disk)==null?void 0:l.percent},s={cpu:(c=t==null?void 0:t.cpu)!=null&&c.cores?`${t.cpu.cores} Cores`:"",ram:t?`${sm(t.ram.used)}/${sm(t.ram.total)} GB`:"",gpu:n?`${sm(t.gpu.gtt_used)}/${sm(t.gpu.gtt_total)} GB`:"",disk:t!=null&&t.disk?`${sm(t.disk.used)}/${sm(t.disk.total)} GB`:""};return g.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[g.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),g.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:r.map(d=>g.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:d.color}}),g.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:d.label}),g.jsxs("span",{className:"shrink-0 font-mono text-xs font-bold tabular-nums text-foreground",children:[Math.round(i[d.key]??0),"%"]}),s[d.key]&&g.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:s[d.key]})]},d.key))}),g.jsx(dV,{data:e,series:r,unit:"%",yMode:"percent",height:176})]}):g.jsx("div",{className:"flex h-44 items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(t==null?void 0:t.temp)&&(t.temp.cpu||t.temp.gpu)&&g.jsxs("div",{className:"mt-3 flex gap-4 border-t border-border/30 pt-3 font-mono text-xs text-muted-foreground/80",children:[t.temp.cpu!=null&&g.jsxs("span",{children:["CPU Temp: ",t.temp.cpu," °C"]}),t.temp.gpu!=null&&g.jsxs("span",{children:["GPU Temp: ",t.temp.gpu," °C"]})]})]})}function g0({label:t,value:e,tone:n}){return g.jsxs("div",{className:nt("flex items-center justify-between rounded-lg border px-3 py-1.5 text-xs",n==="alert"?"border-amber-500/30 bg-amber-500/5 font-semibold text-amber-400":n==="accent"?"border-primary/30 bg-primary/5 font-semibold text-primary":"border-border/30 bg-background/25 text-muted-foreground"),children:[g.jsx("span",{className:"flex items-center gap-1.5",children:t}),g.jsx("span",{className:"font-mono text-[10px]",children:e})]})}function Efe(){var n;const{data:t}=PP(3e3),e=()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}}));return g.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/20 pb-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(n9,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Updates & Pflege"})]}),(t==null?void 0:t.last_check)&&g.jsxs("span",{className:"font-mono text-[9px] text-muted-foreground/80",children:["Zuletzt gesucht: ",new Date(t.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),t?g.jsxs("div",{className:"space-y-1.5",children:[g.jsx(g0,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),g.jsx(g0,{label:"Inferenz-Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),g.jsx(g0,{label:"Router (llama-swap)",tone:t.swap>0?"alert":"muted",value:t.swap>0?"Update verfügbar":"aktuell"}),g.jsx(g0,{label:"Modell-Upgrades",tone:t.models>0?"accent":"muted",value:t.models>0?`${t.models} verfügbar`:"aktuell"}),(n=t.components)==null?void 0:n.map(r=>g.jsx(g0,{tone:r.update===!0?"alert":"muted",label:g.jsxs(g.Fragment,{children:[r.name,r.reachable===!1&&g.jsx("span",{className:"text-[8px] font-bold uppercase text-red-400/80",children:"offline"})]}),value:r.update===!0?`Update: ${r.latest}`:r.update===!1?"aktuell":r.latest?`neueste: ${r.latest}`:"—"},r.key))]}):g.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."})]}),g.jsxs("button",{onClick:e,className:"mt-4 flex h-9 w-full items-center justify-center gap-1.5 rounded-lg bg-primary text-xs font-semibold text-primary-foreground shadow-md shadow-primary/10 transition-all hover:opacity-90 cursor-pointer",children:["Updates verwalten & Pflege ",g.jsx(oF,{className:"h-3.5 w-3.5"})]})]})}function fV({type:t,title:e,message:n,defaultValue:r,autoValue:i,autoLabel:s,onConfirm:o,onCancel:a}){const l=R.useRef(null);return g.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:e}),g.jsx("button",{onClick:a||(()=>o()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:n}),t==="prompt"&&g.jsxs("div",{className:"flex gap-2",children:[g.jsx("input",{ref:l,type:"text",defaultValue:r,className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:c=>{var d;c.key==="Enter"&&o((d=l.current)==null?void 0:d.value)}}),i!==void 0&&g.jsx("button",{type:"button",onClick:()=>{l.current&&(l.current.value=i)},title:"Setup-bewussten Optimalwert eintragen",className:"h-9 px-3 shrink-0 text-xs font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg transition-colors cursor-pointer",children:s||"Auto"})]}),g.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(t==="confirm"||t==="prompt")&&g.jsx("button",{onClick:a,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),g.jsx("button",{onClick:()=>{var d;const c=t==="prompt"?(d=l.current)==null?void 0:d.value:void 0;o(c)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:t==="confirm"?"Ja, fortfahren":t==="prompt"?"Übernehmen":"OK"})]})]})})}function tv(){const[t,e]=R.useState(null),n=R.useCallback(()=>e(null),[]),r=R.useCallback((a,l,c)=>{e({type:"alert",title:a,message:l,onConfirm:()=>{e(null),c==null||c()}})},[]),i=R.useCallback((a,l,c,d)=>{e({type:"confirm",title:a,message:l,onConfirm:()=>{e(null),c()},onCancel:()=>{e(null),d==null||d()}})},[]),s=R.useCallback((a,l,c,d,f,m)=>{e({type:"prompt",title:a,message:l,defaultValue:c,autoValue:m==null?void 0:m.autoValue,autoLabel:m==null?void 0:m.autoLabel,onConfirm:y=>{e(null),d(y)},onCancel:()=>{e(null),f==null||f()}})},[]),o=t?g.jsx(fV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:o}}function Afe(){const t=$h(),{data:e}=CP(3e3),{data:n}=qh(),{showAlert:r,dialogElement:i}=tv(),[s,o]=R.useState(!1),a=(n==null?void 0:n.models)??[];async function l(c){try{await Ft("/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:Lr.agentStatus}),o(!1)}catch(d){r("Fehler",`Fehler beim Wechseln des Gehirns: ${d.message}`)}}return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center justify-between mb-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Il,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(e==null?void 0:e.terminal_url)&&g.jsxs("a",{href:Mg(e.terminal_url),target:"_blank",rel:"noopener",className:nt("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",e.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[g.jsx(bg,{className:"h-3 w-3"})," Terminal öffnen"]})]}),e?g.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[g.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[g.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),g.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[g.jsx("span",{className:nt("h-2 w-2 rounded-full",e.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-medium",children:e.gateway_reachable?"Online":"Offline"})]})]}),g.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[g.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Terminal"}),g.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[g.jsx("span",{className:nt("h-2 w-2 rounded-full",e.terminal_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-medium",children:e.terminal_reachable?"Online":"Offline"})]})]}),g.jsxs("div",{onClick:()=>o(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),g.jsx(El,{className:"h-3 w-3 text-primary"})]}),g.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[g.jsx($1,{className:"h-3 w-3 shrink-0"}),e.brain_model||"auto"]})]}),g.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),g.jsx(rw,{className:"h-3 w-3 text-primary"})]}),g.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[g.jsxs("div",{children:["Config: ",e.has_config?g.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),g.jsxs("div",{children:["Skills: ",e.has_skills?g.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),g.jsxs("div",{children:["Memory: ",e.has_memories?g.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):g.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),e&&g.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[g.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[g.jsx("span",{children:"Telegram"}),g.jsx("span",{className:nt("font-semibold",e.telegram_enabled?"text-emerald-400":""),children:e.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),g.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[g.jsx("span",{children:"MCP-Server"}),g.jsxs("span",{className:"font-semibold text-foreground",children:[e.mcp_server_count??0," verbunden"]})]}),g.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[g.jsx("span",{children:"PC Executor"}),g.jsx("span",{className:nt("font-semibold",e.pc_executor_reachable?"text-emerald-400":""),children:e.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),e&&s&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[g.jsx(El,{className:"h-4 w-4"}),g.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),g.jsx("button",{onClick:()=>o(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',g.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),g.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...a.map(c=>{var d;return((d=c.name.split("/").pop())==null?void 0:d.replace(".gguf",""))||c.name})].map(c=>{const d=["auto","fast","heavy"].includes(c);return g.jsxs("button",{onClick:()=>l(c),className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",e.brain_model===c||!e.brain_model&&c==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[g.jsxs("div",{className:"flex flex-col text-left",children:[g.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:c}),g.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:d?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(e.brain_model===c||!e.brain_model&&c==="auto")&&g.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function Tfe(){const{data:t}=qh(3e3),e=(t==null?void 0:t.models)??[],n=(t==null?void 0:t.running)??[];return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[g.jsx($1,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),g.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:QF.map(r=>{var o;const i=e.find(a=>a.role===r),s=i?n.includes(i.name):!1;return g.jsxs("div",{className:nt("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",s?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":i?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[g.jsx("div",{className:"min-w-0 flex-1 mr-2",children:g.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[g.jsx("span",{className:nt("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",NP(r)),children:r}),g.jsxs("div",{className:"flex flex-col min-w-0",children:[g.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:i?(o=i.name.split("/").pop())==null?void 0:o.replace(/\.gguf$/i,""):"nicht zugewiesen"}),i&&g.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[i.prompt_cache&&g.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),i.spec_active&&g.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${i.spec_draft_model})`,children:"SPEC"}),i.parallel_slots>1&&g.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${i.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",i.parallel_slots]}),i.incomplete&&g.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),g.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:i?s?g.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):g.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):g.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},r)})})]}),g.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]})}function Cfe(){const t=$h(),{data:e=[]}=HT({limit:3}),[n,r]=R.useState(""),[i,s]=R.useState("stable"),[o,a]=R.useState(!1);async function l(){if(!(!n.trim()||o)){a(!0);try{await Ft("/api/memory",{method:"POST",body:JSON.stringify({content:n,category:i,source:"dashboard"})}),r(""),t.invalidateQueries({queryKey:["memory"]})}catch(c){console.error(c)}finally{a(!1)}}}return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[g.jsx(W1,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsx("textarea",{value:n,onChange:c=>r(c.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),g.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[g.jsxs("select",{value:i,onChange:c=>s(c.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[g.jsx("option",{value:"stable",children:"🔵 Fakt"}),g.jsx("option",{value:"instruction",children:"📋 Regel"}),g.jsx("option",{value:"user",children:"👤 User"}),g.jsx("option",{value:"versioned",children:"🟡 Version"})]}),g.jsxs("button",{onClick:l,disabled:!n.trim()||o,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[g.jsx(OT,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),g.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[g.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),g.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:e.length===0?g.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):e.map(c=>g.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[g.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:c.category}),g.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:c.content,children:c.content})]},c.id))})]})]}),g.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}const k3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Pfe(){const{data:t}=TP(3e3),e=aX(),n=e[e.length-1],r=n?Math.round(n.prompt+n.completion):0;return g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(ay,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),g.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t&&g.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[g.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:r.toLocaleString("de-DE")}),g.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),t&&g.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[g.jsxs("div",{children:[t.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",g.jsxs("span",{className:"text-emerald-400/90",children:[t.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),g.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",t.prompt_tokens.toLocaleString("de-DE")," · Output ",t.completion_tokens.toLocaleString("de-DE")]})]})]}),g.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:k3.map(i=>g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),g.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),g.jsx("span",{className:"font-mono text-xs font-bold tabular-nums text-foreground",children:Math.round((n==null?void 0:n[i.key])??0)})]},i.key))})]}),t?g.jsx(dV,{data:e,series:k3,unit:" tok/s",yMode:"auto",height:150}):g.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),g.jsx("div",{className:"mt-2 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:"Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf."})]})}function Rfe(){const{data:t}=m7(3e3),{showAlert:e,dialogElement:n}=tv(),[r,i]=R.useState({});async function s(o){i(a=>({...a,[o]:!0}));try{const a=await Ft("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:o})});a.ok||e("Fehler",`Neustart fehlgeschlagen: ${a.err||"Unbekannt"}`)}catch(a){e("Fehler",`Fehler: ${a.message}`)}finally{i(a=>({...a,[o]:!1}))}}return g.jsxs("div",{className:"flex flex-col rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[g.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(nw,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Dienste"})]}),g.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground transition-colors hover:text-primary cursor-pointer",children:"Logs / Pflege"})]}),t?g.jsxs("div",{className:"flex flex-1 flex-col",children:[g.jsx("div",{className:"space-y-1.5",children:t.services.map(o=>g.jsxs("div",{className:"group flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[g.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[g.jsx("span",{className:nt("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",o.ok?"bg-emerald-500":"bg-amber-500")}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"truncate text-xs font-bold text-foreground",children:o.name}),g.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:o.url})]})]}),g.jsx("button",{onClick:()=>s(o.name),disabled:r[o.name],className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground opacity-0 transition-all hover:bg-primary/5 hover:text-primary group-hover:opacity-100",title:"Dienst neu starten",children:g.jsx(Vm,{className:nt("h-3.5 w-3.5",r[o.name]&&"animate-spin")})})]},o.name))}),g.jsxs("div",{className:"mt-auto flex flex-wrap gap-3 border-t border-border/20 pt-2.5 text-[10px] font-semibold text-muted-foreground",children:[g.jsxs("a",{href:Mg(t.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[g.jsx(bg,{className:"h-3 w-3"})," Engine"]}),g.jsxs("a",{href:Mg(t.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[g.jsx(bg,{className:"h-3 w-3"})," Gateway"]})]})]}):g.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Dienste…"}),n]})}function O3({children:t}){return g.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t})}function Nfe(){return g.jsxs("div",{className:"space-y-7",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),g.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),g.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[g.jsx(Mfe,{}),g.jsx(Pfe,{}),g.jsx(rX,{})]}),g.jsxs("section",{children:[g.jsx(O3,{children:"Stack-Status"}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[g.jsx(Tfe,{}),g.jsx(Rfe,{})]})]}),g.jsxs("section",{children:[g.jsx(O3,{children:"Betrieb & Wissen"}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[g.jsx(Efe,{}),g.jsx(Afe,{}),g.jsx(Cfe,{})]})]})]})}function Ife(){const t=$h(),{data:e=[]}=v7(2e3),{showAlert:n,dialogElement:r}=tv();async function i(a){try{await Ft(`/api/jobs/${a}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:Lr.jobs})}catch(l){n("Fehler",l.message)}}const s=e.filter(a=>a.state==="running"||a.state==="queued"),o=e.filter(a=>a.state!=="running"&&a.state!=="queued").slice(-3);return s.length===0&&o.length===0?null:g.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[g.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),s.map(a=>g.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[g.jsxs("div",{className:"flex justify-between items-center text-xs",children:[g.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:a.label}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("span",{className:"text-muted-foreground font-mono",children:[a.progress??0,"% • ",VT(a.done_bytes),"/",VT(a.total_bytes),a.eta_s?` • ETA ${w7(a.eta_s)}`:""]}),g.jsx("button",{onClick:()=>i(a.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),g.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:g.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${a.progress??0}%`}})})]},a.id)),o.map(a=>g.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[g.jsx("span",{className:"truncate",children:a.label}),g.jsx("span",{className:nt("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",a.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:a.state})]},a.id)),r]})}function Af({children:t,tone:e="muted"}){const n={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return g.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${n[e]}`,children:t})}function L3({caps:t}){return t?g.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&g.jsx(Af,{children:"💻 Code"}),t.vision&&g.jsx(Af,{children:"👁 Bild"}),t.reasoning&&g.jsx(Af,{children:"🧠 Reason"}),t.moe&&g.jsxs(Af,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&g.jsx(Af,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&g.jsx(Af,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&g.jsx(Af,{children:"🔢 Embed"})]}):null}function kfe({model:t,onClose:e,onChanged:n}){var S,w;const{data:r,isLoading:i}=b7(t.gguf_path),[s,o]=R.useState(null),[a,l]=R.useState(""),c=r==null?void 0:r.target_vocab,d=(r==null?void 0:r.drafts)??[],f=d.filter(_=>_.compatible===!0),m=t.spec_draft_model;async function y(_){o(_??"__clear__"),l("");try{await Ft(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:_})}),n(),e()}catch(E){l(String((E==null?void 0:E.message)||E)),o(null)}}const x=_=>{var E;return _?`${_.pre??"?"} · ${((E=_.n_vocab)==null?void 0:E.toLocaleString())??"?"} Tokens`:"—"};return g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[g.jsx(xh,{className:"h-4 w-4"})," Speculative Draft"]}),g.jsx("button",{onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',g.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),g.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[g.jsx("span",{className:"text-muted-foreground",children:(S=t.name.split("/").pop())==null?void 0:S.replace(/\.gguf$/i,"")}),g.jsxs("span",{className:"text-foreground",children:["Vocab: ",x(c)]})]}),t.spec_active&&m&&g.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[g.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[g.jsx(Go,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",m]}),g.jsx("button",{onClick:()=>y(null),disabled:s!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(r!=null&&r.target_exists)&&g.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[g.jsx(_g,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),g.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?g.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):d.length===0?g.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",g.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):d.map(_=>{var C,O;const E=_.filename===m,T=_.compatible===!0;return g.jsxs("div",{className:nt("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",T?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",E&&"border-primary/40 bg-primary/10"),children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:_.filename}),g.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[Bo(_.size_bytes)," · Vocab: ",x(_.vocab)]})]}),T?E?g.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[g.jsx(Go,{className:"h-3.5 w-3.5"})," Aktiv"]}):g.jsx("button",{onClick:()=>y(_.path),disabled:s!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):g.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:_.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(C=_.vocab)==null?void 0:C.pre}/${(O=_.vocab)==null?void 0:O.n_vocab} ≠ Modell ${c==null?void 0:c.pre}/${c==null?void 0:c.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[g.jsx(_g,{className:"h-3.5 w-3.5"})," ",_.compatible===!1?"Vocab ≠":"n/a"]})]},_.path)})}),!i&&(r==null?void 0:r.target_exists)&&d.length>0&&f.length===0&&g.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",g.jsx("span",{className:"font-mono",children:c==null?void 0:c.pre}),", n_vocab=",g.jsx("span",{className:"font-mono",children:(w=c==null?void 0:c.n_vocab)==null?void 0:w.toLocaleString()}),")."]}),a&&g.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:a})]})})}function Ofe(){var rt,dt,de,Ne,tt,jt,Lt,ct;const t=$h(),{data:e,isLoading:n,error:r}=qh(4e3),{data:i}=g7(4e3),{data:s}=WF(),{data:o}=PP(4e3),{data:a}=y7(),{data:l}=Q1(),{showAlert:c,showConfirm:d,showPrompt:f,dialogElement:m}=tv(),y=(e==null?void 0:e.models)??[],x=(e==null?void 0:e.running)??[],S=r?String(r):"",w=()=>{t.invalidateQueries({queryKey:Lr.models}),t.invalidateQueries({queryKey:Lr.routing})},[_,E]=R.useState(null),[T,C]=R.useState(null),[O,N]=R.useState(null),[D,F]=R.useState(null),[G,k]=R.useState(!1),[U,H]=R.useState(!1),[ne,te]=R.useState(null),[he,se]=R.useState("grid"),[fe,B]=R.useState("all"),J=y.filter(ue=>fe==="in_use"?!!ue.role||x.includes(ue.name):!0),[Y,V]=R.useState({width:800,height:360}),q=R.useRef(null),pe=R.useCallback(ue=>{if(q.current&&(q.current.disconnect(),q.current=null),ue){const Q=new ResizeObserver(Ae=>{if(!Ae||Ae.length===0)return;const re=Ae[0].contentRect;V({width:re.width,height:re.height})});Q.observe(ue),q.current=Q}},[]),ae=Y.width,le=Y.height,be=ue=>{const Q=ae*.1,Ae=le*ue,re=ae*.5,Fe=le*.5,Te=ae*.3,Le=Ae,Ye=ae*.3;return`M ${Q} ${Ae} C ${Te} ${Le}, ${Ye} ${Fe}, ${re} ${Fe}`},Se=ue=>{const Q=ae*.5,Ae=le*.5,re=ae*.9,Fe=le*ue,Te=ae*.7,Le=Ae,Ye=ae*.7;return`M ${Q} ${Ae} C ${Te} ${Le}, ${Ye} ${Fe}, ${re} ${Fe}`};async function qe(ue){try{await Ft(`/api/models/${encodeURIComponent(ue)}/load`,{method:"POST"}),w()}catch(Q){c("Fehler",`Fehler beim Laden des Modells: ${Q.message}`)}}async function Me(ue){try{await Ft(`/api/models/${encodeURIComponent(ue)}/unload`,{method:"POST"}),w()}catch(Q){c("Fehler",`Fehler beim Entladen des Modells: ${Q.message}`)}}async function $e(){try{await Ft("/api/models/unload",{method:"POST"}),w()}catch(ue){c("Fehler",`Fehler beim Entladen aller Modelle: ${ue.message}`)}}async function Ke(ue,Q){try{await Ft(`/api/models/${encodeURIComponent(Q)}/role`,{method:"POST",body:JSON.stringify({role:ue||null})}),w()}catch(Ae){c("Fehler",`Fehler beim Zuweisen der Rolle: ${Ae.message||Ae}`)}}function ce(ue){C(ue),N(null),Ft(`/api/roles/${encodeURIComponent(ue)}/recommend`).then(Q=>N(Q)).catch(()=>{})}async function Z(ue,Q){let Ae=null;try{Ae=await Ft(`/api/models/${encodeURIComponent(ue)}/ctx/auto`)}catch{}const re=Ae?`Optimal für dein Setup: ${(Ae.ctx/1024).toFixed(0)}k (${Ae.ctx}) — GTT ${Ae.gtt_gb} GB − reserviert ${Ae.reserved_gb} GB (${Ae.mode}) → ${Ae.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";f("Kontextlänge anpassen",re,String(Q||32768),async Fe=>{if(Fe)try{await Ft(`/api/models/${encodeURIComponent(ue)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Fe,10)})}),w()}catch(Te){c("Fehler",`Fehler beim Setzen des Kontexts: ${Te.message||Te}`)}},void 0,Ae?{autoValue:String(Ae.ctx),autoLabel:`Auto (${(Ae.ctx/1024).toFixed(0)}k)`}:void 0)}async function We(ue){d("Modell löschen?",`Modell '${ue}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await Ft(`/api/models/${encodeURIComponent(ue)}`,{method:"DELETE"}),w()}catch(Q){c("Fehler",`Fehler beim Löschen: ${Q.message||Q}`)}})}async function je(ue,Q,Ae,re){try{await Ft("/api/models/install",{method:"POST",body:JSON.stringify({repo:ue,role:Q,quant:Ae,jinja:re})}),c("Herunterladen gestartet",`Download für '${ue}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Fe){c("Fehler",`Fehler beim Starten des Upgrades: ${Fe.message||Fe}`)}}async function Xe(ue){const Q=a==null?void 0:a.budget,Ae=Q&&!Q.fits?` -⚠ Speicher-Warnung: Dieses Brain (~${J.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${J.largest_ondemand_gb} GB) sprengt das das Budget (${J.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";d("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${de.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${Ae}`,async()=>{try{await Ft("/api/models/install",{method:"POST",body:JSON.stringify({repo:de,role:"hermes",quant:"Q4_K_M",jinja:!0})}),c("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),w()}catch(re){c("Fehler",`Update fehlgeschlagen: ${re.message||re}`)}})}async function Je(de){d("Agent-Hirn wechseln?",`'${de.split("/").pop()}' als Agent-Hirn (Alias hermes) setzen? Es wird warm gehalten (brains-Gruppe); Hermes nutzt es nach einem kurzen Gateway-Restart.`,async()=>{try{await Ft("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:de})}),c("Erledigt","Agent-Hirn gewechselt. Gateway wurde neugestartet."),k(!1),w()}catch(J){c("Fehler",`Wechsel fehlgeschlagen: ${J.message||J}`)}})}async function bt(de){de&&(await navigator.clipboard.writeText(de),H(!0),setTimeout(()=>H(!1),1500))}if(n)return g.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(S)return g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",S,")."]});const at=y.filter(de=>x.includes(de.name)),ee=at.reduce((de,J)=>de+(J.size_bytes||0),0),W=((nt=l==null?void 0:l.gpu)==null?void 0:nt.gtt_total)||((se=l==null?void 0:l.gpu)==null?void 0:se.vram_total)||0,Ee=((rt=l==null?void 0:l.gpu)==null?void 0:rt.gtt_used)||0,ze=16*1024**3,He=W>2*1024**3?W:ee>ze?ee*1.2:ze,Be=de=>y.find(J=>J.role===de),pt=de=>{const J=Be(de);return J?x.includes(J.name):!1};return g.jsxs("div",{className:"space-y-8",children:[g.jsx("style",{children:` +⚠ Speicher-Warnung: Dieses Brain (~${Q.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${Q.largest_ondemand_gb} GB) sprengt das das Budget (${Q.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";d("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${ue.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${Ae}`,async()=>{try{await Ft("/api/models/install",{method:"POST",body:JSON.stringify({repo:ue,role:"hermes",quant:"Q4_K_M",jinja:!0})}),c("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),w()}catch(re){c("Fehler",`Update fehlgeschlagen: ${re.message||re}`)}})}async function Je(ue){d("Agent-Hirn wechseln?",`'${ue.split("/").pop()}' als Agent-Hirn (Alias hermes) setzen? Es wird warm gehalten (brains-Gruppe); Hermes nutzt es nach einem kurzen Gateway-Restart.`,async()=>{try{await Ft("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:ue})}),c("Erledigt","Agent-Hirn gewechselt. Gateway wurde neugestartet."),k(!1),w()}catch(Q){c("Fehler",`Wechsel fehlgeschlagen: ${Q.message||Q}`)}})}async function bt(ue){ue&&(await navigator.clipboard.writeText(ue),H(!0),setTimeout(()=>H(!1),1500))}if(n)return g.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(S)return g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",S,")."]});const ut=y.filter(ue=>x.includes(ue.name)),ee=ut.reduce((ue,Q)=>ue+(Q.size_bytes||0),0),$=((rt=l==null?void 0:l.gpu)==null?void 0:rt.gtt_total)||((dt=l==null?void 0:l.gpu)==null?void 0:dt.vram_total)||0,Ee=((de=l==null?void 0:l.gpu)==null?void 0:de.gtt_used)||0,Be=16*1024**3,Ve=$>2*1024**3?$:ee>Be?ee*1.2:Be,He=ue=>y.find(Q=>Q.role===ue),mt=ue=>{const Q=He(ue);return Q?x.includes(Q.name):!1};return g.jsxs("div",{className:"space-y-8",children:[g.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -565,13 +570,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(rE,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",Bo(ee)," Gewichte",Ee>0?` · ${Bo(Ee)} real belegt (inkl. KV)`:""," / ",Bo(He)]}),x.length>0&&g.jsx("button",{onClick:We,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),g.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:at.length===0?g.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):at.map((de,J)=>{var Ue;const Ae=(de.size_bytes||0)/He*100,re=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][J%4];return g.jsxs("div",{style:{width:`${Ae}%`},className:tt("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",re),title:`${de.name} (${Bo(de.size_bytes)})`,children:[g.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[de.role?`[${de.role}] `:"",(Ue=de.name.split("/").pop())==null?void 0:Ue.replace(".gguf","")]}),g.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Bo(de.size_bytes)})]},de.name)})})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[g.jsxs("div",{children:[g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),g.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),g.jsxs("div",{ref:ge,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[g.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[g.jsxs("defs",{children:[g.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),g.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),g.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),g.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),g.jsx("path",{d:_e(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="roocode"||_==="roocode")&&g.jsx("path",{d:_e(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:_e(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="cursor"||_==="cursor")&&g.jsx("path",{d:_e(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:_e(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="opencode"||_==="opencode")&&g.jsx("path",{d:_e(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:_e(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="zed"||_==="zed")&&g.jsx("path",{d:_e(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:_e(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="continue"||_==="continue")&&g.jsx("path",{d:_e(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Se(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),pt("fast")&&g.jsx("path",{d:Se(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Se(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),pt("heavy")&&g.jsx("path",{d:Se(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Se(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),pt("coder")&&g.jsx("path",{d:Se(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Se(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),pt("vision")&&g.jsx("path",{d:Se(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Se(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),pt("scout")&&g.jsx("path",{d:Se(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>te("roocode"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="roocode"?null:"roocode"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Roo Code"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>te("cursor"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="cursor"?null:"cursor"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Cursor IDE"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>te("opencode"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="opencode"?null:"opencode"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"OpenCode"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>te("zed"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="zed"?null:"zed"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Zed"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>te("continue"),onMouseLeave:()=>te(null),onClick:()=>E(de=>de==="continue"?null:"continue"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Continue"})]}),g.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[g.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),g.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",i!=null&&i.heavy_threshold_chars?i.heavy_threshold_chars/1e3:"4","k Zeichen"]}),g.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),ZF.map(de=>{var Te;const J=["12%","31%","50%","69%","88%"],Ae=Be(de),re=Ae?x.includes(Ae.name):!1;if(de==="agent")return null;const Ue={fast:0,heavy:1,coder:2,vision:3,scout:4}[de];return g.jsxs("div",{className:tt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",re?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":Ae?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:J[Ue]},onClick:()=>ce(de),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:de}),re&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:Ae?(Te=Ae.name.split("/").pop())==null?void 0:Te.replace(".gguf",""):"Keine Zuweisung"})]},de)}),_&&s&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[_==="roocode"&&"Roo Code Setup",_==="cursor"&&"Cursor Setup",_==="opencode"&&"OpenCode Setup",_==="zed"&&"Zed Setup",_==="continue"&&"Continue Setup"]}),g.jsx("button",{onClick:()=>E(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[_==="roocode"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",g.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),g.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",g.jsx("strong",{children:"OpenAI Compatible"}),"."]}),g.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",g.jsx("code",{children:"settings.json"})," ein."]})]}),_==="cursor"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Öffne Cursor Settings ➔ ",g.jsx("strong",{children:"Models"}),"."]}),g.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",g.jsx("strong",{children:"OpenAI API"})," auf."]}),g.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",g.jsx("strong",{children:"auto"}),"."]})]}),_==="opencode"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Öffne die ",g.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),g.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",g.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),_==="zed"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Öffne die Zed Settings (",g.jsx("code",{children:"ctrl+,"}),")."]}),g.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",g.jsx("code",{children:"language_models"})," ein."]})]}),_==="continue"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),g.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",g.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),s.tools&&g.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[g.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[g.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),g.jsxs("button",{onClick:()=>{var de,J,Ae,re,Ue;return bt(_==="roocode"?(de=s.tools.cline)==null?void 0:de.snippet:_==="cursor"?(J=s.tools.cursor)==null?void 0:J.snippet:_==="opencode"?(Ae=s.tools.opencode)==null?void 0:Ae.snippet:_==="zed"?(re=s.tools.zed)==null?void 0:re.snippet:(Ue=s.tools.continue)==null?void 0:Ue.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[U?g.jsx(Go,{className:"h-3.5 w-3.5 text-emerald-400"}):g.jsx(ew,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:U?"Kopiert":"Kopieren"})]})]}),g.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:g.jsxs("code",{children:[_==="roocode"&&(($e=s.tools.cline)==null?void 0:$e.snippet),_==="cursor"&&((ut=s.tools.cursor)==null?void 0:ut.snippet),_==="opencode"&&((Dt=s.tools.opencode)==null?void 0:Dt.snippet),_==="zed"&&((Et=s.tools.zed)==null?void 0:Et.snippet),_==="continue"&&((mt=s.tools.continue)==null?void 0:mt.snippet)]})})]}),g.jsx("button",{onClick:()=>E(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),g.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),g.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),g.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),g.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[g.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),g.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(de=>{var re;const J=y.find(Ue=>Ue.role===de),Ae=J?x.includes(J.name):!1;return g.jsxs("div",{onClick:()=>ce(de),className:tt("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",Ae?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":J?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:tt("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",RP(de)),children:de}),Ae&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:J==null?void 0:J.name,children:J?(re=J.name.split("/").pop())==null?void 0:re.replace(/\.gguf$/i,""):"nicht zugewiesen"}),g.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},de)})})]}),(a==null?void 0:a.current)&&g.jsxs("div",{className:"rounded-2xl border border-indigo-500/30 bg-indigo-500/5 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[g.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Il,{className:"h-4.5 w-4.5 text-indigo-400"}),g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),a.current.version!=null&&g.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-indigo-500/15 text-indigo-300 border border-indigo-500/25",children:["v",a.current.version]})]}),g.jsx("button",{onClick:()=>k(!0),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",children:"Hirn wechseln"})]}),g.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl bg-background/30 border border-border/30 p-3.5",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:a.current.name,children:a.current.name.split("/").pop()}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[g.jsx("span",{children:a.current.params_b?`${a.current.params_b}B`:"—"}),g.jsx("span",{children:"•"}),g.jsx("span",{children:a.current.quant||"GGUF"}),g.jsx("span",{children:"•"}),g.jsx("span",{children:Bo(a.current.size_bytes||0)})]})]}),a.update_available&&a.recommended?g.jsxs("button",{onClick:()=>Xe(a.recommended.repo),className:tt("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",a.budget&&!a.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[g.jsx(xg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):g.jsxs("span",{className:"h-8 px-3 shrink-0 flex items-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/15 rounded-lg select-none",children:[g.jsx(Go,{className:"h-4 w-4"})," Neueste Generation"]})]}),a.update_available&&a.recommended&&g.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",g.jsx("span",{className:"font-mono font-bold",children:a.recommended.name.replace(/-GGUF$/i,"")}),"(v",a.recommended.version,", ",a.recommended.params_b,"B) — von NousResearch."]}),a.budget&&g.jsxs("div",{className:tt("text-[10px] flex items-start gap-1.5 leading-relaxed",a.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[g.jsx(rE,{className:"h-3 w-3 shrink-0 mt-0.5"}),g.jsxs("span",{children:["Always-On-Brain ~",a.budget.brain_gb," GB + größtes on-demand (~",a.budget.largest_ondemand_gb," GB) = ",(a.budget.brain_gb+a.budget.largest_ondemand_gb).toFixed(1)," / ",a.budget.gtt_gb," GB",a.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[g.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",q.length," von ",y.length,")"]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[g.jsx("button",{onClick:()=>B("all"),className:tt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",fe==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),g.jsx("button",{onClick:()=>B("in_use"),className:tt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",fe==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),g.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[g.jsx("button",{onClick:()=>oe("grid"),className:tt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",he==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),g.jsx("button",{onClick:()=>oe("list"),className:tt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",he==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),he==="grid"?g.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:q.length===0?g.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:fe==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):q.map(de=>{const J=x.includes(de.name),Ae=o==null?void 0:o.model_list.find(Ue=>Ue.role===de.role),re=PI(de.name);return g.jsxs("div",{className:tt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",J?"border-primary/45 shadow-primary/5":de.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[g.jsxs("div",{className:"space-y-3",children:[g.jsx("div",{className:"flex items-start justify-between gap-3",children:g.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[g.jsx("div",{className:tt("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",re.color),title:re.name,children:re.initial}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:de.name,children:de.name.split("/").pop()}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[g.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:de.quant||"GGUF"}),J&&g.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[g.jsx(sy,{className:"h-3 w-3 animate-pulse"})," Warm"]}),de.role&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:de.role}),de.prompt_cache&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),de.spec_active?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${de.spec_draft_model})`,children:"SPEC"}):de.spec_draft_model?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${de.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,de.parallel_slots>1&&g.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${de.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",de.parallel_slots]}),de.incomplete&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),g.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:g.jsx(k3,{caps:de.capabilities})})]}),g.jsxs("div",{className:"space-y-3 pt-1",children:[g.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[g.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[g.jsx(rE,{className:"h-3.5 w-3.5 text-primary/80"}),g.jsxs("div",{children:[g.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),g.jsx("div",{className:"text-foreground font-semibold",children:Bo(de.size_bytes)})]})]}),g.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[g.jsx(q8,{className:"h-3.5 w-3.5 text-primary/80"}),g.jsxs("div",{children:[g.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),g.jsx("div",{className:"text-foreground font-semibold",children:AI(de.ctx)})]})]})]}),Ae&&g.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[g.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),g.jsxs("span",{children:["Upgrade verfügbar: ",Ae.repo.split("/").pop()]})]}),g.jsxs("button",{onClick:()=>De(Ae.repo,de.role,de.quant||"Q4_K_M",de.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[g.jsx(xg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),g.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[g.jsx("button",{onClick:()=>J?Me(de.name):qe(de.name),disabled:de.incomplete&&!J,className:tt("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",de.incomplete&&!J?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":J?"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:J?"Entladen":"Laden"}),g.jsx("button",{onClick:()=>Q(de.name,de.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"}),g.jsxs("button",{onClick:()=>F(de),className:tt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",de.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":de.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[g.jsx(xh,{className:"h-3 w-3"})," Spec"]}),g.jsx("button",{onClick:()=>Ge(de.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:g.jsx(OT,{className:"h-3.5 w-3.5"})})]})]})]},de.name)})}):g.jsx("div",{className:"space-y-2",children:q.length===0?g.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:fe==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):q.map(de=>{const J=x.includes(de.name),Ae=PI(de.name);return g.jsxs("div",{className:tt("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",J?"border-primary/45":de.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[g.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g.jsx("div",{className:tt("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ae.color),title:Ae.name,children:Ae.initial}),g.jsxs("div",{className:"min-w-0 text-left",children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:de.name,children:de.name.split("/").pop()}),de.role&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:de.role}),de.prompt_cache&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),de.spec_active?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${de.spec_draft_model})`,children:"SPEC"}):de.spec_draft_model?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${de.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,de.parallel_slots>1&&g.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${de.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",de.parallel_slots]}),de.incomplete&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),J&&g.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[g.jsxs("span",{children:["Größe: ",Bo(de.size_bytes)]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Kontext: ",AI(de.ctx)]}),g.jsx("span",{children:"•"}),g.jsx("span",{className:"font-mono text-[9px]",children:de.quant||"GGUF"})]})]})]}),g.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[g.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:g.jsx(k3,{caps:de.capabilities})}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:()=>J?Me(de.name):qe(de.name),disabled:de.incomplete&&!J,className:tt("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",de.incomplete&&!J?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":J?"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:J?"Entladen":"Laden"}),g.jsx("button",{onClick:()=>Q(de.name,de.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"}),g.jsxs("button",{onClick:()=>F(de),className:tt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",de.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":de.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[g.jsx(xh,{className:"h-3 w-3"})," Spec"]}),g.jsx("button",{onClick:()=>Ge(de.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:g.jsx(OT,{className:"h-3.5 w-3.5"})})]})]})]},de.name)})})]}),T&&(()=>{var Ue,Te;const de=O&&O.role===T?O:null,J={};de==null||de.models.forEach(Oe=>{J[Oe.name]=Oe});const Ae=de?de.models.map(Oe=>y.find(Ye=>Ye.name===Oe.name)).filter(Boolean):y,re=Oe=>{Ke(T,Oe),C(null)};return g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",T,"' konfigurieren"]}),g.jsx("button",{onClick:()=>C(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",g.jsx("strong",{className:"text-foreground",children:T}),":"]}),(de==null?void 0:de.recommended)&&g.jsxs("button",{onClick:()=>re(de.recommended),title:(Ue=J[de.recommended])==null?void 0:Ue.reason,className:"shrink-0 h-7 px-3 text-[11px] font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg cursor-pointer flex items-center gap-1",children:[g.jsx(xh,{className:"h-3 w-3"})," Auto: ",(Te=de.recommended.split("/").pop())==null?void 0:Te.replace(/\.gguf$/i,"")]})]}),g.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[g.jsx("button",{onClick:()=>re(""),className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:g.jsx("span",{children:"Zuweisung entfernen"})}),Ae.map(Oe=>{var Cn;const Ye=J[Oe.name],ft=Oe.role===T,Yt=!!(Ye!=null&&Ye.recommended),un=!!Ye&&!Ye.suitable;return g.jsxs("button",{onClick:()=>re(Oe.name),className:tt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border",Yt?"border-primary/50 bg-primary/10":ft?"text-primary font-bold bg-primary/5 border-primary/30":un?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[g.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[g.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(Cn=Oe.name.split("/").pop())==null?void 0:Cn.replace(/\.gguf$/i,""),Yt&&g.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),g.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Ye?`${Ye.params_b}B · ${Oe.quant} · ${Ye.reason}`:`${Bo(Oe.size_bytes)} · ${Oe.quant}`})]}),ft&&g.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},Oe.name)})]})]})})})(),D&&g.jsx(Ife,{model:D,onClose:()=>F(null),onChanged:w}),V&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[g.jsx(Il,{className:"h-4 w-4"})," Agent-Hirn wechseln"]}),g.jsx("button",{onClick:()=>k(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Wähle ein ",g.jsx("strong",{className:"text-foreground",children:"installiertes"})," Modell als Agent-Hirn. Es bekommt den",g.jsx("code",{className:"text-primary",children:" hermes"}),'-Alias, wird warm gehalten (brains-Gruppe), und Hermes nutzt es nach einem kurzen Gateway-Restart. Neues Modell (z.B. Hermes-4.3 oder Gemma-4)? Erst über „Modelle finden" laden.']}),g.jsx("div",{className:"space-y-1.5 max-h-72 overflow-y-auto pr-1",children:y.map(de=>{var Ae;const J=de.role==="hermes";return g.jsxs("button",{onClick:()=>!J&&Je(de.name),disabled:J||de.incomplete,className:tt("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",J?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":de.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[g.jsxs("div",{className:"flex flex-col min-w-0",children:[g.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(Ae=de.name.split("/").pop())==null?void 0:Ae.replace(/\.gguf$/i,"")}),g.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[de.capabilities.params_b?`${de.capabilities.params_b}B`:"?"," · ",Bo(de.size_bytes),de.role&&` · Rolle: ${de.role}`,de.capabilities.tools!=="no"?" · Tools ✓":" · ohne Tools"]})]}),J?g.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[g.jsx(Go,{className:"h-3.5 w-3.5"})," Aktiv"]}):g.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Als Hirn setzen →"})]},de.name)})}),g.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[g.jsx("span",{children:"💡"}),g.jsxs("span",{children:["Für einen ",g.jsx("strong",{children:"Agenten"})," sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl als allgemeine Modelle."]})]})]})}),m]})}function Ofe(){const[t,e]=R.useState(""),[n,r]=R.useState([]),[i,s]=R.useState("Q4_K_M"),[o,a]=R.useState(""),[l,c]=R.useState(""),[d,f]=R.useState(""),[m,y]=R.useState([]),[x,S]=R.useState(null),[w,_]=R.useState(!1),E=["fast","heavy","coder","vision","scout"],{data:T}=qh(),C=l?T==null?void 0:T.models.find(H=>(H.role||"").toLowerCase()===l):void 0;async function O(H,ne,te){if(_(!1),!H.trim()){S(null);return}try{const he=await Ft(`/api/fit?params_b=0&quant=${encodeURIComponent(ne)}&ctx=8192&name=${encodeURIComponent(H)}&role=${encodeURIComponent(te)}`);S(he)}catch{S(null)}}async function N(H){const ne=H??t;if(ne.trim()){a("Analysiere HuggingFace Repository..."),S(null);try{const te=await Ft(`/api/hf/quants?repo=${encodeURIComponent(ne)}`);e(te.repo),r(te.quants);const he=te.quants.length?te.quants.includes("Q4_K_M")?"Q4_K_M":te.quants[0]:i;te.quants.length&&s(he),a(te.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden."),te.quants.length&&O(te.repo,he,l)}catch(te){a(`Fehler: ${te}`)}}}function D(H){s(H),O(t,H,l)}function F(H){c(H),n.length&&O(t,i,H)}async function V(){if(d.trim()){a("Durchsuche HuggingFace...");try{const H=await Ft(`/api/hf/search?q=${encodeURIComponent(d)}`);y(H.results),a(H.results.length?"":"Keine Ergebnisse gefunden.")}catch(H){a(`Suche fehlgeschlagen: ${H}`)}}}async function k(){if(t.trim()){if((x==null?void 0:x.fit.level)==="too_tight"&&!w){_(!0);return}a("Download-Job wird initiiert...");try{await Ft("/api/models/install",{method:"POST",body:JSON.stringify({repo:t,quant:i,role:l||void 0,jinja:!0})}),_(!1),a(`Download gestartet: ${t} (${i})${l?`, Rolle: ${l}`:""}. Fortschritt oben.`+(C?` „${l}" wurde von ${C.name} übernommen.`:"")+(l==="fast"||l==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(H){a(`Download-Fehler: ${H}`)}}}const U=(x==null?void 0:x.fit.level)==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":(x==null?void 0:x.fit.level)==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return g.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[g.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),g.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[g.jsx("input",{value:t,onChange:H=>{e(H.target.value),S(null),_(!1)},placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("button",{onClick:()=>N(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),n.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("select",{value:i,onChange:H=>D(H.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:n.map(H=>g.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))}),g.jsxs("select",{value:l,onChange:H=>F(H.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[g.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),E.map(H=>g.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))]}),g.jsx("button",{onClick:k,className:`h-9 px-4 rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5 ${w?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"}`,children:w?g.jsxs(g.Fragment,{children:[g.jsx(_g,{className:"h-3.5 w-3.5"})," OOM-Risiko — trotzdem laden"]}):g.jsxs(g.Fragment,{children:[g.jsx(xg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]})]})]}),x&&g.jsxs("div",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium ${U}`,children:[g.jsx("span",{className:"font-bold uppercase tracking-wide",children:x.fit.text}),g.jsxs("span",{className:"font-mono opacity-90",children:["~",x.params_b,"B · ~",x.fit.req_gb," GB / ",x.sys_ram_gb," GB RAM · ~",x.fit.tps," t/s"]}),x.fit.level!=="too_tight"&&g.jsxs("span",{className:"font-mono opacity-80",title:`Setup-bewusst: GTT ${x.budget.gtt_gb} GB − reserviert ${x.budget.reserved_gb} GB (${x.budget.mode}) → ${x.budget.budget_gb} GB frei`,children:["ctx → ",(x.assigned_ctx/1024).toFixed(0),"k"]}),x.fit.level==="too_tight"&&g.jsx("span",{className:"opacity-90",children:"— passt nicht in den Speicher, würde beim Laden abstürzen (OOM)."})]}),C&&g.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] font-medium text-amber-400",children:[g.jsx(_g,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),g.jsxs("span",{children:["Rolle ",g.jsxs("strong",{children:["„",l,'"']})," ist aktuell ",g.jsx("strong",{children:C.name})," zugewiesen. Beim Download übernimmt das neue Modell diese Rolle — ",C.name," bleibt installiert, verliert sie aber."]})]}),g.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[g.jsxs("div",{className:"relative flex-1",children:[g.jsx("input",{value:d,onChange:H=>f(H.target.value),onKeyDown:H=>H.key==="Enter"&&V(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),g.jsx(_P,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),g.jsx("button",{onClick:V,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),m.length>0&&g.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:m.map(H=>g.jsxs("button",{onClick:()=>{e(H.repo),y([]),f(""),N(H.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[g.jsx("span",{className:"font-semibold truncate",children:H.repo}),g.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[g.jsx(xg,{className:"h-3 w-3"})," ",H.downloads.toLocaleString()]})]},H.repo))}),o&&g.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:o})]})}const Lfe={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:xh},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:G1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:oF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:NT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:RT}};function Dfe(){const{data:t,isLoading:e,error:n}=y7(),{data:r}=qh(),{data:i}=CP(),s=(r==null?void 0:r.models)??[],o=n?String(n):"",[a,l]=R.useState({}),[c,d]=R.useState({}),[f,m]=R.useState(!1);async function y(x,S,w,_){l(E=>({...E,[x]:"Starte..."}));try{await Ft("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:w,jinja:_})}),l(E=>({...E,[x]:"Download läuft"}))}catch{l(T=>({...T,[x]:"Fehler"}))}}return e?g.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):o||!t?g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",o,")."]}):g.jsxs("div",{className:"space-y-8",children:[g.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[g.jsxs("div",{children:["Modell-Registry geladen für ",g.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(n9,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),g.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),g.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(x=>{const S=Lfe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:W1},w=S.icon,_=s.find(D=>D.role===x.role),E=i==null?void 0:i.model_list.find(D=>D.role===x.role),T=x.models.find(D=>D.repo===x.recommended)||x.models[0];if(!T)return null;const C=a[T.repo],O=x.models.filter(D=>D.repo!==x.recommended),N=!!c[x.role];return g.jsxs("div",{className:tt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",_?"border-border/60":"border-primary/20 shadow-primary/5"),children:[g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:g.jsx(w,{className:"h-5.5 w-5.5"})}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),g.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",x.role]})]})]}),_?g.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):g.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),g.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),g.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:_?g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),g.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:_.name,children:_.name.split("/").pop()}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[g.jsxs("span",{children:["Größe: ",HT(_.size_bytes||0)]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Quant: ",_.quant||"GGUF"]})]})]}):g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),g.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[g.jsxs("span",{children:["Ersteller: ",T.author]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Quant: ",T.quant]})]}),g.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:g.jsx(tX,{fit:T.fit})})]})}),g.jsx("div",{className:"pt-1",children:_?E?g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),g.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),g.jsxs("button",{onClick:()=>y(E.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[E.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[g.jsx(xg,{className:"h-3.5 w-3.5"}),a[E.repo]||"Auf neue Version aktualisieren"]})]}):g.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[g.jsx(Go,{className:"h-4 w-4"})," Auf neuestem Stand"]}):g.jsxs("button",{onClick:()=>y(T.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!C,className:tt("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",C?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[g.jsx(xg,{className:"h-3.5 w-3.5"}),C||"Optimales Modell einsetzen"]})})]}),O.length>0&&g.jsxs("div",{className:"border-t border-border/20 pt-3",children:[g.jsxs("button",{onClick:()=>d(D=>({...D,[x.role]:!N})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[N?g.jsx(S8,{className:"h-3 w-3"}):g.jsx(_8,{className:"h-3 w-3"}),g.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&g.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(D=>g.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),g.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[g.jsxs("span",{children:["Quant: ",D.quant]}),g.jsx("span",{children:"•"}),g.jsx("span",{children:D.fit.text})]})]}),g.jsx("button",{onClick:()=>y(D.repo,x.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!a[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:a[D.repo]||"Installieren"})]},D.repo))})]})]},x.role)})}),g.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[g.jsxs("button",{onClick:()=>m(!f),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(_P,{className:"h-4 w-4 text-primary"}),g.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),g.jsx("span",{className:"text-[10px] text-primary hover:underline",children:f?"Ausblenden ▲":"Anzeigen ▼"})]}),f&&g.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:g.jsx(Ofe,{})})]})]})}function jfe(){const[t,e]=R.useState("cockpit");return g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),g.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),g.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(n=>g.jsx("button",{onClick:()=>e(n),className:tt("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===n?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:n==="cockpit"?"Cockpit":"Modelle finden"},n))})]}),g.jsx(Nfe,{}),g.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?g.jsx(kfe,{}):g.jsx(Dfe,{})})]})}const Ufe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function O3({line:t,loading:e}){return e||!t?g.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[g.jsx(bP,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?g.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[g.jsx(M8,{className:"h-3 w-3"})," ",t.detail]}):g.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[g.jsx(A8,{className:"h-3 w-3"})," ",t.detail]})}function L3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return g.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[g.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),g.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),g.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),g.jsx("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:g.jsx("span",{children:e})}),g.jsxs("button",{onClick:i,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[r?g.jsx(Go,{className:"h-3.5 w-3.5 text-emerald-400"}):g.jsx(ew,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),g.jsx("pre",{className:tt("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",n==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:g.jsx("code",{children:t.snippet})})]})}function Ffe(){const[t,e]=R.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[n,r]=R.useState(localStorage.getItem("mc_mcp_path")||""),[i,s]=R.useState("cline"),[o,a]=R.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=GF(l.toString()),{data:f,isLoading:m}=b7(),y=d?String(d):"";function x(E){e(E),E&&localStorage.setItem("mc_host",E)}function S(E){r(E),localStorage.setItem("mc_mcp_path",E)}const w=c==null?void 0:c.tools[i];async function _(E,T){T&&(await navigator.clipboard.writeText(T),a(E),setTimeout(()=>a(null),1500))}return g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",g.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),g.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[g.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[g.jsx(j8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),g.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),g.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),g.jsxs("div",{className:"flex flex-col gap-2.5",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(J_,{className:"h-4 w-4 text-muted-foreground shrink-0"}),g.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[g.jsx(El,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),g.jsx(O3,{line:f==null?void 0:f.gateway,loading:m})]}),g.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · model auto"})]})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(J_,{className:"h-4 w-4 text-muted-foreground shrink-0"}),g.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[g.jsx(G1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),g.jsx(O3,{line:f==null?void 0:f.memory,loading:m})]}),g.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),g.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",g.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",g.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),g.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[g.jsx(L8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),g.jsx("input",{value:t,onChange:E=>x(E.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[g.jsx(I8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",g.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),g.jsx("input",{value:n,onChange:E=>S(E.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),y&&g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",y]}),c&&g.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[g.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[g.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),g.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),g.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([E,T])=>g.jsx("button",{onClick:()=>s(E),className:tt("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===E?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},E))}),w&&g.jsxs(g.Fragment,{children:[w.note&&g.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[g.jsx(aI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),g.jsx("span",{children:w.note})]}),g.jsx(L3,{tool:w,fileName:Ufe[i]||"config.json",accent:"teal",copied:o==="model",onCopy:()=>_("model",w.snippet)})]})]}),g.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[g.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",g.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),g.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",g.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),g.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[g.jsx(aI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),g.jsx("span",{children:c.memory.note})]}),g.jsx(L3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>_("memory",c.memory.snippet)})]})]})]})}const zfe="modulepreload",Bfe=function(t){return"/"+t},D3={},Hfe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=Bfe(c),c in D3)return;D3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":zfe,d||(m.as="script"),m.crossOrigin="",m.href=c,l&&m.setAttribute("nonce",l),document.head.appendChild(m),d)return new Promise((y,x)=>{m.addEventListener("load",y),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};class Vfe extends R.Component{constructor(){super(...arguments);Gs(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?g.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[g.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),g.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const Gfe=R.lazy(()=>Hfe(()=>import("./GraphView-VftfPdeY.js"),[]).then(t=>({default:t.GraphView}))),j3=["identity","knowledge","rules","events"],U3=new Set(["auto","agent","hermes"]),XE={identity:{label:"Identität",icon:r9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:Zm,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:Q8,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:T8,bg:"bg-amber-500/10",text:"text-amber-400"}},F3={label:"Gedächtnis",icon:CT,bg:"bg-muted/10",text:"text-muted-foreground"},Wfe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},z3=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: + `}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[g.jsxs("div",{className:"flex justify-between items-center",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(iE,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",Bo(ee)," Gewichte",Ee>0?` · ${Bo(Ee)} real belegt (inkl. KV)`:""," / ",Bo(Ve)]}),x.length>0&&g.jsx("button",{onClick:$e,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),g.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:ut.length===0?g.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):ut.map((ue,Q)=>{var Fe;const Ae=(ue.size_bytes||0)/Ve*100,re=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][Q%4];return g.jsxs("div",{style:{width:`${Ae}%`},className:nt("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",re),title:`${ue.name} (${Bo(ue.size_bytes)})`,children:[g.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[ue.role?`[${ue.role}] `:"",(Fe=ue.name.split("/").pop())==null?void 0:Fe.replace(".gguf","")]}),g.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Bo(ue.size_bytes)})]},ue.name)})})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[g.jsxs("div",{children:[g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),g.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),g.jsxs("div",{ref:pe,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[g.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[g.jsxs("defs",{children:[g.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),g.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),g.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),g.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),g.jsx("path",{d:be(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="roocode"||_==="roocode")&&g.jsx("path",{d:be(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:be(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="cursor"||_==="cursor")&&g.jsx("path",{d:be(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:be(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="opencode"||_==="opencode")&&g.jsx("path",{d:be(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:be(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="zed"||_==="zed")&&g.jsx("path",{d:be(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:be(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="continue"||_==="continue")&&g.jsx("path",{d:be(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Se(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),mt("fast")&&g.jsx("path",{d:Se(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Se(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),mt("heavy")&&g.jsx("path",{d:Se(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Se(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),mt("coder")&&g.jsx("path",{d:Se(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Se(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),mt("vision")&&g.jsx("path",{d:Se(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:Se(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),mt("scout")&&g.jsx("path",{d:Se(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>te("roocode"),onMouseLeave:()=>te(null),onClick:()=>E(ue=>ue==="roocode"?null:"roocode"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Roo Code"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>te("cursor"),onMouseLeave:()=>te(null),onClick:()=>E(ue=>ue==="cursor"?null:"cursor"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Cursor IDE"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>te("opencode"),onMouseLeave:()=>te(null),onClick:()=>E(ue=>ue==="opencode"?null:"opencode"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"OpenCode"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>te("zed"),onMouseLeave:()=>te(null),onClick:()=>E(ue=>ue==="zed"?null:"zed"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Zed"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>te("continue"),onMouseLeave:()=>te(null),onClick:()=>E(ue=>ue==="continue"?null:"continue"),children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),g.jsx("span",{children:"Continue"})]}),g.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[g.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),g.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",i!=null&&i.heavy_threshold_chars?i.heavy_threshold_chars/1e3:"4","k Zeichen"]}),g.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),QF.map(ue=>{var Te;const Q=["12%","31%","50%","69%","88%"],Ae=He(ue),re=Ae?x.includes(Ae.name):!1;if(ue==="agent")return null;const Fe={fast:0,heavy:1,coder:2,vision:3,scout:4}[ue];return g.jsxs("div",{className:nt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",re?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":Ae?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:Q[Fe]},onClick:()=>ce(ue),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:ue}),re&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:Ae?(Te=Ae.name.split("/").pop())==null?void 0:Te.replace(".gguf",""):"Keine Zuweisung"})]},ue)}),_&&s&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[_==="roocode"&&"Roo Code Setup",_==="cursor"&&"Cursor Setup",_==="opencode"&&"OpenCode Setup",_==="zed"&&"Zed Setup",_==="continue"&&"Continue Setup"]}),g.jsx("button",{onClick:()=>E(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[_==="roocode"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",g.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),g.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",g.jsx("strong",{children:"OpenAI Compatible"}),"."]}),g.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",g.jsx("code",{children:"settings.json"})," ein."]})]}),_==="cursor"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Öffne Cursor Settings ➔ ",g.jsx("strong",{children:"Models"}),"."]}),g.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",g.jsx("strong",{children:"OpenAI API"})," auf."]}),g.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",g.jsx("strong",{children:"auto"}),"."]})]}),_==="opencode"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Öffne die ",g.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),g.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",g.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),_==="zed"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsxs("li",{children:["Öffne die Zed Settings (",g.jsx("code",{children:"ctrl+,"}),")."]}),g.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",g.jsx("code",{children:"language_models"})," ein."]})]}),_==="continue"&&g.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[g.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),g.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",g.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),s.tools&&g.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[g.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[g.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),g.jsxs("button",{onClick:()=>{var ue,Q,Ae,re,Fe;return bt(_==="roocode"?(ue=s.tools.cline)==null?void 0:ue.snippet:_==="cursor"?(Q=s.tools.cursor)==null?void 0:Q.snippet:_==="opencode"?(Ae=s.tools.opencode)==null?void 0:Ae.snippet:_==="zed"?(re=s.tools.zed)==null?void 0:re.snippet:(Fe=s.tools.continue)==null?void 0:Fe.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[U?g.jsx(Go,{className:"h-3.5 w-3.5 text-emerald-400"}):g.jsx(tw,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:U?"Kopiert":"Kopieren"})]})]}),g.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:g.jsxs("code",{children:[_==="roocode"&&((Ne=s.tools.cline)==null?void 0:Ne.snippet),_==="cursor"&&((tt=s.tools.cursor)==null?void 0:tt.snippet),_==="opencode"&&((jt=s.tools.opencode)==null?void 0:jt.snippet),_==="zed"&&((Lt=s.tools.zed)==null?void 0:Lt.snippet),_==="continue"&&((ct=s.tools.continue)==null?void 0:ct.snippet)]})})]}),g.jsx("button",{onClick:()=>E(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),g.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),g.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),g.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),g.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[g.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),g.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(ue=>{var re;const Q=y.find(Fe=>Fe.role===ue),Ae=Q?x.includes(Q.name):!1;return g.jsxs("div",{onClick:()=>ce(ue),className:nt("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]",Ae?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":Q?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:nt("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",NP(ue)),children:ue}),Ae&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:Q==null?void 0:Q.name,children:Q?(re=Q.name.split("/").pop())==null?void 0:re.replace(/\.gguf$/i,""):"nicht zugewiesen"}),g.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},ue)})})]}),(a==null?void 0:a.current)&&g.jsxs("div",{className:"rounded-2xl border border-indigo-500/30 bg-indigo-500/5 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[g.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Il,{className:"h-4.5 w-4.5 text-indigo-400"}),g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),a.current.version!=null&&g.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-indigo-500/15 text-indigo-300 border border-indigo-500/25",children:["v",a.current.version]})]}),g.jsx("button",{onClick:()=>k(!0),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",children:"Hirn wechseln"})]}),g.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl bg-background/30 border border-border/30 p-3.5",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:a.current.name,children:a.current.name.split("/").pop()}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[g.jsx("span",{children:a.current.params_b?`${a.current.params_b}B`:"—"}),g.jsx("span",{children:"•"}),g.jsx("span",{children:a.current.quant||"GGUF"}),g.jsx("span",{children:"•"}),g.jsx("span",{children:Bo(a.current.size_bytes||0)})]})]}),a.update_available&&a.recommended?g.jsxs("button",{onClick:()=>Xe(a.recommended.repo),className:nt("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",a.budget&&!a.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[g.jsx(xg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):g.jsxs("span",{className:"h-8 px-3 shrink-0 flex items-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/15 rounded-lg select-none",children:[g.jsx(Go,{className:"h-4 w-4"})," Neueste Generation"]})]}),a.update_available&&a.recommended&&g.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",g.jsx("span",{className:"font-mono font-bold",children:a.recommended.name.replace(/-GGUF$/i,"")}),"(v",a.recommended.version,", ",a.recommended.params_b,"B) — von NousResearch."]}),a.budget&&g.jsxs("div",{className:nt("text-[10px] flex items-start gap-1.5 leading-relaxed",a.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[g.jsx(iE,{className:"h-3 w-3 shrink-0 mt-0.5"}),g.jsxs("span",{children:["Always-On-Brain ~",a.budget.brain_gb," GB + größtes on-demand (~",a.budget.largest_ondemand_gb," GB) = ",(a.budget.brain_gb+a.budget.largest_ondemand_gb).toFixed(1)," / ",a.budget.gtt_gb," GB",a.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[g.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",J.length," von ",y.length,")"]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[g.jsx("button",{onClick:()=>B("all"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",fe==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),g.jsx("button",{onClick:()=>B("in_use"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",fe==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),g.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[g.jsx("button",{onClick:()=>se("grid"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",he==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),g.jsx("button",{onClick:()=>se("list"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",he==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),he==="grid"?g.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:J.length===0?g.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:fe==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):J.map(ue=>{const Q=x.includes(ue.name),Ae=o==null?void 0:o.model_list.find(Fe=>Fe.role===ue.role),re=NI(ue.name);return g.jsxs("div",{className:nt("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",Q?"border-primary/45 shadow-primary/5":ue.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[g.jsxs("div",{className:"space-y-3",children:[g.jsx("div",{className:"flex items-start justify-between gap-3",children:g.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[g.jsx("div",{className:nt("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",re.color),title:re.name,children:re.initial}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:ue.name,children:ue.name.split("/").pop()}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[g.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:ue.quant||"GGUF"}),Q&&g.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[g.jsx(ay,{className:"h-3 w-3 animate-pulse"})," Warm"]}),ue.role&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:ue.role}),ue.prompt_cache&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),ue.spec_active?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${ue.spec_draft_model})`,children:"SPEC"}):ue.spec_draft_model?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${ue.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,ue.parallel_slots>1&&g.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${ue.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ue.parallel_slots]}),ue.incomplete&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),g.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:g.jsx(L3,{caps:ue.capabilities})})]}),g.jsxs("div",{className:"space-y-3 pt-1",children:[g.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[g.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[g.jsx(iE,{className:"h-3.5 w-3.5 text-primary/80"}),g.jsxs("div",{children:[g.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),g.jsx("div",{className:"text-foreground font-semibold",children:Bo(ue.size_bytes)})]})]}),g.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[g.jsx(K8,{className:"h-3.5 w-3.5 text-primary/80"}),g.jsxs("div",{children:[g.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),g.jsx("div",{className:"text-foreground font-semibold",children:CI(ue.ctx)})]})]})]}),Ae&&g.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[g.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),g.jsxs("span",{children:["Upgrade verfügbar: ",Ae.repo.split("/").pop()]})]}),g.jsxs("button",{onClick:()=>je(Ae.repo,ue.role,ue.quant||"Q4_K_M",ue.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[g.jsx(xg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),g.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[g.jsx("button",{onClick:()=>Q?Me(ue.name):qe(ue.name),disabled:ue.incomplete&&!Q,className:nt("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",ue.incomplete&&!Q?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":Q?"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:Q?"Entladen":"Laden"}),g.jsx("button",{onClick:()=>Z(ue.name,ue.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"}),g.jsxs("button",{onClick:()=>F(ue),className:nt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",ue.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":ue.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[g.jsx(xh,{className:"h-3 w-3"})," Spec"]}),g.jsx("button",{onClick:()=>We(ue.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:g.jsx(LT,{className:"h-3.5 w-3.5"})})]})]})]},ue.name)})}):g.jsx("div",{className:"space-y-2",children:J.length===0?g.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:fe==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):J.map(ue=>{const Q=x.includes(ue.name),Ae=NI(ue.name);return g.jsxs("div",{className:nt("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",Q?"border-primary/45":ue.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[g.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[g.jsx("div",{className:nt("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ae.color),title:Ae.name,children:Ae.initial}),g.jsxs("div",{className:"min-w-0 text-left",children:[g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:ue.name,children:ue.name.split("/").pop()}),ue.role&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:ue.role}),ue.prompt_cache&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),ue.spec_active?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${ue.spec_draft_model})`,children:"SPEC"}):ue.spec_draft_model?g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${ue.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,ue.parallel_slots>1&&g.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${ue.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ue.parallel_slots]}),ue.incomplete&&g.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),Q&&g.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[g.jsxs("span",{children:["Größe: ",Bo(ue.size_bytes)]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Kontext: ",CI(ue.ctx)]}),g.jsx("span",{children:"•"}),g.jsx("span",{className:"font-mono text-[9px]",children:ue.quant||"GGUF"})]})]})]}),g.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[g.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:g.jsx(L3,{caps:ue.capabilities})}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("button",{onClick:()=>Q?Me(ue.name):qe(ue.name),disabled:ue.incomplete&&!Q,className:nt("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",ue.incomplete&&!Q?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":Q?"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:Q?"Entladen":"Laden"}),g.jsx("button",{onClick:()=>Z(ue.name,ue.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"}),g.jsxs("button",{onClick:()=>F(ue),className:nt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",ue.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":ue.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[g.jsx(xh,{className:"h-3 w-3"})," Spec"]}),g.jsx("button",{onClick:()=>We(ue.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:g.jsx(LT,{className:"h-3.5 w-3.5"})})]})]})]},ue.name)})})]}),T&&(()=>{var Fe,Te;const ue=O&&O.role===T?O:null,Q={};ue==null||ue.models.forEach(Le=>{Q[Le.name]=Le});const Ae=ue?ue.models.map(Le=>y.find(Ye=>Ye.name===Le.name)).filter(Boolean):y,re=Le=>{Ke(T,Le),C(null)};return g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",T,"' konfigurieren"]}),g.jsx("button",{onClick:()=>C(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",g.jsx("strong",{className:"text-foreground",children:T}),":"]}),(ue==null?void 0:ue.recommended)&&g.jsxs("button",{onClick:()=>re(ue.recommended),title:(Fe=Q[ue.recommended])==null?void 0:Fe.reason,className:"shrink-0 h-7 px-3 text-[11px] font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg cursor-pointer flex items-center gap-1",children:[g.jsx(xh,{className:"h-3 w-3"})," Auto: ",(Te=ue.recommended.split("/").pop())==null?void 0:Te.replace(/\.gguf$/i,"")]})]}),g.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[g.jsx("button",{onClick:()=>re(""),className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:g.jsx("span",{children:"Zuweisung entfernen"})}),Ae.map(Le=>{var Cn;const Ye=Q[Le.name],ht=Le.role===T,Yt=!!(Ye!=null&&Ye.recommended),un=!!Ye&&!Ye.suitable;return g.jsxs("button",{onClick:()=>re(Le.name),className:nt("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",Yt?"border-primary/50 bg-primary/10":ht?"text-primary font-bold bg-primary/5 border-primary/30":un?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[g.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[g.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(Cn=Le.name.split("/").pop())==null?void 0:Cn.replace(/\.gguf$/i,""),Yt&&g.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),g.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Ye?`${Ye.params_b}B · ${Le.quant} · ${Ye.reason}`:`${Bo(Le.size_bytes)} · ${Le.quant}`})]}),ht&&g.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},Le.name)})]})]})})})(),D&&g.jsx(kfe,{model:D,onClose:()=>F(null),onChanged:w}),G&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[g.jsx(Il,{className:"h-4 w-4"})," Agent-Hirn wechseln"]}),g.jsx("button",{onClick:()=>k(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Wähle ein ",g.jsx("strong",{className:"text-foreground",children:"installiertes"})," Modell als Agent-Hirn. Es bekommt den",g.jsx("code",{className:"text-primary",children:" hermes"}),'-Alias, wird warm gehalten (brains-Gruppe), und Hermes nutzt es nach einem kurzen Gateway-Restart. Neues Modell (z.B. Hermes-4.3 oder Gemma-4)? Erst über „Modelle finden" laden.']}),g.jsx("div",{className:"space-y-1.5 max-h-72 overflow-y-auto pr-1",children:y.map(ue=>{var Ae;const Q=ue.role==="hermes";return g.jsxs("button",{onClick:()=>!Q&&Je(ue.name),disabled:Q||ue.incomplete,className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",Q?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":ue.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[g.jsxs("div",{className:"flex flex-col min-w-0",children:[g.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(Ae=ue.name.split("/").pop())==null?void 0:Ae.replace(/\.gguf$/i,"")}),g.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[ue.capabilities.params_b?`${ue.capabilities.params_b}B`:"?"," · ",Bo(ue.size_bytes),ue.role&&` · Rolle: ${ue.role}`,ue.capabilities.tools!=="no"?" · Tools ✓":" · ohne Tools"]})]}),Q?g.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[g.jsx(Go,{className:"h-3.5 w-3.5"})," Aktiv"]}):g.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Als Hirn setzen →"})]},ue.name)})}),g.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[g.jsx("span",{children:"💡"}),g.jsxs("span",{children:["Für einen ",g.jsx("strong",{children:"Agenten"})," sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl als allgemeine Modelle."]})]})]})}),m]})}function Lfe(){const[t,e]=R.useState(""),[n,r]=R.useState([]),[i,s]=R.useState("Q4_K_M"),[o,a]=R.useState(""),[l,c]=R.useState(""),[d,f]=R.useState(""),[m,y]=R.useState([]),[x,S]=R.useState(null),[w,_]=R.useState(!1),E=["fast","heavy","coder","vision","scout"],{data:T}=qh(),C=l?T==null?void 0:T.models.find(H=>(H.role||"").toLowerCase()===l):void 0;async function O(H,ne,te){if(_(!1),!H.trim()){S(null);return}try{const he=await Ft(`/api/fit?params_b=0&quant=${encodeURIComponent(ne)}&ctx=8192&name=${encodeURIComponent(H)}&role=${encodeURIComponent(te)}`);S(he)}catch{S(null)}}async function N(H){const ne=H??t;if(ne.trim()){a("Analysiere HuggingFace Repository..."),S(null);try{const te=await Ft(`/api/hf/quants?repo=${encodeURIComponent(ne)}`);e(te.repo),r(te.quants);const he=te.quants.length?te.quants.includes("Q4_K_M")?"Q4_K_M":te.quants[0]:i;te.quants.length&&s(he),a(te.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden."),te.quants.length&&O(te.repo,he,l)}catch(te){a(`Fehler: ${te}`)}}}function D(H){s(H),O(t,H,l)}function F(H){c(H),n.length&&O(t,i,H)}async function G(){if(d.trim()){a("Durchsuche HuggingFace...");try{const H=await Ft(`/api/hf/search?q=${encodeURIComponent(d)}`);y(H.results),a(H.results.length?"":"Keine Ergebnisse gefunden.")}catch(H){a(`Suche fehlgeschlagen: ${H}`)}}}async function k(){if(t.trim()){if((x==null?void 0:x.fit.level)==="too_tight"&&!w){_(!0);return}a("Download-Job wird initiiert...");try{await Ft("/api/models/install",{method:"POST",body:JSON.stringify({repo:t,quant:i,role:l||void 0,jinja:!0})}),_(!1),a(`Download gestartet: ${t} (${i})${l?`, Rolle: ${l}`:""}. Fortschritt oben.`+(C?` „${l}" wurde von ${C.name} übernommen.`:"")+(l==="fast"||l==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(H){a(`Download-Fehler: ${H}`)}}}const U=(x==null?void 0:x.fit.level)==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":(x==null?void 0:x.fit.level)==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return g.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[g.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),g.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[g.jsx("input",{value:t,onChange:H=>{e(H.target.value),S(null),_(!1)},placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),g.jsxs("div",{className:"flex gap-2",children:[g.jsx("button",{onClick:()=>N(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),n.length>0&&g.jsxs(g.Fragment,{children:[g.jsx("select",{value:i,onChange:H=>D(H.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:n.map(H=>g.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))}),g.jsxs("select",{value:l,onChange:H=>F(H.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[g.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),E.map(H=>g.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))]}),g.jsx("button",{onClick:k,className:`h-9 px-4 rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5 ${w?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"}`,children:w?g.jsxs(g.Fragment,{children:[g.jsx(_g,{className:"h-3.5 w-3.5"})," OOM-Risiko — trotzdem laden"]}):g.jsxs(g.Fragment,{children:[g.jsx(xg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]})]})]}),x&&g.jsxs("div",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium ${U}`,children:[g.jsx("span",{className:"font-bold uppercase tracking-wide",children:x.fit.text}),g.jsxs("span",{className:"font-mono opacity-90",children:["~",x.params_b,"B · ~",x.fit.req_gb," GB / ",x.sys_ram_gb," GB RAM · ~",x.fit.tps," t/s"]}),x.fit.level!=="too_tight"&&g.jsxs("span",{className:"font-mono opacity-80",title:`Setup-bewusst: GTT ${x.budget.gtt_gb} GB − reserviert ${x.budget.reserved_gb} GB (${x.budget.mode}) → ${x.budget.budget_gb} GB frei`,children:["ctx → ",(x.assigned_ctx/1024).toFixed(0),"k"]}),x.fit.level==="too_tight"&&g.jsx("span",{className:"opacity-90",children:"— passt nicht in den Speicher, würde beim Laden abstürzen (OOM)."})]}),C&&g.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] font-medium text-amber-400",children:[g.jsx(_g,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),g.jsxs("span",{children:["Rolle ",g.jsxs("strong",{children:["„",l,'"']})," ist aktuell ",g.jsx("strong",{children:C.name})," zugewiesen. Beim Download übernimmt das neue Modell diese Rolle — ",C.name," bleibt installiert, verliert sie aber."]})]}),g.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[g.jsxs("div",{className:"relative flex-1",children:[g.jsx("input",{value:d,onChange:H=>f(H.target.value),onKeyDown:H=>H.key==="Enter"&&G(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),g.jsx(wP,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),g.jsx("button",{onClick:G,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),m.length>0&&g.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:m.map(H=>g.jsxs("button",{onClick:()=>{e(H.repo),y([]),f(""),N(H.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[g.jsx("span",{className:"font-semibold truncate",children:H.repo}),g.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[g.jsx(xg,{className:"h-3 w-3"})," ",H.downloads.toLocaleString()]})]},H.repo))}),o&&g.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:o})]})}const Dfe={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:xh},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:W1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:aF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:IT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:NT}};function jfe(){const{data:t,isLoading:e,error:n}=x7(),{data:r}=qh(),{data:i}=PP(),s=(r==null?void 0:r.models)??[],o=n?String(n):"",[a,l]=R.useState({}),[c,d]=R.useState({}),[f,m]=R.useState(!1);async function y(x,S,w,_){l(E=>({...E,[x]:"Starte..."}));try{await Ft("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:w,jinja:_})}),l(E=>({...E,[x]:"Download läuft"}))}catch{l(T=>({...T,[x]:"Fehler"}))}}return e?g.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):o||!t?g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",o,")."]}):g.jsxs("div",{className:"space-y-8",children:[g.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[g.jsxs("div",{children:["Modell-Registry geladen für ",g.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx(r9,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),g.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),g.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(x=>{const S=Dfe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:$1},w=S.icon,_=s.find(D=>D.role===x.role),E=i==null?void 0:i.model_list.find(D=>D.role===x.role),T=x.models.find(D=>D.repo===x.recommended)||x.models[0];if(!T)return null;const C=a[T.repo],O=x.models.filter(D=>D.repo!==x.recommended),N=!!c[x.role];return g.jsxs("div",{className:nt("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",_?"border-border/60":"border-primary/20 shadow-primary/5"),children:[g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:g.jsx(w,{className:"h-5.5 w-5.5"})}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),g.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",x.role]})]})]}),_?g.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):g.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),g.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),g.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:_?g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),g.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:_.name,children:_.name.split("/").pop()}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[g.jsxs("span",{children:["Größe: ",VT(_.size_bytes||0)]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Quant: ",_.quant||"GGUF"]})]})]}):g.jsxs("div",{className:"space-y-1.5",children:[g.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),g.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),g.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[g.jsxs("span",{children:["Ersteller: ",T.author]}),g.jsx("span",{children:"•"}),g.jsxs("span",{children:["Quant: ",T.quant]})]}),g.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:g.jsx(nX,{fit:T.fit})})]})}),g.jsx("div",{className:"pt-1",children:_?E?g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[g.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),g.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),g.jsxs("button",{onClick:()=>y(E.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[E.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[g.jsx(xg,{className:"h-3.5 w-3.5"}),a[E.repo]||"Auf neue Version aktualisieren"]})]}):g.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[g.jsx(Go,{className:"h-4 w-4"})," Auf neuestem Stand"]}):g.jsxs("button",{onClick:()=>y(T.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!C,className:nt("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",C?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[g.jsx(xg,{className:"h-3.5 w-3.5"}),C||"Optimales Modell einsetzen"]})})]}),O.length>0&&g.jsxs("div",{className:"border-t border-border/20 pt-3",children:[g.jsxs("button",{onClick:()=>d(D=>({...D,[x.role]:!N})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[N?g.jsx(M8,{className:"h-3 w-3"}):g.jsx(w8,{className:"h-3 w-3"}),g.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&g.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(D=>g.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),g.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[g.jsxs("span",{children:["Quant: ",D.quant]}),g.jsx("span",{children:"•"}),g.jsx("span",{children:D.fit.text})]})]}),g.jsx("button",{onClick:()=>y(D.repo,x.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!a[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:a[D.repo]||"Installieren"})]},D.repo))})]})]},x.role)})}),g.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[g.jsxs("button",{onClick:()=>m(!f),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(wP,{className:"h-4 w-4 text-primary"}),g.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),g.jsx("span",{className:"text-[10px] text-primary hover:underline",children:f?"Ausblenden ▲":"Anzeigen ▼"})]}),f&&g.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:g.jsx(Lfe,{})})]})]})}function Ufe(){const[t,e]=R.useState("cockpit");return g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),g.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),g.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(n=>g.jsx("button",{onClick:()=>e(n),className:nt("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===n?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:n==="cockpit"?"Cockpit":"Modelle finden"},n))})]}),g.jsx(Ife,{}),g.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?g.jsx(Ofe,{}):g.jsx(jfe,{})})]})}const Ffe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function D3({line:t,loading:e}){return e||!t?g.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[g.jsx(_P,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?g.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[g.jsx(E8,{className:"h-3 w-3"})," ",t.detail]}):g.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[g.jsx(T8,{className:"h-3 w-3"})," ",t.detail]})}function j3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return g.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[g.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),g.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),g.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),g.jsx("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:g.jsx("span",{children:e})}),g.jsxs("button",{onClick:i,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[r?g.jsx(Go,{className:"h-3.5 w-3.5 text-emerald-400"}):g.jsx(tw,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),g.jsx("pre",{className:nt("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",n==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:g.jsx("code",{children:t.snippet})})]})}function zfe(){const[t,e]=R.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[n,r]=R.useState(localStorage.getItem("mc_mcp_path")||""),[i,s]=R.useState("cline"),[o,a]=R.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=WF(l.toString()),{data:f,isLoading:m}=_7(),y=d?String(d):"";function x(E){e(E),E&&localStorage.setItem("mc_host",E)}function S(E){r(E),localStorage.setItem("mc_mcp_path",E)}const w=c==null?void 0:c.tools[i];async function _(E,T){T&&(await navigator.clipboard.writeText(T),a(E),setTimeout(()=>a(null),1500))}return g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",g.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),g.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[g.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[g.jsx(U8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),g.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),g.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),g.jsxs("div",{className:"flex flex-col gap-2.5",children:[g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(ew,{className:"h-4 w-4 text-muted-foreground shrink-0"}),g.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[g.jsx(El,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),g.jsx(D3,{line:f==null?void 0:f.gateway,loading:m})]}),g.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · model auto"})]})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx(ew,{className:"h-4 w-4 text-muted-foreground shrink-0"}),g.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[g.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[g.jsx(W1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),g.jsx(D3,{line:f==null?void 0:f.memory,loading:m})]}),g.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),g.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",g.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",g.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),g.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[g.jsx(D8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),g.jsx("input",{value:t,onChange:E=>x(E.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[g.jsx(k8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",g.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),g.jsx("input",{value:n,onChange:E=>S(E.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),y&&g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",y]}),c&&g.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[g.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[g.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),g.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),g.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([E,T])=>g.jsx("button",{onClick:()=>s(E),className:nt("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===E?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},E))}),w&&g.jsxs(g.Fragment,{children:[w.note&&g.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[g.jsx(lI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),g.jsx("span",{children:w.note})]}),g.jsx(j3,{tool:w,fileName:Ffe[i]||"config.json",accent:"teal",copied:o==="model",onCopy:()=>_("model",w.snippet)})]})]}),g.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[g.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",g.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),g.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",g.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),g.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[g.jsx(lI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),g.jsx("span",{children:c.memory.note})]}),g.jsx(j3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>_("memory",c.memory.snippet)})]})]})]})}const Bfe="modulepreload",Hfe=function(t){return"/"+t},U3={},Vfe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=Hfe(c),c in U3)return;U3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Bfe,d||(m.as="script"),m.crossOrigin="",m.href=c,l&&m.setAttribute("nonce",l),document.head.appendChild(m),d)return new Promise((y,x)=>{m.addEventListener("load",y),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};class Gfe extends R.Component{constructor(){super(...arguments);Gs(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?g.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[g.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),g.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const Wfe=R.lazy(()=>Vfe(()=>import("./GraphView-COC_6OUw.js"),[]).then(t=>({default:t.GraphView}))),jb=["identity","knowledge","rules","events"],F3=new Set(["auto","agent","hermes"]),qE={identity:{label:"Identität",icon:i9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:Zm,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:J8,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:C8,bg:"bg-amber-500/10",text:"text-amber-400"}},z3={label:"Gedächtnis",icon:PT,text:"text-muted-foreground"},$fe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},B3=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: 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 $fe(){const[t,e]=R.useState(""),[n,r]=R.useState(""),[i,s]=R.useState(""),[o,a]=R.useState("knowledge"),[l,c]=R.useState(!1),[d,f]=R.useState(!1),[m,y]=R.useState("graph"),[x,S]=R.useState(!1),w=$h(),{showAlert:_,showConfirm:E,dialogElement:T}=tv(),{data:C=[]}=BT({}),{data:O=[],error:N}=BT({q:n,category:t}),{data:D}=f7(m==="graph"),F=N?String(N):"",V=()=>{w.invalidateQueries({queryKey:["memory"]}),w.invalidateQueries({queryKey:["memory-graph"]})},k=R.useMemo(()=>{const q=C.length,K=C.filter($=>U3.has($.source)).length;return{total:q,auto:K,manual:q-K,cats:new Set(C.map($=>$.category)).size}},[C]),U=C.length===0,H=R.useMemo(()=>{const q=D??{nodes:[],edges:[]};if(!n.trim())return q;const K=n.toLowerCase(),$=q.nodes.filter(ge=>ge.content.toLowerCase().includes(K)),Z=new Set($.map(ge=>ge.id));return{nodes:$,edges:q.edges.filter(ge=>Z.has(ge.source)&&Z.has(ge.target))}},[D,n]);async function ne(){i.trim()&&(await Ft("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:o,source:"ui"})}),s(""),S(!1),V())}async function te(q){await Ft(`/api/memory/${q}`,{method:"DELETE"}),V()}async function he(){try{await navigator.clipboard.writeText(z3),f(!0),setTimeout(()=>f(!1),1800)}catch{_("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function oe(){he(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function fe(){c(!0);try{const q=await Ft("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(q.duplicate_count===0){_("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}E("Deduplizierung bestätigen",`${q.duplicate_count} Dublette(n) in ${q.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await Ft("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),V()}catch(K){_("Fehler",`Fehler beim Löschen: ${K.message}`)}})}catch(q){_("Fehler",`Fehler bei der Deduplizierung: ${q.message}`)}finally{c(!1)}}const B=({value:q,label:K,accent:$})=>g.jsxs("span",{className:tt("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",$==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[$==="auto"&&g.jsx(Gm,{className:"h-3 w-3"}),g.jsx("b",{className:tt("font-semibold",$==="auto"?"":"text-foreground"),children:q})," ",K]});return g.jsxs("div",{className:"space-y-5",children:[g.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool"}),g.jsx("p",{className:"text-sm text-muted-foreground",children:"Geteilte Konstitution — Hermes, IDEs & Gateway lesen und lernen hier per MCP."})]}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsxs("div",{className:"relative",children:[g.jsx("input",{value:n,onChange:q=>r(q.target.value),placeholder:"Semantisch suchen…",className:"w-52 h-9 pl-8 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),g.jsx(_P,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),g.jsxs("button",{onClick:()=>S(q=>!q),className:"h-9 px-3 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[g.jsx(kT,{className:"h-4 w-4"})," Eintrag"]}),g.jsx("div",{className:"flex items-center gap-1 p-1 bg-card/30 border border-border/40 rounded-lg",children:[["liste",B8,"Liste"],["graph",e9,"Graph"]].map(([q,K,$])=>g.jsxs("button",{onClick:()=>y(q),className:tt("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",m===q?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[g.jsx(K,{className:"h-3.5 w-3.5"})," ",$]},q))}),g.jsx("button",{onClick:fe,disabled:l,className:"flex h-9 w-9 items-center justify-center rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50",title:"Deduplizieren",children:g.jsx(Gm,{className:"h-4 w-4 text-primary"})})]})]}),!U&&g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.jsx(B,{value:k.total,label:"Fakten"}),g.jsx(B,{value:k.auto,label:"auto gelernt",accent:"auto"}),g.jsx(B,{value:k.manual,label:"manuell"}),g.jsx(B,{value:k.cats,label:"Kategorien"}),g.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[g.jsx(Gm,{className:"h-3 w-3 text-emerald-400"})," lernt automatisch aus Hermes-Gesprächen"]})]}),x&&g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 space-y-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),g.jsx("button",{onClick:()=>S(!1),className:"text-muted-foreground hover:text-foreground",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsx("textarea",{value:i,onChange:q=>s(q.target.value),rows:2,placeholder:"Eine Regel, Vorliebe oder einen stabilen Fakt über dich oder das Projekt…",className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),g.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[g.jsx("select",{value:o,onChange:q=>a(q.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 text-xs outline-none font-semibold text-foreground cursor-pointer",children:j3.map(q=>{var K;return g.jsx("option",{value:q,className:"bg-popover text-foreground",children:((K=XE[q])==null?void 0:K.label)||q},q)})}),g.jsxs("button",{onClick:ne,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[g.jsx(kT,{className:"h-4 w-4"})," Speichern"]})]})]}),F&&g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler: ",F]}),U?g.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 sm:p-10 flex flex-col items-center text-center gap-5",children:[g.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:g.jsx(V8,{className:"h-7 w-7 text-primary"})}),g.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[g.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),g.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Statt Fakten einzutippen: führ ein kurzes Onboarding-Gespräch mit Hermes. Was ihr besprecht, merkt sich das Gedächtnis automatisch — du musst nichts manuell pflegen."})]}),g.jsxs("div",{className:"w-full max-w-lg text-left",children:[g.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),g.jsx("button",{onClick:he,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:d?g.jsxs(g.Fragment,{children:[g.jsx(Go,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):g.jsxs(g.Fragment,{children:[g.jsx(ew,{className:"h-3 w-3"})," Kopieren"]})})]}),g.jsx("pre",{className:"w-full rounded-xl border border-border/60 bg-background/40 p-3.5 text-[11px] leading-relaxed text-foreground/90 whitespace-pre-wrap font-mono",children:z3})]}),g.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[g.jsxs("button",{onClick:oe,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[g.jsx(cF,{className:"h-4 w-4"})," Im Terminal starten"]}),g.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?g.jsx(Go,{className:"h-4 w-4 text-emerald-400"}):g.jsx(ew,{className:"h-4 w-4"})," Prompt kopieren"]})]}),g.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[g.jsx(J8,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",g.jsx("button",{onClick:()=>S(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):m==="graph"?g.jsx(Vfe,{children:g.jsx(R.Suspense,{fallback:g.jsx("div",{className:"h-[480px] rounded-2xl border border-border/60 bg-card/30 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:g.jsx(Gfe,{data:H,onDelete:te})})}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl w-fit",children:[g.jsx("button",{onClick:()=>e(""),className:tt("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer",t?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),j3.map(q=>{const K=XE[q]||F3,$=K.icon;return g.jsxs("button",{onClick:()=>e(q),className:tt("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",t===q?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[g.jsx($,{className:"h-3 w-3"})," ",K.label]},q)})]}),g.jsx("div",{className:"space-y-3",children:O.length===0?g.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):O.map(q=>{const K=XE[q.category]||F3,$=K.icon,Z=U3.has(q.source);return g.jsxs("div",{className:tt("flex items-start justify-between gap-4 p-4 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 shadow-md shadow-black/5 hover:border-primary/20 transition-all group",Wfe[q.category]||"border-l-muted"),children:[g.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[g.jsxs("span",{className:tt("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",K.bg,K.text),children:[g.jsx($,{className:"h-3 w-3"}),g.jsx("span",{className:"hidden sm:inline",children:K.label})]}),g.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:q.content})]}),g.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[typeof q.score=="number"&&g.jsxs("span",{className:"text-[9px] font-mono text-primary bg-primary/10 px-1.5 py-0.5 rounded uppercase tracking-wider",title:"Relevanz der semantischen Suche",children:[Math.round(q.score*100),"%"]}),g.jsxs("span",{className:tt("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded uppercase tracking-wider",Z?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:Z?"Automatisch gelernt":"Manuell angelegt",children:[Z&&g.jsx(Gm,{className:"h-2.5 w-2.5"}),q.source]}),g.jsx("button",{onClick:()=>te(q.id),title:"Eintrag löschen",className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:g.jsx(OT,{className:"h-3.5 w-3.5"})})]})]},q.id)})})]}),T]})}function Db({label:t,ok:e,detail:n,icon:r,onClick:i}){return g.jsxs("div",{onClick:i,className:tt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",e?"border-border/60":"border-amber-500/30",i&&"cursor-pointer hover:bg-card/70"),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:t}),g.jsx(r,{className:tt("h-4.5 w-4.5",e?"text-primary":"text-amber-500")})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:tt("h-2 w-2 rounded-full ring-2 ring-black/40",e?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-semibold text-foreground",children:e?"Bereit / Online":"Offline / Inaktiv"})]}),n&&g.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:n,children:n})]}),i&&g.jsxs("button",{onClick:s=>{s.stopPropagation(),i()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[g.jsx(El,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:"Gehirn wechseln"})]})]})}function Xfe(){const{data:t,error:e}=TP(5e3),{data:n}=qh(),{showAlert:r,dialogElement:i}=tv(),s=$h(),o=e?String(e):"",a=R.useMemo(()=>["auto","fast","heavy",...((n==null?void 0:n.models)??[]).map(O=>{var N;return((N=O.name.split("/").pop())==null?void 0:N.replace(".gguf",""))||O.name})],[n]),[l,c]=R.useState(null),[d,f]=R.useState(!1),[m,y]=R.useState({width:800,height:360}),x=R.useRef(null),S=R.useCallback(C=>{if(x.current&&(x.current.disconnect(),x.current=null),C){const O=new ResizeObserver(N=>{if(!N||N.length===0)return;const D=N[0].contentRect;y({width:D.width,height:D.height})});O.observe(C),x.current=O}},[]),w=m.width,_=m.height,E=(C,O,N,D)=>{const F=(C+N)/2;return`M ${C} ${O} C ${F} ${O}, ${F} ${D}, ${N} ${D}`};async function T(C){try{await Ft("/api/agent/brain",{method:"POST",body:JSON.stringify({model:C})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${C}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:Lr.agentStatus}),f(!1)}catch(O){r("Fehler",`Fehler beim Wechseln des Gehirns: ${O.message}`)}}return g.jsxs("div",{className:"space-y-6",children:[g.jsx("style",{children:` +Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemerkt hast.`;function Xfe(){const[t,e]=R.useState(""),[n,r]=R.useState(""),[i,s]=R.useState(""),[o,a]=R.useState("knowledge"),[l,c]=R.useState(!1),[d,f]=R.useState(!1),[m,y]=R.useState("liste"),[x,S]=R.useState(!1),w=$h(),{showAlert:_,showConfirm:E,dialogElement:T}=tv(),{data:C=[]}=HT({}),{data:O=[],error:N}=HT({q:n,category:t}),{data:D}=h7(m==="graph"),F=N?String(N):"",G=()=>{w.invalidateQueries({queryKey:["memory"]}),w.invalidateQueries({queryKey:["memory-graph"]})},k=R.useMemo(()=>{const V=C.length,q=C.filter(pe=>F3.has(pe.source)).length;return{total:V,auto:q,manual:V-q,cats:new Set(C.map(pe=>pe.category)).size}},[C]),U=C.length===0,H=R.useMemo(()=>{const V=D??{nodes:[],edges:[]};if(!n.trim())return V;const q=n.toLowerCase(),pe=V.nodes.filter(le=>le.content.toLowerCase().includes(q)),ae=new Set(pe.map(le=>le.id));return{nodes:pe,edges:V.edges.filter(le=>ae.has(le.source)&&ae.has(le.target))}},[D,n]),ne=R.useMemo(()=>{const V={};return O.forEach(q=>{var pe;(V[pe=q.category]??(V[pe]=[])).push(q)}),V},[O]),te=R.useMemo(()=>O.filter(V=>!jb.includes(V.category)),[O]);async function he(){i.trim()&&(await Ft("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:o,source:"ui"})}),s(""),S(!1),G())}async function se(V){await Ft(`/api/memory/${V}`,{method:"DELETE"}),G()}async function fe(){try{await navigator.clipboard.writeText(B3),f(!0),setTimeout(()=>f(!1),1800)}catch{_("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function B(){fe(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function J(){c(!0);try{const V=await Ft("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(V.duplicate_count===0){_("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}E("Deduplizierung bestätigen",`${V.duplicate_count} Dublette(n) in ${V.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await Ft("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),G()}catch(q){_("Fehler",`Fehler beim Löschen: ${q.message}`)}})}catch(V){_("Fehler",`Fehler bei der Deduplizierung: ${V.message}`)}finally{c(!1)}}const Y=({value:V,label:q,accent:pe})=>g.jsxs("span",{className:nt("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",pe==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[pe==="auto"&&g.jsx(Gm,{className:"h-3 w-3"}),g.jsx("b",{className:nt("font-semibold",pe==="auto"?"":"text-foreground"),children:V})," ",q]});return g.jsxs("div",{className:"space-y-5",children:[g.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool"}),g.jsx("p",{className:"text-sm text-muted-foreground",children:"Geteilte Konstitution — Hermes, IDEs & Gateway lesen und lernen hier per MCP."})]}),g.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[g.jsxs("div",{className:"relative",children:[g.jsx("input",{value:n,onChange:V=>r(V.target.value),placeholder:"Semantisch suchen…",className:"w-52 h-9 pl-8 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),g.jsx(wP,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),g.jsxs("button",{onClick:()=>S(V=>!V),className:"h-9 px-3 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[g.jsx(OT,{className:"h-4 w-4"})," Eintrag"]}),g.jsx("div",{className:"flex items-center gap-1 p-1 bg-card/30 border border-border/40 rounded-lg",children:[["liste",H8,"Liste"],["graph",t9,"Graph"]].map(([V,q,pe])=>g.jsxs("button",{onClick:()=>y(V),className:nt("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",m===V?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[g.jsx(q,{className:"h-3.5 w-3.5"})," ",pe]},V))}),g.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",title:"Deduplizieren",children:g.jsx(Gm,{className:"h-4 w-4 text-primary"})})]})]}),!U&&g.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[g.jsx(Y,{value:k.total,label:"Fakten"}),g.jsx(Y,{value:k.auto,label:"auto gelernt",accent:"auto"}),g.jsx(Y,{value:k.manual,label:"manuell"}),g.jsx(Y,{value:k.cats,label:"Kategorien"}),g.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[g.jsx(Gm,{className:"h-3 w-3 text-emerald-400"})," lernt automatisch aus Hermes-Gesprächen"]})]}),x&&g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 space-y-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),g.jsx("button",{onClick:()=>S(!1),className:"text-muted-foreground hover:text-foreground",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsx("textarea",{value:i,onChange:V=>s(V.target.value),rows:2,placeholder:"Eine Regel, Vorliebe oder einen stabilen Fakt über dich oder das Projekt…",className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),g.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[g.jsx("select",{value:o,onChange:V=>a(V.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 text-xs outline-none font-semibold text-foreground cursor-pointer",children:jb.map(V=>{var q;return g.jsx("option",{value:V,className:"bg-popover text-foreground",children:((q=qE[V])==null?void 0:q.label)||V},V)})}),g.jsxs("button",{onClick:he,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[g.jsx(OT,{className:"h-4 w-4"})," Speichern"]})]})]}),F&&g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler: ",F]}),U?g.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 sm:p-10 flex flex-col items-center text-center gap-5",children:[g.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:g.jsx(G8,{className:"h-7 w-7 text-primary"})}),g.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[g.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),g.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Statt Fakten einzutippen: führ ein kurzes Onboarding-Gespräch mit Hermes. Was ihr besprecht, merkt sich das Gedächtnis automatisch — du musst nichts manuell pflegen."})]}),g.jsxs("div",{className:"w-full max-w-lg text-left",children:[g.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),g.jsx("button",{onClick:fe,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:d?g.jsxs(g.Fragment,{children:[g.jsx(Go,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):g.jsxs(g.Fragment,{children:[g.jsx(tw,{className:"h-3 w-3"})," Kopieren"]})})]}),g.jsx("pre",{className:"w-full rounded-xl border border-border/60 bg-background/40 p-3.5 text-[11px] leading-relaxed text-foreground/90 whitespace-pre-wrap font-mono",children:B3})]}),g.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[g.jsxs("button",{onClick:B,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[g.jsx(uF,{className:"h-4 w-4"})," Im Terminal starten"]}),g.jsxs("button",{onClick:fe,className:"h-9 px-4 rounded-lg border border-border/60 bg-card text-xs font-semibold hover:border-primary/50 transition-all flex items-center gap-1.5 cursor-pointer",children:[d?g.jsx(Go,{className:"h-4 w-4 text-emerald-400"}):g.jsx(tw,{className:"h-4 w-4"})," Prompt kopieren"]})]}),g.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[g.jsx(e9,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",g.jsx("button",{onClick:()=>S(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):m==="graph"?g.jsx(Gfe,{children:g.jsx(R.Suspense,{fallback:g.jsx("div",{className:"h-[480px] rounded-2xl border border-border/60 bg-card/30 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:g.jsx(Wfe,{data:H,onDelete:se})})}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl w-fit",children:[g.jsx("button",{onClick:()=>e(""),className:nt("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer",t?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),jb.map(V=>{const q=qE[V]||z3,pe=q.icon;return g.jsxs("button",{onClick:()=>e(V),className:nt("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",t===V?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[g.jsx(pe,{className:"h-3 w-3"})," ",q.label]},V)})]}),O.length===0?g.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):g.jsx("div",{className:"space-y-5",children:[...jb,"__other"].map(V=>{const q=V==="__other"?te:ne[V]||[];if(!q.length)return null;const pe=qE[V]||z3,ae=pe.icon;return g.jsxs("div",{children:[g.jsxs("div",{className:"flex items-center gap-2 mb-2 px-1",children:[g.jsx(ae,{className:nt("h-3.5 w-3.5",pe.text)}),g.jsx("span",{className:nt("text-[11px] font-bold uppercase tracking-wider",pe.text),children:pe.label}),g.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 bg-card/50 rounded px-1.5 py-0.5",children:q.length}),g.jsx("div",{className:"ml-1 h-px flex-1 bg-border/30"})]}),g.jsx("div",{className:"space-y-2",children:q.map(le=>{const be=F3.has(le.source);return g.jsxs("div",{className:nt("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",$fe[le.category]||"border-l-muted"),children:[g.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1 min-w-0",children:le.content}),g.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[typeof le.score=="number"&&g.jsxs("span",{className:"text-[9px] font-mono text-primary bg-primary/10 px-1.5 py-0.5 rounded",title:"Relevanz der semantischen Suche",children:[Math.round(le.score*100),"%"]}),g.jsxs("span",{className:nt("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded",be?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:be?"Automatisch gelernt":"Manuell angelegt",children:[be&&g.jsx(Gm,{className:"h-2.5 w-2.5"}),le.source]}),g.jsx("button",{onClick:()=>se(le.id),title:"Eintrag löschen",className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:g.jsx(LT,{className:"h-3.5 w-3.5"})})]})]},le.id)})})]},V)})})]}),T]})}function Ub({label:t,ok:e,detail:n,icon:r,onClick:i}){return g.jsxs("div",{onClick:i,className:nt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",e?"border-border/60":"border-amber-500/30",i&&"cursor-pointer hover:bg-card/70"),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:t}),g.jsx(r,{className:nt("h-4.5 w-4.5",e?"text-primary":"text-amber-500")})]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:nt("h-2 w-2 rounded-full ring-2 ring-black/40",e?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-semibold text-foreground",children:e?"Bereit / Online":"Offline / Inaktiv"})]}),n&&g.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:n,children:n})]}),i&&g.jsxs("button",{onClick:s=>{s.stopPropagation(),i()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[g.jsx(El,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:"Gehirn wechseln"})]})]})}function qfe(){const{data:t,error:e}=CP(5e3),{data:n}=qh(),{showAlert:r,dialogElement:i}=tv(),s=$h(),o=e?String(e):"",a=R.useMemo(()=>["auto","fast","heavy",...((n==null?void 0:n.models)??[]).map(O=>{var N;return((N=O.name.split("/").pop())==null?void 0:N.replace(".gguf",""))||O.name})],[n]),[l,c]=R.useState(null),[d,f]=R.useState(!1),[m,y]=R.useState({width:800,height:360}),x=R.useRef(null),S=R.useCallback(C=>{if(x.current&&(x.current.disconnect(),x.current=null),C){const O=new ResizeObserver(N=>{if(!N||N.length===0)return;const D=N[0].contentRect;y({width:D.width,height:D.height})});O.observe(C),x.current=O}},[]),w=m.width,_=m.height,E=(C,O,N,D)=>{const F=(C+N)/2;return`M ${C} ${O} C ${F} ${O}, ${F} ${D}, ${N} ${D}`};async function T(C){try{await Ft("/api/agent/brain",{method:"POST",body:JSON.stringify({model:C})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${C}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:Lr.agentStatus}),f(!1)}catch(O){r("Fehler",`Fehler beim Wechseln des Gehirns: ${O.message}`)}}return g.jsxs("div",{className:"space-y-6",children:[g.jsx("style",{children:` @keyframes flow-dash { to { stroke-dashoffset: -20; @@ -581,15 +586,15 @@ Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemer stroke-dasharray: 4 6; animation: flow-dash 1s linear infinite; } - `}),g.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",g.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(t==null?void 0:t.terminal_url)&&g.jsxs("a",{href:Mg(t.terminal_url),target:"_blank",rel:"noopener",className:tt("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",t.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[g.jsx(bg,{className:"h-4 w-4"}),g.jsx("span",{children:"Terminal öffnen"})]})]}),o&&g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",o,")."]}),t&&g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[g.jsx(Db,{label:"Agent Gateway",ok:t.gateway_reachable,detail:"Port :8642 (REST API)",icon:Il}),g.jsx(Db,{label:"Terminal",ok:t.terminal_reachable,detail:"Web-Terminal (hermes chat)",icon:sy}),g.jsx(Db,{label:"Aktives Gehirn",ok:t.gateway_reachable,detail:t.brain_model?`Model: ${t.brain_model}`:"Model: auto",icon:El,onClick:()=>f(!0)}),g.jsx(Db,{label:"Verdrahtung",ok:t.has_config,detail:`Config: ${t.has_config?"✓":"—"} · Skills: ${t.has_skills?"✓":"—"} · Memory: ${t.has_memories?"✓":"—"}`,icon:nw})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[g.jsxs("div",{children:[g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),g.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),g.jsxs("div",{ref:S,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[g.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[g.jsxs("defs",{children:[g.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),g.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),g.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),g.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),g.jsx("path",{d:E(w*.15,_*.5,w*.5,_*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="terminal"||t.terminal_reachable)&&g.jsx("path",{d:E(w*.15,_*.5,w*.5,_*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:E(w*.5,_*.5,w*.85,_*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="brain"||t.gateway_reachable)&&g.jsx("path",{d:E(w*.5,_*.5,w*.85,_*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:E(w*.5,_*.5,w*.85,_*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="wiring"||t.gateway_reachable)&&g.jsx("path",{d:E(w*.5,_*.5,w*.85,_*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>c("terminal"),onMouseLeave:()=>c(null),onClick:()=>t.terminal_reachable&&window.open(Mg(t.terminal_url),"_blank"),title:t.terminal_reachable?"Klicken um das Hermes-Terminal zu öffnen":"Terminal offline",children:[g.jsx(sy,{className:tt("h-3.5 w-3.5",t.terminal_reachable?"text-emerald-400":"text-amber-500")}),g.jsx("span",{children:"Terminal"}),g.jsx("span",{className:tt("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",t.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),g.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>c("gateway"),onMouseLeave:()=>c(null),children:[g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Il,{className:"h-3.5 w-3.5 text-primary"}),g.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),g.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),g.jsx("div",{className:tt("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",t.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:t.gateway_reachable?"Online":"Offline"})]}),g.jsxs("div",{className:tt("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",t.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>c("brain"),onMouseLeave:()=>c(null),onClick:()=>f(!0),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[g.jsx(El,{className:"h-3 w-3 text-primary"}),g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),t.gateway_reachable&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:t.brain_model,children:t.brain_model||"auto"})]}),g.jsxs("div",{className:tt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",t.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>c("wiring"),onMouseLeave:()=>c(null),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[g.jsx(nw,{className:"h-3 w-3 text-primary"}),g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),t.has_config&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[g.jsxs("span",{children:["Config: ",t.has_config?"✓":"—"]}),g.jsxs("span",{children:["Skills: ",t.has_skills?"✓":"—"]}),g.jsxs("span",{children:["Memory: ",t.has_memories?"✓":"—"]})]})]})]}),g.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),g.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),g.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(G8,{className:"h-5 w-5 text-primary"}),g.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:tt("h-2 w-2 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[g.jsxs("div",{className:"space-y-3",children:[g.jsxs("p",{children:["Der ",g.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",g.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"192.168.178.98:7777"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),g.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",g.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),g.jsx("div",{className:"space-y-3",children:t.pc_executor_reachable?g.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[g.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),g.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",g.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",g.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",g.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):g.jsxs("div",{className:"space-y-2",children:[g.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),g.jsxs("p",{children:["Starte ",g.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",g.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),g.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!t.gateway_reachable&&g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Zm,{className:"h-5 w-5 text-amber-500"}),g.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),g.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[g.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),g.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",g.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),g.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[g.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),g.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),g.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-terminal"})]}),g.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",g.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),t&&d&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[g.jsx(El,{className:"h-4 w-4"}),g.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),g.jsx("button",{onClick:()=>f(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',g.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),g.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:a.map(C=>{const O=["auto","fast","heavy"].includes(C);return g.jsxs("button",{onClick:()=>T(C),className:tt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",t.brain_model===C||!t.brain_model&&C==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[g.jsxs("div",{className:"flex flex-col text-left",children:[g.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:C}),g.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:O?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(t.brain_model===C||!t.brain_model&&C==="auto")&&g.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},C)})})]})}),i]})}function qfe(){const{data:t}=TP(5e3),e=t!=null&&t.terminal_url?Mg(t.terminal_url):void 0,n=t==null?void 0:t.terminal_reachable;return g.jsxs("div",{className:"flex h-full flex-col gap-4",children:[g.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Hermes Terminal"}),g.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Interaktiver Agent (",g.jsx("code",{className:"rounded bg-background/40 px-1 font-mono text-[11px] text-primary",children:"hermes chat"}),') mit Tools & PC-Steuerung — „mehr als Chatten".']})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[g.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),n?"online":"offline"]}),e&&g.jsxs("a",{href:e,target:"_blank",rel:"noopener",className:"flex h-8 items-center gap-1.5 rounded-lg border border-border/60 bg-background/20 px-3 text-xs font-semibold text-muted-foreground transition-all hover:border-primary/50 hover:text-foreground",children:[g.jsx(bg,{className:"h-3.5 w-3.5"})," In neuem Tab"]})]})]}),e?g.jsxs("div",{className:"relative min-h-[68vh] flex-1 overflow-hidden rounded-2xl border border-border/60 bg-black/50 shadow-lg shadow-black/25",children:[n===!1&&g.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/70 text-center",children:[g.jsx(_g,{className:"h-8 w-8 text-amber-400"}),g.jsx("div",{className:"text-sm font-semibold text-amber-300",children:"Terminal nicht erreichbar"}),g.jsxs("p",{className:"max-w-sm text-[11px] leading-normal text-muted-foreground",children:["Der ",g.jsx("code",{className:"font-mono text-primary",children:"hermes-terminal"}),"-Dienst (ttyd) läuft nicht. Auf der Box: ",g.jsx("code",{className:"font-mono",children:"systemctl --user restart hermes-terminal"}),"."]})]}),g.jsx("iframe",{src:e,title:"Hermes Terminal",className:"h-full w-full border-0",style:{minHeight:"68vh"}})]}):g.jsxs("div",{className:"flex min-h-[68vh] flex-1 items-center justify-center rounded-2xl border border-border/60 bg-background/20 text-xs text-muted-foreground",children:[g.jsx(lF,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}/** + `}),g.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),g.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",g.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(t==null?void 0:t.terminal_url)&&g.jsxs("a",{href:Mg(t.terminal_url),target:"_blank",rel:"noopener",className:nt("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",t.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[g.jsx(bg,{className:"h-4 w-4"}),g.jsx("span",{children:"Terminal öffnen"})]})]}),o&&g.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",o,")."]}),t&&g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[g.jsx(Ub,{label:"Agent Gateway",ok:t.gateway_reachable,detail:"Port :8642 (REST API)",icon:Il}),g.jsx(Ub,{label:"Terminal",ok:t.terminal_reachable,detail:"Web-Terminal (hermes chat)",icon:ay}),g.jsx(Ub,{label:"Aktives Gehirn",ok:t.gateway_reachable,detail:t.brain_model?`Model: ${t.brain_model}`:"Model: auto",icon:El,onClick:()=>f(!0)}),g.jsx(Ub,{label:"Verdrahtung",ok:t.has_config,detail:`Config: ${t.has_config?"✓":"—"} · Skills: ${t.has_skills?"✓":"—"} · Memory: ${t.has_memories?"✓":"—"}`,icon:rw})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[g.jsxs("div",{children:[g.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),g.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),g.jsxs("div",{ref:S,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[g.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[g.jsxs("defs",{children:[g.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),g.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),g.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[g.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),g.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),g.jsx("path",{d:E(w*.15,_*.5,w*.5,_*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="terminal"||t.terminal_reachable)&&g.jsx("path",{d:E(w*.15,_*.5,w*.5,_*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:E(w*.5,_*.5,w*.85,_*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="brain"||t.gateway_reachable)&&g.jsx("path",{d:E(w*.5,_*.5,w*.85,_*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),g.jsx("path",{d:E(w*.5,_*.5,w*.85,_*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="wiring"||t.gateway_reachable)&&g.jsx("path",{d:E(w*.5,_*.5,w*.85,_*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),g.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>c("terminal"),onMouseLeave:()=>c(null),onClick:()=>t.terminal_reachable&&window.open(Mg(t.terminal_url),"_blank"),title:t.terminal_reachable?"Klicken um das Hermes-Terminal zu öffnen":"Terminal offline",children:[g.jsx(ay,{className:nt("h-3.5 w-3.5",t.terminal_reachable?"text-emerald-400":"text-amber-500")}),g.jsx("span",{children:"Terminal"}),g.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",t.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),g.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>c("gateway"),onMouseLeave:()=>c(null),children:[g.jsxs("div",{className:"flex items-center gap-1",children:[g.jsx(Il,{className:"h-3.5 w-3.5 text-primary"}),g.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),g.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),g.jsx("div",{className:nt("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",t.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:t.gateway_reachable?"Online":"Offline"})]}),g.jsxs("div",{className:nt("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",t.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>c("brain"),onMouseLeave:()=>c(null),onClick:()=>f(!0),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[g.jsx(El,{className:"h-3 w-3 text-primary"}),g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),t.gateway_reachable&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:t.brain_model,children:t.brain_model||"auto"})]}),g.jsxs("div",{className:nt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",t.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>c("wiring"),onMouseLeave:()=>c(null),children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[g.jsx(rw,{className:"h-3 w-3 text-primary"}),g.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),t.has_config&&g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),g.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[g.jsxs("span",{children:["Config: ",t.has_config?"✓":"—"]}),g.jsxs("span",{children:["Skills: ",t.has_skills?"✓":"—"]}),g.jsxs("span",{children:["Memory: ",t.has_memories?"✓":"—"]})]})]})]}),g.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),g.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),g.jsxs("span",{className:"flex items-center gap-1.5",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),g.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(W8,{className:"h-5 w-5 text-primary"}),g.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("span",{className:nt("h-2 w-2 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),g.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),g.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[g.jsxs("div",{className:"space-y-3",children:[g.jsxs("p",{children:["Der ",g.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",g.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"192.168.178.98:7777"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),g.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",g.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),g.jsx("div",{className:"space-y-3",children:t.pc_executor_reachable?g.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[g.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[g.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),g.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",g.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",g.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",g.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):g.jsxs("div",{className:"space-y-2",children:[g.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),g.jsxs("p",{children:["Starte ",g.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",g.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),g.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!t.gateway_reachable&&g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(Zm,{className:"h-5 w-5 text-amber-500"}),g.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),g.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[g.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),g.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",g.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),g.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[g.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),g.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),g.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-terminal"})]}),g.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",g.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),t&&d&&g.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:g.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[g.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[g.jsx(El,{className:"h-4 w-4"}),g.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),g.jsx("button",{onClick:()=>f(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',g.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",g.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),g.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:a.map(C=>{const O=["auto","fast","heavy"].includes(C);return g.jsxs("button",{onClick:()=>T(C),className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",t.brain_model===C||!t.brain_model&&C==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[g.jsxs("div",{className:"flex flex-col text-left",children:[g.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:C}),g.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:O?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(t.brain_model===C||!t.brain_model&&C==="auto")&&g.jsx(Go,{className:"h-4 w-4 shrink-0 text-primary"})]},C)})})]})}),i]})}function Kfe(){const{data:t}=CP(5e3),e=t!=null&&t.terminal_url?Mg(t.terminal_url):void 0,n=t==null?void 0:t.terminal_reachable;return g.jsxs("div",{className:"flex h-full flex-col gap-4",children:[g.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Hermes Terminal"}),g.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Interaktiver Agent (",g.jsx("code",{className:"rounded bg-background/40 px-1 font-mono text-[11px] text-primary",children:"hermes chat"}),') mit Tools & PC-Steuerung — „mehr als Chatten".']})]}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[g.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),n?"online":"offline"]}),e&&g.jsxs("a",{href:e,target:"_blank",rel:"noopener",className:"flex h-8 items-center gap-1.5 rounded-lg border border-border/60 bg-background/20 px-3 text-xs font-semibold text-muted-foreground transition-all hover:border-primary/50 hover:text-foreground",children:[g.jsx(bg,{className:"h-3.5 w-3.5"})," In neuem Tab"]})]})]}),e?g.jsxs("div",{className:"relative min-h-[68vh] flex-1 overflow-hidden rounded-2xl border border-border/60 bg-black/50 shadow-lg shadow-black/25",children:[n===!1&&g.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/70 text-center",children:[g.jsx(_g,{className:"h-8 w-8 text-amber-400"}),g.jsx("div",{className:"text-sm font-semibold text-amber-300",children:"Terminal nicht erreichbar"}),g.jsxs("p",{className:"max-w-sm text-[11px] leading-normal text-muted-foreground",children:["Der ",g.jsx("code",{className:"font-mono text-primary",children:"hermes-terminal"}),"-Dienst (ttyd) läuft nicht. Auf der Box: ",g.jsx("code",{className:"font-mono",children:"systemctl --user restart hermes-terminal"}),"."]})]}),g.jsx("iframe",{src:e,title:"Hermes Terminal",className:"h-full w-full border-0",style:{minHeight:"68vh"}})]}):g.jsxs("div",{className:"flex min-h-[68vh] flex-1 items-center justify-center rounded-2xl border border-border/60 bg-background/20 text-xs text-muted-foreground",children:[g.jsx(cF,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}/** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */const Td="169",Xf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},qf={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},fV=0,BC=1,hV=2,Kfe=3,pV=0,BS=1,X0=2,Oa=3,Ul=0,ss=1,xo=2,$c=0,Sh=1,HC=2,VC=3,GC=4,mV=5,ud=100,gV=101,vV=102,yV=103,xV=104,bV=200,_V=201,wV=202,SV=203,Qw=204,Jw=205,MV=206,EV=207,AV=208,TV=209,CV=210,PV=211,RV=212,NV=213,IV=214,e1=0,t1=1,n1=2,jh=3,r1=4,i1=5,s1=6,o1=7,ox=0,kV=1,OV=2,Pl=0,LV=1,DV=2,jV=3,uR=4,UV=5,FV=6,zV=7,WC="attached",BV="detached",HS=300,Jc=301,Cd=302,My=303,Ey=304,nv=306,Pd=1e3,_o=1001,kg=1002,ri=1003,VS=1004,Yfe=1004,ih=1005,Zfe=1005,Cr=1006,rg=1007,Qfe=1007,qo=1008,Jfe=1008,Ha=1009,dR=1010,fR=1011,Og=1012,GS=1013,eu=1014,Qs=1015,rv=1016,WS=1017,$S=1018,Uh=1020,hR=35902,pR=1021,mR=1022,is=1023,gR=1024,vR=1025,Mh=1026,Fh=1027,XS=1028,ax=1029,yR=1030,qS=1031,ehe=1032,KS=1033,q0=33776,K0=33777,Y0=33778,Z0=33779,a1=35840,l1=35841,c1=35842,u1=35843,d1=36196,f1=37492,h1=37496,p1=37808,m1=37809,g1=37810,v1=37811,y1=37812,x1=37813,b1=37814,_1=37815,w1=37816,S1=37817,M1=37818,E1=37819,A1=37820,T1=37821,Q0=36492,C1=36494,P1=36495,xR=36283,R1=36284,N1=36285,I1=36286,HV=2200,VV=2201,GV=2202,Lg=2300,Dg=2301,W_=2302,sh=2400,oh=2401,Ay=2402,YS=2500,bR=2501,WV=0,_R=1,k1=2,$V=3200,XV=3201,the=3202,nhe=3203,lu=0,qV=1,jc="",Ui="srgb",xi="srgb-linear",ZS="display-p3",lx="display-p3-linear",Ty="linear",Jn="srgb",Cy="rec709",Py="p3",rhe=0,Kf=7680,ihe=7681,she=7682,ohe=7683,ahe=34055,lhe=34056,che=5386,uhe=512,dhe=513,fhe=514,hhe=515,phe=516,mhe=517,ghe=518,$C=519,KV=512,YV=513,ZV=514,wR=515,QV=516,JV=517,e6=518,t6=519,Ry=35044,n6=35048,vhe=35040,yhe=35045,xhe=35049,bhe=35041,_he=35046,whe=35050,She=35042,Mhe="100",XC="300 es",Ml=2e3,Ny=2001;let Vl=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s>8&255]+Qi[t>>16&255]+Qi[t>>24&255]+"-"+Qi[e&255]+Qi[e>>8&255]+"-"+Qi[e>>16&15|64]+Qi[e>>24&255]+"-"+Qi[n&63|128]+Qi[n>>8&255]+"-"+Qi[n>>16&255]+Qi[n>>24&255]+Qi[r&255]+Qi[r>>8&255]+Qi[r>>16&255]+Qi[r>>24&255]).toLowerCase()}function Ar(t,e,n){return Math.max(e,Math.min(n,t))}function SR(t,e){return(t%e+e)%e}function Ehe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function Ahe(t,e,n){return t!==e?(n-t)/(e-t):0}function J0(t,e,n){return(1-n)*t+n*e}function The(t,e,n,r){return J0(t,e,1-Math.exp(-n*r))}function Che(t,e=1){return e-Math.abs(SR(t,e*2)-e)}function Phe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Rhe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Nhe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Ihe(t,e){return t+Math.random()*(e-t)}function khe(t){return t*(.5-Math.random())}function Ohe(t){t!==void 0&&(B3=t);let e=B3+=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 Lhe(t){return t*Eh}function Dhe(t){return t*jg}function jhe(t){return(t&t-1)===0&&t!==0}function Uhe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Fhe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function zhe(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),d=o((e+r)/2),f=s((e-r)/2),m=o((e-r)/2),y=s((r-e)/2),x=o((r-e)/2);switch(i){case"XYX":t.set(a*d,l*f,l*m,a*c);break;case"YZY":t.set(l*m,a*d,l*f,a*c);break;case"ZXZ":t.set(l*f,l*m,a*d,a*c);break;case"XZX":t.set(a*d,l*x,l*y,a*c);break;case"YXY":t.set(l*y,a*d,l*x,a*c);break;case"ZYZ":t.set(l*x,l*y,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function 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 gr={DEG2RAD:Eh,RAD2DEG:jg,generateUUID:So,clamp:Ar,euclideanModulo:SR,mapLinear:Ehe,inverseLerp:Ahe,lerp:J0,damp:The,pingpong:Che,smoothstep:Phe,smootherstep:Rhe,randInt:Nhe,randFloat:Ihe,randFloatSpread:khe,seededRandom:Ohe,degToRad:Lhe,radToDeg:Dhe,isPowerOfTwo:jhe,ceilPowerOfTwo:Uhe,floorPowerOfTwo:Fhe,setQuaternionFromProperEuler:zhe,normalize:cn,denormalize:Ss};class Ve{constructor(e=0,n=0){Ve.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Ar(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class qt{constructor(e,n,r,i,s,o,a,l,c){qt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c)}set(e,n,r,i,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],d=r[4],f=r[7],m=r[2],y=r[5],x=r[8],S=i[0],w=i[3],_=i[6],E=i[1],T=i[4],C=i[7],O=i[2],N=i[5],D=i[8];return s[0]=o*S+a*E+l*O,s[3]=o*w+a*T+l*N,s[6]=o*_+a*C+l*D,s[1]=c*S+d*E+f*O,s[4]=c*w+d*T+f*N,s[7]=c*_+d*C+f*D,s[2]=m*S+y*E+x*O,s[5]=m*w+y*T+x*N,s[8]=m*_+y*C+x*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],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return n*o*d-n*a*c-r*s*d+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=d*o-a*c,m=a*l-d*s,y=c*s-o*l,x=n*f+r*m+i*y;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=f*S,e[1]=(i*c-d*r)*S,e[2]=(a*r-i*o)*S,e[3]=m*S,e[4]=(d*n-i*l)*S,e[5]=(i*s-a*n)*S,e[6]=y*S,e[7]=(r*l-c*n)*S,e[8]=(o*n-r*s)*S,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(qE.makeScale(e,n)),this}rotate(e){return this.premultiply(qE.makeRotation(-e)),this}translate(e,n){return this.premultiply(qE.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 qE=new qt;function r6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Bhe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Xm(t,e){return new Bhe[t](e)}function Iy(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function i6(){const t=Iy("canvas");return t.style.display="block",t}const H3={};function $_(t){t in H3||(H3[t]=!0,console.warn(t))}function Hhe(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 Vhe(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 Ghe(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 V3=new qt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),G3=new qt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),g0={[xi]:{transfer:Ty,primaries:Cy,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Ui]:{transfer:Jn,primaries:Cy,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[lx]:{transfer:Ty,primaries:Py,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(G3),fromReference:t=>t.applyMatrix3(V3)},[ZS]:{transfer:Jn,primaries:Py,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(G3),fromReference:t=>t.applyMatrix3(V3).convertLinearToSRGB()}},Whe=new Set([xi,lx]),In={enabled:!0,_workingColorSpace:xi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!Whe.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=g0[e].toReference,i=g0[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 g0[t].primaries},getTransfer:function(t){return t===jc?Ty:g0[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(g0[e].luminanceCoefficients)}};function ig(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function KE(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let hm;class s6{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=Iy("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=Iy("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==HS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Pd:e.x=e.x-Math.floor(e.x);break;case _o:e.x=e.x<0?0:1;break;case kg:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Pd:e.y=e.y-Math.floor(e.y);break;case _o:e.y=e.y<0?0:1;break;case kg:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}dr.DEFAULT_IMAGE=null;dr.DEFAULT_MAPPING=HS;dr.DEFAULT_ANISOTROPY=1;class Ln{constructor(e=0,n=0,r=0,i=1){Ln.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],d=l[4],f=l[8],m=l[1],y=l[5],x=l[9],S=l[2],w=l[6],_=l[10];if(Math.abs(d-m)<.01&&Math.abs(f-S)<.01&&Math.abs(x-w)<.01){if(Math.abs(d+m)<.1&&Math.abs(f+S)<.1&&Math.abs(x+w)<.1&&Math.abs(c+y+_-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const T=(c+1)/2,C=(y+1)/2,O=(_+1)/2,N=(d+m)/4,D=(f+S)/4,F=(x+w)/4;return T>C&&T>O?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=N/r,s=D/r):C>O?C<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(C),r=N/i,s=F/i):O<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(O),r=D/s,i=F/s),this.set(r,i,s,n),this}let E=Math.sqrt((w-x)*(w-x)+(f-S)*(f-S)+(m-d)*(m-d));return Math.abs(E)<.001&&(E=1),this.x=(w-x)/E,this.y=(f-S)/E,this.z=(m-d)/E,this.w=Math.acos((c+y+_-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 o6 extends Vl{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new Ln(0,0,e,n),this.scissorTest=!1,this.viewport=new Ln(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 dr(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a=0?1:-1,T=1-_*_;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,_*E);w=Math.sin(w*N)/O,a=Math.sin(a*N)/O}const C=a*E;if(l=l*w+m*C,c=c*w+y*C,d=d*w+x*C,f=f*w+S*C,w===1-a){const O=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=O,c*=O,d*=O,f*=O}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],d=r[i+3],f=s[o],m=s[o+1],y=s[o+2],x=s[o+3];return e[n]=a*x+d*f+l*y-c*m,e[n+1]=l*x+d*m+c*f-a*y,e[n+2]=c*x+d*y+a*m-l*f,e[n+3]=d*x-a*f-l*m-c*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),d=a(i/2),f=a(s/2),m=l(r/2),y=l(i/2),x=l(s/2);switch(o){case"XYZ":this._x=m*d*f+c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f-m*y*x;break;case"YXZ":this._x=m*d*f+c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f+m*y*x;break;case"ZXY":this._x=m*d*f-c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f-m*y*x;break;case"ZYX":this._x=m*d*f-c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f+m*y*x;break;case"YZX":this._x=m*d*f+c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f-m*y*x;break;case"XZY":this._x=m*d*f-c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f+m*y*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],o=n[1],a=n[5],l=n[9],c=n[2],d=n[6],f=n[10],m=r+a+f;if(m>0){const y=.5/Math.sqrt(m+1);this._w=.25/y,this._x=(d-l)*y,this._y=(s-c)*y,this._z=(o-i)*y}else if(r>a&&r>f){const y=2*Math.sqrt(1+r-a-f);this._w=(d-l)/y,this._x=.25*y,this._y=(i+o)/y,this._z=(s+c)/y}else if(a>f){const y=2*Math.sqrt(1+a-r-f);this._w=(s-c)/y,this._x=(i+o)/y,this._y=.25*y,this._z=(l+d)/y}else{const y=2*Math.sqrt(1+f-r-a);this._w=(o-i)/y,this._x=(s+c)/y,this._y=(l+d)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ar(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,s=e._z,o=e._w,a=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+o*a+i*c-s*l,this._y=i*d+o*l+s*a-r*c,this._z=s*d+o*c+r*l-i*a,this._w=o*d-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const y=1-n;return this._w=y*o+n*this._w,this._x=y*r+n*this._x,this._y=y*i+n*this._y,this._z=y*s+n*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),f=Math.sin((1-n)*d)/c,m=Math.sin(n*d)/c;return this._w=o*f+this._w*m,this._x=r*f+this._x*m,this._y=i*f+this._y*m,this._z=s*f+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class X{constructor(e=0,n=0,r=0){X.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(W3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(W3.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),d=2*(a*n-s*i),f=2*(s*r-o*n);return this.x=n+l*c+o*f-a*d,this.y=r+l*d+a*c-s*f,this.z=i+l*f+s*d-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,o=n.x,a=n.y,l=n.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return ZE.copy(this).projectOnVector(e),this.sub(ZE)}reflect(e){return this.sub(ZE.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(Ar(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 ZE=new X,W3=new Kt;class os{constructor(e=new X(1/0,1/0,1/0),n=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Pa),Pa.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(v0),Ub.subVectors(this.max,v0),pm.subVectors(e.a,v0),mm.subVectors(e.b,v0),gm.subVectors(e.c,v0),Xu.subVectors(mm,pm),qu.subVectors(gm,mm),Tf.subVectors(pm,gm);let n=[0,-Xu.z,Xu.y,0,-qu.z,qu.y,0,-Tf.z,Tf.y,Xu.z,0,-Xu.x,qu.z,0,-qu.x,Tf.z,0,-Tf.x,-Xu.y,Xu.x,0,-qu.y,qu.x,0,-Tf.y,Tf.x,0];return!QE(n,pm,mm,gm,Ub)||(n=[1,0,0,0,1,0,0,0,1],!QE(n,pm,mm,gm,Ub))?!1:(Fb.crossVectors(Xu,qu),n=[Fb.x,Fb.y,Fb.z],QE(n,pm,mm,gm,Ub))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pa).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Pa).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Mc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Mc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Mc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Mc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Mc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Mc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Mc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Mc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Mc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Mc=[new X,new X,new X,new X,new X,new X,new X,new X],Pa=new X,jb=new os,pm=new X,mm=new X,gm=new X,Xu=new X,qu=new X,Tf=new X,v0=new X,Ub=new X,Fb=new X,Cf=new X;function QE(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){Cf.fromArray(t,s);const a=i.x*Math.abs(Cf.x)+i.y*Math.abs(Cf.y)+i.z*Math.abs(Cf.z),l=e.dot(Cf),c=n.dot(Cf),d=r.dot(Cf);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const Yhe=new os,y0=new X,JE=new X;class Bi{constructor(e=new X,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):Yhe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;y0.subVectors(e,this.center);const n=y0.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(y0,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):(JE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(y0.copy(e.center).add(JE)),this.expandByPoint(y0.copy(e.center).sub(JE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ec=new X,eA=new X,zb=new X,Ku=new X,tA=new X,Bb=new X,nA=new X;class Jh{constructor(e=new X,n=new X(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ec)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Ec.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Ec.copy(this.origin).addScaledVector(this.direction,n),Ec.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){eA.copy(e).add(n).multiplyScalar(.5),zb.copy(n).sub(e).normalize(),Ku.copy(this.origin).sub(eA);const s=e.distanceTo(n)*.5,o=-this.direction.dot(zb),a=Ku.dot(this.direction),l=-Ku.dot(zb),c=Ku.lengthSq(),d=Math.abs(1-o*o);let f,m,y,x;if(d>0)if(f=o*l-a,m=o*a-l,x=s*d,f>=0)if(m>=-x)if(m<=x){const S=1/d;f*=S,m*=S,y=f*(f+o*m+2*a)+m*(o*f+m+2*l)+c}else m=s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;else m=-s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;else m<=-x?(f=Math.max(0,-(-o*s+a)),m=f>0?-s:Math.min(Math.max(-s,-l),s),y=-f*f+m*(m+2*l)+c):m<=x?(f=0,m=Math.min(Math.max(-s,-l),s),y=m*(m+2*l)+c):(f=Math.max(0,-(o*s+a)),m=f>0?s:Math.min(Math.max(-s,-l),s),y=-f*f+m*(m+2*l)+c);else m=o>0?-s:s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(eA).addScaledVector(zb,m),y}intersectSphere(e,n){Ec.subVectors(e.center,this.origin);const r=Ec.dot(this.direction),i=Ec.dot(Ec)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,m=this.origin;return c>=0?(r=(e.min.x-m.x)*c,i=(e.max.x-m.x)*c):(r=(e.max.x-m.x)*c,i=(e.min.x-m.x)*c),d>=0?(s=(e.min.y-m.y)*d,o=(e.max.y-m.y)*d):(s=(e.max.y-m.y)*d,o=(e.min.y-m.y)*d),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-m.z)*f,l=(e.max.z-m.z)*f):(a=(e.max.z-m.z)*f,l=(e.min.z-m.z)*f),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Ec)!==null}intersectTriangle(e,n,r,i,s){tA.subVectors(n,e),Bb.subVectors(r,e),nA.crossVectors(tA,Bb);let o=this.direction.dot(nA),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ku.subVectors(this.origin,e);const l=a*this.direction.dot(Bb.crossVectors(Ku,Bb));if(l<0)return null;const c=a*this.direction.dot(tA.cross(Ku));if(c<0||l+c>o)return null;const d=-a*Ku.dot(nA);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Rt{constructor(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,w){Rt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,w)}set(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,w){const _=this.elements;return _[0]=e,_[4]=n,_[8]=r,_[12]=i,_[1]=s,_[5]=o,_[9]=a,_[13]=l,_[2]=c,_[6]=d,_[10]=f,_[14]=m,_[3]=y,_[7]=x,_[11]=S,_[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 Rt().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(),o=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]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const m=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=y+x*c,n[5]=m-S*c,n[9]=-a*l,n[2]=S-m*c,n[6]=x+y*c,n[10]=o*l}else if(e.order==="YXZ"){const m=l*d,y=l*f,x=c*d,S=c*f;n[0]=m+S*a,n[4]=x*a-y,n[8]=o*c,n[1]=o*f,n[5]=o*d,n[9]=-a,n[2]=y*a-x,n[6]=S+m*a,n[10]=o*l}else if(e.order==="ZXY"){const m=l*d,y=l*f,x=c*d,S=c*f;n[0]=m-S*a,n[4]=-o*f,n[8]=x+y*a,n[1]=y+x*a,n[5]=o*d,n[9]=S-m*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const m=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=x*c-y,n[8]=m*c+S,n[1]=l*f,n[5]=S*c+m,n[9]=y*c-x,n[2]=-c,n[6]=a*l,n[10]=o*l}else if(e.order==="YZX"){const m=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=S-m*f,n[8]=x*f+y,n[1]=f,n[5]=o*d,n[9]=-a*d,n[2]=-c*d,n[6]=y*f+x,n[10]=m-S*f}else if(e.order==="XZY"){const m=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=m*f+S,n[5]=o*d,n[9]=y*f-x,n[2]=x*f-y,n[6]=a*d,n[10]=S*f+m}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Zhe,e,Qhe)}lookAt(e,n,r){const i=this.elements;return ho.subVectors(e,n),ho.lengthSq()===0&&(ho.z=1),ho.normalize(),Yu.crossVectors(r,ho),Yu.lengthSq()===0&&(Math.abs(r.z)===1?ho.x+=1e-4:ho.z+=1e-4,ho.normalize(),Yu.crossVectors(r,ho)),Yu.normalize(),Hb.crossVectors(ho,Yu),i[0]=Yu.x,i[4]=Hb.x,i[8]=ho.x,i[1]=Yu.y,i[5]=Hb.y,i[9]=ho.y,i[2]=Yu.z,i[6]=Hb.z,i[10]=ho.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],d=r[1],f=r[5],m=r[9],y=r[13],x=r[2],S=r[6],w=r[10],_=r[14],E=r[3],T=r[7],C=r[11],O=r[15],N=i[0],D=i[4],F=i[8],V=i[12],k=i[1],U=i[5],H=i[9],ne=i[13],te=i[2],he=i[6],oe=i[10],fe=i[14],B=i[3],q=i[7],K=i[11],$=i[15];return s[0]=o*N+a*k+l*te+c*B,s[4]=o*D+a*U+l*he+c*q,s[8]=o*F+a*H+l*oe+c*K,s[12]=o*V+a*ne+l*fe+c*$,s[1]=d*N+f*k+m*te+y*B,s[5]=d*D+f*U+m*he+y*q,s[9]=d*F+f*H+m*oe+y*K,s[13]=d*V+f*ne+m*fe+y*$,s[2]=x*N+S*k+w*te+_*B,s[6]=x*D+S*U+w*he+_*q,s[10]=x*F+S*H+w*oe+_*K,s[14]=x*V+S*ne+w*fe+_*$,s[3]=E*N+T*k+C*te+O*B,s[7]=E*D+T*U+C*he+O*q,s[11]=E*F+T*H+C*oe+O*K,s[15]=E*V+T*ne+C*fe+O*$,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],f=e[6],m=e[10],y=e[14],x=e[3],S=e[7],w=e[11],_=e[15];return x*(+s*l*f-i*c*f-s*a*m+r*c*m+i*a*y-r*l*y)+S*(+n*l*y-n*c*m+s*o*m-i*o*y+i*c*d-s*l*d)+w*(+n*c*f-n*a*y-s*o*f+r*o*y+s*a*d-r*c*d)+_*(-i*a*d-n*l*f+n*a*m+i*o*f-r*o*m+r*l*d)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=e[9],m=e[10],y=e[11],x=e[12],S=e[13],w=e[14],_=e[15],E=f*w*c-S*m*c+S*l*y-a*w*y-f*l*_+a*m*_,T=x*m*c-d*w*c-x*l*y+o*w*y+d*l*_-o*m*_,C=d*S*c-x*f*c+x*a*y-o*S*y-d*a*_+o*f*_,O=x*f*l-d*S*l-x*a*m+o*S*m+d*a*w-o*f*w,N=n*E+r*T+i*C+s*O;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/N;return e[0]=E*D,e[1]=(S*m*s-f*w*s-S*i*y+r*w*y+f*i*_-r*m*_)*D,e[2]=(a*w*s-S*l*s+S*i*c-r*w*c-a*i*_+r*l*_)*D,e[3]=(f*l*s-a*m*s-f*i*c+r*m*c+a*i*y-r*l*y)*D,e[4]=T*D,e[5]=(d*w*s-x*m*s+x*i*y-n*w*y-d*i*_+n*m*_)*D,e[6]=(x*l*s-o*w*s-x*i*c+n*w*c+o*i*_-n*l*_)*D,e[7]=(o*m*s-d*l*s+d*i*c-n*m*c-o*i*y+n*l*y)*D,e[8]=C*D,e[9]=(x*f*s-d*S*s-x*r*y+n*S*y+d*r*_-n*f*_)*D,e[10]=(o*S*s-x*a*s+x*r*c-n*S*c-o*r*_+n*a*_)*D,e[11]=(d*a*s-o*f*s-d*r*c+n*f*c+o*r*y-n*a*y)*D,e[12]=O*D,e[13]=(d*S*i-x*f*i+x*r*m-n*S*m-d*r*w+n*f*w)*D,e[14]=(x*a*i-o*S*i-x*r*l+n*S*l+o*r*w-n*a*w)*D,e[15]=(o*f*i-d*a*i+d*r*l-n*f*l-o*r*m+n*a*m)*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,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,d*a+r,d*l-i*o,0,c*l-i*a,d*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,d=o+o,f=a+a,m=s*c,y=s*d,x=s*f,S=o*d,w=o*f,_=a*f,E=l*c,T=l*d,C=l*f,O=r.x,N=r.y,D=r.z;return i[0]=(1-(S+_))*O,i[1]=(y+C)*O,i[2]=(x-T)*O,i[3]=0,i[4]=(y-C)*N,i[5]=(1-(m+_))*N,i[6]=(w+E)*N,i[7]=0,i[8]=(x+T)*D,i[9]=(w-E)*D,i[10]=(1-(m+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 o=vm.set(i[4],i[5],i[6]).length(),a=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],Ra.copy(this);const c=1/s,d=1/o,f=1/a;return Ra.elements[0]*=c,Ra.elements[1]*=c,Ra.elements[2]*=c,Ra.elements[4]*=d,Ra.elements[5]*=d,Ra.elements[6]*=d,Ra.elements[8]*=f,Ra.elements[9]*=f,Ra.elements[10]*=f,n.setFromRotationMatrix(Ra),r.x=s,r.y=o,r.z=a,this}makePerspective(e,n,r,i,s,o,a=Ml){const l=this.elements,c=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),m=(r+i)/(r-i);let y,x;if(a===Ml)y=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===Ny)y=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=m,l[13]=0,l[2]=0,l[6]=0,l[10]=y,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,s,o,a=Ml){const l=this.elements,c=1/(n-e),d=1/(r-i),f=1/(o-s),m=(n+e)*c,y=(r+i)*d;let x,S;if(a===Ml)x=(o+s)*f,S=-2*f;else if(a===Ny)x=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-m,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-y,l[2]=0,l[6]=0,l[10]=S,l[14]=-x,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const vm=new X,Ra=new Rt,Zhe=new X(0,0,0),Qhe=new X(1,1,1),Yu=new X,Hb=new X,ho=new X,$3=new Rt,X3=new Kt;class as{constructor(e=0,n=0,r=0,i=as.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],d=i[9],f=i[2],m=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Ar(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ar(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,y),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ar(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-f,y),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ar(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(m,y),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Ar(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,y));break;case"XZY":this._z=Math.asin(-Ar(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,y),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return $3.makeRotationFromQuaternion(e),this.setFromRotationMatrix($3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return X3.setFromEuler(this),this.setFromQuaternion(X3,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}}as.DEFAULT_ORDER="XYZ";class Ah{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let r=0;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),m.length>0&&(r.skeletons=m),y.length>0&&(r.animations=y),x.length>0&&(r.nodes=x)}return r.object=i,r;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){Na.subVectors(i,n),Tc.subVectors(r,n),iA.subVectors(e,n);const o=Na.dot(Na),a=Na.dot(Tc),l=Na.dot(iA),c=Tc.dot(Tc),d=Tc.dot(iA),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const m=1/f,y=(c*l-a*d)*m,x=(o*d-a*l)*m;return s.set(1-y-x,x,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Cc)===null?!1:Cc.x>=0&&Cc.y>=0&&Cc.x+Cc.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,Cc)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Cc.x),l.addScaledVector(o,Cc.y),l.addScaledVector(a,Cc.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return lA.setScalar(0),cA.setScalar(0),uA.setScalar(0),lA.fromBufferAttribute(e,n),cA.fromBufferAttribute(e,r),uA.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(lA,s.x),o.addScaledVector(cA,s.y),o.addScaledVector(uA,s.z),o}static isFrontFacing(e,n,r,i){return Na.subVectors(r,n),Tc.subVectors(e,n),Na.cross(Tc).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Na.subVectors(this.c,this.b),Tc.subVectors(this.a,this.b),Na.cross(Tc).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 o,a;bm.subVectors(i,r),_m.subVectors(s,r),sA.subVectors(e,r);const l=bm.dot(sA),c=_m.dot(sA);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 m=l*f-d*c;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),n.copy(r).addScaledVector(bm,o);aA.subVectors(e,s);const y=bm.dot(aA),x=_m.dot(aA);if(x>=0&&y<=x)return n.copy(s);const S=y*c-l*x;if(S<=0&&c>=0&&x<=0)return a=c/(c-x),n.copy(r).addScaledVector(_m,a);const w=d*x-y*f;if(w<=0&&f-d>=0&&y-x>=0)return J3.subVectors(s,i),a=(f-d)/(f-d+(y-x)),n.copy(i).addScaledVector(J3,a);const _=1/(w+S+m);return o=S*_,a=m*_,n.copy(r).addScaledVector(bm,o).addScaledVector(_m,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const a6={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Zu={h:0,s:0,l:0},Gb={h:0,s:0,l:0};function dA(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=Ui){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,In.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=In.workingColorSpace){return this.r=e,this.g=n,this.b=r,In.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=In.workingColorSpace){if(e=SR(e,1),n=Ar(n,0,1),r=Ar(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=dA(o,s,e+1/3),this.g=dA(o,s,e),this.b=dA(o,s,e-1/3)}return In.toWorkingColorSpace(this,i),this}setStyle(e,n=Ui){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Ui){const r=a6[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ig(e.r),this.g=ig(e.g),this.b=ig(e.b),this}copyLinearToSRGB(e){return this.r=KE(e.r),this.g=KE(e.g),this.b=KE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ui){return In.fromWorkingColorSpace(Ji.copy(this),e),Math.round(Ar(Ji.r*255,0,255))*65536+Math.round(Ar(Ji.g*255,0,255))*256+Math.round(Ar(Ji.b*255,0,255))}getHexString(e=Ui){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=In.workingColorSpace){In.fromWorkingColorSpace(Ji.copy(this),n);const r=Ji.r,i=Ji.g,s=Ji.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=d<=.5?f/(o+a):f/(2-o-a),o){case r:l=(i-s)/f+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Sh&&(r.blending=this.blending),this.side!==Ul&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==Qw&&(r.blendSrc=this.blendSrc),this.blendDst!==Jw&&(r.blendDst=this.blendDst),this.blendEquation!==ud&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==jh&&(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!==$C&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Kf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Kf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Kf&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(n){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class 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 as,this.combine=ox,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Uc=ipe();function ipe(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function $s(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Ar(t,-65504,65504),Uc.floatView[0]=t;const e=Uc.uint32View[0],n=e>>23&511;return Uc.baseTable[n]+((e&8388607)>>Uc.shiftTable[n])}function B0(t){const e=t>>10;return Uc.uint32View[0]=Uc.mantissaTable[Uc.offsetTable[e]+(t&1023)]+Uc.exponentTable[e],Uc.floatView[0]}const spe={toHalfFloat:$s,fromHalfFloat:B0},Hr=new X,Wb=new Ve;class Jt{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=Ry,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,m=c.length;f0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let m=0,y=f.length;m0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(eD.copy(s).invert(),Pf.copy(e.ray).applyMatrix4(eD),!(r.boundingBox!==null&&Pf.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Pf)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,m=s.groups,y=s.drawRange;if(a!==null)if(Array.isArray(o))for(let x=0,S=m.length;xn.far?null:{distance:c,point:Zb.clone(),object:t}}function Qb(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,Xb),t.getVertexPosition(l,qb),t.getVertexPosition(c,Kb);const d=hpe(t,e,n,r,Xb,qb,Kb,nD);if(d){const f=new X;Ks.getBarycoord(nD,Xb,qb,Kb,f),i&&(d.uv=Ks.getInterpolatedAttribute(i,a,l,c,f,new Ve)),s&&(d.uv1=Ks.getInterpolatedAttribute(s,a,l,c,f,new Ve)),o&&(d.normal=Ks.getInterpolatedAttribute(o,a,l,c,f,new X),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const m={a,b:l,c,normal:new X,materialIndex:0};Ks.getNormal(Xb,qb,Kb,m.normal),d.face=m,d.barycoord=f}return d}class ep extends Qt{constructor(e=1,n=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],f=[];let m=0,y=0;x("z","y","x",-1,-1,r,n,e,o,s,0),x("z","y","x",1,-1,r,n,-e,o,s,1),x("x","z","y",1,1,e,r,n,i,o,2),x("x","z","y",1,-1,e,r,-n,i,o,3),x("x","y","z",1,-1,e,n,r,i,s,4),x("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new Lt(c,3)),this.setAttribute("normal",new Lt(d,3)),this.setAttribute("uv",new Lt(f,2));function x(S,w,_,E,T,C,O,N,D,F,V){const k=C/D,U=O/F,H=C/2,ne=O/2,te=N/2,he=D+1,oe=F+1;let fe=0,B=0;const q=new X;for(let K=0;K0?1:-1,d.push(q.x,q.y,q.z),f.push(Z/D),f.push(1-K/F),fe+=1}}for(let K=0;K>8&255]+Qi[t>>16&255]+Qi[t>>24&255]+"-"+Qi[e&255]+Qi[e>>8&255]+"-"+Qi[e>>16&15|64]+Qi[e>>24&255]+"-"+Qi[n&63|128]+Qi[n>>8&255]+"-"+Qi[n>>16&255]+Qi[n>>24&255]+Qi[r&255]+Qi[r>>8&255]+Qi[r>>16&255]+Qi[r>>24&255]).toLowerCase()}function Ar(t,e,n){return Math.max(e,Math.min(n,t))}function MR(t,e){return(t%e+e)%e}function Ahe(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function The(t,e,n){return t!==e?(n-t)/(e-t):0}function ty(t,e,n){return(1-n)*t+n*e}function Che(t,e,n,r){return ty(t,e,1-Math.exp(-n*r))}function Phe(t,e=1){return e-Math.abs(MR(t,e*2)-e)}function Rhe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function Nhe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Ihe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function khe(t,e){return t+Math.random()*(e-t)}function Ohe(t){return t*(.5-Math.random())}function Lhe(t){t!==void 0&&(H3=t);let e=H3+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Dhe(t){return t*Eh}function jhe(t){return t*jg}function Uhe(t){return(t&t-1)===0&&t!==0}function Fhe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function zhe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Bhe(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),d=o((e+r)/2),f=s((e-r)/2),m=o((e-r)/2),y=s((r-e)/2),x=o((r-e)/2);switch(i){case"XYX":t.set(a*d,l*f,l*m,a*c);break;case"YZY":t.set(l*m,a*d,l*f,a*c);break;case"ZXZ":t.set(l*f,l*m,a*d,a*c);break;case"XZX":t.set(a*d,l*x,l*y,a*c);break;case"YXY":t.set(l*y,a*d,l*x,a*c);break;case"ZYZ":t.set(l*x,l*y,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function 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 gr={DEG2RAD:Eh,RAD2DEG:jg,generateUUID:So,clamp:Ar,euclideanModulo:MR,mapLinear:Ahe,inverseLerp:The,lerp:ty,damp:Che,pingpong:Phe,smoothstep:Rhe,smootherstep:Nhe,randInt:Ihe,randFloat:khe,randFloatSpread:Ohe,seededRandom:Lhe,degToRad:Dhe,radToDeg:jhe,isPowerOfTwo:Uhe,ceilPowerOfTwo:Fhe,floorPowerOfTwo:zhe,setQuaternionFromProperEuler:Bhe,normalize:cn,denormalize:Ss};class Ge{constructor(e=0,n=0){Ge.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(Ar(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class qt{constructor(e,n,r,i,s,o,a,l,c){qt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c)}set(e,n,r,i,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=r,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],d=r[4],f=r[7],m=r[2],y=r[5],x=r[8],S=i[0],w=i[3],_=i[6],E=i[1],T=i[4],C=i[7],O=i[2],N=i[5],D=i[8];return s[0]=o*S+a*E+l*O,s[3]=o*w+a*T+l*N,s[6]=o*_+a*C+l*D,s[1]=c*S+d*E+f*O,s[4]=c*w+d*T+f*N,s[7]=c*_+d*C+f*D,s[2]=m*S+y*E+x*O,s[5]=m*w+y*T+x*N,s[8]=m*_+y*C+x*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],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return n*o*d-n*a*c-r*s*d+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=d*o-a*c,m=a*l-d*s,y=c*s-o*l,x=n*f+r*m+i*y;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=f*S,e[1]=(i*c-d*r)*S,e[2]=(a*r-i*o)*S,e[3]=m*S,e[4]=(d*n-i*l)*S,e[5]=(i*s-a*n)*S,e[6]=y*S,e[7]=(r*l-c*n)*S,e[8]=(o*n-r*s)*S,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(KE.makeScale(e,n)),this}rotate(e){return this.premultiply(KE.makeRotation(-e)),this}translate(e,n){return this.premultiply(KE.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const KE=new qt;function i6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Hhe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Xm(t,e){return new Hhe[t](e)}function Oy(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function s6(){const t=Oy("canvas");return t.style.display="block",t}const V3={};function X_(t){t in V3||(V3[t]=!0,console.warn(t))}function Vhe(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 Ghe(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 Whe(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const G3=new qt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),W3=new qt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),v0={[xi]:{transfer:Py,primaries:Ry,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[Ui]:{transfer:Jn,primaries:Ry,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[ux]:{transfer:Py,primaries:Ny,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(W3),fromReference:t=>t.applyMatrix3(G3)},[QS]:{transfer:Jn,primaries:Ny,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(W3),fromReference:t=>t.applyMatrix3(G3).convertLinearToSRGB()}},$he=new Set([xi,ux]),In={enabled:!0,_workingColorSpace:xi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!$he.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const r=v0[e].toReference,i=v0[n].fromReference;return i(r(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return v0[t].primaries},getTransfer:function(t){return t===jc?Py:v0[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(v0[e].luminanceCoefficients)}};function ig(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function YE(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let hm;class o6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{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 o=0;o0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==VS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Pd:e.x=e.x-Math.floor(e.x);break;case _o:e.x=e.x<0?0:1;break;case kg:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Pd:e.y=e.y-Math.floor(e.y);break;case _o:e.y=e.y<0?0:1;break;case kg:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}dr.DEFAULT_IMAGE=null;dr.DEFAULT_MAPPING=VS;dr.DEFAULT_ANISOTROPY=1;class Ln{constructor(e=0,n=0,r=0,i=1){Ln.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*n+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],d=l[4],f=l[8],m=l[1],y=l[5],x=l[9],S=l[2],w=l[6],_=l[10];if(Math.abs(d-m)<.01&&Math.abs(f-S)<.01&&Math.abs(x-w)<.01){if(Math.abs(d+m)<.1&&Math.abs(f+S)<.1&&Math.abs(x+w)<.1&&Math.abs(c+y+_-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const T=(c+1)/2,C=(y+1)/2,O=(_+1)/2,N=(d+m)/4,D=(f+S)/4,F=(x+w)/4;return T>C&&T>O?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=N/r,s=D/r):C>O?C<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(C),r=N/i,s=F/i):O<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(O),r=D/s,i=F/s),this.set(r,i,s,n),this}let E=Math.sqrt((w-x)*(w-x)+(f-S)*(f-S)+(m-d)*(m-d));return Math.abs(E)<.001&&(E=1),this.x=(w-x)/E,this.y=(f-S)/E,this.z=(m-d)/E,this.w=Math.acos((c+y+_-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class a6 extends Vl{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new Ln(0,0,e,n),this.scissorTest=!1,this.viewport=new Ln(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 dr(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a=0?1:-1,T=1-_*_;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,_*E);w=Math.sin(w*N)/O,a=Math.sin(a*N)/O}const C=a*E;if(l=l*w+m*C,c=c*w+y*C,d=d*w+x*C,f=f*w+S*C,w===1-a){const O=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=O,c*=O,d*=O,f*=O}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],d=r[i+3],f=s[o],m=s[o+1],y=s[o+2],x=s[o+3];return e[n]=a*x+d*f+l*y-c*m,e[n+1]=l*x+d*m+c*f-a*y,e[n+2]=c*x+d*y+a*m-l*f,e[n+3]=d*x-a*f-l*m-c*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),d=a(i/2),f=a(s/2),m=l(r/2),y=l(i/2),x=l(s/2);switch(o){case"XYZ":this._x=m*d*f+c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f-m*y*x;break;case"YXZ":this._x=m*d*f+c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f+m*y*x;break;case"ZXY":this._x=m*d*f-c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f-m*y*x;break;case"ZYX":this._x=m*d*f-c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f+m*y*x;break;case"YZX":this._x=m*d*f+c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f-m*y*x;break;case"XZY":this._x=m*d*f-c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f+m*y*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],s=n[8],o=n[1],a=n[5],l=n[9],c=n[2],d=n[6],f=n[10],m=r+a+f;if(m>0){const y=.5/Math.sqrt(m+1);this._w=.25/y,this._x=(d-l)*y,this._y=(s-c)*y,this._z=(o-i)*y}else if(r>a&&r>f){const y=2*Math.sqrt(1+r-a-f);this._w=(d-l)/y,this._x=.25*y,this._y=(i+o)/y,this._z=(s+c)/y}else if(a>f){const y=2*Math.sqrt(1+a-r-f);this._w=(s-c)/y,this._x=(i+o)/y,this._y=.25*y,this._z=(l+d)/y}else{const y=2*Math.sqrt(1+f-r-a);this._w=(o-i)/y,this._x=(s+c)/y,this._y=(l+d)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ar(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,s=e._z,o=e._w,a=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+o*a+i*c-s*l,this._y=i*d+o*l+s*a-r*c,this._z=s*d+o*c+r*l-i*a,this._w=o*d-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const y=1-n;return this._w=y*o+n*this._w,this._x=y*r+n*this._x,this._y=y*i+n*this._y,this._z=y*s+n*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),f=Math.sin((1-n)*d)/c,m=Math.sin(n*d)/c;return this._w=o*f+this._w*m,this._x=r*f+this._x*m,this._y=i*f+this._y*m,this._z=s*f+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class X{constructor(e=0,n=0,r=0){X.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion($3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion($3.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),d=2*(a*n-s*i),f=2*(s*r-o*n);return this.x=n+l*c+o*f-a*d,this.y=r+l*d+a*c-s*f,this.z=i+l*f+s*d-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,o=n.x,a=n.y,l=n.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return QE.copy(this).projectOnVector(e),this.sub(QE)}reflect(e){return this.sub(QE.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Ar(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const QE=new X,$3=new Kt;class os{constructor(e=new X(1/0,1/0,1/0),n=new X(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Pa),Pa.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(y0),zb.subVectors(this.max,y0),pm.subVectors(e.a,y0),mm.subVectors(e.b,y0),gm.subVectors(e.c,y0),Xu.subVectors(mm,pm),qu.subVectors(gm,mm),Tf.subVectors(pm,gm);let n=[0,-Xu.z,Xu.y,0,-qu.z,qu.y,0,-Tf.z,Tf.y,Xu.z,0,-Xu.x,qu.z,0,-qu.x,Tf.z,0,-Tf.x,-Xu.y,Xu.x,0,-qu.y,qu.x,0,-Tf.y,Tf.x,0];return!JE(n,pm,mm,gm,zb)||(n=[1,0,0,0,1,0,0,0,1],!JE(n,pm,mm,gm,zb))?!1:(Bb.crossVectors(Xu,qu),n=[Bb.x,Bb.y,Bb.z],JE(n,pm,mm,gm,zb))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pa).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Pa).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Mc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Mc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Mc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Mc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Mc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Mc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Mc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Mc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Mc),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Mc=[new X,new X,new X,new X,new X,new X,new X,new X],Pa=new X,Fb=new os,pm=new X,mm=new X,gm=new X,Xu=new X,qu=new X,Tf=new X,y0=new X,zb=new X,Bb=new X,Cf=new X;function JE(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){Cf.fromArray(t,s);const a=i.x*Math.abs(Cf.x)+i.y*Math.abs(Cf.y)+i.z*Math.abs(Cf.z),l=e.dot(Cf),c=n.dot(Cf),d=r.dot(Cf);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const Zhe=new os,x0=new X,eA=new X;class Bi{constructor(e=new X,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):Zhe.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;x0.subVectors(e,this.center);const n=x0.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(x0,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(eA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(x0.copy(e.center).add(eA)),this.expandByPoint(x0.copy(e.center).sub(eA))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ec=new X,tA=new X,Hb=new X,Ku=new X,nA=new X,Vb=new X,rA=new X;class Jh{constructor(e=new X,n=new X(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ec)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Ec.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Ec.copy(this.origin).addScaledVector(this.direction,n),Ec.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){tA.copy(e).add(n).multiplyScalar(.5),Hb.copy(n).sub(e).normalize(),Ku.copy(this.origin).sub(tA);const s=e.distanceTo(n)*.5,o=-this.direction.dot(Hb),a=Ku.dot(this.direction),l=-Ku.dot(Hb),c=Ku.lengthSq(),d=Math.abs(1-o*o);let f,m,y,x;if(d>0)if(f=o*l-a,m=o*a-l,x=s*d,f>=0)if(m>=-x)if(m<=x){const S=1/d;f*=S,m*=S,y=f*(f+o*m+2*a)+m*(o*f+m+2*l)+c}else m=s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;else m=-s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;else m<=-x?(f=Math.max(0,-(-o*s+a)),m=f>0?-s:Math.min(Math.max(-s,-l),s),y=-f*f+m*(m+2*l)+c):m<=x?(f=0,m=Math.min(Math.max(-s,-l),s),y=m*(m+2*l)+c):(f=Math.max(0,-(o*s+a)),m=f>0?s:Math.min(Math.max(-s,-l),s),y=-f*f+m*(m+2*l)+c);else m=o>0?-s:s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(tA).addScaledVector(Hb,m),y}intersectSphere(e,n){Ec.subVectors(e.center,this.origin);const r=Ec.dot(this.direction),i=Ec.dot(Ec)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,m=this.origin;return c>=0?(r=(e.min.x-m.x)*c,i=(e.max.x-m.x)*c):(r=(e.max.x-m.x)*c,i=(e.min.x-m.x)*c),d>=0?(s=(e.min.y-m.y)*d,o=(e.max.y-m.y)*d):(s=(e.max.y-m.y)*d,o=(e.min.y-m.y)*d),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-m.z)*f,l=(e.max.z-m.z)*f):(a=(e.max.z-m.z)*f,l=(e.min.z-m.z)*f),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Ec)!==null}intersectTriangle(e,n,r,i,s){nA.subVectors(n,e),Vb.subVectors(r,e),rA.crossVectors(nA,Vb);let o=this.direction.dot(rA),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ku.subVectors(this.origin,e);const l=a*this.direction.dot(Vb.crossVectors(Ku,Vb));if(l<0)return null;const c=a*this.direction.dot(nA.cross(Ku));if(c<0||l+c>o)return null;const d=-a*Ku.dot(rA);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Pt{constructor(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,w){Pt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,w)}set(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,w){const _=this.elements;return _[0]=e,_[4]=n,_[8]=r,_[12]=i,_[1]=s,_[5]=o,_[9]=a,_[13]=l,_[2]=c,_[6]=d,_[10]=f,_[14]=m,_[3]=y,_[7]=x,_[11]=S,_[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 Pt().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(),o=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]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const m=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=y+x*c,n[5]=m-S*c,n[9]=-a*l,n[2]=S-m*c,n[6]=x+y*c,n[10]=o*l}else if(e.order==="YXZ"){const m=l*d,y=l*f,x=c*d,S=c*f;n[0]=m+S*a,n[4]=x*a-y,n[8]=o*c,n[1]=o*f,n[5]=o*d,n[9]=-a,n[2]=y*a-x,n[6]=S+m*a,n[10]=o*l}else if(e.order==="ZXY"){const m=l*d,y=l*f,x=c*d,S=c*f;n[0]=m-S*a,n[4]=-o*f,n[8]=x+y*a,n[1]=y+x*a,n[5]=o*d,n[9]=S-m*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const m=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=x*c-y,n[8]=m*c+S,n[1]=l*f,n[5]=S*c+m,n[9]=y*c-x,n[2]=-c,n[6]=a*l,n[10]=o*l}else if(e.order==="YZX"){const m=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=S-m*f,n[8]=x*f+y,n[1]=f,n[5]=o*d,n[9]=-a*d,n[2]=-c*d,n[6]=y*f+x,n[10]=m-S*f}else if(e.order==="XZY"){const m=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=m*f+S,n[5]=o*d,n[9]=y*f-x,n[2]=x*f-y,n[6]=a*d,n[10]=S*f+m}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Qhe,e,Jhe)}lookAt(e,n,r){const i=this.elements;return ho.subVectors(e,n),ho.lengthSq()===0&&(ho.z=1),ho.normalize(),Yu.crossVectors(r,ho),Yu.lengthSq()===0&&(Math.abs(r.z)===1?ho.x+=1e-4:ho.z+=1e-4,ho.normalize(),Yu.crossVectors(r,ho)),Yu.normalize(),Gb.crossVectors(ho,Yu),i[0]=Yu.x,i[4]=Gb.x,i[8]=ho.x,i[1]=Yu.y,i[5]=Gb.y,i[9]=ho.y,i[2]=Yu.z,i[6]=Gb.z,i[10]=ho.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],d=r[1],f=r[5],m=r[9],y=r[13],x=r[2],S=r[6],w=r[10],_=r[14],E=r[3],T=r[7],C=r[11],O=r[15],N=i[0],D=i[4],F=i[8],G=i[12],k=i[1],U=i[5],H=i[9],ne=i[13],te=i[2],he=i[6],se=i[10],fe=i[14],B=i[3],J=i[7],Y=i[11],V=i[15];return s[0]=o*N+a*k+l*te+c*B,s[4]=o*D+a*U+l*he+c*J,s[8]=o*F+a*H+l*se+c*Y,s[12]=o*G+a*ne+l*fe+c*V,s[1]=d*N+f*k+m*te+y*B,s[5]=d*D+f*U+m*he+y*J,s[9]=d*F+f*H+m*se+y*Y,s[13]=d*G+f*ne+m*fe+y*V,s[2]=x*N+S*k+w*te+_*B,s[6]=x*D+S*U+w*he+_*J,s[10]=x*F+S*H+w*se+_*Y,s[14]=x*G+S*ne+w*fe+_*V,s[3]=E*N+T*k+C*te+O*B,s[7]=E*D+T*U+C*he+O*J,s[11]=E*F+T*H+C*se+O*Y,s[15]=E*G+T*ne+C*fe+O*V,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],f=e[6],m=e[10],y=e[14],x=e[3],S=e[7],w=e[11],_=e[15];return x*(+s*l*f-i*c*f-s*a*m+r*c*m+i*a*y-r*l*y)+S*(+n*l*y-n*c*m+s*o*m-i*o*y+i*c*d-s*l*d)+w*(+n*c*f-n*a*y-s*o*f+r*o*y+s*a*d-r*c*d)+_*(-i*a*d-n*l*f+n*a*m+i*o*f-r*o*m+r*l*d)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=e[9],m=e[10],y=e[11],x=e[12],S=e[13],w=e[14],_=e[15],E=f*w*c-S*m*c+S*l*y-a*w*y-f*l*_+a*m*_,T=x*m*c-d*w*c-x*l*y+o*w*y+d*l*_-o*m*_,C=d*S*c-x*f*c+x*a*y-o*S*y-d*a*_+o*f*_,O=x*f*l-d*S*l-x*a*m+o*S*m+d*a*w-o*f*w,N=n*E+r*T+i*C+s*O;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/N;return e[0]=E*D,e[1]=(S*m*s-f*w*s-S*i*y+r*w*y+f*i*_-r*m*_)*D,e[2]=(a*w*s-S*l*s+S*i*c-r*w*c-a*i*_+r*l*_)*D,e[3]=(f*l*s-a*m*s-f*i*c+r*m*c+a*i*y-r*l*y)*D,e[4]=T*D,e[5]=(d*w*s-x*m*s+x*i*y-n*w*y-d*i*_+n*m*_)*D,e[6]=(x*l*s-o*w*s-x*i*c+n*w*c+o*i*_-n*l*_)*D,e[7]=(o*m*s-d*l*s+d*i*c-n*m*c-o*i*y+n*l*y)*D,e[8]=C*D,e[9]=(x*f*s-d*S*s-x*r*y+n*S*y+d*r*_-n*f*_)*D,e[10]=(o*S*s-x*a*s+x*r*c-n*S*c-o*r*_+n*a*_)*D,e[11]=(d*a*s-o*f*s-d*r*c+n*f*c+o*r*y-n*a*y)*D,e[12]=O*D,e[13]=(d*S*i-x*f*i+x*r*m-n*S*m-d*r*w+n*f*w)*D,e[14]=(x*a*i-o*S*i-x*r*l+n*S*l+o*r*w-n*a*w)*D,e[15]=(o*f*i-d*a*i+d*r*l-n*f*l-o*r*m+n*a*m)*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,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,d*a+r,d*l-i*o,0,c*l-i*a,d*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,d=o+o,f=a+a,m=s*c,y=s*d,x=s*f,S=o*d,w=o*f,_=a*f,E=l*c,T=l*d,C=l*f,O=r.x,N=r.y,D=r.z;return i[0]=(1-(S+_))*O,i[1]=(y+C)*O,i[2]=(x-T)*O,i[3]=0,i[4]=(y-C)*N,i[5]=(1-(m+_))*N,i[6]=(w+E)*N,i[7]=0,i[8]=(x+T)*D,i[9]=(w-E)*D,i[10]=(1-(m+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 o=vm.set(i[4],i[5],i[6]).length(),a=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],Ra.copy(this);const c=1/s,d=1/o,f=1/a;return Ra.elements[0]*=c,Ra.elements[1]*=c,Ra.elements[2]*=c,Ra.elements[4]*=d,Ra.elements[5]*=d,Ra.elements[6]*=d,Ra.elements[8]*=f,Ra.elements[9]*=f,Ra.elements[10]*=f,n.setFromRotationMatrix(Ra),r.x=s,r.y=o,r.z=a,this}makePerspective(e,n,r,i,s,o,a=Ml){const l=this.elements,c=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),m=(r+i)/(r-i);let y,x;if(a===Ml)y=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===ky)y=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=m,l[13]=0,l[2]=0,l[6]=0,l[10]=y,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,s,o,a=Ml){const l=this.elements,c=1/(n-e),d=1/(r-i),f=1/(o-s),m=(n+e)*c,y=(r+i)*d;let x,S;if(a===Ml)x=(o+s)*f,S=-2*f;else if(a===ky)x=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-m,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-y,l[2]=0,l[6]=0,l[10]=S,l[14]=-x,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const vm=new X,Ra=new Pt,Qhe=new X(0,0,0),Jhe=new X(1,1,1),Yu=new X,Gb=new X,ho=new X,X3=new Pt,q3=new Kt;class as{constructor(e=0,n=0,r=0,i=as.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],d=i[9],f=i[2],m=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Ar(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ar(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,y),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ar(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-f,y),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ar(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(m,y),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Ar(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,y));break;case"XZY":this._z=Math.asin(-Ar(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,y),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return X3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(X3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return q3.setFromEuler(this),this.setFromQuaternion(q3,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}as.DEFAULT_ORDER="XYZ";class Ah{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let r=0;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),m.length>0&&(r.skeletons=m),y.length>0&&(r.animations=y),x.length>0&&(r.nodes=x)}return r.object=i,r;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){Na.subVectors(i,n),Tc.subVectors(r,n),sA.subVectors(e,n);const o=Na.dot(Na),a=Na.dot(Tc),l=Na.dot(sA),c=Tc.dot(Tc),d=Tc.dot(sA),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const m=1/f,y=(c*l-a*d)*m,x=(o*d-a*l)*m;return s.set(1-y-x,x,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Cc)===null?!1:Cc.x>=0&&Cc.y>=0&&Cc.x+Cc.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,Cc)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Cc.x),l.addScaledVector(o,Cc.y),l.addScaledVector(a,Cc.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return cA.setScalar(0),uA.setScalar(0),dA.setScalar(0),cA.fromBufferAttribute(e,n),uA.fromBufferAttribute(e,r),dA.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(cA,s.x),o.addScaledVector(uA,s.y),o.addScaledVector(dA,s.z),o}static isFrontFacing(e,n,r,i){return Na.subVectors(r,n),Tc.subVectors(e,n),Na.cross(Tc).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Na.subVectors(this.c,this.b),Tc.subVectors(this.a,this.b),Na.cross(Tc).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 o,a;bm.subVectors(i,r),_m.subVectors(s,r),oA.subVectors(e,r);const l=bm.dot(oA),c=_m.dot(oA);if(l<=0&&c<=0)return n.copy(r);aA.subVectors(e,i);const d=bm.dot(aA),f=_m.dot(aA);if(d>=0&&f<=d)return n.copy(i);const m=l*f-d*c;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),n.copy(r).addScaledVector(bm,o);lA.subVectors(e,s);const y=bm.dot(lA),x=_m.dot(lA);if(x>=0&&y<=x)return n.copy(s);const S=y*c-l*x;if(S<=0&&c>=0&&x<=0)return a=c/(c-x),n.copy(r).addScaledVector(_m,a);const w=d*x-y*f;if(w<=0&&f-d>=0&&y-x>=0)return eD.subVectors(s,i),a=(f-d)/(f-d+(y-x)),n.copy(i).addScaledVector(eD,a);const _=1/(w+S+m);return o=S*_,a=m*_,n.copy(r).addScaledVector(bm,o).addScaledVector(_m,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const l6={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Zu={h:0,s:0,l:0},$b={h:0,s:0,l:0};function fA(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class lt{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=Ui){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,In.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=In.workingColorSpace){return this.r=e,this.g=n,this.b=r,In.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=In.workingColorSpace){if(e=MR(e,1),n=Ar(n,0,1),r=Ar(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=fA(o,s,e+1/3),this.g=fA(o,s,e),this.b=fA(o,s,e-1/3)}return In.toWorkingColorSpace(this,i),this}setStyle(e,n=Ui){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Ui){const r=l6[e.toLowerCase()];return r!==void 0?this.setHex(r,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ig(e.r),this.g=ig(e.g),this.b=ig(e.b),this}copyLinearToSRGB(e){return this.r=YE(e.r),this.g=YE(e.g),this.b=YE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Ui){return In.fromWorkingColorSpace(Ji.copy(this),e),Math.round(Ar(Ji.r*255,0,255))*65536+Math.round(Ar(Ji.g*255,0,255))*256+Math.round(Ar(Ji.b*255,0,255))}getHexString(e=Ui){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=In.workingColorSpace){In.fromWorkingColorSpace(Ji.copy(this),n);const r=Ji.r,i=Ji.g,s=Ji.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=d<=.5?f/(o+a):f/(2-o-a),o){case r:l=(i-s)/f+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Sh&&(r.blending=this.blending),this.side!==Ul&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==Jw&&(r.blendSrc=this.blendSrc),this.blendDst!==e1&&(r.blendDst=this.blendDst),this.blendEquation!==ud&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==jh&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==XC&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Kf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Kf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Kf&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(n){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class As extends Gr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new lt(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 as,this.combine=lx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Uc=spe();function spe(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;(c&8388608)===0;)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:n,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function $s(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Ar(t,-65504,65504),Uc.floatView[0]=t;const e=Uc.uint32View[0],n=e>>23&511;return Uc.baseTable[n]+((e&8388607)>>Uc.shiftTable[n])}function V0(t){const e=t>>10;return Uc.uint32View[0]=Uc.mantissaTable[Uc.offsetTable[e]+(t&1023)]+Uc.exponentTable[e],Uc.floatView[0]}const ope={toHalfFloat:$s,fromHalfFloat:V0},Hr=new X,Xb=new Ge;class Jt{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,m=c.length;f0&&(i[l]=d,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let m=0,y=f.length;m0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(tD.copy(s).invert(),Pf.copy(e.ray).applyMatrix4(tD),!(r.boundingBox!==null&&Pf.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Pf)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,m=s.groups,y=s.drawRange;if(a!==null)if(Array.isArray(o))for(let x=0,S=m.length;xn.far?null:{distance:c,point:Jb.clone(),object:t}}function e_(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,Kb),t.getVertexPosition(l,Yb),t.getVertexPosition(c,Zb);const d=ppe(t,e,n,r,Kb,Yb,Zb,rD);if(d){const f=new X;Ks.getBarycoord(rD,Kb,Yb,Zb,f),i&&(d.uv=Ks.getInterpolatedAttribute(i,a,l,c,f,new Ge)),s&&(d.uv1=Ks.getInterpolatedAttribute(s,a,l,c,f,new Ge)),o&&(d.normal=Ks.getInterpolatedAttribute(o,a,l,c,f,new X),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const m={a,b:l,c,normal:new X,materialIndex:0};Ks.getNormal(Kb,Yb,Zb,m.normal),d.face=m,d.barycoord=f}return d}class ep extends Qt{constructor(e=1,n=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],f=[];let m=0,y=0;x("z","y","x",-1,-1,r,n,e,o,s,0),x("z","y","x",1,-1,r,n,-e,o,s,1),x("x","z","y",1,1,e,r,n,i,o,2),x("x","z","y",1,-1,e,r,-n,i,o,3),x("x","y","z",1,-1,e,n,r,i,s,4),x("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new Ot(c,3)),this.setAttribute("normal",new Ot(d,3)),this.setAttribute("uv",new Ot(f,2));function x(S,w,_,E,T,C,O,N,D,F,G){const k=C/D,U=O/F,H=C/2,ne=O/2,te=N/2,he=D+1,se=F+1;let fe=0,B=0;const J=new X;for(let Y=0;Y0?1:-1,d.push(J.x,J.y,J.z),f.push(q/D),f.push(1-Y/F),fe+=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 cx extends mn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Rt,this.projectionMatrix=new Rt,this.projectionMatrixInverse=new Rt,this.coordinateSystem=Ml}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Qu=new X,rD=new Ve,iD=new Ve;class Tr extends cx{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=jg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Eh*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return jg*2*Math.atan(Math.tan(Eh*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){Qu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z),Qu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z)}getViewSize(e,n){return this.getViewBounds(e,rD,iD),n.subVectors(iD,rD)}setViewOffset(e,n,r,i,s,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Eh*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,n-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Sm=-90,Mm=1;class c6 extends mn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Tr(Sm,Mm,e,n);i.layers=this.layers,this.add(i);const s=new Tr(Sm,Mm,e,n);s.layers=this.layers,this.add(s);const o=new Tr(Sm,Mm,e,n);o.layers=this.layers,this.add(o);const a=new Tr(Sm,Mm,e,n);a.layers=this.layers,this.add(a);const l=new Tr(Sm,Mm,e,n);l.layers=this.layers,this.add(l);const c=new Tr(Sm,Mm,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===Ml)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Ny)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,d]=this.children,f=e.getRenderTarget(),m=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const S=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(n,s),e.setRenderTarget(r,1,i),e.render(n,o),e.setRenderTarget(r,2,i),e.render(n,a),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,c),r.texture.generateMipmaps=S,e.setRenderTarget(r,5,i),e.render(n,d),e.setRenderTarget(f,m,y),e.xr.enabled=x,r.texture.needsPMREMUpdate=!0}}class ux extends dr{constructor(e,n,r,i,s,o,a,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Jc,super(e,n,r,i,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class u6 extends Va{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 ux(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 Qo extends Gr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=gpe,this.fragmentShader=vpe,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=mpe(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?n.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?n.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?n.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?n.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?n.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?n.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?n.uniforms[i]={type:"m4",value:o.toArray()}:n.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class dx extends mn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Pt,this.projectionMatrix=new Pt,this.projectionMatrixInverse=new Pt,this.coordinateSystem=Ml}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Qu=new X,iD=new Ge,sD=new Ge;class Tr extends dx{constructor(e=50,n=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=jg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Eh*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return jg*2*Math.atan(Math.tan(Eh*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){Qu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z),Qu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z)}getViewSize(e,n){return this.getViewBounds(e,iD,sD),n.subVectors(sD,iD)}setViewOffset(e,n,r,i,s,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Eh*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,n-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Sm=-90,Mm=1;class u6 extends mn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Tr(Sm,Mm,e,n);i.layers=this.layers,this.add(i);const s=new Tr(Sm,Mm,e,n);s.layers=this.layers,this.add(s);const o=new Tr(Sm,Mm,e,n);o.layers=this.layers,this.add(o);const a=new Tr(Sm,Mm,e,n);a.layers=this.layers,this.add(a);const l=new Tr(Sm,Mm,e,n);l.layers=this.layers,this.add(l);const c=new Tr(Sm,Mm,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===Ml)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===ky)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,d]=this.children,f=e.getRenderTarget(),m=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const S=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(n,s),e.setRenderTarget(r,1,i),e.render(n,o),e.setRenderTarget(r,2,i),e.render(n,a),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,c),r.texture.generateMipmaps=S,e.setRenderTarget(r,5,i),e.render(n,d),e.setRenderTarget(f,m,y),e.xr.enabled=x,r.texture.needsPMREMUpdate=!0}}class fx extends dr{constructor(e,n,r,i,s,o,a,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Jc,super(e,n,r,i,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class d6 extends Va{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new fx(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter: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; @@ -624,9 +629,9 @@ Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemer gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},i=new ep(5,5,5),s=new Qo({name:"CubemapFromEquirect",uniforms:Ug(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:ss,blending:$c});s.uniforms.tEquirect.value=n;const o=new yr(i,s),a=n.minFilter;return n.minFilter===qo&&(n.minFilter=Cr),new c6(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,r,i);e.setRenderTarget(s)}}const pA=new X,vpe=new X,ype=new qt;class kc{constructor(e=new X(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=pA.subVectors(r,n).cross(vpe.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(pA),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||ype.getNormalMatrix(e),i=this.coplanarPoint(pA).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Rf=new Bi,Jb=new X;class dx{constructor(e=new kc,n=new kc,r=new kc,i=new kc,s=new kc,o=new kc){this.planes=[e,n,r,i,s,o]}set(e,n,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Ml){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],d=i[5],f=i[6],m=i[7],y=i[8],x=i[9],S=i[10],w=i[11],_=i[12],E=i[13],T=i[14],C=i[15];if(r[0].setComponents(l-s,m-c,w-y,C-_).normalize(),r[1].setComponents(l+s,m+c,w+y,C+_).normalize(),r[2].setComponents(l+o,m+d,w+x,C+E).normalize(),r[3].setComponents(l-o,m-d,w-x,C-E).normalize(),r[4].setComponents(l-a,m-f,w-S,C-T).normalize(),n===Ml)r[5].setComponents(l+a,m+f,w+S,C+T).normalize();else if(n===Ny)r[5].setComponents(a,f,S,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Rf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Rf.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Rf)}intersectsSprite(e){return Rf.center.set(0,0,0),Rf.radius=.7071067811865476,Rf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Rf)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)0?e.max.x:e.min.x,Jb.y=i.normal.y>0?e.max.y:e.min.y,Jb.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Jb)<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 d6(){let t=null,e=!1,n=null,r=null;function i(s,o){n(s,o),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function xpe(t){const e=new WeakMap;function n(a,l){const c=a.array,d=a.usage,f=c.byteLength,m=t.createBuffer();t.bindBuffer(l,m),t.bufferData(l,c,d),a.onUploadCallback();let y;if(c instanceof Float32Array)y=t.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?y=t.HALF_FLOAT:y=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)y=t.SHORT;else if(c instanceof Uint32Array)y=t.UNSIGNED_INT;else if(c instanceof Int32Array)y=t.INT;else if(c instanceof Int8Array)y=t.BYTE;else if(c instanceof Uint8Array)y=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)y=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:m,type:y,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function r(a,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,a),f.length===0)t.bufferSubData(c,0,d);else{f.sort((y,x)=>y.start-x.start);let m=0;for(let y=1;y1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const r=n||xpe.getNormalMatrix(e),i=this.coplanarPoint(mA).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Rf=new Bi,t_=new X;class hx{constructor(e=new kc,n=new kc,r=new kc,i=new kc,s=new kc,o=new kc){this.planes=[e,n,r,i,s,o]}set(e,n,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Ml){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],d=i[5],f=i[6],m=i[7],y=i[8],x=i[9],S=i[10],w=i[11],_=i[12],E=i[13],T=i[14],C=i[15];if(r[0].setComponents(l-s,m-c,w-y,C-_).normalize(),r[1].setComponents(l+s,m+c,w+y,C+_).normalize(),r[2].setComponents(l+o,m+d,w+x,C+E).normalize(),r[3].setComponents(l-o,m-d,w-x,C-E).normalize(),r[4].setComponents(l-a,m-f,w-S,C-T).normalize(),n===Ml)r[5].setComponents(l+a,m+f,w+S,C+T).normalize();else if(n===ky)r[5].setComponents(a,f,S,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Rf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Rf.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Rf)}intersectsSprite(e){return Rf.center.set(0,0,0),Rf.radius=.7071067811865476,Rf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Rf)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)0?e.max.x:e.min.x,t_.y=i.normal.y>0?e.max.y:e.min.y,t_.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(t_)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function f6(){let t=null,e=!1,n=null,r=null;function i(s,o){n(s,o),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function bpe(t){const e=new WeakMap;function n(a,l){const c=a.array,d=a.usage,f=c.byteLength,m=t.createBuffer();t.bindBuffer(l,m),t.bufferData(l,c,d),a.onUploadCallback();let y;if(c instanceof Float32Array)y=t.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?y=t.HALF_FLOAT:y=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)y=t.SHORT;else if(c instanceof Uint32Array)y=t.UNSIGNED_INT;else if(c instanceof Int32Array)y=t.INT;else if(c instanceof Int8Array)y=t.BYTE;else if(c instanceof Uint8Array)y=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)y=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:m,type:y,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function r(a,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,a),f.length===0)t.bufferSubData(c,0,d);else{f.sort((y,x)=>y.start-x.start);let m=0;for(let y=1;y 0 +#endif`,Dpe=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; @@ -876,26 +881,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve if ( clipped ) discard; #endif #endif -#endif`,Dpe=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,jpe=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,Upe=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,Fpe=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,Fpe=`#if defined( USE_COLOR_ALPHA ) +#endif`,zpe=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,zpe=`#if defined( USE_COLOR_ALPHA ) +#endif`,Bpe=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,Bpe=`#if defined( USE_COLOR_ALPHA ) +#endif`,Hpe=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; -#endif`,Hpe=`#if defined( USE_COLOR_ALPHA ) +#endif`,Vpe=`#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 ); @@ -909,7 +914,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`,Vpe=`#define PI 3.141592653589793 +#endif`,Gpe=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -983,7 +988,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`,Gpe=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,Wpe=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -1076,7 +1081,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`,Wpe=`vec3 transformedNormal = objectNormal; +#endif`,$pe=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -1105,18 +1110,18 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,$pe=`#ifdef USE_DISPLACEMENTMAP +#endif`,Xpe=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,Xpe=`#ifdef USE_DISPLACEMENTMAP +#endif`,qpe=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,qpe=`#ifdef USE_EMISSIVEMAP +#endif`,Kpe=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,Kpe=`#ifdef USE_EMISSIVEMAP +#endif`,Ype=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,Ype="gl_FragColor = linearToOutputTexel( gl_FragColor );",Zpe=` +#endif`,Zpe="gl_FragColor = linearToOutputTexel( gl_FragColor );",Qpe=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), @@ -1138,7 +1143,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 ); -}`,Qpe=`#ifdef USE_ENVMAP +}`,Jpe=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -1167,7 +1172,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,Jpe=`#ifdef USE_ENVMAP +#endif`,eme=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; @@ -1177,7 +1182,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,eme=`#ifdef USE_ENVMAP +#endif`,tme=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -1188,7 +1193,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,tme=`#ifdef USE_ENVMAP +#endif`,nme=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -1199,7 +1204,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,nme=`#ifdef USE_ENVMAP +#endif`,rme=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -1216,18 +1221,18 @@ vec4 sRGBTransferOETF( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,rme=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; #endif`,ime=`#ifdef USE_FOG - varying float vFogDepth; + vFogDepth = - mvPosition.z; #endif`,sme=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,ome=`#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`,ome=`#ifdef USE_FOG +#endif`,ame=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -1236,7 +1241,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,ame=`#ifdef USE_GRADIENTMAP +#endif`,lme=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -1248,12 +1253,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 -}`,lme=`#ifdef USE_LIGHTMAP +}`,cme=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,cme=`LambertMaterial material; +#endif`,ume=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,ume=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,dme=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -1267,7 +1272,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`,dme=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,fme=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -1383,7 +1388,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,fme=`#ifdef USE_ENVMAP +#endif`,hme=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -1416,8 +1421,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,hme=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,pme=`varying vec3 vViewPosition; +#endif`,pme=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,mme=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -1429,11 +1434,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`,mme=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,gme=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,gme=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,vme=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -1450,7 +1455,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`,vme=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,yme=`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 ); @@ -1536,7 +1541,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`,yme=`struct PhysicalMaterial { +#endif`,xme=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1837,7 +1842,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 ); -}`,xme=` +}`,bme=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1952,7 +1957,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,bme=`#if defined( RE_IndirectDiffuse ) +#endif`,_me=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1971,33 +1976,33 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,_me=`#if defined( RE_IndirectDiffuse ) +#endif`,wme=`#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`,wme=`#if defined( USE_LOGDEPTHBUF ) - gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,Sme=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,Mme=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,Mme=`#ifdef USE_LOGDEPTHBUF +#endif`,Eme=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; -#endif`,Eme=`#ifdef USE_LOGDEPTHBUF +#endif`,Ame=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,Ame=`#ifdef USE_MAP +#endif`,Tme=`#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`,Tme=`#ifdef USE_MAP +#endif`,Cme=`#ifdef USE_MAP uniform sampler2D map; -#endif`,Cme=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,Pme=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -2009,7 +2014,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,Pme=`#if defined( USE_POINTS_UV ) +#endif`,Rme=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -2021,19 +2026,19 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,Rme=`float metalnessFactor = metalness; +#endif`,Nme=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,Nme=`#ifdef USE_METALNESSMAP +#endif`,Ime=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,Ime=`#ifdef USE_INSTANCING_MORPH +#endif`,kme=`#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`,kme=`#if defined( USE_MORPHCOLORS ) +#endif`,Ome=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -2042,12 +2047,12 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,Ome=`#ifdef USE_MORPHNORMALS +#endif`,Lme=`#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`,Lme=`#ifdef USE_MORPHTARGETS +#endif`,Dme=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -2061,12 +2066,12 @@ IncidentLight directLight; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } -#endif`,Dme=`#ifdef USE_MORPHTARGETS +#endif`,jme=`#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`,jme=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,Ume=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -2107,7 +2112,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,Ume=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,Fme=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -2122,12 +2127,6 @@ vec3 nonPerturbedNormal = normal;`,Ume=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,Fme=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif #endif`,zme=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT @@ -2135,12 +2134,18 @@ vec3 nonPerturbedNormal = normal;`,Ume=`#ifdef USE_NORMALMAP_OBJECTSPACE varying vec3 vBitangent; #endif #endif`,Bme=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,Hme=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,Hme=`#ifdef USE_NORMALMAP +#endif`,Vme=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -2162,13 +2167,13 @@ vec3 nonPerturbedNormal = normal;`,Ume=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,Vme=`#ifdef USE_CLEARCOAT +#endif`,Gme=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,Gme=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,Wme=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,Wme=`#ifdef USE_CLEARCOATMAP +#endif`,$me=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -2177,18 +2182,18 @@ vec3 nonPerturbedNormal = normal;`,Ume=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,$me=`#ifdef USE_IRIDESCENCEMAP +#endif`,Xme=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,Xme=`#ifdef OPAQUE +#endif`,qme=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,qme=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Kme=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -2257,9 +2262,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 ); -}`,Kme=`#ifdef PREMULTIPLIED_ALPHA +}`,Yme=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,Yme=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,Zme=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -2267,22 +2272,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,Zme=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,Qme=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,Qme=`#ifdef DITHERING +#endif`,Jme=`#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`,Jme=`float roughnessFactor = roughness; +#endif`,ege=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,ege=`#ifdef USE_ROUGHNESSMAP +#endif`,tge=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,tge=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,nge=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -2468,7 +2473,7 @@ gl_Position = projectionMatrix * mvPosition;`,Zme=`#ifdef DITHERING } return mix( 1.0, shadow, shadowIntensity ); } -#endif`,nge=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,rge=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -2509,7 +2514,7 @@ gl_Position = projectionMatrix * mvPosition;`,Zme=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,rge=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,ige=`#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 @@ -2541,7 +2546,7 @@ gl_Position = projectionMatrix * mvPosition;`,Zme=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,ige=`float getShadowMask() { +#endif`,sge=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -2573,12 +2578,12 @@ gl_Position = projectionMatrix * mvPosition;`,Zme=`#ifdef DITHERING #endif #endif return shadow; -}`,sge=`#ifdef USE_SKINNING +}`,oge=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,oge=`#ifdef USE_SKINNING +#endif`,age=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2593,7 +2598,7 @@ gl_Position = projectionMatrix * mvPosition;`,Zme=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,age=`#ifdef USE_SKINNING +#endif`,lge=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2601,7 +2606,7 @@ gl_Position = projectionMatrix * mvPosition;`,Zme=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,lge=`#ifdef USE_SKINNING +#endif`,cge=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2612,17 +2617,17 @@ gl_Position = projectionMatrix * mvPosition;`,Zme=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,cge=`float specularStrength; +#endif`,uge=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,uge=`#ifdef USE_SPECULARMAP +#endif`,dge=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,dge=`#if defined( TONE_MAPPING ) +#endif`,fge=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,fge=`#ifndef saturate +#endif`,hge=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2719,7 +2724,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; }`,hge=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,pge=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2740,7 +2745,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hge=`#ifdef USE_TRANSMIS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,pge=`#ifdef USE_TRANSMISSION +#endif`,mge=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2871,7 +2876,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hge=`#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`,mge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,gge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2941,7 +2946,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hge=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,gge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,vge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -3035,7 +3040,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hge=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,vge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,yge=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -3106,7 +3111,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hge=`#ifdef USE_TRANSMIS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,yge=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,xge=`#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; @@ -3115,12 +3120,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,hge=`#ifdef USE_TRANSMIS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const xge=`varying vec2 vUv; +#endif`;const bge=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,bge=`uniform sampler2D t2D; +}`,_ge=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -3132,14 +3137,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,_ge=`varying vec3 vWorldDirection; +}`,wge=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,wge=`#ifdef ENVMAP_TYPE_CUBE +}`,Sge=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -3162,14 +3167,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,Sge=`varying vec3 vWorldDirection; +}`,Mge=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Mge=`uniform samplerCube tCube; +}`,Ege=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -3179,7 +3184,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,Ege=`#include +}`,Age=`#include #include #include #include @@ -3206,7 +3211,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,Age=`#if DEPTH_PACKING == 3200 +}`,Tge=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -3240,7 +3245,7 @@ void main() { #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif -}`,Tge=`#define DISTANCE +}`,Cge=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -3267,7 +3272,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,Cge=`#define DISTANCE +}`,Pge=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -3291,13 +3296,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,Pge=`varying vec3 vWorldDirection; +}`,Rge=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,Rge=`uniform sampler2D tEquirect; +}`,Nge=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -3306,7 +3311,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,Nge=`uniform float scale; +}`,Ige=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -3328,7 +3333,7 @@ void main() { #include #include #include -}`,Ige=`uniform vec3 diffuse; +}`,kge=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -3356,7 +3361,7 @@ void main() { #include #include #include -}`,kge=`#include +}`,Oge=`#include #include #include #include @@ -3388,7 +3393,7 @@ void main() { #include #include #include -}`,Oge=`uniform vec3 diffuse; +}`,Lge=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -3436,7 +3441,7 @@ void main() { #include #include #include -}`,Lge=`#define LAMBERT +}`,Dge=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -3475,7 +3480,7 @@ void main() { #include #include #include -}`,Dge=`#define LAMBERT +}`,jge=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3532,7 +3537,7 @@ void main() { #include #include #include -}`,jge=`#define MATCAP +}`,Uge=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3566,7 +3571,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,Uge=`#define MATCAP +}`,Fge=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3612,7 +3617,7 @@ void main() { #include #include #include -}`,Fge=`#define NORMAL +}`,zge=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3645,7 +3650,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,zge=`#define NORMAL +}`,Bge=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3667,7 +3672,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,Bge=`#define PHONG +}`,Hge=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3706,7 +3711,7 @@ void main() { #include #include #include -}`,Hge=`#define PHONG +}`,Vge=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3765,7 +3770,7 @@ void main() { #include #include #include -}`,Vge=`#define STANDARD +}`,Gge=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3808,7 +3813,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,Gge=`#define STANDARD +}`,Wge=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3933,7 +3938,7 @@ void main() { #include #include #include -}`,Wge=`#define TOON +}`,$ge=`#define TOON varying vec3 vViewPosition; #include #include @@ -3970,7 +3975,7 @@ void main() { #include #include #include -}`,$ge=`#define TOON +}`,Xge=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -4023,7 +4028,7 @@ void main() { #include #include #include -}`,Xge=`uniform float size; +}`,qge=`uniform float size; uniform float scale; #include #include @@ -4054,7 +4059,7 @@ void main() { #include #include #include -}`,qge=`uniform vec3 diffuse; +}`,Kge=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -4079,7 +4084,7 @@ void main() { #include #include #include -}`,Kge=`#include +}`,Yge=`#include #include #include #include @@ -4102,7 +4107,7 @@ void main() { #include #include #include -}`,Yge=`uniform vec3 color; +}`,Zge=`uniform vec3 color; uniform float opacity; #include #include @@ -4118,7 +4123,7 @@ void main() { #include #include #include -}`,Zge=`uniform float rotation; +}`,Qge=`uniform float rotation; uniform vec2 center; #include #include @@ -4142,7 +4147,7 @@ void main() { #include #include #include -}`,Qge=`uniform vec3 diffuse; +}`,Jge=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -4167,7 +4172,7 @@ void main() { #include #include #include -}`,hn={alphahash_fragment:bpe,alphahash_pars_fragment:_pe,alphamap_fragment:wpe,alphamap_pars_fragment:Spe,alphatest_fragment:Mpe,alphatest_pars_fragment:Epe,aomap_fragment:Ape,aomap_pars_fragment:Tpe,batching_pars_vertex:Cpe,batching_vertex:Ppe,begin_vertex:Rpe,beginnormal_vertex:Npe,bsdfs:Ipe,iridescence_fragment:kpe,bumpmap_pars_fragment:Ope,clipping_planes_fragment:Lpe,clipping_planes_pars_fragment:Dpe,clipping_planes_pars_vertex:jpe,clipping_planes_vertex:Upe,color_fragment:Fpe,color_pars_fragment:zpe,color_pars_vertex:Bpe,color_vertex:Hpe,common:Vpe,cube_uv_reflection_fragment:Gpe,defaultnormal_vertex:Wpe,displacementmap_pars_vertex:$pe,displacementmap_vertex:Xpe,emissivemap_fragment:qpe,emissivemap_pars_fragment:Kpe,colorspace_fragment:Ype,colorspace_pars_fragment:Zpe,envmap_fragment:Qpe,envmap_common_pars_fragment:Jpe,envmap_pars_fragment:eme,envmap_pars_vertex:tme,envmap_physical_pars_fragment:fme,envmap_vertex:nme,fog_vertex:rme,fog_pars_vertex:ime,fog_fragment:sme,fog_pars_fragment:ome,gradientmap_pars_fragment:ame,lightmap_pars_fragment:lme,lights_lambert_fragment:cme,lights_lambert_pars_fragment:ume,lights_pars_begin:dme,lights_toon_fragment:hme,lights_toon_pars_fragment:pme,lights_phong_fragment:mme,lights_phong_pars_fragment:gme,lights_physical_fragment:vme,lights_physical_pars_fragment:yme,lights_fragment_begin:xme,lights_fragment_maps:bme,lights_fragment_end:_me,logdepthbuf_fragment:wme,logdepthbuf_pars_fragment:Sme,logdepthbuf_pars_vertex:Mme,logdepthbuf_vertex:Eme,map_fragment:Ame,map_pars_fragment:Tme,map_particle_fragment:Cme,map_particle_pars_fragment:Pme,metalnessmap_fragment:Rme,metalnessmap_pars_fragment:Nme,morphinstance_vertex:Ime,morphcolor_vertex:kme,morphnormal_vertex:Ome,morphtarget_pars_vertex:Lme,morphtarget_vertex:Dme,normal_fragment_begin:jme,normal_fragment_maps:Ume,normal_pars_fragment:Fme,normal_pars_vertex:zme,normal_vertex:Bme,normalmap_pars_fragment:Hme,clearcoat_normal_fragment_begin:Vme,clearcoat_normal_fragment_maps:Gme,clearcoat_pars_fragment:Wme,iridescence_pars_fragment:$me,opaque_fragment:Xme,packing:qme,premultiplied_alpha_fragment:Kme,project_vertex:Yme,dithering_fragment:Zme,dithering_pars_fragment:Qme,roughnessmap_fragment:Jme,roughnessmap_pars_fragment:ege,shadowmap_pars_fragment:tge,shadowmap_pars_vertex:nge,shadowmap_vertex:rge,shadowmask_pars_fragment:ige,skinbase_vertex:sge,skinning_pars_vertex:oge,skinning_vertex:age,skinnormal_vertex:lge,specularmap_fragment:cge,specularmap_pars_fragment:uge,tonemapping_fragment:dge,tonemapping_pars_fragment:fge,transmission_fragment:hge,transmission_pars_fragment:pge,uv_pars_fragment:mge,uv_pars_vertex:gge,uv_vertex:vge,worldpos_vertex:yge,background_vert:xge,background_frag:bge,backgroundCube_vert:_ge,backgroundCube_frag:wge,cube_vert:Sge,cube_frag:Mge,depth_vert:Ege,depth_frag:Age,distanceRGBA_vert:Tge,distanceRGBA_frag:Cge,equirect_vert:Pge,equirect_frag:Rge,linedashed_vert:Nge,linedashed_frag:Ige,meshbasic_vert:kge,meshbasic_frag:Oge,meshlambert_vert:Lge,meshlambert_frag:Dge,meshmatcap_vert:jge,meshmatcap_frag:Uge,meshnormal_vert:Fge,meshnormal_frag:zge,meshphong_vert:Bge,meshphong_frag:Hge,meshphysical_vert:Vge,meshphysical_frag:Gge,meshtoon_vert:Wge,meshtoon_frag:$ge,points_vert:Xge,points_frag:qge,shadow_vert:Kge,shadow_frag:Yge,sprite_vert:Zge,sprite_frag:Qge},ht={common:{diffuse:{value:new ct(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qt},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qt}},envmap:{envMap:{value:null},envMapRotation:{value:new qt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qt},normalScale:{value:new Ve(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new 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 qt},alphaTest:{value:0},uvTransform:{value:new qt}},sprite:{diffuse:{value:new ct(16777215)},opacity:{value:1},center:{value:new Ve(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qt},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0}}},Da={basic:{uniforms:_s([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.fog]),vertexShader:hn.meshbasic_vert,fragmentShader:hn.meshbasic_frag},lambert:{uniforms:_s([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new ct(0)}}]),vertexShader:hn.meshlambert_vert,fragmentShader:hn.meshlambert_frag},phong:{uniforms:_s([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new ct(0)},specular:{value:new ct(1118481)},shininess:{value:30}}]),vertexShader:hn.meshphong_vert,fragmentShader:hn.meshphong_frag},standard:{uniforms:_s([ht.common,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.roughnessmap,ht.metalnessmap,ht.fog,ht.lights,{emissive:{value:new ct(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:hn.meshphysical_vert,fragmentShader:hn.meshphysical_frag},toon:{uniforms:_s([ht.common,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.gradientmap,ht.fog,ht.lights,{emissive:{value:new ct(0)}}]),vertexShader:hn.meshtoon_vert,fragmentShader:hn.meshtoon_frag},matcap:{uniforms:_s([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,{matcap:{value:null}}]),vertexShader:hn.meshmatcap_vert,fragmentShader:hn.meshmatcap_frag},points:{uniforms:_s([ht.points,ht.fog]),vertexShader:hn.points_vert,fragmentShader:hn.points_frag},dashed:{uniforms:_s([ht.common,ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hn.linedashed_vert,fragmentShader:hn.linedashed_frag},depth:{uniforms:_s([ht.common,ht.displacementmap]),vertexShader:hn.depth_vert,fragmentShader:hn.depth_frag},normal:{uniforms:_s([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,{opacity:{value:1}}]),vertexShader:hn.meshnormal_vert,fragmentShader:hn.meshnormal_frag},sprite:{uniforms:_s([ht.sprite,ht.fog]),vertexShader:hn.sprite_vert,fragmentShader:hn.sprite_frag},background:{uniforms:{uvTransform:{value:new qt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:hn.background_vert,fragmentShader:hn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qt}},vertexShader:hn.backgroundCube_vert,fragmentShader:hn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:hn.cube_vert,fragmentShader:hn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hn.equirect_vert,fragmentShader:hn.equirect_frag},distanceRGBA:{uniforms:_s([ht.common,ht.displacementmap,{referencePosition:{value:new X},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hn.distanceRGBA_vert,fragmentShader:hn.distanceRGBA_frag},shadow:{uniforms:_s([ht.lights,ht.fog,{color:{value:new ct(0)},opacity:{value:1}}]),vertexShader:hn.shadow_vert,fragmentShader:hn.shadow_frag}};Da.physical={uniforms:_s([Da.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qt},clearcoatNormalScale:{value:new Ve(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qt},sheen:{value:0},sheenColor:{value:new ct(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qt},transmissionSamplerSize:{value:new Ve},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qt},attenuationDistance:{value:0},attenuationColor:{value:new ct(0)},specularColor:{value:new ct(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qt},anisotropyVector:{value:new Ve},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qt}}]),vertexShader:hn.meshphysical_vert,fragmentShader:hn.meshphysical_frag};const e_={r:0,b:0,g:0},Nf=new as,Jge=new Rt;function eve(t,e,n,r,i,s,o){const a=new ct(0);let l=s===!0?0:1,c,d,f=null,m=0,y=null;function x(E){let T=E.isScene===!0?E.background:null;return T&&T.isTexture&&(T=(E.backgroundBlurriness>0?n:e).get(T)),T}function S(E){let T=!1;const C=x(E);C===null?_(a,l):C&&C.isColor&&(_(C,1),T=!0);const O=t.xr.getEnvironmentBlendMode();O==="additive"?r.buffers.color.setClear(0,0,0,1,o):O==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(t.autoClear||T)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function w(E,T){const C=x(T);C&&(C.isCubeTexture||C.mapping===nv)?(d===void 0&&(d=new yr(new ep(1,1,1),new Qo({name:"BackgroundCubeMaterial",uniforms:Ug(Da.backgroundCube.uniforms),vertexShader:Da.backgroundCube.vertexShader,fragmentShader:Da.backgroundCube.fragmentShader,side:ss,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)),Nf.copy(T.backgroundRotation),Nf.x*=-1,Nf.y*=-1,Nf.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(Nf.y*=-1,Nf.z*=-1),d.material.uniforms.envMap.value=C,d.material.uniforms.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(Jge.makeRotationFromEuler(Nf)),d.material.toneMapped=In.getTransfer(C.colorSpace)!==Jn,(f!==C||m!==C.version||y!==t.toneMapping)&&(d.material.needsUpdate=!0,f=C,m=C.version,y=t.toneMapping),d.layers.enableAll(),E.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(c===void 0&&(c=new yr(new iv(2,2),new Qo({name:"BackgroundMaterial",uniforms:Ug(Da.background.uniforms),vertexShader:Da.background.vertexShader,fragmentShader:Da.background.fragmentShader,side:Ul,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=C,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=In.getTransfer(C.colorSpace)!==Jn,C.matrixAutoUpdate===!0&&C.updateMatrix(),c.material.uniforms.uvTransform.value.copy(C.matrix),(f!==C||m!==C.version||y!==t.toneMapping)&&(c.material.needsUpdate=!0,f=C,m=C.version,y=t.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function _(E,T){E.getRGB(e_,l6(t)),r.buffers.color.setClear(e_.r,e_.g,e_.b,T,o)}return{getClearColor:function(){return a},setClearColor:function(E,T=1){a.set(E),l=T,_(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,_(a,l)},render:S,addToRenderList:w}}function tve(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(k,U,H,ne,te){let he=!1;const oe=f(ne,H,U);s!==oe&&(s=oe,c(s.object)),he=y(k,ne,H,te),he&&x(k,ne,H,te),te!==null&&e.update(te,t.ELEMENT_ARRAY_BUFFER),(he||o)&&(o=!1,C(k,U,H,ne),te!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(te).buffer))}function l(){return t.createVertexArray()}function c(k){return t.bindVertexArray(k)}function d(k){return t.deleteVertexArray(k)}function f(k,U,H){const ne=H.wireframe===!0;let te=r[k.id];te===void 0&&(te={},r[k.id]=te);let he=te[U.id];he===void 0&&(he={},te[U.id]=he);let oe=he[ne];return oe===void 0&&(oe=m(l()),he[ne]=oe),oe}function m(k){const U=[],H=[],ne=[];for(let te=0;te=0){const K=te[B];let $=he[B];if($===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&($=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&($=k.instanceColor)),K===void 0||K.attribute!==$||$&&K.data!==$.data)return!0;oe++}return s.attributesNum!==oe||s.index!==ne}function x(k,U,H,ne){const te={},he=U.attributes;let oe=0;const fe=H.getAttributes();for(const B in fe)if(fe[B].location>=0){let K=he[B];K===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(K=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(K=k.instanceColor));const $={};$.attribute=K,K&&K.data&&($.data=K.data),te[B]=$,oe++}s.attributes=te,s.attributesNum=oe,s.index=ne}function S(){const k=s.newAttributes;for(let U=0,H=k.length;U=0){let q=te[fe];if(q===void 0&&(fe==="instanceMatrix"&&k.instanceMatrix&&(q=k.instanceMatrix),fe==="instanceColor"&&k.instanceColor&&(q=k.instanceColor)),q!==void 0){const K=q.normalized,$=q.itemSize,Z=e.get(q);if(Z===void 0)continue;const ge=Z.buffer,le=Z.type,ue=Z.bytesPerElement,_e=le===t.INT||le===t.UNSIGNED_INT||q.gpuType===GS;if(q.isInterleavedBufferAttribute){const Se=q.data,qe=Se.stride,Me=q.offset;if(Se.isInstancedInterleavedBuffer){for(let We=0;We0&&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,m=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(m===!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),x=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=t.getParameter(t.MAX_TEXTURE_SIZE),w=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),_=t.getParameter(t.MAX_VERTEX_ATTRIBS),E=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),T=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),O=x>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:m,maxTextures:y,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:w,maxAttributes:_,maxVertexUniforms:E,maxVaryings:T,maxFragmentUniforms:C,vertexTextures:O,maxSamples:N}}function ive(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new kc,a=new qt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,m){const y=f.length!==0||m||r!==0||i;return i=m,r=f.length,y},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,m){n=d(f,m,0)},this.setState=function(f,m,y){const x=f.clippingPlanes,S=f.clipIntersection,w=f.clipShadows,_=t.get(f);if(!i||x===null||x.length===0||s&&!w)s?d(null):c();else{const E=s?0:r,T=E*4;let C=_.clippingState||null;l.value=C,C=d(x,m,T,y);for(let O=0;O!==T;++O)C[O]=n[O];_.clippingState=C,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(f,m,y,x){const S=f!==null?f.length:0;let w=null;if(S!==0){if(w=l.value,x!==!0||w===null){const _=y+S*4,E=m.matrixWorldInverse;a.getNormalMatrix(E),(w===null||w.length<_)&&(w=new Float32Array(_));for(let T=0,C=y;T!==S;++T,C+=4)o.copy(f[T]).applyMatrix4(E,a),o.normal.toArray(w,C),w[C+3]=o.constant}l.value=w,l.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,w}}function sve(t){let e=new WeakMap;function n(o,a){return a===My?o.mapping=Jc:a===Ey&&(o.mapping=Cd),o}function r(o){if(o&&o.isTexture){const a=o.mapping;if(a===My||a===Ey)if(e.has(o)){const l=e.get(o).texture;return n(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new u6(l.height);return c.fromEquirectangularTexture(t,o),e.set(o,c),o.addEventListener("dispose",i),n(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Xc extends cx{constructor(e=-1,n=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const qm=4,sD=[.125,.215,.35,.446,.526,.582],Zf=20,mA=new Xc,oD=new ct;let gA=null,vA=0,yA=0,xA=!1;const Yf=(1+Math.sqrt(5))/2,Em=1/Yf,aD=[new X(-Yf,Em,0),new X(Yf,Em,0),new X(-Em,0,Yf),new X(Em,0,Yf),new X(0,Yf,-Em),new X(0,Yf,Em),new X(-1,1,-1),new X(1,1,-1),new X(-1,1,1),new X(1,1,1)];class qC{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){gA=this._renderer.getRenderTarget(),vA=this._renderer.getActiveCubeFace(),yA=this._renderer.getActiveMipmapLevel(),xA=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=uD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=cD(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?T:0,T,T),d.setRenderTarget(i),S&&d.render(x,a),d.render(e,a)}x.geometry.dispose(),x.material.dispose(),d.toneMapping=m,d.autoClear=f,e.background=w}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===Jc||e.mapping===Cd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=uD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=cD());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new yr(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;t_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,mA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;sZf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${Zf}`);const _=[];let E=0;for(let D=0;DT-qm?i-T+qm:0),N=4*(this._cubeSize-C);t_(n,O,N,3*C,2*C),l.setRenderTarget(n),l.render(f,mA)}}function ove(t){const e=[],n=[],r=[];let i=t;const s=t-qm+1+sD.length;for(let o=0;ot-qm?l=sD[o-t+qm-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),d=-c,f=1+c,m=[d,d,f,d,f,f,d,d,f,f,d,f],y=6,x=6,S=3,w=2,_=1,E=new Float32Array(S*x*y),T=new Float32Array(w*x*y),C=new Float32Array(_*x*y);for(let N=0;N2?0:-1,V=[D,F,0,D+2/3,F,0,D+2/3,F+1,0,D,F,0,D+2/3,F+1,0,D,F+1,0];E.set(V,S*x*N),T.set(m,w*x*N);const k=[N,N,N,N,N,N];C.set(k,_*x*N)}const O=new Qt;O.setAttribute("position",new Jt(E,S)),O.setAttribute("uv",new Jt(T,w)),O.setAttribute("faceIndex",new Jt(C,_)),e.push(O),i>qm&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function lD(t,e,n){const r=new Va(t,e,n);return r.texture.mapping=nv,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function t_(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function ave(t,e,n){const r=new Float32Array(Zf),i=new X(0,1,0);return new Qo({name:"SphericalGaussianBlur",defines:{n:Zf,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:CR(),fragmentShader:` +}`,hn={alphahash_fragment:_pe,alphahash_pars_fragment:wpe,alphamap_fragment:Spe,alphamap_pars_fragment:Mpe,alphatest_fragment:Epe,alphatest_pars_fragment:Ape,aomap_fragment:Tpe,aomap_pars_fragment:Cpe,batching_pars_vertex:Ppe,batching_vertex:Rpe,begin_vertex:Npe,beginnormal_vertex:Ipe,bsdfs:kpe,iridescence_fragment:Ope,bumpmap_pars_fragment:Lpe,clipping_planes_fragment:Dpe,clipping_planes_pars_fragment:jpe,clipping_planes_pars_vertex:Upe,clipping_planes_vertex:Fpe,color_fragment:zpe,color_pars_fragment:Bpe,color_pars_vertex:Hpe,color_vertex:Vpe,common:Gpe,cube_uv_reflection_fragment:Wpe,defaultnormal_vertex:$pe,displacementmap_pars_vertex:Xpe,displacementmap_vertex:qpe,emissivemap_fragment:Kpe,emissivemap_pars_fragment:Ype,colorspace_fragment:Zpe,colorspace_pars_fragment:Qpe,envmap_fragment:Jpe,envmap_common_pars_fragment:eme,envmap_pars_fragment:tme,envmap_pars_vertex:nme,envmap_physical_pars_fragment:hme,envmap_vertex:rme,fog_vertex:ime,fog_pars_vertex:sme,fog_fragment:ome,fog_pars_fragment:ame,gradientmap_pars_fragment:lme,lightmap_pars_fragment:cme,lights_lambert_fragment:ume,lights_lambert_pars_fragment:dme,lights_pars_begin:fme,lights_toon_fragment:pme,lights_toon_pars_fragment:mme,lights_phong_fragment:gme,lights_phong_pars_fragment:vme,lights_physical_fragment:yme,lights_physical_pars_fragment:xme,lights_fragment_begin:bme,lights_fragment_maps:_me,lights_fragment_end:wme,logdepthbuf_fragment:Sme,logdepthbuf_pars_fragment:Mme,logdepthbuf_pars_vertex:Eme,logdepthbuf_vertex:Ame,map_fragment:Tme,map_pars_fragment:Cme,map_particle_fragment:Pme,map_particle_pars_fragment:Rme,metalnessmap_fragment:Nme,metalnessmap_pars_fragment:Ime,morphinstance_vertex:kme,morphcolor_vertex:Ome,morphnormal_vertex:Lme,morphtarget_pars_vertex:Dme,morphtarget_vertex:jme,normal_fragment_begin:Ume,normal_fragment_maps:Fme,normal_pars_fragment:zme,normal_pars_vertex:Bme,normal_vertex:Hme,normalmap_pars_fragment:Vme,clearcoat_normal_fragment_begin:Gme,clearcoat_normal_fragment_maps:Wme,clearcoat_pars_fragment:$me,iridescence_pars_fragment:Xme,opaque_fragment:qme,packing:Kme,premultiplied_alpha_fragment:Yme,project_vertex:Zme,dithering_fragment:Qme,dithering_pars_fragment:Jme,roughnessmap_fragment:ege,roughnessmap_pars_fragment:tge,shadowmap_pars_fragment:nge,shadowmap_pars_vertex:rge,shadowmap_vertex:ige,shadowmask_pars_fragment:sge,skinbase_vertex:oge,skinning_pars_vertex:age,skinning_vertex:lge,skinnormal_vertex:cge,specularmap_fragment:uge,specularmap_pars_fragment:dge,tonemapping_fragment:fge,tonemapping_pars_fragment:hge,transmission_fragment:pge,transmission_pars_fragment:mge,uv_pars_fragment:gge,uv_pars_vertex:vge,uv_vertex:yge,worldpos_vertex:xge,background_vert:bge,background_frag:_ge,backgroundCube_vert:wge,backgroundCube_frag:Sge,cube_vert:Mge,cube_frag:Ege,depth_vert:Age,depth_frag:Tge,distanceRGBA_vert:Cge,distanceRGBA_frag:Pge,equirect_vert:Rge,equirect_frag:Nge,linedashed_vert:Ige,linedashed_frag:kge,meshbasic_vert:Oge,meshbasic_frag:Lge,meshlambert_vert:Dge,meshlambert_frag:jge,meshmatcap_vert:Uge,meshmatcap_frag:Fge,meshnormal_vert:zge,meshnormal_frag:Bge,meshphong_vert:Hge,meshphong_frag:Vge,meshphysical_vert:Gge,meshphysical_frag:Wge,meshtoon_vert:$ge,meshtoon_frag:Xge,points_vert:qge,points_frag:Kge,shadow_vert:Yge,shadow_frag:Zge,sprite_vert:Qge,sprite_frag:Jge},pt={common:{diffuse:{value:new lt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qt},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qt}},envmap:{envMap:{value:null},envMapRotation:{value:new qt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qt},normalScale:{value:new Ge(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new lt(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 lt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0},uvTransform:{value:new qt}},sprite:{diffuse:{value:new lt(16777215)},opacity:{value:1},center:{value:new Ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qt},alphaMap:{value:null},alphaMapTransform:{value:new qt},alphaTest:{value:0}}},Da={basic:{uniforms:_s([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.fog]),vertexShader:hn.meshbasic_vert,fragmentShader:hn.meshbasic_frag},lambert:{uniforms:_s([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new lt(0)}}]),vertexShader:hn.meshlambert_vert,fragmentShader:hn.meshlambert_frag},phong:{uniforms:_s([pt.common,pt.specularmap,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,pt.lights,{emissive:{value:new lt(0)},specular:{value:new lt(1118481)},shininess:{value:30}}]),vertexShader:hn.meshphong_vert,fragmentShader:hn.meshphong_frag},standard:{uniforms:_s([pt.common,pt.envmap,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.roughnessmap,pt.metalnessmap,pt.fog,pt.lights,{emissive:{value:new lt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:hn.meshphysical_vert,fragmentShader:hn.meshphysical_frag},toon:{uniforms:_s([pt.common,pt.aomap,pt.lightmap,pt.emissivemap,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.gradientmap,pt.fog,pt.lights,{emissive:{value:new lt(0)}}]),vertexShader:hn.meshtoon_vert,fragmentShader:hn.meshtoon_frag},matcap:{uniforms:_s([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,pt.fog,{matcap:{value:null}}]),vertexShader:hn.meshmatcap_vert,fragmentShader:hn.meshmatcap_frag},points:{uniforms:_s([pt.points,pt.fog]),vertexShader:hn.points_vert,fragmentShader:hn.points_frag},dashed:{uniforms:_s([pt.common,pt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hn.linedashed_vert,fragmentShader:hn.linedashed_frag},depth:{uniforms:_s([pt.common,pt.displacementmap]),vertexShader:hn.depth_vert,fragmentShader:hn.depth_frag},normal:{uniforms:_s([pt.common,pt.bumpmap,pt.normalmap,pt.displacementmap,{opacity:{value:1}}]),vertexShader:hn.meshnormal_vert,fragmentShader:hn.meshnormal_frag},sprite:{uniforms:_s([pt.sprite,pt.fog]),vertexShader:hn.sprite_vert,fragmentShader:hn.sprite_frag},background:{uniforms:{uvTransform:{value:new qt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:hn.background_vert,fragmentShader:hn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qt}},vertexShader:hn.backgroundCube_vert,fragmentShader:hn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:hn.cube_vert,fragmentShader:hn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hn.equirect_vert,fragmentShader:hn.equirect_frag},distanceRGBA:{uniforms:_s([pt.common,pt.displacementmap,{referencePosition:{value:new X},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hn.distanceRGBA_vert,fragmentShader:hn.distanceRGBA_frag},shadow:{uniforms:_s([pt.lights,pt.fog,{color:{value:new lt(0)},opacity:{value:1}}]),vertexShader:hn.shadow_vert,fragmentShader:hn.shadow_frag}};Da.physical={uniforms:_s([Da.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qt},clearcoatNormalScale:{value:new Ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qt},sheen:{value:0},sheenColor:{value:new lt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qt},transmissionSamplerSize:{value:new Ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qt},attenuationDistance:{value:0},attenuationColor:{value:new lt(0)},specularColor:{value:new lt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qt},anisotropyVector:{value:new Ge},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qt}}]),vertexShader:hn.meshphysical_vert,fragmentShader:hn.meshphysical_frag};const n_={r:0,b:0,g:0},Nf=new as,eve=new Pt;function tve(t,e,n,r,i,s,o){const a=new lt(0);let l=s===!0?0:1,c,d,f=null,m=0,y=null;function x(E){let T=E.isScene===!0?E.background:null;return T&&T.isTexture&&(T=(E.backgroundBlurriness>0?n:e).get(T)),T}function S(E){let T=!1;const C=x(E);C===null?_(a,l):C&&C.isColor&&(_(C,1),T=!0);const O=t.xr.getEnvironmentBlendMode();O==="additive"?r.buffers.color.setClear(0,0,0,1,o):O==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(t.autoClear||T)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function w(E,T){const C=x(T);C&&(C.isCubeTexture||C.mapping===nv)?(d===void 0&&(d=new yr(new ep(1,1,1),new Qo({name:"BackgroundCubeMaterial",uniforms:Ug(Da.backgroundCube.uniforms),vertexShader:Da.backgroundCube.vertexShader,fragmentShader:Da.backgroundCube.fragmentShader,side:ss,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)),Nf.copy(T.backgroundRotation),Nf.x*=-1,Nf.y*=-1,Nf.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(Nf.y*=-1,Nf.z*=-1),d.material.uniforms.envMap.value=C,d.material.uniforms.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(eve.makeRotationFromEuler(Nf)),d.material.toneMapped=In.getTransfer(C.colorSpace)!==Jn,(f!==C||m!==C.version||y!==t.toneMapping)&&(d.material.needsUpdate=!0,f=C,m=C.version,y=t.toneMapping),d.layers.enableAll(),E.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(c===void 0&&(c=new yr(new iv(2,2),new Qo({name:"BackgroundMaterial",uniforms:Ug(Da.background.uniforms),vertexShader:Da.background.vertexShader,fragmentShader:Da.background.fragmentShader,side:Ul,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=C,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=In.getTransfer(C.colorSpace)!==Jn,C.matrixAutoUpdate===!0&&C.updateMatrix(),c.material.uniforms.uvTransform.value.copy(C.matrix),(f!==C||m!==C.version||y!==t.toneMapping)&&(c.material.needsUpdate=!0,f=C,m=C.version,y=t.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function _(E,T){E.getRGB(n_,c6(t)),r.buffers.color.setClear(n_.r,n_.g,n_.b,T,o)}return{getClearColor:function(){return a},setClearColor:function(E,T=1){a.set(E),l=T,_(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,_(a,l)},render:S,addToRenderList:w}}function nve(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(k,U,H,ne,te){let he=!1;const se=f(ne,H,U);s!==se&&(s=se,c(s.object)),he=y(k,ne,H,te),he&&x(k,ne,H,te),te!==null&&e.update(te,t.ELEMENT_ARRAY_BUFFER),(he||o)&&(o=!1,C(k,U,H,ne),te!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(te).buffer))}function l(){return t.createVertexArray()}function c(k){return t.bindVertexArray(k)}function d(k){return t.deleteVertexArray(k)}function f(k,U,H){const ne=H.wireframe===!0;let te=r[k.id];te===void 0&&(te={},r[k.id]=te);let he=te[U.id];he===void 0&&(he={},te[U.id]=he);let se=he[ne];return se===void 0&&(se=m(l()),he[ne]=se),se}function m(k){const U=[],H=[],ne=[];for(let te=0;te=0){const Y=te[B];let V=he[B];if(V===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(V=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(V=k.instanceColor)),Y===void 0||Y.attribute!==V||V&&Y.data!==V.data)return!0;se++}return s.attributesNum!==se||s.index!==ne}function x(k,U,H,ne){const te={},he=U.attributes;let se=0;const fe=H.getAttributes();for(const B in fe)if(fe[B].location>=0){let Y=he[B];Y===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(Y=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(Y=k.instanceColor));const V={};V.attribute=Y,Y&&Y.data&&(V.data=Y.data),te[B]=V,se++}s.attributes=te,s.attributesNum=se,s.index=ne}function S(){const k=s.newAttributes;for(let U=0,H=k.length;U=0){let J=te[fe];if(J===void 0&&(fe==="instanceMatrix"&&k.instanceMatrix&&(J=k.instanceMatrix),fe==="instanceColor"&&k.instanceColor&&(J=k.instanceColor)),J!==void 0){const Y=J.normalized,V=J.itemSize,q=e.get(J);if(q===void 0)continue;const pe=q.buffer,ae=q.type,le=q.bytesPerElement,be=ae===t.INT||ae===t.UNSIGNED_INT||J.gpuType===WS;if(J.isInterleavedBufferAttribute){const Se=J.data,qe=Se.stride,Me=J.offset;if(Se.isInstancedInterleavedBuffer){for(let $e=0;$e0&&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,m=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(m===!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),x=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=t.getParameter(t.MAX_TEXTURE_SIZE),w=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),_=t.getParameter(t.MAX_VERTEX_ATTRIBS),E=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),T=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),O=x>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:m,maxTextures:y,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:w,maxAttributes:_,maxVertexUniforms:E,maxVaryings:T,maxFragmentUniforms:C,vertexTextures:O,maxSamples:N}}function sve(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new kc,a=new qt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,m){const y=f.length!==0||m||r!==0||i;return i=m,r=f.length,y},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,m){n=d(f,m,0)},this.setState=function(f,m,y){const x=f.clippingPlanes,S=f.clipIntersection,w=f.clipShadows,_=t.get(f);if(!i||x===null||x.length===0||s&&!w)s?d(null):c();else{const E=s?0:r,T=E*4;let C=_.clippingState||null;l.value=C,C=d(x,m,T,y);for(let O=0;O!==T;++O)C[O]=n[O];_.clippingState=C,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(f,m,y,x){const S=f!==null?f.length:0;let w=null;if(S!==0){if(w=l.value,x!==!0||w===null){const _=y+S*4,E=m.matrixWorldInverse;a.getNormalMatrix(E),(w===null||w.length<_)&&(w=new Float32Array(_));for(let T=0,C=y;T!==S;++T,C+=4)o.copy(f[T]).applyMatrix4(E,a),o.normal.toArray(w,C),w[C+3]=o.constant}l.value=w,l.needsUpdate=!0}return e.numPlanes=S,e.numIntersection=0,w}}function ove(t){let e=new WeakMap;function n(o,a){return a===Ay?o.mapping=Jc:a===Ty&&(o.mapping=Cd),o}function r(o){if(o&&o.isTexture){const a=o.mapping;if(a===Ay||a===Ty)if(e.has(o)){const l=e.get(o).texture;return n(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new d6(l.height);return c.fromEquirectangularTexture(t,o),e.set(o,c),o.addEventListener("dispose",i),n(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Xc extends dx{constructor(e=-1,n=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const qm=4,oD=[.125,.215,.35,.446,.526,.582],Zf=20,gA=new Xc,aD=new lt;let vA=null,yA=0,xA=0,bA=!1;const Yf=(1+Math.sqrt(5))/2,Em=1/Yf,lD=[new X(-Yf,Em,0),new X(Yf,Em,0),new X(-Em,0,Yf),new X(Em,0,Yf),new X(0,Yf,-Em),new X(0,Yf,Em),new X(-1,1,-1),new X(1,1,-1),new X(-1,1,1),new X(1,1,1)];class KC{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,r=.1,i=100){vA=this._renderer.getRenderTarget(),yA=this._renderer.getActiveCubeFace(),xA=this._renderer.getActiveMipmapLevel(),bA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=dD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=uD(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?T:0,T,T),d.setRenderTarget(i),S&&d.render(x,a),d.render(e,a)}x.geometry.dispose(),x.material.dispose(),d.toneMapping=m,d.autoClear=f,e.background=w}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===Jc||e.mapping===Cd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=dD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=uD());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new yr(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;r_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,gA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;sZf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${Zf}`);const _=[];let E=0;for(let D=0;DT-qm?i-T+qm:0),N=4*(this._cubeSize-C);r_(n,O,N,3*C,2*C),l.setRenderTarget(n),l.render(f,gA)}}function ave(t){const e=[],n=[],r=[];let i=t;const s=t-qm+1+oD.length;for(let o=0;ot-qm?l=oD[o-t+qm-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),d=-c,f=1+c,m=[d,d,f,d,f,f,d,d,f,f,d,f],y=6,x=6,S=3,w=2,_=1,E=new Float32Array(S*x*y),T=new Float32Array(w*x*y),C=new Float32Array(_*x*y);for(let N=0;N2?0:-1,G=[D,F,0,D+2/3,F,0,D+2/3,F+1,0,D,F,0,D+2/3,F+1,0,D,F+1,0];E.set(G,S*x*N),T.set(m,w*x*N);const k=[N,N,N,N,N,N];C.set(k,_*x*N)}const O=new Qt;O.setAttribute("position",new Jt(E,S)),O.setAttribute("uv",new Jt(T,w)),O.setAttribute("faceIndex",new Jt(C,_)),e.push(O),i>qm&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function cD(t,e,n){const r=new Va(t,e,n);return r.texture.mapping=nv,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function r_(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function lve(t,e,n){const r=new Float32Array(Zf),i=new X(0,1,0);return new Qo({name:"SphericalGaussianBlur",defines:{n:Zf,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; @@ -4227,7 +4232,7 @@ void main() { } } - `,blending:$c,depthTest:!1,depthWrite:!1})}function cD(){return new Qo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:CR(),fragmentShader:` + `,blending:$c,depthTest:!1,depthWrite:!1})}function uD(){return new Qo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:PR(),fragmentShader:` precision mediump float; precision mediump int; @@ -4246,7 +4251,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:$c,depthTest:!1,depthWrite:!1})}function uD(){return new Qo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:CR(),fragmentShader:` + `,blending:$c,depthTest:!1,depthWrite:!1})}function dD(){return new Qo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:PR(),fragmentShader:` precision mediump float; precision mediump int; @@ -4262,7 +4267,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:$c,depthTest:!1,depthWrite:!1})}function CR(){return` + `,blending:$c,depthTest:!1,depthWrite:!1})}function PR(){return` precision mediump float; precision mediump int; @@ -4317,16 +4322,16 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function lve(t){let e=new WeakMap,n=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===My||l===Ey,d=l===Jc||l===Cd;if(c||d){let f=e.get(a);const m=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==m)return n===null&&(n=new qC(t)),f=c?n.fromEquirectangular(a,f):n.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const y=a.image;return c&&y&&y.height>0||d&&y&&i(y)?(n===null&&(n=new qC(t)),f=c?n.fromEquirectangular(a):n.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function i(a){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(O=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const N=new Float32Array(C*O*4*f),D=new QS(N,C,O,f);D.type=Qs,D.needsUpdate=!0;const F=T*4;for(let k=0;k0)return t;const i=e*n;let s=fD[i];if(s===void 0&&(s=new Float32Array(i),fD[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function 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 KC(t)),f=c?n.fromEquirectangular(a):n.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function i(a){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(O=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const N=new Float32Array(C*O*4*f),D=new JS(N,C,O,f);D.type=Qs,D.needsUpdate=!0;const F=T*4;for(let k=0;k0)return t;const i=e*n;let s=hD[i];if(s===void 0&&(s=new Float32Array(i),hD[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function ii(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n":" "} ${a}: ${n[o]}`)}return r.join(` -`)}function l0e(t){const e=In.getPrimaries(In.workingColorSpace),n=In.getPrimaries(t);let r;switch(e===n?r="":e===Py&&n===Cy?r="LinearDisplayP3ToLinearSRGB":e===Cy&&n===Py&&(r="LinearSRGBToLinearDisplayP3"),t){case xi:case lx:return[r,"LinearTransferOETF"];case Ui:case ZS:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function xD(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return n.toUpperCase()+` +`)}function c0e(t){const e=In.getPrimaries(In.workingColorSpace),n=In.getPrimaries(t);let r;switch(e===n?r="":e===Ny&&n===Ry?r="LinearDisplayP3ToLinearSRGB":e===Ry&&n===Ny&&(r="LinearSRGBToLinearDisplayP3"),t){case xi:case ux:return[r,"LinearTransferOETF"];case Ui:case QS:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function bD(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return n.toUpperCase()+` `+i+` -`+a0e(t.getShaderSource(e),o)}else return i}function c0e(t,e){const n=l0e(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function u0e(t,e){let n;switch(e){case LV:n="Linear";break;case DV:n="Reinhard";break;case jV:n="Cineon";break;case uR:n="ACESFilmic";break;case FV:n="AgX";break;case zV:n="Neutral";break;case UV:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const n_=new X;function d0e(){In.getLuminanceCoefficients(n_);const t=n_.x.toFixed(4),e=n_.y.toFixed(4),n=n_.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(` -`)}function f0e(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(H0).join(` -`)}function h0e(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(` -`)}function p0e(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function KC(t){return t.replace(m0e,v0e)}const g0e=new Map;function v0e(t,e){let n=hn[e];if(n===void 0){const r=g0e.get(e);if(r!==void 0)n=hn[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 KC(n)}const y0e=/#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 wD(t){return t.replace(y0e,x0e)}function x0e(t,e,n,r){let i="";for(let s=parseInt(e);s/gm;function YC(t){return t.replace(g0e,y0e)}const v0e=new Map;function y0e(t,e){let n=hn[e];if(n===void 0){const r=v0e.get(e);if(r!==void 0)n=hn[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return YC(n)}const x0e=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function SD(t){return t.replace(x0e,b0e)}function b0e(t,e,n,r){let i="";for(let s=parseInt(e);s0&&(w+=` -`),_=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(H0).join(` +`),_=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(G0).join(` `),_.length>0&&(_+=` -`)):(w=[SD(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(H0).join(` -`),_=[SD(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Pl?"#define TONE_MAPPING":"",n.toneMapping!==Pl?hn.tonemapping_pars_fragment:"",n.toneMapping!==Pl?u0e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",hn.colorspace_pars_fragment,c0e("linearToOutputTexel",n.outputColorSpace),d0e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` -`].filter(H0).join(` -`)),o=KC(o),o=bD(o,n),o=_D(o,n),a=KC(a),a=bD(a,n),a=_D(a,n),o=wD(o),a=wD(a),n.isRawShaderMaterial!==!0&&(E=`#version 300 es +`)):(w=[MD(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(G0).join(` +`),_=[MD(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Pl?"#define TONE_MAPPING":"",n.toneMapping!==Pl?hn.tonemapping_pars_fragment:"",n.toneMapping!==Pl?d0e("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",hn.colorspace_pars_fragment,u0e("linearToOutputTexel",n.outputColorSpace),f0e(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` +`].filter(G0).join(` +`)),o=YC(o),o=_D(o,n),o=wD(o,n),a=YC(a),a=_D(a,n),a=wD(a,n),o=SD(o),a=SD(a),n.isRawShaderMaterial!==!0&&(E=`#version 300 es `,w=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+w,_=["#define varying in",n.glslVersion===XC?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===XC?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`+w,_=["#define varying in",n.glslVersion===qC?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===qC?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` -`+_);const T=E+w+o,C=E+_+a,O=yD(i,i.VERTEX_SHADER,T),N=yD(i,i.FRAGMENT_SHADER,C);i.attachShader(S,O),i.attachShader(S,N),n.index0AttributeName!==void 0?i.bindAttribLocation(S,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(S,0,"position"),i.linkProgram(S);function D(U){if(t.debug.checkShaderErrors){const H=i.getProgramInfoLog(S).trim(),ne=i.getShaderInfoLog(O).trim(),te=i.getShaderInfoLog(N).trim();let he=!0,oe=!0;if(i.getProgramParameter(S,i.LINK_STATUS)===!1)if(he=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,S,O,N);else{const fe=xD(i,O,"vertex"),B=xD(i,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(S,i.VALIDATE_STATUS)+` +`+_);const T=E+w+o,C=E+_+a,O=xD(i,i.VERTEX_SHADER,T),N=xD(i,i.FRAGMENT_SHADER,C);i.attachShader(S,O),i.attachShader(S,N),n.index0AttributeName!==void 0?i.bindAttribLocation(S,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(S,0,"position"),i.linkProgram(S);function D(U){if(t.debug.checkShaderErrors){const H=i.getProgramInfoLog(S).trim(),ne=i.getShaderInfoLog(O).trim(),te=i.getShaderInfoLog(N).trim();let he=!0,se=!0;if(i.getProgramParameter(S,i.LINK_STATUS)===!1)if(he=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,S,O,N);else{const fe=bD(i,O,"vertex"),B=bD(i,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(S,i.VALIDATE_STATUS)+` Material Name: `+U.name+` Material Type: `+U.type+` Program Info Log: `+H+` `+fe+` -`+B)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(ne===""||te==="")&&(oe=!1);oe&&(U.diagnostics={runnable:he,programLog:H,vertexShader:{log:ne,prefix:w},fragmentShader:{log:te,prefix:_}})}i.deleteShader(O),i.deleteShader(N),F=new X_(i,S),V=p0e(i,S)}let F;this.getUniforms=function(){return F===void 0&&D(this),F};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,s0e)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=o0e++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=O,this.fragmentShader=N,this}let A0e=0;class T0e{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new C0e(e),n.set(e,r)),r}}class C0e{constructor(e){this.id=A0e++,this.code=e,this.usedTimes=0}}function P0e(t,e,n,r,i,s,o){const a=new Ah,l=new T0e,c=new Set,d=[],f=i.logarithmicDepthBuffer,m=i.reverseDepthBuffer,y=i.vertexTextures;let x=i.precision;const S={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function w(k){return c.add(k),k===0?"uv":`uv${k}`}function _(k,U,H,ne,te){const he=ne.fog,oe=te.geometry,fe=k.isMeshStandardMaterial?ne.environment:null,B=(k.isMeshStandardMaterial?n:e).get(k.envMap||fe),q=B&&B.mapping===nv?B.image.height:null,K=S[k.type];k.precision!==null&&(x=i.getMaxPrecision(k.precision),x!==k.precision&&console.warn("THREE.WebGLProgram.getParameters:",k.precision,"not supported, using",x,"instead."));const $=oe.morphAttributes.position||oe.morphAttributes.normal||oe.morphAttributes.color,Z=$!==void 0?$.length:0;let ge=0;oe.morphAttributes.position!==void 0&&(ge=1),oe.morphAttributes.normal!==void 0&&(ge=2),oe.morphAttributes.color!==void 0&&(ge=3);let le,ue,_e,Se;if(K){const Hn=Da[K];le=Hn.vertexShader,ue=Hn.fragmentShader}else le=k.vertexShader,ue=k.fragmentShader,l.update(k),_e=l.getVertexShaderID(k),Se=l.getFragmentShaderID(k);const qe=t.getRenderTarget(),Me=te.isInstancedMesh===!0,We=te.isBatchedMesh===!0,Ke=!!k.map,ce=!!k.matcap,Q=!!B,Ge=!!k.aoMap,De=!!k.lightMap,Xe=!!k.bumpMap,Je=!!k.normalMap,bt=!!k.displacementMap,at=!!k.emissiveMap,ee=!!k.metalnessMap,W=!!k.roughnessMap,Ee=k.anisotropy>0,ze=k.clearcoat>0,He=k.dispersion>0,Be=k.iridescence>0,pt=k.sheen>0,nt=k.transmission>0,se=Ee&&!!k.anisotropyMap,rt=ze&&!!k.clearcoatMap,$e=ze&&!!k.clearcoatNormalMap,ut=ze&&!!k.clearcoatRoughnessMap,Dt=Be&&!!k.iridescenceMap,Et=Be&&!!k.iridescenceThicknessMap,mt=pt&&!!k.sheenColorMap,de=pt&&!!k.sheenRoughnessMap,J=!!k.specularMap,Ae=!!k.specularColorMap,re=!!k.specularIntensityMap,Ue=nt&&!!k.transmissionMap,Te=nt&&!!k.thicknessMap,Oe=!!k.gradientMap,Ye=!!k.alphaMap,ft=k.alphaTest>0,Yt=!!k.alphaHash,un=!!k.extensions;let Cn=Pl;k.toneMapped&&(qe===null||qe.isXRRenderTarget===!0)&&(Cn=t.toneMapping);const en={shaderID:K,shaderType:k.type,shaderName:k.name,vertexShader:le,fragmentShader:ue,defines:k.defines,customVertexShaderID:_e,customFragmentShaderID:Se,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:x,batching:We,batchingColor:We&&te._colorsTexture!==null,instancing:Me,instancingColor:Me&&te.instanceColor!==null,instancingMorph:Me&&te.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:qe===null?t.outputColorSpace:qe.isXRRenderTarget===!0?qe.texture.colorSpace:xi,alphaToCoverage:!!k.alphaToCoverage,map:Ke,matcap:ce,envMap:Q,envMapMode:Q&&B.mapping,envMapCubeUVHeight:q,aoMap:Ge,lightMap:De,bumpMap:Xe,normalMap:Je,displacementMap:y&&bt,emissiveMap:at,normalMapObjectSpace:Je&&k.normalMapType===qV,normalMapTangentSpace:Je&&k.normalMapType===lu,metalnessMap:ee,roughnessMap:W,anisotropy:Ee,anisotropyMap:se,clearcoat:ze,clearcoatMap:rt,clearcoatNormalMap:$e,clearcoatRoughnessMap:ut,dispersion:He,iridescence:Be,iridescenceMap:Dt,iridescenceThicknessMap:Et,sheen:pt,sheenColorMap:mt,sheenRoughnessMap:de,specularMap:J,specularColorMap:Ae,specularIntensityMap:re,transmission:nt,transmissionMap:Ue,thicknessMap:Te,gradientMap:Oe,opaque:k.transparent===!1&&k.blending===Sh&&k.alphaToCoverage===!1,alphaMap:Ye,alphaTest:ft,alphaHash:Yt,combine:k.combine,mapUv:Ke&&w(k.map.channel),aoMapUv:Ge&&w(k.aoMap.channel),lightMapUv:De&&w(k.lightMap.channel),bumpMapUv:Xe&&w(k.bumpMap.channel),normalMapUv:Je&&w(k.normalMap.channel),displacementMapUv:bt&&w(k.displacementMap.channel),emissiveMapUv:at&&w(k.emissiveMap.channel),metalnessMapUv:ee&&w(k.metalnessMap.channel),roughnessMapUv:W&&w(k.roughnessMap.channel),anisotropyMapUv:se&&w(k.anisotropyMap.channel),clearcoatMapUv:rt&&w(k.clearcoatMap.channel),clearcoatNormalMapUv:$e&&w(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ut&&w(k.clearcoatRoughnessMap.channel),iridescenceMapUv:Dt&&w(k.iridescenceMap.channel),iridescenceThicknessMapUv:Et&&w(k.iridescenceThicknessMap.channel),sheenColorMapUv:mt&&w(k.sheenColorMap.channel),sheenRoughnessMapUv:de&&w(k.sheenRoughnessMap.channel),specularMapUv:J&&w(k.specularMap.channel),specularColorMapUv:Ae&&w(k.specularColorMap.channel),specularIntensityMapUv:re&&w(k.specularIntensityMap.channel),transmissionMapUv:Ue&&w(k.transmissionMap.channel),thicknessMapUv:Te&&w(k.thicknessMap.channel),alphaMapUv:Ye&&w(k.alphaMap.channel),vertexTangents:!!oe.attributes.tangent&&(Je||Ee),vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!oe.attributes.color&&oe.attributes.color.itemSize===4,pointsUvs:te.isPoints===!0&&!!oe.attributes.uv&&(Ke||Ye),fog:!!he,useFog:k.fog===!0,fogExp2:!!he&&he.isFogExp2,flatShading:k.flatShading===!0,sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:m,skinning:te.isSkinnedMesh===!0,morphTargets:oe.morphAttributes.position!==void 0,morphNormals:oe.morphAttributes.normal!==void 0,morphColors:oe.morphAttributes.color!==void 0,morphTargetsCount:Z,morphTextureStride:ge,numDirLights:U.directional.length,numPointLights:U.point.length,numSpotLights:U.spot.length,numSpotLightMaps:U.spotLightMap.length,numRectAreaLights:U.rectArea.length,numHemiLights:U.hemi.length,numDirLightShadows:U.directionalShadowMap.length,numPointLightShadows:U.pointShadowMap.length,numSpotLightShadows:U.spotShadowMap.length,numSpotLightShadowsWithMaps:U.numSpotLightShadowsWithMaps,numLightProbes:U.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:k.dithering,shadowMapEnabled:t.shadowMap.enabled&&H.length>0,shadowMapType:t.shadowMap.type,toneMapping:Cn,decodeVideoTexture:Ke&&k.map.isVideoTexture===!0&&In.getTransfer(k.map.colorSpace)===Jn,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===xo,flipSided:k.side===ss,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:un&&k.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(un&&k.extensions.multiDraw===!0||We)&&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 E(k){const U=[];if(k.shaderID?U.push(k.shaderID):(U.push(k.customVertexShaderID),U.push(k.customFragmentShaderID)),k.defines!==void 0)for(const H in k.defines)U.push(H),U.push(k.defines[H]);return k.isRawShaderMaterial===!1&&(T(U,k),C(U,k),U.push(t.outputColorSpace)),U.push(k.customProgramCacheKey),U.join()}function T(k,U){k.push(U.precision),k.push(U.outputColorSpace),k.push(U.envMapMode),k.push(U.envMapCubeUVHeight),k.push(U.mapUv),k.push(U.alphaMapUv),k.push(U.lightMapUv),k.push(U.aoMapUv),k.push(U.bumpMapUv),k.push(U.normalMapUv),k.push(U.displacementMapUv),k.push(U.emissiveMapUv),k.push(U.metalnessMapUv),k.push(U.roughnessMapUv),k.push(U.anisotropyMapUv),k.push(U.clearcoatMapUv),k.push(U.clearcoatNormalMapUv),k.push(U.clearcoatRoughnessMapUv),k.push(U.iridescenceMapUv),k.push(U.iridescenceThicknessMapUv),k.push(U.sheenColorMapUv),k.push(U.sheenRoughnessMapUv),k.push(U.specularMapUv),k.push(U.specularColorMapUv),k.push(U.specularIntensityMapUv),k.push(U.transmissionMapUv),k.push(U.thicknessMapUv),k.push(U.combine),k.push(U.fogExp2),k.push(U.sizeAttenuation),k.push(U.morphTargetsCount),k.push(U.morphAttributeCount),k.push(U.numDirLights),k.push(U.numPointLights),k.push(U.numSpotLights),k.push(U.numSpotLightMaps),k.push(U.numHemiLights),k.push(U.numRectAreaLights),k.push(U.numDirLightShadows),k.push(U.numPointLightShadows),k.push(U.numSpotLightShadows),k.push(U.numSpotLightShadowsWithMaps),k.push(U.numLightProbes),k.push(U.shadowMapType),k.push(U.toneMapping),k.push(U.numClippingPlanes),k.push(U.numClipIntersection),k.push(U.depthPacking)}function C(k,U){a.disableAll(),U.supportsVertexTextures&&a.enable(0),U.instancing&&a.enable(1),U.instancingColor&&a.enable(2),U.instancingMorph&&a.enable(3),U.matcap&&a.enable(4),U.envMap&&a.enable(5),U.normalMapObjectSpace&&a.enable(6),U.normalMapTangentSpace&&a.enable(7),U.clearcoat&&a.enable(8),U.iridescence&&a.enable(9),U.alphaTest&&a.enable(10),U.vertexColors&&a.enable(11),U.vertexAlphas&&a.enable(12),U.vertexUv1s&&a.enable(13),U.vertexUv2s&&a.enable(14),U.vertexUv3s&&a.enable(15),U.vertexTangents&&a.enable(16),U.anisotropy&&a.enable(17),U.alphaHash&&a.enable(18),U.batching&&a.enable(19),U.dispersion&&a.enable(20),U.batchingColor&&a.enable(21),k.push(a.mask),a.disableAll(),U.fog&&a.enable(0),U.useFog&&a.enable(1),U.flatShading&&a.enable(2),U.logarithmicDepthBuffer&&a.enable(3),U.reverseDepthBuffer&&a.enable(4),U.skinning&&a.enable(5),U.morphTargets&&a.enable(6),U.morphNormals&&a.enable(7),U.morphColors&&a.enable(8),U.premultipliedAlpha&&a.enable(9),U.shadowMapEnabled&&a.enable(10),U.doubleSided&&a.enable(11),U.flipSided&&a.enable(12),U.useDepthPacking&&a.enable(13),U.dithering&&a.enable(14),U.transmission&&a.enable(15),U.sheen&&a.enable(16),U.opaque&&a.enable(17),U.pointsUvs&&a.enable(18),U.decodeVideoTexture&&a.enable(19),U.alphaToCoverage&&a.enable(20),k.push(a.mask)}function O(k){const U=S[k.type];let H;if(U){const ne=Da[U];H=TR.clone(ne.uniforms)}else H=k.uniforms;return H}function N(k,U){let H;for(let ne=0,te=d.length;ne0?r.push(_):y.transparent===!0?i.push(_):n.push(_)}function l(f,m,y,x,S,w){const _=o(f,m,y,x,S,w);y.transmission>0?r.unshift(_):y.transparent===!0?i.unshift(_):n.unshift(_)}function c(f,m){n.length>1&&n.sort(f||N0e),r.length>1&&r.sort(m||MD),i.length>1&&i.sort(m||MD)}function d(){for(let f=e,m=t.length;f=s.length?(o=new ED,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function k0e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new X,color:new ct};break;case"SpotLight":n={position:new X,direction:new X,color:new ct,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new X,color:new ct,distance:0,decay:0};break;case"HemisphereLight":n={direction:new X,skyColor:new ct,groundColor:new ct};break;case"RectAreaLight":n={color:new ct,position:new X,halfWidth:new X,halfHeight:new X};break}return t[e.id]=n,n}}}function O0e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let L0e=0;function D0e(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function j0e(t){const e=new k0e,n=O0e(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new X);const i=new X,s=new Rt,o=new Rt;function a(c){let d=0,f=0,m=0;for(let V=0;V<9;V++)r.probe[V].set(0,0,0);let y=0,x=0,S=0,w=0,_=0,E=0,T=0,C=0,O=0,N=0,D=0;c.sort(D0e);for(let V=0,k=c.length;V0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ht.LTC_FLOAT_1,r.rectAreaLTC2=ht.LTC_FLOAT_2):(r.rectAreaLTC1=ht.LTC_HALF_1,r.rectAreaLTC2=ht.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=m;const F=r.hash;(F.directionalLength!==y||F.pointLength!==x||F.spotLength!==S||F.rectAreaLength!==w||F.hemiLength!==_||F.numDirectionalShadows!==E||F.numPointShadows!==T||F.numSpotShadows!==C||F.numSpotMaps!==O||F.numLightProbes!==D)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=w,r.point.length=x,r.hemi.length=_,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=D,F.directionalLength=y,F.pointLength=x,F.spotLength=S,F.rectAreaLength=w,F.hemiLength=_,F.numDirectionalShadows=E,F.numPointShadows=T,F.numSpotShadows=C,F.numSpotMaps=O,F.numLightProbes=D,r.version=L0e++)}function l(c,d){let f=0,m=0,y=0,x=0,S=0;const w=d.matrixWorldInverse;for(let _=0,E=c.length;_=o.length?(a=new AD(t),o.push(a)):a=o[s],a}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=$V,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 F0e=`void main() { +`+B)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(ne===""||te==="")&&(se=!1);se&&(U.diagnostics={runnable:he,programLog:H,vertexShader:{log:ne,prefix:w},fragmentShader:{log:te,prefix:_}})}i.deleteShader(O),i.deleteShader(N),F=new q_(i,S),G=m0e(i,S)}let F;this.getUniforms=function(){return F===void 0&&D(this),F};let G;this.getAttributes=function(){return G===void 0&&D(this),G};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(S,o0e)),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 T0e=0;class C0e{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new P0e(e),n.set(e,r)),r}}class P0e{constructor(e){this.id=T0e++,this.code=e,this.usedTimes=0}}function R0e(t,e,n,r,i,s,o){const a=new Ah,l=new C0e,c=new Set,d=[],f=i.logarithmicDepthBuffer,m=i.reverseDepthBuffer,y=i.vertexTextures;let x=i.precision;const S={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function w(k){return c.add(k),k===0?"uv":`uv${k}`}function _(k,U,H,ne,te){const he=ne.fog,se=te.geometry,fe=k.isMeshStandardMaterial?ne.environment:null,B=(k.isMeshStandardMaterial?n:e).get(k.envMap||fe),J=B&&B.mapping===nv?B.image.height:null,Y=S[k.type];k.precision!==null&&(x=i.getMaxPrecision(k.precision),x!==k.precision&&console.warn("THREE.WebGLProgram.getParameters:",k.precision,"not supported, using",x,"instead."));const V=se.morphAttributes.position||se.morphAttributes.normal||se.morphAttributes.color,q=V!==void 0?V.length:0;let pe=0;se.morphAttributes.position!==void 0&&(pe=1),se.morphAttributes.normal!==void 0&&(pe=2),se.morphAttributes.color!==void 0&&(pe=3);let ae,le,be,Se;if(Y){const Hn=Da[Y];ae=Hn.vertexShader,le=Hn.fragmentShader}else ae=k.vertexShader,le=k.fragmentShader,l.update(k),be=l.getVertexShaderID(k),Se=l.getFragmentShaderID(k);const qe=t.getRenderTarget(),Me=te.isInstancedMesh===!0,$e=te.isBatchedMesh===!0,Ke=!!k.map,ce=!!k.matcap,Z=!!B,We=!!k.aoMap,je=!!k.lightMap,Xe=!!k.bumpMap,Je=!!k.normalMap,bt=!!k.displacementMap,ut=!!k.emissiveMap,ee=!!k.metalnessMap,$=!!k.roughnessMap,Ee=k.anisotropy>0,Be=k.clearcoat>0,Ve=k.dispersion>0,He=k.iridescence>0,mt=k.sheen>0,rt=k.transmission>0,dt=Ee&&!!k.anisotropyMap,de=Be&&!!k.clearcoatMap,Ne=Be&&!!k.clearcoatNormalMap,tt=Be&&!!k.clearcoatRoughnessMap,jt=He&&!!k.iridescenceMap,Lt=He&&!!k.iridescenceThicknessMap,ct=mt&&!!k.sheenColorMap,ue=mt&&!!k.sheenRoughnessMap,Q=!!k.specularMap,Ae=!!k.specularColorMap,re=!!k.specularIntensityMap,Fe=rt&&!!k.transmissionMap,Te=rt&&!!k.thicknessMap,Le=!!k.gradientMap,Ye=!!k.alphaMap,ht=k.alphaTest>0,Yt=!!k.alphaHash,un=!!k.extensions;let Cn=Pl;k.toneMapped&&(qe===null||qe.isXRRenderTarget===!0)&&(Cn=t.toneMapping);const en={shaderID:Y,shaderType:k.type,shaderName:k.name,vertexShader:ae,fragmentShader:le,defines:k.defines,customVertexShaderID:be,customFragmentShaderID:Se,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:x,batching:$e,batchingColor:$e&&te._colorsTexture!==null,instancing:Me,instancingColor:Me&&te.instanceColor!==null,instancingMorph:Me&&te.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:qe===null?t.outputColorSpace:qe.isXRRenderTarget===!0?qe.texture.colorSpace:xi,alphaToCoverage:!!k.alphaToCoverage,map:Ke,matcap:ce,envMap:Z,envMapMode:Z&&B.mapping,envMapCubeUVHeight:J,aoMap:We,lightMap:je,bumpMap:Xe,normalMap:Je,displacementMap:y&&bt,emissiveMap:ut,normalMapObjectSpace:Je&&k.normalMapType===KV,normalMapTangentSpace:Je&&k.normalMapType===lu,metalnessMap:ee,roughnessMap:$,anisotropy:Ee,anisotropyMap:dt,clearcoat:Be,clearcoatMap:de,clearcoatNormalMap:Ne,clearcoatRoughnessMap:tt,dispersion:Ve,iridescence:He,iridescenceMap:jt,iridescenceThicknessMap:Lt,sheen:mt,sheenColorMap:ct,sheenRoughnessMap:ue,specularMap:Q,specularColorMap:Ae,specularIntensityMap:re,transmission:rt,transmissionMap:Fe,thicknessMap:Te,gradientMap:Le,opaque:k.transparent===!1&&k.blending===Sh&&k.alphaToCoverage===!1,alphaMap:Ye,alphaTest:ht,alphaHash:Yt,combine:k.combine,mapUv:Ke&&w(k.map.channel),aoMapUv:We&&w(k.aoMap.channel),lightMapUv:je&&w(k.lightMap.channel),bumpMapUv:Xe&&w(k.bumpMap.channel),normalMapUv:Je&&w(k.normalMap.channel),displacementMapUv:bt&&w(k.displacementMap.channel),emissiveMapUv:ut&&w(k.emissiveMap.channel),metalnessMapUv:ee&&w(k.metalnessMap.channel),roughnessMapUv:$&&w(k.roughnessMap.channel),anisotropyMapUv:dt&&w(k.anisotropyMap.channel),clearcoatMapUv:de&&w(k.clearcoatMap.channel),clearcoatNormalMapUv:Ne&&w(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:tt&&w(k.clearcoatRoughnessMap.channel),iridescenceMapUv:jt&&w(k.iridescenceMap.channel),iridescenceThicknessMapUv:Lt&&w(k.iridescenceThicknessMap.channel),sheenColorMapUv:ct&&w(k.sheenColorMap.channel),sheenRoughnessMapUv:ue&&w(k.sheenRoughnessMap.channel),specularMapUv:Q&&w(k.specularMap.channel),specularColorMapUv:Ae&&w(k.specularColorMap.channel),specularIntensityMapUv:re&&w(k.specularIntensityMap.channel),transmissionMapUv:Fe&&w(k.transmissionMap.channel),thicknessMapUv:Te&&w(k.thicknessMap.channel),alphaMapUv:Ye&&w(k.alphaMap.channel),vertexTangents:!!se.attributes.tangent&&(Je||Ee),vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!se.attributes.color&&se.attributes.color.itemSize===4,pointsUvs:te.isPoints===!0&&!!se.attributes.uv&&(Ke||Ye),fog:!!he,useFog:k.fog===!0,fogExp2:!!he&&he.isFogExp2,flatShading:k.flatShading===!0,sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:m,skinning:te.isSkinnedMesh===!0,morphTargets:se.morphAttributes.position!==void 0,morphNormals:se.morphAttributes.normal!==void 0,morphColors:se.morphAttributes.color!==void 0,morphTargetsCount:q,morphTextureStride:pe,numDirLights:U.directional.length,numPointLights:U.point.length,numSpotLights:U.spot.length,numSpotLightMaps:U.spotLightMap.length,numRectAreaLights:U.rectArea.length,numHemiLights:U.hemi.length,numDirLightShadows:U.directionalShadowMap.length,numPointLightShadows:U.pointShadowMap.length,numSpotLightShadows:U.spotShadowMap.length,numSpotLightShadowsWithMaps:U.numSpotLightShadowsWithMaps,numLightProbes:U.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:k.dithering,shadowMapEnabled:t.shadowMap.enabled&&H.length>0,shadowMapType:t.shadowMap.type,toneMapping:Cn,decodeVideoTexture:Ke&&k.map.isVideoTexture===!0&&In.getTransfer(k.map.colorSpace)===Jn,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===xo,flipSided:k.side===ss,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:un&&k.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(un&&k.extensions.multiDraw===!0||$e)&&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 E(k){const U=[];if(k.shaderID?U.push(k.shaderID):(U.push(k.customVertexShaderID),U.push(k.customFragmentShaderID)),k.defines!==void 0)for(const H in k.defines)U.push(H),U.push(k.defines[H]);return k.isRawShaderMaterial===!1&&(T(U,k),C(U,k),U.push(t.outputColorSpace)),U.push(k.customProgramCacheKey),U.join()}function T(k,U){k.push(U.precision),k.push(U.outputColorSpace),k.push(U.envMapMode),k.push(U.envMapCubeUVHeight),k.push(U.mapUv),k.push(U.alphaMapUv),k.push(U.lightMapUv),k.push(U.aoMapUv),k.push(U.bumpMapUv),k.push(U.normalMapUv),k.push(U.displacementMapUv),k.push(U.emissiveMapUv),k.push(U.metalnessMapUv),k.push(U.roughnessMapUv),k.push(U.anisotropyMapUv),k.push(U.clearcoatMapUv),k.push(U.clearcoatNormalMapUv),k.push(U.clearcoatRoughnessMapUv),k.push(U.iridescenceMapUv),k.push(U.iridescenceThicknessMapUv),k.push(U.sheenColorMapUv),k.push(U.sheenRoughnessMapUv),k.push(U.specularMapUv),k.push(U.specularColorMapUv),k.push(U.specularIntensityMapUv),k.push(U.transmissionMapUv),k.push(U.thicknessMapUv),k.push(U.combine),k.push(U.fogExp2),k.push(U.sizeAttenuation),k.push(U.morphTargetsCount),k.push(U.morphAttributeCount),k.push(U.numDirLights),k.push(U.numPointLights),k.push(U.numSpotLights),k.push(U.numSpotLightMaps),k.push(U.numHemiLights),k.push(U.numRectAreaLights),k.push(U.numDirLightShadows),k.push(U.numPointLightShadows),k.push(U.numSpotLightShadows),k.push(U.numSpotLightShadowsWithMaps),k.push(U.numLightProbes),k.push(U.shadowMapType),k.push(U.toneMapping),k.push(U.numClippingPlanes),k.push(U.numClipIntersection),k.push(U.depthPacking)}function C(k,U){a.disableAll(),U.supportsVertexTextures&&a.enable(0),U.instancing&&a.enable(1),U.instancingColor&&a.enable(2),U.instancingMorph&&a.enable(3),U.matcap&&a.enable(4),U.envMap&&a.enable(5),U.normalMapObjectSpace&&a.enable(6),U.normalMapTangentSpace&&a.enable(7),U.clearcoat&&a.enable(8),U.iridescence&&a.enable(9),U.alphaTest&&a.enable(10),U.vertexColors&&a.enable(11),U.vertexAlphas&&a.enable(12),U.vertexUv1s&&a.enable(13),U.vertexUv2s&&a.enable(14),U.vertexUv3s&&a.enable(15),U.vertexTangents&&a.enable(16),U.anisotropy&&a.enable(17),U.alphaHash&&a.enable(18),U.batching&&a.enable(19),U.dispersion&&a.enable(20),U.batchingColor&&a.enable(21),k.push(a.mask),a.disableAll(),U.fog&&a.enable(0),U.useFog&&a.enable(1),U.flatShading&&a.enable(2),U.logarithmicDepthBuffer&&a.enable(3),U.reverseDepthBuffer&&a.enable(4),U.skinning&&a.enable(5),U.morphTargets&&a.enable(6),U.morphNormals&&a.enable(7),U.morphColors&&a.enable(8),U.premultipliedAlpha&&a.enable(9),U.shadowMapEnabled&&a.enable(10),U.doubleSided&&a.enable(11),U.flipSided&&a.enable(12),U.useDepthPacking&&a.enable(13),U.dithering&&a.enable(14),U.transmission&&a.enable(15),U.sheen&&a.enable(16),U.opaque&&a.enable(17),U.pointsUvs&&a.enable(18),U.decodeVideoTexture&&a.enable(19),U.alphaToCoverage&&a.enable(20),k.push(a.mask)}function O(k){const U=S[k.type];let H;if(U){const ne=Da[U];H=CR.clone(ne.uniforms)}else H=k.uniforms;return H}function N(k,U){let H;for(let ne=0,te=d.length;ne0?r.push(_):y.transparent===!0?i.push(_):n.push(_)}function l(f,m,y,x,S,w){const _=o(f,m,y,x,S,w);y.transmission>0?r.unshift(_):y.transparent===!0?i.unshift(_):n.unshift(_)}function c(f,m){n.length>1&&n.sort(f||I0e),r.length>1&&r.sort(m||ED),i.length>1&&i.sort(m||ED)}function d(){for(let f=e,m=t.length;f=s.length?(o=new AD,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function O0e(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new X,color:new lt};break;case"SpotLight":n={position:new X,direction:new X,color:new lt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new X,color:new lt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new X,skyColor:new lt,groundColor:new lt};break;case"RectAreaLight":n={color:new lt,position:new X,halfWidth:new X,halfHeight:new X};break}return t[e.id]=n,n}}}function L0e(){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 Ge};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ge,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let D0e=0;function j0e(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function U0e(t){const e=new O0e,n=L0e(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new X);const i=new X,s=new Pt,o=new Pt;function a(c){let d=0,f=0,m=0;for(let G=0;G<9;G++)r.probe[G].set(0,0,0);let y=0,x=0,S=0,w=0,_=0,E=0,T=0,C=0,O=0,N=0,D=0;c.sort(j0e);for(let G=0,k=c.length;G0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=pt.LTC_FLOAT_1,r.rectAreaLTC2=pt.LTC_FLOAT_2):(r.rectAreaLTC1=pt.LTC_HALF_1,r.rectAreaLTC2=pt.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=m;const F=r.hash;(F.directionalLength!==y||F.pointLength!==x||F.spotLength!==S||F.rectAreaLength!==w||F.hemiLength!==_||F.numDirectionalShadows!==E||F.numPointShadows!==T||F.numSpotShadows!==C||F.numSpotMaps!==O||F.numLightProbes!==D)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=w,r.point.length=x,r.hemi.length=_,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=D,F.directionalLength=y,F.pointLength=x,F.spotLength=S,F.rectAreaLength=w,F.hemiLength=_,F.numDirectionalShadows=E,F.numPointShadows=T,F.numSpotShadows=C,F.numSpotMaps=O,F.numLightProbes=D,r.version=D0e++)}function l(c,d){let f=0,m=0,y=0,x=0,S=0;const w=d.matrixWorldInverse;for(let _=0,E=c.length;_=o.length?(a=new TD(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}class NR extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=XV,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class IR extends 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 z0e=`void main() { gl_Position = vec4( position, 1.0 ); -}`,z0e=`uniform sampler2D shadow_pass; +}`,B0e=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -4395,12 +4400,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function B0e(t,e,n){let r=new dx;const i=new Ve,s=new Ve,o=new Ln,a=new RR({depthPacking:XV}),l=new NR,c={},d=n.maxTextureSize,f={[Ul]:ss,[ss]:Ul,[xo]:xo},m=new Qo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ve},radius:{value:4}},vertexShader:F0e,fragmentShader:z0e}),y=m.clone();y.defines.HORIZONTAL_PASS=1;const x=new Qt;x.setAttribute("position",new Jt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new yr(x,m),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=BS;let _=this.type;this.render=function(N,D,F){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||N.length===0)return;const V=t.getRenderTarget(),k=t.getActiveCubeFace(),U=t.getActiveMipmapLevel(),H=t.state;H.setBlending($c),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);const ne=_!==Oa&&this.type===Oa,te=_===Oa&&this.type!==Oa;for(let he=0,oe=N.length;hed||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/q.x),i.x=s.x*q.x,B.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/q.y),i.y=s.y*q.y,B.mapSize.y=s.y)),B.map===null||ne===!0||te===!0){const $=this.type!==Oa?{minFilter:ri,magFilter:ri}:{};B.map!==null&&B.map.dispose(),B.map=new Va(i.x,i.y,$),B.map.texture.name=fe.name+".shadowMap",B.camera.updateProjectionMatrix()}t.setRenderTarget(B.map),t.clear();const K=B.getViewportCount();for(let $=0;$0||D.map&&D.alphaTest>0){const H=k.uuid,ne=D.uuid;let te=c[H];te===void 0&&(te={},c[H]=te);let he=te[ne];he===void 0&&(he=k.clone(),te[ne]=he,D.addEventListener("dispose",O)),k=he}if(k.visible=D.visible,k.wireframe=D.wireframe,V===Oa?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,F.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const H=t.properties.get(k);H.light=F}return k}function C(N,D,F,V,k){if(N.visible===!1)return;if(N.layers.test(D.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&k===Oa)&&(!N.frustumCulled||r.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,N.matrixWorld);const ne=e.update(N),te=N.material;if(Array.isArray(te)){const he=ne.groups;for(let oe=0,fe=he.length;oe=1):fe.indexOf("OpenGL ES")!==-1&&(oe=parseFloat(/^OpenGL ES (\d)/.exec(fe)[1]),he=oe>=2);let B=null,q={};const K=t.getParameter(t.SCISSOR_BOX),$=t.getParameter(t.VIEWPORT),Z=new Ln().fromArray(K),ge=new Ln().fromArray($);function le(re,Ue,Te,Oe){const Ye=new Uint8Array(4),ft=t.createTexture();t.bindTexture(re,ft),t.texParameteri(re,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(re,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Yt=0;Yte?(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 W0e(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 $0e(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function YC(t,e,n,r){const i=X0e(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 ax: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 is:return t*e*4/i.components*i.byteLength;case KS:return t*e*4/i.components*i.byteLength;case q0:case K0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Y0:case Z0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case l1:case u1:return Math.max(t,16)*Math.max(e,8)/4;case a1:case c1:return Math.max(t,8)*Math.max(e,8)/2;case d1:case f1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case h1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case p1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case m1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case g1:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case v1:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case y1:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case x1:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case b1:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case _1:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case w1:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case S1:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case M1:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case E1:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case A1:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case T1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Q0:case C1:case P1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case xR:case R1:return Math.ceil(t/4)*Math.ceil(e/4)*8;case N1:case I1:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function X0e(t){switch(t){case Ha:case dR:return{byteLength:1,components:1};case Og:case fR:case rv:return{byteLength:2,components:1};case WS:case $S:return{byteLength:2,components:4};case eu:case GS:case Qs:return{byteLength:4,components:1};case hR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const q0e={contain:G0e,cover:W0e,fill:$0e,getByteLength:YC};function K0e(t,e,n,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ve,d=new WeakMap;let f;const m=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(ee,W){return y?new OffscreenCanvas(ee,W):Iy("canvas")}function S(ee,W,Ee){let ze=1;const He=at(ee);if((He.width>Ee||He.height>Ee)&&(ze=Ee/Math.max(He.width,He.height)),ze<1)if(typeof HTMLImageElement<"u"&&ee instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&ee instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&ee instanceof ImageBitmap||typeof VideoFrame<"u"&&ee instanceof VideoFrame){const Be=Math.floor(ze*He.width),pt=Math.floor(ze*He.height);f===void 0&&(f=x(Be,pt));const nt=W?x(Be,pt):f;return nt.width=Be,nt.height=pt,nt.getContext("2d").drawImage(ee,0,0,Be,pt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+He.width+"x"+He.height+") to ("+Be+"x"+pt+")."),nt}else return"data"in ee&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+He.width+"x"+He.height+")."),ee;return ee}function w(ee){return ee.generateMipmaps&&ee.minFilter!==ri&&ee.minFilter!==Cr}function _(ee){t.generateMipmap(ee)}function E(ee,W,Ee,ze,He=!1){if(ee!==null){if(t[ee]!==void 0)return t[ee];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+ee+"'")}let Be=W;if(W===t.RED&&(Ee===t.FLOAT&&(Be=t.R32F),Ee===t.HALF_FLOAT&&(Be=t.R16F),Ee===t.UNSIGNED_BYTE&&(Be=t.R8)),W===t.RED_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Be=t.R8UI),Ee===t.UNSIGNED_SHORT&&(Be=t.R16UI),Ee===t.UNSIGNED_INT&&(Be=t.R32UI),Ee===t.BYTE&&(Be=t.R8I),Ee===t.SHORT&&(Be=t.R16I),Ee===t.INT&&(Be=t.R32I)),W===t.RG&&(Ee===t.FLOAT&&(Be=t.RG32F),Ee===t.HALF_FLOAT&&(Be=t.RG16F),Ee===t.UNSIGNED_BYTE&&(Be=t.RG8)),W===t.RG_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Be=t.RG8UI),Ee===t.UNSIGNED_SHORT&&(Be=t.RG16UI),Ee===t.UNSIGNED_INT&&(Be=t.RG32UI),Ee===t.BYTE&&(Be=t.RG8I),Ee===t.SHORT&&(Be=t.RG16I),Ee===t.INT&&(Be=t.RG32I)),W===t.RGB_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Be=t.RGB8UI),Ee===t.UNSIGNED_SHORT&&(Be=t.RGB16UI),Ee===t.UNSIGNED_INT&&(Be=t.RGB32UI),Ee===t.BYTE&&(Be=t.RGB8I),Ee===t.SHORT&&(Be=t.RGB16I),Ee===t.INT&&(Be=t.RGB32I)),W===t.RGBA_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Be=t.RGBA8UI),Ee===t.UNSIGNED_SHORT&&(Be=t.RGBA16UI),Ee===t.UNSIGNED_INT&&(Be=t.RGBA32UI),Ee===t.BYTE&&(Be=t.RGBA8I),Ee===t.SHORT&&(Be=t.RGBA16I),Ee===t.INT&&(Be=t.RGBA32I)),W===t.RGB&&Ee===t.UNSIGNED_INT_5_9_9_9_REV&&(Be=t.RGB9_E5),W===t.RGBA){const pt=He?Ty:In.getTransfer(ze);Ee===t.FLOAT&&(Be=t.RGBA32F),Ee===t.HALF_FLOAT&&(Be=t.RGBA16F),Ee===t.UNSIGNED_BYTE&&(Be=pt===Jn?t.SRGB8_ALPHA8:t.RGBA8),Ee===t.UNSIGNED_SHORT_4_4_4_4&&(Be=t.RGBA4),Ee===t.UNSIGNED_SHORT_5_5_5_1&&(Be=t.RGB5_A1)}return(Be===t.R16F||Be===t.R32F||Be===t.RG16F||Be===t.RG32F||Be===t.RGBA16F||Be===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Be}function T(ee,W){let Ee;return ee?W===null||W===eu||W===Uh?Ee=t.DEPTH24_STENCIL8:W===Qs?Ee=t.DEPTH32F_STENCIL8:W===Og&&(Ee=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):W===null||W===eu||W===Uh?Ee=t.DEPTH_COMPONENT24:W===Qs?Ee=t.DEPTH_COMPONENT32F:W===Og&&(Ee=t.DEPTH_COMPONENT16),Ee}function C(ee,W){return w(ee)===!0||ee.isFramebufferTexture&&ee.minFilter!==ri&&ee.minFilter!==Cr?Math.log2(Math.max(W.width,W.height))+1:ee.mipmaps!==void 0&&ee.mipmaps.length>0?ee.mipmaps.length:ee.isCompressedTexture&&Array.isArray(ee.image)?W.mipmaps.length:1}function O(ee){const W=ee.target;W.removeEventListener("dispose",O),D(W),W.isVideoTexture&&d.delete(W)}function N(ee){const W=ee.target;W.removeEventListener("dispose",N),V(W)}function D(ee){const W=r.get(ee);if(W.__webglInit===void 0)return;const Ee=ee.source,ze=m.get(Ee);if(ze){const He=ze[W.__cacheKey];He.usedTimes--,He.usedTimes===0&&F(ee),Object.keys(ze).length===0&&m.delete(Ee)}r.remove(ee)}function F(ee){const W=r.get(ee);t.deleteTexture(W.__webglTexture);const Ee=ee.source,ze=m.get(Ee);delete ze[W.__cacheKey],o.memory.textures--}function V(ee){const W=r.get(ee);if(ee.depthTexture&&ee.depthTexture.dispose(),ee.isWebGLCubeRenderTarget)for(let ze=0;ze<6;ze++){if(Array.isArray(W.__webglFramebuffer[ze]))for(let He=0;He=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+ee+" texture units while this GPU supports only "+i.maxTextures),k+=1,ee}function ne(ee){const W=[];return W.push(ee.wrapS),W.push(ee.wrapT),W.push(ee.wrapR||0),W.push(ee.magFilter),W.push(ee.minFilter),W.push(ee.anisotropy),W.push(ee.internalFormat),W.push(ee.format),W.push(ee.type),W.push(ee.generateMipmaps),W.push(ee.premultiplyAlpha),W.push(ee.flipY),W.push(ee.unpackAlignment),W.push(ee.colorSpace),W.join()}function te(ee,W){const Ee=r.get(ee);if(ee.isVideoTexture&&Je(ee),ee.isRenderTargetTexture===!1&&ee.version>0&&Ee.__version!==ee.version){const ze=ee.image;if(ze===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ze.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ge(Ee,ee,W);return}}n.bindTexture(t.TEXTURE_2D,Ee.__webglTexture,t.TEXTURE0+W)}function he(ee,W){const Ee=r.get(ee);if(ee.version>0&&Ee.__version!==ee.version){ge(Ee,ee,W);return}n.bindTexture(t.TEXTURE_2D_ARRAY,Ee.__webglTexture,t.TEXTURE0+W)}function oe(ee,W){const Ee=r.get(ee);if(ee.version>0&&Ee.__version!==ee.version){ge(Ee,ee,W);return}n.bindTexture(t.TEXTURE_3D,Ee.__webglTexture,t.TEXTURE0+W)}function fe(ee,W){const Ee=r.get(ee);if(ee.version>0&&Ee.__version!==ee.version){le(Ee,ee,W);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Ee.__webglTexture,t.TEXTURE0+W)}const B={[Pd]:t.REPEAT,[_o]:t.CLAMP_TO_EDGE,[kg]:t.MIRRORED_REPEAT},q={[ri]:t.NEAREST,[VS]:t.NEAREST_MIPMAP_NEAREST,[ih]:t.NEAREST_MIPMAP_LINEAR,[Cr]:t.LINEAR,[rg]:t.LINEAR_MIPMAP_NEAREST,[qo]:t.LINEAR_MIPMAP_LINEAR},K={[KV]:t.NEVER,[t6]:t.ALWAYS,[YV]:t.LESS,[wR]:t.LEQUAL,[ZV]:t.EQUAL,[e6]:t.GEQUAL,[QV]:t.GREATER,[JV]:t.NOTEQUAL};function $(ee,W){if(W.type===Qs&&e.has("OES_texture_float_linear")===!1&&(W.magFilter===Cr||W.magFilter===rg||W.magFilter===ih||W.magFilter===qo||W.minFilter===Cr||W.minFilter===rg||W.minFilter===ih||W.minFilter===qo)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(ee,t.TEXTURE_WRAP_S,B[W.wrapS]),t.texParameteri(ee,t.TEXTURE_WRAP_T,B[W.wrapT]),(ee===t.TEXTURE_3D||ee===t.TEXTURE_2D_ARRAY)&&t.texParameteri(ee,t.TEXTURE_WRAP_R,B[W.wrapR]),t.texParameteri(ee,t.TEXTURE_MAG_FILTER,q[W.magFilter]),t.texParameteri(ee,t.TEXTURE_MIN_FILTER,q[W.minFilter]),W.compareFunction&&(t.texParameteri(ee,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(ee,t.TEXTURE_COMPARE_FUNC,K[W.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(W.magFilter===ri||W.minFilter!==ih&&W.minFilter!==qo||W.type===Qs&&e.has("OES_texture_float_linear")===!1)return;if(W.anisotropy>1||r.get(W).__currentAnisotropy){const Ee=e.get("EXT_texture_filter_anisotropic");t.texParameterf(ee,Ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(W.anisotropy,i.getMaxAnisotropy())),r.get(W).__currentAnisotropy=W.anisotropy}}}function Z(ee,W){let Ee=!1;ee.__webglInit===void 0&&(ee.__webglInit=!0,W.addEventListener("dispose",O));const ze=W.source;let He=m.get(ze);He===void 0&&(He={},m.set(ze,He));const Be=ne(W);if(Be!==ee.__cacheKey){He[Be]===void 0&&(He[Be]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,Ee=!0),He[Be].usedTimes++;const pt=He[ee.__cacheKey];pt!==void 0&&(He[ee.__cacheKey].usedTimes--,pt.usedTimes===0&&F(W)),ee.__cacheKey=Be,ee.__webglTexture=He[Be].texture}return Ee}function ge(ee,W,Ee){let ze=t.TEXTURE_2D;(W.isDataArrayTexture||W.isCompressedArrayTexture)&&(ze=t.TEXTURE_2D_ARRAY),W.isData3DTexture&&(ze=t.TEXTURE_3D);const He=Z(ee,W),Be=W.source;n.bindTexture(ze,ee.__webglTexture,t.TEXTURE0+Ee);const pt=r.get(Be);if(Be.version!==pt.__version||He===!0){n.activeTexture(t.TEXTURE0+Ee);const nt=In.getPrimaries(In.workingColorSpace),se=W.colorSpace===jc?null:In.getPrimaries(W.colorSpace),rt=W.colorSpace===jc||nt===se?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,rt);let $e=S(W.image,!1,i.maxTextureSize);$e=bt(W,$e);const ut=s.convert(W.format,W.colorSpace),Dt=s.convert(W.type);let Et=E(W.internalFormat,ut,Dt,W.colorSpace,W.isVideoTexture);$(ze,W);let mt;const de=W.mipmaps,J=W.isVideoTexture!==!0,Ae=pt.__version===void 0||He===!0,re=Be.dataReady,Ue=C(W,$e);if(W.isDepthTexture)Et=T(W.format===Fh,W.type),Ae&&(J?n.texStorage2D(t.TEXTURE_2D,1,Et,$e.width,$e.height):n.texImage2D(t.TEXTURE_2D,0,Et,$e.width,$e.height,0,ut,Dt,null));else if(W.isDataTexture)if(de.length>0){J&&Ae&&n.texStorage2D(t.TEXTURE_2D,Ue,Et,de[0].width,de[0].height);for(let Te=0,Oe=de.length;Te0){const Ye=YC(mt.width,mt.height,W.format,W.type);for(const ft of W.layerUpdates){const Yt=mt.data.subarray(ft*Ye/mt.data.BYTES_PER_ELEMENT,(ft+1)*Ye/mt.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,ft,mt.width,mt.height,1,ut,Yt,0,0)}W.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,mt.width,mt.height,$e.depth,ut,mt.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Te,Et,mt.width,mt.height,$e.depth,0,mt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else J?re&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,mt.width,mt.height,$e.depth,ut,Dt,mt.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Te,Et,mt.width,mt.height,$e.depth,0,ut,Dt,mt.data)}else{J&&Ae&&n.texStorage2D(t.TEXTURE_2D,Ue,Et,de[0].width,de[0].height);for(let Te=0,Oe=de.length;Te0){const Te=YC($e.width,$e.height,W.format,W.type);for(const Oe of W.layerUpdates){const Ye=$e.data.subarray(Oe*Te/$e.data.BYTES_PER_ELEMENT,(Oe+1)*Te/$e.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Oe,$e.width,$e.height,1,ut,Dt,Ye)}W.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,$e.width,$e.height,$e.depth,ut,Dt,$e.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Et,$e.width,$e.height,$e.depth,0,ut,Dt,$e.data);else if(W.isData3DTexture)J?(Ae&&n.texStorage3D(t.TEXTURE_3D,Ue,Et,$e.width,$e.height,$e.depth),re&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,$e.width,$e.height,$e.depth,ut,Dt,$e.data)):n.texImage3D(t.TEXTURE_3D,0,Et,$e.width,$e.height,$e.depth,0,ut,Dt,$e.data);else if(W.isFramebufferTexture){if(Ae)if(J)n.texStorage2D(t.TEXTURE_2D,Ue,Et,$e.width,$e.height);else{let Te=$e.width,Oe=$e.height;for(let Ye=0;Ye>=1,Oe>>=1}}else if(de.length>0){if(J&&Ae){const Te=at(de[0]);n.texStorage2D(t.TEXTURE_2D,Ue,Et,Te.width,Te.height)}for(let Te=0,Oe=de.length;Te0&&Ue++;const Oe=at(ut[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Ue,de,Oe.width,Oe.height)}for(let Oe=0;Oe<6;Oe++)if($e){J?re&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Oe,0,0,0,ut[Oe].width,ut[Oe].height,Et,mt,ut[Oe].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Oe,0,de,ut[Oe].width,ut[Oe].height,0,Et,mt,ut[Oe].data);for(let Ye=0;Ye>Be),ut=Math.max(1,W.height>>Be);He===t.TEXTURE_3D||He===t.TEXTURE_2D_ARRAY?n.texImage3D(He,Be,se,$e,ut,W.depth,0,pt,nt,null):n.texImage2D(He,Be,se,$e,ut,0,pt,nt,null)}n.bindFramebuffer(t.FRAMEBUFFER,ee),Xe(W)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,ze,He,r.get(Ee).__webglTexture,0,De(W)):(He===t.TEXTURE_2D||He>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&He<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,ze,He,r.get(Ee).__webglTexture,Be),n.bindFramebuffer(t.FRAMEBUFFER,null)}function _e(ee,W,Ee){if(t.bindRenderbuffer(t.RENDERBUFFER,ee),W.depthBuffer){const ze=W.depthTexture,He=ze&&ze.isDepthTexture?ze.type:null,Be=T(W.stencilBuffer,He),pt=W.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,nt=De(W);Xe(W)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,nt,Be,W.width,W.height):Ee?t.renderbufferStorageMultisample(t.RENDERBUFFER,nt,Be,W.width,W.height):t.renderbufferStorage(t.RENDERBUFFER,Be,W.width,W.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,pt,t.RENDERBUFFER,ee)}else{const ze=W.textures;for(let He=0;He{delete W.__boundDepthTexture,delete W.__depthDisposeCallback,ze.removeEventListener("dispose",He)};ze.addEventListener("dispose",He),W.__depthDisposeCallback=He}W.__boundDepthTexture=ze}if(ee.depthTexture&&!W.__autoAllocateDepthBuffer){if(Ee)throw new Error("target.depthTexture not supported in Cube render targets");Se(W.__webglFramebuffer,ee)}else if(Ee){W.__webglDepthbuffer=[];for(let ze=0;ze<6;ze++)if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer[ze]),W.__webglDepthbuffer[ze]===void 0)W.__webglDepthbuffer[ze]=t.createRenderbuffer(),_e(W.__webglDepthbuffer[ze],ee,!1);else{const He=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Be=W.__webglDepthbuffer[ze];t.bindRenderbuffer(t.RENDERBUFFER,Be),t.framebufferRenderbuffer(t.FRAMEBUFFER,He,t.RENDERBUFFER,Be)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer),W.__webglDepthbuffer===void 0)W.__webglDepthbuffer=t.createRenderbuffer(),_e(W.__webglDepthbuffer,ee,!1);else{const ze=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,He=W.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,He),t.framebufferRenderbuffer(t.FRAMEBUFFER,ze,t.RENDERBUFFER,He)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Me(ee,W,Ee){const ze=r.get(ee);W!==void 0&&ue(ze.__webglFramebuffer,ee,ee.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Ee!==void 0&&qe(ee)}function We(ee){const W=ee.texture,Ee=r.get(ee),ze=r.get(W);ee.addEventListener("dispose",N);const He=ee.textures,Be=ee.isWebGLCubeRenderTarget===!0,pt=He.length>1;if(pt||(ze.__webglTexture===void 0&&(ze.__webglTexture=t.createTexture()),ze.__version=W.version,o.memory.textures++),Be){Ee.__webglFramebuffer=[];for(let nt=0;nt<6;nt++)if(W.mipmaps&&W.mipmaps.length>0){Ee.__webglFramebuffer[nt]=[];for(let se=0;se0){Ee.__webglFramebuffer=[];for(let nt=0;nt0&&Xe(ee)===!1){Ee.__webglMultisampledFramebuffer=t.createFramebuffer(),Ee.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Ee.__webglMultisampledFramebuffer);for(let nt=0;nt0)for(let se=0;se0)for(let se=0;se0){if(Xe(ee)===!1){const W=ee.textures,Ee=ee.width,ze=ee.height;let He=t.COLOR_BUFFER_BIT;const Be=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,pt=r.get(ee),nt=W.length>1;if(nt)for(let se=0;se0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&W.__useRenderToTexture!==!1}function Je(ee){const W=o.render.frame;d.get(ee)!==W&&(d.set(ee,W),ee.update())}function bt(ee,W){const Ee=ee.colorSpace,ze=ee.format,He=ee.type;return ee.isCompressedTexture===!0||ee.isVideoTexture===!0||Ee!==xi&&Ee!==jc&&(In.getTransfer(Ee)===Jn?(ze!==is||He!==Ha)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Ee)),W}function at(ee){return typeof HTMLImageElement<"u"&&ee instanceof HTMLImageElement?(c.width=ee.naturalWidth||ee.width,c.height=ee.naturalHeight||ee.height):typeof VideoFrame<"u"&&ee instanceof VideoFrame?(c.width=ee.displayWidth,c.height=ee.displayHeight):(c.width=ee.width,c.height=ee.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=U,this.setTexture2D=te,this.setTexture2DArray=he,this.setTexture3D=oe,this.setTextureCube=fe,this.rebindTextures=Me,this.setupRenderTarget=We,this.updateRenderTargetMipmap=Ke,this.updateMultisampleRenderTarget=Ge,this.setupDepthRenderbuffer=qe,this.setupFrameBufferTexture=ue,this.useMultisampledRTT=Xe}function g6(t,e){function n(r,i=jc){let s;const o=In.getTransfer(i);if(r===Ha)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===Og)return t.UNSIGNED_SHORT;if(r===GS)return t.INT;if(r===eu)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===is)return t.RGBA;if(r===gR)return t.LUMINANCE;if(r===vR)return t.LUMINANCE_ALPHA;if(r===Mh)return t.DEPTH_COMPONENT;if(r===Fh)return t.DEPTH_STENCIL;if(r===XS)return t.RED;if(r===ax)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===q0||r===K0||r===Y0||r===Z0)if(o===Jn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===q0)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===K0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Y0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Z0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===q0)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===K0)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Y0)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Z0)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===a1||r===l1||r===c1||r===u1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===a1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===l1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===c1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===u1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===d1||r===f1||r===h1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===d1||r===f1)return o===Jn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===h1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===p1||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)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===p1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===m1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===g1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===v1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===y1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===x1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===b1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===_1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===w1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===S1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===M1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===E1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===A1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===T1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Q0||r===C1||r===P1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===Q0)return o===Jn?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===P1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===xR||r===R1||r===N1||r===I1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===Q0)return s.COMPRESSED_RED_RGTC1_EXT;if(r===R1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===N1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===I1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Uh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class v6 extends Tr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends mn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Y0e={type:"move"};class _A{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 X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),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 X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const S of e.hand.values()){const w=n.getJointPose(S,r),_=this._getHandJoint(c,S);w!==null&&(_.matrix.fromArray(w.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=w.radius),_.visible=w!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],m=d.position.distanceTo(f.position),y=.02,x=.005;c.inputState.pinching&&m>y+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&m<=y-x&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Y0e)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Ts;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const Z0e=` +}`;function H0e(t,e,n){let r=new hx;const i=new Ge,s=new Ge,o=new Ln,a=new NR({depthPacking:qV}),l=new IR,c={},d=n.maxTextureSize,f={[Ul]:ss,[ss]:Ul,[xo]:xo},m=new Qo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ge},radius:{value:4}},vertexShader:z0e,fragmentShader:B0e}),y=m.clone();y.defines.HORIZONTAL_PASS=1;const x=new Qt;x.setAttribute("position",new Jt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new yr(x,m),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=HS;let _=this.type;this.render=function(N,D,F){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||N.length===0)return;const G=t.getRenderTarget(),k=t.getActiveCubeFace(),U=t.getActiveMipmapLevel(),H=t.state;H.setBlending($c),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);const ne=_!==Oa&&this.type===Oa,te=_===Oa&&this.type!==Oa;for(let he=0,se=N.length;hed||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||ne===!0||te===!0){const V=this.type!==Oa?{minFilter:ri,magFilter:ri}:{};B.map!==null&&B.map.dispose(),B.map=new Va(i.x,i.y,V),B.map.texture.name=fe.name+".shadowMap",B.camera.updateProjectionMatrix()}t.setRenderTarget(B.map),t.clear();const Y=B.getViewportCount();for(let V=0;V0||D.map&&D.alphaTest>0){const H=k.uuid,ne=D.uuid;let te=c[H];te===void 0&&(te={},c[H]=te);let he=te[ne];he===void 0&&(he=k.clone(),te[ne]=he,D.addEventListener("dispose",O)),k=he}if(k.visible=D.visible,k.wireframe=D.wireframe,G===Oa?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,F.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const H=t.properties.get(k);H.light=F}return k}function C(N,D,F,G,k){if(N.visible===!1)return;if(N.layers.test(D.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&k===Oa)&&(!N.frustumCulled||r.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,N.matrixWorld);const ne=e.update(N),te=N.material;if(Array.isArray(te)){const he=ne.groups;for(let se=0,fe=he.length;se=1):fe.indexOf("OpenGL ES")!==-1&&(se=parseFloat(/^OpenGL ES (\d)/.exec(fe)[1]),he=se>=2);let B=null,J={};const Y=t.getParameter(t.SCISSOR_BOX),V=t.getParameter(t.VIEWPORT),q=new Ln().fromArray(Y),pe=new Ln().fromArray(V);function ae(re,Fe,Te,Le){const Ye=new Uint8Array(4),ht=t.createTexture();t.bindTexture(re,ht),t.texParameteri(re,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(re,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Yt=0;Yte?(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 $0e(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 X0e(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function ZC(t,e,n,r){const i=q0e(r);switch(n){case mR:return t*e;case vR:return t*e;case yR:return t*e*2;case qS:return t*e/i.components*i.byteLength;case cx:return t*e/i.components*i.byteLength;case xR:return t*e*2/i.components*i.byteLength;case KS:return t*e*2/i.components*i.byteLength;case gR:return t*e*3/i.components*i.byteLength;case is:return t*e*4/i.components*i.byteLength;case YS:return t*e*4/i.components*i.byteLength;case Y0:case Z0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Q0:case J0:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case c1:case d1:return Math.max(t,16)*Math.max(e,8)/4;case l1:case u1:return Math.max(t,8)*Math.max(e,8)/2;case f1:case h1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case p1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case m1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case g1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case v1:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case y1:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case x1:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case b1:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case _1:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case w1:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case S1:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case M1:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case E1:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case A1:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case T1:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case C1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case ey:case P1:case R1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case bR:case N1:return Math.ceil(t/4)*Math.ceil(e/4)*8;case I1:case k1:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function q0e(t){switch(t){case Ha:case fR:return{byteLength:1,components:1};case Og:case hR:case rv:return{byteLength:2,components:1};case $S:case XS:return{byteLength:2,components:4};case eu:case WS:case Qs:return{byteLength:4,components:1};case pR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const K0e={contain:W0e,cover:$0e,fill:X0e,getByteLength:ZC};function Y0e(t,e,n,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new Ge,d=new WeakMap;let f;const m=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(ee,$){return y?new OffscreenCanvas(ee,$):Oy("canvas")}function S(ee,$,Ee){let Be=1;const Ve=ut(ee);if((Ve.width>Ee||Ve.height>Ee)&&(Be=Ee/Math.max(Ve.width,Ve.height)),Be<1)if(typeof HTMLImageElement<"u"&&ee instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&ee instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&ee instanceof ImageBitmap||typeof VideoFrame<"u"&&ee instanceof VideoFrame){const He=Math.floor(Be*Ve.width),mt=Math.floor(Be*Ve.height);f===void 0&&(f=x(He,mt));const rt=$?x(He,mt):f;return rt.width=He,rt.height=mt,rt.getContext("2d").drawImage(ee,0,0,He,mt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ve.width+"x"+Ve.height+") to ("+He+"x"+mt+")."),rt}else return"data"in ee&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ve.width+"x"+Ve.height+")."),ee;return ee}function w(ee){return ee.generateMipmaps&&ee.minFilter!==ri&&ee.minFilter!==Cr}function _(ee){t.generateMipmap(ee)}function E(ee,$,Ee,Be,Ve=!1){if(ee!==null){if(t[ee]!==void 0)return t[ee];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+ee+"'")}let He=$;if($===t.RED&&(Ee===t.FLOAT&&(He=t.R32F),Ee===t.HALF_FLOAT&&(He=t.R16F),Ee===t.UNSIGNED_BYTE&&(He=t.R8)),$===t.RED_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(He=t.R8UI),Ee===t.UNSIGNED_SHORT&&(He=t.R16UI),Ee===t.UNSIGNED_INT&&(He=t.R32UI),Ee===t.BYTE&&(He=t.R8I),Ee===t.SHORT&&(He=t.R16I),Ee===t.INT&&(He=t.R32I)),$===t.RG&&(Ee===t.FLOAT&&(He=t.RG32F),Ee===t.HALF_FLOAT&&(He=t.RG16F),Ee===t.UNSIGNED_BYTE&&(He=t.RG8)),$===t.RG_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(He=t.RG8UI),Ee===t.UNSIGNED_SHORT&&(He=t.RG16UI),Ee===t.UNSIGNED_INT&&(He=t.RG32UI),Ee===t.BYTE&&(He=t.RG8I),Ee===t.SHORT&&(He=t.RG16I),Ee===t.INT&&(He=t.RG32I)),$===t.RGB_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(He=t.RGB8UI),Ee===t.UNSIGNED_SHORT&&(He=t.RGB16UI),Ee===t.UNSIGNED_INT&&(He=t.RGB32UI),Ee===t.BYTE&&(He=t.RGB8I),Ee===t.SHORT&&(He=t.RGB16I),Ee===t.INT&&(He=t.RGB32I)),$===t.RGBA_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(He=t.RGBA8UI),Ee===t.UNSIGNED_SHORT&&(He=t.RGBA16UI),Ee===t.UNSIGNED_INT&&(He=t.RGBA32UI),Ee===t.BYTE&&(He=t.RGBA8I),Ee===t.SHORT&&(He=t.RGBA16I),Ee===t.INT&&(He=t.RGBA32I)),$===t.RGB&&Ee===t.UNSIGNED_INT_5_9_9_9_REV&&(He=t.RGB9_E5),$===t.RGBA){const mt=Ve?Py:In.getTransfer(Be);Ee===t.FLOAT&&(He=t.RGBA32F),Ee===t.HALF_FLOAT&&(He=t.RGBA16F),Ee===t.UNSIGNED_BYTE&&(He=mt===Jn?t.SRGB8_ALPHA8:t.RGBA8),Ee===t.UNSIGNED_SHORT_4_4_4_4&&(He=t.RGBA4),Ee===t.UNSIGNED_SHORT_5_5_5_1&&(He=t.RGB5_A1)}return(He===t.R16F||He===t.R32F||He===t.RG16F||He===t.RG32F||He===t.RGBA16F||He===t.RGBA32F)&&e.get("EXT_color_buffer_float"),He}function T(ee,$){let Ee;return ee?$===null||$===eu||$===Uh?Ee=t.DEPTH24_STENCIL8:$===Qs?Ee=t.DEPTH32F_STENCIL8:$===Og&&(Ee=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):$===null||$===eu||$===Uh?Ee=t.DEPTH_COMPONENT24:$===Qs?Ee=t.DEPTH_COMPONENT32F:$===Og&&(Ee=t.DEPTH_COMPONENT16),Ee}function C(ee,$){return w(ee)===!0||ee.isFramebufferTexture&&ee.minFilter!==ri&&ee.minFilter!==Cr?Math.log2(Math.max($.width,$.height))+1:ee.mipmaps!==void 0&&ee.mipmaps.length>0?ee.mipmaps.length:ee.isCompressedTexture&&Array.isArray(ee.image)?$.mipmaps.length:1}function O(ee){const $=ee.target;$.removeEventListener("dispose",O),D($),$.isVideoTexture&&d.delete($)}function N(ee){const $=ee.target;$.removeEventListener("dispose",N),G($)}function D(ee){const $=r.get(ee);if($.__webglInit===void 0)return;const Ee=ee.source,Be=m.get(Ee);if(Be){const Ve=Be[$.__cacheKey];Ve.usedTimes--,Ve.usedTimes===0&&F(ee),Object.keys(Be).length===0&&m.delete(Ee)}r.remove(ee)}function F(ee){const $=r.get(ee);t.deleteTexture($.__webglTexture);const Ee=ee.source,Be=m.get(Ee);delete Be[$.__cacheKey],o.memory.textures--}function G(ee){const $=r.get(ee);if(ee.depthTexture&&ee.depthTexture.dispose(),ee.isWebGLCubeRenderTarget)for(let Be=0;Be<6;Be++){if(Array.isArray($.__webglFramebuffer[Be]))for(let Ve=0;Ve<$.__webglFramebuffer[Be].length;Ve++)t.deleteFramebuffer($.__webglFramebuffer[Be][Ve]);else t.deleteFramebuffer($.__webglFramebuffer[Be]);$.__webglDepthbuffer&&t.deleteRenderbuffer($.__webglDepthbuffer[Be])}else{if(Array.isArray($.__webglFramebuffer))for(let Be=0;Be<$.__webglFramebuffer.length;Be++)t.deleteFramebuffer($.__webglFramebuffer[Be]);else t.deleteFramebuffer($.__webglFramebuffer);if($.__webglDepthbuffer&&t.deleteRenderbuffer($.__webglDepthbuffer),$.__webglMultisampledFramebuffer&&t.deleteFramebuffer($.__webglMultisampledFramebuffer),$.__webglColorRenderbuffer)for(let Be=0;Be<$.__webglColorRenderbuffer.length;Be++)$.__webglColorRenderbuffer[Be]&&t.deleteRenderbuffer($.__webglColorRenderbuffer[Be]);$.__webglDepthRenderbuffer&&t.deleteRenderbuffer($.__webglDepthRenderbuffer)}const Ee=ee.textures;for(let Be=0,Ve=Ee.length;Be=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+ee+" texture units while this GPU supports only "+i.maxTextures),k+=1,ee}function ne(ee){const $=[];return $.push(ee.wrapS),$.push(ee.wrapT),$.push(ee.wrapR||0),$.push(ee.magFilter),$.push(ee.minFilter),$.push(ee.anisotropy),$.push(ee.internalFormat),$.push(ee.format),$.push(ee.type),$.push(ee.generateMipmaps),$.push(ee.premultiplyAlpha),$.push(ee.flipY),$.push(ee.unpackAlignment),$.push(ee.colorSpace),$.join()}function te(ee,$){const Ee=r.get(ee);if(ee.isVideoTexture&&Je(ee),ee.isRenderTargetTexture===!1&&ee.version>0&&Ee.__version!==ee.version){const Be=ee.image;if(Be===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Be.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{pe(Ee,ee,$);return}}n.bindTexture(t.TEXTURE_2D,Ee.__webglTexture,t.TEXTURE0+$)}function he(ee,$){const Ee=r.get(ee);if(ee.version>0&&Ee.__version!==ee.version){pe(Ee,ee,$);return}n.bindTexture(t.TEXTURE_2D_ARRAY,Ee.__webglTexture,t.TEXTURE0+$)}function se(ee,$){const Ee=r.get(ee);if(ee.version>0&&Ee.__version!==ee.version){pe(Ee,ee,$);return}n.bindTexture(t.TEXTURE_3D,Ee.__webglTexture,t.TEXTURE0+$)}function fe(ee,$){const Ee=r.get(ee);if(ee.version>0&&Ee.__version!==ee.version){ae(Ee,ee,$);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Ee.__webglTexture,t.TEXTURE0+$)}const B={[Pd]:t.REPEAT,[_o]:t.CLAMP_TO_EDGE,[kg]:t.MIRRORED_REPEAT},J={[ri]:t.NEAREST,[GS]:t.NEAREST_MIPMAP_NEAREST,[ih]:t.NEAREST_MIPMAP_LINEAR,[Cr]:t.LINEAR,[rg]:t.LINEAR_MIPMAP_NEAREST,[qo]:t.LINEAR_MIPMAP_LINEAR},Y={[YV]:t.NEVER,[n6]:t.ALWAYS,[ZV]:t.LESS,[SR]:t.LEQUAL,[QV]:t.EQUAL,[t6]:t.GEQUAL,[JV]:t.GREATER,[e6]:t.NOTEQUAL};function V(ee,$){if($.type===Qs&&e.has("OES_texture_float_linear")===!1&&($.magFilter===Cr||$.magFilter===rg||$.magFilter===ih||$.magFilter===qo||$.minFilter===Cr||$.minFilter===rg||$.minFilter===ih||$.minFilter===qo)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(ee,t.TEXTURE_WRAP_S,B[$.wrapS]),t.texParameteri(ee,t.TEXTURE_WRAP_T,B[$.wrapT]),(ee===t.TEXTURE_3D||ee===t.TEXTURE_2D_ARRAY)&&t.texParameteri(ee,t.TEXTURE_WRAP_R,B[$.wrapR]),t.texParameteri(ee,t.TEXTURE_MAG_FILTER,J[$.magFilter]),t.texParameteri(ee,t.TEXTURE_MIN_FILTER,J[$.minFilter]),$.compareFunction&&(t.texParameteri(ee,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(ee,t.TEXTURE_COMPARE_FUNC,Y[$.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if($.magFilter===ri||$.minFilter!==ih&&$.minFilter!==qo||$.type===Qs&&e.has("OES_texture_float_linear")===!1)return;if($.anisotropy>1||r.get($).__currentAnisotropy){const Ee=e.get("EXT_texture_filter_anisotropic");t.texParameterf(ee,Ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min($.anisotropy,i.getMaxAnisotropy())),r.get($).__currentAnisotropy=$.anisotropy}}}function q(ee,$){let Ee=!1;ee.__webglInit===void 0&&(ee.__webglInit=!0,$.addEventListener("dispose",O));const Be=$.source;let Ve=m.get(Be);Ve===void 0&&(Ve={},m.set(Be,Ve));const He=ne($);if(He!==ee.__cacheKey){Ve[He]===void 0&&(Ve[He]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,Ee=!0),Ve[He].usedTimes++;const mt=Ve[ee.__cacheKey];mt!==void 0&&(Ve[ee.__cacheKey].usedTimes--,mt.usedTimes===0&&F($)),ee.__cacheKey=He,ee.__webglTexture=Ve[He].texture}return Ee}function pe(ee,$,Ee){let Be=t.TEXTURE_2D;($.isDataArrayTexture||$.isCompressedArrayTexture)&&(Be=t.TEXTURE_2D_ARRAY),$.isData3DTexture&&(Be=t.TEXTURE_3D);const Ve=q(ee,$),He=$.source;n.bindTexture(Be,ee.__webglTexture,t.TEXTURE0+Ee);const mt=r.get(He);if(He.version!==mt.__version||Ve===!0){n.activeTexture(t.TEXTURE0+Ee);const rt=In.getPrimaries(In.workingColorSpace),dt=$.colorSpace===jc?null:In.getPrimaries($.colorSpace),de=$.colorSpace===jc||rt===dt?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,$.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,$.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,$.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,de);let Ne=S($.image,!1,i.maxTextureSize);Ne=bt($,Ne);const tt=s.convert($.format,$.colorSpace),jt=s.convert($.type);let Lt=E($.internalFormat,tt,jt,$.colorSpace,$.isVideoTexture);V(Be,$);let ct;const ue=$.mipmaps,Q=$.isVideoTexture!==!0,Ae=mt.__version===void 0||Ve===!0,re=He.dataReady,Fe=C($,Ne);if($.isDepthTexture)Lt=T($.format===Fh,$.type),Ae&&(Q?n.texStorage2D(t.TEXTURE_2D,1,Lt,Ne.width,Ne.height):n.texImage2D(t.TEXTURE_2D,0,Lt,Ne.width,Ne.height,0,tt,jt,null));else if($.isDataTexture)if(ue.length>0){Q&&Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,Lt,ue[0].width,ue[0].height);for(let Te=0,Le=ue.length;Te0){const Ye=ZC(ct.width,ct.height,$.format,$.type);for(const ht of $.layerUpdates){const Yt=ct.data.subarray(ht*Ye/ct.data.BYTES_PER_ELEMENT,(ht+1)*Ye/ct.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,ht,ct.width,ct.height,1,tt,Yt,0,0)}$.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,ct.width,ct.height,Ne.depth,tt,ct.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Te,Lt,ct.width,ct.height,Ne.depth,0,ct.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Q?re&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,ct.width,ct.height,Ne.depth,tt,jt,ct.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Te,Lt,ct.width,ct.height,Ne.depth,0,tt,jt,ct.data)}else{Q&&Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,Lt,ue[0].width,ue[0].height);for(let Te=0,Le=ue.length;Te0){const Te=ZC(Ne.width,Ne.height,$.format,$.type);for(const Le of $.layerUpdates){const Ye=Ne.data.subarray(Le*Te/Ne.data.BYTES_PER_ELEMENT,(Le+1)*Te/Ne.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Le,Ne.width,Ne.height,1,tt,jt,Ye)}$.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,Ne.width,Ne.height,Ne.depth,tt,jt,Ne.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Lt,Ne.width,Ne.height,Ne.depth,0,tt,jt,Ne.data);else if($.isData3DTexture)Q?(Ae&&n.texStorage3D(t.TEXTURE_3D,Fe,Lt,Ne.width,Ne.height,Ne.depth),re&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,Ne.width,Ne.height,Ne.depth,tt,jt,Ne.data)):n.texImage3D(t.TEXTURE_3D,0,Lt,Ne.width,Ne.height,Ne.depth,0,tt,jt,Ne.data);else if($.isFramebufferTexture){if(Ae)if(Q)n.texStorage2D(t.TEXTURE_2D,Fe,Lt,Ne.width,Ne.height);else{let Te=Ne.width,Le=Ne.height;for(let Ye=0;Ye>=1,Le>>=1}}else if(ue.length>0){if(Q&&Ae){const Te=ut(ue[0]);n.texStorage2D(t.TEXTURE_2D,Fe,Lt,Te.width,Te.height)}for(let Te=0,Le=ue.length;Te0&&Fe++;const Le=ut(tt[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Fe,ue,Le.width,Le.height)}for(let Le=0;Le<6;Le++)if(Ne){Q?re&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,0,0,tt[Le].width,tt[Le].height,Lt,ct,tt[Le].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,ue,tt[Le].width,tt[Le].height,0,Lt,ct,tt[Le].data);for(let Ye=0;Ye>He),tt=Math.max(1,$.height>>He);Ve===t.TEXTURE_3D||Ve===t.TEXTURE_2D_ARRAY?n.texImage3D(Ve,He,dt,Ne,tt,$.depth,0,mt,rt,null):n.texImage2D(Ve,He,dt,Ne,tt,0,mt,rt,null)}n.bindFramebuffer(t.FRAMEBUFFER,ee),Xe($)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Be,Ve,r.get(Ee).__webglTexture,0,je($)):(Ve===t.TEXTURE_2D||Ve>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Ve<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Be,Ve,r.get(Ee).__webglTexture,He),n.bindFramebuffer(t.FRAMEBUFFER,null)}function be(ee,$,Ee){if(t.bindRenderbuffer(t.RENDERBUFFER,ee),$.depthBuffer){const Be=$.depthTexture,Ve=Be&&Be.isDepthTexture?Be.type:null,He=T($.stencilBuffer,Ve),mt=$.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,rt=je($);Xe($)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,He,$.width,$.height):Ee?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,He,$.width,$.height):t.renderbufferStorage(t.RENDERBUFFER,He,$.width,$.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,mt,t.RENDERBUFFER,ee)}else{const Be=$.textures;for(let Ve=0;Ve{delete $.__boundDepthTexture,delete $.__depthDisposeCallback,Be.removeEventListener("dispose",Ve)};Be.addEventListener("dispose",Ve),$.__depthDisposeCallback=Ve}$.__boundDepthTexture=Be}if(ee.depthTexture&&!$.__autoAllocateDepthBuffer){if(Ee)throw new Error("target.depthTexture not supported in Cube render targets");Se($.__webglFramebuffer,ee)}else if(Ee){$.__webglDepthbuffer=[];for(let Be=0;Be<6;Be++)if(n.bindFramebuffer(t.FRAMEBUFFER,$.__webglFramebuffer[Be]),$.__webglDepthbuffer[Be]===void 0)$.__webglDepthbuffer[Be]=t.createRenderbuffer(),be($.__webglDepthbuffer[Be],ee,!1);else{const Ve=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,He=$.__webglDepthbuffer[Be];t.bindRenderbuffer(t.RENDERBUFFER,He),t.framebufferRenderbuffer(t.FRAMEBUFFER,Ve,t.RENDERBUFFER,He)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,$.__webglFramebuffer),$.__webglDepthbuffer===void 0)$.__webglDepthbuffer=t.createRenderbuffer(),be($.__webglDepthbuffer,ee,!1);else{const Be=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ve=$.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,Ve),t.framebufferRenderbuffer(t.FRAMEBUFFER,Be,t.RENDERBUFFER,Ve)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Me(ee,$,Ee){const Be=r.get(ee);$!==void 0&&le(Be.__webglFramebuffer,ee,ee.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Ee!==void 0&&qe(ee)}function $e(ee){const $=ee.texture,Ee=r.get(ee),Be=r.get($);ee.addEventListener("dispose",N);const Ve=ee.textures,He=ee.isWebGLCubeRenderTarget===!0,mt=Ve.length>1;if(mt||(Be.__webglTexture===void 0&&(Be.__webglTexture=t.createTexture()),Be.__version=$.version,o.memory.textures++),He){Ee.__webglFramebuffer=[];for(let rt=0;rt<6;rt++)if($.mipmaps&&$.mipmaps.length>0){Ee.__webglFramebuffer[rt]=[];for(let dt=0;dt<$.mipmaps.length;dt++)Ee.__webglFramebuffer[rt][dt]=t.createFramebuffer()}else Ee.__webglFramebuffer[rt]=t.createFramebuffer()}else{if($.mipmaps&&$.mipmaps.length>0){Ee.__webglFramebuffer=[];for(let rt=0;rt<$.mipmaps.length;rt++)Ee.__webglFramebuffer[rt]=t.createFramebuffer()}else Ee.__webglFramebuffer=t.createFramebuffer();if(mt)for(let rt=0,dt=Ve.length;rt0&&Xe(ee)===!1){Ee.__webglMultisampledFramebuffer=t.createFramebuffer(),Ee.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Ee.__webglMultisampledFramebuffer);for(let rt=0;rt0)for(let dt=0;dt<$.mipmaps.length;dt++)le(Ee.__webglFramebuffer[rt][dt],ee,$,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+rt,dt);else le(Ee.__webglFramebuffer[rt],ee,$,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+rt,0);w($)&&_(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(mt){for(let rt=0,dt=Ve.length;rt0)for(let dt=0;dt<$.mipmaps.length;dt++)le(Ee.__webglFramebuffer[dt],ee,$,t.COLOR_ATTACHMENT0,rt,dt);else le(Ee.__webglFramebuffer,ee,$,t.COLOR_ATTACHMENT0,rt,0);w($)&&_(rt),n.unbindTexture()}ee.depthBuffer&&qe(ee)}function Ke(ee){const $=ee.textures;for(let Ee=0,Be=$.length;Ee0){if(Xe(ee)===!1){const $=ee.textures,Ee=ee.width,Be=ee.height;let Ve=t.COLOR_BUFFER_BIT;const He=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,mt=r.get(ee),rt=$.length>1;if(rt)for(let dt=0;dt<$.length;dt++)n.bindFramebuffer(t.FRAMEBUFFER,mt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+dt,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,mt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+dt,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,mt.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,mt.__webglFramebuffer);for(let dt=0;dt<$.length;dt++){if(ee.resolveDepthBuffer&&(ee.depthBuffer&&(Ve|=t.DEPTH_BUFFER_BIT),ee.stencilBuffer&&ee.resolveStencilBuffer&&(Ve|=t.STENCIL_BUFFER_BIT)),rt){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,mt.__webglColorRenderbuffer[dt]);const de=r.get($[dt]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,de,0)}t.blitFramebuffer(0,0,Ee,Be,0,0,Ee,Be,Ve,t.NEAREST),l===!0&&(ce.length=0,Z.length=0,ce.push(t.COLOR_ATTACHMENT0+dt),ee.depthBuffer&&ee.resolveDepthBuffer===!1&&(ce.push(He),Z.push(He),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Z)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,ce))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),rt)for(let dt=0;dt<$.length;dt++){n.bindFramebuffer(t.FRAMEBUFFER,mt.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+dt,t.RENDERBUFFER,mt.__webglColorRenderbuffer[dt]);const de=r.get($[dt]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,mt.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+dt,t.TEXTURE_2D,de,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,mt.__webglMultisampledFramebuffer)}else if(ee.depthBuffer&&ee.resolveDepthBuffer===!1&&l){const $=ee.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[$])}}}function je(ee){return Math.min(i.maxSamples,ee.samples)}function Xe(ee){const $=r.get(ee);return ee.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&$.__useRenderToTexture!==!1}function Je(ee){const $=o.render.frame;d.get(ee)!==$&&(d.set(ee,$),ee.update())}function bt(ee,$){const Ee=ee.colorSpace,Be=ee.format,Ve=ee.type;return ee.isCompressedTexture===!0||ee.isVideoTexture===!0||Ee!==xi&&Ee!==jc&&(In.getTransfer(Ee)===Jn?(Be!==is||Ve!==Ha)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Ee)),$}function ut(ee){return typeof HTMLImageElement<"u"&&ee instanceof HTMLImageElement?(c.width=ee.naturalWidth||ee.width,c.height=ee.naturalHeight||ee.height):typeof VideoFrame<"u"&&ee instanceof VideoFrame?(c.width=ee.displayWidth,c.height=ee.displayHeight):(c.width=ee.width,c.height=ee.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=U,this.setTexture2D=te,this.setTexture2DArray=he,this.setTexture3D=se,this.setTextureCube=fe,this.rebindTextures=Me,this.setupRenderTarget=$e,this.updateRenderTargetMipmap=Ke,this.updateMultisampleRenderTarget=We,this.setupDepthRenderbuffer=qe,this.setupFrameBufferTexture=le,this.useMultisampledRTT=Xe}function v6(t,e){function n(r,i=jc){let s;const o=In.getTransfer(i);if(r===Ha)return t.UNSIGNED_BYTE;if(r===$S)return t.UNSIGNED_SHORT_4_4_4_4;if(r===XS)return t.UNSIGNED_SHORT_5_5_5_1;if(r===pR)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===fR)return t.BYTE;if(r===hR)return t.SHORT;if(r===Og)return t.UNSIGNED_SHORT;if(r===WS)return t.INT;if(r===eu)return t.UNSIGNED_INT;if(r===Qs)return t.FLOAT;if(r===rv)return t.HALF_FLOAT;if(r===mR)return t.ALPHA;if(r===gR)return t.RGB;if(r===is)return t.RGBA;if(r===vR)return t.LUMINANCE;if(r===yR)return t.LUMINANCE_ALPHA;if(r===Mh)return t.DEPTH_COMPONENT;if(r===Fh)return t.DEPTH_STENCIL;if(r===qS)return t.RED;if(r===cx)return t.RED_INTEGER;if(r===xR)return t.RG;if(r===KS)return t.RG_INTEGER;if(r===YS)return t.RGBA_INTEGER;if(r===Y0||r===Z0||r===Q0||r===J0)if(o===Jn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Y0)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===Z0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===J0)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Y0)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===Z0)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Q0)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===J0)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===l1||r===c1||r===u1||r===d1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===l1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===c1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===u1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===d1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===f1||r===h1||r===p1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===f1||r===h1)return o===Jn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===p1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===m1||r===g1||r===v1||r===y1||r===x1||r===b1||r===_1||r===w1||r===S1||r===M1||r===E1||r===A1||r===T1||r===C1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===m1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===g1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===v1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===y1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===x1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===b1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===_1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===w1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===S1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===M1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===E1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===A1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===T1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===C1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===ey||r===P1||r===R1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===ey)return o===Jn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===P1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===R1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===bR||r===N1||r===I1||r===k1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===ey)return s.COMPRESSED_RED_RGTC1_EXT;if(r===N1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===I1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===k1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Uh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class y6 extends Tr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends mn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Z0e={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 X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),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 X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const S of e.hand.values()){const w=n.getJointPose(S,r),_=this._getHandJoint(c,S);w!==null&&(_.matrix.fromArray(w.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=w.radius),_.visible=w!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],m=d.position.distanceTo(f.position),y=.02,x=.005;c.inputState.pinching&&m>y+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&m<=y-x&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Z0e)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Ts;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const Q0e=` void main() { gl_Position = vec4( position, 1.0 ); -}`,Q0e=` +}`,J0e=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -4419,7 +4424,7 @@ void main() { } -}`;class J0e{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,r){if(this.texture===null){const i=new dr,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 Qo({vertexShader:Z0e,fragmentShader:Q0e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new yr(new iv(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class eye extends Vl{constructor(e,n){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,f=null,m=null,y=null,x=null;const S=new J0e,w=n.getContextAttributes();let _=null,E=null;const T=[],C=[],O=new Ve;let N=null;const D=new Tr;D.layers.enable(1),D.viewport=new Ln;const F=new Tr;F.layers.enable(2),F.viewport=new Ln;const V=[D,F],k=new v6;k.layers.enable(1),k.layers.enable(2);let U=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let ue=T[le];return ue===void 0&&(ue=new _A,T[le]=ue),ue.getTargetRaySpace()},this.getControllerGrip=function(le){let ue=T[le];return ue===void 0&&(ue=new _A,T[le]=ue),ue.getGripSpace()},this.getHand=function(le){let ue=T[le];return ue===void 0&&(ue=new _A,T[le]=ue),ue.getHandSpace()};function ne(le){const ue=C.indexOf(le.inputSource);if(ue===-1)return;const _e=T[ue];_e!==void 0&&(_e.update(le.inputSource,le.frame,c||o),_e.dispatchEvent({type:le.type,data:le.inputSource}))}function te(){i.removeEventListener("select",ne),i.removeEventListener("selectstart",ne),i.removeEventListener("selectend",ne),i.removeEventListener("squeeze",ne),i.removeEventListener("squeezestart",ne),i.removeEventListener("squeezeend",ne),i.removeEventListener("end",te),i.removeEventListener("inputsourceschange",he);for(let le=0;le=0&&(C[Se]=null,T[Se].disconnect(_e))}for(let ue=0;ue=C.length){C.push(_e),Se=Me;break}else if(C[Me]===null){C[Me]=_e,Se=Me;break}if(Se===-1)break}const qe=T[Se];qe&&qe.connect(_e)}}const oe=new X,fe=new X;function B(le,ue,_e){oe.setFromMatrixPosition(ue.matrixWorld),fe.setFromMatrixPosition(_e.matrixWorld);const Se=oe.distanceTo(fe),qe=ue.projectionMatrix.elements,Me=_e.projectionMatrix.elements,We=qe[14]/(qe[10]-1),Ke=qe[14]/(qe[10]+1),ce=(qe[9]+1)/qe[5],Q=(qe[9]-1)/qe[5],Ge=(qe[8]-1)/qe[0],De=(Me[8]+1)/Me[0],Xe=We*Ge,Je=We*De,bt=Se/(-Ge+De),at=bt*-Ge;if(ue.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(at),le.translateZ(bt),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),qe[10]===-1)le.projectionMatrix.copy(ue.projectionMatrix),le.projectionMatrixInverse.copy(ue.projectionMatrixInverse);else{const ee=We+bt,W=Ke+bt,Ee=Xe-at,ze=Je+(Se-at),He=ce*Ke/W*ee,Be=Q*Ke/W*ee;le.projectionMatrix.makePerspective(Ee,ze,He,Be,ee,W),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function q(le,ue){ue===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(ue.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(i===null)return;let ue=le.near,_e=le.far;S.texture!==null&&(S.depthNear>0&&(ue=S.depthNear),S.depthFar>0&&(_e=S.depthFar)),k.near=F.near=D.near=ue,k.far=F.far=D.far=_e,(U!==k.near||H!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),U=k.near,H=k.far);const Se=le.parent,qe=k.cameras;q(k,Se);for(let Me=0;Me0&&(w.alphaTest.value=_.alphaTest);const E=e.get(_),T=E.envMap,C=E.envMapRotation;T&&(w.envMap.value=T,If.copy(C),If.x*=-1,If.y*=-1,If.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(If.y*=-1,If.z*=-1),w.envMapRotation.value.setFromMatrix4(tye.makeRotationFromEuler(If)),w.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=_.reflectivity,w.ior.value=_.ior,w.refractionRatio.value=_.refractionRatio),_.lightMap&&(w.lightMap.value=_.lightMap,w.lightMapIntensity.value=_.lightMapIntensity,n(_.lightMap,w.lightMapTransform)),_.aoMap&&(w.aoMap.value=_.aoMap,w.aoMapIntensity.value=_.aoMapIntensity,n(_.aoMap,w.aoMapTransform))}function o(w,_){w.diffuse.value.copy(_.color),w.opacity.value=_.opacity,_.map&&(w.map.value=_.map,n(_.map,w.mapTransform))}function a(w,_){w.dashSize.value=_.dashSize,w.totalSize.value=_.dashSize+_.gapSize,w.scale.value=_.scale}function l(w,_,E,T){w.diffuse.value.copy(_.color),w.opacity.value=_.opacity,w.size.value=_.size*E,w.scale.value=T*.5,_.map&&(w.map.value=_.map,n(_.map,w.uvTransform)),_.alphaMap&&(w.alphaMap.value=_.alphaMap,n(_.alphaMap,w.alphaMapTransform)),_.alphaTest>0&&(w.alphaTest.value=_.alphaTest)}function c(w,_){w.diffuse.value.copy(_.color),w.opacity.value=_.opacity,w.rotation.value=_.rotation,_.map&&(w.map.value=_.map,n(_.map,w.mapTransform)),_.alphaMap&&(w.alphaMap.value=_.alphaMap,n(_.alphaMap,w.alphaMapTransform)),_.alphaTest>0&&(w.alphaTest.value=_.alphaTest)}function d(w,_){w.specular.value.copy(_.specular),w.shininess.value=Math.max(_.shininess,1e-4)}function f(w,_){_.gradientMap&&(w.gradientMap.value=_.gradientMap)}function m(w,_){w.metalness.value=_.metalness,_.metalnessMap&&(w.metalnessMap.value=_.metalnessMap,n(_.metalnessMap,w.metalnessMapTransform)),w.roughness.value=_.roughness,_.roughnessMap&&(w.roughnessMap.value=_.roughnessMap,n(_.roughnessMap,w.roughnessMapTransform)),_.envMap&&(w.envMapIntensity.value=_.envMapIntensity)}function y(w,_,E){w.ior.value=_.ior,_.sheen>0&&(w.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),w.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(w.sheenColorMap.value=_.sheenColorMap,n(_.sheenColorMap,w.sheenColorMapTransform)),_.sheenRoughnessMap&&(w.sheenRoughnessMap.value=_.sheenRoughnessMap,n(_.sheenRoughnessMap,w.sheenRoughnessMapTransform))),_.clearcoat>0&&(w.clearcoat.value=_.clearcoat,w.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(w.clearcoatMap.value=_.clearcoatMap,n(_.clearcoatMap,w.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,n(_.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(w.clearcoatNormalMap.value=_.clearcoatNormalMap,n(_.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===ss&&w.clearcoatNormalScale.value.negate())),_.dispersion>0&&(w.dispersion.value=_.dispersion),_.iridescence>0&&(w.iridescence.value=_.iridescence,w.iridescenceIOR.value=_.iridescenceIOR,w.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(w.iridescenceMap.value=_.iridescenceMap,n(_.iridescenceMap,w.iridescenceMapTransform)),_.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=_.iridescenceThicknessMap,n(_.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),_.transmission>0&&(w.transmission.value=_.transmission,w.transmissionSamplerMap.value=E.texture,w.transmissionSamplerSize.value.set(E.width,E.height),_.transmissionMap&&(w.transmissionMap.value=_.transmissionMap,n(_.transmissionMap,w.transmissionMapTransform)),w.thickness.value=_.thickness,_.thicknessMap&&(w.thicknessMap.value=_.thicknessMap,n(_.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=_.attenuationDistance,w.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(w.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(w.anisotropyMap.value=_.anisotropyMap,n(_.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=_.specularIntensity,w.specularColor.value.copy(_.specularColor),_.specularColorMap&&(w.specularColorMap.value=_.specularColorMap,n(_.specularColorMap,w.specularColorMapTransform)),_.specularIntensityMap&&(w.specularIntensityMap.value=_.specularIntensityMap,n(_.specularIntensityMap,w.specularIntensityMapTransform))}function x(w,_){_.matcap&&(w.matcap.value=_.matcap)}function S(w,_){const E=e.get(_).light;w.referencePosition.value.setFromMatrixPosition(E.matrixWorld),w.nearDistance.value=E.shadow.camera.near,w.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function rye(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,T){const C=T.program;r.uniformBlockBinding(E,C)}function c(E,T){let C=i[E.id];C===void 0&&(x(E),C=d(E),i[E.id]=C,E.addEventListener("dispose",w));const O=T.program;r.updateUBOMapping(E,O);const N=e.render.frame;s[E.id]!==N&&(m(E),s[E.id]=N)}function d(E){const T=f();E.__bindingPointIndex=T;const C=t.createBuffer(),O=E.__size,N=E.usage;return t.bindBuffer(t.UNIFORM_BUFFER,C),t.bufferData(t.UNIFORM_BUFFER,O,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,T,C),C}function f(){for(let E=0;E0&&(C+=O-N),E.__size=C,E.__cache={},this}function S(E){const T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),T}function w(E){const T=E.target;T.removeEventListener("dispose",w);const C=o.indexOf(T.__bindingPointIndex);o.splice(C,1),t.deleteBuffer(i[T.id]),delete i[T.id],delete s[T.id]}function _(){for(const E in i)t.deleteBuffer(i[E]);o=[],i={},s={}}return{bind:l,update:c,dispose:_}}class y6{constructor(e={}){const{canvas:n=i6(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let m;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=r.getContextAttributes().alpha}else m=o;const y=new Uint32Array(4),x=new Int32Array(4);let S=null,w=null;const _=[],E=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ui,this.toneMapping=Pl,this.toneMappingExposure=1;const T=this;let C=!1,O=0,N=0,D=null,F=-1,V=null;const k=new Ln,U=new Ln;let H=null;const ne=new ct(0);let te=0,he=n.width,oe=n.height,fe=1,B=null,q=null;const K=new Ln(0,0,he,oe),$=new Ln(0,0,he,oe);let Z=!1;const ge=new dx;let le=!1,ue=!1;const _e=new Rt,Se=new Rt,qe=new X,Me=new Ln,We={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ke=!1;function ce(){return D===null?fe:1}let Q=r;function Ge(Y,xe){return n.getContext(Y,xe)}try{const Y={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Td}`),n.addEventListener("webglcontextlost",Oe,!1),n.addEventListener("webglcontextrestored",Ye,!1),n.addEventListener("webglcontextcreationerror",ft,!1),Q===null){const xe="webgl2";if(Q=Ge(xe,Y),Q===null)throw Ge(xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Y){throw console.error("THREE.WebGLRenderer: "+Y.message),Y}let De,Xe,Je,bt,at,ee,W,Ee,ze,He,Be,pt,nt,se,rt,$e,ut,Dt,Et,mt,de,J,Ae,re;function Ue(){De=new cve(Q),De.init(),J=new g6(Q,De),Xe=new rve(Q,De,e,J),Je=new V0e(Q),Xe.reverseDepthBuffer&&Je.buffers.depth.setReversed(!0),bt=new fve(Q),at=new R0e,ee=new K0e(Q,De,Je,at,Xe,J,bt),W=new sve(T),Ee=new lve(T),ze=new xpe(Q),Ae=new tve(Q,ze),He=new uve(Q,ze,bt,Ae),Be=new pve(Q,He,ze,bt),Et=new hve(Q,Xe,ee),$e=new ive(at),pt=new P0e(T,W,Ee,De,Xe,Ae,$e),nt=new nye(T,at),se=new I0e,rt=new U0e(De),Dt=new eve(T,W,Ee,Je,Be,m,l),ut=new B0e(T,Be,Xe),re=new rye(Q,bt,Xe,Je),mt=new nve(Q,De,bt),de=new dve(Q,De,bt),bt.programs=pt.programs,T.capabilities=Xe,T.extensions=De,T.properties=at,T.renderLists=se,T.shadowMap=ut,T.state=Je,T.info=bt}Ue();const Te=new eye(T,Q);this.xr=Te,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const Y=De.get("WEBGL_lose_context");Y&&Y.loseContext()},this.forceContextRestore=function(){const Y=De.get("WEBGL_lose_context");Y&&Y.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(Y){Y!==void 0&&(fe=Y,this.setSize(he,oe,!1))},this.getSize=function(Y){return Y.set(he,oe)},this.setSize=function(Y,xe,Pe=!0){if(Te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}he=Y,oe=xe,n.width=Math.floor(Y*fe),n.height=Math.floor(xe*fe),Pe===!0&&(n.style.width=Y+"px",n.style.height=xe+"px"),this.setViewport(0,0,Y,xe)},this.getDrawingBufferSize=function(Y){return Y.set(he*fe,oe*fe).floor()},this.setDrawingBufferSize=function(Y,xe,Pe){he=Y,oe=xe,fe=Pe,n.width=Math.floor(Y*Pe),n.height=Math.floor(xe*Pe),this.setViewport(0,0,Y,xe)},this.getCurrentViewport=function(Y){return Y.copy(k)},this.getViewport=function(Y){return Y.copy(K)},this.setViewport=function(Y,xe,Pe,Ie){Y.isVector4?K.set(Y.x,Y.y,Y.z,Y.w):K.set(Y,xe,Pe,Ie),Je.viewport(k.copy(K).multiplyScalar(fe).round())},this.getScissor=function(Y){return Y.copy($)},this.setScissor=function(Y,xe,Pe,Ie){Y.isVector4?$.set(Y.x,Y.y,Y.z,Y.w):$.set(Y,xe,Pe,Ie),Je.scissor(U.copy($).multiplyScalar(fe).round())},this.getScissorTest=function(){return Z},this.setScissorTest=function(Y){Je.setScissorTest(Z=Y)},this.setOpaqueSort=function(Y){B=Y},this.setTransparentSort=function(Y){q=Y},this.getClearColor=function(Y){return Y.copy(Dt.getClearColor())},this.setClearColor=function(){Dt.setClearColor.apply(Dt,arguments)},this.getClearAlpha=function(){return Dt.getClearAlpha()},this.setClearAlpha=function(){Dt.setClearAlpha.apply(Dt,arguments)},this.clear=function(Y=!0,xe=!0,Pe=!0){let Ie=0;if(Y){let we=!1;if(D!==null){const it=D.texture.format;we=it===KS||it===qS||it===ax}if(we){const it=D.texture.type,xt=it===Ha||it===eu||it===Og||it===Uh||it===WS||it===$S,lt=Dt.getClearColor(),At=Dt.getClearAlpha(),zt=lt.r,Vt=lt.g,Nt=lt.b;xt?(y[0]=zt,y[1]=Vt,y[2]=Nt,y[3]=At,Q.clearBufferuiv(Q.COLOR,0,y)):(x[0]=zt,x[1]=Vt,x[2]=Nt,x[3]=At,Q.clearBufferiv(Q.COLOR,0,x))}else Ie|=Q.COLOR_BUFFER_BIT}xe&&(Ie|=Q.DEPTH_BUFFER_BIT,Q.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Pe&&(Ie|=Q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Q.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",Oe,!1),n.removeEventListener("webglcontextrestored",Ye,!1),n.removeEventListener("webglcontextcreationerror",ft,!1),se.dispose(),rt.dispose(),at.dispose(),W.dispose(),Ee.dispose(),Be.dispose(),Ae.dispose(),re.dispose(),pt.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",Si),Te.removeEventListener("sessionend",ra),Mi.stop()};function Oe(Y){Y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),C=!0}function Ye(){console.log("THREE.WebGLRenderer: Context Restored."),C=!1;const Y=bt.autoReset,xe=ut.enabled,Pe=ut.autoUpdate,Ie=ut.needsUpdate,we=ut.type;Ue(),bt.autoReset=Y,ut.enabled=xe,ut.autoUpdate=Pe,ut.needsUpdate=Ie,ut.type=we}function ft(Y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Y.statusMessage)}function Yt(Y){const xe=Y.target;xe.removeEventListener("dispose",Yt),un(xe)}function un(Y){Cn(Y),at.remove(Y)}function Cn(Y){const xe=at.get(Y).programs;xe!==void 0&&(xe.forEach(function(Pe){pt.releaseProgram(Pe)}),Y.isShaderMaterial&&pt.releaseShaderCache(Y))}this.renderBufferDirect=function(Y,xe,Pe,Ie,we,it){xe===null&&(xe=We);const xt=we.isMesh&&we.matrixWorld.determinant()<0,lt=To(Y,xe,Pe,Ie,we);Je.setMaterial(Ie,xt);let At=Pe.index,zt=1;if(Ie.wireframe===!0){if(At=He.getWireframeAttribute(Pe),At===void 0)return;zt=2}const Vt=Pe.drawRange,Nt=Pe.attributes.position;let Sn=Vt.start*zt,Mn=(Vt.start+Vt.count)*zt;it!==null&&(Sn=Math.max(Sn,it.start*zt),Mn=Math.min(Mn,(it.start+it.count)*zt)),At!==null?(Sn=Math.max(Sn,0),Mn=Math.min(Mn,At.count)):Nt!=null&&(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Nt.count));const yn=Mn-Sn;if(yn<0||yn===1/0)return;Ae.setup(we,Ie,lt,Pe,At);let Zt,Ut=mt;if(At!==null&&(Zt=ze.get(At),Ut=de,Ut.setIndex(Zt)),we.isMesh)Ie.wireframe===!0?(Je.setLineWidth(Ie.wireframeLinewidth*ce()),Ut.setMode(Q.LINES)):Ut.setMode(Q.TRIANGLES);else if(we.isLine){let gt=Ie.linewidth;gt===void 0&&(gt=1),Je.setLineWidth(gt*ce()),we.isLineSegments?Ut.setMode(Q.LINES):we.isLineLoop?Ut.setMode(Q.LINE_LOOP):Ut.setMode(Q.LINE_STRIP)}else we.isPoints?Ut.setMode(Q.POINTS):we.isSprite&&Ut.setMode(Q.TRIANGLES);if(we.isBatchedMesh)if(we._multiDrawInstances!==null)Ut.renderMultiDrawInstances(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount,we._multiDrawInstances);else if(De.get("WEBGL_multi_draw"))Ut.renderMultiDraw(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount);else{const gt=we._multiDrawStarts,xn=we._multiDrawCounts,tn=we._multiDrawCount,Pr=At?ze.get(At).bytesPerElement:1,li=at.get(Ie).currentProgram.getUniforms();for(let kn=0;kn{function it(){if(Ie.forEach(function(xt){at.get(xt).currentProgram.isReady()&&Ie.delete(xt)}),Ie.size===0){we(Y);return}setTimeout(it,10)}De.get("KHR_parallel_shader_compile")!==null?it():setTimeout(it,10)})};let Hn=null;function hr(Y){Hn&&Hn(Y)}function Si(){Mi.stop()}function ra(){Mi.start()}const Mi=new d6;Mi.setAnimationLoop(hr),typeof self<"u"&&Mi.setContext(self),this.setAnimationLoop=function(Y){Hn=Y,Te.setAnimationLoop(Y),Y===null?Mi.stop():Mi.start()},Te.addEventListener("sessionstart",Si),Te.addEventListener("sessionend",ra),this.render=function(Y,xe){if(xe!==void 0&&xe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;if(Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),xe.parent===null&&xe.matrixWorldAutoUpdate===!0&&xe.updateMatrixWorld(),Te.enabled===!0&&Te.isPresenting===!0&&(Te.cameraAutoUpdate===!0&&Te.updateCamera(xe),xe=Te.getCamera()),Y.isScene===!0&&Y.onBeforeRender(T,Y,xe,D),w=rt.get(Y,E.length),w.init(xe),E.push(w),Se.multiplyMatrices(xe.projectionMatrix,xe.matrixWorldInverse),ge.setFromProjectionMatrix(Se),ue=this.localClippingEnabled,le=$e.init(this.clippingPlanes,ue),S=se.get(Y,_.length),S.init(),_.push(S),Te.enabled===!0&&Te.isPresenting===!0){const it=T.xr.getDepthSensingMesh();it!==null&&Ka(it,xe,-1/0,T.sortObjects)}Ka(Y,xe,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(B,q),Ke=Te.enabled===!1||Te.isPresenting===!1||Te.hasDepthSensing()===!1,Ke&&Dt.addToRenderList(S,Y),this.info.render.frame++,le===!0&&$e.beginShadows();const Pe=w.state.shadowsArray;ut.render(Pe,Y,xe),le===!0&&$e.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ie=S.opaque,we=S.transmissive;if(w.setupLights(),xe.isArrayCamera){const it=xe.cameras;if(we.length>0)for(let xt=0,lt=it.length;xt0&&ia(Ie,we,Y,xe),Ke&&Dt.render(Y),Ns(S,Y,xe);D!==null&&(ee.updateMultisampleRenderTarget(D),ee.updateRenderTargetMipmap(D)),Y.isScene===!0&&Y.onAfterRender(T,Y,xe),Ae.resetDefaultState(),F=-1,V=null,E.pop(),E.length>0?(w=E[E.length-1],le===!0&&$e.setGlobalState(T.clippingPlanes,w.state.camera)):w=null,_.pop(),_.length>0?S=_[_.length-1]:S=null};function Ka(Y,xe,Pe,Ie){if(Y.visible===!1)return;if(Y.layers.test(xe.layers)){if(Y.isGroup)Pe=Y.renderOrder;else if(Y.isLOD)Y.autoUpdate===!0&&Y.update(xe);else if(Y.isLight)w.pushLight(Y),Y.castShadow&&w.pushShadow(Y);else if(Y.isSprite){if(!Y.frustumCulled||ge.intersectsSprite(Y)){Ie&&Me.setFromMatrixPosition(Y.matrixWorld).applyMatrix4(Se);const xt=Be.update(Y),lt=Y.material;lt.visible&&S.push(Y,xt,lt,Pe,Me.z,null)}}else if((Y.isMesh||Y.isLine||Y.isPoints)&&(!Y.frustumCulled||ge.intersectsObject(Y))){const xt=Be.update(Y),lt=Y.material;if(Ie&&(Y.boundingSphere!==void 0?(Y.boundingSphere===null&&Y.computeBoundingSphere(),Me.copy(Y.boundingSphere.center)):(xt.boundingSphere===null&&xt.computeBoundingSphere(),Me.copy(xt.boundingSphere.center)),Me.applyMatrix4(Y.matrixWorld).applyMatrix4(Se)),Array.isArray(lt)){const At=xt.groups;for(let zt=0,Vt=At.length;zt0&&Ei(we,xe,Pe),it.length>0&&Ei(it,xe,Pe),xt.length>0&&Ei(xt,xe,Pe),Je.buffers.depth.setTest(!0),Je.buffers.depth.setMask(!0),Je.buffers.color.setMask(!0),Je.setPolygonOffset(!1)}function ia(Y,xe,Pe,Ie){if((Pe.isScene===!0?Pe.overrideMaterial:null)!==null)return;w.state.transmissionRenderTarget[Ie.id]===void 0&&(w.state.transmissionRenderTarget[Ie.id]=new Va(1,1,{generateMipmaps:!0,type:De.has("EXT_color_buffer_half_float")||De.has("EXT_color_buffer_float")?rv:Ha,minFilter:qo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:In.workingColorSpace}));const it=w.state.transmissionRenderTarget[Ie.id],xt=Ie.viewport||k;it.setSize(xt.z,xt.w);const lt=T.getRenderTarget();T.setRenderTarget(it),T.getClearColor(ne),te=T.getClearAlpha(),te<1&&T.setClearColor(16777215,.5),T.clear(),Ke&&Dt.render(Pe);const At=T.toneMapping;T.toneMapping=Pl;const zt=Ie.viewport;if(Ie.viewport!==void 0&&(Ie.viewport=void 0),w.setupLightsView(Ie),le===!0&&$e.setGlobalState(T.clippingPlanes,Ie),Ei(Y,Pe,Ie),ee.updateMultisampleRenderTarget(it),ee.updateRenderTargetMipmap(it),De.has("WEBGL_multisampled_render_to_texture")===!1){let Vt=!1;for(let Nt=0,Sn=xe.length;Nt0),Nt=!!Pe.morphAttributes.position,Sn=!!Pe.morphAttributes.normal,Mn=!!Pe.morphAttributes.color;let yn=Pl;Ie.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(yn=T.toneMapping);const Zt=Pe.morphAttributes.position||Pe.morphAttributes.normal||Pe.morphAttributes.color,Ut=Zt!==void 0?Zt.length:0,gt=at.get(Ie),xn=w.state.lights;if(le===!0&&(ue===!0||Y!==V)){const Xr=Y===V&&Ie.id===F;$e.setState(Ie,Y,Xr)}let tn=!1;Ie.version===gt.__version?(gt.needsLights&>.lightsStateVersion!==xn.state.version||gt.outputColorSpace!==lt||we.isBatchedMesh&>.batching===!1||!we.isBatchedMesh&>.batching===!0||we.isBatchedMesh&>.batchingColor===!0&&we.colorTexture===null||we.isBatchedMesh&>.batchingColor===!1&&we.colorTexture!==null||we.isInstancedMesh&>.instancing===!1||!we.isInstancedMesh&>.instancing===!0||we.isSkinnedMesh&>.skinning===!1||!we.isSkinnedMesh&>.skinning===!0||we.isInstancedMesh&>.instancingColor===!0&&we.instanceColor===null||we.isInstancedMesh&>.instancingColor===!1&&we.instanceColor!==null||we.isInstancedMesh&>.instancingMorph===!0&&we.morphTexture===null||we.isInstancedMesh&>.instancingMorph===!1&&we.morphTexture!==null||gt.envMap!==At||Ie.fog===!0&>.fog!==it||gt.numClippingPlanes!==void 0&&(gt.numClippingPlanes!==$e.numPlanes||gt.numIntersection!==$e.numIntersection)||gt.vertexAlphas!==zt||gt.vertexTangents!==Vt||gt.morphTargets!==Nt||gt.morphNormals!==Sn||gt.morphColors!==Mn||gt.toneMapping!==yn||gt.morphTargetsCount!==Ut)&&(tn=!0):(tn=!0,gt.__version=Ie.version);let Pr=gt.currentProgram;tn===!0&&(Pr=sa(Ie,xe,we));let li=!1,kn=!1,Is=!1;const Vn=Pr.getUniforms(),to=gt.uniforms;if(Je.useProgram(Pr.program)&&(li=!0,kn=!0,Is=!0),Ie.id!==F&&(F=Ie.id,kn=!0),li||V!==Y){Xe.reverseDepthBuffer?(_e.copy(Y.projectionMatrix),Vhe(_e),Ghe(_e),Vn.setValue(Q,"projectionMatrix",_e)):Vn.setValue(Q,"projectionMatrix",Y.projectionMatrix),Vn.setValue(Q,"viewMatrix",Y.matrixWorldInverse);const Xr=Vn.map.cameraPosition;Xr!==void 0&&Xr.setValue(Q,qe.setFromMatrixPosition(Y.matrixWorld)),Xe.logarithmicDepthBuffer&&Vn.setValue(Q,"logDepthBufFC",2/(Math.log(Y.far+1)/Math.LN2)),(Ie.isMeshPhongMaterial||Ie.isMeshToonMaterial||Ie.isMeshLambertMaterial||Ie.isMeshBasicMaterial||Ie.isMeshStandardMaterial||Ie.isShaderMaterial)&&Vn.setValue(Q,"isOrthographic",Y.isOrthographicCamera===!0),V!==Y&&(V=Y,kn=!0,Is=!0)}if(we.isSkinnedMesh){Vn.setOptional(Q,we,"bindMatrix"),Vn.setOptional(Q,we,"bindMatrixInverse");const Xr=we.skeleton;Xr&&(Xr.boneTexture===null&&Xr.computeBoneTexture(),Vn.setValue(Q,"boneTexture",Xr.boneTexture,ee))}we.isBatchedMesh&&(Vn.setOptional(Q,we,"batchingTexture"),Vn.setValue(Q,"batchingTexture",we._matricesTexture,ee),Vn.setOptional(Q,we,"batchingIdTexture"),Vn.setValue(Q,"batchingIdTexture",we._indirectTexture,ee),Vn.setOptional(Q,we,"batchingColorTexture"),we._colorsTexture!==null&&Vn.setValue(Q,"batchingColorTexture",we._colorsTexture,ee));const Ya=Pe.morphAttributes;if((Ya.position!==void 0||Ya.normal!==void 0||Ya.color!==void 0)&&Et.update(we,Pe,Pr),(kn||gt.receiveShadow!==we.receiveShadow)&&(gt.receiveShadow=we.receiveShadow,Vn.setValue(Q,"receiveShadow",we.receiveShadow)),Ie.isMeshGouraudMaterial&&Ie.envMap!==null&&(to.envMap.value=At,to.flipEnvMap.value=At.isCubeTexture&&At.isRenderTargetTexture===!1?-1:1),Ie.isMeshStandardMaterial&&Ie.envMap===null&&xe.environment!==null&&(to.envMapIntensity.value=xe.environmentIntensity),kn&&(Vn.setValue(Q,"toneMappingExposure",T.toneMappingExposure),gt.needsLights&&du(to,Is),it&&Ie.fog===!0&&nt.refreshFogUniforms(to,it),nt.refreshMaterialUniforms(to,Ie,fe,oe,w.state.transmissionRenderTarget[Y.id]),X_.upload(Q,cu(gt),to,ee)),Ie.isShaderMaterial&&Ie.uniformsNeedUpdate===!0&&(X_.upload(Q,cu(gt),to,ee),Ie.uniformsNeedUpdate=!1),Ie.isSpriteMaterial&&Vn.setValue(Q,"center",we.center),Vn.setValue(Q,"modelViewMatrix",we.modelViewMatrix),Vn.setValue(Q,"normalMatrix",we.normalMatrix),Vn.setValue(Q,"modelMatrix",we.matrixWorld),Ie.isShaderMaterial||Ie.isRawShaderMaterial){const Xr=Ie.uniformsGroups;for(let ci=0,Ld=Xr.length;ci0&&ee.useMultisampledRTT(Y)===!1?we=at.get(Y).__webglMultisampledFramebuffer:Array.isArray(Vt)?we=Vt[Pe]:we=Vt,k.copy(Y.viewport),U.copy(Y.scissor),H=Y.scissorTest}else k.copy(K).multiplyScalar(fe).floor(),U.copy($).multiplyScalar(fe).floor(),H=Z;if(Je.bindFramebuffer(Q.FRAMEBUFFER,we)&&Ie&&Je.drawBuffers(Y,we),Je.viewport(k),Je.scissor(U),Je.setScissorTest(H),it){const At=at.get(Y.texture);Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_CUBE_MAP_POSITIVE_X+xe,At.__webglTexture,Pe)}else if(xt){const At=at.get(Y.texture),zt=xe||0;Q.framebufferTextureLayer(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,At.__webglTexture,Pe||0,zt)}F=-1},this.readRenderTargetPixels=function(Y,xe,Pe,Ie,we,it,xt){if(!(Y&&Y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let lt=at.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&xt!==void 0&&(lt=lt[xt]),lt){Je.bindFramebuffer(Q.FRAMEBUFFER,lt);try{const At=Y.texture,zt=At.format,Vt=At.type;if(!Xe.textureFormatReadable(zt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Xe.textureTypeReadable(Vt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}xe>=0&&xe<=Y.width-Ie&&Pe>=0&&Pe<=Y.height-we&&Q.readPixels(xe,Pe,Ie,we,J.convert(zt),J.convert(Vt),it)}finally{const At=D!==null?at.get(D).__webglFramebuffer:null;Je.bindFramebuffer(Q.FRAMEBUFFER,At)}}},this.readRenderTargetPixelsAsync=async function(Y,xe,Pe,Ie,we,it,xt){if(!(Y&&Y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let lt=at.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&xt!==void 0&&(lt=lt[xt]),lt){const At=Y.texture,zt=At.format,Vt=At.type;if(!Xe.textureFormatReadable(zt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Xe.textureTypeReadable(Vt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(xe>=0&&xe<=Y.width-Ie&&Pe>=0&&Pe<=Y.height-we){Je.bindFramebuffer(Q.FRAMEBUFFER,lt);const Nt=Q.createBuffer();Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Nt),Q.bufferData(Q.PIXEL_PACK_BUFFER,it.byteLength,Q.STREAM_READ),Q.readPixels(xe,Pe,Ie,we,J.convert(zt),J.convert(Vt),0);const Sn=D!==null?at.get(D).__webglFramebuffer:null;Je.bindFramebuffer(Q.FRAMEBUFFER,Sn);const Mn=Q.fenceSync(Q.SYNC_GPU_COMMANDS_COMPLETE,0);return Q.flush(),await Hhe(Q,Mn,4),Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Nt),Q.getBufferSubData(Q.PIXEL_PACK_BUFFER,0,it),Q.deleteBuffer(Nt),Q.deleteSync(Mn),it}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(Y,xe=null,Pe=0){Y.isTexture!==!0&&($_("WebGLRenderer: copyFramebufferToTexture function signature has changed."),xe=arguments[0]||null,Y=arguments[1]);const Ie=Math.pow(2,-Pe),we=Math.floor(Y.image.width*Ie),it=Math.floor(Y.image.height*Ie),xt=xe!==null?xe.x:0,lt=xe!==null?xe.y:0;ee.setTexture2D(Y,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,Pe,0,0,xt,lt,we,it),Je.unbindTexture()},this.copyTextureToTexture=function(Y,xe,Pe=null,Ie=null,we=0){Y.isTexture!==!0&&($_("WebGLRenderer: copyTextureToTexture function signature has changed."),Ie=arguments[0]||null,Y=arguments[1],xe=arguments[2],we=arguments[3]||0,Pe=null);let it,xt,lt,At,zt,Vt;Pe!==null?(it=Pe.max.x-Pe.min.x,xt=Pe.max.y-Pe.min.y,lt=Pe.min.x,At=Pe.min.y):(it=Y.image.width,xt=Y.image.height,lt=0,At=0),Ie!==null?(zt=Ie.x,Vt=Ie.y):(zt=0,Vt=0);const Nt=J.convert(xe.format),Sn=J.convert(xe.type);ee.setTexture2D(xe,0),Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,xe.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,xe.unpackAlignment);const Mn=Q.getParameter(Q.UNPACK_ROW_LENGTH),yn=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),Zt=Q.getParameter(Q.UNPACK_SKIP_PIXELS),Ut=Q.getParameter(Q.UNPACK_SKIP_ROWS),gt=Q.getParameter(Q.UNPACK_SKIP_IMAGES),xn=Y.isCompressedTexture?Y.mipmaps[we]:Y.image;Q.pixelStorei(Q.UNPACK_ROW_LENGTH,xn.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,xn.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,lt),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,At),Y.isDataTexture?Q.texSubImage2D(Q.TEXTURE_2D,we,zt,Vt,it,xt,Nt,Sn,xn.data):Y.isCompressedTexture?Q.compressedTexSubImage2D(Q.TEXTURE_2D,we,zt,Vt,xn.width,xn.height,Nt,xn.data):Q.texSubImage2D(Q.TEXTURE_2D,we,zt,Vt,it,xt,Nt,Sn,xn),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,Mn),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,yn),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Zt),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Ut),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,gt),we===0&&xe.generateMipmaps&&Q.generateMipmap(Q.TEXTURE_2D),Je.unbindTexture()},this.copyTextureToTexture3D=function(Y,xe,Pe=null,Ie=null,we=0){Y.isTexture!==!0&&($_("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Pe=arguments[0]||null,Ie=arguments[1]||null,Y=arguments[2],xe=arguments[3],we=arguments[4]||0);let it,xt,lt,At,zt,Vt,Nt,Sn,Mn;const yn=Y.isCompressedTexture?Y.mipmaps[we]:Y.image;Pe!==null?(it=Pe.max.x-Pe.min.x,xt=Pe.max.y-Pe.min.y,lt=Pe.max.z-Pe.min.z,At=Pe.min.x,zt=Pe.min.y,Vt=Pe.min.z):(it=yn.width,xt=yn.height,lt=yn.depth,At=0,zt=0,Vt=0),Ie!==null?(Nt=Ie.x,Sn=Ie.y,Mn=Ie.z):(Nt=0,Sn=0,Mn=0);const Zt=J.convert(xe.format),Ut=J.convert(xe.type);let gt;if(xe.isData3DTexture)ee.setTexture3D(xe,0),gt=Q.TEXTURE_3D;else if(xe.isDataArrayTexture||xe.isCompressedArrayTexture)ee.setTexture2DArray(xe,0),gt=Q.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,xe.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,xe.unpackAlignment);const xn=Q.getParameter(Q.UNPACK_ROW_LENGTH),tn=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),Pr=Q.getParameter(Q.UNPACK_SKIP_PIXELS),li=Q.getParameter(Q.UNPACK_SKIP_ROWS),kn=Q.getParameter(Q.UNPACK_SKIP_IMAGES);Q.pixelStorei(Q.UNPACK_ROW_LENGTH,yn.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,yn.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,At),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,zt),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,Vt),Y.isDataTexture||Y.isData3DTexture?Q.texSubImage3D(gt,we,Nt,Sn,Mn,it,xt,lt,Zt,Ut,yn.data):xe.isCompressedArrayTexture?Q.compressedTexSubImage3D(gt,we,Nt,Sn,Mn,it,xt,lt,Zt,yn.data):Q.texSubImage3D(gt,we,Nt,Sn,Mn,it,xt,lt,Zt,Ut,yn),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,xn),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,tn),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Pr),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,li),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,kn),we===0&&xe.generateMipmaps&&Q.generateMipmap(gt),Je.unbindTexture()},this.initRenderTarget=function(Y){at.get(Y).__webglFramebuffer===void 0&&ee.setupRenderTarget(Y)},this.initTexture=function(Y){Y.isCubeTexture?ee.setTextureCube(Y,0):Y.isData3DTexture?ee.setTexture3D(Y,0):Y.isDataArrayTexture||Y.isCompressedArrayTexture?ee.setTexture2DArray(Y,0):ee.setTexture2D(Y,0),Je.unbindTexture()},this.resetState=function(){O=0,N=0,D=null,Je.reset(),Ae.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=In.workingColorSpace===lx?"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 as,this.environmentIntensity=1,this.environmentRotation=new as,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 tp{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=Ry,this.updateRanges=[],this.version=0,this.uuid=So()}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:_0.clone(),uv:Ks.getInterpolation(_0,r_,S0,i_,TD,wA,CD,new Ve),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function s_(t,e,n,r,i,s){Pm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(w0.x=s*Pm.x-i*Pm.y,w0.y=i*Pm.x+s*Pm.y):w0.copy(Pm),t.copy(e),t.x+=w0.x,t.y+=w0.y,t.applyMatrix4(x6)}const o_=new X,PD=new X;class _6 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){o_.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(o_);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){o_.setFromMatrixPosition(e.matrixWorld),PD.setFromMatrixPosition(this.matrixWorld);const r=o_.distanceTo(PD)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i=o)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}}const Ju=new Rt,EA=new Rt,uye=new Rt,dye=new ct(1,1,1),UD=new Rt,AA=new dx,c_=new os,kf=new Bi,A0=new X,FD=new X,fye=new X,TA=new cye,es=new yr,u_=[];function hye(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 Jt(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,o=s.image.data;uye.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(dye.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,n=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),n===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=n,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),d=c!==null;if(d&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const f=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:d?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new os,sphereInitialized:!1,sphere:new Bi}),this.setGeometryAt(f,e),f}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=n.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||n.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const y in r.attributes){const x=n.getAttribute(y),S=r.getAttribute(y);hye(x,S,l);const w=x.itemSize;for(let _=x.count,E=c;_=n.length||n[e].active===!1?this:(n[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,n){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,d=l.start+l.count;c=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,c_),c_.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let d=l.start,f=l.start+l.count;d=r.length||r[e].active===!1?this:(n.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,n){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:n.fromArray(i,e*16)}setColorAt(e,n){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(n.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,n){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:n.fromArray(r,e*4)}setVisibleAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===n?this:(r[e].visible=n,this._visibilityChanged=!0,this)}getVisibleAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?!1:n[e].visible}setGeometryIdAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||n<0||n>=this._geometryCount?null:(r[e].geometryIndex=n,this)}getGeometryIdAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?-1:n[e].geometryIndex}getGeometryRangeAt(e,n={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return n.start=r.start,n.count=r.count,n}raycast(e,n){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,o=this.geometry;es.material=this.material,es.geometry.index=o.index,es.geometry.attributes=o.attributes,es.geometry.boundingBox===null&&(es.geometry.boundingBox=new os),es.geometry.boundingSphere===null&&(es.geometry.boundingSphere=new Bi);for(let a=0,l=r.length;a({...n})),this._reservedRanges=e._reservedRanges.map(n=>({...n})),this._drawInfo=e._drawInfo.map(n=>({...n})),this._bounds=e._bounds.map(n=>({boxInitialized:n.boxInitialized,box:n.box.clone(),sphereInitialized:n.sphereInitialized,sphere:n.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,n,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,m=this.perObjectFrustumCulled,y=this._indirectTexture,x=y.image.data;m&&(UD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),AA.setFromProjectionMatrix(UD,e.coordinateSystem));let S=0;if(this.sortObjects){EA.copy(this.matrixWorld).invert(),A0.setFromMatrixPosition(r.matrixWorld).applyMatrix4(EA),FD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(EA);for(let E=0,T=l.length;E0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;CA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(CA);if(!(le.far))return{distance:l,point:BD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const HD=new X,VD=new X;class eo extends zl{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[];for(let i=0,s=n.count;i0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class pye extends dr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o: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 mye extends dr{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 dr{constructor(e,n,r,i,s,o,a,l,c,d,f,m){super(null,o,a,l,c,d,i,s,f,m),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class gye extends sM{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=_o,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class vye extends sM{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,Jc),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class yye extends dr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Xa{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),s=0;n.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const r=this.getLengths();let i=0;const s=r.length;let o;n?o=n:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const d=r[i],m=r[i+1]-d,y=(o-d)/m;return(i+y)/(s-1)}getTangent(e,n){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=n||(o.isVector2?new Ve:new X);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new X,i=[],s=[],o=[],a=new X,l=new Rt;for(let y=0;y<=e;y++){const x=y/e;i[y]=this.getTangentAt(x,new X)}s[0]=new X,o[0]=new X;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),m=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),m<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let y=1;y<=e;y++){if(s[y]=s[y-1].clone(),o[y]=o[y-1].clone(),a.crossVectors(i[y-1],i[y]),a.length()>Number.EPSILON){a.normalize();const x=Math.acos(Ar(i[y-1].dot(i[y]),-1,1));s[y].applyMatrix4(l.makeRotationAxis(a,x))}o[y].crossVectors(i[y],s[y])}if(n===!0){let y=Math.acos(Ar(s[0].dot(s[e]),-1,1));y/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(y=-y);for(let x=1;x<=e;x++)s[x].applyMatrix4(l.makeRotationAxis(i[x],y*x)),o[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class oM extends Xa{constructor(e=0,n=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n=new Ve){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,d;this.closed||a>0?c=i[(a-1)%s]:(m_.subVectors(i[0],i[1]).add(i[0]),c=m_);const f=i[a%s],m=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set($D(a,l.x,c.x,d.x,f.x),$D(a,l.y,c.y,d.y,f.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;r1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const d=c.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class fx extends Qt{constructor(e=[new Ve(0,-.5),new Ve(.5,0),new Ve(0,.5)],n=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=Ar(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/n,f=new X,m=new Ve,y=new X,x=new X,S=new X;let w=0,_=0;for(let E=0;E<=e.length-1;E++)switch(E){case 0:w=e[E+1].x-e[E].x,_=e[E+1].y-e[E].y,y.x=_*1,y.y=-w,y.z=_*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[E+1].x-e[E].x,_=e[E+1].y-e[E].y,y.x=_*1,y.y=-w,y.z=_*0,x.copy(y),y.x+=S.x,y.y+=S.y,y.z+=S.z,y.normalize(),l.push(y.x,y.y,y.z),S.copy(x)}for(let E=0;E<=n;E++){const T=r+E*d*i,C=Math.sin(T),O=Math.cos(T);for(let N=0;N<=e.length-1;N++){f.x=e[N].x*C,f.y=e[N].y,f.z=e[N].x*O,o.push(f.x,f.y,f.z),m.x=E/n,m.y=N/(e.length-1),a.push(m.x,m.y);const D=l[3*N+0]*C,F=l[3*N+1],V=l[3*N+0]*O;c.push(D,F,V)}}for(let E=0;E0&&T(!0),n>0&&T(!1)),this.setIndex(d),this.setAttribute("position",new Lt(f,3)),this.setAttribute("normal",new Lt(m,3)),this.setAttribute("uv",new Lt(y,2));function E(){const C=new X,O=new X;let N=0;const D=(n-e)/r;for(let F=0;F<=s;F++){const V=[],k=F/s,U=k*(n-e)+e;for(let H=0;H<=i;H++){const ne=H/i,te=ne*l+a,he=Math.sin(te),oe=Math.cos(te);O.x=U*he,O.y=-k*r+w,O.z=U*oe,f.push(O.x,O.y,O.z),C.set(he,D,oe).normalize(),m.push(C.x,C.y,C.z),y.push(ne,1-k),V.push(x++)}S.push(V)}for(let F=0;F0&&(d.push(k,U,ne),N+=3),n>0&&(d.push(U,H,ne),N+=3)}c.addGroup(_,N,0),_+=N}function T(C){const O=x,N=new Ve,D=new X;let F=0;const V=C===!0?e:n,k=C===!0?1:-1;for(let H=1;H<=i;H++)f.push(0,w*k,0),m.push(0,k,0),y.push(.5,.5),x++;const U=x;for(let H=0;H<=i;H++){const te=H/i*l+a,he=Math.cos(te),oe=Math.sin(te);D.x=V*oe,D.y=w*k,D.z=V*he,f.push(D.x,D.y,D.z),m.push(0,k,0),N.x=he*.5+.5,N.y=oe*.5*k+.5,y.push(N.x,N.y),x++}for(let H=0;H.9&&D<.1&&(T<.2&&(o[E+0]+=1),C<.2&&(o[E+2]+=1),O<.2&&(o[E+4]+=1))}}function m(E){s.push(E.x,E.y,E.z)}function y(E,T){const C=E*3;T.x=e[C+0],T.y=e[C+1],T.z=e[C+2]}function x(){const E=new X,T=new X,C=new X,O=new X,N=new Ve,D=new Ve,F=new Ve;for(let V=0,k=0;V80*n){a=c=t[0],l=d=t[1];for(let x=n;xc&&(c=f),m>d&&(d=m);y=Math.max(c-a,d-l),y=y!==0?32767/y:0}return Oy(s,o,n,a,l,y,0),o}};function P6(t,e,n,r,i){let s,o;if(i===Hye(t,e,n,r)>0)for(s=e;s=e;s-=r)o=XD(s,t[s],t[s+1],o);return o&&dM(o,o.next)&&(Dy(o),o=o.next),o}function Bh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(dM(n,n.next)||vr(n.prev,n,n.next)===0)){if(Dy(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Oy(t,e,n,r,i,s,o){if(!t)return;!o&&s&&Dye(t,r,i,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Cye(t,r,i,s):Tye(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Dy(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=Pye(Bh(t),e,n),Oy(t,e,n,r,i,s,2)):o===2&&Rye(t,e,n,r,i,s):Oy(Bh(t),e,n,r,i,s,1);break}}}function Tye(t){const e=t.prev,n=t,r=t.next;if(vr(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,c=r.y,d=is?i>o?i:o:s>o?s:o,y=a>l?a>c?a:c:l>c?l:c;let x=r.next;for(;x!==e;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=y&&Km(i,a,s,l,o,c,x.x,x.y)&&vr(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function Cye(t,e,n,r){const i=t.prev,s=t,o=t.next;if(vr(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,d=i.y,f=s.y,m=o.y,y=al?a>c?a:c:l>c?l:c,w=d>f?d>m?d:m:f>m?f:m,_=QC(y,x,e,n,r),E=QC(S,w,e,n,r);let T=t.prevZ,C=t.nextZ;for(;T&&T.z>=_&&C&&C.z<=E;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==o&&Km(a,d,l,f,c,m,T.x,T.y)&&vr(T.prev,T,T.next)>=0||(T=T.prevZ,C.x>=y&&C.x<=S&&C.y>=x&&C.y<=w&&C!==i&&C!==o&&Km(a,d,l,f,c,m,C.x,C.y)&&vr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;T&&T.z>=_;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==o&&Km(a,d,l,f,c,m,T.x,T.y)&&vr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;C&&C.z<=E;){if(C.x>=y&&C.x<=S&&C.y>=x&&C.y<=w&&C!==i&&C!==o&&Km(a,d,l,f,c,m,C.x,C.y)&&vr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Pye(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!dM(i,s)&&R6(i,r,r.next,s)&&Ly(i,s)&&Ly(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Dy(r),Dy(r.next),r=t=s),r=r.next}while(r!==t);return Bh(r)}function Rye(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Fye(o,a)){let l=N6(o,a);o=Bh(o,o.next),l=Bh(l,l.next),Oy(o,e,n,r,i,s,0),Oy(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function Nye(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const m=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(m<=s&&m>r&&(r=m,i=n.x=n.x&&n.x>=l&&s!==n.x&&Km(oi.x||n.x===i.x&&Lye(i,n)))&&(i=n,d=f)),n=n.next;while(n!==a);return i}function Lye(t,e){return vr(t.prev,t,e.prev)<0&&vr(e.next,t,t.next)<0}function Dye(t,e,n,r){let i=t;do i.z===0&&(i.z=QC(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,jye(i)}function jye(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function QC(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 Uye(t){let e=t,n=t;do(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function Fye(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!zye(t,e)&&(Ly(t,e)&&Ly(e,t)&&Bye(t,e)&&(vr(t.prev,t,e.prev)||vr(t,e.prev,e))||dM(t,e)&&vr(t.prev,t,t.next)>0&&vr(e.prev,e,e.next)>0)}function vr(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 R6(t,e,n,r){const i=b_(vr(t,e,n)),s=b_(vr(t,e,r)),o=b_(vr(n,r,t)),a=b_(vr(n,r,e));return!!(i!==s&&o!==a||i===0&&x_(t,n,e)||s===0&&x_(t,r,e)||o===0&&x_(n,t,r)||a===0&&x_(n,e,r))}function x_(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 b_(t){return t>0?1:t<0?-1:0}function zye(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&&R6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function Ly(t,e){return vr(t.prev,t,t.next)<0?vr(t,e,t.next)>=0&&vr(t,t.prev,e)>=0:vr(t,e,t.prev)<0||vr(t,t.next,e)<0}function Bye(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 N6(t,e){const n=new JC(t.i,t.x,t.y),r=new JC(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 XD(t,e,n,r){const i=new JC(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 Dy(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 JC(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 Hye(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function KD(t,e){for(let n=0;nNumber.EPSILON){const He=Math.sqrt(Ee),Be=Math.sqrt(ee*ee+W*W),pt=Q.x-at/He,nt=Q.y+bt/He,se=Ge.x-W/Be,rt=Ge.y+ee/Be,$e=((se-pt)*W-(rt-nt)*ee)/(bt*W-at*ee);De=pt+bt*$e-ce.x,Xe=nt+at*$e-ce.y;const ut=De*De+Xe*Xe;if(ut<=2)return new Ve(De,Xe);Je=Math.sqrt(ut/2)}else{let He=!1;bt>Number.EPSILON?ee>Number.EPSILON&&(He=!0):bt<-Number.EPSILON?ee<-Number.EPSILON&&(He=!0):Math.sign(at)===Math.sign(W)&&(He=!0),He?(De=-at,Xe=bt,Je=Math.sqrt(Ee)):(De=bt,Xe=at,Je=Math.sqrt(Ee/2))}return new Ve(De/Je,Xe/Je)}const q=[];for(let ce=0,Q=te.length,Ge=Q-1,De=ce+1;ce=0;ce--){const Q=ce/w,Ge=y*Math.cos(Q*Math.PI/2),De=x*Math.sin(Q*Math.PI/2)+S;for(let Xe=0,Je=te.length;Xe=0;){const De=Ge;let Xe=Ge-1;Xe<0&&(Xe=ce.length-1);for(let Je=0,bt=d+w*2;Je0)&&y.push(T,C,N),(_!==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 L6 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=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new as,this.combine=ox,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 D6 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=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class j6 extends Gr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class U6 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=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new as,this.combine=ox,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 F6 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=lu,this.normalScale=new Ve(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class z6 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 lh(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 B6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function H6(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 eP(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const a=n[s]*e;for(let l=0;l!==e;++l)i[o++]=t[a+l]}return i}function 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 o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),n.push.apply(n,o)),s=t[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),n.push(o)),s=t[i++];while(s!==void 0)}function $ye(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l=r)){f.push(c.times[y]);for(let S=0;Ss.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[x]){const _=x*f+d,E=_+f-d;S=a.values.slice(_,E)}else{const _=a.createInterpolant(),E=d,T=f-d;_.evaluate(s),S=_.resultBuffer.slice(E,T)}l==="quaternion"&&new Kt().fromArray(S).normalize().conjugate().toArray(S);const w=c.times.length;for(let _=0;_=s)){const a=n[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;en;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&B6(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===W_,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}qa.prototype.TimeBufferType=Float32Array;qa.prototype.ValueBufferType=Float32Array;qa.prototype.DefaultInterpolation=Dg;class np extends qa{constructor(e,n,r){super(e,n,r)}}np.prototype.ValueTypeName="bool";np.prototype.ValueBufferType=Array;np.prototype.DefaultInterpolation=Lg;np.prototype.InterpolantFactoryMethodLinear=void 0;np.prototype.InterpolantFactoryMethodSmooth=void 0;class WR extends qa{}WR.prototype.ValueTypeName="color";class Hh extends qa{}Hh.prototype.ValueTypeName="number";class W6 extends av{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let c=e*a;for(let d=c+a;c!==d;c+=4)Kt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Vh extends qa{InterpolantFactoryMethodLinear(e){return new W6(this.times,this.values,this.getValueSize(),e)}}Vh.prototype.ValueTypeName="quaternion";Vh.prototype.InterpolantFactoryMethodSmooth=void 0;class rp extends qa{constructor(e,n,r){super(e,n,r)}}rp.prototype.ValueTypeName="string";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=Lg;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class Gh extends qa{}Gh.prototype.ValueTypeName="vector";class Fg{constructor(e="",n=-1,r=[],i=YS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=So(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)n.push(Yye(r[o]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)n.push(qa.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a1){const f=d[1];let m=i[f];m||(i[f]=m=[]),m.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return o}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(f,m,y,x,S){if(y.length!==0){const w=[],_=[];VR(y,w,_,x),w.length!==0&&S.push(new f(m,w,_))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f{n&&n(s),this.manager.itemEnd(e)},0),s;if(Pc[e]!==void 0){Pc[e].push({onLoad:n,onProgress:r,onError:i});return}Pc[e]=[],Pc[e].push({onLoad:n,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Pc[e],f=c.body.getReader(),m=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),y=m?parseInt(m):0,x=y!==0;let S=0;const w=new ReadableStream({start(_){E();function E(){f.read().then(({done:T,value:C})=>{if(T)_.close();else{S+=C.byteLength;const O=new ProgressEvent("progress",{lengthComputable:x,loaded:S,total:y});for(let N=0,D=d.length;N{_.error(T)})}}});return new Response(w)}else throw new Zye(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),m=f&&f[1]?f[1].toLowerCase():void 0,y=new TextDecoder(m);return c.arrayBuffer().then(x=>y.decode(x))}}}).then(c=>{Hc.add(e,c);const d=Pc[e];delete Pc[e];for(let f=0,m=d.length;f{const d=Pc[e];if(d===void 0)throw this.manager.itemError(e),c;delete Pc[e];for(let f=0,m=d.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Qye extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ga(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new ct().setHex(o.value);break;case"v2":i.uniforms[s].value=new Ve().fromArray(o.value);break;case"v3":i.uniforms[s].value=new X().fromArray(o.value);break;case"v4":i.uniforms[s].value=new Ln().fromArray(o.value);break;case"m3":i.uniforms[s].value=new qt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new Rt().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Ve().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new Ve().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return bM.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:k6,SpriteMaterial:kR,RawShaderMaterial:O6,ShaderMaterial:Qo,PointsMaterial:iM,MeshPhysicalMaterial:na,MeshStandardMaterial:mx,MeshPhongMaterial:L6,MeshToonMaterial:D6,MeshNormalMaterial:j6,MeshLambertMaterial:U6,MeshDepthMaterial:RR,MeshDistanceMaterial:NR,MeshBasicMaterial:As,MeshMatcapMaterial:F6,LineDashedMaterial:z6,LineBasicMaterial:$r,Material:Gr};return new n[e]}}class Md{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let r=0,i=e.length;r0){const l=new $R(n);s=new zg(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){i=new zg(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const w=new os;w.min.fromArray(S.boxMin),w.max.fromArray(S.boxMax);const _=new Bi;return _.radius=S.sphereRadius,_.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:w,sphereInitialized:S.sphereInitialized,sphere:_}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new _6;break;case"Line":o=new zl(a(e.geometry),l(e.material));break;case"LineLoop":o=new LR(a(e.geometry),l(e.material));break;case"LineSegments":o=new eo(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new DR(a(e.geometry),l(e.material));break;case"Sprite":o=new b6(l(e.material));break;case"Group":o=new Ts;break;case"Bone":o=new rM;break;default:o=new mn}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let y=0;y"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hc.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Hc.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Hc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Hc.add(e,l),s.manager.itemStart(e)}}let __;class ZR{static getContext(){return __===void 0&&(__=new(window.AudioContext||window.webkitAudioContext)),__}static setContext(e){__=e}}class axe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ga(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);ZR.getContext().decodeAudioData(c,function(f){n(f)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const rj=new Rt,ij=new Rt,Of=new Rt;class lxe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Tr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Tr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,Of.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(Eh*n.fov*.5)/n.zoom;let a,l;ij.elements[12]=-i,rj.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,Of.elements[0]=2*n.near/(l-a),Of.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Of),a=-o*n.aspect-s,l=o*n.aspect-s,Of.elements[0]=2*n.near/(l-a),Of.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Of)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(ij),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(rj)}}class QR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=sj(),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=sj();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function sj(){return performance.now()}const Lf=new X,oj=new Kt,cxe=new X,Df=new X;class uxe 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(Lf,oj,cxe),Df.set(0,0,-1).applyQuaternion(oj),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Lf.x,i),n.positionY.linearRampToValueAtTime(Lf.y,i),n.positionZ.linearRampToValueAtTime(Lf.z,i),n.forwardX.linearRampToValueAtTime(Df.x,i),n.forwardY.linearRampToValueAtTime(Df.y,i),n.forwardZ.linearRampToValueAtTime(Df.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(Lf.x,Lf.y,Lf.z),n.setOrientation(Df.x,Df.y,Df.z,r.x,r.y,r.z)}}let nG=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]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let s=r,o=i;s!==o;++s)n[s]=n[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[n+o]=e[r+o]}_slerp(e,n,r,i){Kt.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;Kt.multiplyQuaternionsFlat(e,o,e,n,e,r),Kt.slerpFlat(e,n,e,n,e,o,i)}_lerp(e,n,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=n+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,n,r,i,s){for(let o=0;o!==s;++o){const a=n+o;e[a]=e[a]+e[r+o]*i}}}const JR="\\[\\]\\.:\\/",pxe=new RegExp("["+JR+"]","g"),eN="[^"+JR+"]",mxe="[^"+JR.replace("\\.","")+"]",gxe=/((?:WC+[\/:])*)/.source.replace("WC",eN),vxe=/(WCOD+)?/.source.replace("WCOD",mxe),yxe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",eN),xxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",eN),bxe=new RegExp("^"+gxe+vxe+yxe+xxe+"$"),_xe=["material","materials","bones","map"];class wxe{constructor(e,n,r){const i=r||Nn.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 Nn{constructor(e,n,r){this.path=n,this.parsedPath=r||Nn.parseTrackName(n),this.node=Nn.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 Nn.Composite(e,n,r):new Nn(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(pxe,"")}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);_xe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o=s){const f=s++,m=e[f];n[m.uuid]=d,e[d]=m,n[c]=f,e[f]=l;for(let y=0,x=i;y!==x;++y){const S=r[y],w=S[f],_=S[d];S[d]=w,S[f]=_}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],d=c.uuid,f=n[d];if(f!==void 0)if(delete n[d],f0&&(n[y.uuid]=f),e[f]=y,e.pop();for(let x=0,S=i;x!==S;++x){const w=r[x];w[f]=w[m],w.pop()}}}this.nCachedObjects_=s}subscribe_(e,n){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,f=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(f);for(let m=d,y=l.length;m!==y;++m){const x=l[m];f[m]=new Nn(x,e,n)}return f}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];n[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class iG{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,o=s.length,a=new Array(o),l={endingStart:sh,endingEnd:sh};for(let c=0;c!==o;++c){const d=s[c].createInterpolant(null);a[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=VV,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,r){if(e.fadeOut(n),this.fadeIn(n),r){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,r){return e.crossFadeFrom(this,n,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,r){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=n/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?n=0:(this._startTime=null,n=r*l)}n*=this._updateTimeScale(e);const o=this._updateTime(n),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case bR:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case YS:default:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulate(i,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===GV;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===HV){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=n||i<0){const a=Math.floor(i/n);i-=n*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=oh,i.endingEnd=oh):(e?i.endingStart=this.zeroSlopeAtStart?oh:sh:i.endingStart=Ay,n?i.endingEnd=this.zeroSlopeAtEnd?oh:sh:i.endingEnd=Ay)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=n,a[1]=s+e,l[1]=r,this}}const Mxe=new Float32Array(1);class Exe extends Vl{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let f=0;f!==s;++f){const m=i[f],y=m.name;let x=d[y];if(x!==void 0)++x.referenceCount,o[f]=x;else{if(x=o[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,l,y));continue}const S=n&&n._propertyBindings[f].binding.parsedPath;x=new rG(Nn.create(r,y,S),m.ValueTypeName,m.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,l,y),o[f]=x}a[f].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const n=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let n=0;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,uj).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 dj=new X,w_=new X;class Nxe{constructor(e=new X,n=new X){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){dj.subVectors(e,this.start),w_.subVectors(this.end,this.start);const r=w_.dot(w_);let s=w_.dot(dj)/r;return n&&(s=Ar(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 fj=new X;class Ixe extends mn{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new Qt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let f=0;f.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{vj.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(vj,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 aG extends eo{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 Qt;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 Wxe{constructor(){this.type="ShapePath",this.color=new ct,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new ky,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,s,o){return this.currentPath.bezierCurveTo(e,n,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(_){const E=[];for(let T=0,C=_.length;TNumber.EPSILON){if(k<0&&(D=E[N],V=-V,F=E[O],k=-k),_.yF.y)continue;if(_.y===D.y){if(_.x===D.x)return!0}else{const U=k*(_.x-D.x)-V*(_.y-D.y);if(U===0)return!0;if(U<0)continue;C=!C}}else{if(_.y!==D.y)continue;if(F.x<=_.x&&_.x<=D.x||D.x<=_.x&&_.x<=F.x)return!0}}return C}const i=Nl.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Th,l.curves=a.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],m=[];let y=[],x=0,S;m[x]=void 0,y[x]=[];for(let _=0,E=s.length;_1){let _=!1,E=0;for(let T=0,C=m.length;T0&&_===!1&&(y=f)}let w;for(let _=0,E=m.length;_=0&&(C[Se]=null,T[Se].disconnect(be))}for(let le=0;le=C.length){C.push(be),Se=Me;break}else if(C[Me]===null){C[Me]=be,Se=Me;break}if(Se===-1)break}const qe=T[Se];qe&&qe.connect(be)}}const se=new X,fe=new X;function B(ae,le,be){se.setFromMatrixPosition(le.matrixWorld),fe.setFromMatrixPosition(be.matrixWorld);const Se=se.distanceTo(fe),qe=le.projectionMatrix.elements,Me=be.projectionMatrix.elements,$e=qe[14]/(qe[10]-1),Ke=qe[14]/(qe[10]+1),ce=(qe[9]+1)/qe[5],Z=(qe[9]-1)/qe[5],We=(qe[8]-1)/qe[0],je=(Me[8]+1)/Me[0],Xe=$e*We,Je=$e*je,bt=Se/(-We+je),ut=bt*-We;if(le.matrixWorld.decompose(ae.position,ae.quaternion,ae.scale),ae.translateX(ut),ae.translateZ(bt),ae.matrixWorld.compose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldInverse.copy(ae.matrixWorld).invert(),qe[10]===-1)ae.projectionMatrix.copy(le.projectionMatrix),ae.projectionMatrixInverse.copy(le.projectionMatrixInverse);else{const ee=$e+bt,$=Ke+bt,Ee=Xe-ut,Be=Je+(Se-ut),Ve=ce*Ke/$*ee,He=Z*Ke/$*ee;ae.projectionMatrix.makePerspective(Ee,Be,Ve,He,ee,$),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert()}}function J(ae,le){le===null?ae.matrixWorld.copy(ae.matrix):ae.matrixWorld.multiplyMatrices(le.matrixWorld,ae.matrix),ae.matrixWorldInverse.copy(ae.matrixWorld).invert()}this.updateCamera=function(ae){if(i===null)return;let le=ae.near,be=ae.far;S.texture!==null&&(S.depthNear>0&&(le=S.depthNear),S.depthFar>0&&(be=S.depthFar)),k.near=F.near=D.near=le,k.far=F.far=D.far=be,(U!==k.near||H!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),U=k.near,H=k.far);const Se=ae.parent,qe=k.cameras;J(k,Se);for(let Me=0;Me0&&(w.alphaTest.value=_.alphaTest);const E=e.get(_),T=E.envMap,C=E.envMapRotation;T&&(w.envMap.value=T,If.copy(C),If.x*=-1,If.y*=-1,If.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(If.y*=-1,If.z*=-1),w.envMapRotation.value.setFromMatrix4(nye.makeRotationFromEuler(If)),w.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=_.reflectivity,w.ior.value=_.ior,w.refractionRatio.value=_.refractionRatio),_.lightMap&&(w.lightMap.value=_.lightMap,w.lightMapIntensity.value=_.lightMapIntensity,n(_.lightMap,w.lightMapTransform)),_.aoMap&&(w.aoMap.value=_.aoMap,w.aoMapIntensity.value=_.aoMapIntensity,n(_.aoMap,w.aoMapTransform))}function o(w,_){w.diffuse.value.copy(_.color),w.opacity.value=_.opacity,_.map&&(w.map.value=_.map,n(_.map,w.mapTransform))}function a(w,_){w.dashSize.value=_.dashSize,w.totalSize.value=_.dashSize+_.gapSize,w.scale.value=_.scale}function l(w,_,E,T){w.diffuse.value.copy(_.color),w.opacity.value=_.opacity,w.size.value=_.size*E,w.scale.value=T*.5,_.map&&(w.map.value=_.map,n(_.map,w.uvTransform)),_.alphaMap&&(w.alphaMap.value=_.alphaMap,n(_.alphaMap,w.alphaMapTransform)),_.alphaTest>0&&(w.alphaTest.value=_.alphaTest)}function c(w,_){w.diffuse.value.copy(_.color),w.opacity.value=_.opacity,w.rotation.value=_.rotation,_.map&&(w.map.value=_.map,n(_.map,w.mapTransform)),_.alphaMap&&(w.alphaMap.value=_.alphaMap,n(_.alphaMap,w.alphaMapTransform)),_.alphaTest>0&&(w.alphaTest.value=_.alphaTest)}function d(w,_){w.specular.value.copy(_.specular),w.shininess.value=Math.max(_.shininess,1e-4)}function f(w,_){_.gradientMap&&(w.gradientMap.value=_.gradientMap)}function m(w,_){w.metalness.value=_.metalness,_.metalnessMap&&(w.metalnessMap.value=_.metalnessMap,n(_.metalnessMap,w.metalnessMapTransform)),w.roughness.value=_.roughness,_.roughnessMap&&(w.roughnessMap.value=_.roughnessMap,n(_.roughnessMap,w.roughnessMapTransform)),_.envMap&&(w.envMapIntensity.value=_.envMapIntensity)}function y(w,_,E){w.ior.value=_.ior,_.sheen>0&&(w.sheenColor.value.copy(_.sheenColor).multiplyScalar(_.sheen),w.sheenRoughness.value=_.sheenRoughness,_.sheenColorMap&&(w.sheenColorMap.value=_.sheenColorMap,n(_.sheenColorMap,w.sheenColorMapTransform)),_.sheenRoughnessMap&&(w.sheenRoughnessMap.value=_.sheenRoughnessMap,n(_.sheenRoughnessMap,w.sheenRoughnessMapTransform))),_.clearcoat>0&&(w.clearcoat.value=_.clearcoat,w.clearcoatRoughness.value=_.clearcoatRoughness,_.clearcoatMap&&(w.clearcoatMap.value=_.clearcoatMap,n(_.clearcoatMap,w.clearcoatMapTransform)),_.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=_.clearcoatRoughnessMap,n(_.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),_.clearcoatNormalMap&&(w.clearcoatNormalMap.value=_.clearcoatNormalMap,n(_.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(_.clearcoatNormalScale),_.side===ss&&w.clearcoatNormalScale.value.negate())),_.dispersion>0&&(w.dispersion.value=_.dispersion),_.iridescence>0&&(w.iridescence.value=_.iridescence,w.iridescenceIOR.value=_.iridescenceIOR,w.iridescenceThicknessMinimum.value=_.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=_.iridescenceThicknessRange[1],_.iridescenceMap&&(w.iridescenceMap.value=_.iridescenceMap,n(_.iridescenceMap,w.iridescenceMapTransform)),_.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=_.iridescenceThicknessMap,n(_.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),_.transmission>0&&(w.transmission.value=_.transmission,w.transmissionSamplerMap.value=E.texture,w.transmissionSamplerSize.value.set(E.width,E.height),_.transmissionMap&&(w.transmissionMap.value=_.transmissionMap,n(_.transmissionMap,w.transmissionMapTransform)),w.thickness.value=_.thickness,_.thicknessMap&&(w.thicknessMap.value=_.thicknessMap,n(_.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=_.attenuationDistance,w.attenuationColor.value.copy(_.attenuationColor)),_.anisotropy>0&&(w.anisotropyVector.value.set(_.anisotropy*Math.cos(_.anisotropyRotation),_.anisotropy*Math.sin(_.anisotropyRotation)),_.anisotropyMap&&(w.anisotropyMap.value=_.anisotropyMap,n(_.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=_.specularIntensity,w.specularColor.value.copy(_.specularColor),_.specularColorMap&&(w.specularColorMap.value=_.specularColorMap,n(_.specularColorMap,w.specularColorMapTransform)),_.specularIntensityMap&&(w.specularIntensityMap.value=_.specularIntensityMap,n(_.specularIntensityMap,w.specularIntensityMapTransform))}function x(w,_){_.matcap&&(w.matcap.value=_.matcap)}function S(w,_){const E=e.get(_).light;w.referencePosition.value.setFromMatrixPosition(E.matrixWorld),w.nearDistance.value=E.shadow.camera.near,w.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function iye(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,T){const C=T.program;r.uniformBlockBinding(E,C)}function c(E,T){let C=i[E.id];C===void 0&&(x(E),C=d(E),i[E.id]=C,E.addEventListener("dispose",w));const O=T.program;r.updateUBOMapping(E,O);const N=e.render.frame;s[E.id]!==N&&(m(E),s[E.id]=N)}function d(E){const T=f();E.__bindingPointIndex=T;const C=t.createBuffer(),O=E.__size,N=E.usage;return t.bindBuffer(t.UNIFORM_BUFFER,C),t.bufferData(t.UNIFORM_BUFFER,O,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,T,C),C}function f(){for(let E=0;E0&&(C+=O-N),E.__size=C,E.__cache={},this}function S(E){const T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),T}function w(E){const T=E.target;T.removeEventListener("dispose",w);const C=o.indexOf(T.__bindingPointIndex);o.splice(C,1),t.deleteBuffer(i[T.id]),delete i[T.id],delete s[T.id]}function _(){for(const E in i)t.deleteBuffer(i[E]);o=[],i={},s={}}return{bind:l,update:c,dispose:_}}class x6{constructor(e={}){const{canvas:n=s6(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let m;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=r.getContextAttributes().alpha}else m=o;const y=new Uint32Array(4),x=new Int32Array(4);let S=null,w=null;const _=[],E=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Ui,this.toneMapping=Pl,this.toneMappingExposure=1;const T=this;let C=!1,O=0,N=0,D=null,F=-1,G=null;const k=new Ln,U=new Ln;let H=null;const ne=new lt(0);let te=0,he=n.width,se=n.height,fe=1,B=null,J=null;const Y=new Ln(0,0,he,se),V=new Ln(0,0,he,se);let q=!1;const pe=new hx;let ae=!1,le=!1;const be=new Pt,Se=new Pt,qe=new X,Me=new Ln,$e={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ke=!1;function ce(){return D===null?fe:1}let Z=r;function We(K,xe){return n.getContext(K,xe)}try{const K={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Td}`),n.addEventListener("webglcontextlost",Le,!1),n.addEventListener("webglcontextrestored",Ye,!1),n.addEventListener("webglcontextcreationerror",ht,!1),Z===null){const xe="webgl2";if(Z=We(xe,K),Z===null)throw We(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 je,Xe,Je,bt,ut,ee,$,Ee,Be,Ve,He,mt,rt,dt,de,Ne,tt,jt,Lt,ct,ue,Q,Ae,re;function Fe(){je=new uve(Z),je.init(),Q=new v6(Z,je),Xe=new ive(Z,je,e,Q),Je=new G0e(Z),Xe.reverseDepthBuffer&&Je.buffers.depth.setReversed(!0),bt=new hve(Z),ut=new N0e,ee=new Y0e(Z,je,Je,ut,Xe,Q,bt),$=new ove(T),Ee=new cve(T),Be=new bpe(Z),Ae=new nve(Z,Be),Ve=new dve(Z,Be,bt,Ae),He=new mve(Z,Ve,Be,bt),Lt=new pve(Z,Xe,ee),Ne=new sve(ut),mt=new R0e(T,$,Ee,je,Xe,Ae,Ne),rt=new rye(T,ut),dt=new k0e,de=new F0e(je),jt=new tve(T,$,Ee,Je,He,m,l),tt=new H0e(T,He,Xe),re=new iye(Z,bt,Xe,Je),ct=new rve(Z,je,bt),ue=new fve(Z,je,bt),bt.programs=mt.programs,T.capabilities=Xe,T.extensions=je,T.properties=ut,T.renderLists=dt,T.shadowMap=tt,T.state=Je,T.info=bt}Fe();const Te=new tye(T,Z);this.xr=Te,this.getContext=function(){return Z},this.getContextAttributes=function(){return Z.getContextAttributes()},this.forceContextLoss=function(){const K=je.get("WEBGL_lose_context");K&&K.loseContext()},this.forceContextRestore=function(){const K=je.get("WEBGL_lose_context");K&&K.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(K){K!==void 0&&(fe=K,this.setSize(he,se,!1))},this.getSize=function(K){return K.set(he,se)},this.setSize=function(K,xe,Pe=!0){if(Te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}he=K,se=xe,n.width=Math.floor(K*fe),n.height=Math.floor(xe*fe),Pe===!0&&(n.style.width=K+"px",n.style.height=xe+"px"),this.setViewport(0,0,K,xe)},this.getDrawingBufferSize=function(K){return K.set(he*fe,se*fe).floor()},this.setDrawingBufferSize=function(K,xe,Pe){he=K,se=xe,fe=Pe,n.width=Math.floor(K*Pe),n.height=Math.floor(xe*Pe),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,Pe,ke){K.isVector4?Y.set(K.x,K.y,K.z,K.w):Y.set(K,xe,Pe,ke),Je.viewport(k.copy(Y).multiplyScalar(fe).round())},this.getScissor=function(K){return K.copy(V)},this.setScissor=function(K,xe,Pe,ke){K.isVector4?V.set(K.x,K.y,K.z,K.w):V.set(K,xe,Pe,ke),Je.scissor(U.copy(V).multiplyScalar(fe).round())},this.getScissorTest=function(){return q},this.setScissorTest=function(K){Je.setScissorTest(q=K)},this.setOpaqueSort=function(K){B=K},this.setTransparentSort=function(K){J=K},this.getClearColor=function(K){return K.copy(jt.getClearColor())},this.setClearColor=function(){jt.setClearColor.apply(jt,arguments)},this.getClearAlpha=function(){return jt.getClearAlpha()},this.setClearAlpha=function(){jt.setClearAlpha.apply(jt,arguments)},this.clear=function(K=!0,xe=!0,Pe=!0){let ke=0;if(K){let we=!1;if(D!==null){const it=D.texture.format;we=it===YS||it===KS||it===cx}if(we){const it=D.texture.type,xt=it===Ha||it===eu||it===Og||it===Uh||it===$S||it===XS,at=jt.getClearColor(),Et=jt.getClearAlpha(),zt=at.r,Vt=at.g,Rt=at.b;xt?(y[0]=zt,y[1]=Vt,y[2]=Rt,y[3]=Et,Z.clearBufferuiv(Z.COLOR,0,y)):(x[0]=zt,x[1]=Vt,x[2]=Rt,x[3]=Et,Z.clearBufferiv(Z.COLOR,0,x))}else ke|=Z.COLOR_BUFFER_BIT}xe&&(ke|=Z.DEPTH_BUFFER_BIT,Z.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Pe&&(ke|=Z.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Z.clear(ke)},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",Le,!1),n.removeEventListener("webglcontextrestored",Ye,!1),n.removeEventListener("webglcontextcreationerror",ht,!1),dt.dispose(),de.dispose(),ut.dispose(),$.dispose(),Ee.dispose(),He.dispose(),Ae.dispose(),re.dispose(),mt.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",Si),Te.removeEventListener("sessionend",ra),Mi.stop()};function Le(K){K.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),C=!0}function Ye(){console.log("THREE.WebGLRenderer: Context Restored."),C=!1;const K=bt.autoReset,xe=tt.enabled,Pe=tt.autoUpdate,ke=tt.needsUpdate,we=tt.type;Fe(),bt.autoReset=K,tt.enabled=xe,tt.autoUpdate=Pe,tt.needsUpdate=ke,tt.type=we}function ht(K){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",K.statusMessage)}function Yt(K){const xe=K.target;xe.removeEventListener("dispose",Yt),un(xe)}function un(K){Cn(K),ut.remove(K)}function Cn(K){const xe=ut.get(K).programs;xe!==void 0&&(xe.forEach(function(Pe){mt.releaseProgram(Pe)}),K.isShaderMaterial&&mt.releaseShaderCache(K))}this.renderBufferDirect=function(K,xe,Pe,ke,we,it){xe===null&&(xe=$e);const xt=we.isMesh&&we.matrixWorld.determinant()<0,at=To(K,xe,Pe,ke,we);Je.setMaterial(ke,xt);let Et=Pe.index,zt=1;if(ke.wireframe===!0){if(Et=Ve.getWireframeAttribute(Pe),Et===void 0)return;zt=2}const Vt=Pe.drawRange,Rt=Pe.attributes.position;let Sn=Vt.start*zt,Mn=(Vt.start+Vt.count)*zt;it!==null&&(Sn=Math.max(Sn,it.start*zt),Mn=Math.min(Mn,(it.start+it.count)*zt)),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;Ae.setup(we,ke,at,Pe,Et);let Zt,Ut=ct;if(Et!==null&&(Zt=Be.get(Et),Ut=ue,Ut.setIndex(Zt)),we.isMesh)ke.wireframe===!0?(Je.setLineWidth(ke.wireframeLinewidth*ce()),Ut.setMode(Z.LINES)):Ut.setMode(Z.TRIANGLES);else if(we.isLine){let vt=ke.linewidth;vt===void 0&&(vt=1),Je.setLineWidth(vt*ce()),we.isLineSegments?Ut.setMode(Z.LINES):we.isLineLoop?Ut.setMode(Z.LINE_LOOP):Ut.setMode(Z.LINE_STRIP)}else we.isPoints?Ut.setMode(Z.POINTS):we.isSprite&&Ut.setMode(Z.TRIANGLES);if(we.isBatchedMesh)if(we._multiDrawInstances!==null)Ut.renderMultiDrawInstances(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount,we._multiDrawInstances);else if(je.get("WEBGL_multi_draw"))Ut.renderMultiDraw(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount);else{const vt=we._multiDrawStarts,xn=we._multiDrawCounts,tn=we._multiDrawCount,Pr=Et?Be.get(Et).bytesPerElement:1,li=ut.get(ke).currentProgram.getUniforms();for(let kn=0;kn{function it(){if(ke.forEach(function(xt){ut.get(xt).currentProgram.isReady()&&ke.delete(xt)}),ke.size===0){we(K);return}setTimeout(it,10)}je.get("KHR_parallel_shader_compile")!==null?it():setTimeout(it,10)})};let Hn=null;function hr(K){Hn&&Hn(K)}function Si(){Mi.stop()}function ra(){Mi.start()}const Mi=new f6;Mi.setAnimationLoop(hr),typeof self<"u"&&Mi.setContext(self),this.setAnimationLoop=function(K){Hn=K,Te.setAnimationLoop(K),K===null?Mi.stop():Mi.start()},Te.addEventListener("sessionstart",Si),Te.addEventListener("sessionend",ra),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(C===!0)return;if(K.matrixWorldAutoUpdate===!0&&K.updateMatrixWorld(),xe.parent===null&&xe.matrixWorldAutoUpdate===!0&&xe.updateMatrixWorld(),Te.enabled===!0&&Te.isPresenting===!0&&(Te.cameraAutoUpdate===!0&&Te.updateCamera(xe),xe=Te.getCamera()),K.isScene===!0&&K.onBeforeRender(T,K,xe,D),w=de.get(K,E.length),w.init(xe),E.push(w),Se.multiplyMatrices(xe.projectionMatrix,xe.matrixWorldInverse),pe.setFromProjectionMatrix(Se),le=this.localClippingEnabled,ae=Ne.init(this.clippingPlanes,le),S=dt.get(K,_.length),S.init(),_.push(S),Te.enabled===!0&&Te.isPresenting===!0){const it=T.xr.getDepthSensingMesh();it!==null&&Ka(it,xe,-1/0,T.sortObjects)}Ka(K,xe,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(B,J),Ke=Te.enabled===!1||Te.isPresenting===!1||Te.hasDepthSensing()===!1,Ke&&jt.addToRenderList(S,K),this.info.render.frame++,ae===!0&&Ne.beginShadows();const Pe=w.state.shadowsArray;tt.render(Pe,K,xe),ae===!0&&Ne.endShadows(),this.info.autoReset===!0&&this.info.reset();const ke=S.opaque,we=S.transmissive;if(w.setupLights(),xe.isArrayCamera){const it=xe.cameras;if(we.length>0)for(let xt=0,at=it.length;xt0&&ia(ke,we,K,xe),Ke&&jt.render(K),Ns(S,K,xe);D!==null&&(ee.updateMultisampleRenderTarget(D),ee.updateRenderTargetMipmap(D)),K.isScene===!0&&K.onAfterRender(T,K,xe),Ae.resetDefaultState(),F=-1,G=null,E.pop(),E.length>0?(w=E[E.length-1],ae===!0&&Ne.setGlobalState(T.clippingPlanes,w.state.camera)):w=null,_.pop(),_.length>0?S=_[_.length-1]:S=null};function Ka(K,xe,Pe,ke){if(K.visible===!1)return;if(K.layers.test(xe.layers)){if(K.isGroup)Pe=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||pe.intersectsSprite(K)){ke&&Me.setFromMatrixPosition(K.matrixWorld).applyMatrix4(Se);const xt=He.update(K),at=K.material;at.visible&&S.push(K,xt,at,Pe,Me.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||pe.intersectsObject(K))){const xt=He.update(K),at=K.material;if(ke&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),Me.copy(K.boundingSphere.center)):(xt.boundingSphere===null&&xt.computeBoundingSphere(),Me.copy(xt.boundingSphere.center)),Me.applyMatrix4(K.matrixWorld).applyMatrix4(Se)),Array.isArray(at)){const Et=xt.groups;for(let zt=0,Vt=Et.length;zt0&&Ei(we,xe,Pe),it.length>0&&Ei(it,xe,Pe),xt.length>0&&Ei(xt,xe,Pe),Je.buffers.depth.setTest(!0),Je.buffers.depth.setMask(!0),Je.buffers.color.setMask(!0),Je.setPolygonOffset(!1)}function ia(K,xe,Pe,ke){if((Pe.isScene===!0?Pe.overrideMaterial:null)!==null)return;w.state.transmissionRenderTarget[ke.id]===void 0&&(w.state.transmissionRenderTarget[ke.id]=new Va(1,1,{generateMipmaps:!0,type:je.has("EXT_color_buffer_half_float")||je.has("EXT_color_buffer_float")?rv:Ha,minFilter:qo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:In.workingColorSpace}));const it=w.state.transmissionRenderTarget[ke.id],xt=ke.viewport||k;it.setSize(xt.z,xt.w);const at=T.getRenderTarget();T.setRenderTarget(it),T.getClearColor(ne),te=T.getClearAlpha(),te<1&&T.setClearColor(16777215,.5),T.clear(),Ke&&jt.render(Pe);const Et=T.toneMapping;T.toneMapping=Pl;const zt=ke.viewport;if(ke.viewport!==void 0&&(ke.viewport=void 0),w.setupLightsView(ke),ae===!0&&Ne.setGlobalState(T.clippingPlanes,ke),Ei(K,Pe,ke),ee.updateMultisampleRenderTarget(it),ee.updateRenderTargetMipmap(it),je.has("WEBGL_multisampled_render_to_texture")===!1){let Vt=!1;for(let Rt=0,Sn=xe.length;Rt0),Rt=!!Pe.morphAttributes.position,Sn=!!Pe.morphAttributes.normal,Mn=!!Pe.morphAttributes.color;let yn=Pl;ke.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(yn=T.toneMapping);const Zt=Pe.morphAttributes.position||Pe.morphAttributes.normal||Pe.morphAttributes.color,Ut=Zt!==void 0?Zt.length:0,vt=ut.get(ke),xn=w.state.lights;if(ae===!0&&(le===!0||K!==G)){const Xr=K===G&&ke.id===F;Ne.setState(ke,K,Xr)}let tn=!1;ke.version===vt.__version?(vt.needsLights&&vt.lightsStateVersion!==xn.state.version||vt.outputColorSpace!==at||we.isBatchedMesh&&vt.batching===!1||!we.isBatchedMesh&&vt.batching===!0||we.isBatchedMesh&&vt.batchingColor===!0&&we.colorTexture===null||we.isBatchedMesh&&vt.batchingColor===!1&&we.colorTexture!==null||we.isInstancedMesh&&vt.instancing===!1||!we.isInstancedMesh&&vt.instancing===!0||we.isSkinnedMesh&&vt.skinning===!1||!we.isSkinnedMesh&&vt.skinning===!0||we.isInstancedMesh&&vt.instancingColor===!0&&we.instanceColor===null||we.isInstancedMesh&&vt.instancingColor===!1&&we.instanceColor!==null||we.isInstancedMesh&&vt.instancingMorph===!0&&we.morphTexture===null||we.isInstancedMesh&&vt.instancingMorph===!1&&we.morphTexture!==null||vt.envMap!==Et||ke.fog===!0&&vt.fog!==it||vt.numClippingPlanes!==void 0&&(vt.numClippingPlanes!==Ne.numPlanes||vt.numIntersection!==Ne.numIntersection)||vt.vertexAlphas!==zt||vt.vertexTangents!==Vt||vt.morphTargets!==Rt||vt.morphNormals!==Sn||vt.morphColors!==Mn||vt.toneMapping!==yn||vt.morphTargetsCount!==Ut)&&(tn=!0):(tn=!0,vt.__version=ke.version);let Pr=vt.currentProgram;tn===!0&&(Pr=sa(ke,xe,we));let li=!1,kn=!1,Is=!1;const Vn=Pr.getUniforms(),to=vt.uniforms;if(Je.useProgram(Pr.program)&&(li=!0,kn=!0,Is=!0),ke.id!==F&&(F=ke.id,kn=!0),li||G!==K){Xe.reverseDepthBuffer?(be.copy(K.projectionMatrix),Ghe(be),Whe(be),Vn.setValue(Z,"projectionMatrix",be)):Vn.setValue(Z,"projectionMatrix",K.projectionMatrix),Vn.setValue(Z,"viewMatrix",K.matrixWorldInverse);const Xr=Vn.map.cameraPosition;Xr!==void 0&&Xr.setValue(Z,qe.setFromMatrixPosition(K.matrixWorld)),Xe.logarithmicDepthBuffer&&Vn.setValue(Z,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),(ke.isMeshPhongMaterial||ke.isMeshToonMaterial||ke.isMeshLambertMaterial||ke.isMeshBasicMaterial||ke.isMeshStandardMaterial||ke.isShaderMaterial)&&Vn.setValue(Z,"isOrthographic",K.isOrthographicCamera===!0),G!==K&&(G=K,kn=!0,Is=!0)}if(we.isSkinnedMesh){Vn.setOptional(Z,we,"bindMatrix"),Vn.setOptional(Z,we,"bindMatrixInverse");const Xr=we.skeleton;Xr&&(Xr.boneTexture===null&&Xr.computeBoneTexture(),Vn.setValue(Z,"boneTexture",Xr.boneTexture,ee))}we.isBatchedMesh&&(Vn.setOptional(Z,we,"batchingTexture"),Vn.setValue(Z,"batchingTexture",we._matricesTexture,ee),Vn.setOptional(Z,we,"batchingIdTexture"),Vn.setValue(Z,"batchingIdTexture",we._indirectTexture,ee),Vn.setOptional(Z,we,"batchingColorTexture"),we._colorsTexture!==null&&Vn.setValue(Z,"batchingColorTexture",we._colorsTexture,ee));const Ya=Pe.morphAttributes;if((Ya.position!==void 0||Ya.normal!==void 0||Ya.color!==void 0)&&Lt.update(we,Pe,Pr),(kn||vt.receiveShadow!==we.receiveShadow)&&(vt.receiveShadow=we.receiveShadow,Vn.setValue(Z,"receiveShadow",we.receiveShadow)),ke.isMeshGouraudMaterial&&ke.envMap!==null&&(to.envMap.value=Et,to.flipEnvMap.value=Et.isCubeTexture&&Et.isRenderTargetTexture===!1?-1:1),ke.isMeshStandardMaterial&&ke.envMap===null&&xe.environment!==null&&(to.envMapIntensity.value=xe.environmentIntensity),kn&&(Vn.setValue(Z,"toneMappingExposure",T.toneMappingExposure),vt.needsLights&&du(to,Is),it&&ke.fog===!0&&rt.refreshFogUniforms(to,it),rt.refreshMaterialUniforms(to,ke,fe,se,w.state.transmissionRenderTarget[K.id]),q_.upload(Z,cu(vt),to,ee)),ke.isShaderMaterial&&ke.uniformsNeedUpdate===!0&&(q_.upload(Z,cu(vt),to,ee),ke.uniformsNeedUpdate=!1),ke.isSpriteMaterial&&Vn.setValue(Z,"center",we.center),Vn.setValue(Z,"modelViewMatrix",we.modelViewMatrix),Vn.setValue(Z,"normalMatrix",we.normalMatrix),Vn.setValue(Z,"modelMatrix",we.matrixWorld),ke.isShaderMaterial||ke.isRawShaderMaterial){const Xr=ke.uniformsGroups;for(let ci=0,Ld=Xr.length;ci0&&ee.useMultisampledRTT(K)===!1?we=ut.get(K).__webglMultisampledFramebuffer:Array.isArray(Vt)?we=Vt[Pe]:we=Vt,k.copy(K.viewport),U.copy(K.scissor),H=K.scissorTest}else k.copy(Y).multiplyScalar(fe).floor(),U.copy(V).multiplyScalar(fe).floor(),H=q;if(Je.bindFramebuffer(Z.FRAMEBUFFER,we)&&ke&&Je.drawBuffers(K,we),Je.viewport(k),Je.scissor(U),Je.setScissorTest(H),it){const Et=ut.get(K.texture);Z.framebufferTexture2D(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Z.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Et.__webglTexture,Pe)}else if(xt){const Et=ut.get(K.texture),zt=xe||0;Z.framebufferTextureLayer(Z.FRAMEBUFFER,Z.COLOR_ATTACHMENT0,Et.__webglTexture,Pe||0,zt)}F=-1},this.readRenderTargetPixels=function(K,xe,Pe,ke,we,it,xt){if(!(K&&K.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let at=ut.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&xt!==void 0&&(at=at[xt]),at){Je.bindFramebuffer(Z.FRAMEBUFFER,at);try{const Et=K.texture,zt=Et.format,Vt=Et.type;if(!Xe.textureFormatReadable(zt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!Xe.textureTypeReadable(Vt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}xe>=0&&xe<=K.width-ke&&Pe>=0&&Pe<=K.height-we&&Z.readPixels(xe,Pe,ke,we,Q.convert(zt),Q.convert(Vt),it)}finally{const Et=D!==null?ut.get(D).__webglFramebuffer:null;Je.bindFramebuffer(Z.FRAMEBUFFER,Et)}}},this.readRenderTargetPixelsAsync=async function(K,xe,Pe,ke,we,it,xt){if(!(K&&K.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let at=ut.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&xt!==void 0&&(at=at[xt]),at){const Et=K.texture,zt=Et.format,Vt=Et.type;if(!Xe.textureFormatReadable(zt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!Xe.textureTypeReadable(Vt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(xe>=0&&xe<=K.width-ke&&Pe>=0&&Pe<=K.height-we){Je.bindFramebuffer(Z.FRAMEBUFFER,at);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,Pe,ke,we,Q.convert(zt),Q.convert(Vt),0);const Sn=D!==null?ut.get(D).__webglFramebuffer:null;Je.bindFramebuffer(Z.FRAMEBUFFER,Sn);const Mn=Z.fenceSync(Z.SYNC_GPU_COMMANDS_COMPLETE,0);return Z.flush(),await Vhe(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,Pe=0){K.isTexture!==!0&&(X_("WebGLRenderer: copyFramebufferToTexture function signature has changed."),xe=arguments[0]||null,K=arguments[1]);const ke=Math.pow(2,-Pe),we=Math.floor(K.image.width*ke),it=Math.floor(K.image.height*ke),xt=xe!==null?xe.x:0,at=xe!==null?xe.y:0;ee.setTexture2D(K,0),Z.copyTexSubImage2D(Z.TEXTURE_2D,Pe,0,0,xt,at,we,it),Je.unbindTexture()},this.copyTextureToTexture=function(K,xe,Pe=null,ke=null,we=0){K.isTexture!==!0&&(X_("WebGLRenderer: copyTextureToTexture function signature has changed."),ke=arguments[0]||null,K=arguments[1],xe=arguments[2],we=arguments[3]||0,Pe=null);let it,xt,at,Et,zt,Vt;Pe!==null?(it=Pe.max.x-Pe.min.x,xt=Pe.max.y-Pe.min.y,at=Pe.min.x,Et=Pe.min.y):(it=K.image.width,xt=K.image.height,at=0,Et=0),ke!==null?(zt=ke.x,Vt=ke.y):(zt=0,Vt=0);const Rt=Q.convert(xe.format),Sn=Q.convert(xe.type);ee.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),Zt=Z.getParameter(Z.UNPACK_SKIP_PIXELS),Ut=Z.getParameter(Z.UNPACK_SKIP_ROWS),vt=Z.getParameter(Z.UNPACK_SKIP_IMAGES),xn=K.isCompressedTexture?K.mipmaps[we]:K.image;Z.pixelStorei(Z.UNPACK_ROW_LENGTH,xn.width),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,xn.height),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,at),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Et),K.isDataTexture?Z.texSubImage2D(Z.TEXTURE_2D,we,zt,Vt,it,xt,Rt,Sn,xn.data):K.isCompressedTexture?Z.compressedTexSubImage2D(Z.TEXTURE_2D,we,zt,Vt,xn.width,xn.height,Rt,xn.data):Z.texSubImage2D(Z.TEXTURE_2D,we,zt,Vt,it,xt,Rt,Sn,xn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,Mn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,yn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Zt),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,Ut),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,vt),we===0&&xe.generateMipmaps&&Z.generateMipmap(Z.TEXTURE_2D),Je.unbindTexture()},this.copyTextureToTexture3D=function(K,xe,Pe=null,ke=null,we=0){K.isTexture!==!0&&(X_("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Pe=arguments[0]||null,ke=arguments[1]||null,K=arguments[2],xe=arguments[3],we=arguments[4]||0);let it,xt,at,Et,zt,Vt,Rt,Sn,Mn;const yn=K.isCompressedTexture?K.mipmaps[we]:K.image;Pe!==null?(it=Pe.max.x-Pe.min.x,xt=Pe.max.y-Pe.min.y,at=Pe.max.z-Pe.min.z,Et=Pe.min.x,zt=Pe.min.y,Vt=Pe.min.z):(it=yn.width,xt=yn.height,at=yn.depth,Et=0,zt=0,Vt=0),ke!==null?(Rt=ke.x,Sn=ke.y,Mn=ke.z):(Rt=0,Sn=0,Mn=0);const Zt=Q.convert(xe.format),Ut=Q.convert(xe.type);let vt;if(xe.isData3DTexture)ee.setTexture3D(xe,0),vt=Z.TEXTURE_3D;else if(xe.isDataArrayTexture||xe.isCompressedArrayTexture)ee.setTexture2DArray(xe,0),vt=Z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Z.pixelStorei(Z.UNPACK_FLIP_Y_WEBGL,xe.flipY),Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Z.pixelStorei(Z.UNPACK_ALIGNMENT,xe.unpackAlignment);const xn=Z.getParameter(Z.UNPACK_ROW_LENGTH),tn=Z.getParameter(Z.UNPACK_IMAGE_HEIGHT),Pr=Z.getParameter(Z.UNPACK_SKIP_PIXELS),li=Z.getParameter(Z.UNPACK_SKIP_ROWS),kn=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,zt),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,Vt),K.isDataTexture||K.isData3DTexture?Z.texSubImage3D(vt,we,Rt,Sn,Mn,it,xt,at,Zt,Ut,yn.data):xe.isCompressedArrayTexture?Z.compressedTexSubImage3D(vt,we,Rt,Sn,Mn,it,xt,at,Zt,yn.data):Z.texSubImage3D(vt,we,Rt,Sn,Mn,it,xt,at,Zt,Ut,yn),Z.pixelStorei(Z.UNPACK_ROW_LENGTH,xn),Z.pixelStorei(Z.UNPACK_IMAGE_HEIGHT,tn),Z.pixelStorei(Z.UNPACK_SKIP_PIXELS,Pr),Z.pixelStorei(Z.UNPACK_SKIP_ROWS,li),Z.pixelStorei(Z.UNPACK_SKIP_IMAGES,kn),we===0&&xe.generateMipmaps&&Z.generateMipmap(vt),Je.unbindTexture()},this.initRenderTarget=function(K){ut.get(K).__webglFramebuffer===void 0&&ee.setupRenderTarget(K)},this.initTexture=function(K){K.isCubeTexture?ee.setTextureCube(K,0):K.isData3DTexture?ee.setTexture3D(K,0):K.isDataArrayTexture||K.isCompressedArrayTexture?ee.setTexture2DArray(K,0):ee.setTexture2D(K,0),Je.unbindTexture()},this.resetState=function(){O=0,N=0,D=null,Je.reset(),Ae.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ml}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===QS?"display-p3":"srgb",n.unpackColorSpace=In.workingColorSpace===ux?"display-p3":"srgb"}}class tM{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new lt(e),this.density=n}clone(){return new tM(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class nM{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new lt(e),this.near=n,this.far=r}clone(){return new nM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class kR extends 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 as,this.environmentIntensity=1,this.environmentRotation=new as,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 tp{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=So()}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,s_,M0,o_,CD,SA,PD,new Ge),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function a_(t,e,n,r,i,s){Pm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(S0.x=s*Pm.x-i*Pm.y,S0.y=i*Pm.x+s*Pm.y):S0.copy(Pm),t.copy(e),t.x+=S0.x,t.y+=S0.y,t.applyMatrix4(b6)}const l_=new X,RD=new X;class w6 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){l_.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(l_);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){l_.setFromMatrixPosition(e.matrixWorld),RD.setFromMatrixPosition(this.matrixWorld);const r=l_.distanceTo(RD)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i=o)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}}const Ju=new Pt,AA=new Pt,dye=new Pt,fye=new lt(1,1,1),FD=new Pt,TA=new hx,d_=new os,kf=new Bi,T0=new X,zD=new X,hye=new X,CA=new uye,es=new yr,f_=[];function pye(t,e,n=0){const r=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const i=t.count;for(let s=0;s65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new Jt(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,o=s.image.data;dye.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(fye.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,n=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),n===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=n,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),d=c!==null;if(d&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const f=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:d?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new os,sphereInitialized:!1,sphere:new Bi}),this.setGeometryAt(f,e),f}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=n.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||n.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const y in r.attributes){const x=n.getAttribute(y),S=r.getAttribute(y);pye(x,S,l);const w=x.itemSize;for(let _=x.count,E=c;_=n.length||n[e].active===!1?this:(n[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,n){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,d=l.start+l.count;c=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,d_),d_.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let d=l.start,f=l.start+l.count;d=r.length||r[e].active===!1?this:(n.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,n){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:n.fromArray(i,e*16)}setColorAt(e,n){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(n.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,n){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:n.fromArray(r,e*4)}setVisibleAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===n?this:(r[e].visible=n,this._visibilityChanged=!0,this)}getVisibleAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?!1:n[e].visible}setGeometryIdAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||n<0||n>=this._geometryCount?null:(r[e].geometryIndex=n,this)}getGeometryIdAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?-1:n[e].geometryIndex}getGeometryRangeAt(e,n={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return n.start=r.start,n.count=r.count,n}raycast(e,n){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,o=this.geometry;es.material=this.material,es.geometry.index=o.index,es.geometry.attributes=o.attributes,es.geometry.boundingBox===null&&(es.geometry.boundingBox=new os),es.geometry.boundingSphere===null&&(es.geometry.boundingSphere=new Bi);for(let a=0,l=r.length;a({...n})),this._reservedRanges=e._reservedRanges.map(n=>({...n})),this._drawInfo=e._drawInfo.map(n=>({...n})),this._bounds=e._bounds.map(n=>({boxInitialized:n.boxInitialized,box:n.box.clone(),sphereInitialized:n.sphereInitialized,sphere:n.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,n,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,m=this.perObjectFrustumCulled,y=this._indirectTexture,x=y.image.data;m&&(FD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),TA.setFromProjectionMatrix(FD,e.coordinateSystem));let S=0;if(this.sortObjects){AA.copy(this.matrixWorld).invert(),T0.setFromMatrixPosition(r.matrixWorld).applyMatrix4(AA),zD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(AA);for(let E=0,T=l.length;E0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;PA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(PA);if(!(le.far))return{distance:l,point:HD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const VD=new X,GD=new X;class eo extends zl{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[];for(let i=0,s=n.count;i0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class mye extends dr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o: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 gye extends dr{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=ri,this.minFilter=ri,this.generateMipmaps=!1,this.needsUpdate=!0}}class oM extends dr{constructor(e,n,r,i,s,o,a,l,c,d,f,m){super(null,o,a,l,c,d,i,s,f,m),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class vye extends oM{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=_o,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class yye extends oM{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,Jc),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class xye extends dr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Xa{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let r,i=this.getPoint(0),s=0;n.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const r=this.getLengths();let i=0;const s=r.length;let o;n?o=n:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const d=r[i],m=r[i+1]-d,y=(o-d)/m;return(i+y)/(s-1)}getTangent(e,n){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=n||(o.isVector2?new Ge:new X);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new X,i=[],s=[],o=[],a=new X,l=new Pt;for(let y=0;y<=e;y++){const x=y/e;i[y]=this.getTangentAt(x,new X)}s[0]=new X,o[0]=new X;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),m=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),m<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let y=1;y<=e;y++){if(s[y]=s[y-1].clone(),o[y]=o[y-1].clone(),a.crossVectors(i[y-1],i[y]),a.length()>Number.EPSILON){a.normalize();const x=Math.acos(Ar(i[y-1].dot(i[y]),-1,1));s[y].applyMatrix4(l.makeRotationAxis(a,x))}o[y].crossVectors(i[y],s[y])}if(n===!0){let y=Math.acos(Ar(s[0].dot(s[e]),-1,1));y/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(y=-y);for(let x=1;x<=e;x++)s[x].applyMatrix4(l.makeRotationAxis(i[x],y*x)),o[x].crossVectors(i[x],s[x])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class aM extends Xa{constructor(e=0,n=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n=new Ge){const r=n,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,d;this.closed||a>0?c=i[(a-1)%s]:(v_.subVectors(i[0],i[1]).add(i[0]),c=v_);const f=i[a%s],m=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(XD(a,l.x,c.x,d.x,f.x),XD(a,l.y,c.y,d.y,f.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let r=0,i=this.curves.length;r1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.y)}this.curves.push(c);const d=c.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class px extends Qt{constructor(e=[new Ge(0,-.5),new Ge(.5,0),new Ge(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=Ar(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/n,f=new X,m=new Ge,y=new X,x=new X,S=new X;let w=0,_=0;for(let E=0;E<=e.length-1;E++)switch(E){case 0:w=e[E+1].x-e[E].x,_=e[E+1].y-e[E].y,y.x=_*1,y.y=-w,y.z=_*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[E+1].x-e[E].x,_=e[E+1].y-e[E].y,y.x=_*1,y.y=-w,y.z=_*0,x.copy(y),y.x+=S.x,y.y+=S.y,y.z+=S.z,y.normalize(),l.push(y.x,y.y,y.z),S.copy(x)}for(let E=0;E<=n;E++){const T=r+E*d*i,C=Math.sin(T),O=Math.cos(T);for(let N=0;N<=e.length-1;N++){f.x=e[N].x*C,f.y=e[N].y,f.z=e[N].x*O,o.push(f.x,f.y,f.z),m.x=E/n,m.y=N/(e.length-1),a.push(m.x,m.y);const D=l[3*N+0]*C,F=l[3*N+1],G=l[3*N+0]*O;c.push(D,F,G)}}for(let E=0;E0&&T(!0),n>0&&T(!1)),this.setIndex(d),this.setAttribute("position",new Ot(f,3)),this.setAttribute("normal",new Ot(m,3)),this.setAttribute("uv",new Ot(y,2));function E(){const C=new X,O=new X;let N=0;const D=(n-e)/r;for(let F=0;F<=s;F++){const G=[],k=F/s,U=k*(n-e)+e;for(let H=0;H<=i;H++){const ne=H/i,te=ne*l+a,he=Math.sin(te),se=Math.cos(te);O.x=U*he,O.y=-k*r+w,O.z=U*se,f.push(O.x,O.y,O.z),C.set(he,D,se).normalize(),m.push(C.x,C.y,C.z),y.push(ne,1-k),G.push(x++)}S.push(G)}for(let F=0;F0&&(d.push(k,U,ne),N+=3),n>0&&(d.push(U,H,ne),N+=3)}c.addGroup(_,N,0),_+=N}function T(C){const O=x,N=new Ge,D=new X;let F=0;const G=C===!0?e:n,k=C===!0?1:-1;for(let H=1;H<=i;H++)f.push(0,w*k,0),m.push(0,k,0),y.push(.5,.5),x++;const U=x;for(let H=0;H<=i;H++){const te=H/i*l+a,he=Math.cos(te),se=Math.sin(te);D.x=G*se,D.y=w*k,D.z=G*he,f.push(D.x,D.y,D.z),m.push(0,k,0),N.x=he*.5+.5,N.y=se*.5*k+.5,y.push(N.x,N.y),x++}for(let H=0;H.9&&D<.1&&(T<.2&&(o[E+0]+=1),C<.2&&(o[E+2]+=1),O<.2&&(o[E+4]+=1))}}function m(E){s.push(E.x,E.y,E.z)}function y(E,T){const C=E*3;T.x=e[C+0],T.y=e[C+1],T.z=e[C+2]}function x(){const E=new X,T=new X,C=new X,O=new X,N=new Ge,D=new Ge,F=new Ge;for(let G=0,k=0;G80*n){a=c=t[0],l=d=t[1];for(let x=n;xc&&(c=f),m>d&&(d=m);y=Math.max(c-a,d-l),y=y!==0?32767/y:0}return Dy(s,o,n,a,l,y,0),o}};function R6(t,e,n,r,i){let s,o;if(i===Vye(t,e,n,r)>0)for(s=e;s=e;s-=r)o=qD(s,t[s],t[s+1],o);return o&&fM(o,o.next)&&(Uy(o),o=o.next),o}function Bh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(fM(n,n.next)||vr(n.prev,n,n.next)===0)){if(Uy(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function Dy(t,e,n,r,i,s,o){if(!t)return;!o&&s&&jye(t,r,i,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Pye(t,r,i,s):Cye(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Uy(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=Rye(Bh(t),e,n),Dy(t,e,n,r,i,s,2)):o===2&&Nye(t,e,n,r,i,s):Dy(Bh(t),e,n,r,i,s,1);break}}}function Cye(t){const e=t.prev,n=t,r=t.next;if(vr(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,c=r.y,d=is?i>o?i:o:s>o?s:o,y=a>l?a>c?a:c:l>c?l:c;let x=r.next;for(;x!==e;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=y&&Km(i,a,s,l,o,c,x.x,x.y)&&vr(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function Pye(t,e,n,r){const i=t.prev,s=t,o=t.next;if(vr(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,d=i.y,f=s.y,m=o.y,y=al?a>c?a:c:l>c?l:c,w=d>f?d>m?d:m:f>m?f:m,_=JC(y,x,e,n,r),E=JC(S,w,e,n,r);let T=t.prevZ,C=t.nextZ;for(;T&&T.z>=_&&C&&C.z<=E;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==o&&Km(a,d,l,f,c,m,T.x,T.y)&&vr(T.prev,T,T.next)>=0||(T=T.prevZ,C.x>=y&&C.x<=S&&C.y>=x&&C.y<=w&&C!==i&&C!==o&&Km(a,d,l,f,c,m,C.x,C.y)&&vr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;T&&T.z>=_;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==o&&Km(a,d,l,f,c,m,T.x,T.y)&&vr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;C&&C.z<=E;){if(C.x>=y&&C.x<=S&&C.y>=x&&C.y<=w&&C!==i&&C!==o&&Km(a,d,l,f,c,m,C.x,C.y)&&vr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function Rye(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!fM(i,s)&&N6(i,r,r.next,s)&&jy(i,s)&&jy(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),Uy(r),Uy(r.next),r=t=s),r=r.next}while(r!==t);return Bh(r)}function Nye(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&zye(o,a)){let l=I6(o,a);o=Bh(o,o.next),l=Bh(l,l.next),Dy(o,e,n,r,i,s,0),Dy(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function Iye(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const m=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(m<=s&&m>r&&(r=m,i=n.x=n.x&&n.x>=l&&s!==n.x&&Km(oi.x||n.x===i.x&&Dye(i,n)))&&(i=n,d=f)),n=n.next;while(n!==a);return i}function Dye(t,e){return vr(t.prev,t,e.prev)<0&&vr(e.next,t,t.next)<0}function jye(t,e,n,r){let i=t;do i.z===0&&(i.z=JC(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,Uye(i)}function Uye(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function JC(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Fye(t){let e=t,n=t;do(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function zye(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Bye(t,e)&&(jy(t,e)&&jy(e,t)&&Hye(t,e)&&(vr(t.prev,t,e.prev)||vr(t,e.prev,e))||fM(t,e)&&vr(t.prev,t,t.next)>0&&vr(e.prev,e,e.next)>0)}function vr(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function fM(t,e){return t.x===e.x&&t.y===e.y}function N6(t,e,n,r){const i=w_(vr(t,e,n)),s=w_(vr(t,e,r)),o=w_(vr(n,r,t)),a=w_(vr(n,r,e));return!!(i!==s&&o!==a||i===0&&__(t,n,e)||s===0&&__(t,r,e)||o===0&&__(n,t,r)||a===0&&__(n,e,r))}function __(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function w_(t){return t>0?1:t<0?-1:0}function Bye(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&N6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function jy(t,e){return vr(t.prev,t,t.next)<0?vr(t,e,t.next)>=0&&vr(t,t.prev,e)>=0:vr(t,e,t.prev)<0||vr(t,t.next,e)<0}function Hye(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function I6(t,e){const n=new eP(t.i,t.x,t.y),r=new eP(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function qD(t,e,n,r){const i=new eP(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Uy(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function eP(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Vye(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function YD(t,e){for(let n=0;nNumber.EPSILON){const Ve=Math.sqrt(Ee),He=Math.sqrt(ee*ee+$*$),mt=Z.x-ut/Ve,rt=Z.y+bt/Ve,dt=We.x-$/He,de=We.y+ee/He,Ne=((dt-mt)*$-(de-rt)*ee)/(bt*$-ut*ee);je=mt+bt*Ne-ce.x,Xe=rt+ut*Ne-ce.y;const tt=je*je+Xe*Xe;if(tt<=2)return new Ge(je,Xe);Je=Math.sqrt(tt/2)}else{let Ve=!1;bt>Number.EPSILON?ee>Number.EPSILON&&(Ve=!0):bt<-Number.EPSILON?ee<-Number.EPSILON&&(Ve=!0):Math.sign(ut)===Math.sign($)&&(Ve=!0),Ve?(je=-ut,Xe=bt,Je=Math.sqrt(Ee)):(je=bt,Xe=ut,Je=Math.sqrt(Ee/2))}return new Ge(je/Je,Xe/Je)}const J=[];for(let ce=0,Z=te.length,We=Z-1,je=ce+1;ce=0;ce--){const Z=ce/w,We=y*Math.cos(Z*Math.PI/2),je=x*Math.sin(Z*Math.PI/2)+S;for(let Xe=0,Je=te.length;Xe=0;){const je=We;let Xe=We-1;Xe<0&&(Xe=ce.length-1);for(let Je=0,bt=d+w*2;Je0)&&y.push(T,C,N),(_!==r-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class D6 extends Gr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new lt(16777215),this.specular=new lt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new as,this.combine=lx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class j6 extends Gr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new lt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class U6 extends Gr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class F6 extends Gr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new lt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new lt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new as,this.combine=lx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class z6 extends Gr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new lt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new Ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class B6 extends $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 lh(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function H6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function V6(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function tP(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const a=n[s]*e;for(let l=0;l!==e;++l)i[o++]=t[a+l]}return i}function GR(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),n.push.apply(n,o)),s=t[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),n.push(o)),s=t[i++];while(s!==void 0)}function Xye(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l=r)){f.push(c.times[y]);for(let S=0;Ss.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[x]){const _=x*f+d,E=_+f-d;S=a.values.slice(_,E)}else{const _=a.createInterpolant(),E=d,T=f-d;_.evaluate(s),S=_.resultBuffer.slice(E,T)}l==="quaternion"&&new Kt().fromArray(S).normalize().conjugate().toArray(S);const w=c.times.length;for(let _=0;_=s)){const a=n[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;en;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&H6(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===$_,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}qa.prototype.TimeBufferType=Float32Array;qa.prototype.ValueBufferType=Float32Array;qa.prototype.DefaultInterpolation=Dg;class np extends qa{constructor(e,n,r){super(e,n,r)}}np.prototype.ValueTypeName="bool";np.prototype.ValueBufferType=Array;np.prototype.DefaultInterpolation=Lg;np.prototype.InterpolantFactoryMethodLinear=void 0;np.prototype.InterpolantFactoryMethodSmooth=void 0;class $R extends qa{}$R.prototype.ValueTypeName="color";class Hh extends qa{}Hh.prototype.ValueTypeName="number";class $6 extends av{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let c=e*a;for(let d=c+a;c!==d;c+=4)Kt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Vh extends qa{InterpolantFactoryMethodLinear(e){return new $6(this.times,this.values,this.getValueSize(),e)}}Vh.prototype.ValueTypeName="quaternion";Vh.prototype.InterpolantFactoryMethodSmooth=void 0;class rp extends qa{constructor(e,n,r){super(e,n,r)}}rp.prototype.ValueTypeName="string";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=Lg;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class Gh extends qa{}Gh.prototype.ValueTypeName="vector";class Fg{constructor(e="",n=-1,r=[],i=ZS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=So(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)n.push(Zye(r[o]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)n.push(qa.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a1){const f=d[1];let m=i[f];m||(i[f]=m=[]),m.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return o}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(f,m,y,x,S){if(y.length!==0){const w=[],_=[];GR(y,w,_,x),w.length!==0&&S.push(new f(m,w,_))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f{n&&n(s),this.manager.itemEnd(e)},0),s;if(Pc[e]!==void 0){Pc[e].push({onLoad:n,onProgress:r,onError:i});return}Pc[e]=[],Pc[e].push({onLoad:n,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Pc[e],f=c.body.getReader(),m=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),y=m?parseInt(m):0,x=y!==0;let S=0;const w=new ReadableStream({start(_){E();function E(){f.read().then(({done:T,value:C})=>{if(T)_.close();else{S+=C.byteLength;const O=new ProgressEvent("progress",{lengthComputable:x,loaded:S,total:y});for(let N=0,D=d.length;N{_.error(T)})}}});return new Response(w)}else throw new Qye(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a===void 0)return c.text();{const f=/charset="?([^;"\s]*)"?/i.exec(a),m=f&&f[1]?f[1].toLowerCase():void 0,y=new TextDecoder(m);return c.arrayBuffer().then(x=>y.decode(x))}}}).then(c=>{Hc.add(e,c);const d=Pc[e];delete Pc[e];for(let f=0,m=d.length;f{const d=Pc[e];if(d===void 0)throw this.manager.itemError(e),c;delete Pc[e];for(let f=0,m=d.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Jye extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ga(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];for(let r=0;r0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new lt().setHex(o.value);break;case"v2":i.uniforms[s].value=new Ge().fromArray(o.value);break;case"v3":i.uniforms[s].value=new X().fromArray(o.value);break;case"v4":i.uniforms[s].value=new Ln().fromArray(o.value);break;case"m3":i.uniforms[s].value=new qt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new Pt().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new Ge().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 Ge().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return _M.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:O6,SpriteMaterial:OR,RawShaderMaterial:L6,ShaderMaterial:Qo,PointsMaterial:sM,MeshPhysicalMaterial:na,MeshStandardMaterial:vx,MeshPhongMaterial:D6,MeshToonMaterial:j6,MeshNormalMaterial:U6,MeshLambertMaterial:F6,MeshDepthMaterial:NR,MeshDistanceMaterial:IR,MeshBasicMaterial:As,MeshMatcapMaterial:z6,LineDashedMaterial:B6,LineBasicMaterial:$r,Material:Gr};return new n[e]}}class Md{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let r=0,i=e.length;r0){const l=new XR(n);s=new zg(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){i=new zg(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const w=new os;w.min.fromArray(S.boxMin),w.max.fromArray(S.boxMax);const _=new Bi;return _.radius=S.sphereRadius,_.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:w,sphereInitialized:S.sphereInitialized,sphere:_}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new w6;break;case"Line":o=new zl(a(e.geometry),l(e.material));break;case"LineLoop":o=new DR(a(e.geometry),l(e.material));break;case"LineSegments":o=new eo(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new jR(a(e.geometry),l(e.material));break;case"Sprite":o=new _6(l(e.material));break;case"Group":o=new Ts;break;case"Bone":o=new iM;break;default:o=new mn}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const m=e.children;for(let y=0;y"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Hc.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Hc.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Hc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Hc.add(e,l),s.manager.itemStart(e)}}let S_;class QR{static getContext(){return S_===void 0&&(S_=new(window.AudioContext||window.webkitAudioContext)),S_}static setContext(e){S_=e}}class lxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Ga(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);QR.getContext().decodeAudioData(c,function(f){n(f)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const ij=new Pt,sj=new Pt,Of=new Pt;class cxe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Tr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Tr,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,Of.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(Eh*n.fov*.5)/n.zoom;let a,l;sj.elements[12]=-i,ij.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,Of.elements[0]=2*n.near/(l-a),Of.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Of),a=-o*n.aspect-s,l=o*n.aspect-s,Of.elements[0]=2*n.near/(l-a),Of.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Of)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(sj),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(ij)}}class JR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=oj(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=oj();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function oj(){return performance.now()}const Lf=new X,aj=new Kt,uxe=new X,Df=new X;class dxe extends mn{constructor(){super(),this.type="AudioListener",this.context=QR.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new JR}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Lf,aj,uxe),Df.set(0,0,-1).applyQuaternion(aj),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Lf.x,i),n.positionY.linearRampToValueAtTime(Lf.y,i),n.positionZ.linearRampToValueAtTime(Lf.z,i),n.forwardX.linearRampToValueAtTime(Df.x,i),n.forwardY.linearRampToValueAtTime(Df.y,i),n.forwardZ.linearRampToValueAtTime(Df.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(Lf.x,Lf.y,Lf.z),n.setOrientation(Df.x,Df.y,Df.z,r.x,r.y,r.z)}}let rG=class extends 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]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let s=r,o=i;s!==o;++s)n[s]=n[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[n+o]=e[r+o]}_slerp(e,n,r,i){Kt.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;Kt.multiplyQuaternionsFlat(e,o,e,n,e,r),Kt.slerpFlat(e,n,e,n,e,o,i)}_lerp(e,n,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=n+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,n,r,i,s){for(let o=0;o!==s;++o){const a=n+o;e[a]=e[a]+e[r+o]*i}}}const eN="\\[\\]\\.:\\/",mxe=new RegExp("["+eN+"]","g"),tN="[^"+eN+"]",gxe="[^"+eN.replace("\\.","")+"]",vxe=/((?:WC+[\/:])*)/.source.replace("WC",tN),yxe=/(WCOD+)?/.source.replace("WCOD",gxe),xxe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",tN),bxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",tN),_xe=new RegExp("^"+vxe+yxe+xxe+bxe+"$"),wxe=["material","materials","bones","map"];class Sxe{constructor(e,n,r){const i=r||Nn.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 Nn{constructor(e,n,r){this.path=n,this.parsedPath=r||Nn.parseTrackName(n),this.node=Nn.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 Nn.Composite(e,n,r):new Nn(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(mxe,"")}static parseTrackName(e){const n=_xe.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);wxe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o=s){const f=s++,m=e[f];n[m.uuid]=d,e[d]=m,n[c]=f,e[f]=l;for(let y=0,x=i;y!==x;++y){const S=r[y],w=S[f],_=S[d];S[d]=w,S[f]=_}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],d=c.uuid,f=n[d];if(f!==void 0)if(delete n[d],f0&&(n[y.uuid]=f),e[f]=y,e.pop();for(let x=0,S=i;x!==S;++x){const w=r[x];w[f]=w[m],w.pop()}}}this.nCachedObjects_=s}subscribe_(e,n){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,f=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(f);for(let m=d,y=l.length;m!==y;++m){const x=l[m];f[m]=new Nn(x,e,n)}return f}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];n[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class sG{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,o=s.length,a=new Array(o),l={endingStart:sh,endingEnd:sh};for(let c=0;c!==o;++c){const d=s[c].createInterpolant(null);a[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=GV,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,r){if(e.fadeOut(n),this.fadeIn(n),r){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,r){return e.crossFadeFrom(this,n,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,r){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=n/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?n=0:(this._startTime=null,n=r*l)}n*=this._updateTimeScale(e);const o=this._updateTime(n),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case _R:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case ZS:default:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulate(i,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===WV;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===VV){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=n||i<0){const a=Math.floor(i/n);i-=n*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=oh,i.endingEnd=oh):(e?i.endingStart=this.zeroSlopeAtStart?oh:sh:i.endingStart=Cy,n?i.endingEnd=this.zeroSlopeAtEnd?oh:sh:i.endingEnd=Cy)}_scheduleFading(e,n,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=n,a[1]=s+e,l[1]=r,this}}const Exe=new Float32Array(1);class Axe extends Vl{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let f=0;f!==s;++f){const m=i[f],y=m.name;let x=d[y];if(x!==void 0)++x.referenceCount,o[f]=x;else{if(x=o[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,l,y));continue}const S=n&&n._propertyBindings[f].binding.parsedPath;x=new iG(Nn.create(r,y,S),m.ValueTypeName,m.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,l,y),o[f]=x}a[f].resultBuffer=x.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const n=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let n=0;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,dj).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const fj=new X,M_=new X;class Ixe{constructor(e=new X,n=new X){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){fj.subVectors(e,this.start),M_.subVectors(this.end,this.start);const r=M_.dot(M_);let s=M_.dot(fj)/r;return n&&(s=Ar(s,0,1)),s}closestPointToPoint(e,n,r){const i=this.closestPointToPointParameter(e,n);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const hj=new X;class kxe extends mn{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new Qt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let f=0;f.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{yj.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(yj,n)}}setLength(e,n=e*.2,r=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(r,n,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class lG extends eo{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 Qt;i.setAttribute("position",new Ot(n,3)),i.setAttribute("color",new Ot(r,3));const s=new $r({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new lt,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 $xe{constructor(){this.type="ShapePath",this.color=new lt,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new Ly,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,s,o){return this.currentPath.bezierCurveTo(e,n,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(_){const E=[];for(let T=0,C=_.length;TNumber.EPSILON){if(k<0&&(D=E[N],G=-G,F=E[O],k=-k),_.yF.y)continue;if(_.y===D.y){if(_.x===D.x)return!0}else{const U=k*(_.x-D.x)-G*(_.y-D.y);if(U===0)return!0;if(U<0)continue;C=!C}}else{if(_.y!==D.y)continue;if(F.x<=_.x&&_.x<=D.x||D.x<=_.x&&_.x<=F.x)return!0}}return C}const i=Nl.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Th,l.curves=a.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],m=[];let y=[],x=0,S;m[x]=void 0,y[x]=[];for(let _=0,E=s.length;_1){let _=!1,E=0;for(let T=0,C=m.length;T0&&_===!1&&(y=f)}let w;for(let _=0,E=m.length;_{const f=typeof c=="function"?c(e):c;if(f!==e){const m=e;e=d?f:Object.assign({},e,f),n.forEach(y=>y(e,m))}},i=()=>e,s=(c,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=d(e);function y(){const x=d(e);if(!f(m,x)){const S=m;c(m=x,S)}}return n.add(y),()=>n.delete(y)},l={setState:r,getState:i,subscribe:(c,d,f)=>d||f?s(c,d,f):(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return e=t(r,i,l),l}const Qxe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),bj=Qxe?R.useEffect:R.useLayoutEffect;function Jxe(t){const e=typeof t=="function"?Zxe(t):t,n=(r=e.getState,i=Object.is)=>{const[,s]=R.useReducer(w=>w+1,0),o=e.getState(),a=R.useRef(o),l=R.useRef(r),c=R.useRef(i),d=R.useRef(!1),f=R.useRef();f.current===void 0&&(f.current=r(o));let m,y=!1;(a.current!==o||l.current!==r||c.current!==i||d.current)&&(m=r(o),y=!i(f.current,m)),bj(()=>{y&&(f.current=m),a.current=o,l.current=r,c.current=i,d.current=!1});const x=R.useRef(o);bj(()=>{const w=()=>{try{const E=e.getState(),T=l.current(E);c.current(f.current,T)||(a.current=E,f.current=T,s())}catch{d.current=!0,s()}},_=e.subscribe(w);return e.getState()!==x.current&&w(),_},[]);const S=y?m:f.current;return R.useDebugValue(S),S};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[n,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},n}var UA={exports:{}},FA={exports:{}},zA={};/** + */var xj;function Yxe(){return xj||(xj=1,td.ConcurrentRoot=1,td.ContinuousEventPriority=4,td.DefaultEventPriority=16,td.DiscreteEventPriority=1,td.IdleEventPriority=536870912,td.LegacyRoot=0),td}var bj;function Zxe(){return bj||(bj=1,UA.exports=Yxe()),UA.exports}var Ym=Zxe();function Qxe(t){let e;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(e):c;if(f!==e){const m=e;e=d?f:Object.assign({},e,f),n.forEach(y=>y(e,m))}},i=()=>e,s=(c,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=d(e);function y(){const x=d(e);if(!f(m,x)){const S=m;c(m=x,S)}}return n.add(y),()=>n.delete(y)},l={setState:r,getState:i,subscribe:(c,d,f)=>d||f?s(c,d,f):(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return e=t(r,i,l),l}const Jxe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),_j=Jxe?R.useEffect:R.useLayoutEffect;function ebe(t){const e=typeof t=="function"?Qxe(t):t,n=(r=e.getState,i=Object.is)=>{const[,s]=R.useReducer(w=>w+1,0),o=e.getState(),a=R.useRef(o),l=R.useRef(r),c=R.useRef(i),d=R.useRef(!1),f=R.useRef();f.current===void 0&&(f.current=r(o));let m,y=!1;(a.current!==o||l.current!==r||c.current!==i||d.current)&&(m=r(o),y=!i(f.current,m)),_j(()=>{y&&(f.current=m),a.current=o,l.current=r,c.current=i,d.current=!1});const x=R.useRef(o);_j(()=>{const w=()=>{try{const E=e.getState(),T=l.current(E);c.current(f.current,T)||(a.current=E,f.current=T,s())}catch{d.current=!0,s()}},_=e.subscribe(w);return e.getState()!==x.current&&w(),_},[]);const S=y?m:f.current;return R.useDebugValue(S),S};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[n,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},n}var FA={exports:{}},zA={exports:{}},BA={};/** * @license React * scheduler.production.min.js * @@ -4435,7 +4440,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 _j;function ebe(){return _j||(_j=1,(function(t){function e(B,q){var K=B.length;B.push(q);e:for(;0>>1,Z=B[$];if(0>>1;$i(ue,K))_ei(Se,ue)?(B[$]=Se,B[_e]=K,$=_e):(B[$]=ue,B[le]=K,$=le);else if(_ei(Se,K))B[$]=Se,B[_e]=K,$=_e;else break e}}return q}function i(B,q){var K=B.sortIndex-q.sortIndex;return K!==0?K:B.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var q=n(c);q!==null;){if(q.callback===null)r(c);else if(q.startTime<=B)r(c),q.sortIndex=q.expirationTime,e(l,q);else break;q=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,oe(O);else{var q=n(c);q!==null&&fe(C,q.startTime-B)}}function O(B,q){x=!1,S&&(S=!1,_(F),F=-1),y=!0;var K=m;try{for(T(q),f=n(l);f!==null&&(!(f.expirationTime>q)||B&&!U());){var $=f.callback;if(typeof $=="function"){f.callback=null,m=f.priorityLevel;var Z=$(f.expirationTime<=q);q=t.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),T(q)}else r(l);f=n(l)}if(f!==null)var ge=!0;else{var le=n(c);le!==null&&fe(C,le.startTime-q),ge=!1}return ge}finally{f=null,m=K,y=!1}}var N=!1,D=null,F=-1,V=5,k=-1;function U(){return!(t.unstable_now()-kB||125$?(B.sortIndex=K,e(c,B),n(l)===null&&B===n(c)&&(S?(_(F),F=-1):S=!0,fe(C,K-$))):(B.sortIndex=Z,e(l,B),x||y||(x=!0,oe(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var q=m;return function(){var K=m;m=q;try{return B.apply(this,arguments)}finally{m=K}}}})(zA)),zA}var wj;function tbe(){return wj||(wj=1,FA.exports=ebe()),FA.exports}/** + */var wj;function tbe(){return wj||(wj=1,(function(t){function e(B,J){var Y=B.length;B.push(J);e:for(;0>>1,q=B[V];if(0>>1;Vi(le,Y))bei(Se,le)?(B[V]=Se,B[be]=Y,V=be):(B[V]=le,B[ae]=Y,V=ae);else if(bei(Se,Y))B[V]=Se,B[be]=Y,V=be;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 o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var 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 C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,se(O);else{var J=n(c);J!==null&&fe(C,J.startTime-B)}}function O(B,J){x=!1,S&&(S=!1,_(F),F=-1),y=!0;var Y=m;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!U());){var V=f.callback;if(typeof V=="function"){f.callback=null,m=f.priorityLevel;var q=V(f.expirationTime<=J);J=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var pe=!0;else{var ae=n(c);ae!==null&&fe(C,ae.startTime-J),pe=!1}return pe}finally{f=null,m=Y,y=!1}}var N=!1,D=null,F=-1,G=5,k=-1;function U(){return!(t.unstable_now()-kB||125V?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(_(F),F=-1):S=!0,fe(C,Y-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,se(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var J=m;return function(){var Y=m;m=J;try{return B.apply(this,arguments)}finally{m=Y}}}})(BA)),BA}var Sj;function nbe(){return Sj||(Sj=1,zA.exports=tbe()),zA.exports}/** * @license React * react-reconciler.production.min.js * @@ -4443,17 +4448,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 BA,Sj;function nbe(){return Sj||(Sj=1,BA=function(e){var n={},r=Wh(),i=tbe(),s=Object.assign;function o(p){for(var v="https://reactjs.org/docs/error-decoder.html?invariant="+p,M=1;Mye||L[ie]!==z[ye]){var Fe=` -`+L[ie].replace(" at new "," at ");return p.displayName&&Fe.includes("")&&(Fe=Fe.replace("",p.displayName)),Fe}while(1<=ie&&0<=ye);break}}}finally{zt=!1,Error.prepareStackTrace=M}return(p=p?p.displayName||p.name:"")?At(p):""}var Nt=Object.prototype.hasOwnProperty,Sn=[],Mn=-1;function yn(p){return{current:p}}function Zt(p){0>Mn||(p.current=Sn[Mn],Sn[Mn]=null,Mn--)}function Ut(p,v){Mn++,Sn[Mn]=p.current,p.current=v}var gt={},xn=yn(gt),tn=yn(!1),Pr=gt;function li(p,v){var M=p.type.contextTypes;if(!M)return gt;var P=p.stateNode;if(P&&P.__reactInternalMemoizedUnmaskedChildContext===v)return P.__reactInternalMemoizedMaskedChildContext;var L={},z;for(z in M)L[z]=v[z];return P&&(p=p.stateNode,p.__reactInternalMemoizedUnmaskedChildContext=v,p.__reactInternalMemoizedMaskedChildContext=L),L}function kn(p){return p=p.childContextTypes,p!=null}function Is(){Zt(tn),Zt(xn)}function Vn(p,v,M){if(xn.current!==gt)throw Error(o(168));Ut(xn,v),Ut(tn,M)}function to(p,v,M){var P=p.stateNode;if(v=v.childContextTypes,typeof P.getChildContext!="function")return M;P=P.getChildContext();for(var L in P)if(!(L in v))throw Error(o(108,F(p)||"Unknown",L));return s({},M,P)}function Ya(p){return p=(p=p.stateNode)&&p.__reactInternalMemoizedMergedChildContext||gt,Pr=xn.current,Ut(xn,p),Ut(tn,tn.current),!0}function Xr(p,v,M){var P=p.stateNode;if(!P)throw Error(o(169));M?(p=to(p,v,Pr),P.__reactInternalMemoizedMergedChildContext=p,Zt(tn),Zt(xn),Ut(xn,p)):Zt(tn),Ut(tn,M)}var ci=Math.clz32?Math.clz32:_M,Ld=Math.log,Za=Math.LN2;function _M(p){return p>>>=0,p===0?32:31-(Ld(p)/Za|0)|0}var fu=64,Pn=4194304;function hu(p){switch(p&-p){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return p&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return p&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return p}}function Dd(p,v){var M=p.pendingLanes;if(M===0)return 0;var P=0,L=p.suspendedLanes,z=p.pingedLanes,ie=M&268435455;if(ie!==0){var ye=ie&~L;ye!==0?P=hu(ye):(z&=ie,z!==0&&(P=hu(z)))}else ie=M&~L,ie!==0?P=hu(ie):z!==0&&(P=hu(z));if(P===0)return 0;if(v!==0&&v!==P&&(v&L)===0&&(L=P&-P,z=v&-v,L>=z||L===16&&(z&4194240)!==0))return v;if((P&4)!==0&&(P|=M&16),v=p.entangledLanes,v!==0)for(p=p.entanglements,v&=P;0M;M++)v.push(p);return v}function Wl(p,v,M){p.pendingLanes|=v,v!==536870912&&(p.suspendedLanes=0,p.pingedLanes=0),p=p.eventTimes,v=31-ci(v),p[v]=M}function op(p,v){var M=p.pendingLanes&~v;p.pendingLanes=v,p.suspendedLanes=0,p.pingedLanes=0,p.expiredLanes&=v,p.mutableReadLanes&=v,p.entangledLanes&=v,v=p.entanglements;var P=p.eventTimes;for(p=p.expirationTimes;0>=ie,L-=ie,ca=1<<32-ci(v)+L|M<En?(br=sn,sn=null):br=sn.sibling;var bn=Ht(Ne,sn,je[En],vt);if(bn===null){sn===null&&(sn=br);break}p&&sn&&bn.alternate===null&&v(Ne,sn),be=z(bn,be,En),on===null?Ot=bn:on.sibling=bn,on=bn,sn=br}if(En===je.length)return M(Ne,sn),Zn&&Ql(Ne,En),Ot;if(sn===null){for(;EnEn?(br=sn,sn=null):br=sn.sibling;var Ea=Ht(Ne,sn,bn.value,vt);if(Ea===null){sn===null&&(sn=br);break}p&&sn&&Ea.alternate===null&&v(Ne,sn),be=z(Ea,be,En),on===null?Ot=Ea:on.sibling=Ea,on=Ea,sn=br}if(bn.done)return M(Ne,sn),Zn&&Ql(Ne,En),Ot;if(sn===null){for(;!bn.done;En++,bn=je.next())bn=rn(Ne,bn.value,vt),bn!==null&&(be=z(bn,be,En),on===null?Ot=bn:on.sibling=bn,on=bn);return Zn&&Ql(Ne,En),Ot}for(sn=P(Ne,sn);!bn.done;En++,bn=je.next())bn=ln(sn,Ne,En,bn.value,vt),bn!==null&&(p&&bn.alternate!==null&&sn.delete(bn.key===null?En:bn.key),be=z(bn,be,En),on===null?Ot=bn:on.sibling=bn,on=bn);return p&&sn.forEach(function(Kv){return v(Ne,Kv)}),Zn&&Ql(Ne,En),Ot}function ys(Ne,be,je,vt){if(typeof je=="object"&&je!==null&&je.type===d&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case l:e:{for(var Ot=je.key,on=be;on!==null;){if(on.key===Ot){if(Ot=je.type,Ot===d){if(on.tag===7){M(Ne,on.sibling),be=L(on,je.props.children),be.return=Ne,Ne=be;break e}}else if(on.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===T&&_u(Ot)===on.type){M(Ne,on.sibling),be=L(on,je.props),be.ref=bu(Ne,on,je),be.return=Ne,Ne=be;break e}M(Ne,on);break}else v(Ne,on);on=on.sibling}je.type===d?(be=bc(je.props.children,Ne.mode,vt,je.key),be.return=Ne,Ne=be):(vt=$p(je.type,je.key,je.props,null,Ne.mode,vt),vt.ref=bu(Ne,be,je),vt.return=Ne,Ne=vt)}return ie(Ne);case c:e:{for(on=je.key;be!==null;){if(be.key===on)if(be.tag===4&&be.stateNode.containerInfo===je.containerInfo&&be.stateNode.implementation===je.implementation){M(Ne,be.sibling),be=L(be,je.children||[]),be.return=Ne,Ne=be;break e}else{M(Ne,be);break}else v(Ne,be);be=be.sibling}be=qp(je,Ne.mode,vt),be.return=Ne,Ne=be}return ie(Ne);case T:return on=je._init,ys(Ne,be,on(je._payload),vt)}if(he(je))return _t(Ne,be,je,vt);if(N(je))return Jr(Ne,be,je,vt);nl(Ne,je)}return typeof je=="string"&&je!==""||typeof je=="number"?(je=""+je,be!==null&&be.tag===6?(M(Ne,be.sibling),be=L(be,je),be.return=Ne,Ne=be):(M(Ne,be),be=Xp(je,Ne.mode,vt),be.return=Ne,Ne=be),ie(Ne)):M(Ne,be)}return ys}var da=Ex(!0),Ax=Ex(!1),wu={},Xi=yn(wu),Jl=yn(wu),ec=yn(wu);function ro(p){if(p===wu)throw Error(o(174));return p}function _p(p,v){Ut(ec,v),Ut(Jl,p),Ut(Xi,wu),p=fe(v),Zt(Xi),Ut(Xi,p)}function Su(){Zt(Xi),Zt(Jl),Zt(ec)}function Tx(p){var v=ro(ec.current),M=ro(Xi.current);v=B(M,p.type,v),M!==v&&(Ut(Jl,p),Ut(Xi,v))}function xv(p){Jl.current===p&&(Zt(Xi),Zt(Jl))}var tr=yn(0);function wp(p){for(var v=p;v!==null;){if(v.tag===13){var M=v.memoizedState;if(M!==null&&(M=M.dehydrated,M===null||Ka(M)||Ns(M)))return v}else if(v.tag===19&&v.memoizedProps.revealOrder!==void 0){if((v.flags&128)!==0)return v}else if(v.child!==null){v.child.return=v,v=v.child;continue}if(v===p)break;for(;v.sibling===null;){if(v.return===null||v.return===p)return null;v=v.return}v.sibling.return=v.return,v=v.sibling}return null}var ds=[];function tc(){for(var p=0;pM?M:4,p(!0);var P=fs.transition;fs.transition={};try{p(!1),v()}finally{dn=M,fs.transition=P}}function ic(){return so().memoizedState}function Px(p,v,M){var P=co(p);M={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null},Rx(p)?Mv(v,M):(Yd(p,v,M),M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,v,P))}function MM(p,v,M){var P=co(p),L={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null};if(Rx(p))Mv(v,L);else{Yd(p,v,L);var z=p.alternate;if(p.lanes===0&&(z===null||z.lanes===0)&&(z=v.lastRenderedReducer,z!==null))try{var ie=v.lastRenderedState,ye=z(ie,M);if(L.hasEagerState=!0,L.eagerState=ye,Ai(ye,ie))return}catch{}finally{}M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,v,P)}}function Rx(p){var v=p.alternate;return p===nr||v!==null&&v===nr}function Mv(p,v){Ro=Sp=!0;var M=p.pending;M===null?v.next=v:(v.next=M.next,M.next=v),p.pending=v}function Yd(p,v,M){mr!==null&&(p.mode&1)!==0&&(an&2)===0?(p=v.interleaved,p===null?(M.next=M,Ls===null?Ls=[v]:Ls.push(v)):(M.next=p.next,p.next=M),v.interleaved=M):(p=v.pending,p===null?M.next=M:(M.next=p.next,p.next=M),v.pending=M)}function Zd(p,v,M){if((M&4194240)!==0){var P=v.lanes;P&=p.pendingLanes,M|=P,v.lanes=M,Co(p,M)}}var Cu={readContext:$i,useCallback:Ur,useContext:Ur,useEffect:Ur,useImperativeHandle:Ur,useInsertionEffect:Ur,useLayoutEffect:Ur,useMemo:Ur,useReducer:Ur,useRef:Ur,useState:Ur,useDebugValue:Ur,useDeferredValue:Ur,useTransition:Ur,useMutableSource:Ur,useSyncExternalStore:Ur,useId:Ur,unstable_isNewReconciler:!1},Ev={readContext:$i,useCallback:function(p,v){return io().memoizedState=[p,v===void 0?null:v],p},useContext:$i,useEffect:Tp,useImperativeHandle:function(p,v,M){return M=M!=null?M.concat([p]):null,il(4194308,4,Kd.bind(null,v,p),M)},useLayoutEffect:function(p,v){return il(4194308,4,p,v)},useInsertionEffect:function(p,v){return il(4,2,p,v)},useMemo:function(p,v){var M=io();return v=v===void 0?null:v,p=p(),M.memoizedState=[p,v],p},useReducer:function(p,v,M){var P=io();return v=M!==void 0?M(v):v,P.memoizedState=P.baseState=v,p={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:p,lastRenderedState:v},P.queue=p,p=p.dispatch=Px.bind(null,nr,p),[P.memoizedState,p]},useRef:function(p){var v=io();return p={current:p},v.memoizedState=p},useState:Xd,useDebugValue:Pp,useDeferredValue:function(p){var v=Xd(p),M=v[0],P=v[1];return Tp(function(){var L=fs.transition;fs.transition={};try{P(p)}finally{fs.transition=L}},[p]),M},useTransition:function(){var p=Xd(!1),v=p[0];return p=Np.bind(null,p[1]),io().memoizedState=p,[v,p]},useMutableSource:function(){},useSyncExternalStore:function(p,v,M){var P=nr,L=io();if(Zn){if(M===void 0)throw Error(o(407));M=M()}else{if(M=v(),mr===null)throw Error(o(349));(nc&30)!==0||wv(P,v,M)}L.memoizedState=M;var z={value:M,getSnapshot:v};return L.queue=z,Tp(fa.bind(null,P,z,p),[p]),P.flags|=2048,qd(9,Sv.bind(null,P,z,M,v),void 0,null),M},useId:function(){var p=io(),v=mr.identifierPrefix;if(Zn){var M=ua,P=ca;M=(P&~(1<<32-ci(P)-1)).toString(32)+M,v=":"+v+"R"+M,M=rc++,0ye||L[ie]!==z[ye]){var ze=` +`+L[ie].replace(" at new "," at ");return p.displayName&&ze.includes("")&&(ze=ze.replace("",p.displayName)),ze}while(1<=ie&&0<=ye);break}}}finally{zt=!1,Error.prepareStackTrace=M}return(p=p?p.displayName||p.name:"")?Et(p):""}var Rt=Object.prototype.hasOwnProperty,Sn=[],Mn=-1;function yn(p){return{current:p}}function Zt(p){0>Mn||(p.current=Sn[Mn],Sn[Mn]=null,Mn--)}function Ut(p,v){Mn++,Sn[Mn]=p.current,p.current=v}var vt={},xn=yn(vt),tn=yn(!1),Pr=vt;function li(p,v){var M=p.type.contextTypes;if(!M)return vt;var P=p.stateNode;if(P&&P.__reactInternalMemoizedUnmaskedChildContext===v)return P.__reactInternalMemoizedMaskedChildContext;var L={},z;for(z in M)L[z]=v[z];return P&&(p=p.stateNode,p.__reactInternalMemoizedUnmaskedChildContext=v,p.__reactInternalMemoizedMaskedChildContext=L),L}function kn(p){return p=p.childContextTypes,p!=null}function Is(){Zt(tn),Zt(xn)}function Vn(p,v,M){if(xn.current!==vt)throw Error(o(168));Ut(xn,v),Ut(tn,M)}function to(p,v,M){var P=p.stateNode;if(v=v.childContextTypes,typeof P.getChildContext!="function")return M;P=P.getChildContext();for(var L in P)if(!(L in v))throw Error(o(108,F(p)||"Unknown",L));return s({},M,P)}function Ya(p){return p=(p=p.stateNode)&&p.__reactInternalMemoizedMergedChildContext||vt,Pr=xn.current,Ut(xn,p),Ut(tn,tn.current),!0}function Xr(p,v,M){var P=p.stateNode;if(!P)throw Error(o(169));M?(p=to(p,v,Pr),P.__reactInternalMemoizedMergedChildContext=p,Zt(tn),Zt(xn),Ut(xn,p)):Zt(tn),Ut(tn,M)}var ci=Math.clz32?Math.clz32:wM,Ld=Math.log,Za=Math.LN2;function wM(p){return p>>>=0,p===0?32:31-(Ld(p)/Za|0)|0}var fu=64,Pn=4194304;function hu(p){switch(p&-p){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return p&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return p&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return p}}function Dd(p,v){var M=p.pendingLanes;if(M===0)return 0;var P=0,L=p.suspendedLanes,z=p.pingedLanes,ie=M&268435455;if(ie!==0){var ye=ie&~L;ye!==0?P=hu(ye):(z&=ie,z!==0&&(P=hu(z)))}else ie=M&~L,ie!==0?P=hu(ie):z!==0&&(P=hu(z));if(P===0)return 0;if(v!==0&&v!==P&&(v&L)===0&&(L=P&-P,z=v&-v,L>=z||L===16&&(z&4194240)!==0))return v;if((P&4)!==0&&(P|=M&16),v=p.entangledLanes,v!==0)for(p=p.entanglements,v&=P;0M;M++)v.push(p);return v}function Wl(p,v,M){p.pendingLanes|=v,v!==536870912&&(p.suspendedLanes=0,p.pingedLanes=0),p=p.eventTimes,v=31-ci(v),p[v]=M}function op(p,v){var M=p.pendingLanes&~v;p.pendingLanes=v,p.suspendedLanes=0,p.pingedLanes=0,p.expiredLanes&=v,p.mutableReadLanes&=v,p.entangledLanes&=v,v=p.entanglements;var P=p.eventTimes;for(p=p.expirationTimes;0>=ie,L-=ie,ca=1<<32-ci(v)+L|M<En?(br=sn,sn=null):br=sn.sibling;var bn=Ht(Ie,sn,Ue[En],yt);if(bn===null){sn===null&&(sn=br);break}p&&sn&&bn.alternate===null&&v(Ie,sn),_e=z(bn,_e,En),on===null?kt=bn:on.sibling=bn,on=bn,sn=br}if(En===Ue.length)return M(Ie,sn),Zn&&Ql(Ie,En),kt;if(sn===null){for(;EnEn?(br=sn,sn=null):br=sn.sibling;var Ea=Ht(Ie,sn,bn.value,yt);if(Ea===null){sn===null&&(sn=br);break}p&&sn&&Ea.alternate===null&&v(Ie,sn),_e=z(Ea,_e,En),on===null?kt=Ea:on.sibling=Ea,on=Ea,sn=br}if(bn.done)return M(Ie,sn),Zn&&Ql(Ie,En),kt;if(sn===null){for(;!bn.done;En++,bn=Ue.next())bn=rn(Ie,bn.value,yt),bn!==null&&(_e=z(bn,_e,En),on===null?kt=bn:on.sibling=bn,on=bn);return Zn&&Ql(Ie,En),kt}for(sn=P(Ie,sn);!bn.done;En++,bn=Ue.next())bn=ln(sn,Ie,En,bn.value,yt),bn!==null&&(p&&bn.alternate!==null&&sn.delete(bn.key===null?En:bn.key),_e=z(bn,_e,En),on===null?kt=bn:on.sibling=bn,on=bn);return p&&sn.forEach(function(Kv){return v(Ie,Kv)}),Zn&&Ql(Ie,En),kt}function ys(Ie,_e,Ue,yt){if(typeof Ue=="object"&&Ue!==null&&Ue.type===d&&Ue.key===null&&(Ue=Ue.props.children),typeof Ue=="object"&&Ue!==null){switch(Ue.$$typeof){case l:e:{for(var kt=Ue.key,on=_e;on!==null;){if(on.key===kt){if(kt=Ue.type,kt===d){if(on.tag===7){M(Ie,on.sibling),_e=L(on,Ue.props.children),_e.return=Ie,Ie=_e;break e}}else if(on.elementType===kt||typeof kt=="object"&&kt!==null&&kt.$$typeof===T&&_u(kt)===on.type){M(Ie,on.sibling),_e=L(on,Ue.props),_e.ref=bu(Ie,on,Ue),_e.return=Ie,Ie=_e;break e}M(Ie,on);break}else v(Ie,on);on=on.sibling}Ue.type===d?(_e=bc(Ue.props.children,Ie.mode,yt,Ue.key),_e.return=Ie,Ie=_e):(yt=$p(Ue.type,Ue.key,Ue.props,null,Ie.mode,yt),yt.ref=bu(Ie,_e,Ue),yt.return=Ie,Ie=yt)}return ie(Ie);case c:e:{for(on=Ue.key;_e!==null;){if(_e.key===on)if(_e.tag===4&&_e.stateNode.containerInfo===Ue.containerInfo&&_e.stateNode.implementation===Ue.implementation){M(Ie,_e.sibling),_e=L(_e,Ue.children||[]),_e.return=Ie,Ie=_e;break e}else{M(Ie,_e);break}else v(Ie,_e);_e=_e.sibling}_e=qp(Ue,Ie.mode,yt),_e.return=Ie,Ie=_e}return ie(Ie);case T:return on=Ue._init,ys(Ie,_e,on(Ue._payload),yt)}if(he(Ue))return _t(Ie,_e,Ue,yt);if(N(Ue))return Jr(Ie,_e,Ue,yt);nl(Ie,Ue)}return typeof Ue=="string"&&Ue!==""||typeof Ue=="number"?(Ue=""+Ue,_e!==null&&_e.tag===6?(M(Ie,_e.sibling),_e=L(_e,Ue),_e.return=Ie,Ie=_e):(M(Ie,_e),_e=Xp(Ue,Ie.mode,yt),_e.return=Ie,Ie=_e),ie(Ie)):M(Ie,_e)}return ys}var da=Tx(!0),Cx=Tx(!1),wu={},Xi=yn(wu),Jl=yn(wu),ec=yn(wu);function ro(p){if(p===wu)throw Error(o(174));return p}function _p(p,v){Ut(ec,v),Ut(Jl,p),Ut(Xi,wu),p=fe(v),Zt(Xi),Ut(Xi,p)}function Su(){Zt(Xi),Zt(Jl),Zt(ec)}function Px(p){var v=ro(ec.current),M=ro(Xi.current);v=B(M,p.type,v),M!==v&&(Ut(Jl,p),Ut(Xi,v))}function xv(p){Jl.current===p&&(Zt(Xi),Zt(Jl))}var tr=yn(0);function wp(p){for(var v=p;v!==null;){if(v.tag===13){var M=v.memoizedState;if(M!==null&&(M=M.dehydrated,M===null||Ka(M)||Ns(M)))return v}else if(v.tag===19&&v.memoizedProps.revealOrder!==void 0){if((v.flags&128)!==0)return v}else if(v.child!==null){v.child.return=v,v=v.child;continue}if(v===p)break;for(;v.sibling===null;){if(v.return===null||v.return===p)return null;v=v.return}v.sibling.return=v.return,v=v.sibling}return null}var ds=[];function tc(){for(var p=0;pM?M:4,p(!0);var P=fs.transition;fs.transition={};try{p(!1),v()}finally{dn=M,fs.transition=P}}function ic(){return so().memoizedState}function Nx(p,v,M){var P=co(p);M={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null},Ix(p)?Mv(v,M):(Yd(p,v,M),M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,v,P))}function EM(p,v,M){var P=co(p),L={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null};if(Ix(p))Mv(v,L);else{Yd(p,v,L);var z=p.alternate;if(p.lanes===0&&(z===null||z.lanes===0)&&(z=v.lastRenderedReducer,z!==null))try{var ie=v.lastRenderedState,ye=z(ie,M);if(L.hasEagerState=!0,L.eagerState=ye,Ai(ye,ie))return}catch{}finally{}M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,v,P)}}function Ix(p){var v=p.alternate;return p===nr||v!==null&&v===nr}function Mv(p,v){Ro=Sp=!0;var M=p.pending;M===null?v.next=v:(v.next=M.next,M.next=v),p.pending=v}function Yd(p,v,M){mr!==null&&(p.mode&1)!==0&&(an&2)===0?(p=v.interleaved,p===null?(M.next=M,Ls===null?Ls=[v]:Ls.push(v)):(M.next=p.next,p.next=M),v.interleaved=M):(p=v.pending,p===null?M.next=M:(M.next=p.next,p.next=M),v.pending=M)}function Zd(p,v,M){if((M&4194240)!==0){var P=v.lanes;P&=p.pendingLanes,M|=P,v.lanes=M,Co(p,M)}}var Cu={readContext:$i,useCallback:Ur,useContext:Ur,useEffect:Ur,useImperativeHandle:Ur,useInsertionEffect:Ur,useLayoutEffect:Ur,useMemo:Ur,useReducer:Ur,useRef:Ur,useState:Ur,useDebugValue:Ur,useDeferredValue:Ur,useTransition:Ur,useMutableSource:Ur,useSyncExternalStore:Ur,useId:Ur,unstable_isNewReconciler:!1},Ev={readContext:$i,useCallback:function(p,v){return io().memoizedState=[p,v===void 0?null:v],p},useContext:$i,useEffect:Tp,useImperativeHandle:function(p,v,M){return M=M!=null?M.concat([p]):null,il(4194308,4,Kd.bind(null,v,p),M)},useLayoutEffect:function(p,v){return il(4194308,4,p,v)},useInsertionEffect:function(p,v){return il(4,2,p,v)},useMemo:function(p,v){var M=io();return v=v===void 0?null:v,p=p(),M.memoizedState=[p,v],p},useReducer:function(p,v,M){var P=io();return v=M!==void 0?M(v):v,P.memoizedState=P.baseState=v,p={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:p,lastRenderedState:v},P.queue=p,p=p.dispatch=Nx.bind(null,nr,p),[P.memoizedState,p]},useRef:function(p){var v=io();return p={current:p},v.memoizedState=p},useState:Xd,useDebugValue:Pp,useDeferredValue:function(p){var v=Xd(p),M=v[0],P=v[1];return Tp(function(){var L=fs.transition;fs.transition={};try{P(p)}finally{fs.transition=L}},[p]),M},useTransition:function(){var p=Xd(!1),v=p[0];return p=Np.bind(null,p[1]),io().memoizedState=p,[v,p]},useMutableSource:function(){},useSyncExternalStore:function(p,v,M){var P=nr,L=io();if(Zn){if(M===void 0)throw Error(o(407));M=M()}else{if(M=v(),mr===null)throw Error(o(349));(nc&30)!==0||wv(P,v,M)}L.memoizedState=M;var z={value:M,getSnapshot:v};return L.queue=z,Tp(fa.bind(null,P,z,p),[p]),P.flags|=2048,qd(9,Sv.bind(null,P,z,M,v),void 0,null),M},useId:function(){var p=io(),v=mr.identifierPrefix;if(Zn){var M=ua,P=ca;M=(P&~(1<<32-ci(P)-1)).toString(32)+M,v=":"+v+"R"+M,M=rc++,0ll&&(v.flags|=128,P=!0,pa(L,!1),v.lanes=4194304)}else{if(!P)if(p=wp(z),p!==null){if(v.flags|=128,P=!0,p=p.updateQueue,p!==null&&(v.updateQueue=p,v.flags|=4),pa(L,!0),L.tail===null&&L.tailMode==="hidden"&&!z.alternate&&!Zn)return pr(v),null}else 2*Rr()-L.renderingStartTime>ll&&M!==1073741824&&(v.flags|=128,P=!0,pa(L,!1),v.lanes=4194304);L.isBackwards?(z.sibling=v.child,v.child=z):(p=L.last,p!==null?p.sibling=z:v.child=z,L.last=z)}return L.tail!==null?(v=L.tail,L.rendering=v,L.tail=v.sibling,L.renderingStartTime=Rr(),v.sibling=null,p=tr.current,Ut(tr,P?p&1|2:p&1),v):(pr(v),null);case 22:case 23:return ff(),P=v.memoizedState!==null,p!==null&&p.memoizedState!==null!==P&&(v.flags|=8192),P&&(v.mode&1)!==0?(di&1073741824)!==0&&(pr(v),Ke&&v.subtreeFlags&6&&(v.flags|=8192)):pr(v),null;case 24:return null;case 25:return null}throw Error(o(156,v.tag))}var Rv=a.ReactCurrentOwner,Fr=!1;function ar(p,v,M,P){v.child=p===null?Ax(v,null,M,P):da(v,p.child,M,P)}function $n(p,v,M,P,L){M=M.render;var z=v.ref;return mu(v,L),P=Mu(p,v,M,P,z,L),M=rl(),p!==null&&!Fr?(v.updateQueue=p.updateQueue,v.flags&=-2053,p.lanes&=~L,qi(p,v,L)):(Zn&&M&&mv(v),v.flags|=1,ar(p,v,P,L),v.child)}function Gn(p,v,M,P,L){if(p===null){var z=M.type;return typeof z=="function"&&!Wp(z)&&z.defaultProps===void 0&&M.compare===null&&M.defaultProps===void 0?(v.tag=15,v.type=z,ma(p,v,z,P,L)):(p=$p(M.type,null,P,v,v.mode,L),p.ref=v.ref,p.return=v,v.child=p)}if(z=p.child,(p.lanes&L)===0){var ie=z.memoizedProps;if(M=M.compare,M=M!==null?M:no,M(ie,P)&&p.ref===v.ref)return qi(p,v,L)}return v.flags|=1,p=Ma(z,P),p.ref=v.ref,p.return=v,v.child=p}function ma(p,v,M,P,L){if(p!==null&&no(p.memoizedProps,P)&&p.ref===v.ref)if(Fr=!1,(p.lanes&L)!==0)(p.flags&131072)!==0&&(Fr=!0);else return v.lanes=p.lanes,qi(p,v,L);return ga(p,v,M,P,L)}function Kr(p,v,M){var P=v.pendingProps,L=P.children,z=p!==null?p.memoizedState:null;if(P.mode==="hidden")if((v.mode&1)===0)v.memoizedState={baseLanes:0,cachePool:null},Ut(mc,di),di|=M;else if((M&1073741824)!==0)v.memoizedState={baseLanes:0,cachePool:null},P=z!==null?z.baseLanes:M,Ut(mc,di),di|=P;else return p=z!==null?z.baseLanes|M:M,v.lanes=v.childLanes=1073741824,v.memoizedState={baseLanes:p,cachePool:null},v.updateQueue=null,Ut(mc,di),di|=p,null;else z!==null?(P=z.baseLanes|M,v.memoizedState=null):P=M,Ut(mc,di),di|=P;return ar(p,v,L,M),v.child}function Pi(p,v){var M=v.ref;(p===null&&M!==null||p!==null&&p.ref!==M)&&(v.flags|=512,v.flags|=2097152)}function ga(p,v,M,P,L){var z=kn(M)?Pr:xn.current;return z=li(v,z),mu(v,L),M=Mu(p,v,M,P,z,L),P=rl(),p!==null&&!Fr?(v.updateQueue=p.updateQueue,v.flags&=-2053,p.lanes&=~L,qi(p,v,L)):(Zn&&P&&mv(v),v.flags|=1,ar(p,v,M,L),v.child)}function ac(p,v,M,P,L){if(kn(M)){var z=!0;Ya(v)}else z=!1;if(mu(v,L),v.stateNode===null)p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),_x(v,M,P),pv(v,M,P,L),P=!0;else if(p===null){var ie=v.stateNode,ye=v.memoizedProps;ie.props=ye;var Fe=ie.context,st=M.contextType;typeof st=="object"&&st!==null?st=$i(st):(st=kn(M)?Pr:xn.current,st=li(v,st));var Mt=M.getDerivedStateFromProps,rn=typeof Mt=="function"||typeof ie.getSnapshotBeforeUpdate=="function";rn||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==P||Fe!==st)&&wx(v,ie,P,st),Ds=!1;var Ht=v.memoizedState;ie.state=Ht,mp(v,P,ie,L),Fe=v.memoizedState,ye!==P||Ht!==Fe||tn.current||Ds?(typeof Mt=="function"&&(fv(v,M,Mt,P),Fe=v.memoizedState),(ye=Ds||hv(v,M,ye,P,Ht,Fe,st))?(rn||typeof ie.UNSAFE_componentWillMount!="function"&&typeof ie.componentWillMount!="function"||(typeof ie.componentWillMount=="function"&&ie.componentWillMount(),typeof ie.UNSAFE_componentWillMount=="function"&&ie.UNSAFE_componentWillMount()),typeof ie.componentDidMount=="function"&&(v.flags|=4194308)):(typeof ie.componentDidMount=="function"&&(v.flags|=4194308),v.memoizedProps=P,v.memoizedState=Fe),ie.props=P,ie.state=Fe,ie.context=st,P=ye):(typeof ie.componentDidMount=="function"&&(v.flags|=4194308),P=!1)}else{ie=v.stateNode,dv(p,v),ye=v.memoizedProps,st=v.type===v.elementType?ye:Wi(v.type,ye),ie.props=st,rn=v.pendingProps,Ht=ie.context,Fe=M.contextType,typeof Fe=="object"&&Fe!==null?Fe=$i(Fe):(Fe=kn(M)?Pr:xn.current,Fe=li(v,Fe));var ln=M.getDerivedStateFromProps;(Mt=typeof ln=="function"||typeof ie.getSnapshotBeforeUpdate=="function")||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==rn||Ht!==Fe)&&wx(v,ie,P,Fe),Ds=!1,Ht=v.memoizedState,ie.state=Ht,mp(v,P,ie,L);var _t=v.memoizedState;ye!==rn||Ht!==_t||tn.current||Ds?(typeof ln=="function"&&(fv(v,M,ln,P),_t=v.memoizedState),(st=Ds||hv(v,M,st,P,Ht,_t,Fe)||!1)?(Mt||typeof ie.UNSAFE_componentWillUpdate!="function"&&typeof ie.componentWillUpdate!="function"||(typeof ie.componentWillUpdate=="function"&&ie.componentWillUpdate(P,_t,Fe),typeof ie.UNSAFE_componentWillUpdate=="function"&&ie.UNSAFE_componentWillUpdate(P,_t,Fe)),typeof ie.componentDidUpdate=="function"&&(v.flags|=4),typeof ie.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof ie.componentDidUpdate!="function"||ye===p.memoizedProps&&Ht===p.memoizedState||(v.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===p.memoizedProps&&Ht===p.memoizedState||(v.flags|=1024),v.memoizedProps=P,v.memoizedState=_t),ie.props=P,ie.state=_t,ie.context=Fe,P=st):(typeof ie.componentDidUpdate!="function"||ye===p.memoizedProps&&Ht===p.memoizedState||(v.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===p.memoizedProps&&Ht===p.memoizedState||(v.flags|=1024),P=!1)}return ui(p,v,M,P,z,L)}function ui(p,v,M,P,L,z){Pi(p,v);var ie=(v.flags&128)!==0;if(!P&&!ie)return L&&Xr(v,M,!1),qi(p,v,z);P=v.stateNode,Rv.current=v;var ye=ie&&typeof M.getDerivedStateFromError!="function"?null:P.render();return v.flags|=1,p!==null&&ie?(v.child=da(v,p.child,null,z),v.child=da(v,null,ye,z)):ar(p,v,ye,z),v.memoizedState=P.state,L&&Xr(v,M,!0),v.child}function Qd(p){var v=p.stateNode;v.pendingContext?Vn(p,v.pendingContext,v.pendingContext!==v.context):v.context&&Vn(p,v.context,!1),_p(p,v.containerInfo)}function Nv(p,v,M,P,L){return xu(),bp(L),v.flags|=256,ar(p,v,M,P),v.child}var Jd={dehydrated:null,treeContext:null,retryLane:0};function lc(p){return{baseLanes:p,cachePool:null}}function Iv(p,v,M){var P=v.pendingProps,L=tr.current,z=!1,ie=(v.flags&128)!==0,ye;if((ye=ie)||(ye=p!==null&&p.memoizedState===null?!1:(L&2)!==0),ye?(z=!0,v.flags&=-129):(p===null||p.memoizedState!==null)&&(L|=1),Ut(tr,L&1),p===null)return tl(v),p=v.memoizedState,p!==null&&(p=p.dehydrated,p!==null)?((v.mode&1)===0?v.lanes=1:Ns(p)?v.lanes=8:v.lanes=1073741824,null):(L=P.children,p=P.fallback,z?(P=v.mode,z=v.child,L={mode:"hidden",children:L},(P&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=L):z=mf(L,P,0,null),p=bc(p,P,M,null),z.return=v,p.return=v,z.sibling=p,v.child=z,v.child.memoizedState=lc(M),v.memoizedState=Jd,p):oo(v,L));if(L=p.memoizedState,L!==null){if(ye=L.dehydrated,ye!==null){if(ie)return v.flags&256?(v.flags&=-257,tf(p,v,M,Error(o(422)))):v.memoizedState!==null?(v.child=p.child,v.flags|=128,null):(z=P.fallback,L=v.mode,P=mf({mode:"visible",children:P.children},L,0,null),z=bc(z,L,M,null),z.flags|=2,P.return=v,z.return=v,P.sibling=z,v.child=P,(v.mode&1)!==0&&da(v,p.child,null,M),v.child.memoizedState=lc(M),v.memoizedState=Jd,z);if((v.mode&1)===0)v=tf(p,v,M,null);else if(Ns(ye))v=tf(p,v,M,Error(o(419)));else if(P=(M&p.childLanes)!==0,Fr||P){if(P=mr,P!==null){switch(M&-M){case 4:z=2;break;case 16:z=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:z=32;break;case 536870912:z=268435456;break;default:z=0}P=(z&(P.suspendedLanes|M))!==0?0:z,P!==0&&P!==L.retryLane&&(L.retryLane=P,fi(p,P,-1))}Vp(),v=tf(p,v,M,Error(o(421)))}else Ka(ye)?(v.flags|=128,v.child=p.child,v=Dx.bind(null,p),ia(ye,v),v=null):(M=L.treeContext,Q&&(qr=cu(ye),Ci=v,Zn=!0,Us=null,yu=!1,M!==null&&(js[us++]=ca,js[us++]=ua,js[us++]=Zl,ca=M.id,ua=M.overflow,Zl=v)),v=oo(v,v.pendingProps.children),v.flags|=4096);return v}return z?(P=jp(p,v,P.children,P.fallback,M),z=v.child,L=p.child.memoizedState,z.memoizedState=L===null?lc(M):{baseLanes:L.baseLanes|M,cachePool:null},z.childLanes=p.childLanes&~M,v.memoizedState=Jd,P):(M=ef(p,v,P.children,M),v.memoizedState=null,M)}return z?(P=jp(p,v,P.children,P.fallback,M),z=v.child,L=p.child.memoizedState,z.memoizedState=L===null?lc(M):{baseLanes:L.baseLanes|M,cachePool:null},z.childLanes=p.childLanes&~M,v.memoizedState=Jd,P):(M=ef(p,v,P.children,M),v.memoizedState=null,M)}function oo(p,v){return v=mf({mode:"visible",children:v},p.mode,0,null),v.return=p,p.child=v}function ef(p,v,M,P){var L=p.child;return p=L.sibling,M=Ma(L,{mode:"visible",children:M}),(v.mode&1)===0&&(M.lanes=P),M.return=v,M.sibling=null,p!==null&&(P=v.deletions,P===null?(v.deletions=[p],v.flags|=16):P.push(p)),v.child=M}function jp(p,v,M,P,L){var z=v.mode;p=p.child;var ie=p.sibling,ye={mode:"hidden",children:M};return(z&1)===0&&v.child!==p?(M=v.child,M.childLanes=0,M.pendingProps=ye,v.deletions=null):(M=Ma(p,ye),M.subtreeFlags=p.subtreeFlags&14680064),ie!==null?P=Ma(ie,P):(P=bc(P,z,L,null),P.flags|=2),P.return=v,M.return=v,M.sibling=P,v.child=M,P}function tf(p,v,M,P){return P!==null&&bp(P),da(v,p.child,null,M),p=oo(v,v.pendingProps.children),p.flags|=2,v.memoizedState=null,p}function Ix(p,v,M){p.lanes|=v;var P=p.alternate;P!==null&&(P.lanes|=v),Yl(p.return,v,M)}function Io(p,v,M,P,L){var z=p.memoizedState;z===null?p.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:P,tail:M,tailMode:L}:(z.isBackwards=v,z.rendering=null,z.renderingStartTime=0,z.last=P,z.tail=M,z.tailMode=L)}function cc(p,v,M){var P=v.pendingProps,L=P.revealOrder,z=P.tail;if(ar(p,v,P.children,M),P=tr.current,(P&2)!==0)P=P&1|2,v.flags|=128;else{if(p!==null&&(p.flags&128)!==0)e:for(p=v.child;p!==null;){if(p.tag===13)p.memoizedState!==null&&Ix(p,M,v);else if(p.tag===19)Ix(p,M,v);else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===v)break e;for(;p.sibling===null;){if(p.return===null||p.return===v)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}P&=1}if(Ut(tr,P),(v.mode&1)===0)v.memoizedState=null;else switch(L){case"forwards":for(M=v.child,L=null;M!==null;)p=M.alternate,p!==null&&wp(p)===null&&(L=M),M=M.sibling;M=L,M===null?(L=v.child,v.child=null):(L=M.sibling,M.sibling=null),Io(v,!1,L,M,z);break;case"backwards":for(M=null,L=v.child,v.child=null;L!==null;){if(p=L.alternate,p!==null&&wp(p)===null){v.child=L;break}p=L.sibling,L.sibling=M,M=L,L=p}Io(v,!0,M,null,z);break;case"together":Io(v,!1,null,null,void 0);break;default:v.memoizedState=null}return v.child}function qi(p,v,M){if(p!==null&&(v.dependencies=p.dependencies),ko|=v.lanes,(M&v.childLanes)===0)return null;if(p!==null&&v.child!==p.child)throw Error(o(153));if(v.child!==null){for(p=v.child,M=Ma(p,p.pendingProps),v.child=M,M.return=v;p.sibling!==null;)p=p.sibling,M=M.sibling=Ma(p,p.pendingProps),M.return=v;M.sibling=null}return v.child}function Up(p,v,M){switch(v.tag){case 3:Qd(v),xu();break;case 5:Tx(v);break;case 1:kn(v.type)&&Ya(v);break;case 4:_p(v,v.stateNode.containerInfo);break;case 10:Kl(v,v.type._context,v.memoizedProps.value);break;case 13:var P=v.memoizedState;if(P!==null)return P.dehydrated!==null?(Ut(tr,tr.current&1),v.flags|=128,null):(M&v.child.childLanes)!==0?Iv(p,v,M):(Ut(tr,tr.current&1),p=qi(p,v,M),p!==null?p.sibling:null);Ut(tr,tr.current&1);break;case 19:if(P=(M&v.childLanes)!==0,(p.flags&128)!==0){if(P)return cc(p,v,M);v.flags|=128}var L=v.memoizedState;if(L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),Ut(tr,tr.current),P)break;return null;case 22:case 23:return v.lanes=0,Kr(p,v,M)}return qi(p,v,M)}function Fp(p,v){switch(gv(v),v.tag){case 1:return kn(v.type)&&Is(),p=v.flags,p&65536?(v.flags=p&-65537|128,v):null;case 3:return Su(),Zt(tn),Zt(xn),tc(),p=v.flags,(p&65536)!==0&&(p&128)===0?(v.flags=p&-65537|128,v):null;case 5:return xv(v),null;case 13:if(Zt(tr),p=v.memoizedState,p!==null&&p.dehydrated!==null){if(v.alternate===null)throw Error(o(340));xu()}return p=v.flags,p&65536?(v.flags=p&-65537|128,v):null;case 19:return Zt(tr),null;case 4:return Su(),null;case 10:return Bd(v.type._context),null;case 22:case 23:return ff(),null;case 24:return null;default:return null}}var Ri=!1,zr=!1,uc=typeof WeakSet=="function"?WeakSet:Set,dt=null;function Fs(p,v){var M=p.ref;if(M!==null)if(typeof M=="function")try{M(null)}catch(P){Ii(p,v,P)}else M.current=null}function va(p,v,M){try{M()}catch(P){Ii(p,v,P)}}var kv=!1;function Ov(p,v){for(q(p.containerInfo),dt=v;dt!==null;)if(p=dt,v=p.child,(p.subtreeFlags&1028)!==0&&v!==null)v.return=p,dt=v;else for(;dt!==null;){p=dt;try{var M=p.alternate;if((p.flags&1024)!==0)switch(p.tag){case 0:case 11:case 15:break;case 1:if(M!==null){var P=M.memoizedProps,L=M.memoizedState,z=p.stateNode,ie=z.getSnapshotBeforeUpdate(p.elementType===p.type?P:Wi(p.type,P),L);z.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:Ke&&Ye(p.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ye){Ii(p,p.return,ye)}if(v=p.sibling,v!==null){v.return=p.return,dt=v;break}dt=p.return}return M=kv,kv=!1,M}function ya(p,v,M){var P=v.updateQueue;if(P=P!==null?P.lastEffect:null,P!==null){var L=P=P.next;do{if((L.tag&p)===p){var z=L.destroy;L.destroy=void 0,z!==void 0&&va(v,M,z)}L=L.next}while(L!==P)}}function Yr(p,v){if(v=v.updateQueue,v=v!==null?v.lastEffect:null,v!==null){var M=v=v.next;do{if((M.tag&p)===p){var P=M.create;M.destroy=P()}M=M.next}while(M!==v)}}function Ni(p){var v=p.ref;if(v!==null){var M=p.stateNode;switch(p.tag){case 5:p=oe(M);break;default:p=M}typeof v=="function"?v(p):v.current=p}}function qn(p,v,M){if(Po&&typeof Po.onCommitFiberUnmount=="function")try{Po.onCommitFiberUnmount(jd,v)}catch{}switch(v.tag){case 0:case 11:case 14:case 15:if(p=v.updateQueue,p!==null&&(p=p.lastEffect,p!==null)){var P=p=p.next;do{var L=P,z=L.destroy;L=L.tag,z!==void 0&&((L&2)!==0||(L&4)!==0)&&va(v,M,z),P=P.next}while(P!==p)}break;case 1:if(Fs(v,M),p=v.stateNode,typeof p.componentWillUnmount=="function")try{p.props=v.memoizedProps,p.state=v.memoizedState,p.componentWillUnmount()}catch(ie){Ii(v,M,ie)}break;case 5:Fs(v,M);break;case 4:Ke?jv(p,v,M):ce&&ce&&(v=v.stateNode.containerInfo,M=Yt(v),en(v,M))}}function zs(p,v,M){for(var P=v;;)if(qn(p,P,M),P.child===null||Ke&&P.tag===4){if(P===v)break;for(;P.sibling===null;){if(P.return===null||P.return===v)return;P=P.return}P.sibling.return=P.return,P=P.sibling}else P.child.return=P,P=P.child}function Lv(p){var v=p.alternate;v!==null&&(p.alternate=null,Lv(v)),p.child=null,p.deletions=null,p.sibling=null,p.tag===5&&(v=p.stateNode,v!==null&&Je(v)),p.stateNode=null,p.return=null,p.dependencies=null,p.memoizedProps=null,p.memoizedState=null,p.pendingProps=null,p.stateNode=null,p.updateQueue=null}function Dv(p){return p.tag===5||p.tag===3||p.tag===4}function zp(p){e:for(;;){for(;p.sibling===null;){if(p.return===null||Dv(p.return))return null;p=p.return}for(p.sibling.return=p.return,p=p.sibling;p.tag!==5&&p.tag!==6&&p.tag!==18;){if(p.flags&2||p.child===null||p.tag===4)continue e;p.child.return=p,p=p.child}if(!(p.flags&2))return p.stateNode}}function Bp(p){if(Ke){e:{for(var v=p.return;v!==null;){if(Dv(v))break e;v=v.return}throw Error(o(160))}var M=v;switch(M.tag){case 5:v=M.stateNode,M.flags&32&&(Ae(v),M.flags&=-33),M=zp(p),Ru(p,M,v);break;case 3:case 4:v=M.stateNode.containerInfo,M=zp(p),Hp(p,M,v);break;default:throw Error(o(161))}}}function Hp(p,v,M){var P=p.tag;if(P===5||P===6)p=p.stateNode,v?mt(M,p,v):rt(M,p);else if(P!==4&&(p=p.child,p!==null))for(Hp(p,v,M),p=p.sibling;p!==null;)Hp(p,v,M),p=p.sibling}function Ru(p,v,M){var P=p.tag;if(P===5||P===6)p=p.stateNode,v?Et(M,p,v):se(M,p);else if(P!==4&&(p=p.child,p!==null))for(Ru(p,v,M),p=p.sibling;p!==null;)Ru(p,v,M),p=p.sibling}function jv(p,v,M){for(var P=v,L=!1,z,ie;;){if(!L){L=P.return;e:for(;;){if(L===null)throw Error(o(160));switch(z=L.stateNode,L.tag){case 5:ie=!1;break e;case 3:z=z.containerInfo,ie=!0;break e;case 4:z=z.containerInfo,ie=!0;break e}L=L.return}L=!0}if(P.tag===5||P.tag===6)zs(p,P,M),ie?J(z,P.stateNode):de(z,P.stateNode);else if(P.tag===18)ie?Ie(z,P.stateNode):Pe(z,P.stateNode);else if(P.tag===4){if(P.child!==null){z=P.stateNode.containerInfo,ie=!0,P.child.return=P,P=P.child;continue}}else if(qn(p,P,M),P.child!==null){P.child.return=P,P=P.child;continue}if(P===v)break;for(;P.sibling===null;){if(P.return===null||P.return===v)return;P=P.return,P.tag===4&&(L=!1)}P.sibling.return=P.return,P=P.sibling}}function ol(p,v){if(Ke){switch(v.tag){case 0:case 11:case 14:case 15:ya(3,v,v.return),Yr(3,v),ya(5,v,v.return);return;case 1:return;case 5:var M=v.stateNode;if(M!=null){var P=v.memoizedProps;p=p!==null?p.memoizedProps:P;var L=v.type,z=v.updateQueue;v.updateQueue=null,z!==null&&Dt(M,z,L,p,P,v)}return;case 6:if(v.stateNode===null)throw Error(o(162));M=v.memoizedProps,$e(v.stateNode,p!==null?p.memoizedProps:M,M);return;case 3:Q&&p!==null&&p.memoizedState.isDehydrated&&Y(v.stateNode.containerInfo);return;case 12:return;case 13:Nu(v);return;case 19:Nu(v);return;case 17:return}throw Error(o(163))}switch(v.tag){case 0:case 11:case 14:case 15:ya(3,v,v.return),Yr(3,v),ya(5,v,v.return);return;case 12:return;case 13:Nu(v);return;case 19:Nu(v);return;case 3:Q&&p!==null&&p.memoizedState.isDehydrated&&Y(v.stateNode.containerInfo);break;case 22:case 23:return}e:if(ce){switch(v.tag){case 1:case 5:case 6:break e;case 3:case 4:v=v.stateNode,en(v.containerInfo,v.pendingChildren);break e}throw Error(o(163))}}function Nu(p){var v=p.updateQueue;if(v!==null){p.updateQueue=null;var M=p.stateNode;M===null&&(M=p.stateNode=new uc),v.forEach(function(P){var L=jx.bind(null,p,P);M.has(P)||(M.add(P),P.then(L,L))})}}function AM(p,v){for(dt=v;dt!==null;){v=dt;var M=v.deletions;if(M!==null)for(var P=0;P";case fc:return":has("+(al(p)||"")+")";case hc:return'[role="'+p.value+'"]';case Iu:return'"'+p.value+'"';case xa:return'[data-testname="'+p.value+'"]';default:throw Error(o(365))}}function ps(p,v){var M=[];p=[p,0];for(var P=0;PL&&(L=ie),P&=~z}if(P=L,P=Rr()-P,P=(120>P?120:480>P?480:1080>P?1080:1920>P?1920:3e3>P?3e3:4320>P?4320:1960*zv(P/1960))-P,10p?16:p,Oo===null)var P=!1;else{if(p=Oo,Oo=null,yc=0,(an&6)!==0)throw Error(o(331));var L=an;for(an|=4,dt=p.current;dt!==null;){var z=dt,ie=z.child;if((dt.flags&16)!==0){var ye=z.deletions;if(ye!==null){for(var Fe=0;FeRr()-cf?Sa(p,0):gc|=M),Ki(p,v)}function Xv(p,v){v===0&&((p.mode&1)===0?v=1:(v=Pn,Pn<<=1,(Pn&130023424)===0&&(Pn=4194304)));var M=Rn();p=cl(p,v),p!==null&&(Wl(p,v,M),Ki(p,M))}function Dx(p){var v=p.memoizedState,M=0;v!==null&&(M=v.retryLane),Xv(p,M)}function jx(p,v){var M=0;switch(p.tag){case 13:var P=p.stateNode,L=p.memoizedState;L!==null&&(M=L.retryLane);break;case 19:P=p.stateNode;break;default:throw Error(o(314))}P!==null&&P.delete(v),Xv(p,M)}var qv;qv=function(p,v,M){if(p!==null)if(p.memoizedProps!==v.pendingProps||tn.current)Fr=!0;else{if((p.lanes&M)===0&&(v.flags&128)===0)return Fr=!1,Up(p,v,M);Fr=(p.flags&131072)!==0}else Fr=!1,Zn&&(v.flags&1048576)!==0&&Sx(v,yp,v.index);switch(v.lanes=0,v.tag){case 2:var P=v.type;p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),p=v.pendingProps;var L=li(v,xn.current);mu(v,M),L=Mu(null,v,P,p,L,M);var z=rl();return v.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(v.tag=1,v.memoizedState=null,v.updateQueue=null,kn(P)?(z=!0,Ya(v)):z=!1,v.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,gu(v),L.updater=gp,v.stateNode=L,L._reactInternals=v,pv(v,P,p,M),v=ui(null,v,P,!0,z,M)):(v.tag=0,Zn&&z&&mv(v),ar(null,v,L,M),v=v.child),v;case 16:P=v.elementType;e:{switch(p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),p=v.pendingProps,L=P._init,P=L(P._payload),v.type=P,L=v.tag=TM(P),p=Wi(P,p),L){case 0:v=ga(null,v,P,p,M);break e;case 1:v=ac(null,v,P,p,M);break e;case 11:v=$n(null,v,P,p,M);break e;case 14:v=Gn(null,v,P,Wi(P.type,p),M);break e}throw Error(o(306,P,""))}return v;case 0:return P=v.type,L=v.pendingProps,L=v.elementType===P?L:Wi(P,L),ga(p,v,P,L,M);case 1:return P=v.type,L=v.pendingProps,L=v.elementType===P?L:Wi(P,L),ac(p,v,P,L,M);case 3:e:{if(Qd(v),p===null)throw Error(o(387));P=v.pendingProps,z=v.memoizedState,L=z.element,dv(p,v),mp(v,P,null,M);var ie=v.memoizedState;if(P=ie.element,Q&&z.isDehydrated)if(z={element:P,isDehydrated:!1,cache:ie.cache,transitions:ie.transitions},v.updateQueue.baseState=z,v.memoizedState=z,v.flags&256){L=Error(o(423)),v=Nv(p,v,P,M,L);break e}else if(P!==L){L=Error(o(424)),v=Nv(p,v,P,M,L);break e}else for(Q&&(qr=sa(v.stateNode.containerInfo),Ci=v,Zn=!0,Us=null,yu=!1),M=Ax(v,null,P,M),v.child=M;M;)M.flags=M.flags&-3|4096,M=M.sibling;else{if(xu(),P===L){v=qi(p,v,M);break e}ar(p,v,P,M)}v=v.child}return v;case 5:return Tx(v),p===null&&tl(v),P=v.type,L=v.pendingProps,z=p!==null?p.memoizedProps:null,ie=L.children,ue(P,L)?ie=null:z!==null&&ue(P,z)&&(v.flags|=32),Pi(p,v),ar(p,v,ie,M),v.child;case 6:return p===null&&tl(v),null;case 13:return Iv(p,v,M);case 4:return _p(v,v.stateNode.containerInfo),P=v.pendingProps,p===null?v.child=da(v,null,P,M):ar(p,v,P,M),v.child;case 11:return P=v.type,L=v.pendingProps,L=v.elementType===P?L:Wi(P,L),$n(p,v,P,L,M);case 7:return ar(p,v,v.pendingProps,M),v.child;case 8:return ar(p,v,v.pendingProps.children,M),v.child;case 12:return ar(p,v,v.pendingProps.children,M),v.child;case 10:e:{if(P=v.type._context,L=v.pendingProps,z=v.memoizedProps,ie=L.value,Kl(v,P,ie),z!==null)if(Ai(z.value,ie)){if(z.children===L.children&&!tn.current){v=qi(p,v,M);break e}}else for(z=v.child,z!==null&&(z.return=v);z!==null;){var ye=z.dependencies;if(ye!==null){ie=z.child;for(var Fe=ye.firstContext;Fe!==null;){if(Fe.context===P){if(z.tag===1){Fe=la(-1,M&-M),Fe.tag=2;var st=z.updateQueue;if(st!==null){st=st.shared;var Mt=st.pending;Mt===null?Fe.next=Fe:(Fe.next=Mt.next,Mt.next=Fe),st.pending=Fe}}z.lanes|=M,Fe=z.alternate,Fe!==null&&(Fe.lanes|=M),Yl(z.return,M,v),ye.lanes|=M;break}Fe=Fe.next}}else if(z.tag===10)ie=z.type===v.type?null:z.child;else if(z.tag===18){if(ie=z.return,ie===null)throw Error(o(341));ie.lanes|=M,ye=ie.alternate,ye!==null&&(ye.lanes|=M),Yl(ie,M,v),ie=z.sibling}else ie=z.child;if(ie!==null)ie.return=z;else for(ie=z;ie!==null;){if(ie===v){ie=null;break}if(z=ie.sibling,z!==null){z.return=ie.return,ie=z;break}ie=ie.return}z=ie}ar(p,v,L.children,M),v=v.child}return v;case 9:return L=v.type,P=v.pendingProps.children,mu(v,M),L=$i(L),P=P(L),v.flags|=1,ar(p,v,P,M),v.child;case 14:return P=v.type,L=Wi(P,v.pendingProps),L=Wi(P.type,L),Gn(p,v,P,L,M);case 15:return ma(p,v,v.type,v.pendingProps,M);case 17:return P=v.type,L=v.pendingProps,L=v.elementType===P?L:Wi(P,L),p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),v.tag=1,kn(P)?(p=!0,Ya(v)):p=!1,mu(v,M),_x(v,P,L),pv(v,P,L,M),ui(null,v,P,!0,p,M);case 19:return cc(p,v,M);case 22:return Kr(p,v,M)}throw Error(o(156,v.tag))};function Gp(p,v){return $l(p,v)}function Ux(p,v,M,P){this.tag=p,this.key=M,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=v,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=P,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(p,v,M,P){return new Ux(p,v,M,P)}function Wp(p){return p=p.prototype,!(!p||!p.isReactComponent)}function TM(p){if(typeof p=="function")return Wp(p)?1:0;if(p!=null){if(p=p.$$typeof,p===S)return 11;if(p===E)return 14}return 2}function Ma(p,v){var M=p.alternate;return M===null?(M=vs(p.tag,v,p.key,p.mode),M.elementType=p.elementType,M.type=p.type,M.stateNode=p.stateNode,M.alternate=p,p.alternate=M):(M.pendingProps=v,M.type=p.type,M.flags=0,M.subtreeFlags=0,M.deletions=null),M.flags=p.flags&14680064,M.childLanes=p.childLanes,M.lanes=p.lanes,M.child=p.child,M.memoizedProps=p.memoizedProps,M.memoizedState=p.memoizedState,M.updateQueue=p.updateQueue,v=p.dependencies,M.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext},M.sibling=p.sibling,M.index=p.index,M.ref=p.ref,M}function $p(p,v,M,P,L,z){var ie=2;if(P=p,typeof p=="function")Wp(p)&&(ie=1);else if(typeof p=="string")ie=5;else e:switch(p){case d:return bc(M.children,L,z,v);case f:ie=8,L|=8;break;case m:return p=vs(12,M,v,L|2),p.elementType=m,p.lanes=z,p;case w:return p=vs(13,M,v,L),p.elementType=w,p.lanes=z,p;case _:return p=vs(19,M,v,L),p.elementType=_,p.lanes=z,p;case C:return mf(M,L,z,v);default:if(typeof p=="object"&&p!==null)switch(p.$$typeof){case y:ie=10;break e;case x:ie=9;break e;case S:ie=11;break e;case E:ie=14;break e;case T:ie=16,P=null;break e}throw Error(o(130,p==null?p:typeof p,""))}return v=vs(ie,M,v,L),v.elementType=p,v.type=P,v.lanes=z,v}function bc(p,v,M,P){return p=vs(7,p,P,v),p.lanes=M,p}function mf(p,v,M,P){return p=vs(22,p,P,v),p.elementType=C,p.lanes=M,p.stateNode={},p}function Xp(p,v,M){return p=vs(6,p,null,v),p.lanes=M,p}function qp(p,v,M){return v=vs(4,p.children!==null?p.children:[],p.key,v),v.lanes=M,v.stateNode={containerInfo:p.containerInfo,pendingChildren:null,implementation:p.implementation},v}function Kp(p,v,M,P,L){this.tag=v,this.containerInfo=p,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Me,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sp(0),this.expirationTimes=sp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sp(0),this.identifierPrefix=P,this.onRecoverableError=L,Q&&(this.mutableSourceEagerHydrationData=null)}function Fx(p,v,M,P,L,z,ie,ye,Fe){return p=new Kp(p,v,M,ye,Fe),v===1?(v=1,z===!0&&(v|=8)):v=0,z=vs(3,null,null,v),p.current=z,z.stateNode=p,z.memoizedState={element:P,isDehydrated:M,cache:null,transitions:null},gu(z),p}function zx(p){if(!p)return gt;p=p._reactInternals;e:{if(V(p)!==p||p.tag!==1)throw Error(o(170));var v=p;do{switch(v.tag){case 3:v=v.stateNode.context;break e;case 1:if(kn(v.type)){v=v.stateNode.__reactInternalMemoizedMergedChildContext;break e}}v=v.return}while(v!==null);throw Error(o(171))}if(p.tag===1){var M=p.type;if(kn(M))return to(p,M,v)}return v}function Bx(p){var v=p._reactInternals;if(v===void 0)throw typeof p.render=="function"?Error(o(188)):(p=Object.keys(p).join(","),Error(o(268,p)));return p=H(v),p===null?null:p.stateNode}function Bs(p,v){if(p=p.memoizedState,p!==null&&p.dehydrated!==null){var M=p.retryLane;p.retryLane=M!==0&&M=st&&z>=rn&&L<=Mt&&ie<=Ht){p.splice(v,1);break}else if(P!==st||M.width!==Fe.width||Htie){if(!(z!==rn||M.height!==Fe.height||MtL)){st>P&&(Fe.width+=st-P,Fe.x=P),Mtz&&(Fe.height+=rn-z,Fe.y=z),HtM&&(M=ie)),iell&&(v.flags|=128,P=!0,pa(L,!1),v.lanes=4194304)}else{if(!P)if(p=wp(z),p!==null){if(v.flags|=128,P=!0,p=p.updateQueue,p!==null&&(v.updateQueue=p,v.flags|=4),pa(L,!0),L.tail===null&&L.tailMode==="hidden"&&!z.alternate&&!Zn)return pr(v),null}else 2*Rr()-L.renderingStartTime>ll&&M!==1073741824&&(v.flags|=128,P=!0,pa(L,!1),v.lanes=4194304);L.isBackwards?(z.sibling=v.child,v.child=z):(p=L.last,p!==null?p.sibling=z:v.child=z,L.last=z)}return L.tail!==null?(v=L.tail,L.rendering=v,L.tail=v.sibling,L.renderingStartTime=Rr(),v.sibling=null,p=tr.current,Ut(tr,P?p&1|2:p&1),v):(pr(v),null);case 22:case 23:return ff(),P=v.memoizedState!==null,p!==null&&p.memoizedState!==null!==P&&(v.flags|=8192),P&&(v.mode&1)!==0?(di&1073741824)!==0&&(pr(v),Ke&&v.subtreeFlags&6&&(v.flags|=8192)):pr(v),null;case 24:return null;case 25:return null}throw Error(o(156,v.tag))}var Rv=a.ReactCurrentOwner,Fr=!1;function ar(p,v,M,P){v.child=p===null?Cx(v,null,M,P):da(v,p.child,M,P)}function $n(p,v,M,P,L){M=M.render;var z=v.ref;return mu(v,L),P=Mu(p,v,M,P,z,L),M=rl(),p!==null&&!Fr?(v.updateQueue=p.updateQueue,v.flags&=-2053,p.lanes&=~L,qi(p,v,L)):(Zn&&M&&mv(v),v.flags|=1,ar(p,v,P,L),v.child)}function Gn(p,v,M,P,L){if(p===null){var z=M.type;return typeof z=="function"&&!Wp(z)&&z.defaultProps===void 0&&M.compare===null&&M.defaultProps===void 0?(v.tag=15,v.type=z,ma(p,v,z,P,L)):(p=$p(M.type,null,P,v,v.mode,L),p.ref=v.ref,p.return=v,v.child=p)}if(z=p.child,(p.lanes&L)===0){var ie=z.memoizedProps;if(M=M.compare,M=M!==null?M:no,M(ie,P)&&p.ref===v.ref)return qi(p,v,L)}return v.flags|=1,p=Ma(z,P),p.ref=v.ref,p.return=v,v.child=p}function ma(p,v,M,P,L){if(p!==null&&no(p.memoizedProps,P)&&p.ref===v.ref)if(Fr=!1,(p.lanes&L)!==0)(p.flags&131072)!==0&&(Fr=!0);else return v.lanes=p.lanes,qi(p,v,L);return ga(p,v,M,P,L)}function Kr(p,v,M){var P=v.pendingProps,L=P.children,z=p!==null?p.memoizedState:null;if(P.mode==="hidden")if((v.mode&1)===0)v.memoizedState={baseLanes:0,cachePool:null},Ut(mc,di),di|=M;else if((M&1073741824)!==0)v.memoizedState={baseLanes:0,cachePool:null},P=z!==null?z.baseLanes:M,Ut(mc,di),di|=P;else return p=z!==null?z.baseLanes|M:M,v.lanes=v.childLanes=1073741824,v.memoizedState={baseLanes:p,cachePool:null},v.updateQueue=null,Ut(mc,di),di|=p,null;else z!==null?(P=z.baseLanes|M,v.memoizedState=null):P=M,Ut(mc,di),di|=P;return ar(p,v,L,M),v.child}function Pi(p,v){var M=v.ref;(p===null&&M!==null||p!==null&&p.ref!==M)&&(v.flags|=512,v.flags|=2097152)}function ga(p,v,M,P,L){var z=kn(M)?Pr:xn.current;return z=li(v,z),mu(v,L),M=Mu(p,v,M,P,z,L),P=rl(),p!==null&&!Fr?(v.updateQueue=p.updateQueue,v.flags&=-2053,p.lanes&=~L,qi(p,v,L)):(Zn&&P&&mv(v),v.flags|=1,ar(p,v,M,L),v.child)}function ac(p,v,M,P,L){if(kn(M)){var z=!0;Ya(v)}else z=!1;if(mu(v,L),v.stateNode===null)p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),Sx(v,M,P),pv(v,M,P,L),P=!0;else if(p===null){var ie=v.stateNode,ye=v.memoizedProps;ie.props=ye;var ze=ie.context,st=M.contextType;typeof st=="object"&&st!==null?st=$i(st):(st=kn(M)?Pr:xn.current,st=li(v,st));var Mt=M.getDerivedStateFromProps,rn=typeof Mt=="function"||typeof ie.getSnapshotBeforeUpdate=="function";rn||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==P||ze!==st)&&Mx(v,ie,P,st),Ds=!1;var Ht=v.memoizedState;ie.state=Ht,mp(v,P,ie,L),ze=v.memoizedState,ye!==P||Ht!==ze||tn.current||Ds?(typeof Mt=="function"&&(fv(v,M,Mt,P),ze=v.memoizedState),(ye=Ds||hv(v,M,ye,P,Ht,ze,st))?(rn||typeof ie.UNSAFE_componentWillMount!="function"&&typeof ie.componentWillMount!="function"||(typeof ie.componentWillMount=="function"&&ie.componentWillMount(),typeof ie.UNSAFE_componentWillMount=="function"&&ie.UNSAFE_componentWillMount()),typeof ie.componentDidMount=="function"&&(v.flags|=4194308)):(typeof ie.componentDidMount=="function"&&(v.flags|=4194308),v.memoizedProps=P,v.memoizedState=ze),ie.props=P,ie.state=ze,ie.context=st,P=ye):(typeof ie.componentDidMount=="function"&&(v.flags|=4194308),P=!1)}else{ie=v.stateNode,dv(p,v),ye=v.memoizedProps,st=v.type===v.elementType?ye:Wi(v.type,ye),ie.props=st,rn=v.pendingProps,Ht=ie.context,ze=M.contextType,typeof ze=="object"&&ze!==null?ze=$i(ze):(ze=kn(M)?Pr:xn.current,ze=li(v,ze));var ln=M.getDerivedStateFromProps;(Mt=typeof ln=="function"||typeof ie.getSnapshotBeforeUpdate=="function")||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==rn||Ht!==ze)&&Mx(v,ie,P,ze),Ds=!1,Ht=v.memoizedState,ie.state=Ht,mp(v,P,ie,L);var _t=v.memoizedState;ye!==rn||Ht!==_t||tn.current||Ds?(typeof ln=="function"&&(fv(v,M,ln,P),_t=v.memoizedState),(st=Ds||hv(v,M,st,P,Ht,_t,ze)||!1)?(Mt||typeof ie.UNSAFE_componentWillUpdate!="function"&&typeof ie.componentWillUpdate!="function"||(typeof ie.componentWillUpdate=="function"&&ie.componentWillUpdate(P,_t,ze),typeof ie.UNSAFE_componentWillUpdate=="function"&&ie.UNSAFE_componentWillUpdate(P,_t,ze)),typeof ie.componentDidUpdate=="function"&&(v.flags|=4),typeof ie.getSnapshotBeforeUpdate=="function"&&(v.flags|=1024)):(typeof ie.componentDidUpdate!="function"||ye===p.memoizedProps&&Ht===p.memoizedState||(v.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===p.memoizedProps&&Ht===p.memoizedState||(v.flags|=1024),v.memoizedProps=P,v.memoizedState=_t),ie.props=P,ie.state=_t,ie.context=ze,P=st):(typeof ie.componentDidUpdate!="function"||ye===p.memoizedProps&&Ht===p.memoizedState||(v.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===p.memoizedProps&&Ht===p.memoizedState||(v.flags|=1024),P=!1)}return ui(p,v,M,P,z,L)}function ui(p,v,M,P,L,z){Pi(p,v);var ie=(v.flags&128)!==0;if(!P&&!ie)return L&&Xr(v,M,!1),qi(p,v,z);P=v.stateNode,Rv.current=v;var ye=ie&&typeof M.getDerivedStateFromError!="function"?null:P.render();return v.flags|=1,p!==null&&ie?(v.child=da(v,p.child,null,z),v.child=da(v,null,ye,z)):ar(p,v,ye,z),v.memoizedState=P.state,L&&Xr(v,M,!0),v.child}function Qd(p){var v=p.stateNode;v.pendingContext?Vn(p,v.pendingContext,v.pendingContext!==v.context):v.context&&Vn(p,v.context,!1),_p(p,v.containerInfo)}function Nv(p,v,M,P,L){return xu(),bp(L),v.flags|=256,ar(p,v,M,P),v.child}var Jd={dehydrated:null,treeContext:null,retryLane:0};function lc(p){return{baseLanes:p,cachePool:null}}function Iv(p,v,M){var P=v.pendingProps,L=tr.current,z=!1,ie=(v.flags&128)!==0,ye;if((ye=ie)||(ye=p!==null&&p.memoizedState===null?!1:(L&2)!==0),ye?(z=!0,v.flags&=-129):(p===null||p.memoizedState!==null)&&(L|=1),Ut(tr,L&1),p===null)return tl(v),p=v.memoizedState,p!==null&&(p=p.dehydrated,p!==null)?((v.mode&1)===0?v.lanes=1:Ns(p)?v.lanes=8:v.lanes=1073741824,null):(L=P.children,p=P.fallback,z?(P=v.mode,z=v.child,L={mode:"hidden",children:L},(P&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=L):z=mf(L,P,0,null),p=bc(p,P,M,null),z.return=v,p.return=v,z.sibling=p,v.child=z,v.child.memoizedState=lc(M),v.memoizedState=Jd,p):oo(v,L));if(L=p.memoizedState,L!==null){if(ye=L.dehydrated,ye!==null){if(ie)return v.flags&256?(v.flags&=-257,tf(p,v,M,Error(o(422)))):v.memoizedState!==null?(v.child=p.child,v.flags|=128,null):(z=P.fallback,L=v.mode,P=mf({mode:"visible",children:P.children},L,0,null),z=bc(z,L,M,null),z.flags|=2,P.return=v,z.return=v,P.sibling=z,v.child=P,(v.mode&1)!==0&&da(v,p.child,null,M),v.child.memoizedState=lc(M),v.memoizedState=Jd,z);if((v.mode&1)===0)v=tf(p,v,M,null);else if(Ns(ye))v=tf(p,v,M,Error(o(419)));else if(P=(M&p.childLanes)!==0,Fr||P){if(P=mr,P!==null){switch(M&-M){case 4:z=2;break;case 16:z=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:z=32;break;case 536870912:z=268435456;break;default:z=0}P=(z&(P.suspendedLanes|M))!==0?0:z,P!==0&&P!==L.retryLane&&(L.retryLane=P,fi(p,P,-1))}Vp(),v=tf(p,v,M,Error(o(421)))}else Ka(ye)?(v.flags|=128,v.child=p.child,v=Ux.bind(null,p),ia(ye,v),v=null):(M=L.treeContext,Z&&(qr=cu(ye),Ci=v,Zn=!0,Us=null,yu=!1,M!==null&&(js[us++]=ca,js[us++]=ua,js[us++]=Zl,ca=M.id,ua=M.overflow,Zl=v)),v=oo(v,v.pendingProps.children),v.flags|=4096);return v}return z?(P=jp(p,v,P.children,P.fallback,M),z=v.child,L=p.child.memoizedState,z.memoizedState=L===null?lc(M):{baseLanes:L.baseLanes|M,cachePool:null},z.childLanes=p.childLanes&~M,v.memoizedState=Jd,P):(M=ef(p,v,P.children,M),v.memoizedState=null,M)}return z?(P=jp(p,v,P.children,P.fallback,M),z=v.child,L=p.child.memoizedState,z.memoizedState=L===null?lc(M):{baseLanes:L.baseLanes|M,cachePool:null},z.childLanes=p.childLanes&~M,v.memoizedState=Jd,P):(M=ef(p,v,P.children,M),v.memoizedState=null,M)}function oo(p,v){return v=mf({mode:"visible",children:v},p.mode,0,null),v.return=p,p.child=v}function ef(p,v,M,P){var L=p.child;return p=L.sibling,M=Ma(L,{mode:"visible",children:M}),(v.mode&1)===0&&(M.lanes=P),M.return=v,M.sibling=null,p!==null&&(P=v.deletions,P===null?(v.deletions=[p],v.flags|=16):P.push(p)),v.child=M}function jp(p,v,M,P,L){var z=v.mode;p=p.child;var ie=p.sibling,ye={mode:"hidden",children:M};return(z&1)===0&&v.child!==p?(M=v.child,M.childLanes=0,M.pendingProps=ye,v.deletions=null):(M=Ma(p,ye),M.subtreeFlags=p.subtreeFlags&14680064),ie!==null?P=Ma(ie,P):(P=bc(P,z,L,null),P.flags|=2),P.return=v,M.return=v,M.sibling=P,v.child=M,P}function tf(p,v,M,P){return P!==null&&bp(P),da(v,p.child,null,M),p=oo(v,v.pendingProps.children),p.flags|=2,v.memoizedState=null,p}function Ox(p,v,M){p.lanes|=v;var P=p.alternate;P!==null&&(P.lanes|=v),Yl(p.return,v,M)}function Io(p,v,M,P,L){var z=p.memoizedState;z===null?p.memoizedState={isBackwards:v,rendering:null,renderingStartTime:0,last:P,tail:M,tailMode:L}:(z.isBackwards=v,z.rendering=null,z.renderingStartTime=0,z.last=P,z.tail=M,z.tailMode=L)}function cc(p,v,M){var P=v.pendingProps,L=P.revealOrder,z=P.tail;if(ar(p,v,P.children,M),P=tr.current,(P&2)!==0)P=P&1|2,v.flags|=128;else{if(p!==null&&(p.flags&128)!==0)e:for(p=v.child;p!==null;){if(p.tag===13)p.memoizedState!==null&&Ox(p,M,v);else if(p.tag===19)Ox(p,M,v);else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===v)break e;for(;p.sibling===null;){if(p.return===null||p.return===v)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}P&=1}if(Ut(tr,P),(v.mode&1)===0)v.memoizedState=null;else switch(L){case"forwards":for(M=v.child,L=null;M!==null;)p=M.alternate,p!==null&&wp(p)===null&&(L=M),M=M.sibling;M=L,M===null?(L=v.child,v.child=null):(L=M.sibling,M.sibling=null),Io(v,!1,L,M,z);break;case"backwards":for(M=null,L=v.child,v.child=null;L!==null;){if(p=L.alternate,p!==null&&wp(p)===null){v.child=L;break}p=L.sibling,L.sibling=M,M=L,L=p}Io(v,!0,M,null,z);break;case"together":Io(v,!1,null,null,void 0);break;default:v.memoizedState=null}return v.child}function qi(p,v,M){if(p!==null&&(v.dependencies=p.dependencies),ko|=v.lanes,(M&v.childLanes)===0)return null;if(p!==null&&v.child!==p.child)throw Error(o(153));if(v.child!==null){for(p=v.child,M=Ma(p,p.pendingProps),v.child=M,M.return=v;p.sibling!==null;)p=p.sibling,M=M.sibling=Ma(p,p.pendingProps),M.return=v;M.sibling=null}return v.child}function Up(p,v,M){switch(v.tag){case 3:Qd(v),xu();break;case 5:Px(v);break;case 1:kn(v.type)&&Ya(v);break;case 4:_p(v,v.stateNode.containerInfo);break;case 10:Kl(v,v.type._context,v.memoizedProps.value);break;case 13:var P=v.memoizedState;if(P!==null)return P.dehydrated!==null?(Ut(tr,tr.current&1),v.flags|=128,null):(M&v.child.childLanes)!==0?Iv(p,v,M):(Ut(tr,tr.current&1),p=qi(p,v,M),p!==null?p.sibling:null);Ut(tr,tr.current&1);break;case 19:if(P=(M&v.childLanes)!==0,(p.flags&128)!==0){if(P)return cc(p,v,M);v.flags|=128}var L=v.memoizedState;if(L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),Ut(tr,tr.current),P)break;return null;case 22:case 23:return v.lanes=0,Kr(p,v,M)}return qi(p,v,M)}function Fp(p,v){switch(gv(v),v.tag){case 1:return kn(v.type)&&Is(),p=v.flags,p&65536?(v.flags=p&-65537|128,v):null;case 3:return Su(),Zt(tn),Zt(xn),tc(),p=v.flags,(p&65536)!==0&&(p&128)===0?(v.flags=p&-65537|128,v):null;case 5:return xv(v),null;case 13:if(Zt(tr),p=v.memoizedState,p!==null&&p.dehydrated!==null){if(v.alternate===null)throw Error(o(340));xu()}return p=v.flags,p&65536?(v.flags=p&-65537|128,v):null;case 19:return Zt(tr),null;case 4:return Su(),null;case 10:return Bd(v.type._context),null;case 22:case 23:return ff(),null;case 24:return null;default:return null}}var Ri=!1,zr=!1,uc=typeof WeakSet=="function"?WeakSet:Set,ft=null;function Fs(p,v){var M=p.ref;if(M!==null)if(typeof M=="function")try{M(null)}catch(P){Ii(p,v,P)}else M.current=null}function va(p,v,M){try{M()}catch(P){Ii(p,v,P)}}var kv=!1;function Ov(p,v){for(J(p.containerInfo),ft=v;ft!==null;)if(p=ft,v=p.child,(p.subtreeFlags&1028)!==0&&v!==null)v.return=p,ft=v;else for(;ft!==null;){p=ft;try{var M=p.alternate;if((p.flags&1024)!==0)switch(p.tag){case 0:case 11:case 15:break;case 1:if(M!==null){var P=M.memoizedProps,L=M.memoizedState,z=p.stateNode,ie=z.getSnapshotBeforeUpdate(p.elementType===p.type?P:Wi(p.type,P),L);z.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:Ke&&Ye(p.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ye){Ii(p,p.return,ye)}if(v=p.sibling,v!==null){v.return=p.return,ft=v;break}ft=p.return}return M=kv,kv=!1,M}function ya(p,v,M){var P=v.updateQueue;if(P=P!==null?P.lastEffect:null,P!==null){var L=P=P.next;do{if((L.tag&p)===p){var z=L.destroy;L.destroy=void 0,z!==void 0&&va(v,M,z)}L=L.next}while(L!==P)}}function Yr(p,v){if(v=v.updateQueue,v=v!==null?v.lastEffect:null,v!==null){var M=v=v.next;do{if((M.tag&p)===p){var P=M.create;M.destroy=P()}M=M.next}while(M!==v)}}function Ni(p){var v=p.ref;if(v!==null){var M=p.stateNode;switch(p.tag){case 5:p=se(M);break;default:p=M}typeof v=="function"?v(p):v.current=p}}function qn(p,v,M){if(Po&&typeof Po.onCommitFiberUnmount=="function")try{Po.onCommitFiberUnmount(jd,v)}catch{}switch(v.tag){case 0:case 11:case 14:case 15:if(p=v.updateQueue,p!==null&&(p=p.lastEffect,p!==null)){var P=p=p.next;do{var L=P,z=L.destroy;L=L.tag,z!==void 0&&((L&2)!==0||(L&4)!==0)&&va(v,M,z),P=P.next}while(P!==p)}break;case 1:if(Fs(v,M),p=v.stateNode,typeof p.componentWillUnmount=="function")try{p.props=v.memoizedProps,p.state=v.memoizedState,p.componentWillUnmount()}catch(ie){Ii(v,M,ie)}break;case 5:Fs(v,M);break;case 4:Ke?jv(p,v,M):ce&&ce&&(v=v.stateNode.containerInfo,M=Yt(v),en(v,M))}}function zs(p,v,M){for(var P=v;;)if(qn(p,P,M),P.child===null||Ke&&P.tag===4){if(P===v)break;for(;P.sibling===null;){if(P.return===null||P.return===v)return;P=P.return}P.sibling.return=P.return,P=P.sibling}else P.child.return=P,P=P.child}function Lv(p){var v=p.alternate;v!==null&&(p.alternate=null,Lv(v)),p.child=null,p.deletions=null,p.sibling=null,p.tag===5&&(v=p.stateNode,v!==null&&Je(v)),p.stateNode=null,p.return=null,p.dependencies=null,p.memoizedProps=null,p.memoizedState=null,p.pendingProps=null,p.stateNode=null,p.updateQueue=null}function Dv(p){return p.tag===5||p.tag===3||p.tag===4}function zp(p){e:for(;;){for(;p.sibling===null;){if(p.return===null||Dv(p.return))return null;p=p.return}for(p.sibling.return=p.return,p=p.sibling;p.tag!==5&&p.tag!==6&&p.tag!==18;){if(p.flags&2||p.child===null||p.tag===4)continue e;p.child.return=p,p=p.child}if(!(p.flags&2))return p.stateNode}}function Bp(p){if(Ke){e:{for(var v=p.return;v!==null;){if(Dv(v))break e;v=v.return}throw Error(o(160))}var M=v;switch(M.tag){case 5:v=M.stateNode,M.flags&32&&(Ae(v),M.flags&=-33),M=zp(p),Ru(p,M,v);break;case 3:case 4:v=M.stateNode.containerInfo,M=zp(p),Hp(p,M,v);break;default:throw Error(o(161))}}}function Hp(p,v,M){var P=p.tag;if(P===5||P===6)p=p.stateNode,v?ct(M,p,v):de(M,p);else if(P!==4&&(p=p.child,p!==null))for(Hp(p,v,M),p=p.sibling;p!==null;)Hp(p,v,M),p=p.sibling}function Ru(p,v,M){var P=p.tag;if(P===5||P===6)p=p.stateNode,v?Lt(M,p,v):dt(M,p);else if(P!==4&&(p=p.child,p!==null))for(Ru(p,v,M),p=p.sibling;p!==null;)Ru(p,v,M),p=p.sibling}function jv(p,v,M){for(var P=v,L=!1,z,ie;;){if(!L){L=P.return;e:for(;;){if(L===null)throw Error(o(160));switch(z=L.stateNode,L.tag){case 5:ie=!1;break e;case 3:z=z.containerInfo,ie=!0;break e;case 4:z=z.containerInfo,ie=!0;break e}L=L.return}L=!0}if(P.tag===5||P.tag===6)zs(p,P,M),ie?Q(z,P.stateNode):ue(z,P.stateNode);else if(P.tag===18)ie?ke(z,P.stateNode):Pe(z,P.stateNode);else if(P.tag===4){if(P.child!==null){z=P.stateNode.containerInfo,ie=!0,P.child.return=P,P=P.child;continue}}else if(qn(p,P,M),P.child!==null){P.child.return=P,P=P.child;continue}if(P===v)break;for(;P.sibling===null;){if(P.return===null||P.return===v)return;P=P.return,P.tag===4&&(L=!1)}P.sibling.return=P.return,P=P.sibling}}function ol(p,v){if(Ke){switch(v.tag){case 0:case 11:case 14:case 15:ya(3,v,v.return),Yr(3,v),ya(5,v,v.return);return;case 1:return;case 5:var M=v.stateNode;if(M!=null){var P=v.memoizedProps;p=p!==null?p.memoizedProps:P;var L=v.type,z=v.updateQueue;v.updateQueue=null,z!==null&&jt(M,z,L,p,P,v)}return;case 6:if(v.stateNode===null)throw Error(o(162));M=v.memoizedProps,Ne(v.stateNode,p!==null?p.memoizedProps:M,M);return;case 3:Z&&p!==null&&p.memoizedState.isDehydrated&&K(v.stateNode.containerInfo);return;case 12:return;case 13:Nu(v);return;case 19:Nu(v);return;case 17:return}throw Error(o(163))}switch(v.tag){case 0:case 11:case 14:case 15:ya(3,v,v.return),Yr(3,v),ya(5,v,v.return);return;case 12:return;case 13:Nu(v);return;case 19:Nu(v);return;case 3:Z&&p!==null&&p.memoizedState.isDehydrated&&K(v.stateNode.containerInfo);break;case 22:case 23:return}e:if(ce){switch(v.tag){case 1:case 5:case 6:break e;case 3:case 4:v=v.stateNode,en(v.containerInfo,v.pendingChildren);break e}throw Error(o(163))}}function Nu(p){var v=p.updateQueue;if(v!==null){p.updateQueue=null;var M=p.stateNode;M===null&&(M=p.stateNode=new uc),v.forEach(function(P){var L=Fx.bind(null,p,P);M.has(P)||(M.add(P),P.then(L,L))})}}function TM(p,v){for(ft=v;ft!==null;){v=ft;var M=v.deletions;if(M!==null)for(var P=0;P";case fc:return":has("+(al(p)||"")+")";case hc:return'[role="'+p.value+'"]';case Iu:return'"'+p.value+'"';case xa:return'[data-testname="'+p.value+'"]';default:throw Error(o(365))}}function ps(p,v){var M=[];p=[p,0];for(var P=0;PL&&(L=ie),P&=~z}if(P=L,P=Rr()-P,P=(120>P?120:480>P?480:1080>P?1080:1920>P?1920:3e3>P?3e3:4320>P?4320:1960*zv(P/1960))-P,10p?16:p,Oo===null)var P=!1;else{if(p=Oo,Oo=null,yc=0,(an&6)!==0)throw Error(o(331));var L=an;for(an|=4,ft=p.current;ft!==null;){var z=ft,ie=z.child;if((ft.flags&16)!==0){var ye=z.deletions;if(ye!==null){for(var ze=0;zeRr()-cf?Sa(p,0):gc|=M),Ki(p,v)}function Xv(p,v){v===0&&((p.mode&1)===0?v=1:(v=Pn,Pn<<=1,(Pn&130023424)===0&&(Pn=4194304)));var M=Rn();p=cl(p,v),p!==null&&(Wl(p,v,M),Ki(p,M))}function Ux(p){var v=p.memoizedState,M=0;v!==null&&(M=v.retryLane),Xv(p,M)}function Fx(p,v){var M=0;switch(p.tag){case 13:var P=p.stateNode,L=p.memoizedState;L!==null&&(M=L.retryLane);break;case 19:P=p.stateNode;break;default:throw Error(o(314))}P!==null&&P.delete(v),Xv(p,M)}var qv;qv=function(p,v,M){if(p!==null)if(p.memoizedProps!==v.pendingProps||tn.current)Fr=!0;else{if((p.lanes&M)===0&&(v.flags&128)===0)return Fr=!1,Up(p,v,M);Fr=(p.flags&131072)!==0}else Fr=!1,Zn&&(v.flags&1048576)!==0&&Ex(v,yp,v.index);switch(v.lanes=0,v.tag){case 2:var P=v.type;p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),p=v.pendingProps;var L=li(v,xn.current);mu(v,M),L=Mu(null,v,P,p,L,M);var z=rl();return v.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(v.tag=1,v.memoizedState=null,v.updateQueue=null,kn(P)?(z=!0,Ya(v)):z=!1,v.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,gu(v),L.updater=gp,v.stateNode=L,L._reactInternals=v,pv(v,P,p,M),v=ui(null,v,P,!0,z,M)):(v.tag=0,Zn&&z&&mv(v),ar(null,v,L,M),v=v.child),v;case 16:P=v.elementType;e:{switch(p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),p=v.pendingProps,L=P._init,P=L(P._payload),v.type=P,L=v.tag=CM(P),p=Wi(P,p),L){case 0:v=ga(null,v,P,p,M);break e;case 1:v=ac(null,v,P,p,M);break e;case 11:v=$n(null,v,P,p,M);break e;case 14:v=Gn(null,v,P,Wi(P.type,p),M);break e}throw Error(o(306,P,""))}return v;case 0:return P=v.type,L=v.pendingProps,L=v.elementType===P?L:Wi(P,L),ga(p,v,P,L,M);case 1:return P=v.type,L=v.pendingProps,L=v.elementType===P?L:Wi(P,L),ac(p,v,P,L,M);case 3:e:{if(Qd(v),p===null)throw Error(o(387));P=v.pendingProps,z=v.memoizedState,L=z.element,dv(p,v),mp(v,P,null,M);var ie=v.memoizedState;if(P=ie.element,Z&&z.isDehydrated)if(z={element:P,isDehydrated:!1,cache:ie.cache,transitions:ie.transitions},v.updateQueue.baseState=z,v.memoizedState=z,v.flags&256){L=Error(o(423)),v=Nv(p,v,P,M,L);break e}else if(P!==L){L=Error(o(424)),v=Nv(p,v,P,M,L);break e}else for(Z&&(qr=sa(v.stateNode.containerInfo),Ci=v,Zn=!0,Us=null,yu=!1),M=Cx(v,null,P,M),v.child=M;M;)M.flags=M.flags&-3|4096,M=M.sibling;else{if(xu(),P===L){v=qi(p,v,M);break e}ar(p,v,P,M)}v=v.child}return v;case 5:return Px(v),p===null&&tl(v),P=v.type,L=v.pendingProps,z=p!==null?p.memoizedProps:null,ie=L.children,le(P,L)?ie=null:z!==null&&le(P,z)&&(v.flags|=32),Pi(p,v),ar(p,v,ie,M),v.child;case 6:return p===null&&tl(v),null;case 13:return Iv(p,v,M);case 4:return _p(v,v.stateNode.containerInfo),P=v.pendingProps,p===null?v.child=da(v,null,P,M):ar(p,v,P,M),v.child;case 11:return P=v.type,L=v.pendingProps,L=v.elementType===P?L:Wi(P,L),$n(p,v,P,L,M);case 7:return ar(p,v,v.pendingProps,M),v.child;case 8:return ar(p,v,v.pendingProps.children,M),v.child;case 12:return ar(p,v,v.pendingProps.children,M),v.child;case 10:e:{if(P=v.type._context,L=v.pendingProps,z=v.memoizedProps,ie=L.value,Kl(v,P,ie),z!==null)if(Ai(z.value,ie)){if(z.children===L.children&&!tn.current){v=qi(p,v,M);break e}}else for(z=v.child,z!==null&&(z.return=v);z!==null;){var ye=z.dependencies;if(ye!==null){ie=z.child;for(var ze=ye.firstContext;ze!==null;){if(ze.context===P){if(z.tag===1){ze=la(-1,M&-M),ze.tag=2;var st=z.updateQueue;if(st!==null){st=st.shared;var Mt=st.pending;Mt===null?ze.next=ze:(ze.next=Mt.next,Mt.next=ze),st.pending=ze}}z.lanes|=M,ze=z.alternate,ze!==null&&(ze.lanes|=M),Yl(z.return,M,v),ye.lanes|=M;break}ze=ze.next}}else if(z.tag===10)ie=z.type===v.type?null:z.child;else if(z.tag===18){if(ie=z.return,ie===null)throw Error(o(341));ie.lanes|=M,ye=ie.alternate,ye!==null&&(ye.lanes|=M),Yl(ie,M,v),ie=z.sibling}else ie=z.child;if(ie!==null)ie.return=z;else for(ie=z;ie!==null;){if(ie===v){ie=null;break}if(z=ie.sibling,z!==null){z.return=ie.return,ie=z;break}ie=ie.return}z=ie}ar(p,v,L.children,M),v=v.child}return v;case 9:return L=v.type,P=v.pendingProps.children,mu(v,M),L=$i(L),P=P(L),v.flags|=1,ar(p,v,P,M),v.child;case 14:return P=v.type,L=Wi(P,v.pendingProps),L=Wi(P.type,L),Gn(p,v,P,L,M);case 15:return ma(p,v,v.type,v.pendingProps,M);case 17:return P=v.type,L=v.pendingProps,L=v.elementType===P?L:Wi(P,L),p!==null&&(p.alternate=null,v.alternate=null,v.flags|=2),v.tag=1,kn(P)?(p=!0,Ya(v)):p=!1,mu(v,M),Sx(v,P,L),pv(v,P,L,M),ui(null,v,P,!0,p,M);case 19:return cc(p,v,M);case 22:return Kr(p,v,M)}throw Error(o(156,v.tag))};function Gp(p,v){return $l(p,v)}function zx(p,v,M,P){this.tag=p,this.key=M,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=v,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=P,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(p,v,M,P){return new zx(p,v,M,P)}function Wp(p){return p=p.prototype,!(!p||!p.isReactComponent)}function CM(p){if(typeof p=="function")return Wp(p)?1:0;if(p!=null){if(p=p.$$typeof,p===S)return 11;if(p===E)return 14}return 2}function Ma(p,v){var M=p.alternate;return M===null?(M=vs(p.tag,v,p.key,p.mode),M.elementType=p.elementType,M.type=p.type,M.stateNode=p.stateNode,M.alternate=p,p.alternate=M):(M.pendingProps=v,M.type=p.type,M.flags=0,M.subtreeFlags=0,M.deletions=null),M.flags=p.flags&14680064,M.childLanes=p.childLanes,M.lanes=p.lanes,M.child=p.child,M.memoizedProps=p.memoizedProps,M.memoizedState=p.memoizedState,M.updateQueue=p.updateQueue,v=p.dependencies,M.dependencies=v===null?null:{lanes:v.lanes,firstContext:v.firstContext},M.sibling=p.sibling,M.index=p.index,M.ref=p.ref,M}function $p(p,v,M,P,L,z){var ie=2;if(P=p,typeof p=="function")Wp(p)&&(ie=1);else if(typeof p=="string")ie=5;else e:switch(p){case d:return bc(M.children,L,z,v);case f:ie=8,L|=8;break;case m:return p=vs(12,M,v,L|2),p.elementType=m,p.lanes=z,p;case w:return p=vs(13,M,v,L),p.elementType=w,p.lanes=z,p;case _:return p=vs(19,M,v,L),p.elementType=_,p.lanes=z,p;case C:return mf(M,L,z,v);default:if(typeof p=="object"&&p!==null)switch(p.$$typeof){case y:ie=10;break e;case x:ie=9;break e;case S:ie=11;break e;case E:ie=14;break e;case T:ie=16,P=null;break e}throw Error(o(130,p==null?p:typeof p,""))}return v=vs(ie,M,v,L),v.elementType=p,v.type=P,v.lanes=z,v}function bc(p,v,M,P){return p=vs(7,p,P,v),p.lanes=M,p}function mf(p,v,M,P){return p=vs(22,p,P,v),p.elementType=C,p.lanes=M,p.stateNode={},p}function Xp(p,v,M){return p=vs(6,p,null,v),p.lanes=M,p}function qp(p,v,M){return v=vs(4,p.children!==null?p.children:[],p.key,v),v.lanes=M,v.stateNode={containerInfo:p.containerInfo,pendingChildren:null,implementation:p.implementation},v}function Kp(p,v,M,P,L){this.tag=v,this.containerInfo=p,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Me,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sp(0),this.expirationTimes=sp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sp(0),this.identifierPrefix=P,this.onRecoverableError=L,Z&&(this.mutableSourceEagerHydrationData=null)}function Bx(p,v,M,P,L,z,ie,ye,ze){return p=new Kp(p,v,M,ye,ze),v===1?(v=1,z===!0&&(v|=8)):v=0,z=vs(3,null,null,v),p.current=z,z.stateNode=p,z.memoizedState={element:P,isDehydrated:M,cache:null,transitions:null},gu(z),p}function Hx(p){if(!p)return vt;p=p._reactInternals;e:{if(G(p)!==p||p.tag!==1)throw Error(o(170));var v=p;do{switch(v.tag){case 3:v=v.stateNode.context;break e;case 1:if(kn(v.type)){v=v.stateNode.__reactInternalMemoizedMergedChildContext;break e}}v=v.return}while(v!==null);throw Error(o(171))}if(p.tag===1){var M=p.type;if(kn(M))return to(p,M,v)}return v}function Vx(p){var v=p._reactInternals;if(v===void 0)throw typeof p.render=="function"?Error(o(188)):(p=Object.keys(p).join(","),Error(o(268,p)));return p=H(v),p===null?null:p.stateNode}function Bs(p,v){if(p=p.memoizedState,p!==null&&p.dehydrated!==null){var M=p.retryLane;p.retryLane=M!==0&&M=st&&z>=rn&&L<=Mt&&ie<=Ht){p.splice(v,1);break}else if(P!==st||M.width!==ze.width||Htie){if(!(z!==rn||M.height!==ze.height||MtL)){st>P&&(ze.width+=st-P,ze.x=P),Mtz&&(ze.height+=rn-z,ze.y=z),HtM&&(M=ie)),ie ")+` No matching component was found for: - `)+p.join(" > ")}return null},n.getPublicRootInstance=function(p){if(p=p.current,!p.child)return null;switch(p.child.tag){case 5:return oe(p.child.stateNode);default:return p.child.stateNode}},n.injectIntoDevTools=function(p){if(p={bundleType:p.bundleType,version:p.version,rendererPackageName:p.rendererPackageName,rendererConfig:p.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:Yp,findFiberByHostInstance:p.findFiberByHostInstance||Hx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")p=!1;else{var v=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(v.isDisabled||!v.supportsFiber)p=!0;else{try{jd=v.inject(p),Po=v}catch{}p=!!v.checkDCE}}return p},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(p,v,M,P){if(!ee)throw Error(o(363));p=ba(p,v);var L=nt(p,M,P).disconnect;return{disconnect:function(){L()}}},n.registerMutableSourceForHydration=function(p,v){var M=v._getVersion;M=M(v._source),p.mutableSourceEagerHydrationData==null?p.mutableSourceEagerHydrationData=[v,M]:p.mutableSourceEagerHydrationData.push(v,M)},n.runWithPriority=function(p,v){var M=dn;try{return dn=p,v()}finally{dn=M}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(p,v,M,P){var L=v.current,z=Rn(),ie=co(L);return M=zx(M),v.context===null?v.context=M:v.pendingContext=M,v=la(z,ie),v.payload={element:p},P=P===void 0?null:P,P!==null&&(v.callback=P),Ja(L,v),p=fi(L,ie,z),p!==null&&hp(p,L,ie),ie},n}),BA}var Mj;function rbe(){return Mj||(Mj=1,UA.exports=nbe()),UA.exports}var ibe=rbe();const sbe=H1(ibe);var HA={exports:{}},VA={};/** + `)+p.join(" > ")}return null},n.getPublicRootInstance=function(p){if(p=p.current,!p.child)return null;switch(p.child.tag){case 5:return se(p.child.stateNode);default:return p.child.stateNode}},n.injectIntoDevTools=function(p){if(p={bundleType:p.bundleType,version:p.version,rendererPackageName:p.rendererPackageName,rendererConfig:p.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:Yp,findFiberByHostInstance:p.findFiberByHostInstance||Gx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")p=!1;else{var v=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(v.isDisabled||!v.supportsFiber)p=!0;else{try{jd=v.inject(p),Po=v}catch{}p=!!v.checkDCE}}return p},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(p,v,M,P){if(!ee)throw Error(o(363));p=ba(p,v);var L=rt(p,M,P).disconnect;return{disconnect:function(){L()}}},n.registerMutableSourceForHydration=function(p,v){var M=v._getVersion;M=M(v._source),p.mutableSourceEagerHydrationData==null?p.mutableSourceEagerHydrationData=[v,M]:p.mutableSourceEagerHydrationData.push(v,M)},n.runWithPriority=function(p,v){var M=dn;try{return dn=p,v()}finally{dn=M}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(p,v,M,P){var L=v.current,z=Rn(),ie=co(L);return M=Hx(M),v.context===null?v.context=M:v.pendingContext=M,v=la(z,ie),v.payload={element:p},P=P===void 0?null:P,P!==null&&(v.callback=P),Ja(L,v),p=fi(L,ie,z),p!==null&&hp(p,L,ie),ie},n}),HA}var Ej;function ibe(){return Ej||(Ej=1,FA.exports=rbe()),FA.exports}var sbe=ibe();const obe=V1(sbe);var VA={exports:{}},GA={};/** * @license React * scheduler.production.min.js * @@ -4461,14 +4466,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 Ej;function obe(){return Ej||(Ej=1,(function(t){function e(B,q){var K=B.length;B.push(q);e:for(;0>>1,Z=B[$];if(0>>1;$i(ue,K))_ei(Se,ue)?(B[$]=Se,B[_e]=K,$=_e):(B[$]=ue,B[le]=K,$=le);else if(_ei(Se,K))B[$]=Se,B[_e]=K,$=_e;else break e}}return q}function i(B,q){var K=B.sortIndex-q.sortIndex;return K!==0?K:B.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var q=n(c);q!==null;){if(q.callback===null)r(c);else if(q.startTime<=B)r(c),q.sortIndex=q.expirationTime,e(l,q);else break;q=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,oe(O);else{var q=n(c);q!==null&&fe(C,q.startTime-B)}}function O(B,q){x=!1,S&&(S=!1,_(F),F=-1),y=!0;var K=m;try{for(T(q),f=n(l);f!==null&&(!(f.expirationTime>q)||B&&!U());){var $=f.callback;if(typeof $=="function"){f.callback=null,m=f.priorityLevel;var Z=$(f.expirationTime<=q);q=t.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),T(q)}else r(l);f=n(l)}if(f!==null)var ge=!0;else{var le=n(c);le!==null&&fe(C,le.startTime-q),ge=!1}return ge}finally{f=null,m=K,y=!1}}var N=!1,D=null,F=-1,V=5,k=-1;function U(){return!(t.unstable_now()-kB||125$?(B.sortIndex=K,e(c,B),n(l)===null&&B===n(c)&&(S?(_(F),F=-1):S=!0,fe(C,K-$))):(B.sortIndex=Z,e(l,B),x||y||(x=!0,oe(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var q=m;return function(){var K=m;m=q;try{return B.apply(this,arguments)}finally{m=K}}}})(VA)),VA}var Aj;function abe(){return Aj||(Aj=1,HA.exports=obe()),HA.exports}var Tj=abe();const rN={},lbe=t=>void Object.assign(rN,t);function cbe(t,e){function n(d,{args:f=[],attach:m,...y},x){let S=`${d[0].toUpperCase()}${d.slice(1)}`,w;if(d==="primitive"){if(y.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const _=y.object;w=Fm(_,{type:d,root:x,attach:m,primitive:!0})}else{const _=rN[S];if(!_)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 _(...f),{type:d,root:x,attach:m,memoizedProps:{args:f}})}return w.__r3f.attach===void 0&&(w.isBufferGeometry?w.__r3f.attach="geometry":w.isMaterial&&(w.__r3f.attach="material")),S!=="inject"&&$A(w,y),w}function r(d,f){let m=!1;if(f){var y,x;(y=f.__r3f)!=null&&y.attach?WA(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),m=!0),m||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,sP(f),zm(f)}}function i(d,f,m){let y=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)WA(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(E=>E!==f),_=w.indexOf(m);d.children=[...w.slice(0,_),f,...w.slice(_)],y=!0}y||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,sP(f),zm(f)}}function s(d,f,m=!1){d&&[...d].forEach(y=>o(f,y,m))}function o(d,f,m){if(f){var y,x,S;if(f.__r3f&&(f.__r3f.parent=null),(y=d.__r3f)!=null&&y.objects&&(d.__r3f.objects=d.__r3f.objects.filter(C=>C!==f)),(x=f.__r3f)!=null&&x.attach)Ij(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var w;d.remove(f),(w=f.__r3f)!=null&&w.root&&gbe(q_(f),f)}const E=(S=f.__r3f)==null?void 0:S.primitive,T=!E&&(m===void 0?f.dispose!==null:m);if(!E){var _;s((_=f.__r3f)==null?void 0:_.objects,f,T),s(f.children,f,T)}if(delete f.__r3f,T&&f.dispose&&f.type!=="Scene"){const C=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?Tj.unstable_scheduleCallback(Tj.unstable_IdlePriority,C):C()}zm(d)}}function a(d,f,m,y){var x;const S=(x=d.__r3f)==null?void 0:x.parent;if(!S)return;const w=n(f,m,d.__r3f.root);if(d.children){for(const _ of d.children)_.__r3f&&r(w,_);d.children=d.children.filter(_=>!_.__r3f)}d.__r3f.objects.forEach(_=>r(w,_)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(S,d),w.parent&&(w.__r3f.autoRemovedBeforeAppend=!0),r(S,w),w.raycast&&w.__r3f.eventCount&&q_(w).getState().internal.interaction.push(w),[y,y.alternate].forEach(_=>{_!==null&&(_.stateNode=w,_.ref&&(typeof _.ref=="function"?_.ref(w):_.ref.current=w))})}const l=()=>{};return{reconciler:sbe({createInstance:n,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const m=d.getState().scene;m.__r3f&&(m.__r3f.root=d,r(m,f))},removeChildFromContainer:(d,f)=>{f&&o(d.getState().scene,f)},insertInContainerBefore:(d,f,m)=>{if(!f||!m)return;const y=d.getState().scene;y.__r3f&&i(y,f,m)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,m,y){var x;if(((x=d==null?void 0:d.__r3f)!=null?x:{}).primitive&&y.object&&y.object!==d)return[!0];{const{args:w=[],children:_,...E}=y,{args:T=[],children:C,...O}=m;if(!Array.isArray(w))throw new Error("R3F: the args prop must be an array!");if(w.some((D,F)=>D!==T[F]))return[!0];const N=pG(d,E,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,m],y,x,S,w){f?a(d,y,S,w):$A(d,m)},commitMount(d,f,m,y){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&q_(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:m,parent:y}=(f=d.__r3f)!=null?f:{};m&&y&&Ij(y,d,m),d.isObject3D&&(d.visible=!1),zm(d)},unhideInstance(d,f){var m;const{attach:y,parent:x}=(m=d.__r3f)!=null?m:{};y&&x&&WA(x,d,y),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),zm(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Ym.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&ir.fun(performance.now)?performance.now:ir.fun(Date.now)?Date.now:()=>0,scheduleTimeout:ir.fun(setTimeout)?setTimeout:void 0,cancelTimeout:ir.fun(clearTimeout)?clearTimeout:void 0}),applyProps:$A}}var Cj,Pj;const GA=t=>"colorSpace"in t||"outputColorSpace"in t,lG=()=>{var t;return(t=rN.ColorManagement)!=null?t:null},cG=t=>t&&t.isOrthographicCamera,ube=t=>t&&t.hasOwnProperty("current"),gx=typeof window<"u"&&((Cj=window.document)!=null&&Cj.createElement||((Pj=window.navigator)==null?void 0:Pj.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function uG(t){const e=R.useRef(t);return gx(()=>void(e.current=t),[t]),e}function dbe({set:t}){return gx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class dG 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}}dG.getDerivedStateFromError=()=>({error:!0});const fG="__default",Rj=new Map,fbe=t=>t&&!!t.memoized&&!!t.changes;function hG(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 P0=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function q_(t){let e=t.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const ir={obj:t=>t===Object(t)&&!ir.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(ir.str(t)||ir.num(t)||ir.boo(t))return t===e;const s=ir.obj(t);if(s&&r==="reference")return t===e;const o=ir.arr(t);if(o&&n==="reference")return t===e;if((o||s)&&t===e)return!0;let a;for(a in t)if(!(a in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(a in i?e:t)if(!ir.equ(t[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:t)if(t[a]!==e[a])return!1;if(ir.und(a)){if(o&&t.length===0&&e.length===0||s&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function hbe(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 iP(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((s,o)=>s[o],t),{target:n,key:i}}else return{target:n,key:e}}const Nj=/-\d+$/;function WA(t,e,n){if(ir.str(n)){if(Nj.test(n)){const s=n.replace(Nj,""),{target:o,key:a}=iP(t,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=iP(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function Ij(t,e,n){var r,i;if(ir.str(n)){const{target:s,key:o}=iP(t,n),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function pG(t,{children:e,key:n,ref:r,...i},{children:s,key:o,ref:a,...l}={},c=!1){const d=t.__r3f,f=Object.entries(i),m=[];if(c){const x=Object.keys(l);for(let S=0;S{var w;if((w=t.__r3f)!=null&&w.primitive&&x==="object"||ir.equ(S,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,S,!0,[]]);let _=[];x.includes("-")&&(_=x.split("-")),m.push([x,S,!1,_]);for(const E in i){const T=i[E];E.startsWith(`${x}-`)&&m.push([E,T,!1,E.split("-")])}});const y={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(y.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(y.attach=d.memoizedProps.attach),{memoized:y,changes:m}}function $A(t,e){var n;const r=t.__r3f,i=r==null?void 0:r.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:a}=fbe(e)?e:pG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=o);for(let m=0;mT[C],t),!(E&&E.set))){const[T,...C]=w.reverse();_=C.reverse().reduce((O,N)=>O[N],t),y=T}if(x===fG+"remove")if(_.constructor){let T=Rj.get(_.constructor);T||(T=new _.constructor,Rj.set(_.constructor,T)),x=T[y]}else x=0;if(S&&r)x?r.handlers[y]=x:delete r.handlers[y],r.eventCount=Object.keys(r.handlers).length;else if(E&&E.set&&(E.copy||E instanceof Ah)){if(Array.isArray(x))E.fromArray?E.fromArray(x):E.set(...x);else if(E.copy&&x&&x.constructor&&E.constructor===x.constructor)E.copy(x);else if(x!==void 0){var c;const T=(c=E)==null?void 0:c.isColor;!T&&E.setScalar?E.setScalar(x):E instanceof Ah&&x instanceof Ah?E.mask=x.mask:E.set(x),!lG()&&s&&!s.linear&&T&&E.convertSRGBToLinear()}}else{var d;if(_[y]=x,(d=_[y])!=null&&d.isTexture&&_[y].format===is&&_[y].type===Ha&&s){const T=_[y];GA(T)&&GA(s.gl)?T.colorSpace=s.gl.outputColorSpace:T.encoding=s.gl.outputEncoding}}zm(t)}if(r&&r.parent&&t.raycast&&l!==r.eventCount){const m=q_(t).getState().internal,y=m.interaction.indexOf(t);y>-1&&m.interaction.splice(y,1),r.eventCount&&m.interaction.push(t)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(n=t.__r3f)!=null&&n.parent&&sP(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 sP(t){t.onUpdate==null||t.onUpdate(t)}function pbe(t,e){t.manual||(cG(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 C_(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function mbe(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Ym.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Ym.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Ym.ContinuousEventPriority;default:return Ym.DefaultEventPriority}}function mG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function gbe(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)=>{mG(n.capturedMap,e,r,i)})}function vbe(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],f=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+f*f))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var f;return(f=c.__r3f)==null?void 0:f.handlers["onPointer"+d]}))}function r(l,c){const d=t.getState(),f=new Set,m=[],y=c?c(d.internal.interaction):d.internal.interaction;for(let _=0;_{const T=P0(_.object),C=P0(E.object);return!T||!C?_.distance-E.distance:C.events.priority-T.events.priority||_.distance-E.distance}).filter(_=>{const E=C_(_);return f.has(E)?!1:(f.add(E),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const _ of S){let E=_.object;for(;E;){var w;(w=E.__r3f)!=null&&w.eventCount&&m.push({..._,eventObject:E}),E=E.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let _ of d.internal.capturedMap.get(l.pointerId).values())f.has(C_(_.intersection))||m.push(_.intersection);return m}function i(l,c,d,f){const m=t.getState();if(l.length){const y={stopped:!1};for(const x of l){const S=P0(x.object)||m,{raycaster:w,pointer:_,camera:E,internal:T}=S,C=new X(_.x,_.y,0).unproject(E),O=k=>{var U,H;return(U=(H=T.capturedMap.get(k))==null?void 0:H.has(x.eventObject))!=null?U:!1},N=k=>{const U={intersection:x,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(x.eventObject,U):T.capturedMap.set(k,new Map([[x.eventObject,U]])),c.target.setPointerCapture(k)},D=k=>{const U=T.capturedMap.get(k);U&&mG(T.capturedMap,x.eventObject,U,k)};let F={};for(let k in c){let U=c[k];typeof U!="function"&&(F[k]=U)}let V={...x,...F,pointer:_,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:C,ray:w.ray,camera:E,stopPropagation(){const k="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!k||k.has(x.eventObject))&&(V.stopped=y.stopped=!0,T.hovered.size&&Array.from(T.hovered.values()).find(U=>U.eventObject===x.eventObject))){const U=l.slice(0,l.indexOf(x));s([...U,x])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture: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 m=d.eventObject.__r3f,y=m==null?void 0:m.handlers;if(c.hovered.delete(C_(d)),m!=null&&m.eventCount){const x={...d,intersections:l};y.onPointerOut==null||y.onPointerOut(x),y.onPointerLeave==null||y.onPointerLeave(x)}}}function o(l,c){for(let d=0;ds([]);case"onLostPointerCapture":return c=>{const{internal:d}=t.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:f,internal:m}=t.getState();m.lastEvent.current=d;const y=l==="onPointerMove",x=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",w=r(d,y?n:void 0),_=x?e(d):0;l==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=w.map(T=>T.eventObject)),x&&!w.length&&_<=2&&(o(d,m.interaction),f&&f(d)),y&&s(w);function E(T){const C=T.eventObject,O=C.__r3f,N=O==null?void 0:O.handlers;if(O!=null&&O.eventCount)if(y){if(N.onPointerOver||N.onPointerEnter||N.onPointerOut||N.onPointerLeave){const D=C_(T),F=m.hovered.get(D);F?F.stopped&&T.stopPropagation():(m.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?(!x||m.initialHits.includes(C))&&(o(d,m.interaction.filter(F=>!m.initialHits.includes(F))),D(T)):x&&m.initialHits.includes(C)&&o(d,m.interaction.filter(F=>!m.initialHits.includes(F)))}}i(w,d,_,E)}}return{handlePointer:a}}const gG=t=>!!(t!=null&&t.render),vG=R.createContext(null),ybe=(t,e)=>{const n=Jxe((a,l)=>{const c=new X,d=new X,f=new X;function m(_=l().camera,E=d,T=l().size){const{width:C,height:O,top:N,left:D}=T,F=C/O;E.isVector3?f.copy(E):f.set(...E);const V=_.getWorldPosition(c).distanceTo(f);if(cG(_))return{width:C/_.zoom,height:O/_.zoom,top:N,left:D,factor:1,distance:V,aspect:F};{const k=_.fov*Math.PI/180,U=2*Math.tan(k/2)*V,H=U*(C/O);return{width:H,height:U,top:N,left:D,factor:C/H,distance:V,aspect:F}}}let y;const x=_=>a(E=>({performance:{...E.performance,current:_}})),S=new Ve;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(_=1)=>t(l(),_),advance:(_,E)=>e(_,E,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 _=l();y&&clearTimeout(y),_.performance.current!==_.performance.min&&x(_.performance.min),y=setTimeout(()=>x(l().performance.max),_.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:_=>a(E=>({...E,events:{...E.events,..._}})),setSize:(_,E,T,C,O)=>{const N=l().camera,D={width:_,height:E,top:C||0,left:O||0,updateStyle:T};a(F=>({size:D,viewport:{...F.viewport,...m(N,d,D)}}))},setDpr:_=>a(E=>{const T=hG(_);return{viewport:{...E.viewport,dpr:T,initialDpr:E.viewport.initialDpr||T}}}),setFrameloop:(_="always")=>{const E=l().clock;E.stop(),E.elapsedTime=0,_!=="never"&&(E.start(),E.elapsedTime=0),a(()=>({frameloop:_}))},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:(_,E,T)=>{const C=l().internal;return C.priority=C.priority+(E>0?1:0),C.subscribers.push({ref:_,priority:E,store:T}),C.subscribers=C.subscribers.sort((O,N)=>O.priority-N.priority),()=>{const O=l().internal;O!=null&&O.subscribers&&(O.priority=O.priority-(E>0?1:0),O.subscribers=O.subscribers.filter(N=>N.ref!==_))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return n.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:d,set:f}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){var m;i=l,s=c.dpr,pbe(a,l),d.setPixelRatio(c.dpr);const y=(m=l.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,y)}a!==o&&(o=a,f(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};let P_,xbe=new Set,bbe=new Set,_be=new Set;function XA(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function R0(t,e){switch(t){case"before":return XA(xbe,e);case"after":return XA(bbe,e);case"tail":return XA(_be,e)}}let qA,KA;function YA(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),qA=e.internal.subscribers,P_=0;P_0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(r+=YA(c,s))}if(n=!1,R0("after",c),r===0)return R0("tail",c),e=!1,cancelAnimationFrame(i)}function a(c,d=1){var f;if(!c)return t.forEach(m=>a(m.store.getState(),d));(f=c.gl.xr)!=null&&f.isPresenting||!c.internal.active||c.frameloop==="never"||(d>1?c.internal.frames=Math.min(60,c.internal.frames+d):n?c.internal.frames=2:c.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(c,d=!0,f,m){if(d&&R0("before",c),f)YA(c,f,m);else for(const y of t.values())YA(c,y.store.getState());d&&R0("after",c)}return{loop:o,invalidate:a,advance:l}}function yG(){const t=R.useContext(vG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function nd(t=n=>n,e){return yG()(t,e)}function xG(t,e=0){const n=yG(),r=n.getState().internal.subscribe,i=uG(t);return gx(()=>r(i,e,n),[e,r,n]),null}const Bg=new Map,{invalidate:kj,advance:Oj}=wbe(Bg),{reconciler:j1,applyProps:Nm}=cbe(Bg,mbe),Im={objects:"shallow",strict:!1},Sbe=(t,e)=>{const n=typeof t=="function"?t(e):t;return gG(n)?n:new y6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Mbe(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:o,updateStyle:a=n}=e;return{width:r,height:i,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:s,left:o}=t.parentElement.getBoundingClientRect();return{width:r,height:i,top:s,left:o,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function Ebe(t){const e=Bg.get(t),n=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||ybe(kj,Oj),o=n||j1.createContainer(s,Ym.ConcurrentRoot,null,!1,null,"",i,null);e||Bg.set(t,{fiber:o,store:s});let a,l=!1,c;return{configure(d={}){let{gl:f,size:m,scene:y,events:x,onCreated:S,shadows:w=!1,linear:_=!1,flat:E=!1,legacy:T=!1,orthographic:C=!1,frameloop:O="always",dpr:N=[1,2],performance:D,raycaster:F,camera:V,onPointerMissed:k}=d,U=s.getState(),H=U.gl;U.gl||U.set({gl:H=Sbe(f,t)});let ne=U.raycaster;ne||U.set({raycaster:ne=new sG});const{params:te,...he}=F||{};if(ir.equ(he,ne,Im)||Nm(ne,{...he}),ir.equ(te,ne.params,Im)||Nm(ne,{params:{...ne.params,...te}}),!U.camera||U.camera===c&&!ir.equ(c,V,Im)){c=V;const K=V instanceof cx,$=K?V:C?new Xc(0,0,0,0,.1,1e3):new Tr(75,0,.1,1e3);K||($.position.z=5,V&&(Nm($,V),("aspect"in V||"left"in V||"right"in V||"bottom"in V||"top"in V)&&($.manual=!0,$.updateProjectionMatrix())),!U.camera&&!(V!=null&&V.rotation)&&$.lookAt(0,0,0)),U.set({camera:$}),ne.camera=$}if(!U.scene){let K;y!=null&&y.isScene?K=y:(K=new IR,y&&Nm(K,y)),U.set({scene:Fm(K)})}if(!U.xr){var oe;const K=(ge,le)=>{const ue=s.getState();ue.frameloop!=="never"&&Oj(ge,!0,ue,le)},$=()=>{const ge=s.getState();ge.gl.xr.enabled=ge.gl.xr.isPresenting,ge.gl.xr.setAnimationLoop(ge.gl.xr.isPresenting?K:null),ge.gl.xr.isPresenting||kj(ge)},Z={connect(){const ge=s.getState().gl;ge.xr.addEventListener("sessionstart",$),ge.xr.addEventListener("sessionend",$)},disconnect(){const ge=s.getState().gl;ge.xr.removeEventListener("sessionstart",$),ge.xr.removeEventListener("sessionend",$)}};typeof((oe=H.xr)==null?void 0:oe.addEventListener)=="function"&&Z.connect(),U.set({xr:Z})}if(H.shadowMap){const K=H.shadowMap.enabled,$=H.shadowMap.type;if(H.shadowMap.enabled=!!w,ir.boo(w))H.shadowMap.type=X0;else if(ir.str(w)){var fe;const Z={basic:pV,percentage:BS,soft:X0,variance:Oa};H.shadowMap.type=(fe=Z[w])!=null?fe:X0}else ir.obj(w)&&Object.assign(H.shadowMap,w);(K!==H.shadowMap.enabled||$!==H.shadowMap.type)&&(H.shadowMap.needsUpdate=!0)}const B=lG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Nm(H,{outputEncoding:_?3e3:3001,toneMapping:E?Pl:uR}),U.legacy!==T&&U.set(()=>({legacy:T})),U.linear!==_&&U.set(()=>({linear:_})),U.flat!==E&&U.set(()=>({flat:E})),f&&!ir.fun(f)&&!gG(f)&&!ir.equ(f,H,Im)&&Nm(H,f),x&&!U.events.handlers&&U.set({events:x(s)});const q=Mbe(t,m);return ir.equ(q,U.size,Im)||U.setSize(q.width,q.height,q.updateStyle,q.top,q.left),N&&U.viewport.dpr!==hG(N)&&U.setDpr(N),U.frameloop!==O&&U.setFrameloop(O),U.onPointerMissed||U.set({onPointerMissed:k}),D&&!ir.equ(D,U.performance,Im)&&U.set(K=>({performance:{...K.performance,...D}})),a=S,l=!0,this},render(d){return l||this.configure(),j1.updateContainer(g.jsx(Abe,{store:s,children:d,onCreated:a,rootElement:t}),o,null,()=>{}),s},unmount(){bG(t)}}}function Abe({store:t,children:e,onCreated:n,rootElement:r}){return gx(()=>{const i=t.getState();i.set(s=>({internal:{...s.internal,active:!0}})),n&&n(i),t.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),g.jsx(vG.Provider,{value:t,children:e})}function bG(t,e){const n=Bg.get(t),r=n==null?void 0:n.fiber;if(r){const i=n==null?void 0:n.store.getState();i&&(i.internal.active=!1),j1.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),hbe(i),Bg.delete(t)}catch{}},500)})}}j1.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:R.version});const ZA={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 Tbe(t){const{handlePointer:e}=vbe(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(ZA).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{var r;const{set:i,events:s}=t.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:n}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([o,a])=>{const[l,c]=ZA[o];n.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,o])=>{if(r&&r.connected instanceof HTMLElement){const[a]=ZA[s];r.connected.removeEventListener(a,o)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function Lj(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function Cbe({debounce:t,scroll:e,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=R.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=R.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=R.useRef(!1);R.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,m,y]=R.useMemo(()=>{const _=()=>{if(!a.current.element)return;const{left:E,top:T,width:C,height:O,bottom:N,right:D,x:F,y:V}=a.current.element.getBoundingClientRect(),k={left:E,top:T,width:C,height:O,bottom:N,right:D,x:F,y:V};a.current.element instanceof HTMLElement&&r&&(k.height=a.current.element.offsetHeight,k.width=a.current.element.offsetWidth),Object.freeze(k),d.current&&!Ibe(a.current.lastBounds,k)&&o(a.current.lastBounds=k)};return[_,c?Lj(_,c):_,l?Lj(_,l):_]},[o,r,l,c]);function x(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",y,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function S(){a.current.element&&(a.current.resizeObserver=new i(y),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(_=>_.addEventListener("scroll",y,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const w=_=>{!_||_===a.current.element||(x(),a.current.element=_,a.current.scrollContainers=_G(_),S())};return Rbe(y,!!e),Pbe(m),R.useEffect(()=>{x(),S()},[e,y,m]),R.useEffect(()=>x,[]),[w,s,f]}function Pbe(t){R.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function Rbe(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 _G(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,..._G(t.parentElement)]}const Nbe=["x","y","top","bottom","left","right","width","height"],Ibe=(t,e)=>Nbe.every(n=>t[n]===e[n]);var kbe=Object.defineProperty,Obe=Object.defineProperties,Lbe=Object.getOwnPropertyDescriptors,Dj=Object.getOwnPropertySymbols,Dbe=Object.prototype.hasOwnProperty,jbe=Object.prototype.propertyIsEnumerable,jj=(t,e,n)=>e in t?kbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Uj=(t,e)=>{for(var n in e||(e={}))Dbe.call(e,n)&&jj(t,n,e[n]);if(Dj)for(var n of Dj(e))jbe.call(e,n)&&jj(t,n,e[n]);return t},Ube=(t,e)=>Obe(t,Lbe(e)),Fj,zj;typeof window<"u"&&((Fj=window.document)!=null&&Fj.createElement||((zj=window.navigator)==null?void 0:zj.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function wG(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=wG(r,e,n);if(i)return i;r=r.sibling}}function SG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const Bj=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=Bj;return}return Bj.apply(this,arguments)};const iN=SG(R.createContext(null));class MG extends R.Component{render(){return R.createElement(iN.Provider,{value:this._reactInternals},this.props.children)}}function Fbe(){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=wG(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[t,e])}function zbe(){const t=Fbe(),[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(SG(i)))}n=n.return}return e}function Bbe(){const t=zbe();return R.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>R.createElement(e,null,R.createElement(n.Provider,Ube(Uj({},r),{value:t.get(n)}))),e=>R.createElement(MG,Uj({},e))),[t])}const Hbe=R.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:o=Tbe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:_,camera:E,scene:T,onPointerMissed:C,onCreated:O,...N},D){R.useMemo(()=>lbe(qxe),[]);const F=Bbe(),[V,k]=Cbe({scroll:!0,debounce:{scroll:50,resize:0},...r}),U=R.useRef(null),H=R.useRef(null);R.useImperativeHandle(D,()=>U.current);const ne=uG(C),[te,he]=R.useState(!1),[oe,fe]=R.useState(!1);if(te)throw te;if(oe)throw oe;const B=R.useRef(null);gx(()=>{const K=U.current;k.width>0&&k.height>0&&K&&(B.current||(B.current=Ebe(K)),B.current.configure({gl:s,events:o,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:_,camera:E,scene:T,size:k,onPointerMissed:(...$)=>ne.current==null?void 0:ne.current(...$),onCreated:$=>{$.events.connect==null||$.events.connect(a?ube(a)?a.current:a:H.current),l&&$.setEvents({compute:(Z,ge)=>{const le=Z[l+"X"],ue=Z[l+"Y"];ge.pointer.set(le/ge.size.width*2-1,-(ue/ge.size.height)*2+1),ge.raycaster.setFromCamera(ge.pointer,ge.camera)}}),O==null||O($)}}),B.current.render(g.jsx(F,{children:g.jsx(dG,{set:fe,children:g.jsx(R.Suspense,{fallback:g.jsx(dbe,{set:he}),children:e??null})})})))}),R.useEffect(()=>{const K=U.current;if(K)return()=>bG(K)},[]);const q=a?"none":"auto";return g.jsx("div",{ref:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:q,...i},...N,children:g.jsx("div",{ref:V,style:{width:"100%",height:"100%"},children:g.jsx("canvas",{ref:U,style:{display:"block"},children:n})})})}),Vbe=R.forwardRef(function(e,n){return g.jsx(MG,{children:g.jsx(Hbe,{...e,ref:n})})});function oP(){return oP=Object.assign?Object.assign.bind():function(t){for(var e=1;ee in t?Gbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$be=(t,e,n)=>(Wbe(t,e+"",n),n);class Xbe{constructor(){$be(this,"_listeners")}addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;se in t?qbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Xt=(t,e,n)=>(Kbe(t,typeof e!="symbol"?e+"":e,n),n);const R_=new Jh,Hj=new kc,Ybe=Math.cos(70*(Math.PI/180)),Vj=(t,e)=>(t%e+e)%e;let Zbe=class extends Xbe{constructor(e,n){super(),Xt(this,"object"),Xt(this,"domElement"),Xt(this,"enabled",!0),Xt(this,"target",new X),Xt(this,"minDistance",0),Xt(this,"maxDistance",1/0),Xt(this,"minZoom",0),Xt(this,"maxZoom",1/0),Xt(this,"minPolarAngle",0),Xt(this,"maxPolarAngle",Math.PI),Xt(this,"minAzimuthAngle",-1/0),Xt(this,"maxAzimuthAngle",1/0),Xt(this,"enableDamping",!1),Xt(this,"dampingFactor",.05),Xt(this,"enableZoom",!0),Xt(this,"zoomSpeed",1),Xt(this,"enableRotate",!0),Xt(this,"rotateSpeed",1),Xt(this,"enablePan",!0),Xt(this,"panSpeed",1),Xt(this,"screenSpacePanning",!0),Xt(this,"keyPanSpeed",7),Xt(this,"zoomToCursor",!1),Xt(this,"autoRotate",!1),Xt(this,"autoRotateSpeed",2),Xt(this,"reverseOrbit",!1),Xt(this,"reverseHorizontalOrbit",!1),Xt(this,"reverseVerticalOrbit",!1),Xt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Xt(this,"mouseButtons",{LEFT:Xf.ROTATE,MIDDLE:Xf.DOLLY,RIGHT:Xf.PAN}),Xt(this,"touches",{ONE:qf.ROTATE,TWO:qf.DOLLY_PAN}),Xt(this,"target0"),Xt(this,"position0"),Xt(this,"zoom0"),Xt(this,"_domElementKeyEvents",null),Xt(this,"getPolarAngle"),Xt(this,"getAzimuthalAngle"),Xt(this,"setPolarAngle"),Xt(this,"setAzimuthalAngle"),Xt(this,"getDistance"),Xt(this,"getZoomScale"),Xt(this,"listenToKeyEvents"),Xt(this,"stopListenToKeyEvents"),Xt(this,"saveState"),Xt(this,"reset"),Xt(this,"update"),Xt(this,"connect"),Xt(this,"dispose"),Xt(this,"dollyIn"),Xt(this,"dollyOut"),Xt(this,"getScale"),Xt(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=J=>{let Ae=Vj(J,2*Math.PI),re=d.phi;re<0&&(re+=2*Math.PI),Ae<0&&(Ae+=2*Math.PI);let Ue=Math.abs(Ae-re);2*Math.PI-Ue{let Ae=Vj(J,2*Math.PI),re=d.theta;re<0&&(re+=2*Math.PI),Ae<0&&(Ae+=2*Math.PI);let Ue=Math.abs(Ae-re);2*Math.PI-Uer.object.position.distanceTo(r.target),this.listenToKeyEvents=J=>{J.addEventListener("keydown",se),this._domElementKeyEvents=J},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",se),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=a.NONE},this.update=(()=>{const J=new X,Ae=new X(0,1,0),re=new Kt().setFromUnitVectors(e.up,Ae),Ue=re.clone().invert(),Te=new X,Oe=new Kt,Ye=2*Math.PI;return function(){const Yt=r.object.position;re.setFromUnitVectors(e.up,Ae),Ue.copy(re).invert(),J.copy(Yt).sub(r.target),J.applyQuaternion(re),d.setFromVector3(J),r.autoRotate&&l===a.NONE&&te(H()),r.enableDamping?(d.theta+=f.theta*r.dampingFactor,d.phi+=f.phi*r.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let un=r.minAzimuthAngle,Cn=r.maxAzimuthAngle;isFinite(un)&&isFinite(Cn)&&(un<-Math.PI?un+=Ye:un>Math.PI&&(un-=Ye),Cn<-Math.PI?Cn+=Ye:Cn>Math.PI&&(Cn-=Ye),un<=Cn?d.theta=Math.max(un,Math.min(Cn,d.theta)):d.theta=d.theta>(un+Cn)/2?Math.max(un,d.theta):Math.min(Cn,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=ge(d.radius):d.radius=ge(d.radius*m),J.setFromSpherical(d),J.applyQuaternion(Ue),Yt.copy(r.target).add(J),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 Tr&&r.object.isPerspectiveCamera){const hr=J.length();Hn=ge(hr*m);const Si=hr-Hn;r.object.position.addScaledVector(D,Si),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const hr=new X(F.x,F.y,0);hr.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix(),en=!0;const Si=new X(F.x,F.y,0);Si.unproject(r.object),r.object.position.sub(Si).add(hr),r.object.updateMatrixWorld(),Hn=J.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):(R_.origin.copy(r.object.position),R_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(R_.direction))c||8*(1-Oe.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Te.copy(r.object.position),Oe.copy(r.object.quaternion),en=!1,!0):!1}})(),this.connect=J=>{r.domElement=J,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",ut),r.domElement.addEventListener("pointerdown",Ee),r.domElement.addEventListener("pointercancel",He),r.domElement.addEventListener("wheel",nt)},this.dispose=()=>{var J,Ae,re,Ue,Te,Oe;r.domElement&&(r.domElement.style.touchAction="auto"),(J=r.domElement)==null||J.removeEventListener("contextmenu",ut),(Ae=r.domElement)==null||Ae.removeEventListener("pointerdown",Ee),(re=r.domElement)==null||re.removeEventListener("pointercancel",He),(Ue=r.domElement)==null||Ue.removeEventListener("wheel",nt),(Te=r.domElement)==null||Te.ownerDocument.removeEventListener("pointermove",ze),(Oe=r.domElement)==null||Oe.ownerDocument.removeEventListener("pointerup",He),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",se)};const r=this,i={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,d=new rP,f=new rP;let m=1;const y=new X,x=new Ve,S=new Ve,w=new Ve,_=new Ve,E=new Ve,T=new Ve,C=new Ve,O=new Ve,N=new Ve,D=new X,F=new Ve;let V=!1;const k=[],U={};function H(){return 2*Math.PI/60/60*r.autoRotateSpeed}function ne(){return Math.pow(.95,r.zoomSpeed)}function te(J){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=J:f.theta-=J}function he(J){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=J:f.phi-=J}const oe=(()=>{const J=new X;return function(re,Ue){J.setFromMatrixColumn(Ue,0),J.multiplyScalar(-re),y.add(J)}})(),fe=(()=>{const J=new X;return function(re,Ue){r.screenSpacePanning===!0?J.setFromMatrixColumn(Ue,1):(J.setFromMatrixColumn(Ue,0),J.crossVectors(r.object.up,J)),J.multiplyScalar(re),y.add(J)}})(),B=(()=>{const J=new X;return function(re,Ue){const Te=r.domElement;if(Te&&r.object instanceof Tr&&r.object.isPerspectiveCamera){const Oe=r.object.position;J.copy(Oe).sub(r.target);let Ye=J.length();Ye*=Math.tan(r.object.fov/2*Math.PI/180),oe(2*re*Ye/Te.clientHeight,r.object.matrix),fe(2*Ue*Ye/Te.clientHeight,r.object.matrix)}else Te&&r.object instanceof Xc&&r.object.isOrthographicCamera?(oe(re*(r.object.right-r.object.left)/r.object.zoom/Te.clientWidth,r.object.matrix),fe(Ue*(r.object.top-r.object.bottom)/r.object.zoom/Te.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function q(J){r.object instanceof Tr&&r.object.isPerspectiveCamera||r.object instanceof Xc&&r.object.isOrthographicCamera?m=J:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function K(J){q(m/J)}function $(J){q(m*J)}function Z(J){if(!r.zoomToCursor||!r.domElement)return;V=!0;const Ae=r.domElement.getBoundingClientRect(),re=J.clientX-Ae.left,Ue=J.clientY-Ae.top,Te=Ae.width,Oe=Ae.height;F.x=re/Te*2-1,F.y=-(Ue/Oe)*2+1,D.set(F.x,F.y,1).unproject(r.object).sub(r.object.position).normalize()}function ge(J){return Math.max(r.minDistance,Math.min(r.maxDistance,J))}function le(J){x.set(J.clientX,J.clientY)}function ue(J){Z(J),C.set(J.clientX,J.clientY)}function _e(J){_.set(J.clientX,J.clientY)}function Se(J){S.set(J.clientX,J.clientY),w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Ae=r.domElement;Ae&&(te(2*Math.PI*w.x/Ae.clientHeight),he(2*Math.PI*w.y/Ae.clientHeight)),x.copy(S),r.update()}function qe(J){O.set(J.clientX,J.clientY),N.subVectors(O,C),N.y>0?K(ne()):N.y<0&&$(ne()),C.copy(O),r.update()}function Me(J){E.set(J.clientX,J.clientY),T.subVectors(E,_).multiplyScalar(r.panSpeed),B(T.x,T.y),_.copy(E),r.update()}function We(J){Z(J),J.deltaY<0?$(ne()):J.deltaY>0&&K(ne()),r.update()}function Ke(J){let Ae=!1;switch(J.code){case r.keys.UP:B(0,r.keyPanSpeed),Ae=!0;break;case r.keys.BOTTOM:B(0,-r.keyPanSpeed),Ae=!0;break;case r.keys.LEFT:B(r.keyPanSpeed,0),Ae=!0;break;case r.keys.RIGHT:B(-r.keyPanSpeed,0),Ae=!0;break}Ae&&(J.preventDefault(),r.update())}function ce(){if(k.length==1)x.set(k[0].pageX,k[0].pageY);else{const J=.5*(k[0].pageX+k[1].pageX),Ae=.5*(k[0].pageY+k[1].pageY);x.set(J,Ae)}}function Q(){if(k.length==1)_.set(k[0].pageX,k[0].pageY);else{const J=.5*(k[0].pageX+k[1].pageX),Ae=.5*(k[0].pageY+k[1].pageY);_.set(J,Ae)}}function Ge(){const J=k[0].pageX-k[1].pageX,Ae=k[0].pageY-k[1].pageY,re=Math.sqrt(J*J+Ae*Ae);C.set(0,re)}function De(){r.enableZoom&&Ge(),r.enablePan&&Q()}function Xe(){r.enableZoom&&Ge(),r.enableRotate&&ce()}function Je(J){if(k.length==1)S.set(J.pageX,J.pageY);else{const re=de(J),Ue=.5*(J.pageX+re.x),Te=.5*(J.pageY+re.y);S.set(Ue,Te)}w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Ae=r.domElement;Ae&&(te(2*Math.PI*w.x/Ae.clientHeight),he(2*Math.PI*w.y/Ae.clientHeight)),x.copy(S)}function bt(J){if(k.length==1)E.set(J.pageX,J.pageY);else{const Ae=de(J),re=.5*(J.pageX+Ae.x),Ue=.5*(J.pageY+Ae.y);E.set(re,Ue)}T.subVectors(E,_).multiplyScalar(r.panSpeed),B(T.x,T.y),_.copy(E)}function at(J){const Ae=de(J),re=J.pageX-Ae.x,Ue=J.pageY-Ae.y,Te=Math.sqrt(re*re+Ue*Ue);O.set(0,Te),N.set(0,Math.pow(O.y/C.y,r.zoomSpeed)),K(N.y),C.copy(O)}function ee(J){r.enableZoom&&at(J),r.enablePan&&bt(J)}function W(J){r.enableZoom&&at(J),r.enableRotate&&Je(J)}function Ee(J){var Ae,re;r.enabled!==!1&&(k.length===0&&((Ae=r.domElement)==null||Ae.ownerDocument.addEventListener("pointermove",ze),(re=r.domElement)==null||re.ownerDocument.addEventListener("pointerup",He)),Dt(J),J.pointerType==="touch"?rt(J):Be(J))}function ze(J){r.enabled!==!1&&(J.pointerType==="touch"?$e(J):pt(J))}function He(J){var Ae,re,Ue;Et(J),k.length===0&&((Ae=r.domElement)==null||Ae.releasePointerCapture(J.pointerId),(re=r.domElement)==null||re.ownerDocument.removeEventListener("pointermove",ze),(Ue=r.domElement)==null||Ue.ownerDocument.removeEventListener("pointerup",He)),r.dispatchEvent(o),l=a.NONE}function Be(J){let Ae;switch(J.button){case 0:Ae=r.mouseButtons.LEFT;break;case 1:Ae=r.mouseButtons.MIDDLE;break;case 2:Ae=r.mouseButtons.RIGHT;break;default:Ae=-1}switch(Ae){case Xf.DOLLY:if(r.enableZoom===!1)return;ue(J),l=a.DOLLY;break;case Xf.ROTATE:if(J.ctrlKey||J.metaKey||J.shiftKey){if(r.enablePan===!1)return;_e(J),l=a.PAN}else{if(r.enableRotate===!1)return;le(J),l=a.ROTATE}break;case Xf.PAN:if(J.ctrlKey||J.metaKey||J.shiftKey){if(r.enableRotate===!1)return;le(J),l=a.ROTATE}else{if(r.enablePan===!1)return;_e(J),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function pt(J){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;Se(J);break;case a.DOLLY:if(r.enableZoom===!1)return;qe(J);break;case a.PAN:if(r.enablePan===!1)return;Me(J);break}}function nt(J){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(J.preventDefault(),r.dispatchEvent(s),We(J),r.dispatchEvent(o))}function se(J){r.enabled===!1||r.enablePan===!1||Ke(J)}function rt(J){switch(mt(J),k.length){case 1:switch(r.touches.ONE){case qf.ROTATE:if(r.enableRotate===!1)return;ce(),l=a.TOUCH_ROTATE;break;case qf.PAN:if(r.enablePan===!1)return;Q(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case qf.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;De(),l=a.TOUCH_DOLLY_PAN;break;case qf.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Xe(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function $e(J){switch(mt(J),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Je(J),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;bt(J),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ee(J),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;W(J),r.update();break;default:l=a.NONE}}function ut(J){r.enabled!==!1&&J.preventDefault()}function Dt(J){k.push(J)}function Et(J){delete U[J.pointerId];for(let Ae=0;Ae{$(J),r.update()},this.dollyOut=(J=ne())=>{K(J),r.update()},this.getScale=()=>m,this.setScale=J=>{q(J),r.update()},this.getZoomScale=()=>ne(),n!==void 0&&this.connect(n),this.update()}};const Qbe=R.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},d)=>{const f=nd(N=>N.invalidate),m=nd(N=>N.camera),y=nd(N=>N.gl),x=nd(N=>N.events),S=nd(N=>N.setEvents),w=nd(N=>N.set),_=nd(N=>N.get),E=nd(N=>N.performance),T=e||m,C=r||x.connected||y.domElement,O=R.useMemo(()=>new Zbe(T),[T]);return xG(()=>{O.enabled&&O.update()},-1),R.useEffect(()=>(s&&O.connect(s===!0?C:s),O.connect(C),()=>void O.dispose()),[s,C,n,O,f]),R.useEffect(()=>{const N=V=>{f(),n&&E.regress(),o&&o(V)},D=V=>{a&&a(V)},F=V=>{l&&l(V)};return O.addEventListener("change",N),O.addEventListener("start",D),O.addEventListener("end",F),()=>{O.removeEventListener("start",D),O.removeEventListener("end",F),O.removeEventListener("change",N)}},[o,a,l,O,f,S]),R.useEffect(()=>{if(t){const N=_().controls;return w({controls:O}),()=>w({controls:N})}},[t,O]),R.createElement("primitive",oP({ref:d,object:O,enableDamping:i},c))});function Gj(t,e){if(e===WV)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===k1||e===_R){let n=t.getIndex();if(n===null){const o=[],a=t.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const c=new I_e(s,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function e_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 t_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,o)}}class m_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 o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class g_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 o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class v_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),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,f=i.byteStride,m=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,f,m,i.mode,i.filter).then(function(y){return y.buffer}):o.ready.then(function(){const y=new ArrayBuffer(d*f);return o.decodeGltfBuffer(new Uint8Array(y),d,f,m,i.mode,i.filter),y})})}else return null}}class y_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!==Ho.TRIANGLES&&c.mode!==Ho.TRIANGLE_STRIP&&c.mode!==Ho.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(l[c]=d,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),f=d.isGroup?d.children:[d],m=c[0].count,y=[];for(const x of f){const S=new Rt,w=new X,_=new Kt,E=new X(1,1,1),T=new OR(x.geometry,x.material,m);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const N_e=new Rt;class I_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new e_e,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new X6(this.options.manager):this.textureLoader=new tG(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ga(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return Ff(s,a,i),Nc(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=n.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,d]of o.children.entries())s(d,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r=2&&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=x}return w})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,o=n.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,n,r){const i=this,s=this.json,o=s.textures[e],a=s.images[n],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const m=(s.samplers||{})[o.sampler]||{};return d.magFilter=$j[m.magFilter]||Cr,d.minFilter=$j[m.minFilter]||qo,d.wrapS=Xj[m.wrapS]||Pd,d.wrapT=Xj[m.wrapT]||Pd,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,n){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(f){c=!0;const m=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(m),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(f){return new Promise(function(m,y){let x=m;n.isImageBitmapLoader===!0&&(x=function(S){const w=new dr(S);w.needsUpdate=!0,m(w)}),n.load(Md.resolveURL(f,s.path),x,void 0,y)})}).then(function(f){return c===!0&&a.revokeObjectURL(l),Nc(f,o),f.userData.mimeType=o.mimeType||R_e(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=d,d}assignTexture(e,n,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[vn.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[vn.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[vn.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[n]=o,o})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,o=n.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new iM,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new $r,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return mx}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[vn.KHR_MATERIALS_UNLIT]){const f=i[vn.KHR_MATERIALS_UNLIT];o=f.getMaterialType(),c.push(f.extendParams(a,s,n))}else{const f=s.pbrMetallicRoughness||{};if(a.color=new ct(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const m=f.baseColorFactor;a.color.setRGB(m[0],m[1],m[2],xi),a.opacity=m[3]}f.baseColorTexture!==void 0&&c.push(n.assignTexture(a,"map",f.baseColorTexture,Ui)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),o=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=xo);const d=s.alphaMode||JA.OPAQUE;if(d===JA.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===JA.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==As&&(c.push(n.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ve(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;a.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&o!==As&&(c.push(n.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==As){const f=s.emissiveFactor;a.emissive=new ct().setRGB(f[0],f[1],f[2],xi)}return s.emissiveTexture!==void 0&&o!==As&&c.push(n.assignTexture(a,"emissiveMap",s.emissiveTexture,Ui)),Promise.all(c).then(function(){const f=new o(a);return s.name&&(f.name=s.name),Nc(f,s),n.associations.set(f,{materials:e}),s.extensions&&Ff(i,f,s),f})}createUniqueName(e){const n=Nn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[vn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,n).then(function(l){return qj(l,a,n)})}const o=[];for(let a=0,l=e.length;a0&&C_e(_,s),_.name=n.createUniqueName(s.name||"mesh_"+e),Nc(_,s),w.extensions&&Ff(i,_,w),n.assignFinalMaterial(_),f.push(_)}for(let y=0,x=f.length;y1?d=new Ts:c.length===1?d=c[0]:d=new mn,d!==c[0])for(let f=0,m=c.length;f{const f=new Map;for(const[m,y]of i.associations)(m instanceof Gr||m instanceof dr)&&f.set(m,y);return d.traverse(m=>{const y=i.associations.get(m);y!=null&&f.set(m,y)}),f};return i.associations=c(s),s})}_createAnimationTracks(e,n,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];rd[s.path]===rd.weights?e.traverse(function(m){m.morphTargetInfluences&&l.push(m.name?m.name:m.uuid)}):l.push(a);let c;switch(rd[s.path]){case rd.weights:c=Hh;break;case rd.rotation:c=Vh;break;case rd.position:case rd.scale:c=Gh;break;default:switch(r.itemSize){case 1:c=Hh;break;case 2:case 3:default:c=Gh;break}break}const d=i.interpolation!==void 0?E_e[i.interpolation]:Dg,f=this._getArrayFromAccessor(r);for(let m=0,y=l.length;m>>1,q=B[V];if(0>>1;Vi(le,Y))bei(Se,le)?(B[V]=Se,B[be]=Y,V=be):(B[V]=le,B[ae]=Y,V=ae);else if(bei(Se,Y))B[V]=Se,B[be]=Y,V=be;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 o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,f=null,m=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var 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 C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,se(O);else{var J=n(c);J!==null&&fe(C,J.startTime-B)}}function O(B,J){x=!1,S&&(S=!1,_(F),F=-1),y=!0;var Y=m;try{for(T(J),f=n(l);f!==null&&(!(f.expirationTime>J)||B&&!U());){var V=f.callback;if(typeof V=="function"){f.callback=null,m=f.priorityLevel;var q=V(f.expirationTime<=J);J=t.unstable_now(),typeof q=="function"?f.callback=q:f===n(l)&&r(l),T(J)}else r(l);f=n(l)}if(f!==null)var pe=!0;else{var ae=n(c);ae!==null&&fe(C,ae.startTime-J),pe=!1}return pe}finally{f=null,m=Y,y=!1}}var N=!1,D=null,F=-1,G=5,k=-1;function U(){return!(t.unstable_now()-kB||125V?(B.sortIndex=Y,e(c,B),n(l)===null&&B===n(c)&&(S?(_(F),F=-1):S=!0,fe(C,Y-V))):(B.sortIndex=q,e(l,B),x||y||(x=!0,se(O))),B},t.unstable_shouldYield=U,t.unstable_wrapCallback=function(B){var J=m;return function(){var Y=m;m=J;try{return B.apply(this,arguments)}finally{m=Y}}}})(GA)),GA}var Tj;function lbe(){return Tj||(Tj=1,VA.exports=abe()),VA.exports}var Cj=lbe();const iN={},cbe=t=>void Object.assign(iN,t);function ube(t,e){function n(d,{args:f=[],attach:m,...y},x){let S=`${d[0].toUpperCase()}${d.slice(1)}`,w;if(d==="primitive"){if(y.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const _=y.object;w=Fm(_,{type:d,root:x,attach:m,primitive:!0})}else{const _=iN[S];if(!_)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 _(...f),{type:d,root:x,attach:m,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 m=!1;if(f){var y,x;(y=f.__r3f)!=null&&y.attach?$A(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),m=!0),m||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,oP(f),zm(f)}}function i(d,f,m){let y=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)$A(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){f.parent=d,f.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:f});const w=d.children.filter(E=>E!==f),_=w.indexOf(m);d.children=[...w.slice(0,_),f,...w.slice(_)],y=!0}y||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,oP(f),zm(f)}}function s(d,f,m=!1){d&&[...d].forEach(y=>o(f,y,m))}function o(d,f,m){if(f){var y,x,S;if(f.__r3f&&(f.__r3f.parent=null),(y=d.__r3f)!=null&&y.objects&&(d.__r3f.objects=d.__r3f.objects.filter(C=>C!==f)),(x=f.__r3f)!=null&&x.attach)kj(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var w;d.remove(f),(w=f.__r3f)!=null&&w.root&&vbe(K_(f),f)}const E=(S=f.__r3f)==null?void 0:S.primitive,T=!E&&(m===void 0?f.dispose!==null:m);if(!E){var _;s((_=f.__r3f)==null?void 0:_.objects,f,T),s(f.children,f,T)}if(delete f.__r3f,T&&f.dispose&&f.type!=="Scene"){const C=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?Cj.unstable_scheduleCallback(Cj.unstable_IdlePriority,C):C()}zm(d)}}function a(d,f,m,y){var x;const S=(x=d.__r3f)==null?void 0:x.parent;if(!S)return;const w=n(f,m,d.__r3f.root);if(d.children){for(const _ of d.children)_.__r3f&&r(w,_);d.children=d.children.filter(_=>!_.__r3f)}d.__r3f.objects.forEach(_=>r(w,_)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(S,d),w.parent&&(w.__r3f.autoRemovedBeforeAppend=!0),r(S,w),w.raycast&&w.__r3f.eventCount&&K_(w).getState().internal.interaction.push(w),[y,y.alternate].forEach(_=>{_!==null&&(_.stateNode=w,_.ref&&(typeof _.ref=="function"?_.ref(w):_.ref.current=w))})}const l=()=>{};return{reconciler:obe({createInstance:n,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const m=d.getState().scene;m.__r3f&&(m.__r3f.root=d,r(m,f))},removeChildFromContainer:(d,f)=>{f&&o(d.getState().scene,f)},insertInContainerBefore:(d,f,m)=>{if(!f||!m)return;const y=d.getState().scene;y.__r3f&&i(y,f,m)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,m,y){var x;if(((x=d==null?void 0:d.__r3f)!=null?x:{}).primitive&&y.object&&y.object!==d)return[!0];{const{args:w=[],children:_,...E}=y,{args:T=[],children:C,...O}=m;if(!Array.isArray(w))throw new Error("R3F: the args prop must be an array!");if(w.some((D,F)=>D!==T[F]))return[!0];const N=mG(d,E,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,m],y,x,S,w){f?a(d,y,S,w):XA(d,m)},commitMount(d,f,m,y){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&K_(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Fm(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:m,parent:y}=(f=d.__r3f)!=null?f:{};m&&y&&kj(y,d,m),d.isObject3D&&(d.visible=!1),zm(d)},unhideInstance(d,f){var m;const{attach:y,parent:x}=(m=d.__r3f)!=null?m:{};y&&x&&$A(x,d,y),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),zm(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Ym.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&ir.fun(performance.now)?performance.now:ir.fun(Date.now)?Date.now:()=>0,scheduleTimeout:ir.fun(setTimeout)?setTimeout:void 0,cancelTimeout:ir.fun(clearTimeout)?clearTimeout:void 0}),applyProps:XA}}var Pj,Rj;const WA=t=>"colorSpace"in t||"outputColorSpace"in t,cG=()=>{var t;return(t=iN.ColorManagement)!=null?t:null},uG=t=>t&&t.isOrthographicCamera,dbe=t=>t&&t.hasOwnProperty("current"),yx=typeof window<"u"&&((Pj=window.document)!=null&&Pj.createElement||((Rj=window.navigator)==null?void 0:Rj.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function dG(t){const e=R.useRef(t);return yx(()=>void(e.current=t),[t]),e}function fbe({set:t}){return yx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class fG extends R.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}fG.getDerivedStateFromError=()=>({error:!0});const hG="__default",Nj=new Map,hbe=t=>t&&!!t.memoized&&!!t.changes;function pG(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const R0=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function K_(t){let e=t.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const ir={obj:t=>t===Object(t)&&!ir.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(ir.str(t)||ir.num(t)||ir.boo(t))return t===e;const s=ir.obj(t);if(s&&r==="reference")return t===e;const o=ir.arr(t);if(o&&n==="reference")return t===e;if((o||s)&&t===e)return!0;let a;for(a in t)if(!(a in e))return!1;if(s&&n==="shallow"&&r==="shallow"){for(a in i?e:t)if(!ir.equ(t[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:t)if(t[a]!==e[a])return!1;if(ir.und(a)){if(o&&t.length===0&&e.length===0||s&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function pbe(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function Fm(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function sP(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((s,o)=>s[o],t),{target:n,key:i}}else return{target:n,key:e}}const Ij=/-\d+$/;function $A(t,e,n){if(ir.str(n)){if(Ij.test(n)){const s=n.replace(Ij,""),{target:o,key:a}=sP(t,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=sP(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function kj(t,e,n){var r,i;if(ir.str(n)){const{target:s,key:o}=sP(t,n),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function mG(t,{children:e,key:n,ref:r,...i},{children:s,key:o,ref:a,...l}={},c=!1){const d=t.__r3f,f=Object.entries(i),m=[];if(c){const x=Object.keys(l);for(let S=0;S{var w;if((w=t.__r3f)!=null&&w.primitive&&x==="object"||ir.equ(S,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,S,!0,[]]);let _=[];x.includes("-")&&(_=x.split("-")),m.push([x,S,!1,_]);for(const E in i){const T=i[E];E.startsWith(`${x}-`)&&m.push([E,T,!1,E.split("-")])}});const y={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(y.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(y.attach=d.memoizedProps.attach),{memoized:y,changes:m}}function XA(t,e){var n;const r=t.__r3f,i=r==null?void 0:r.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:a}=hbe(e)?e:mG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=o);for(let m=0;mT[C],t),!(E&&E.set))){const[T,...C]=w.reverse();_=C.reverse().reduce((O,N)=>O[N],t),y=T}if(x===hG+"remove")if(_.constructor){let T=Nj.get(_.constructor);T||(T=new _.constructor,Nj.set(_.constructor,T)),x=T[y]}else x=0;if(S&&r)x?r.handlers[y]=x:delete r.handlers[y],r.eventCount=Object.keys(r.handlers).length;else if(E&&E.set&&(E.copy||E instanceof Ah)){if(Array.isArray(x))E.fromArray?E.fromArray(x):E.set(...x);else if(E.copy&&x&&x.constructor&&E.constructor===x.constructor)E.copy(x);else if(x!==void 0){var c;const T=(c=E)==null?void 0:c.isColor;!T&&E.setScalar?E.setScalar(x):E instanceof Ah&&x instanceof Ah?E.mask=x.mask:E.set(x),!cG()&&s&&!s.linear&&T&&E.convertSRGBToLinear()}}else{var d;if(_[y]=x,(d=_[y])!=null&&d.isTexture&&_[y].format===is&&_[y].type===Ha&&s){const T=_[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 m=K_(t).getState().internal,y=m.interaction.indexOf(t);y>-1&&m.interaction.splice(y,1),r.eventCount&&m.interaction.push(t)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(n=t.__r3f)!=null&&n.parent&&oP(t),t}function 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 oP(t){t.onUpdate==null||t.onUpdate(t)}function mbe(t,e){t.manual||(uG(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function R_(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function gbe(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Ym.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Ym.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Ym.ContinuousEventPriority;default:return Ym.DefaultEventPriority}}function gG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function vbe(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(r=>r!==e),n.initialHits=n.initialHits.filter(r=>r!==e),n.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&n.hovered.delete(i)}),n.capturedMap.forEach((r,i)=>{gG(n.capturedMap,e,r,i)})}function ybe(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],f=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+f*f))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var f;return(f=c.__r3f)==null?void 0:f.handlers["onPointer"+d]}))}function r(l,c){const d=t.getState(),f=new Set,m=[],y=c?c(d.internal.interaction):d.internal.interaction;for(let _=0;_{const T=R0(_.object),C=R0(E.object);return!T||!C?_.distance-E.distance:C.events.priority-T.events.priority||_.distance-E.distance}).filter(_=>{const E=R_(_);return f.has(E)?!1:(f.add(E),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const _ of S){let E=_.object;for(;E;){var w;(w=E.__r3f)!=null&&w.eventCount&&m.push({..._,eventObject:E}),E=E.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let _ of d.internal.capturedMap.get(l.pointerId).values())f.has(R_(_.intersection))||m.push(_.intersection);return m}function i(l,c,d,f){const m=t.getState();if(l.length){const y={stopped:!1};for(const x of l){const S=R0(x.object)||m,{raycaster:w,pointer:_,camera:E,internal:T}=S,C=new X(_.x,_.y,0).unproject(E),O=k=>{var U,H;return(U=(H=T.capturedMap.get(k))==null?void 0:H.has(x.eventObject))!=null?U:!1},N=k=>{const U={intersection:x,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(x.eventObject,U):T.capturedMap.set(k,new Map([[x.eventObject,U]])),c.target.setPointerCapture(k)},D=k=>{const U=T.capturedMap.get(k);U&&gG(T.capturedMap,x.eventObject,U,k)};let F={};for(let k in c){let U=c[k];typeof U!="function"&&(F[k]=U)}let G={...x,...F,pointer:_,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:C,ray:w.ray,camera:E,stopPropagation(){const k="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!k||k.has(x.eventObject))&&(G.stopped=y.stopped=!0,T.hovered.size&&Array.from(T.hovered.values()).find(U=>U.eventObject===x.eventObject))){const U=l.slice(0,l.indexOf(x));s([...U,x])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},currentTarget:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},nativeEvent:c};if(f(G),y.stopped===!0)break}}return l}function s(l){const{internal:c}=t.getState();for(const d of c.hovered.values())if(!l.length||!l.find(f=>f.object===d.object&&f.index===d.index&&f.instanceId===d.instanceId)){const m=d.eventObject.__r3f,y=m==null?void 0:m.handlers;if(c.hovered.delete(R_(d)),m!=null&&m.eventCount){const x={...d,intersections:l};y.onPointerOut==null||y.onPointerOut(x),y.onPointerLeave==null||y.onPointerLeave(x)}}}function o(l,c){for(let d=0;ds([]);case"onLostPointerCapture":return c=>{const{internal:d}=t.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:f,internal:m}=t.getState();m.lastEvent.current=d;const y=l==="onPointerMove",x=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",w=r(d,y?n:void 0),_=x?e(d):0;l==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=w.map(T=>T.eventObject)),x&&!w.length&&_<=2&&(o(d,m.interaction),f&&f(d)),y&&s(w);function E(T){const C=T.eventObject,O=C.__r3f,N=O==null?void 0:O.handlers;if(O!=null&&O.eventCount)if(y){if(N.onPointerOver||N.onPointerEnter||N.onPointerOut||N.onPointerLeave){const D=R_(T),F=m.hovered.get(D);F?F.stopped&&T.stopPropagation():(m.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?(!x||m.initialHits.includes(C))&&(o(d,m.interaction.filter(F=>!m.initialHits.includes(F))),D(T)):x&&m.initialHits.includes(C)&&o(d,m.interaction.filter(F=>!m.initialHits.includes(F)))}}i(w,d,_,E)}}return{handlePointer:a}}const vG=t=>!!(t!=null&&t.render),yG=R.createContext(null),xbe=(t,e)=>{const n=ebe((a,l)=>{const c=new X,d=new X,f=new X;function m(_=l().camera,E=d,T=l().size){const{width:C,height:O,top:N,left:D}=T,F=C/O;E.isVector3?f.copy(E):f.set(...E);const G=_.getWorldPosition(c).distanceTo(f);if(uG(_))return{width:C/_.zoom,height:O/_.zoom,top:N,left:D,factor:1,distance:G,aspect:F};{const k=_.fov*Math.PI/180,U=2*Math.tan(k/2)*G,H=U*(C/O);return{width:H,height:U,top:N,left:D,factor:C/H,distance:G,aspect:F}}}let y;const x=_=>a(E=>({performance:{...E.performance,current:_}})),S=new Ge;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(_=1)=>t(l(),_),advance:(_,E)=>e(_,E,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new JR,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const _=l();y&&clearTimeout(y),_.performance.current!==_.performance.min&&x(_.performance.min),y=setTimeout(()=>x(l().performance.max),_.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:m},setEvents:_=>a(E=>({...E,events:{...E.events,..._}})),setSize:(_,E,T,C,O)=>{const N=l().camera,D={width:_,height:E,top:C||0,left:O||0,updateStyle:T};a(F=>({size:D,viewport:{...F.viewport,...m(N,d,D)}}))},setDpr:_=>a(E=>{const T=pG(_);return{viewport:{...E.viewport,dpr:T,initialDpr:E.viewport.initialDpr||T}}}),setFrameloop:(_="always")=>{const E=l().clock;E.stop(),E.elapsedTime=0,_!=="never"&&(E.start(),E.elapsedTime=0),a(()=>({frameloop:_}))},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:(_,E,T)=>{const C=l().internal;return C.priority=C.priority+(E>0?1:0),C.subscribers.push({ref:_,priority:E,store:T}),C.subscribers=C.subscribers.sort((O,N)=>O.priority-N.priority),()=>{const O=l().internal;O!=null&&O.subscribers&&(O.priority=O.priority-(E>0?1:0),O.subscribers=O.subscribers.filter(N=>N.ref!==_))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return n.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:d,set:f}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){var m;i=l,s=c.dpr,mbe(a,l),d.setPixelRatio(c.dpr);const y=(m=l.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,y)}a!==o&&(o=a,f(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};let N_,bbe=new Set,_be=new Set,wbe=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(bbe,e);case"after":return qA(_be,e);case"tail":return qA(wbe,e)}}let KA,YA;function ZA(t,e,n){let r=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(r=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),KA=e.internal.subscribers,N_=0;N_0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(r+=ZA(c,s))}if(n=!1,N0("after",c),r===0)return N0("tail",c),e=!1,cancelAnimationFrame(i)}function a(c,d=1){var f;if(!c)return t.forEach(m=>a(m.store.getState(),d));(f=c.gl.xr)!=null&&f.isPresenting||!c.internal.active||c.frameloop==="never"||(d>1?c.internal.frames=Math.min(60,c.internal.frames+d):n?c.internal.frames=2:c.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(c,d=!0,f,m){if(d&&N0("before",c),f)ZA(c,f,m);else for(const y of t.values())ZA(c,y.store.getState());d&&N0("after",c)}return{loop:o,invalidate:a,advance:l}}function xG(){const t=R.useContext(yG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function nd(t=n=>n,e){return xG()(t,e)}function bG(t,e=0){const n=xG(),r=n.getState().internal.subscribe,i=dG(t);return yx(()=>r(i,e,n),[e,r,n]),null}const Bg=new Map,{invalidate:Oj,advance:Lj}=Sbe(Bg),{reconciler:U1,applyProps:Nm}=ube(Bg,gbe),Im={objects:"shallow",strict:!1},Mbe=(t,e)=>{const n=typeof t=="function"?t(e):t;return vG(n)?n:new x6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Ebe(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:o,updateStyle:a=n}=e;return{width:r,height:i,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:s,left:o}=t.parentElement.getBoundingClientRect();return{width:r,height:i,top:s,left:o,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function Abe(t){const e=Bg.get(t),n=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||xbe(Oj,Lj),o=n||U1.createContainer(s,Ym.ConcurrentRoot,null,!1,null,"",i,null);e||Bg.set(t,{fiber:o,store:s});let a,l=!1,c;return{configure(d={}){let{gl:f,size:m,scene:y,events:x,onCreated:S,shadows:w=!1,linear:_=!1,flat:E=!1,legacy:T=!1,orthographic:C=!1,frameloop:O="always",dpr:N=[1,2],performance:D,raycaster:F,camera:G,onPointerMissed:k}=d,U=s.getState(),H=U.gl;U.gl||U.set({gl:H=Mbe(f,t)});let ne=U.raycaster;ne||U.set({raycaster:ne=new oG});const{params:te,...he}=F||{};if(ir.equ(he,ne,Im)||Nm(ne,{...he}),ir.equ(te,ne.params,Im)||Nm(ne,{params:{...ne.params,...te}}),!U.camera||U.camera===c&&!ir.equ(c,G,Im)){c=G;const Y=G instanceof dx,V=Y?G:C?new Xc(0,0,0,0,.1,1e3):new Tr(75,0,.1,1e3);Y||(V.position.z=5,G&&(Nm(V,G),("aspect"in G||"left"in G||"right"in G||"bottom"in G||"top"in G)&&(V.manual=!0,V.updateProjectionMatrix())),!U.camera&&!(G!=null&&G.rotation)&&V.lookAt(0,0,0)),U.set({camera:V}),ne.camera=V}if(!U.scene){let Y;y!=null&&y.isScene?Y=y:(Y=new kR,y&&Nm(Y,y)),U.set({scene:Fm(Y)})}if(!U.xr){var se;const Y=(pe,ae)=>{const le=s.getState();le.frameloop!=="never"&&Lj(pe,!0,le,ae)},V=()=>{const pe=s.getState();pe.gl.xr.enabled=pe.gl.xr.isPresenting,pe.gl.xr.setAnimationLoop(pe.gl.xr.isPresenting?Y:null),pe.gl.xr.isPresenting||Oj(pe)},q={connect(){const pe=s.getState().gl;pe.xr.addEventListener("sessionstart",V),pe.xr.addEventListener("sessionend",V)},disconnect(){const pe=s.getState().gl;pe.xr.removeEventListener("sessionstart",V),pe.xr.removeEventListener("sessionend",V)}};typeof((se=H.xr)==null?void 0:se.addEventListener)=="function"&&q.connect(),U.set({xr:q})}if(H.shadowMap){const Y=H.shadowMap.enabled,V=H.shadowMap.type;if(H.shadowMap.enabled=!!w,ir.boo(w))H.shadowMap.type=K0;else if(ir.str(w)){var fe;const q={basic:mV,percentage:HS,soft:K0,variance:Oa};H.shadowMap.type=(fe=q[w])!=null?fe:K0}else ir.obj(w)&&Object.assign(H.shadowMap,w);(Y!==H.shadowMap.enabled||V!==H.shadowMap.type)&&(H.shadowMap.needsUpdate=!0)}const B=cG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Nm(H,{outputEncoding:_?3e3:3001,toneMapping:E?Pl:dR}),U.legacy!==T&&U.set(()=>({legacy:T})),U.linear!==_&&U.set(()=>({linear:_})),U.flat!==E&&U.set(()=>({flat:E})),f&&!ir.fun(f)&&!vG(f)&&!ir.equ(f,H,Im)&&Nm(H,f),x&&!U.events.handlers&&U.set({events:x(s)});const J=Ebe(t,m);return ir.equ(J,U.size,Im)||U.setSize(J.width,J.height,J.updateStyle,J.top,J.left),N&&U.viewport.dpr!==pG(N)&&U.setDpr(N),U.frameloop!==O&&U.setFrameloop(O),U.onPointerMissed||U.set({onPointerMissed:k}),D&&!ir.equ(D,U.performance,Im)&&U.set(Y=>({performance:{...Y.performance,...D}})),a=S,l=!0,this},render(d){return l||this.configure(),U1.updateContainer(g.jsx(Tbe,{store:s,children:d,onCreated:a,rootElement:t}),o,null,()=>{}),s},unmount(){_G(t)}}}function Tbe({store:t,children:e,onCreated:n,rootElement:r}){return yx(()=>{const i=t.getState();i.set(s=>({internal:{...s.internal,active:!0}})),n&&n(i),t.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),g.jsx(yG.Provider,{value:t,children:e})}function _G(t,e){const n=Bg.get(t),r=n==null?void 0:n.fiber;if(r){const i=n==null?void 0:n.store.getState();i&&(i.internal.active=!1),U1.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),pbe(i),Bg.delete(t)}catch{}},500)})}}U1.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:R.version});const QA={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Cbe(t){const{handlePointer:e}=ybe(t);return{priority:1,enabled:!0,compute(n,r,i){r.pointer.set(n.offsetX/r.size.width*2-1,-(n.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(QA).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{var r;const{set:i,events:s}=t.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:n}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([o,a])=>{const[l,c]=QA[o];n.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,o])=>{if(r&&r.connected instanceof HTMLElement){const[a]=QA[s];r.connected.removeEventListener(a,o)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function Dj(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function Pbe({debounce:t,scroll:e,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=R.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=R.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=R.useRef(!1);R.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,m,y]=R.useMemo(()=>{const _=()=>{if(!a.current.element)return;const{left:E,top:T,width:C,height:O,bottom:N,right:D,x:F,y:G}=a.current.element.getBoundingClientRect(),k={left:E,top:T,width:C,height:O,bottom:N,right:D,x:F,y:G};a.current.element instanceof HTMLElement&&r&&(k.height=a.current.element.offsetHeight,k.width=a.current.element.offsetWidth),Object.freeze(k),d.current&&!kbe(a.current.lastBounds,k)&&o(a.current.lastBounds=k)};return[_,c?Dj(_,c):_,l?Dj(_,l):_]},[o,r,l,c]);function x(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",y,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function S(){a.current.element&&(a.current.resizeObserver=new i(y),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(_=>_.addEventListener("scroll",y,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const w=_=>{!_||_===a.current.element||(x(),a.current.element=_,a.current.scrollContainers=wG(_),S())};return Nbe(y,!!e),Rbe(m),R.useEffect(()=>{x(),S()},[e,y,m]),R.useEffect(()=>x,[]),[w,s,f]}function Rbe(t){R.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function Nbe(t,e){R.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function wG(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(t);return[n,r,i].some(s=>s==="auto"||s==="scroll")&&e.push(t),[...e,...wG(t.parentElement)]}const Ibe=["x","y","top","bottom","left","right","width","height"],kbe=(t,e)=>Ibe.every(n=>t[n]===e[n]);var Obe=Object.defineProperty,Lbe=Object.defineProperties,Dbe=Object.getOwnPropertyDescriptors,jj=Object.getOwnPropertySymbols,jbe=Object.prototype.hasOwnProperty,Ube=Object.prototype.propertyIsEnumerable,Uj=(t,e,n)=>e in t?Obe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Fj=(t,e)=>{for(var n in e||(e={}))jbe.call(e,n)&&Uj(t,n,e[n]);if(jj)for(var n of jj(e))Ube.call(e,n)&&Uj(t,n,e[n]);return t},Fbe=(t,e)=>Lbe(t,Dbe(e)),zj,Bj;typeof window<"u"&&((zj=window.document)!=null&&zj.createElement||((Bj=window.navigator)==null?void 0:Bj.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function SG(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=SG(r,e,n);if(i)return i;r=r.sibling}}function MG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const Hj=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=Hj;return}return Hj.apply(this,arguments)};const sN=MG(R.createContext(null));class EG extends R.Component{render(){return R.createElement(sN.Provider,{value:this._reactInternals},this.props.children)}}function zbe(){const t=R.useContext(sN);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=R.useId();return R.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=SG(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[t,e])}function Bbe(){const t=zbe(),[e]=R.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==sN&&!e.has(i)&&e.set(i,R.useContext(MG(i)))}n=n.return}return e}function Hbe(){const t=Bbe();return R.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>R.createElement(e,null,R.createElement(n.Provider,Fbe(Fj({},r),{value:t.get(n)}))),e=>R.createElement(EG,Fj({},e))),[t])}const Vbe=R.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:o=Cbe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:_,camera:E,scene:T,onPointerMissed:C,onCreated:O,...N},D){R.useMemo(()=>cbe(Kxe),[]);const F=Hbe(),[G,k]=Pbe({scroll:!0,debounce:{scroll:50,resize:0},...r}),U=R.useRef(null),H=R.useRef(null);R.useImperativeHandle(D,()=>U.current);const ne=dG(C),[te,he]=R.useState(!1),[se,fe]=R.useState(!1);if(te)throw te;if(se)throw se;const B=R.useRef(null);yx(()=>{const Y=U.current;k.width>0&&k.height>0&&Y&&(B.current||(B.current=Abe(Y)),B.current.configure({gl:s,events:o,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:_,camera:E,scene:T,size:k,onPointerMissed:(...V)=>ne.current==null?void 0:ne.current(...V),onCreated:V=>{V.events.connect==null||V.events.connect(a?dbe(a)?a.current:a:H.current),l&&V.setEvents({compute:(q,pe)=>{const ae=q[l+"X"],le=q[l+"Y"];pe.pointer.set(ae/pe.size.width*2-1,-(le/pe.size.height)*2+1),pe.raycaster.setFromCamera(pe.pointer,pe.camera)}}),O==null||O(V)}}),B.current.render(g.jsx(F,{children:g.jsx(fG,{set:fe,children:g.jsx(R.Suspense,{fallback:g.jsx(fbe,{set:he}),children:e??null})})})))}),R.useEffect(()=>{const Y=U.current;if(Y)return()=>_G(Y)},[]);const J=a?"none":"auto";return g.jsx("div",{ref:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:J,...i},...N,children:g.jsx("div",{ref:G,style:{width:"100%",height:"100%"},children:g.jsx("canvas",{ref:U,style:{display:"block"},children:n})})})}),Gbe=R.forwardRef(function(e,n){return g.jsx(EG,{children:g.jsx(Vbe,{...e,ref:n})})});function aP(){return aP=Object.assign?Object.assign.bind():function(t){for(var e=1;ee in t?Wbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Xbe=(t,e,n)=>($be(t,e+"",n),n);class qbe{constructor(){Xbe(this,"_listeners")}addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;se in t?Kbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Xt=(t,e,n)=>(Ybe(t,typeof e!="symbol"?e+"":e,n),n);const I_=new Jh,Vj=new kc,Zbe=Math.cos(70*(Math.PI/180)),Gj=(t,e)=>(t%e+e)%e;let Qbe=class extends qbe{constructor(e,n){super(),Xt(this,"object"),Xt(this,"domElement"),Xt(this,"enabled",!0),Xt(this,"target",new X),Xt(this,"minDistance",0),Xt(this,"maxDistance",1/0),Xt(this,"minZoom",0),Xt(this,"maxZoom",1/0),Xt(this,"minPolarAngle",0),Xt(this,"maxPolarAngle",Math.PI),Xt(this,"minAzimuthAngle",-1/0),Xt(this,"maxAzimuthAngle",1/0),Xt(this,"enableDamping",!1),Xt(this,"dampingFactor",.05),Xt(this,"enableZoom",!0),Xt(this,"zoomSpeed",1),Xt(this,"enableRotate",!0),Xt(this,"rotateSpeed",1),Xt(this,"enablePan",!0),Xt(this,"panSpeed",1),Xt(this,"screenSpacePanning",!0),Xt(this,"keyPanSpeed",7),Xt(this,"zoomToCursor",!1),Xt(this,"autoRotate",!1),Xt(this,"autoRotateSpeed",2),Xt(this,"reverseOrbit",!1),Xt(this,"reverseHorizontalOrbit",!1),Xt(this,"reverseVerticalOrbit",!1),Xt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Xt(this,"mouseButtons",{LEFT:Xf.ROTATE,MIDDLE:Xf.DOLLY,RIGHT:Xf.PAN}),Xt(this,"touches",{ONE:qf.ROTATE,TWO:qf.DOLLY_PAN}),Xt(this,"target0"),Xt(this,"position0"),Xt(this,"zoom0"),Xt(this,"_domElementKeyEvents",null),Xt(this,"getPolarAngle"),Xt(this,"getAzimuthalAngle"),Xt(this,"setPolarAngle"),Xt(this,"setAzimuthalAngle"),Xt(this,"getDistance"),Xt(this,"getZoomScale"),Xt(this,"listenToKeyEvents"),Xt(this,"stopListenToKeyEvents"),Xt(this,"saveState"),Xt(this,"reset"),Xt(this,"update"),Xt(this,"connect"),Xt(this,"dispose"),Xt(this,"dollyIn"),Xt(this,"dollyOut"),Xt(this,"getScale"),Xt(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=Q=>{let Ae=Gj(Q,2*Math.PI),re=d.phi;re<0&&(re+=2*Math.PI),Ae<0&&(Ae+=2*Math.PI);let Fe=Math.abs(Ae-re);2*Math.PI-Fe{let Ae=Gj(Q,2*Math.PI),re=d.theta;re<0&&(re+=2*Math.PI),Ae<0&&(Ae+=2*Math.PI);let Fe=Math.abs(Ae-re);2*Math.PI-Fer.object.position.distanceTo(r.target),this.listenToKeyEvents=Q=>{Q.addEventListener("keydown",dt),this._domElementKeyEvents=Q},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",dt),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=a.NONE},this.update=(()=>{const Q=new X,Ae=new X(0,1,0),re=new Kt().setFromUnitVectors(e.up,Ae),Fe=re.clone().invert(),Te=new X,Le=new Kt,Ye=2*Math.PI;return function(){const Yt=r.object.position;re.setFromUnitVectors(e.up,Ae),Fe.copy(re).invert(),Q.copy(Yt).sub(r.target),Q.applyQuaternion(re),d.setFromVector3(Q),r.autoRotate&&l===a.NONE&&te(H()),r.enableDamping?(d.theta+=f.theta*r.dampingFactor,d.phi+=f.phi*r.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let un=r.minAzimuthAngle,Cn=r.maxAzimuthAngle;isFinite(un)&&isFinite(Cn)&&(un<-Math.PI?un+=Ye:un>Math.PI&&(un-=Ye),Cn<-Math.PI?Cn+=Ye:Cn>Math.PI&&(Cn-=Ye),un<=Cn?d.theta=Math.max(un,Math.min(Cn,d.theta)):d.theta=d.theta>(un+Cn)/2?Math.max(un,d.theta):Math.min(Cn,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(y,r.dampingFactor):r.target.add(y),r.zoomToCursor&&G||r.object.isOrthographicCamera?d.radius=pe(d.radius):d.radius=pe(d.radius*m),Q.setFromSpherical(d),Q.applyQuaternion(Fe),Yt.copy(r.target).add(Q),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&&G){let Hn=null;if(r.object instanceof Tr&&r.object.isPerspectiveCamera){const hr=Q.length();Hn=pe(hr*m);const Si=hr-Hn;r.object.position.addScaledVector(D,Si),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const hr=new X(F.x,F.y,0);hr.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix(),en=!0;const Si=new X(F.x,F.y,0);Si.unproject(r.object),r.object.position.sub(Si).add(hr),r.object.updateMatrixWorld(),Hn=Q.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):(I_.origin.copy(r.object.position),I_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(I_.direction))c||8*(1-Le.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Te.copy(r.object.position),Le.copy(r.object.quaternion),en=!1,!0):!1}})(),this.connect=Q=>{r.domElement=Q,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",tt),r.domElement.addEventListener("pointerdown",Ee),r.domElement.addEventListener("pointercancel",Ve),r.domElement.addEventListener("wheel",rt)},this.dispose=()=>{var Q,Ae,re,Fe,Te,Le;r.domElement&&(r.domElement.style.touchAction="auto"),(Q=r.domElement)==null||Q.removeEventListener("contextmenu",tt),(Ae=r.domElement)==null||Ae.removeEventListener("pointerdown",Ee),(re=r.domElement)==null||re.removeEventListener("pointercancel",Ve),(Fe=r.domElement)==null||Fe.removeEventListener("wheel",rt),(Te=r.domElement)==null||Te.ownerDocument.removeEventListener("pointermove",Be),(Le=r.domElement)==null||Le.ownerDocument.removeEventListener("pointerup",Ve),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",dt)};const r=this,i={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,d=new iP,f=new iP;let m=1;const y=new X,x=new Ge,S=new Ge,w=new Ge,_=new Ge,E=new Ge,T=new Ge,C=new Ge,O=new Ge,N=new Ge,D=new X,F=new Ge;let G=!1;const k=[],U={};function H(){return 2*Math.PI/60/60*r.autoRotateSpeed}function ne(){return Math.pow(.95,r.zoomSpeed)}function te(Q){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=Q:f.theta-=Q}function he(Q){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=Q:f.phi-=Q}const se=(()=>{const Q=new X;return function(re,Fe){Q.setFromMatrixColumn(Fe,0),Q.multiplyScalar(-re),y.add(Q)}})(),fe=(()=>{const Q=new X;return function(re,Fe){r.screenSpacePanning===!0?Q.setFromMatrixColumn(Fe,1):(Q.setFromMatrixColumn(Fe,0),Q.crossVectors(r.object.up,Q)),Q.multiplyScalar(re),y.add(Q)}})(),B=(()=>{const Q=new X;return function(re,Fe){const Te=r.domElement;if(Te&&r.object instanceof Tr&&r.object.isPerspectiveCamera){const Le=r.object.position;Q.copy(Le).sub(r.target);let Ye=Q.length();Ye*=Math.tan(r.object.fov/2*Math.PI/180),se(2*re*Ye/Te.clientHeight,r.object.matrix),fe(2*Fe*Ye/Te.clientHeight,r.object.matrix)}else Te&&r.object instanceof Xc&&r.object.isOrthographicCamera?(se(re*(r.object.right-r.object.left)/r.object.zoom/Te.clientWidth,r.object.matrix),fe(Fe*(r.object.top-r.object.bottom)/r.object.zoom/Te.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function J(Q){r.object instanceof Tr&&r.object.isPerspectiveCamera||r.object instanceof Xc&&r.object.isOrthographicCamera?m=Q:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function Y(Q){J(m/Q)}function V(Q){J(m*Q)}function q(Q){if(!r.zoomToCursor||!r.domElement)return;G=!0;const Ae=r.domElement.getBoundingClientRect(),re=Q.clientX-Ae.left,Fe=Q.clientY-Ae.top,Te=Ae.width,Le=Ae.height;F.x=re/Te*2-1,F.y=-(Fe/Le)*2+1,D.set(F.x,F.y,1).unproject(r.object).sub(r.object.position).normalize()}function pe(Q){return Math.max(r.minDistance,Math.min(r.maxDistance,Q))}function ae(Q){x.set(Q.clientX,Q.clientY)}function le(Q){q(Q),C.set(Q.clientX,Q.clientY)}function be(Q){_.set(Q.clientX,Q.clientY)}function Se(Q){S.set(Q.clientX,Q.clientY),w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Ae=r.domElement;Ae&&(te(2*Math.PI*w.x/Ae.clientHeight),he(2*Math.PI*w.y/Ae.clientHeight)),x.copy(S),r.update()}function qe(Q){O.set(Q.clientX,Q.clientY),N.subVectors(O,C),N.y>0?Y(ne()):N.y<0&&V(ne()),C.copy(O),r.update()}function Me(Q){E.set(Q.clientX,Q.clientY),T.subVectors(E,_).multiplyScalar(r.panSpeed),B(T.x,T.y),_.copy(E),r.update()}function $e(Q){q(Q),Q.deltaY<0?V(ne()):Q.deltaY>0&&Y(ne()),r.update()}function Ke(Q){let Ae=!1;switch(Q.code){case r.keys.UP:B(0,r.keyPanSpeed),Ae=!0;break;case r.keys.BOTTOM:B(0,-r.keyPanSpeed),Ae=!0;break;case r.keys.LEFT:B(r.keyPanSpeed,0),Ae=!0;break;case r.keys.RIGHT:B(-r.keyPanSpeed,0),Ae=!0;break}Ae&&(Q.preventDefault(),r.update())}function ce(){if(k.length==1)x.set(k[0].pageX,k[0].pageY);else{const Q=.5*(k[0].pageX+k[1].pageX),Ae=.5*(k[0].pageY+k[1].pageY);x.set(Q,Ae)}}function Z(){if(k.length==1)_.set(k[0].pageX,k[0].pageY);else{const Q=.5*(k[0].pageX+k[1].pageX),Ae=.5*(k[0].pageY+k[1].pageY);_.set(Q,Ae)}}function We(){const Q=k[0].pageX-k[1].pageX,Ae=k[0].pageY-k[1].pageY,re=Math.sqrt(Q*Q+Ae*Ae);C.set(0,re)}function je(){r.enableZoom&&We(),r.enablePan&&Z()}function Xe(){r.enableZoom&&We(),r.enableRotate&&ce()}function Je(Q){if(k.length==1)S.set(Q.pageX,Q.pageY);else{const re=ue(Q),Fe=.5*(Q.pageX+re.x),Te=.5*(Q.pageY+re.y);S.set(Fe,Te)}w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Ae=r.domElement;Ae&&(te(2*Math.PI*w.x/Ae.clientHeight),he(2*Math.PI*w.y/Ae.clientHeight)),x.copy(S)}function bt(Q){if(k.length==1)E.set(Q.pageX,Q.pageY);else{const Ae=ue(Q),re=.5*(Q.pageX+Ae.x),Fe=.5*(Q.pageY+Ae.y);E.set(re,Fe)}T.subVectors(E,_).multiplyScalar(r.panSpeed),B(T.x,T.y),_.copy(E)}function ut(Q){const Ae=ue(Q),re=Q.pageX-Ae.x,Fe=Q.pageY-Ae.y,Te=Math.sqrt(re*re+Fe*Fe);O.set(0,Te),N.set(0,Math.pow(O.y/C.y,r.zoomSpeed)),Y(N.y),C.copy(O)}function ee(Q){r.enableZoom&&ut(Q),r.enablePan&&bt(Q)}function $(Q){r.enableZoom&&ut(Q),r.enableRotate&&Je(Q)}function Ee(Q){var Ae,re;r.enabled!==!1&&(k.length===0&&((Ae=r.domElement)==null||Ae.ownerDocument.addEventListener("pointermove",Be),(re=r.domElement)==null||re.ownerDocument.addEventListener("pointerup",Ve)),jt(Q),Q.pointerType==="touch"?de(Q):He(Q))}function Be(Q){r.enabled!==!1&&(Q.pointerType==="touch"?Ne(Q):mt(Q))}function Ve(Q){var Ae,re,Fe;Lt(Q),k.length===0&&((Ae=r.domElement)==null||Ae.releasePointerCapture(Q.pointerId),(re=r.domElement)==null||re.ownerDocument.removeEventListener("pointermove",Be),(Fe=r.domElement)==null||Fe.ownerDocument.removeEventListener("pointerup",Ve)),r.dispatchEvent(o),l=a.NONE}function He(Q){let Ae;switch(Q.button){case 0:Ae=r.mouseButtons.LEFT;break;case 1:Ae=r.mouseButtons.MIDDLE;break;case 2:Ae=r.mouseButtons.RIGHT;break;default:Ae=-1}switch(Ae){case Xf.DOLLY:if(r.enableZoom===!1)return;le(Q),l=a.DOLLY;break;case Xf.ROTATE:if(Q.ctrlKey||Q.metaKey||Q.shiftKey){if(r.enablePan===!1)return;be(Q),l=a.PAN}else{if(r.enableRotate===!1)return;ae(Q),l=a.ROTATE}break;case Xf.PAN:if(Q.ctrlKey||Q.metaKey||Q.shiftKey){if(r.enableRotate===!1)return;ae(Q),l=a.ROTATE}else{if(r.enablePan===!1)return;be(Q),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function mt(Q){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;Se(Q);break;case a.DOLLY:if(r.enableZoom===!1)return;qe(Q);break;case a.PAN:if(r.enablePan===!1)return;Me(Q);break}}function rt(Q){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(Q.preventDefault(),r.dispatchEvent(s),$e(Q),r.dispatchEvent(o))}function dt(Q){r.enabled===!1||r.enablePan===!1||Ke(Q)}function de(Q){switch(ct(Q),k.length){case 1:switch(r.touches.ONE){case qf.ROTATE:if(r.enableRotate===!1)return;ce(),l=a.TOUCH_ROTATE;break;case qf.PAN:if(r.enablePan===!1)return;Z(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case qf.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;je(),l=a.TOUCH_DOLLY_PAN;break;case qf.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Xe(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Ne(Q){switch(ct(Q),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Je(Q),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;bt(Q),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ee(Q),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;$(Q),r.update();break;default:l=a.NONE}}function tt(Q){r.enabled!==!1&&Q.preventDefault()}function jt(Q){k.push(Q)}function Lt(Q){delete U[Q.pointerId];for(let Ae=0;Ae{V(Q),r.update()},this.dollyOut=(Q=ne())=>{Y(Q),r.update()},this.getScale=()=>m,this.setScale=Q=>{J(Q),r.update()},this.getZoomScale=()=>ne(),n!==void 0&&this.connect(n),this.update()}};const Jbe=R.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},d)=>{const f=nd(N=>N.invalidate),m=nd(N=>N.camera),y=nd(N=>N.gl),x=nd(N=>N.events),S=nd(N=>N.setEvents),w=nd(N=>N.set),_=nd(N=>N.get),E=nd(N=>N.performance),T=e||m,C=r||x.connected||y.domElement,O=R.useMemo(()=>new Qbe(T),[T]);return bG(()=>{O.enabled&&O.update()},-1),R.useEffect(()=>(s&&O.connect(s===!0?C:s),O.connect(C),()=>void O.dispose()),[s,C,n,O,f]),R.useEffect(()=>{const N=G=>{f(),n&&E.regress(),o&&o(G)},D=G=>{a&&a(G)},F=G=>{l&&l(G)};return O.addEventListener("change",N),O.addEventListener("start",D),O.addEventListener("end",F),()=>{O.removeEventListener("start",D),O.removeEventListener("end",F),O.removeEventListener("change",N)}},[o,a,l,O,f,S]),R.useEffect(()=>{if(t){const N=_().controls;return w({controls:O}),()=>w({controls:N})}},[t,O]),R.createElement("primitive",aP({ref:d,object:O,enableDamping:i},c))});function Wj(t,e){if(e===$V)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===O1||e===wR){let n=t.getIndex();if(n===null){const o=[],a=t.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const c=new k_e(s,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function t_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 n_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,o)}}class g_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 o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class v_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 o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class y_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),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,f=i.byteStride,m=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,f,m,i.mode,i.filter).then(function(y){return y.buffer}):o.ready.then(function(){const y=new ArrayBuffer(d*f);return o.decodeGltfBuffer(new Uint8Array(y),d,f,m,i.mode,i.filter),y})})}else return null}}class x_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!==Ho.TRIANGLES&&c.mode!==Ho.TRIANGLE_STRIP&&c.mode!==Ho.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(l[c]=d,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),f=d.isGroup?d.children:[d],m=c[0].count,y=[];for(const x of f){const S=new Pt,w=new X,_=new Kt,E=new X(1,1,1),T=new LR(x.geometry,x.material,m);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const I_e=new Pt;class k_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new t_e,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new q6(this.options.manager):this.textureLoader=new nG(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ga(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,n){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return Ff(s,a,i),Nc(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=n.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,d]of o.children.entries())s(d,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r=2&&w.setY(G,N[D*l+1]),l>=3&&w.setZ(G,N[D*l+2]),l>=4&&w.setW(G,N[D*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}w.normalized=x}return w})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,o=n.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,n,r){const i=this,s=this.json,o=s.textures[e],a=s.images[n],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const m=(s.samplers||{})[o.sampler]||{};return d.magFilter=Xj[m.magFilter]||Cr,d.minFilter=Xj[m.minFilter]||qo,d.wrapS=qj[m.wrapS]||Pd,d.wrapT=qj[m.wrapT]||Pd,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,n){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(f){c=!0;const m=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(m),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(f){return new Promise(function(m,y){let x=m;n.isImageBitmapLoader===!0&&(x=function(S){const w=new dr(S);w.needsUpdate=!0,m(w)}),n.load(Md.resolveURL(f,s.path),x,void 0,y)})}).then(function(f){return c===!0&&a.revokeObjectURL(l),Nc(f,o),f.userData.mimeType=o.mimeType||N_e(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=d,d}assignTexture(e,n,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[vn.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[vn.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[vn.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[n]=o,o})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,o=n.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new sM,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new $r,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return vx}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[vn.KHR_MATERIALS_UNLIT]){const f=i[vn.KHR_MATERIALS_UNLIT];o=f.getMaterialType(),c.push(f.extendParams(a,s,n))}else{const f=s.pbrMetallicRoughness||{};if(a.color=new lt(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const m=f.baseColorFactor;a.color.setRGB(m[0],m[1],m[2],xi),a.opacity=m[3]}f.baseColorTexture!==void 0&&c.push(n.assignTexture(a,"map",f.baseColorTexture,Ui)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),o=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=xo);const d=s.alphaMode||eT.OPAQUE;if(d===eT.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===eT.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==As&&(c.push(n.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ge(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;a.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&o!==As&&(c.push(n.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==As){const f=s.emissiveFactor;a.emissive=new lt().setRGB(f[0],f[1],f[2],xi)}return s.emissiveTexture!==void 0&&o!==As&&c.push(n.assignTexture(a,"emissiveMap",s.emissiveTexture,Ui)),Promise.all(c).then(function(){const f=new o(a);return s.name&&(f.name=s.name),Nc(f,s),n.associations.set(f,{materials:e}),s.extensions&&Ff(i,f,s),f})}createUniqueName(e){const n=Nn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[vn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,n).then(function(l){return Kj(l,a,n)})}const o=[];for(let a=0,l=e.length;a0&&P_e(_,s),_.name=n.createUniqueName(s.name||"mesh_"+e),Nc(_,s),w.extensions&&Ff(i,_,w),n.assignFinalMaterial(_),f.push(_)}for(let y=0,x=f.length;y1?d=new Ts:c.length===1?d=c[0]:d=new mn,d!==c[0])for(let f=0,m=c.length;f{const f=new Map;for(const[m,y]of i.associations)(m instanceof Gr||m instanceof dr)&&f.set(m,y);return d.traverse(m=>{const y=i.associations.get(m);y!=null&&f.set(m,y)}),f};return i.associations=c(s),s})}_createAnimationTracks(e,n,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];rd[s.path]===rd.weights?e.traverse(function(m){m.morphTargetInfluences&&l.push(m.name?m.name:m.uuid)}):l.push(a);let c;switch(rd[s.path]){case rd.weights:c=Hh;break;case rd.rotation:c=Vh;break;case rd.position:case rd.scale:c=Gh;break;default:switch(r.itemSize){case 1:c=Hh;break;case 2:case 3:default:c=Gh;break}break}const d=i.interpolation!==void 0?A_e[i.interpolation]:Dg,f=this._getArrayFromAccessor(r);for(let m=0,y=l.length;mnew Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),jn=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),Kj=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 TG(t,e,n){var r,i;const s=t.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,d=[];return n.traverse(f=>{d.length{const s=TG(t,i,r);s!=null&&n.set(i,s)}),n})}var cP={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 CG(t){return Math.max(Math.min(t,1),0)}var Qj=class PG{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(cP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(cP));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 PG().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=CG(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}}},I0={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},O_e={_Color:I0.Color,_EmissionColor:I0.EmissionColor,_ShadeColor:I0.ShadeColor,_RimColor:I0.RimColor,_OutlineColor:I0.OutlineColor},L_e=new ct,RG=class NG{constructor({material:e,type:n,targetValue:r,targetAlpha:i}){this.material=e,this.type=n,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:n,alpha:r}=this._state;if(n!=null){const{propertyName:i,deltaValue:s}=n,o=this.material[i];o!=null&&o.add(L_e.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:n}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(n!=null){const{propertyName:r,initialValue:i}=n;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,n,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?n:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const d=i[l].clone(),f=new ct(o.r-d.r,o.g-d.g,o.b-d.b);return{propertyName:l,initialValue:d,deltaValue:f}}_initAlphaBindState(){var e,n,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?n:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],d=o-c;return{propertyName:l,initialValue:c,deltaValue:d}}_getPropertyNameMap(){var e,n;return(n=(e=Object.entries(NG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};RG._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 Jj=RG,U1=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)})}},eU=new Ve,IG=class kG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const o=(i=Object.entries(kG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const d=c.offset.clone(),f=c.repeat.clone(),m=r.clone().sub(d),y=n.clone().sub(f);this._properties.push({name:a,initialOffset:d,deltaOffset:m,initialScale:f,deltaScale:y})}))}applyWeight(e){this._properties.forEach(n=>{const r=this.material[n.name];r!==void 0&&(r.offset.add(eU.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(eU.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))})}};IG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var tU=IG,D_e=new Set(["1.0","1.0-beta"]),OG=class LG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return jn(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return jn(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 jn(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!D_e.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(cP)),d=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([m,y])=>{if(y!=null){if(!c.has(m)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${m}" detected. Ignoring the expression`);return}d.set(m,y)}}),l.custom!=null&&Object.entries(l.custom).forEach(([m,y])=>{if(c.has(m)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${m}". Ignoring the expression`);return}d.set(m,y)});const f=new Qj;return yield Promise.all(Array.from(d.entries()).map(m=>jn(this,[m],function*([y,x]){var S,w,_,E,T,C,O;const N=new Kj(y);if(e.scene.add(N),N.isBinary=(S=x.isBinary)!=null?S:!1,N.overrideBlink=(w=x.overrideBlink)!=null?w:"none",N.overrideLookAt=(_=x.overrideLookAt)!=null?_:"none",N.overrideMouth=(E=x.overrideMouth)!=null?E:"none",(T=x.morphTargetBinds)==null||T.forEach(D=>jn(this,null,function*(){var F;if(D.node===void 0||D.index===void 0)return;const V=yield Yj(e,D.node),k=D.index;if(!V.every(U=>Array.isArray(U.morphTargetInfluences)&&k{const V=F.material;V&&(Array.isArray(V)?D.push(...V):D.push(V))}),(C=x.materialColorBinds)==null||C.forEach(F=>jn(this,null,function*(){D.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{N.addBind(new Jj({material:k,type:F.type,targetValue:new ct().fromArray(F.targetValue),targetAlpha:F.targetValue[3]}))})})),(O=x.textureTransformBinds)==null||O.forEach(F=>jn(this,null,function*(){D.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{var U,H;N.addBind(new tU({material:k,offset:new Ve().fromArray((U=F.offset)!=null?U:[0,0]),scale:new Ve().fromArray((H=F.scale)!=null?H:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return jn(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new Qj,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>jn(this,null,function*(){var d;const f=c.presetName,m=f!=null&&LG.v0v1PresetNameMap[f]||null,y=m??c.name;if(y==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(y)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${f} has duplicated entries. Ignoring the expression`);return}l.add(y);const x=new Kj(y);e.scene.add(x),x.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(w=>jn(this,null,function*(){var _;if(w.mesh===void 0||w.index===void 0)return;const E=[];if((_=r.nodes)==null||_.forEach((C,O)=>{C.mesh===w.mesh&&E.push(O)}),E.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(E.map(C=>jn(this,null,function*(){var O;const N=yield Yj(e,C);if(!N.every(D=>Array.isArray(D.morphTargetInfluences)&&T{if(w.materialName===void 0||w.propertyName===void 0||w.targetValue===void 0)return;const _=[];e.scene.traverse(T=>{if(T.material){const C=T.material;Array.isArray(C)?_.push(...C.filter(O=>(O.name===w.materialName||O.name===w.materialName+" (Outline)")&&_.indexOf(O)===-1)):C.name===w.materialName&&_.indexOf(C)===-1&&_.push(C)}});const E=w.propertyName;_.forEach(T=>{if(E==="_MainTex_ST"){const O=new Ve(w.targetValue[0],w.targetValue[1]),N=new Ve(w.targetValue[2],w.targetValue[3]);N.y=1-N.y-O.y,x.addBind(new tU({material:T,scale:O,offset:N}));return}const C=O_e[E];if(C){x.addBind(new Jj({material:T,type:C,targetValue:new ct().fromArray(w.targetValue),targetAlpha:w.targetValue[3]}));return}console.warn(E+" is not supported")})}),o.registerExpression(x)}))),o})}};OG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var j_e=OG,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 o=0;o0&&i.includes(f[0])||d[1]>0&&i.includes(f[1])||d[2]>0&&i.includes(f[2])||d[3]>0&&i.includes(f[3]))continue;const m=n[l],y=r[l];if(m[0]>0&&i.includes(y[0])||m[1]>0&&i.includes(y[1])||m[2]>0&&i.includes(y[2])||m[3]>0&&i.includes(y[3]))continue;const x=n[c],S=r[c];x[0]>0&&i.includes(S[0])||x[1]>0&&i.includes(S[1])||x[2]>0&&i.includes(S[2])||x[3]>0&&i.includes(S[3])||(e[s++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,n){const r=new 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"),o=s instanceof tP?[]:s.array,a=[];for(let S=0;S{this._isEraseTarget(s)&&r.push(o)}),!r.length){n.layers.enable(this._thirdPersonOnlyLayer),n.layers.enable(this._firstPersonOnlyLayer);return}n.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(n,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer));else{const n=new 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 nU=sN,U_e=new Set(["1.0","1.0-beta"]),F_e=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return jn(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 jn(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 jn(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!U_e.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,c=[],d=yield Zj(t);return Array.from(d.entries()).forEach(([f,m])=>{var y,x;const S=(y=l==null?void 0:l.meshAnnotations)==null?void 0:y.find(w=>w.node===f);c.push({meshes:m,type:(x=S==null?void 0:S.type)!=null?x:"auto"})}),new nU(e,c)})}_v0Import(t,e){return jn(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield Zj(t);return Array.from(a.entries()).forEach(([l,c])=>{const d=r.nodes[l],f=s.meshAnnotations?s.meshAnnotations.find(m=>m.mesh===d.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new nU(e,o)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},rU=new X,iU=new X,z_e=new Kt,sU=class extends Ts{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new aG(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(rU,z_e,iU);const r=rU.set(.1,.1,.1).divide(iU);n.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(t)}},tT=["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"],B_e={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function DG(t){return t.invert?t.invert():t.inverse(),t}var zf=new X,Bf=new Kt,uP=class{constructor(t){this.humanBones=t,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);r&&(zf.copy(r.position),Bf.copy(r.quaternion),t[n]={position:zf.toArray(),rotation:Bf.toArray()})}),t}getPose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);if(!r)return;zf.set(0,0,0),Bf.identity();const i=this.restPose[n];i!=null&&i.position&&zf.fromArray(i.position).negate(),i!=null&&i.rotation&&DG(Bf.fromArray(i.rotation)),zf.add(r.position),Bf.premultiply(r.quaternion),t[n]={position:zf.toArray(),rotation:Bf.toArray()}}),t}setPose(t){Object.entries(t).forEach(([e,n])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(n!=null&&n.position&&(i.position.fromArray(n.position),s.position&&i.position.add(zf.fromArray(s.position))),n!=null&&n.rotation&&(i.quaternion.fromArray(n.rotation),s.rotation&&i.quaternion.multiply(Bf.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([t,e])=>{const n=this.getBoneNode(t);n&&(e!=null&&e.position&&n.position.fromArray(e.position),e!=null&&e.rotation&&n.quaternion.fromArray(e.rotation))})}getBone(t){var e;return(e=this.humanBones[t])!=null?e:void 0}getBoneNode(t){var e,n;return(n=(e=this.humanBones[t])==null?void 0:e.node)!=null?n:null}},nT=new X,H_e=new Kt,V_e=new X,oU=class jG extends uP{static _setupTransforms(e){const n=new mn;n.name="VRMHumanoidRig";const r={},i={},s={};tT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=new X,f=new Kt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(d,f,nT),r[a]=d,i[a]=c.quaternion.clone();const m=new Kt;(l=c.parent)==null||l.matrixWorld.decompose(nT,m,nT),s[a]=m}});const o={};return tT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=r[a];let f=a,m;for(;m==null&&(f=B_e[f],f!=null);)m=r[f];const y=new mn;y.name="Normalized_"+c.name,(f?(l=o[f])==null?void 0:l.node:n).add(y),y.position.copy(d),m&&y.position.sub(m),o[a]={node:y}}}),{rigBones:o,root:n,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:s}=jG._setupTransforms(e);super(n),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){tT.forEach(e=>{const n=this.original.getBoneNode(e);if(n!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=H_e.copy(i).invert(),o=this._boneRotations[e];if(n.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition(V_e);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=a.applyMatrix4(l.invert());n.position.copy(c)}}})}},aU=class UG{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 uP(e),this._normalizedHumanBones=new oU(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new uP(e.humanBones),this._normalizedHumanBones=new oU(this._rawHumanBones),this}clone(){return new UG(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()}},G_e={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},W_e=new Set(["1.0","1.0-beta"]),lU={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},$_e=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(t){return jn(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return jn(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 jn(this,null,function*(){var e,n;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(n=r.extensions)==null?void 0:n.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!W_e.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(f=>jn(this,[f],function*([m,y]){let x=m;const S=y.node;if(l){const _=lU[x];_!=null&&(x=_)}const w=yield this.parser.getDependency("node",S);if(w==null){console.warn(`A glTF node bound to the humanoid bone ${x} (index = ${S}) does not exist`);return}c[x]={node:w}}))));const d=new aU(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new sU(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return jn(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>jn(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;if(c<0){console.warn(`A glTF node index for the humanoid bone ${l} is negative (${c}), ignoring this bone.`);return}const d=yield this.parser.getDependency("node",c);if(d==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const f=lU[l],m=f??l;if(s[m]!=null){console.warn(`Multiple bone entries for ${m} detected (index = ${c}), ignoring duplicated entries.`);return}s[m]={node:d}}))));const o=new aU(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new sU(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(t){const e=Object.values(G_e).filter(n=>t[n]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return t}},cU=class extends Qt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new Jt(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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}},X_e=class extends Qt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new X,this._currentTail=new X,this._attrPos=new Jt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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}},I_=new Kt,uU=new Kt,k0=new X,dU=new X,fU=Math.sqrt(2)/2,q_e=new Kt(0,0,-fU,fU),K_e=new X(0,1,0),Y_e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new cU;e.radius=.5;const n=new As({color:65280,transparent:!0,opacity:.5,side:xo,depthTest:!1,depthWrite:!1});this._meshPitch=new yr(e,n),this.add(this._meshPitch)}{const e=new cU;e.radius=.5;const n=new As({color:16711680,transparent:!0,opacity:.5,side:xo,depthTest:!1,depthWrite:!1});this._meshYaw=new yr(e,n),this.add(this._meshYaw)}{const e=new X_e;e.radius=.1;const n=new $r({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new eo(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=gr.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const n=gr.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=n,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(k0),this.vrmLookAt.getLookAtWorldQuaternion(I_),I_.multiply(this.vrmLookAt.getFaceFrontQuaternion(uU)),this._meshYaw.position.copy(k0),this._meshYaw.quaternion.copy(I_),this._meshPitch.position.copy(k0),this._meshPitch.quaternion.copy(I_),this._meshPitch.quaternion.multiply(uU.setFromAxisAngle(K_e,e)),this._meshPitch.quaternion.multiply(q_e);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(dU).sub(k0),this._lineTarget.geometry.tail.copy(dU),this._lineTarget.geometry.update(),this._lineTarget.position.copy(k0)),super.updateMatrixWorld(t)}},Z_e=new X,Q_e=new X;function dP(t,e){return t.matrixWorld.decompose(Z_e,e,Q_e),e}function K_(t){return[Math.atan2(-t.z,t.x),Math.atan2(t.y,Math.sqrt(t.x*t.x+t.z*t.z))]}function hU(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var pU=new X(0,0,1),J_e=new X,ewe=new X,twe=new X,nwe=new Kt,rT=new Kt,mU=new Kt,rwe=new Kt,iT=new as,FG=class zG{constructor(e,n){this.offsetFromHeadBone=new X,this.autoUpdate=!0,this.faceFront=new X(0,0,1),this.humanoid=e,this.applier=n,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new Kt)}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 as)}getEuler(e){return e.set(gr.DEG2RAD*this._pitch,gr.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 zG(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 dP(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(pU)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=K_(this.faceFront);return iT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(iT).premultiply(rwe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(rT),this.getFaceFrontQuaternion(mU),e.copy(pU).applyQuaternion(rT).applyQuaternion(mU).applyEuler(this.getEuler(iT))}lookAt(e){const n=nwe.copy(this._restHeadWorldQuaternion).multiply(DG(this.getLookAtWorldQuaternion(rT))),r=this.getLookAtWorldPosition(ewe),i=twe.copy(e).sub(r).applyQuaternion(n).normalize(),[s,o]=K_(this.faceFront),[a,l]=K_(i),c=hU(a-s),d=hU(o-l);this._yaw=gr.RAD2DEG*c,this._pitch=gr.RAD2DEG*d,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(J_e)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};FG.EULER_ORDER="YXZ";var iwe=FG,swe=new X(0,0,1),ml=new Kt,km=new Kt,Fo=new as(0,0,0,"YXZ"),Y_=class{constructor(t,e,n,r,i){this.humanoid=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new X(0,0,1),this._restQuatLeftEye=new Kt,this._restQuatRightEye=new Kt,this._restLeftEyeParentWorldQuat=new Kt,this._restRightEyeParentWorldQuat=new Kt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),dP(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),dP(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(t,e){const n=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");n&&(e<0?Fo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fo.y=-gr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):Fo.y=gr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),ml.setFromEuler(Fo),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?Fo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fo.y=-gr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):Fo.y=gr.DEG2RAD*this.rangeMapHorizontalInner.map(t),ml.setFromEuler(Fo),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=gr.RAD2DEG*t.y,n=gr.RAD2DEG*t.x;this.applyYawPitch(e,n)}_getWorldFaceFrontQuat(t){if(this.faceFront.distanceToSquared(swe)<.01)return t.identity();const[e,n]=K_(this.faceFront);return Fo.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Fo)}};Y_.type="bone";var fP=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=gr.RAD2DEG*t.y,n=gr.RAD2DEG*t.x;this.applyYawPitch(e,n)}};fP.type="expression";var gU=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*CG(t/this.inputMaxValue)}},owe=new Set(["1.0","1.0-beta"]),k_=.01,awe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return jn(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 jn(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 jn(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!owe.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const d=l.lookAt;if(!d)return null;const f=d.type==="expression"?1:10,m=this._v1ImportRangeMap(d.rangeMapHorizontalInner,f),y=this._v1ImportRangeMap(d.rangeMapHorizontalOuter,f),x=this._v1ImportRangeMap(d.rangeMapVerticalDown,f),S=this._v1ImportRangeMap(d.rangeMapVerticalUp,f);let w;d.type==="expression"?w=new fP(n,m,y,x,S):w=new Y_(e,m,y,x,S);const _=this._importLookAt(e,w);return _.offsetFromHeadBone.fromArray((s=d.offsetFromHeadBone)!=null?s:[0,.06,0]),_})}_v1ImportRangeMap(t,e){var n,r;let i=(n=t==null?void 0:t.inputMaxValue)!=null?n:90;const s=(r=t==null?void 0:t.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},dwe=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()}},fwe=class extends dwe{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)})}},hwe=Object.defineProperty,vU=Object.getOwnPropertySymbols,pwe=Object.prototype.hasOwnProperty,mwe=Object.prototype.propertyIsEnumerable,yU=(t,e,n)=>e in t?hwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xU=(t,e)=>{for(var n in e||(e={}))pwe.call(e,n)&&yU(t,n,e[n]);if(vU)for(var n of vU(e))mwe.call(e,n)&&yU(t,n,e[n]);return t},ch=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),gwe={"":3e3,srgb:3001};function vwe(t,e){parseInt(Td,10)>=152?t.colorSpace=e:t.encoding=gwe[e]}var ywe=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 ch(this,null,function*(){const r=ch(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&&vwe(i,"srgb")}});return this._pendings.push(r),r})}assignTextureByIndex(t,e,n){return ch(this,null,function*(){return this.assignTexture(t,e!=null?{index:e}:void 0,n)})}},xwe=`// #define PHONG + */var k_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),jn=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),Yj=class extends 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 CG(t,e,n){var r,i;const s=t.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,d=[];return n.traverse(f=>{d.length{const s=CG(t,i,r);s!=null&&n.set(i,s)}),n})}var uP={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function PG(t){return Math.max(Math.min(t,1),0)}var Jj=class RG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},n=new Set(Object.values(uP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(uP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new RG().copy(this)}getExpression(e){var n;return(n=this._expressionMap[e])!=null?n:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const n=this._expressions.indexOf(e);n===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(n,1),delete this._expressionMap[e.expressionName]}getValue(e){var n;const r=this.getExpression(e);return(n=r==null?void 0:r.weight)!=null?n:null}setValue(e,n){const r=this.getExpression(e);r&&(r.weight=PG(n))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const n=this.getExpression(e);return n?`${n.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(n=>{n.clearAppliedWeight()}),this._expressions.forEach(n=>{let r=1;const i=n.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),n.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,n=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,n-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),n=Math.max(0,n),r=Math.max(0,r),{blink:e,lookAt:n,mouth:r}}},k0={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},L_e={_Color:k0.Color,_EmissionColor:k0.EmissionColor,_ShadeColor:k0.ShadeColor,_RimColor:k0.RimColor,_OutlineColor:k0.OutlineColor},D_e=new lt,NG=class IG{constructor({material:e,type:n,targetValue:r,targetAlpha:i}){this.material=e,this.type=n,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:n,alpha:r}=this._state;if(n!=null){const{propertyName:i,deltaValue:s}=n,o=this.material[i];o!=null&&o.add(D_e.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:n}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(n!=null){const{propertyName:r,initialValue:i}=n;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,n,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?n:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const d=i[l].clone(),f=new lt(o.r-d.r,o.g-d.g,o.b-d.b);return{propertyName:l,initialValue:d,deltaValue:f}}_initAlphaBindState(){var e,n,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?n:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],d=o-c;return{propertyName:l,initialValue:c,deltaValue:d}}_getPropertyNameMap(){var e,n;return(n=(e=Object.entries(IG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};NG._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var eU=NG,F1=class{constructor({primitives:t,index:e,weight:n}){this.primitives=t,this.index=e,this.weight=n}applyWeight(t){this.primitives.forEach(e=>{var n;((n=e.morphTargetInfluences)==null?void 0:n[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*t)})}clearAppliedWeight(){this.primitives.forEach(t=>{var e;((e=t.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(t.morphTargetInfluences[this.index]=0)})}},tU=new Ge,kG=class OG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const o=(i=Object.entries(OG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const d=c.offset.clone(),f=c.repeat.clone(),m=r.clone().sub(d),y=n.clone().sub(f);this._properties.push({name:a,initialOffset:d,deltaOffset:m,initialScale:f,deltaScale:y})}))}applyWeight(e){this._properties.forEach(n=>{const r=this.material[n.name];r!==void 0&&(r.offset.add(tU.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(tU.copy(n.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const n=this.material[e.name];n!==void 0&&(n.offset.copy(e.initialOffset),n.repeat.copy(e.initialScale))})}};kG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var nU=kG,j_e=new Set(["1.0","1.0-beta"]),LG=class DG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return jn(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return jn(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 jn(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!j_e.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(uP)),d=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([m,y])=>{if(y!=null){if(!c.has(m)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${m}" detected. Ignoring the expression`);return}d.set(m,y)}}),l.custom!=null&&Object.entries(l.custom).forEach(([m,y])=>{if(c.has(m)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${m}". Ignoring the expression`);return}d.set(m,y)});const f=new Jj;return yield Promise.all(Array.from(d.entries()).map(m=>jn(this,[m],function*([y,x]){var S,w,_,E,T,C,O;const N=new Yj(y);if(e.scene.add(N),N.isBinary=(S=x.isBinary)!=null?S:!1,N.overrideBlink=(w=x.overrideBlink)!=null?w:"none",N.overrideLookAt=(_=x.overrideLookAt)!=null?_:"none",N.overrideMouth=(E=x.overrideMouth)!=null?E:"none",(T=x.morphTargetBinds)==null||T.forEach(D=>jn(this,null,function*(){var F;if(D.node===void 0||D.index===void 0)return;const G=yield Zj(e,D.node),k=D.index;if(!G.every(U=>Array.isArray(U.morphTargetInfluences)&&k{const G=F.material;G&&(Array.isArray(G)?D.push(...G):D.push(G))}),(C=x.materialColorBinds)==null||C.forEach(F=>jn(this,null,function*(){D.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{N.addBind(new eU({material:k,type:F.type,targetValue:new lt().fromArray(F.targetValue),targetAlpha:F.targetValue[3]}))})})),(O=x.textureTransformBinds)==null||O.forEach(F=>jn(this,null,function*(){D.filter(k=>{var U;const H=(U=this.parser.associations.get(k))==null?void 0:U.materials;return F.material===H}).forEach(k=>{var U,H;N.addBind(new nU({material:k,offset:new Ge().fromArray((U=F.offset)!=null?U:[0,0]),scale:new Ge().fromArray((H=F.scale)!=null?H:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return jn(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new Jj,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>jn(this,null,function*(){var d;const f=c.presetName,m=f!=null&&DG.v0v1PresetNameMap[f]||null,y=m??c.name;if(y==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(y)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${f} has duplicated entries. Ignoring the expression`);return}l.add(y);const x=new Yj(y);e.scene.add(x),x.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(w=>jn(this,null,function*(){var _;if(w.mesh===void 0||w.index===void 0)return;const E=[];if((_=r.nodes)==null||_.forEach((C,O)=>{C.mesh===w.mesh&&E.push(O)}),E.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(E.map(C=>jn(this,null,function*(){var O;const N=yield Zj(e,C);if(!N.every(D=>Array.isArray(D.morphTargetInfluences)&&T{if(w.materialName===void 0||w.propertyName===void 0||w.targetValue===void 0)return;const _=[];e.scene.traverse(T=>{if(T.material){const C=T.material;Array.isArray(C)?_.push(...C.filter(O=>(O.name===w.materialName||O.name===w.materialName+" (Outline)")&&_.indexOf(O)===-1)):C.name===w.materialName&&_.indexOf(C)===-1&&_.push(C)}});const E=w.propertyName;_.forEach(T=>{if(E==="_MainTex_ST"){const O=new Ge(w.targetValue[0],w.targetValue[1]),N=new Ge(w.targetValue[2],w.targetValue[3]);N.y=1-N.y-O.y,x.addBind(new nU({material:T,scale:O,offset:N}));return}const C=L_e[E];if(C){x.addBind(new eU({material:T,type:C,targetValue:new lt().fromArray(w.targetValue),targetAlpha:w.targetValue[3]}));return}console.warn(E+" is not supported")})}),o.registerExpression(x)}))),o})}};LG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var U_e=LG,oN=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 o=0;o0&&i.includes(f[0])||d[1]>0&&i.includes(f[1])||d[2]>0&&i.includes(f[2])||d[3]>0&&i.includes(f[3]))continue;const m=n[l],y=r[l];if(m[0]>0&&i.includes(y[0])||m[1]>0&&i.includes(y[1])||m[2]>0&&i.includes(y[2])||m[3]>0&&i.includes(y[3]))continue;const x=n[c],S=r[c];x[0]>0&&i.includes(S[0])||x[1]>0&&i.includes(S[1])||x[2]>0&&i.includes(S[2])||x[3]>0&&i.includes(S[3])||(e[s++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,n){const r=new rM(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),o=s instanceof nP?[]:s.array,a=[];for(let S=0;S{this._isEraseTarget(s)&&r.push(o)}),!r.length){n.layers.enable(this._thirdPersonOnlyLayer),n.layers.enable(this._firstPersonOnlyLayer);return}n.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(n,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer));else{const n=new 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}};oN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;oN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var rU=oN,F_e=new Set(["1.0","1.0-beta"]),z_e=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return jn(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 jn(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 jn(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!F_e.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,c=[],d=yield Qj(t);return Array.from(d.entries()).forEach(([f,m])=>{var y,x;const S=(y=l==null?void 0:l.meshAnnotations)==null?void 0:y.find(w=>w.node===f);c.push({meshes:m,type:(x=S==null?void 0:S.type)!=null?x:"auto"})}),new rU(e,c)})}_v0Import(t,e){return jn(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield Qj(t);return Array.from(a.entries()).forEach(([l,c])=>{const d=r.nodes[l],f=s.meshAnnotations?s.meshAnnotations.find(m=>m.mesh===d.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new rU(e,o)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},iU=new X,sU=new X,B_e=new Kt,oU=class extends Ts{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new lG(1);n.matrixAutoUpdate=!1,n.material.depthTest=!1,n.material.depthWrite=!1,this.add(n),this._boneAxesMap.set(e,n)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(t=>{t.geometry.dispose(),t.material.dispose()})}updateMatrixWorld(t){Array.from(this._boneAxesMap.entries()).forEach(([e,n])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(iU,B_e,sU);const r=iU.set(.1,.1,.1).divide(sU);n.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(t)}},nT=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],H_e={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function jG(t){return t.invert?t.invert():t.inverse(),t}var zf=new X,Bf=new Kt,dP=class{constructor(t){this.humanBones=t,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);r&&(zf.copy(r.position),Bf.copy(r.quaternion),t[n]={position:zf.toArray(),rotation:Bf.toArray()})}),t}getPose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);if(!r)return;zf.set(0,0,0),Bf.identity();const i=this.restPose[n];i!=null&&i.position&&zf.fromArray(i.position).negate(),i!=null&&i.rotation&&jG(Bf.fromArray(i.rotation)),zf.add(r.position),Bf.premultiply(r.quaternion),t[n]={position:zf.toArray(),rotation:Bf.toArray()}}),t}setPose(t){Object.entries(t).forEach(([e,n])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(n!=null&&n.position&&(i.position.fromArray(n.position),s.position&&i.position.add(zf.fromArray(s.position))),n!=null&&n.rotation&&(i.quaternion.fromArray(n.rotation),s.rotation&&i.quaternion.multiply(Bf.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([t,e])=>{const n=this.getBoneNode(t);n&&(e!=null&&e.position&&n.position.fromArray(e.position),e!=null&&e.rotation&&n.quaternion.fromArray(e.rotation))})}getBone(t){var e;return(e=this.humanBones[t])!=null?e:void 0}getBoneNode(t){var e,n;return(n=(e=this.humanBones[t])==null?void 0:e.node)!=null?n:null}},rT=new X,V_e=new Kt,G_e=new X,aU=class UG extends dP{static _setupTransforms(e){const n=new mn;n.name="VRMHumanoidRig";const r={},i={},s={};nT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=new X,f=new Kt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(d,f,rT),r[a]=d,i[a]=c.quaternion.clone();const m=new Kt;(l=c.parent)==null||l.matrixWorld.decompose(rT,m,rT),s[a]=m}});const o={};return nT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=r[a];let f=a,m;for(;m==null&&(f=H_e[f],f!=null);)m=r[f];const y=new mn;y.name="Normalized_"+c.name,(f?(l=o[f])==null?void 0:l.node:n).add(y),y.position.copy(d),m&&y.position.sub(m),o[a]={node:y}}}),{rigBones:o,root:n,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:s}=UG._setupTransforms(e);super(n),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){nT.forEach(e=>{const n=this.original.getBoneNode(e);if(n!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=V_e.copy(i).invert(),o=this._boneRotations[e];if(n.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition(G_e);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=a.applyMatrix4(l.invert());n.position.copy(c)}}})}},lU=class FG{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,n){var r;this.autoUpdateHumanBones=(r=n==null?void 0:n.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new dP(e),this._normalizedHumanBones=new aU(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new dP(e.humanBones),this._normalizedHumanBones=new aU(this._rawHumanBones),this}clone(){return new FG(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},W_e={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},$_e=new Set(["1.0","1.0-beta"]),cU={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},X_e=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(t){return jn(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return jn(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 jn(this,null,function*(){var e,n;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(n=r.extensions)==null?void 0:n.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!$_e.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(f=>jn(this,[f],function*([m,y]){let x=m;const S=y.node;if(l){const _=cU[x];_!=null&&(x=_)}const w=yield this.parser.getDependency("node",S);if(w==null){console.warn(`A glTF node bound to the humanoid bone ${x} (index = ${S}) does not exist`);return}c[x]={node:w}}))));const d=new lU(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new oU(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return jn(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>jn(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;if(c<0){console.warn(`A glTF node index for the humanoid bone ${l} is negative (${c}), ignoring this bone.`);return}const d=yield this.parser.getDependency("node",c);if(d==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const f=cU[l],m=f??l;if(s[m]!=null){console.warn(`Multiple bone entries for ${m} detected (index = ${c}), ignoring duplicated entries.`);return}s[m]={node:d}}))));const o=new lU(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new oU(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(t){const e=Object.values(W_e).filter(n=>t[n]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return t}},uU=class extends Qt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new Jt(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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}},q_e=class extends Qt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new X,this._currentTail=new X,this._attrPos=new Jt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},O_=new Kt,dU=new Kt,O0=new X,fU=new X,hU=Math.sqrt(2)/2,K_e=new Kt(0,0,-hU,hU),Y_e=new X(0,1,0),Z_e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new uU;e.radius=.5;const n=new As({color:65280,transparent:!0,opacity:.5,side:xo,depthTest:!1,depthWrite:!1});this._meshPitch=new yr(e,n),this.add(this._meshPitch)}{const e=new uU;e.radius=.5;const n=new As({color:16711680,transparent:!0,opacity:.5,side:xo,depthTest:!1,depthWrite:!1});this._meshYaw=new yr(e,n),this.add(this._meshYaw)}{const e=new q_e;e.radius=.1;const n=new $r({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new eo(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=gr.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const n=gr.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=n,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(O0),this.vrmLookAt.getLookAtWorldQuaternion(O_),O_.multiply(this.vrmLookAt.getFaceFrontQuaternion(dU)),this._meshYaw.position.copy(O0),this._meshYaw.quaternion.copy(O_),this._meshPitch.position.copy(O0),this._meshPitch.quaternion.copy(O_),this._meshPitch.quaternion.multiply(dU.setFromAxisAngle(Y_e,e)),this._meshPitch.quaternion.multiply(K_e);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(fU).sub(O0),this._lineTarget.geometry.tail.copy(fU),this._lineTarget.geometry.update(),this._lineTarget.position.copy(O0)),super.updateMatrixWorld(t)}},Q_e=new X,J_e=new X;function fP(t,e){return t.matrixWorld.decompose(Q_e,e,J_e),e}function Y_(t){return[Math.atan2(-t.z,t.x),Math.atan2(t.y,Math.sqrt(t.x*t.x+t.z*t.z))]}function pU(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var mU=new X(0,0,1),ewe=new X,twe=new X,nwe=new X,rwe=new Kt,iT=new Kt,gU=new Kt,iwe=new Kt,sT=new as,zG=class BG{constructor(e,n){this.offsetFromHeadBone=new X,this.autoUpdate=!0,this.faceFront=new X(0,0,1),this.humanoid=e,this.applier=n,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new Kt)}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 as)}getEuler(e){return e.set(gr.DEG2RAD*this._pitch,gr.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new BG(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const n=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(n.matrixWorld)}getLookAtWorldQuaternion(e){const n=this.humanoid.getRawBoneNode("head");return fP(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(mU)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=Y_(this.faceFront);return sT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(sT).premultiply(iwe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(iT),this.getFaceFrontQuaternion(gU),e.copy(mU).applyQuaternion(iT).applyQuaternion(gU).applyEuler(this.getEuler(sT))}lookAt(e){const n=rwe.copy(this._restHeadWorldQuaternion).multiply(jG(this.getLookAtWorldQuaternion(iT))),r=this.getLookAtWorldPosition(twe),i=nwe.copy(e).sub(r).applyQuaternion(n).normalize(),[s,o]=Y_(this.faceFront),[a,l]=Y_(i),c=pU(a-s),d=pU(o-l);this._yaw=gr.RAD2DEG*c,this._pitch=gr.RAD2DEG*d,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(ewe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};zG.EULER_ORDER="YXZ";var swe=zG,owe=new X(0,0,1),ml=new Kt,km=new Kt,Fo=new as(0,0,0,"YXZ"),Z_=class{constructor(t,e,n,r,i){this.humanoid=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new X(0,0,1),this._restQuatLeftEye=new Kt,this._restQuatRightEye=new Kt,this._restLeftEyeParentWorldQuat=new Kt,this._restRightEyeParentWorldQuat=new Kt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),fP(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),fP(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(t,e){const n=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");n&&(e<0?Fo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fo.y=-gr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):Fo.y=gr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),ml.setFromEuler(Fo),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?Fo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):Fo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?Fo.y=-gr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):Fo.y=gr.DEG2RAD*this.rangeMapHorizontalInner.map(t),ml.setFromEuler(Fo),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=gr.RAD2DEG*t.y,n=gr.RAD2DEG*t.x;this.applyYawPitch(e,n)}_getWorldFaceFrontQuat(t){if(this.faceFront.distanceToSquared(owe)<.01)return t.identity();const[e,n]=Y_(this.faceFront);return Fo.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(Fo)}};Z_.type="bone";var hP=class{constructor(t,e,n,r,i){this.expressions=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(t,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),t<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-t))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(t)))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=gr.RAD2DEG*t.y,n=gr.RAD2DEG*t.x;this.applyYawPitch(e,n)}};hP.type="expression";var vU=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*PG(t/this.inputMaxValue)}},awe=new Set(["1.0","1.0-beta"]),L_=.01,lwe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return jn(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 jn(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 jn(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!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,m=this._v1ImportRangeMap(d.rangeMapHorizontalInner,f),y=this._v1ImportRangeMap(d.rangeMapHorizontalOuter,f),x=this._v1ImportRangeMap(d.rangeMapVerticalDown,f),S=this._v1ImportRangeMap(d.rangeMapVerticalUp,f);let w;d.type==="expression"?w=new hP(n,m,y,x,S):w=new Z_(e,m,y,x,S);const _=this._importLookAt(e,w);return _.offsetFromHeadBone.fromArray((s=d.offsetFromHeadBone)!=null?s:[0,.06,0]),_})}_v1ImportRangeMap(t,e){var n,r;let i=(n=t==null?void 0:t.inputMaxValue)!=null?n:90;const s=(r=t==null?void 0:t.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},fwe=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()}},hwe=class extends fwe{constructor(t){super(t),this.materials=t.materials,this.springBoneManager=t.springBoneManager,this.nodeConstraintManager=t.nodeConstraintManager}update(t){super.update(t),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(t),this.materials&&this.materials.forEach(e=>{e.update&&e.update(t)})}},pwe=Object.defineProperty,yU=Object.getOwnPropertySymbols,mwe=Object.prototype.hasOwnProperty,gwe=Object.prototype.propertyIsEnumerable,xU=(t,e,n)=>e in t?pwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bU=(t,e)=>{for(var n in e||(e={}))mwe.call(e,n)&&xU(t,n,e[n]);if(yU)for(var n of yU(e))gwe.call(e,n)&&xU(t,n,e[n]);return t},ch=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),vwe={"":3e3,srgb:3001};function ywe(t,e){parseInt(Td,10)>=152?t.colorSpace=e:t.encoding=vwe[e]}var xwe=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 lt().fromArray(e);n&&r.convertSRGBToLinear(),this._materialParams[t]=r}}assignTexture(t,e,n){return ch(this,null,function*(){const r=ch(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&&ywe(i,"srgb")}});return this._pendings.push(r),r})}assignTextureByIndex(t,e,n){return ch(this,null,function*(){return this.assignTexture(t,e!=null?{index:e}:void 0,n)})}},bwe=`// #define PHONG varying vec3 vViewPosition; @@ -4586,7 +4591,7 @@ void main() { #include #include -}`,bwe=`// #define PHONG +}`,_we=`// #define PHONG uniform vec3 litFactor; @@ -5399,9 +5404,9 @@ void main() { gl_FragColor = vec4( col, diffuseColor.a ); postCorrection(); } -`,_we={None:"none"},bU={None:"none",ScreenCoordinates:"screenCoordinates"},wwe={3e3:"",3001:"srgb"};function sT(t){return parseInt(Td,10)>=152?t.colorSpace:wwe[t.encoding]}var Swe=class extends Qo{constructor(t={}){var e;super({vertexShader:xwe,fragmentShader:bwe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=lu,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=_we.None,this._outlineWidthMode=bU.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([ht.common,ht.normalmap,ht.emissivemap,ht.fog,ht.lights,{litFactor:{value:new ct(1,1,1)},mapUvTransform:{value:new qt},colorAlpha:{value:1},normalMapUvTransform:{value:new qt},shadeColorFactor:{value:new ct(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new qt},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new qt},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ct(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new qt},parametricRimColorFactor:{value:new ct(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new qt},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ct(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new qt},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new qt},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ct(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new qt},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=t.uniforms)!=null?e:{}]),this.setValues(t),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([n,r])=>`${n}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${sT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${sT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${sT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(Td,10),i=Object.entries(xU(xU({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` +`,wwe={None:"none"},_U={None:"none",ScreenCoordinates:"screenCoordinates"},Swe={3e3:"",3001:"srgb"};function oT(t){return parseInt(Td,10)>=152?t.colorSpace:Swe[t.encoding]}var Mwe=class extends Qo{constructor(t={}){var e;super({vertexShader:bwe,fragmentShader:_we}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=lu,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=wwe.None,this._outlineWidthMode=_U.None,this._isOutline=!1,t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,t.fog=!0,t.lights=!0,t.clipping=!0,this.uniforms=CR.merge([pt.common,pt.normalmap,pt.emissivemap,pt.fog,pt.lights,{litFactor:{value:new lt(1,1,1)},mapUvTransform:{value:new qt},colorAlpha:{value:1},normalMapUvTransform:{value:new qt},shadeColorFactor:{value:new lt(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new qt},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new qt},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new lt(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new qt},parametricRimColorFactor:{value:new lt(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new qt},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new lt(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new qt},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new qt},outlineWidthFactor:{value:0},outlineColorFactor:{value:new lt(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new qt},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=t.uniforms)!=null?e:{}]),this.setValues(t),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([n,r])=>`${n}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${oT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${oT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${oT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(Td,10),i=Object.entries(bU(bU({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` `)+` -`;n.vertexShader=i+n.vertexShader,n.fragmentShader=i+n.fragmentShader,r<154&&(n.fragmentShader=n.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(t){this.uniforms.litFactor.value=t}get map(){return this.uniforms.map.value}set map(t){this.uniforms.map.value=t}get normalMap(){return this.uniforms.normalMap.value}set normalMap(t){this.uniforms.normalMap.value=t}get normalScale(){return this.uniforms.normalScale.value}set normalScale(t){this.uniforms.normalScale.value=t}get emissive(){return this.uniforms.emissive.value}set emissive(t){this.uniforms.emissive.value=t}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(t){this.uniforms.emissiveIntensity.value=t}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(t){this.uniforms.emissiveMap.value=t}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(t){this.uniforms.shadeColorFactor.value=t}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(t){this.uniforms.shadeMultiplyTexture.value=t}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(t){this.uniforms.shadingShiftFactor.value=t}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(t){this.uniforms.shadingShiftTexture.value=t}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(t){this.uniforms.shadingShiftTextureScale.value=t}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(t){this.uniforms.shadingToonyFactor.value=t}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(t){this.uniforms.giEqualizationFactor.value=t}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(t){this.uniforms.matcapFactor.value=t}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(t){this.uniforms.matcapTexture.value=t}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(t){this.uniforms.parametricRimColorFactor.value=t}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(t){this.uniforms.rimMultiplyTexture.value=t}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(t){this.uniforms.rimLightingMixFactor.value=t}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(t){this.uniforms.parametricRimFresnelPowerFactor.value=t}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(t){this.uniforms.parametricRimLiftFactor.value=t}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(t){this.uniforms.outlineWidthMultiplyTexture.value=t}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(t){this.uniforms.outlineWidthFactor.value=t}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(t){this.uniforms.outlineColorFactor.value=t}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(t){this.uniforms.outlineLightingMixFactor.value=t}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(t){this.uniforms.uvAnimationMaskTexture.value=t}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(t){this.uniforms.uvAnimationScrollXOffset.value=t}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(t){this.uniforms.uvAnimationScrollYOffset.value=t}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(t){this.uniforms.uvAnimationRotationPhase.value=t}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(t){this._ignoreVertexColor=t,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(t){this._v0CompatShade=t,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(t){this._debugMode=t,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(t){this._outlineWidthMode=t,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(t){this._isOutline=t,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(t){this._uploadUniformsWorkaround(),this._updateUVAnimation(t)}copy(t){return super.copy(t),this.map=t.map,this.normalMap=t.normalMap,this.emissiveMap=t.emissiveMap,this.shadeMultiplyTexture=t.shadeMultiplyTexture,this.shadingShiftTexture=t.shadingShiftTexture,this.matcapTexture=t.matcapTexture,this.rimMultiplyTexture=t.rimMultiplyTexture,this.outlineWidthMultiplyTexture=t.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=t.uvAnimationMaskTexture,this.normalMapType=t.normalMapType,this.uvAnimationScrollXSpeedFactor=t.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=t.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=t.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=t.ignoreVertexColor,this.v0CompatShade=t.v0CompatShade,this.debugMode=t.debugMode,this.outlineWidthMode=t.outlineWidthMode,this.isOutline=t.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(t){this.uniforms.uvAnimationScrollXOffset.value+=t*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=t*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=t*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const t=parseInt(Td,10),e=this.outlineWidthMultiplyTexture!==null,n=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:t,OUTLINE:this._isOutline,MTOON_USE_UV:e||n,MTOON_UVS_VERTEX_ONLY:e&&!n,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===bU.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},Mwe=new Set(["1.0","1.0-beta"]),BG=class Z_{get name(){return Z_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,o;this.parser=e,this.materialType=(r=n.materialType)!=null?r:Swe,this.renderOrderOffset=(i=n.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(o=n.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return ch(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return ch(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 ch(this,null,function*(){var n;const r=this.parser,s=(n=r.json.meshes)==null?void 0:n[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[Z_.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!Mwe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Z_.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,n){return ch(this,null,function*(){var r;delete n.metalness,delete n.roughness;const i=new ywe(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=ss,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)}};BG.EXTENSION_NAME="VRMC_materials_mtoon";var Ewe=BG,Awe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),HG=class hP{get name(){return hP.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Awe(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;n.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[hP.EXTENSION_NAME];if(a!=null)return a}};HG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Twe=HG,Cwe=Object.defineProperty,Pwe=Object.defineProperties,Rwe=Object.getOwnPropertyDescriptors,_U=Object.getOwnPropertySymbols,Nwe=Object.prototype.hasOwnProperty,Iwe=Object.prototype.propertyIsEnumerable,wU=(t,e,n)=>e in t?Cwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gl=(t,e)=>{for(var n in e||(e={}))Nwe.call(e,n)&&wU(t,n,e[n]);if(_U)for(var n of _U(e))Iwe.call(e,n)&&wU(t,n,e[n]);return t},SU=(t,e)=>Pwe(t,Rwe(e)),kwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())});function Om(t){return Math.pow(t,2.2)}var Owe=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(t){var e;this.parser=t,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const n=this.parser.json;n.extensionsUsed=(e=n.extensionsUsed)!=null?e:[],n.extensionsUsed.indexOf("KHR_texture_transform")===-1&&n.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return kwe(this,null,function*(){var t;const e=this.parser.json,n=(t=e.extensions)==null?void 0:t.VRM,r=n==null?void 0:n.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(t,e){var n,r,i,s,o,a,l,c,d,f,m,y,x,S,w,_,E,T,C,O,N,D,F,V,k,U,H,ne,te,he,oe,fe,B,q,K,$,Z,ge,le,ue,_e,Se,qe,Me,We,Ke,ce,Q,Ge,De,Xe,Je,bt,at,ee;const W=(r=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?r:!1,ze=((i=t.floatProperties)==null?void 0:i._ZWrite)===1&&W,He=this._v0ParseRenderQueue(t),Be=(o=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,pt=W?"BLEND":Be?"MASK":"OPAQUE",nt=Be?(l=(a=t.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,rt=((d=(c=t.floatProperties)==null?void 0:c._CullMode)!=null?d:2)===0,$e=this._portTextureTransform(t),ut=((m=(f=t.vectorProperties)==null?void 0:f._Color)!=null?m:[1,1,1,1]).map((it,xt)=>xt===3?it:Om(it)),Dt=(y=t.textureProperties)==null?void 0:y._MainTex,Et=Dt!=null?{index:Dt,extensions:gl({},$e)}:void 0,mt=(S=(x=t.floatProperties)==null?void 0:x._BumpScale)!=null?S:1,de=(w=t.textureProperties)==null?void 0:w._BumpMap,J=de!=null?{index:de,scale:mt,extensions:gl({},$e)}:void 0,Ae=((E=(_=t.vectorProperties)==null?void 0:_._EmissionColor)!=null?E:[0,0,0,1]).map(Om),re=(T=t.textureProperties)==null?void 0:T._EmissionMap,Ue=re!=null?{index:re,extensions:gl({},$e)}:void 0,Te=((O=(C=t.vectorProperties)==null?void 0:C._ShadeColor)!=null?O:[.97,.81,.86,1]).map(Om),Oe=(N=t.textureProperties)==null?void 0:N._ShadeTexture,Ye=Oe!=null?{index:Oe,extensions:gl({},$e)}:void 0;let ft=(F=(D=t.floatProperties)==null?void 0:D._ShadeShift)!=null?F:0,Yt=(k=(V=t.floatProperties)==null?void 0:V._ShadeToony)!=null?k:.9;Yt=gr.lerp(Yt,1,.5+.5*ft),ft=-ft-(1-Yt);const un=(H=(U=t.floatProperties)==null?void 0:U._IndirectLightIntensity)!=null?H:.1,Cn=un?1-un:void 0,en=(ne=t.textureProperties)==null?void 0:ne._SphereAdd,Hn=en!=null?[1,1,1]:void 0,hr=en!=null?{index:en}:void 0,Si=(he=(te=t.floatProperties)==null?void 0:te._RimLightingMix)!=null?he:0,ra=(oe=t.textureProperties)==null?void 0:oe._RimTexture,Mi=ra!=null?{index:ra,extensions:gl({},$e)}:void 0,Ka=((B=(fe=t.vectorProperties)==null?void 0:fe._RimColor)!=null?B:[0,0,0,1]).map(Om),Ns=(K=(q=t.floatProperties)==null?void 0:q._RimFresnelPower)!=null?K:1,ia=(Z=($=t.floatProperties)==null?void 0:$._RimLift)!=null?Z:0,Ei=["none","worldCoordinates","screenCoordinates"][(le=(ge=t.floatProperties)==null?void 0:ge._OutlineWidthMode)!=null?le:0];let Ao=(_e=(ue=t.floatProperties)==null?void 0:ue._OutlineWidth)!=null?_e:0;Ao=.01*Ao;const sa=(Se=t.textureProperties)==null?void 0:Se._OutlineWidthTexture,cu=sa!=null?{index:sa,extensions:gl({},$e)}:void 0,uu=((Me=(qe=t.vectorProperties)==null?void 0:qe._OutlineColor)!=null?Me:[0,0,0]).map(Om),du=((Ke=(We=t.floatProperties)==null?void 0:We._OutlineColorMode)!=null?Ke:0)===1?(Q=(ce=t.floatProperties)==null?void 0:ce._OutlineLightingMix)!=null?Q:1:0,Gl=(Ge=t.textureProperties)==null?void 0:Ge._UvAnimMaskTexture,Y=Gl!=null?{index:Gl,extensions:gl({},$e)}:void 0,xe=(Xe=(De=t.floatProperties)==null?void 0:De._UvAnimScrollX)!=null?Xe:0;let Pe=(bt=(Je=t.floatProperties)==null?void 0:Je._UvAnimScrollY)!=null?bt:0;Pe!=null&&(Pe=-Pe);const Ie=(ee=(at=t.floatProperties)==null?void 0:at._UvAnimRotation)!=null?ee:0,we={specVersion:"1.0",transparentWithZWrite:ze,renderQueueOffsetNumber:He,shadeColorFactor:Te,shadeMultiplyTexture:Ye,shadingShiftFactor:ft,shadingToonyFactor:Yt,giEqualizationFactor:Cn,matcapFactor:Hn,matcapTexture:hr,rimLightingMixFactor:Si,rimMultiplyTexture:Mi,parametricRimColorFactor:Ka,parametricRimFresnelPowerFactor:Ns,parametricRimLiftFactor:ia,outlineWidthMode:Ei,outlineWidthFactor:Ao,outlineWidthMultiplyTexture:cu,outlineColorFactor:uu,outlineLightingMixFactor:du,uvAnimationMaskTexture:Y,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Pe,uvAnimationRotationSpeedFactor:Ie};return SU(gl({},e),{pbrMetallicRoughness:{baseColorFactor:ut,baseColorTexture:Et},normalTexture:J,emissiveTexture:Ue,emissiveFactor:Ae,alphaMode:pt,alphaCutoff:nt,doubleSided:rt,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(t,e){var n,r,i,s,o;const a=t.shader==="VRM/UnlitTransparentZWrite",l=t.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",f=l?"BLEND":d?"MASK":"OPAQUE",m=d?(r=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?r:.5:void 0,y=this._portTextureTransform(t),x=((s=(i=t.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Om),S=(o=t.textureProperties)==null?void 0:o._MainTex,w=S!=null?{index:S,extensions:gl({},y)}:void 0,_={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:x,shadeMultiplyTexture:w};return SU(gl({},e),{pbrMetallicRoughness:{baseColorFactor:x,baseColorTexture:w},alphaMode:f,alphaCutoff:m,extensions:{VRMC_materials_mtoon:_}})}_portTextureTransform(t){var e,n,r,i,s;const o=(e=t.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(n=o==null?void 0:o[0])!=null?n:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(t){var e,n;const r=t.shader==="VRM/UnlitTransparentZWrite",i=((e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||t.shader==="VRM/UnlitTransparent"||r,s=((n=t.floatProperties)==null?void 0:n._ZWrite)===1||r;let o=0;if(i){const a=t.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(t){const e=new Set,n=new Set;t.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?n.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(n).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},MU=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),id=new X,oT=class extends Ts{constructor(t){super(),this._attrPosition=new Jt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(n6);const e=new Qt;e.setAttribute("position",this._attrPosition);const n=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new zl(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){id.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,id.x,id.y,id.z),this.constraint.source&&id.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,id.x,id.y,id.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function EU(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Lwe=new X,Dwe=new X;function jwe(t,e){return t.decompose(Lwe,e,Dwe),e}function F1(t){return t.invert?t.invert():t.inverse(),t}var oN=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},Uwe=new X,Fwe=new X,zwe=new X,Bwe=new Kt,Hwe=new Kt,Vwe=new Kt,Gwe=class extends oN{get aimAxis(){return this._aimAxis}set aimAxis(t){this._aimAxis=t,this._v3AimAxis.set(t==="PositiveX"?1:t==="NegativeX"?-1:0,t==="PositiveY"?1:t==="NegativeY"?-1:0,t==="PositiveZ"?1:t==="NegativeZ"?-1:0)}get dependencies(){const t=new Set([this.source]);return this.destination.parent&&t.add(this.destination.parent),t}constructor(t,e){super(t,e),this._aimAxis="PositiveX",this._v3AimAxis=new X(1,0,0),this._dstRestQuat=new Kt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const t=Bwe.identity(),e=Hwe.identity();this.destination.parent&&(jwe(this.destination.parent.matrixWorld,t),F1(e.copy(t)));const n=Uwe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=EU(this.source.matrixWorld,Fwe).sub(EU(this.destination.matrixWorld,zwe)).normalize(),i=Vwe.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function Wwe(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var $we=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)Wwe(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,n,r)});r(t),n.add(t)}},Xwe=new Kt,qwe=new Kt,Kwe=class extends oN{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new Kt,this._invSrcRestQuat=new Kt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),F1(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const t=Xwe.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=qwe.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Ywe=new X,Zwe=new Kt,Qwe=new Kt,Jwe=class extends oN{get rollAxis(){return this._rollAxis}set rollAxis(t){this._rollAxis=t,this._v3RollAxis.set(t==="X"?1:0,t==="Y"?1:0,t==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._rollAxis="X",this._v3RollAxis=new X(1,0,0),this._dstRestQuat=new Kt,this._invDstRestQuat=new Kt,this._invSrcRestQuatMulDstRestQuat=new Kt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),F1(this._invDstRestQuat.copy(this._dstRestQuat)),F1(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const t=Zwe.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Ywe.copy(this._v3RollAxis).applyQuaternion(t),r=Qwe.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},e1e=new Set(["1.0","1.0-beta"]),VG=class V0{get name(){return V0.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return MU(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return MU(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf(V0.EXTENSION_NAME))!==-1))return null;const s=new $we,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const d=r.nodes[l],f=(c=d==null?void 0:d.extensions)==null?void 0:c[V0.EXTENSION_NAME];if(f==null)return;const m=f.specVersion;if(!e1e.has(m)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${V0.EXTENSION_NAME} specVersion "${m}"`);return}const y=f.constraint;if(y.roll!=null){const x=this._importRollConstraint(a,o,y.roll);s.addConstraint(x)}else if(y.aim!=null){const x=this._importAimConstraint(a,o,y.aim);s.addConstraint(x)}else if(y.rotation!=null){const x=this._importRotationConstraint(a,o,y.rotation);s.addConstraint(x)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,r){const{source:i,rollAxis:s,weight:o}=r,a=n[i],l=new Jwe(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new oT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:o}=r,a=n[i],l=new Gwe(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new oT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,o=n[i],a=new Kwe(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new oT(a);this.helperRoot.add(l)}return a}};VG.EXTENSION_NAME="VRMC_node_constraint";var t1e=VG,O_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),aN=class{},aT=new X,Hf=new X,GG=class extends aN{get type(){return"capsule"}constructor(t){var e,n,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new X(0,0,0),this.radius=(r=t==null?void 0:t.radius)!=null?r:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,n,r){aT.setFromMatrixPosition(t),Hf.subVectors(this.tail,this.offset).applyMatrix4(t),Hf.sub(aT);const i=Hf.lengthSq();r.copy(e).sub(aT);const s=Hf.dot(r);s<=0||(i<=s||Hf.multiplyScalar(s/i),r.sub(Hf));const o=r.length(),a=this.inside?this.radius-n-o:o-n-this.radius;return a<0&&(r.multiplyScalar(1/o),this.inside&&r.negate()),a}},lT=new X,AU=new qt,WG=class extends aN{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new X(0,0,1)}calculateCollision(t,e,n,r){r.setFromMatrixPosition(t),r.negate().add(e),AU.getNormalMatrix(t),lT.copy(this.normal).applyNormalMatrix(AU).normalize();const i=r.dot(lT)-n;return r.copy(lT),i}},n1e=new X,$G=class extends aN{get type(){return"sphere"}constructor(t){var e,n,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0,this.inside=(r=t==null?void 0:t.inside)!=null?r:!1}calculateCollision(t,e,n,r){r.subVectors(e,n1e.setFromMatrixPosition(t));const i=r.length(),s=this.inside?this.radius-n-i:i-n-this.radius;return s<0&&(r.multiplyScalar(1/i),this.inside&&r.negate()),s}},vl=new X,r1e=class extends Qt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._currentTail=new X,this._shape=t,this._attrPos=new Jt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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}},i1e=class extends Qt{constructor(t){super(),this.worldScale=1,this._currentOffset=new X,this._currentNormal=new X,this._shape=t,this._attrPos=new Jt(new Float32Array(18),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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}},s1e=class extends Qt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._shape=t,this._attrPos=new Jt(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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}},o1e=new X,cT=class extends Ts{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof $G)this._geometry=new s1e(this.collider.shape);else if(this.collider.shape instanceof GG)this._geometry=new r1e(this.collider.shape);else if(this.collider.shape instanceof WG)this._geometry=new i1e(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 eo(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=o1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},a1e=class extends Qt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new X,this._springBone=t,this._attrPos=new Jt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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}},l1e=new X,c1e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new a1e(this.springBone);const e=new $r({color:16776960,depthTest:!1,depthWrite:!1});this._line=new eo(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=l1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},uT=class extends mn{constructor(t){super(),this.colliderMatrix=new Rt,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),u1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function u1e(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 d1e=new Rt;function f1e(t){return t.invert?t.invert():t.getInverse(d1e.copy(t)),t}var h1e=class{constructor(t){this._inverseCache=new Rt,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&&(f1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},dT=new Rt,Lm=new X,O0=new X,L0=new X,D0=new X,p1e=new Rt,m1e=class{constructor(t,e,n={},r=[]){this._currentTail=new X,this._prevTail=new X,this._boneAxis=new X,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Rt,this._initialLocalRotation=new Kt,this._initialLocalChildPosition=new X;var i,s,o,a,l,c;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=n.hitRadius)!=null?i:0,stiffness:(s=n.stiffness)!=null?s:1,gravityPower:(o=n.gravityPower)!=null?o:0,gravityDir:(l=(a=n.gravityDir)==null?void 0:a.clone())!=null?l:new X(0,-1,0),dragForce:(c=n.dragForce)!=null?c:.4},this.colliderGroups=r}get dependencies(){const t=new Set,e=this.bone.parent;e&&t.add(e);for(let n=0;n{e(i)})}function pP(t,e){t.children.forEach(n=>{e(n)||pP(n,e)})}function v1e(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 TU=class{constructor(){this._joints=new Set,this._sortedJoints=[],this._hasWarnedCircularDependency=!1,this._ancestors=[],this._objectSpringBonesMap=new Map,this._isSortedJointsDirty=!1,this._relevantChildrenUpdated=this._relevantChildrenUpdated.bind(this)}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const t=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(n=>{t.add(n)})}),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{t.add(n)})}),Array.from(t)}addJoint(t){this._joints.add(t);let e=this._objectSpringBonesMap.get(t.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t),this._isSortedJointsDirty=!0}addSpringBone(t){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(t)}deleteJoint(t){this._joints.delete(t),this._objectSpringBonesMap.get(t.bone).delete(t),this._isSortedJointsDirty=!0}deleteSpringBone(t){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(t)}setInitState(){this._sortJoints();for(let t=0;t{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(this._ancestors.push(s),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(t,e,n,r,i){if(n.has(t))return;if(e.has(t)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}e.add(t);const s=t.dependencies;for(const o of s){let a=!1,l=null;g1e(o,c=>{const d=this._objectSpringBonesMap.get(c);if(d)for(const f of d)a=!0,this._insertJointSort(f,e,n,r,i);else a||(l=c)}),l&&i.add(l)}r.push(t),n.add(t)}_relevantChildrenUpdated(t){var e,n;return((n=(e=this._objectSpringBonesMap.get(t))==null?void 0:e.size)!=null?n:0)>0?!0:(t.updateWorldMatrix(!1,!1),!1)}},CU="VRMC_springBone_extended_collider",y1e=new Set(["1.0","1.0-beta"]),x1e=new Set(["1.0"]),XG=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 O_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return O_(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 O_(this,null,function*(){var n,r,i,s,o;const a=e.parser.json;if(!(((n=a.extensionsUsed)==null?void 0:n.indexOf(Hm.EXTENSION_NAME))!==-1))return null;const c=new TU,d=yield e.parser.getDependencies("node"),f=(r=a.extensions)==null?void 0:r[Hm.EXTENSION_NAME];if(!f)return null;const m=f.specVersion;if(!y1e.has(m))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Hm.EXTENSION_NAME} specVersion "${m}"`),null;const y=(i=f.colliders)==null?void 0:i.map((S,w)=>{var _,E,T,C,O,N,D,F,V,k,U,H,ne,te,he;const oe=d[S.node];if(oe==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} attempted to reference a node #${S.node} but not found. Skipping the collider`),null;const fe=S.shape,B=(_=S.extensions)==null?void 0:_[CU];if(this.useExtendedColliders&&B!=null){const q=B.specVersion;if(!x1e.has(q))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${CU} specVersion "${q}". Fallbacking to the ${Hm.EXTENSION_NAME} definition`);else{const K=B.shape;if(K.sphere)return this._importSphereCollider(oe,{offset:new X().fromArray((E=K.sphere.offset)!=null?E:[0,0,0]),radius:(T=K.sphere.radius)!=null?T:0,inside:(C=K.sphere.inside)!=null?C:!1});if(K.capsule)return this._importCapsuleCollider(oe,{offset:new X().fromArray((O=K.capsule.offset)!=null?O:[0,0,0]),radius:(N=K.capsule.radius)!=null?N:0,tail:new X().fromArray((D=K.capsule.tail)!=null?D:[0,0,0]),inside:(F=K.capsule.inside)!=null?F:!1});if(K.plane)return this._importPlaneCollider(oe,{offset:new X().fromArray((V=K.plane.offset)!=null?V:[0,0,0]),normal:new X().fromArray((k=K.plane.normal)!=null?k:[0,0,1])})}}if(fe.sphere)return this._importSphereCollider(oe,{offset:new X().fromArray((U=fe.sphere.offset)!=null?U:[0,0,0]),radius:(H=fe.sphere.radius)!=null?H:0,inside:!1});if(fe.capsule)return this._importCapsuleCollider(oe,{offset:new X().fromArray((ne=fe.capsule.offset)!=null?ne:[0,0,0]),radius:(te=fe.capsule.radius)!=null?te:0,tail:new X().fromArray((he=fe.capsule.tail)!=null?he:[0,0,0]),inside:!1});console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} has no valid shape. Skipping the collider`)}),x=(s=f.colliderGroups)==null?void 0:s.map((S,w)=>{var _;return{colliders:((_=S.colliders)!=null?_:[]).map(T=>{const C=y==null?void 0:y[T];return C??(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${w} attempted to reference a collider #${T} but not found. Skipping the collider`),null)}).filter(T=>T!=null),name:S.name}});return(o=f.springs)==null||o.forEach((S,w)=>{var _;const E=S.joints,T=(_=S.colliderGroups)==null?void 0:_.map(N=>{const D=x==null?void 0:x[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),C=S.center!=null?d[S.center]:void 0;let O;E.forEach(N=>{if(O){const D=O.node,F=d[D],V=N.node,k=d[V],U={hitRadius:O.hitRadius,dragForce:O.dragForce,gravityPower:O.gravityPower,stiffness:O.stiffness,gravityDir:O.gravityDir!=null?new X().fromArray(O.gravityDir):void 0},H=this._importJoint(F,k,U,T);C&&(H.center=C),c.addJoint(H)}O=N})}),c.setInitState(),c})}_v0Import(e){return O_(this,null,function*(){var n,r,i;const s=e.parser.json;if(!(((n=s.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const d=new TU,f=yield e.parser.getDependencies("node"),m=(i=l.colliderGroups)==null?void 0:i.map((y,x)=>{var S;const w=f[y.node];return w==null?(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${x} attempted to reference a node #${y.node} but not found. Skipping the collider group`),null):{colliders:((S=y.colliders)!=null?S:[]).map((E,T)=>{var C,O,N;const D=new X(0,0,0);return E.offset&&D.set((C=E.offset.x)!=null?C:0,(O=E.offset.y)!=null?O:0,E.offset.z?-E.offset.z:0),this._importSphereCollider(w,{offset:D,radius:(N=E.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,x)=>{const S=y.bones;S&&S.forEach(w=>{var _,E,T,C;const O=f[w];if(O==null){console.warn(`VRMSpringBoneLoaderPlugin: The spring bone group #${x} attempted to reference a node #${w} but not found. Skipping the node`);return}const N=new X;y.gravityDir?N.set((_=y.gravityDir.x)!=null?_:0,(E=y.gravityDir.y)!=null?E:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const D=y.center!=null?f[y.center]:void 0,F={hitRadius:y.hitRadius,dragForce:y.dragForce,gravityPower:y.gravityPower,stiffness:y.stiffiness,gravityDir:N},V=(C=y.colliderGroups)==null?void 0:C.map(k=>{const U=m==null?void 0:m[k];return U??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${x} attempted to reference a collider group #${k} but not found. Skipping the collider group`),null)}).filter(k=>k!=null);O.traverse(k=>{var U;const H=(U=k.children[0])!=null?U:null,ne=this._importJoint(k,H,F,V);D&&(ne.center=D),d.addJoint(ne)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new m1e(e,n,r,i);if(this.jointHelperRoot){const o=new c1e(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new $G(n),i=new uT(r);if(e.add(i),this.colliderHelperRoot){const s=new cT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,n){const r=new GG(n),i=new uT(r);if(e.add(i),this.colliderHelperRoot){const s=new cT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,n){const r=new WG(n),i=new uT(r);if(e.add(i),this.colliderHelperRoot){const s=new cT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};XG.EXTENSION_NAME="VRMC_springBone";var b1e=XG,_1e=class{get name(){return"VRMLoaderPlugin"}constructor(t,e){var n,r,i,s,o,a,l,c,d,f;this.parser=t;const m=e==null?void 0:e.helperRoot,y=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(n=e==null?void 0:e.expressionPlugin)!=null?n:new j_e(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new F_e(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new $_e(t,{helperRoot:m,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new awe(t,{helperRoot:m}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new uwe(t),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new Ewe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Twe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new Owe(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new b1e(t,{colliderHelperRoot:m,jointHelperRoot:m}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new t1e(t,{helperRoot:m})}beforeRoot(){return N_(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(t){return N_(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(t)})}getMaterialType(t){const e=this.mtoonMaterialPlugin.getMaterialType(t);return e??null}extendMaterialParams(t,e){return N_(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(t,e),yield this.mtoonMaterialPlugin.extendMaterialParams(t,e)})}afterRoot(t){return N_(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 fwe({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 w1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function PU(t,e,n){if(e.size===1){const o=e.values().next().value;if(o.weight===1)return t[o.index]}const r=new Float32Array(t[0].count*3);let i=0;if(n)i=1;else for(const o of e)i+=o.weight;for(const o of e){const a=t[o.index],l=o.weight/i;for(let c=0;cd.getOrCreate(V)).join(","),D=`${C};${_};${N}`;let F=a.get(D);F==null&&(F=T.clone(),P1e(F,O,x),a.set(D,F)),E.geometry.setAttribute("skinIndex",F)}for(const E of y)E.bind(w,new Rt)}}function E1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function A1e(t,e){const n=new Set;for(let r=0;rn)return!1;return!0}var fT=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 N1e(t){var e,n,r,i;const s=new Qt;s.name=t.name,s.setIndex(t.index);for(const[o,a]of Object.entries(t.attributes))s.setAttribute(o,a);for(const[o,a]of Object.entries(t.morphAttributes)){const l=o;s.morphAttributes[l]=a.concat()}s.morphTargetsRelative=t.morphTargetsRelative,s.groups=[];for(const o of t.groups)s.addGroup(o.start,o.count,o.materialIndex);return s.boundingSphere=(n=(e=t.boundingSphere)==null?void 0:e.clone())!=null?n:null,s.boundingBox=(i=(r=t.boundingBox)==null?void 0:r.clone())!=null?i:null,s.drawRange.start=t.drawRange.start,s.drawRange.count=t.drawRange.count,s.userData=t.userData,s}function RU(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 I1e(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=>RU(i)):r&&RU(r))}function k1e(t){t.traverse(I1e)}function O1e(t,e){var n,r;console.warn("VRMUtils.removeUnnecessaryJoints: removeUnnecessaryJoints is deprecated. Use combineSkeletons instead. combineSkeletons contributes more to the performance improvement. This function will be removed in the next major version.");const i=(n=e==null?void 0:e.experimentalSameBoneCounts)!=null?n:!1,s=[];t.traverse(l=>{l.type==="SkinnedMesh"&&s.push(l)});const o=new Map;let a=0;for(const l of s){const d=l.geometry.getAttribute("skinIndex");if(o.has(d))continue;const f=new Map,m=new Map;for(let y=0;y{e.addGroup(o.start,o.count,o.materialIndex)}),e.boundingBox=(r=(n=t.boundingBox)==null?void 0:n.clone())!=null?r:null,e.boundingSphere=(s=(i=t.boundingSphere)==null?void 0:i.clone())!=null?s:null,e.setDrawRange(t.drawRange.start,t.drawRange.count),e.userData=t.userData}function U1e(t,e,n){const r=e.array,i=new r.constructor(r.length);for(let s=0;s{if(!n.isMesh)return;const r=n,i=r.geometry,s=i.index;if(s==null)return;const o=e.get(i);if(o!=null){r.geometry=o;return}const{isVertexUsed:a,vertexCount:l,verticesUsed:c}=L1e(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=D1e(a),m=new Qt;j1e(i,m),e.set(i,m),U1e(m,s,d),z1e(m,i.attributes,f),H1e(m,i.morphAttributes,f),r.geometry=m}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function G1e(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var qc=class{constructor(){}};qc.combineMorphs=S1e;qc.combineSkeletons=M1e;qc.deepDispose=k1e;qc.removeUnnecessaryJoints=O1e;qc.removeUnnecessaryVertices=V1e;qc.rotateVRM0=G1e;/*! +`;n.vertexShader=i+n.vertexShader,n.fragmentShader=i+n.fragmentShader,r<154&&(n.fragmentShader=n.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(t){this.uniforms.litFactor.value=t}get map(){return this.uniforms.map.value}set map(t){this.uniforms.map.value=t}get normalMap(){return this.uniforms.normalMap.value}set normalMap(t){this.uniforms.normalMap.value=t}get normalScale(){return this.uniforms.normalScale.value}set normalScale(t){this.uniforms.normalScale.value=t}get emissive(){return this.uniforms.emissive.value}set emissive(t){this.uniforms.emissive.value=t}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(t){this.uniforms.emissiveIntensity.value=t}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(t){this.uniforms.emissiveMap.value=t}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(t){this.uniforms.shadeColorFactor.value=t}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(t){this.uniforms.shadeMultiplyTexture.value=t}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(t){this.uniforms.shadingShiftFactor.value=t}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(t){this.uniforms.shadingShiftTexture.value=t}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(t){this.uniforms.shadingShiftTextureScale.value=t}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(t){this.uniforms.shadingToonyFactor.value=t}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(t){this.uniforms.giEqualizationFactor.value=t}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(t){this.uniforms.matcapFactor.value=t}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(t){this.uniforms.matcapTexture.value=t}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(t){this.uniforms.parametricRimColorFactor.value=t}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(t){this.uniforms.rimMultiplyTexture.value=t}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(t){this.uniforms.rimLightingMixFactor.value=t}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(t){this.uniforms.parametricRimFresnelPowerFactor.value=t}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(t){this.uniforms.parametricRimLiftFactor.value=t}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(t){this.uniforms.outlineWidthMultiplyTexture.value=t}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(t){this.uniforms.outlineWidthFactor.value=t}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(t){this.uniforms.outlineColorFactor.value=t}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(t){this.uniforms.outlineLightingMixFactor.value=t}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(t){this.uniforms.uvAnimationMaskTexture.value=t}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(t){this.uniforms.uvAnimationScrollXOffset.value=t}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(t){this.uniforms.uvAnimationScrollYOffset.value=t}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(t){this.uniforms.uvAnimationRotationPhase.value=t}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(t){this._ignoreVertexColor=t,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(t){this._v0CompatShade=t,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(t){this._debugMode=t,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(t){this._outlineWidthMode=t,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(t){this._isOutline=t,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(t){this._uploadUniformsWorkaround(),this._updateUVAnimation(t)}copy(t){return super.copy(t),this.map=t.map,this.normalMap=t.normalMap,this.emissiveMap=t.emissiveMap,this.shadeMultiplyTexture=t.shadeMultiplyTexture,this.shadingShiftTexture=t.shadingShiftTexture,this.matcapTexture=t.matcapTexture,this.rimMultiplyTexture=t.rimMultiplyTexture,this.outlineWidthMultiplyTexture=t.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=t.uvAnimationMaskTexture,this.normalMapType=t.normalMapType,this.uvAnimationScrollXSpeedFactor=t.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=t.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=t.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=t.ignoreVertexColor,this.v0CompatShade=t.v0CompatShade,this.debugMode=t.debugMode,this.outlineWidthMode=t.outlineWidthMode,this.isOutline=t.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(t){this.uniforms.uvAnimationScrollXOffset.value+=t*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=t*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=t*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const t=parseInt(Td,10),e=this.outlineWidthMultiplyTexture!==null,n=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:t,OUTLINE:this._isOutline,MTOON_USE_UV:e||n,MTOON_UVS_VERTEX_ONLY:e&&!n,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===_U.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},Ewe=new Set(["1.0","1.0-beta"]),HG=class Q_{get name(){return Q_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,o;this.parser=e,this.materialType=(r=n.materialType)!=null?r:Mwe,this.renderOrderOffset=(i=n.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(o=n.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return ch(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return ch(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 ch(this,null,function*(){var n;const r=this.parser,s=(n=r.json.meshes)==null?void 0:n[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[Q_.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!Ewe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Q_.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,n){return ch(this,null,function*(){var r;delete n.metalness,delete n.roughness;const i=new xwe(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=ss,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const n=e.material,r=new Set;Array.isArray(n)?n.forEach(i=>r.add(i)):r.add(n);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var n;return(e.transparentWithZWrite?0:19)+((n=e.renderQueueOffsetNumber)!=null?n:0)}};HG.EXTENSION_NAME="VRMC_materials_mtoon";var Awe=HG,Twe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),VG=class pP{get name(){return pP.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Twe(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;n.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[pP.EXTENSION_NAME];if(a!=null)return a}};VG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Cwe=VG,Pwe=Object.defineProperty,Rwe=Object.defineProperties,Nwe=Object.getOwnPropertyDescriptors,wU=Object.getOwnPropertySymbols,Iwe=Object.prototype.hasOwnProperty,kwe=Object.prototype.propertyIsEnumerable,SU=(t,e,n)=>e in t?Pwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,gl=(t,e)=>{for(var n in e||(e={}))Iwe.call(e,n)&&SU(t,n,e[n]);if(wU)for(var n of wU(e))kwe.call(e,n)&&SU(t,n,e[n]);return t},MU=(t,e)=>Rwe(t,Nwe(e)),Owe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())});function Om(t){return Math.pow(t,2.2)}var Lwe=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 Owe(this,null,function*(){var t;const e=this.parser.json,n=(t=e.extensions)==null?void 0:t.VRM,r=n==null?void 0:n.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(t,e){var n,r,i,s,o,a,l,c,d,f,m,y,x,S,w,_,E,T,C,O,N,D,F,G,k,U,H,ne,te,he,se,fe,B,J,Y,V,q,pe,ae,le,be,Se,qe,Me,$e,Ke,ce,Z,We,je,Xe,Je,bt,ut,ee;const $=(r=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?r:!1,Be=((i=t.floatProperties)==null?void 0:i._ZWrite)===1&&$,Ve=this._v0ParseRenderQueue(t),He=(o=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,mt=$?"BLEND":He?"MASK":"OPAQUE",rt=He?(l=(a=t.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,de=((d=(c=t.floatProperties)==null?void 0:c._CullMode)!=null?d:2)===0,Ne=this._portTextureTransform(t),tt=((m=(f=t.vectorProperties)==null?void 0:f._Color)!=null?m:[1,1,1,1]).map((it,xt)=>xt===3?it:Om(it)),jt=(y=t.textureProperties)==null?void 0:y._MainTex,Lt=jt!=null?{index:jt,extensions:gl({},Ne)}:void 0,ct=(S=(x=t.floatProperties)==null?void 0:x._BumpScale)!=null?S:1,ue=(w=t.textureProperties)==null?void 0:w._BumpMap,Q=ue!=null?{index:ue,scale:ct,extensions:gl({},Ne)}:void 0,Ae=((E=(_=t.vectorProperties)==null?void 0:_._EmissionColor)!=null?E:[0,0,0,1]).map(Om),re=(T=t.textureProperties)==null?void 0:T._EmissionMap,Fe=re!=null?{index:re,extensions:gl({},Ne)}:void 0,Te=((O=(C=t.vectorProperties)==null?void 0:C._ShadeColor)!=null?O:[.97,.81,.86,1]).map(Om),Le=(N=t.textureProperties)==null?void 0:N._ShadeTexture,Ye=Le!=null?{index:Le,extensions:gl({},Ne)}:void 0;let ht=(F=(D=t.floatProperties)==null?void 0:D._ShadeShift)!=null?F:0,Yt=(k=(G=t.floatProperties)==null?void 0:G._ShadeToony)!=null?k:.9;Yt=gr.lerp(Yt,1,.5+.5*ht),ht=-ht-(1-Yt);const un=(H=(U=t.floatProperties)==null?void 0:U._IndirectLightIntensity)!=null?H:.1,Cn=un?1-un:void 0,en=(ne=t.textureProperties)==null?void 0:ne._SphereAdd,Hn=en!=null?[1,1,1]:void 0,hr=en!=null?{index:en}:void 0,Si=(he=(te=t.floatProperties)==null?void 0:te._RimLightingMix)!=null?he:0,ra=(se=t.textureProperties)==null?void 0:se._RimTexture,Mi=ra!=null?{index:ra,extensions:gl({},Ne)}:void 0,Ka=((B=(fe=t.vectorProperties)==null?void 0:fe._RimColor)!=null?B:[0,0,0,1]).map(Om),Ns=(Y=(J=t.floatProperties)==null?void 0:J._RimFresnelPower)!=null?Y:1,ia=(q=(V=t.floatProperties)==null?void 0:V._RimLift)!=null?q:0,Ei=["none","worldCoordinates","screenCoordinates"][(ae=(pe=t.floatProperties)==null?void 0:pe._OutlineWidthMode)!=null?ae:0];let Ao=(be=(le=t.floatProperties)==null?void 0:le._OutlineWidth)!=null?be:0;Ao=.01*Ao;const sa=(Se=t.textureProperties)==null?void 0:Se._OutlineWidthTexture,cu=sa!=null?{index:sa,extensions:gl({},Ne)}:void 0,uu=((Me=(qe=t.vectorProperties)==null?void 0:qe._OutlineColor)!=null?Me:[0,0,0]).map(Om),du=((Ke=($e=t.floatProperties)==null?void 0:$e._OutlineColorMode)!=null?Ke:0)===1?(Z=(ce=t.floatProperties)==null?void 0:ce._OutlineLightingMix)!=null?Z:1:0,Gl=(We=t.textureProperties)==null?void 0:We._UvAnimMaskTexture,K=Gl!=null?{index:Gl,extensions:gl({},Ne)}:void 0,xe=(Xe=(je=t.floatProperties)==null?void 0:je._UvAnimScrollX)!=null?Xe:0;let Pe=(bt=(Je=t.floatProperties)==null?void 0:Je._UvAnimScrollY)!=null?bt:0;Pe!=null&&(Pe=-Pe);const ke=(ee=(ut=t.floatProperties)==null?void 0:ut._UvAnimRotation)!=null?ee:0,we={specVersion:"1.0",transparentWithZWrite:Be,renderQueueOffsetNumber:Ve,shadeColorFactor:Te,shadeMultiplyTexture:Ye,shadingShiftFactor:ht,shadingToonyFactor:Yt,giEqualizationFactor:Cn,matcapFactor:Hn,matcapTexture:hr,rimLightingMixFactor:Si,rimMultiplyTexture:Mi,parametricRimColorFactor:Ka,parametricRimFresnelPowerFactor:Ns,parametricRimLiftFactor:ia,outlineWidthMode:Ei,outlineWidthFactor:Ao,outlineWidthMultiplyTexture:cu,outlineColorFactor:uu,outlineLightingMixFactor:du,uvAnimationMaskTexture:K,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Pe,uvAnimationRotationSpeedFactor:ke};return MU(gl({},e),{pbrMetallicRoughness:{baseColorFactor:tt,baseColorTexture:Lt},normalTexture:Q,emissiveTexture:Fe,emissiveFactor:Ae,alphaMode:mt,alphaCutoff:rt,doubleSided:de,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(t,e){var n,r,i,s,o;const a=t.shader==="VRM/UnlitTransparentZWrite",l=t.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",f=l?"BLEND":d?"MASK":"OPAQUE",m=d?(r=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?r:.5:void 0,y=this._portTextureTransform(t),x=((s=(i=t.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Om),S=(o=t.textureProperties)==null?void 0:o._MainTex,w=S!=null?{index:S,extensions:gl({},y)}:void 0,_={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:x,shadeMultiplyTexture:w};return MU(gl({},e),{pbrMetallicRoughness:{baseColorFactor:x,baseColorTexture:w},alphaMode:f,alphaCutoff:m,extensions:{VRMC_materials_mtoon:_}})}_portTextureTransform(t){var e,n,r,i,s;const o=(e=t.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(n=o==null?void 0:o[0])!=null?n:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(t){var e,n;const r=t.shader==="VRM/UnlitTransparentZWrite",i=((e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||t.shader==="VRM/UnlitTransparent"||r,s=((n=t.floatProperties)==null?void 0:n._ZWrite)===1||r;let o=0;if(i){const a=t.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(t){const e=new Set,n=new Set;t.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?n.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(n).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},EU=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),id=new X,aT=class extends Ts{constructor(t){super(),this._attrPosition=new Jt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(r6);const e=new Qt;e.setAttribute("position",this._attrPosition);const n=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new zl(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){id.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,id.x,id.y,id.z),this.constraint.source&&id.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,id.x,id.y,id.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function AU(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Dwe=new X,jwe=new X;function Uwe(t,e){return t.decompose(Dwe,e,jwe),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}},Fwe=new X,zwe=new X,Bwe=new X,Hwe=new Kt,Vwe=new Kt,Gwe=new Kt,Wwe=class extends aN{get aimAxis(){return this._aimAxis}set aimAxis(t){this._aimAxis=t,this._v3AimAxis.set(t==="PositiveX"?1:t==="NegativeX"?-1:0,t==="PositiveY"?1:t==="NegativeY"?-1:0,t==="PositiveZ"?1:t==="NegativeZ"?-1:0)}get dependencies(){const t=new Set([this.source]);return this.destination.parent&&t.add(this.destination.parent),t}constructor(t,e){super(t,e),this._aimAxis="PositiveX",this._v3AimAxis=new X(1,0,0),this._dstRestQuat=new Kt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const t=Hwe.identity(),e=Vwe.identity();this.destination.parent&&(Uwe(this.destination.parent.matrixWorld,t),z1(e.copy(t)));const n=Fwe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=AU(this.source.matrixWorld,zwe).sub(AU(this.destination.matrixWorld,Bwe)).normalize(),i=Gwe.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function $we(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var Xwe=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)$we(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,n,r)});r(t),n.add(t)}},qwe=new Kt,Kwe=new Kt,Ywe=class extends aN{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new Kt,this._invSrcRestQuat=new Kt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),z1(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const t=qwe.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Kwe.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Zwe=new X,Qwe=new Kt,Jwe=new Kt,e1e=class extends aN{get rollAxis(){return this._rollAxis}set rollAxis(t){this._rollAxis=t,this._v3RollAxis.set(t==="X"?1:0,t==="Y"?1:0,t==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._rollAxis="X",this._v3RollAxis=new X(1,0,0),this._dstRestQuat=new Kt,this._invDstRestQuat=new Kt,this._invSrcRestQuatMulDstRestQuat=new Kt}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=Qwe.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Zwe.copy(this._v3RollAxis).applyQuaternion(t),r=Jwe.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},t1e=new Set(["1.0","1.0-beta"]),GG=class W0{get name(){return W0.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return EU(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return EU(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf(W0.EXTENSION_NAME))!==-1))return null;const s=new Xwe,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const d=r.nodes[l],f=(c=d==null?void 0:d.extensions)==null?void 0:c[W0.EXTENSION_NAME];if(f==null)return;const m=f.specVersion;if(!t1e.has(m)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${W0.EXTENSION_NAME} specVersion "${m}"`);return}const y=f.constraint;if(y.roll!=null){const x=this._importRollConstraint(a,o,y.roll);s.addConstraint(x)}else if(y.aim!=null){const x=this._importAimConstraint(a,o,y.aim);s.addConstraint(x)}else if(y.rotation!=null){const x=this._importRotationConstraint(a,o,y.rotation);s.addConstraint(x)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,r){const{source:i,rollAxis:s,weight:o}=r,a=n[i],l=new e1e(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new aT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:o}=r,a=n[i],l=new Wwe(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new aT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,o=n[i],a=new Ywe(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new aT(a);this.helperRoot.add(l)}return a}};GG.EXTENSION_NAME="VRMC_node_constraint";var n1e=GG,D_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),lN=class{},lT=new X,Hf=new X,WG=class extends lN{get type(){return"capsule"}constructor(t){var e,n,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new X(0,0,0),this.radius=(r=t==null?void 0:t.radius)!=null?r:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,n,r){lT.setFromMatrixPosition(t),Hf.subVectors(this.tail,this.offset).applyMatrix4(t),Hf.sub(lT);const i=Hf.lengthSq();r.copy(e).sub(lT);const s=Hf.dot(r);s<=0||(i<=s||Hf.multiplyScalar(s/i),r.sub(Hf));const o=r.length(),a=this.inside?this.radius-n-o:o-n-this.radius;return a<0&&(r.multiplyScalar(1/o),this.inside&&r.negate()),a}},cT=new X,TU=new qt,$G=class extends lN{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new X(0,0,1)}calculateCollision(t,e,n,r){r.setFromMatrixPosition(t),r.negate().add(e),TU.getNormalMatrix(t),cT.copy(this.normal).applyNormalMatrix(TU).normalize();const i=r.dot(cT)-n;return r.copy(cT),i}},r1e=new X,XG=class extends lN{get type(){return"sphere"}constructor(t){var e,n,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0,this.inside=(r=t==null?void 0:t.inside)!=null?r:!1}calculateCollision(t,e,n,r){r.subVectors(e,r1e.setFromMatrixPosition(t));const i=r.length(),s=this.inside?this.radius-n-i:i-n-this.radius;return s<0&&(r.multiplyScalar(1/i),this.inside&&r.negate()),s}},vl=new X,i1e=class extends Qt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._currentTail=new X,this._shape=t,this._attrPos=new Jt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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}},s1e=class extends Qt{constructor(t){super(),this.worldScale=1,this._currentOffset=new X,this._currentNormal=new X,this._shape=t,this._attrPos=new Jt(new Float32Array(18),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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}},o1e=class extends Qt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._shape=t,this._attrPos=new Jt(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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 X,uT=class extends Ts{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof XG)this._geometry=new o1e(this.collider.shape);else if(this.collider.shape instanceof WG)this._geometry=new i1e(this.collider.shape);else if(this.collider.shape instanceof $G)this._geometry=new s1e(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 eo(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)}},l1e=class extends Qt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new X,this._springBone=t,this._attrPos=new Jt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Jt(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 X,u1e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new l1e(this.springBone);const e=new $r({color:16776960,depthTest:!1,depthWrite:!1});this._line=new eo(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 Pt,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),d1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function d1e(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 f1e=new Pt;function h1e(t){return t.invert?t.invert():t.getInverse(f1e.copy(t)),t}var p1e=class{constructor(t){this._inverseCache=new Pt,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&&(h1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},fT=new Pt,Lm=new X,L0=new X,D0=new X,j0=new X,m1e=new Pt,g1e=class{constructor(t,e,n={},r=[]){this._currentTail=new X,this._prevTail=new X,this._boneAxis=new X,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Pt,this._initialLocalRotation=new Kt,this._initialLocalChildPosition=new X;var i,s,o,a,l,c;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=n.hitRadius)!=null?i:0,stiffness:(s=n.stiffness)!=null?s:1,gravityPower:(o=n.gravityPower)!=null?o:0,gravityDir:(l=(a=n.gravityDir)==null?void 0:a.clone())!=null?l:new X(0,-1,0),dragForce:(c=n.dragForce)!=null?c:.4},this.colliderGroups=r}get dependencies(){const t=new Set,e=this.bone.parent;e&&t.add(e);for(let n=0;n{e(i)})}function mP(t,e){t.children.forEach(n=>{e(n)||mP(n,e)})}function y1e(t){var e;const n=new Map;for(const r of t){let i=r;do{const s=((e=n.get(i))!=null?e:0)+1;if(s===t.size)return i;n.set(i,s),i=i.parent}while(i!==null)}return null}var CU=class{constructor(){this._joints=new Set,this._sortedJoints=[],this._hasWarnedCircularDependency=!1,this._ancestors=[],this._objectSpringBonesMap=new Map,this._isSortedJointsDirty=!1,this._relevantChildrenUpdated=this._relevantChildrenUpdated.bind(this)}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const t=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(n=>{t.add(n)})}),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{t.add(n)})}),Array.from(t)}addJoint(t){this._joints.add(t);let e=this._objectSpringBonesMap.get(t.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t),this._isSortedJointsDirty=!0}addSpringBone(t){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(t)}deleteJoint(t){this._joints.delete(t),this._objectSpringBonesMap.get(t.bone).delete(t),this._isSortedJointsDirty=!0}deleteSpringBone(t){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(t)}setInitState(){this._sortJoints();for(let t=0;t{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(this._ancestors.push(s),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(t,e,n,r,i){if(n.has(t))return;if(e.has(t)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}e.add(t);const s=t.dependencies;for(const o of s){let a=!1,l=null;v1e(o,c=>{const d=this._objectSpringBonesMap.get(c);if(d)for(const f of d)a=!0,this._insertJointSort(f,e,n,r,i);else a||(l=c)}),l&&i.add(l)}r.push(t),n.add(t)}_relevantChildrenUpdated(t){var e,n;return((n=(e=this._objectSpringBonesMap.get(t))==null?void 0:e.size)!=null?n:0)>0?!0:(t.updateWorldMatrix(!1,!1),!1)}},PU="VRMC_springBone_extended_collider",x1e=new Set(["1.0","1.0-beta"]),b1e=new Set(["1.0"]),qG=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 D_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return D_(this,null,function*(){const n=yield this._v1Import(e);if(n!=null)return n;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return D_(this,null,function*(){var n,r,i,s,o;const a=e.parser.json;if(!(((n=a.extensionsUsed)==null?void 0:n.indexOf(Hm.EXTENSION_NAME))!==-1))return null;const c=new CU,d=yield e.parser.getDependencies("node"),f=(r=a.extensions)==null?void 0:r[Hm.EXTENSION_NAME];if(!f)return null;const m=f.specVersion;if(!x1e.has(m))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Hm.EXTENSION_NAME} specVersion "${m}"`),null;const y=(i=f.colliders)==null?void 0:i.map((S,w)=>{var _,E,T,C,O,N,D,F,G,k,U,H,ne,te,he;const se=d[S.node];if(se==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} attempted to reference a node #${S.node} but not found. Skipping the collider`),null;const fe=S.shape,B=(_=S.extensions)==null?void 0:_[PU];if(this.useExtendedColliders&&B!=null){const J=B.specVersion;if(!b1e.has(J))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${PU} specVersion "${J}". Fallbacking to the ${Hm.EXTENSION_NAME} definition`);else{const Y=B.shape;if(Y.sphere)return this._importSphereCollider(se,{offset:new X().fromArray((E=Y.sphere.offset)!=null?E:[0,0,0]),radius:(T=Y.sphere.radius)!=null?T:0,inside:(C=Y.sphere.inside)!=null?C:!1});if(Y.capsule)return this._importCapsuleCollider(se,{offset:new X().fromArray((O=Y.capsule.offset)!=null?O:[0,0,0]),radius:(N=Y.capsule.radius)!=null?N:0,tail:new X().fromArray((D=Y.capsule.tail)!=null?D:[0,0,0]),inside:(F=Y.capsule.inside)!=null?F:!1});if(Y.plane)return this._importPlaneCollider(se,{offset:new X().fromArray((G=Y.plane.offset)!=null?G:[0,0,0]),normal:new X().fromArray((k=Y.plane.normal)!=null?k:[0,0,1])})}}if(fe.sphere)return this._importSphereCollider(se,{offset:new X().fromArray((U=fe.sphere.offset)!=null?U:[0,0,0]),radius:(H=fe.sphere.radius)!=null?H:0,inside:!1});if(fe.capsule)return this._importCapsuleCollider(se,{offset:new X().fromArray((ne=fe.capsule.offset)!=null?ne:[0,0,0]),radius:(te=fe.capsule.radius)!=null?te:0,tail:new X().fromArray((he=fe.capsule.tail)!=null?he:[0,0,0]),inside:!1});console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} has no valid shape. Skipping the collider`)}),x=(s=f.colliderGroups)==null?void 0:s.map((S,w)=>{var _;return{colliders:((_=S.colliders)!=null?_:[]).map(T=>{const C=y==null?void 0:y[T];return C??(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${w} attempted to reference a collider #${T} but not found. Skipping the collider`),null)}).filter(T=>T!=null),name:S.name}});return(o=f.springs)==null||o.forEach((S,w)=>{var _;const E=S.joints,T=(_=S.colliderGroups)==null?void 0:_.map(N=>{const D=x==null?void 0:x[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),C=S.center!=null?d[S.center]:void 0;let O;E.forEach(N=>{if(O){const D=O.node,F=d[D],G=N.node,k=d[G],U={hitRadius:O.hitRadius,dragForce:O.dragForce,gravityPower:O.gravityPower,stiffness:O.stiffness,gravityDir:O.gravityDir!=null?new X().fromArray(O.gravityDir):void 0},H=this._importJoint(F,k,U,T);C&&(H.center=C),c.addJoint(H)}O=N})}),c.setInitState(),c})}_v0Import(e){return D_(this,null,function*(){var n,r,i;const s=e.parser.json;if(!(((n=s.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const d=new CU,f=yield e.parser.getDependencies("node"),m=(i=l.colliderGroups)==null?void 0:i.map((y,x)=>{var S;const w=f[y.node];return w==null?(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${x} attempted to reference a node #${y.node} but not found. Skipping the collider group`),null):{colliders:((S=y.colliders)!=null?S:[]).map((E,T)=>{var C,O,N;const D=new X(0,0,0);return E.offset&&D.set((C=E.offset.x)!=null?C:0,(O=E.offset.y)!=null?O:0,E.offset.z?-E.offset.z:0),this._importSphereCollider(w,{offset:D,radius:(N=E.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,x)=>{const S=y.bones;S&&S.forEach(w=>{var _,E,T,C;const O=f[w];if(O==null){console.warn(`VRMSpringBoneLoaderPlugin: The spring bone group #${x} attempted to reference a node #${w} but not found. Skipping the node`);return}const N=new X;y.gravityDir?N.set((_=y.gravityDir.x)!=null?_:0,(E=y.gravityDir.y)!=null?E:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const D=y.center!=null?f[y.center]:void 0,F={hitRadius:y.hitRadius,dragForce:y.dragForce,gravityPower:y.gravityPower,stiffness:y.stiffiness,gravityDir:N},G=(C=y.colliderGroups)==null?void 0:C.map(k=>{const U=m==null?void 0:m[k];return U??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${x} attempted to reference a collider group #${k} but not found. Skipping the collider group`),null)}).filter(k=>k!=null);O.traverse(k=>{var U;const H=(U=k.children[0])!=null?U:null,ne=this._importJoint(k,H,F,G);D&&(ne.center=D),d.addJoint(ne)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new g1e(e,n,r,i);if(this.jointHelperRoot){const o=new u1e(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new XG(n),i=new dT(r);if(e.add(i),this.colliderHelperRoot){const s=new uT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,n){const r=new WG(n),i=new dT(r);if(e.add(i),this.colliderHelperRoot){const s=new uT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,n){const r=new $G(n),i=new dT(r);if(e.add(i),this.colliderHelperRoot){const s=new uT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};qG.EXTENSION_NAME="VRMC_springBone";var _1e=qG,w1e=class{get name(){return"VRMLoaderPlugin"}constructor(t,e){var n,r,i,s,o,a,l,c,d,f;this.parser=t;const m=e==null?void 0:e.helperRoot,y=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(n=e==null?void 0:e.expressionPlugin)!=null?n:new U_e(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new z_e(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new X_e(t,{helperRoot:m,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new lwe(t,{helperRoot:m}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new dwe(t),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new Awe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Cwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new Lwe(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new _1e(t,{colliderHelperRoot:m,jointHelperRoot:m}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new n1e(t,{helperRoot:m})}beforeRoot(){return k_(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(t){return k_(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(t)})}getMaterialType(t){const e=this.mtoonMaterialPlugin.getMaterialType(t);return e??null}extendMaterialParams(t,e){return k_(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(t,e),yield this.mtoonMaterialPlugin.extendMaterialParams(t,e)})}afterRoot(t){return k_(this,null,function*(){yield this.metaPlugin.afterRoot(t),yield this.humanoidPlugin.afterRoot(t),yield this.expressionPlugin.afterRoot(t),yield this.lookAtPlugin.afterRoot(t),yield this.firstPersonPlugin.afterRoot(t),yield this.springBonePlugin.afterRoot(t),yield this.nodeConstraintPlugin.afterRoot(t),yield this.mtoonMaterialPlugin.afterRoot(t);const e=t.userData.vrmMeta,n=t.userData.vrmHumanoid;if(e&&n){const r=new hwe({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 S1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function RU(t,e,n){if(e.size===1){const o=e.values().next().value;if(o.weight===1)return t[o.index]}const r=new Float32Array(t[0].count*3);let i=0;if(n)i=1;else for(const o of e)i+=o.weight;for(const o of e){const a=t[o.index],l=o.weight/i;for(let c=0;cd.getOrCreate(G)).join(","),D=`${C};${_};${N}`;let F=a.get(D);F==null&&(F=T.clone(),R1e(F,O,x),a.set(D,F)),E.geometry.setAttribute("skinIndex",F)}for(const E of y)E.bind(w,new Pt)}}function A1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function T1e(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 I1e(t){var e,n,r,i;const s=new Qt;s.name=t.name,s.setIndex(t.index);for(const[o,a]of Object.entries(t.attributes))s.setAttribute(o,a);for(const[o,a]of Object.entries(t.morphAttributes)){const l=o;s.morphAttributes[l]=a.concat()}s.morphTargetsRelative=t.morphTargetsRelative,s.groups=[];for(const o of t.groups)s.addGroup(o.start,o.count,o.materialIndex);return s.boundingSphere=(n=(e=t.boundingSphere)==null?void 0:e.clone())!=null?n:null,s.boundingBox=(i=(r=t.boundingBox)==null?void 0:r.clone())!=null?i:null,s.drawRange.start=t.drawRange.start,s.drawRange.count=t.drawRange.count,s.userData=t.userData,s}function NU(t){if(Object.values(t).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),t.isShaderMaterial){const e=t.uniforms;e&&Object.values(e).forEach(n=>{const r=n.value;r!=null&&r.isTexture&&r.dispose()})}t.dispose()}function k1e(t){const e=t.geometry;e&&e.dispose();const n=t.skeleton;n&&n.dispose();const r=t.material;r&&(Array.isArray(r)?r.forEach(i=>NU(i)):r&&NU(r))}function O1e(t){t.traverse(k1e)}function L1e(t,e){var n,r;console.warn("VRMUtils.removeUnnecessaryJoints: removeUnnecessaryJoints is deprecated. Use combineSkeletons instead. combineSkeletons contributes more to the performance improvement. This function will be removed in the next major version.");const i=(n=e==null?void 0:e.experimentalSameBoneCounts)!=null?n:!1,s=[];t.traverse(l=>{l.type==="SkinnedMesh"&&s.push(l)});const o=new Map;let a=0;for(const l of s){const d=l.geometry.getAttribute("skinIndex");if(o.has(d))continue;const f=new Map,m=new Map;for(let y=0;y{e.addGroup(o.start,o.count,o.materialIndex)}),e.boundingBox=(r=(n=t.boundingBox)==null?void 0:n.clone())!=null?r:null,e.boundingSphere=(s=(i=t.boundingSphere)==null?void 0:i.clone())!=null?s:null,e.setDrawRange(t.drawRange.start,t.drawRange.count),e.userData=t.userData}function F1e(t,e,n){const r=e.array,i=new r.constructor(r.length);for(let s=0;s{if(!n.isMesh)return;const r=n,i=r.geometry,s=i.index;if(s==null)return;const o=e.get(i);if(o!=null){r.geometry=o;return}const{isVertexUsed:a,vertexCount:l,verticesUsed:c}=D1e(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=j1e(a),m=new Qt;U1e(i,m),e.set(i,m),F1e(m,s,d),B1e(m,i.attributes,f),V1e(m,i.morphAttributes,f),r.geometry=m}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function W1e(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var qc=class{constructor(){}};qc.combineMorphs=M1e;qc.combineSkeletons=E1e;qc.deepDispose=O1e;qc.removeUnnecessaryJoints=L1e;qc.removeUnnecessaryVertices=G1e;qc.rotateVRM0=W1e;/*! * @pixiv/three-vrm-core v3.5.4 * The implementation of core features of VRM, for @pixiv/three-vrm * @@ -5443,12 +5448,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 W1e={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function Ia(t,e,n,r,i){var o;const s=(o=t.humanoid)==null?void 0:o.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function $1e(t){var e;for(const[n,r]of Object.entries(W1e))Ia(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function X1e(t,e,n,r,i,s){const o=Math.sin(e*1.7),a=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;Ia(t,"hips",0,l*.045,l*.03),Ia(t,"spine",o*.025+s*.07,a*.022,-l*.03),Ia(t,"chest",o*.02+s*.02,a*.018,0),Ia(t,"upperChest",o*.015,0,0),Ia(t,"neck",i*.4+d*.5,r*.4,0),Ia(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;Ia(t,"leftUpperArm",0,0,1.18+f+l*.04),Ia(t,"rightUpperArm",0,0,-1.18-f+l*.04),Ia(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),Ia(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const q1e=["happy","angry","sad","surprised","relaxed"],K1e={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function Y1e({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=R.useState(null),o=R.useRef({}),a=R.useRef({t:0,next:3,active:0}),l=R.useRef({yaw:0,pitch:0,tYaw:0,tPitch:0,t:0,next:2.5,lean:0});return R.useEffect(()=>{let c=!1,d=null;const f=new Jbe;return f.register(m=>new _1e(m)),f.load(t,m=>{var x;if(c)return;const y=m.userData.vrm;if(!y){r("Datei enthält kein gültiges VRM-Modell.");return}qc.removeUnnecessaryVertices(m.scene),((x=y.meta)==null?void 0:x.metaVersion)==="0"&&qc.rotateVRM0(y),y.scene.rotation.y=Math.PI,$1e(y),d=y,s(y)},void 0,m=>{console.error("VRM-Load-Fehler:",m),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&qc.deepDispose(d.scene),s(null)}},[t,r]),xG((c,d)=>{var x;if(!i)return;const f=((x=e.current)==null?void 0:x.current)??0;i.lookAt&&(i.lookAt.target=c.camera);const m=l.current;m.t+=d,m.t>m.next&&(m.tYaw=(Math.random()-.5)*.5,m.tPitch=(Math.random()-.5)*.24,m.t=0,m.next=2.5+Math.random()*3.5),m.yaw+=(m.tYaw-m.yaw)*Math.min(1,d*1.5),m.pitch+=(m.tPitch-m.pitch)*Math.min(1,d*1.5),m.lean+=(Math.min(1,f*1.6)-m.lean)*Math.min(1,d*3),X1e(i,c.clock.elapsedTime,f,m.yaw,m.pitch,m.lean);const y=i.expressionManager;if(y){const S=(o.current.aa??0)*.4+f*.6;o.current.aa=S,y.setValue("aa",S);const w=K1e[n.current];for(const T of q1e){const C=w===T?.75:0,O=o.current[T]??0,N=O+(C-O)*Math.min(1,d*4);o.current[T]=N,y.setValue(T,N)}const _=a.current;_.t+=d,_.active<=0&&_.t>_.next&&(_.active=.16,_.t=0,_.next=3+Math.random()*4);let E=0;if(_.active>0){_.active-=d;const T=1-_.active/.16;E=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,E))}i.update(d)}),i?g.jsx("primitive",{object:i.scene}):null}function Z1e({url:t,audioLevel:e,emotion:n}){const[r,i]=R.useState(null);return g.jsxs("div",{className:"relative h-full w-full",children:[g.jsxs(Vbe,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[g.jsx("ambientLight",{intensity:.85}),g.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),g.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),g.jsx(Y1e,{url:t,audioLevel:e,emotion:n,onError:i},t),g.jsx(Qbe,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&g.jsx("div",{className:"absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-red-500/15 border border-red-500/30 px-3 py-1.5 text-xs text-red-300",children:r})]})}const Q1e=["elevenlabs","edge"],J1e={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function eSe(){const[t,e]=R.useState([]),[n,r]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=R.useState(localStorage.getItem("mc_voice_voice")||""),[o,a]=R.useState(!1),[l,c]=R.useState(()=>{const _=localStorage.getItem("mc_voice_volume");if(_===null||_==="")return .6;const E=Number(_);return Number.isNaN(E)?.6:E}),d=R.useRef(null),f=_=>{c(_),localStorage.setItem("mc_voice_volume",String(_)),window.dispatchEvent(new CustomEvent("mc-voice-volume",{detail:_}))},m=(_,E)=>{r(_),s(E),localStorage.setItem("mc_voice_engine",_),localStorage.setItem("mc_voice_voice",E)};R.useEffect(()=>{fetch("/api/voice/voices").then(_=>_.ok?_.json():Promise.reject()).then(_=>{const E=_.voices||[];if(e(E),!i){const T=E.find(C=>C.engine===n);T&&m(n,T.id)}}).catch(()=>e([]))},[]);const y=async()=>{var _;if(!o){a(!0);try{const E=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:n,voice:i})});if(!E.ok)throw new Error(`TTS ${E.status}`);const T=URL.createObjectURL(await E.blob());(_=d.current)==null||_.pause();const C=new Audio(T);C.volume=Math.min(1,l),d.current=C,C.onended=()=>URL.revokeObjectURL(T),await C.play()}catch(E){console.error("Probe fehlgeschlagen:",E)}finally{a(!1)}}},x=_=>{const E=t.find(T=>T.engine===_);m(_,(E==null?void 0:E.id)||"")},S=t.filter(_=>_.engine===n),w=n==="elevenlabs"&&S.length===0;return g.jsxs("div",{className:"text-sm",children:[g.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[g.jsx(Gm,{className:"h-3.5 w-3.5"})," Stimme"]}),t.length===0?g.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-300",children:"Voice-Dienst nicht erreichbar — Stimmen werden geladen, sobald der Sidecar läuft."}):g.jsxs("div",{className:"space-y-2",children:[g.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:Q1e.map(_=>g.jsx("button",{onClick:()=>x(_),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===_?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:J1e[_]},_))}),g.jsx("select",{value:i,onChange:_=>m(n,_.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(_=>g.jsx("option",{value:_.id,children:_.label},_.id))}),g.jsxs("button",{onClick:y,disabled:o||w,className:"flex w-full items-center justify-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-2.5 py-2 text-xs text-primary hover:bg-primary/20 transition-colors disabled:opacity-60",children:[o?g.jsx(bP,{className:"h-3.5 w-3.5 animate-spin"}):g.jsx(LT,{className:"h-3.5 w-3.5"}),o?"Spielt …":"Probe hören"]}),g.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[g.jsx(LT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),g.jsx("input",{type:"range",min:0,max:1.2,step:.05,value:l,onChange:_=>f(Number(_.target.value)),className:"h-1 flex-1 cursor-pointer accent-primary",title:"Lautstärke"}),g.jsxs("span",{className:"w-9 text-right text-[11px] tabular-nums text-muted-foreground",children:[Math.round(l*100),"%"]})]}),w&&g.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",g.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder keine eigene Stimme angelegt."]}),n==="edge"&&g.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})}function tSe(t){const[e,n]=R.useState(!1),r=R.useRef(null),i=R.useRef([]),s=R.useRef(null),o=R.useCallback(async()=>{if(r.current)return;let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(f){console.error("Mikrofon-Zugriff verweigert:",f);return}s.current=l;const c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(l,{mimeType:c});i.current=[],d.ondataavailable=f=>{f.data.size&&i.current.push(f.data)},d.onstop=()=>{var m;const f=new Blob(i.current,{type:c});(m=s.current)==null||m.getTracks().forEach(y=>y.stop()),s.current=null,r.current=null,n(!1),f.size>1200&&t(f)},d.start(),r.current=d,n(!0)},[t]),a=R.useCallback(()=>{var l;(l=r.current)==null||l.stop()},[]);return R.useEffect(()=>()=>{var l,c;(l=r.current)==null||l.stop(),(c=s.current)==null||c.getTracks().forEach(d=>d.stop())},[]),{recording:e,start:o,stop:a}}class 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 NU(){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 oSe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function aSe(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 lSe(){const[t,e]=R.useState("idle"),[n,r]=R.useState([]),[i,s]=R.useState(null),o=R.useRef({current:0}),a=R.useRef("neutral"),l=R.useRef(null),c=R.useRef(NU()),d=R.useCallback(()=>{if(!l.current){const E=new lN;E.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=E,o.current=E.level}return l.current},[]),f=R.useCallback(async E=>{var ne,te,he,oe;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const fe=new FormData;fe.append("audio",E,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:fe});if(!B.ok)throw new Error(`STT ${B.status}`);C=((ne=(await B.json()).text)==null?void 0:ne.trim())||""}catch(fe){e("error"),s(`Spracherkennung fehlgeschlagen: ${fe.message}`);return}if(!C){e("idle");return}r(fe=>[...fe,{role:"user",text:C}]),e("thinking");const{engine:O,voice:N}=oSe();let D="",F="";r(fe=>[...fe,{role:"assistant",text:""}]);let V=Promise.resolve(),k=!1,U=!1;const H=fe=>{const B=sSe(fe);B&&(V=V.then(async()=>{try{const q=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:B,engine:O,voice:N})});if(!q.ok)throw new Error(`TTS ${q.status}`);await T.enqueue(await q.arrayBuffer()),k=!0}catch(q){U=!0,console.error("TTS-Fehler:",q)}}))};try{const fe=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:C,session_id:c.current,system:iSe})});if(!fe.ok||!fe.body)throw new Error(`Agent ${fe.status}`);const B=fe.body.getReader(),q=new TextDecoder;let K="";for(;;){const{done:$,value:Z}=await B.read();if($)break;K+=q.decode(Z,{stream:!0});const ge=K.split(` + */const $1e={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function Ia(t,e,n,r,i){var o;const s=(o=t.humanoid)==null?void 0:o.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function X1e(t){var e;for(const[n,r]of Object.entries($1e))Ia(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function q1e(t,e,n,r,i,s){const o=Math.sin(e*1.7),a=Math.sin(e*.45),l=Math.sin(e*.32),c=Math.min(1,n*1.4),d=Math.sin(e*1.3)*c*.06;Ia(t,"hips",0,l*.045,l*.03),Ia(t,"spine",o*.025+s*.07,a*.022,-l*.03),Ia(t,"chest",o*.02+s*.02,a*.018,0),Ia(t,"upperChest",o*.015,0,0),Ia(t,"neck",i*.4+d*.5,r*.4,0),Ia(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;Ia(t,"leftUpperArm",0,0,1.18+f+l*.04),Ia(t,"rightUpperArm",0,0,-1.18-f+l*.04),Ia(t,"leftLowerArm",0,-.18-Math.sin(e*.8)*.03,0),Ia(t,"rightLowerArm",0,.18+Math.sin(e*.8)*.03,0)}const K1e=["happy","angry","sad","surprised","relaxed"],Y1e={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function Z1e({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=R.useState(null),o=R.useRef({}),a=R.useRef({t:0,next:3,active:0}),l=R.useRef({yaw:0,pitch:0,tYaw:0,tPitch:0,t:0,next:2.5,lean:0});return R.useEffect(()=>{let c=!1,d=null;const f=new e_e;return f.register(m=>new w1e(m)),f.load(t,m=>{var x;if(c)return;const y=m.userData.vrm;if(!y){r("Datei enthält kein gültiges VRM-Modell.");return}qc.removeUnnecessaryVertices(m.scene),((x=y.meta)==null?void 0:x.metaVersion)==="0"&&qc.rotateVRM0(y),y.scene.rotation.y=Math.PI,X1e(y),d=y,s(y)},void 0,m=>{console.error("VRM-Load-Fehler:",m),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{c=!0,d&&qc.deepDispose(d.scene),s(null)}},[t,r]),bG((c,d)=>{var x;if(!i)return;const f=((x=e.current)==null?void 0:x.current)??0;i.lookAt&&(i.lookAt.target=c.camera);const m=l.current;m.t+=d,m.t>m.next&&(m.tYaw=(Math.random()-.5)*.5,m.tPitch=(Math.random()-.5)*.24,m.t=0,m.next=2.5+Math.random()*3.5),m.yaw+=(m.tYaw-m.yaw)*Math.min(1,d*1.5),m.pitch+=(m.tPitch-m.pitch)*Math.min(1,d*1.5),m.lean+=(Math.min(1,f*1.6)-m.lean)*Math.min(1,d*3),q1e(i,c.clock.elapsedTime,f,m.yaw,m.pitch,m.lean);const y=i.expressionManager;if(y){const S=(o.current.aa??0)*.4+f*.6;o.current.aa=S,y.setValue("aa",S);const w=Y1e[n.current];for(const T of K1e){const C=w===T?.75:0,O=o.current[T]??0,N=O+(C-O)*Math.min(1,d*4);o.current[T]=N,y.setValue(T,N)}const _=a.current;_.t+=d,_.active<=0&&_.t>_.next&&(_.active=.16,_.t=0,_.next=3+Math.random()*4);let E=0;if(_.active>0){_.active-=d;const T=1-_.active/.16;E=1-Math.abs(T-.5)*2}y.setValue("blink",Math.max(0,E))}i.update(d)}),i?g.jsx("primitive",{object:i.scene}):null}function Q1e({url:t,audioLevel:e,emotion:n}){const[r,i]=R.useState(null);return g.jsxs("div",{className:"relative h-full w-full",children:[g.jsxs(Gbe,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[g.jsx("ambientLight",{intensity:.85}),g.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),g.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),g.jsx(Z1e,{url:t,audioLevel:e,emotion:n,onError:i},t),g.jsx(Jbe,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&g.jsx("div",{className:"absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-red-500/15 border border-red-500/30 px-3 py-1.5 text-xs text-red-300",children:r})]})}const J1e=["elevenlabs","edge"],eSe={elevenlabs:"ElevenLabs (premium)",edge:"Edge (natürlich · gratis)"};function tSe(){const[t,e]=R.useState([]),[n,r]=R.useState(localStorage.getItem("mc_voice_engine")||"elevenlabs"),[i,s]=R.useState(localStorage.getItem("mc_voice_voice")||""),[o,a]=R.useState(!1),[l,c]=R.useState(()=>{const _=localStorage.getItem("mc_voice_volume");if(_===null||_==="")return .6;const E=Number(_);return Number.isNaN(E)?.6:E}),d=R.useRef(null),f=_=>{c(_),localStorage.setItem("mc_voice_volume",String(_)),window.dispatchEvent(new CustomEvent("mc-voice-volume",{detail:_}))},m=(_,E)=>{r(_),s(E),localStorage.setItem("mc_voice_engine",_),localStorage.setItem("mc_voice_voice",E)};R.useEffect(()=>{fetch("/api/voice/voices").then(_=>_.ok?_.json():Promise.reject()).then(_=>{const E=_.voices||[];if(e(E),!i){const T=E.find(C=>C.engine===n);T&&m(n,T.id)}}).catch(()=>e([]))},[]);const y=async()=>{var _;if(!o){a(!0);try{const E=await fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:"Hallo! So klingt diese Stimme auf Deutsch.",engine:n,voice:i})});if(!E.ok)throw new Error(`TTS ${E.status}`);const T=URL.createObjectURL(await E.blob());(_=d.current)==null||_.pause();const C=new Audio(T);C.volume=Math.min(1,l),d.current=C,C.onended=()=>URL.revokeObjectURL(T),await C.play()}catch(E){console.error("Probe fehlgeschlagen:",E)}finally{a(!1)}}},x=_=>{const E=t.find(T=>T.engine===_);m(_,(E==null?void 0:E.id)||"")},S=t.filter(_=>_.engine===n),w=n==="elevenlabs"&&S.length===0;return g.jsxs("div",{className:"text-sm",children:[g.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[g.jsx(Gm,{className:"h-3.5 w-3.5"})," Stimme"]}),t.length===0?g.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-300",children:"Voice-Dienst nicht erreichbar — Stimmen werden geladen, sobald der Sidecar läuft."}):g.jsxs("div",{className:"space-y-2",children:[g.jsx("div",{className:"grid grid-cols-2 gap-1.5",children:J1e.map(_=>g.jsx("button",{onClick:()=>x(_),className:`rounded-md border px-2.5 py-1.5 text-xs transition-colors ${n===_?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:eSe[_]},_))}),g.jsx("select",{value:i,onChange:_=>m(n,_.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(_=>g.jsx("option",{value:_.id,children:_.label},_.id))}),g.jsxs("button",{onClick:y,disabled:o||w,className:"flex w-full items-center justify-center gap-2 rounded-md border border-primary/40 bg-primary/10 px-2.5 py-2 text-xs text-primary hover:bg-primary/20 transition-colors disabled:opacity-60",children:[o?g.jsx(_P,{className:"h-3.5 w-3.5 animate-spin"}):g.jsx(DT,{className:"h-3.5 w-3.5"}),o?"Spielt …":"Probe hören"]}),g.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[g.jsx(DT,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),g.jsx("input",{type:"range",min:0,max:1.2,step:.05,value:l,onChange:_=>f(Number(_.target.value)),className:"h-1 flex-1 cursor-pointer accent-primary",title:"Lautstärke"}),g.jsxs("span",{className:"w-9 text-right text-[11px] tabular-nums text-muted-foreground",children:[Math.round(l*100),"%"]})]}),w&&g.jsxs("p",{className:"text-[11px] text-amber-300",children:["Keine ElevenLabs-Stimmen — Key in ",g.jsx("code",{children:"~/.hermes/.env"})," fehlt, oder keine eigene Stimme angelegt."]}),n==="edge"&&g.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Edge: native deutsche Stimmen, gratis & ohne Key. Cloud (Text → Microsoft)."})]})]})}function nSe(t){const[e,n]=R.useState(!1),r=R.useRef(null),i=R.useRef([]),s=R.useRef(null),o=R.useCallback(async()=>{if(r.current)return;let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(f){console.error("Mikrofon-Zugriff verweigert:",f);return}s.current=l;const c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(l,{mimeType:c});i.current=[],d.ondataavailable=f=>{f.data.size&&i.current.push(f.data)},d.onstop=()=>{var m;const f=new Blob(i.current,{type:c});(m=s.current)==null||m.getTracks().forEach(y=>y.stop()),s.current=null,r.current=null,n(!1),f.size>1200&&t(f)},d.start(),r.current=d,n(!0)},[t]),a=R.useCallback(()=>{var l;(l=r.current)==null||l.stop()},[]);return R.useEffect(()=>()=>{var l,c;(l=r.current)==null||l.stop(),(c=s.current)==null||c.getTracks().forEach(d=>d.stop())},[]),{recording:e,start:o,stop:a}}class cN{constructor(){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=cN.readVolume(),this.analyser.connect(this.gain),this.gain.connect(this.ctx.destination),this.freq=new Uint8Array(new ArrayBuffer(this.analyser.frequencyBinCount)),window.addEventListener("mc-voice-volume",n=>{const r=Number(n.detail);Number.isNaN(r)||(this.gain.gain.value=Math.max(0,Math.min(1.5,r)))})}static readVolume(){const e=localStorage.getItem("mc_voice_volume");if(e===null||e==="")return .6;const n=Number(e);return Number.isNaN(n)?.6:Math.max(0,Math.min(1.5,n))}async enqueue(e){this.queue.push(e),this.playing||await this.playNext()}clear(){this.queue=[]}async playNext(){var i,s;const e=this.queue.shift();if(!e){this.playing=!1,this.stopMeter(),(i=this.onSpeaking)==null||i.call(this,!1);return}if(this.playing=!0,(s=this.onSpeaking)==null||s.call(this,!0),this.ctx.state==="suspended")try{await this.ctx.resume()}catch{}let n;try{n=await this.ctx.decodeAudioData(e.slice(0))}catch{return this.playNext()}const r=this.ctx.createBufferSource();r.buffer=n,r.connect(this.analyser),r.onended=()=>{this.playNext()},r.start(),this.startMeter()}startMeter(){cancelAnimationFrame(this.raf);const e=()=>{this.analyser.getByteFrequencyData(this.freq);const n=Math.min(this.freq.length,48);let r=0;for(let s=2;s~|`]+/g," ").replace(/^\s*[-•·]\s+/gm," ").replace(/\s*&\s*/g," und ").replace(/(\d)\s*%/g,"$1 Prozent").replace(/%/g," Prozent ").replace(/(\d)\s*°\s*C?/g,"$1 Grad").replace(/°/g," Grad ").replace(/\s*=\s*/g," gleich ").replace(/\s*\/\s*/g," ").replace(/[\u{1F300}-\u{1FAFF}\u{2600}-\u{27BF}\u{2190}-\u{21FF}\u{2B00}-\u{2BFF}]/gu,"").replace(/\s+/g," ").trim()}function IU(){let t=localStorage.getItem("mc_voice_session");return t||(t="voice-"+Math.random().toString(36).slice(2)+Date.now().toString(36),localStorage.setItem("mc_voice_session",t)),t}function aSe(){return{engine:localStorage.getItem("mc_voice_engine")||"elevenlabs",voice:localStorage.getItem("mc_voice_voice")||""}}function lSe(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),o=R.useRef({current:0}),a=R.useRef("neutral"),l=R.useRef(null),c=R.useRef(IU()),d=R.useCallback(()=>{if(!l.current){const E=new cN;E.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=E,o.current=E.level}return l.current},[]),f=R.useCallback(async E=>{var ne,te,he,se;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const fe=new FormData;fe.append("audio",E,"rec.webm");const B=await fetch("/api/voice/stt",{method:"POST",body:fe});if(!B.ok)throw new Error(`STT ${B.status}`);C=((ne=(await B.json()).text)==null?void 0:ne.trim())||""}catch(fe){e("error"),s(`Spracherkennung fehlgeschlagen: ${fe.message}`);return}if(!C){e("idle");return}r(fe=>[...fe,{role:"user",text:C}]),e("thinking");const{engine:O,voice:N}=aSe();let D="",F="";r(fe=>[...fe,{role:"assistant",text:""}]);let G=Promise.resolve(),k=!1,U=!1;const H=fe=>{const B=oSe(fe);B&&(G=G.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){U=!0,console.error("TTS-Fehler:",J)}}))};try{const fe=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:C,session_id:c.current,system:sSe})});if(!fe.ok||!fe.body)throw new Error(`Agent ${fe.status}`);const B=fe.body.getReader(),J=new TextDecoder;let Y="";for(;;){const{done:V,value:q}=await B.read();if(V)break;Y+=J.decode(q,{stream:!0});const pe=Y.split(` -`);K=ge.pop()||"";for(const le of ge){const ue=le.split(` -`).find(Ke=>Ke.startsWith("data:"));if(!ue)continue;const _e=ue.slice(5).trim();if(_e==="[DONE]")continue;let Se;try{Se=JSON.parse(_e)}catch{continue}if(Se.error)throw new Error(Se.error);const qe=((oe=(he=(te=Se.choices)==null?void 0:te[0])==null?void 0:he.delta)==null?void 0:oe.content)||"";if(!qe)continue;D+=qe,F+=qe,a.current=rSe(D),r(Ke=>{const ce=Ke.slice();return ce[ce.length-1]={role:"assistant",text:D},ce});const{sentences:Me,rest:We}=aSe(F);F=We,Me.forEach(H)}}if(F.trim()&&H(F),await V,!D.trim()){e("idle");return}k||(e("error"),s(U?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(fe){e("error"),s(`Agent-Antwort fehlgeschlagen: ${fe.message}`)}},[d]),{recording:m,start:y,stop:x}=tSe(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),w=R.useCallback(()=>{x()},[x]),_=R.useCallback(()=>{var E;(E=l.current)==null||E.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=NU()},[]);return R.useEffect(()=>{!m&&t==="listening"&&e("transcribing")},[m,t]),{status:t,messages:n,error:i,recording:m,audioLevel:o,emotion:a,pressStart:S,pressEnd:w,reset:_}}const cSe="/avatar.vrm";function uSe(t){return t.split(/(\*\*[^*\n]+\*\*)/g).map((e,n)=>{const r=e.match(/^\*\*([^*]+)\*\*$/);return r?g.jsx("strong",{className:"font-semibold text-foreground",children:r[1]},n):g.jsx("span",{children:e},n)})}function dSe(){return g.jsx("span",{className:"inline-flex items-center gap-1 align-middle",children:[0,1,2].map(t=>g.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground",style:{animationDelay:`${t*.15}s`}},t))})}const fSe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function hSe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:o,pressEnd:a,reset:l}=lSe(),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),x=w=>{w.code!=="Space"||w.repeat||c.current||y(w.target)||(w.preventDefault(),c.current=!0,o())},S=w=>{w.code!=="Space"||!c.current||(w.preventDefault(),c.current=!1,a())};return window.addEventListener("keydown",x),window.addEventListener("keyup",S),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",S)}},[o,a]);const f=t==="speaking",m=t==="transcribing"||t==="thinking";return g.jsxs("div",{className:"flex h-full gap-5",children:[g.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[g.jsx("div",{className:"flex-1 min-h-0",children:g.jsx(Z1e,{url:cSe,audioLevel:i,emotion:s})}),g.jsxs("div",{className:"shrink-0 flex flex-col items-center gap-3 border-t border-border/40 bg-background/30 py-5 backdrop-blur-sm",children:[g.jsxs("div",{className:tt("flex items-center gap-2 text-sm",t==="error"?"text-red-400":f?"text-primary":"text-muted-foreground"),children:[m&&g.jsx(bP,{className:"h-4 w-4 animate-spin"}),f&&g.jsx(LT,{className:"h-4 w-4 animate-pulse"}),g.jsx("span",{children:n||fSe[t]})]}),g.jsx("button",{onPointerDown:y=>{y.preventDefault(),c.current=!0,o()},onPointerUp:()=>{c.current&&(c.current=!1,a())},onPointerLeave:()=>{c.current&&(c.current=!1,a())},className:tt("flex h-20 w-20 items-center justify-center rounded-full border-2 transition-all select-none touch-none",r?"border-red-500 bg-red-500/20 scale-110 shadow-lg shadow-red-500/30":"border-primary/60 bg-primary/15 hover:bg-primary/25 hover:scale-105"),title:"Gedrückt halten zum Sprechen (oder Leertaste halten)",children:g.jsx(aF,{className:tt("h-8 w-8",r?"text-red-400":"text-primary")})}),g.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",g.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),g.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[g.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4",children:g.jsx(eSe,{})}),g.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[g.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),g.jsx("button",{onClick:l,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:g.jsx(Z8,{className:"h-3.5 w-3.5"})})]}),g.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4 scrollbar-thin",children:[e.length===0&&g.jsx("p",{className:"text-xs text-muted-foreground",children:"Halte den Knopf (oder die Leertaste) und sprich. Hermes hört zu, denkt mit seinem vollen Gedächtnis und seinen Werkzeugen — und antwortet hörbar."}),e.map((y,x)=>g.jsxs("div",{className:tt("flex flex-col gap-1",y.role==="user"?"items-end":"items-start"),children:[g.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:y.role==="user"?"Du":"Hermes"}),g.jsx("div",{className:tt("max-w-[88%] whitespace-pre-wrap break-words rounded-2xl px-3 py-2 text-sm leading-relaxed",y.role==="user"?"rounded-br-sm bg-primary/15 text-foreground":"rounded-bl-sm border border-border/40 bg-background/40 text-foreground/90"),children:y.text?uSe(y.text):g.jsx(dSe,{})})]},x)),g.jsx("div",{ref:d})]})]})]})]})}const IU=[{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 pSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function mo({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:o}){return g.jsxs("section",{id:t,className:tt("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",o&&"md:col-span-2"),children:[g.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[g.jsx(e,{className:tt("h-5 w-5 shrink-0",n)}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&g.jsx("span",{className:tt("text-[9px] font-mono",n),children:i})]})]}),g.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Vf({children:t}){return g.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[g.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[g.jsx(Gm,{className:"h-3 w-3"})," Bei dir konkret"]}),g.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function pn({children:t}){return g.jsx("code",{className:"rounded bg-background/40 border border-border/30 px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:t})}function Or({href:t,name:e,note:n}){return g.jsxs("li",{className:"leading-relaxed",children:[g.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,g.jsx(y8,{className:"h-3 w-3 opacity-60"})]}),g.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function mSe(){const[t,e]=R.useState(!1);return g.jsxs("div",{className:"space-y-7",children:[g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 flex items-start gap-4",children:[g.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:g.jsx(CT,{className:"h-6 w-6 text-primary"})}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Die AI-Bibel"}),g.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-2xl",children:["Allgemeines Nachschlagewerk für lokale & agentische AI — Konzepte, Tricks, Kniffe und kuratierte Quellen. ",g.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",g.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),g.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:g.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:g.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[g.jsx(RT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?IU:IU.slice(0,9)).map(n=>g.jsx("button",{onClick:()=>pSe(n.id),className:"rounded-lg px-2.5 py-1 text-[11px] font-semibold text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:n.label},n.id)),g.jsx("button",{onClick:()=>e(n=>!n),className:"rounded-lg px-2 py-1 text-[11px] font-semibold text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:t?"weniger":"+ mehr"})]})})}),g.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[g.jsxs(mo,{id:"grundlagen",icon:El,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[g.jsxs("p",{children:["Ein LLM ist im Kern ein ",g.jsx("strong",{children:"Wahrscheinlichkeits-Rechner für das nächste Token"}),' (Wortteil). Es „weiß" nichts — es setzt fort, was statistisch am plausibelsten ist. Daraus folgt fast alles andere.']}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),g.jsxs("li",{children:[g.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",g.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),g.jsxs(mo,{id:"moe",icon:W1,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",g.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",g.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),g.jsxs("p",{children:[g.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx(pn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),g.jsxs("li",{children:[g.jsx(pn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),g.jsxs("li",{children:[g.jsx(pn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),g.jsxs(Vf,{children:["VRAM/RAM ist die harte Grenze — ",g.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",g.jsx(pn,{children:"Q4_K_M"}),"/",g.jsx(pn,{children:"Q6_K"}),"."]})]}),g.jsxs(mo,{id:"lokal",icon:tw,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"llama-swap"})," — Proxy, der ",g.jsx("em",{children:"mehrere"})," Modelle hinter ",g.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),g.jsx("ul",{className:"list-disc pl-4 space-y-1",children:g.jsxs("li",{children:[g.jsx(pn,{children:"CUDA"})," NVIDIA · ",g.jsx(pn,{children:"ROCm"})," AMD · ",g.jsx(pn,{children:"Vulkan"})," herstellerübergreifend · ",g.jsx(pn,{children:"Metal"})," Apple"]})}),g.jsxs("p",{className:"pt-1",children:[g.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",g.jsx(pn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",g.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),g.jsxs(Vf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",g.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",g.jsx(pn,{children:"Vulkan/RADV"})," das offizielle ",g.jsx(pn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",g.jsx(pn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",g.jsx(pn,{children:"coder"})," nutzt Spec-Decoding."]})]}),g.jsxs(mo,{id:"modelle",icon:PT,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx("p",{children:g.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Llama"})," (Meta), ",g.jsx("strong",{children:"Gemma"})," (Google), ",g.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"DeepSeek"}),", ",g.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx("p",{children:g.jsx("strong",{children:"Frontier (Cloud-API):"})}),g.jsx("ul",{className:"list-disc pl-4 space-y-1",children:g.jsxs("li",{children:[g.jsx("strong",{children:"Claude"})," (Anthropic), ",g.jsx("strong",{children:"GPT"})," (OpenAI), ",g.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),g.jsxs("p",{className:"pt-1",children:[g.jsx("strong",{children:"Modellwahl nach Aufgabe:"})," schnelles Alltags-Hirn · großes Logik-Hirn für harte Tasks · dediziertes Code-Modell · multimodal für Bilder · Embedding-Modell fürs Gedächtnis."]})]})]}),g.jsx("p",{className:"text-[11px] italic",children:'Leaderboards (HF, LMArena) sind grobe Orientierung — der einzige Benchmark, der zählt, ist deine eigene Aufgabe. Vorsicht vor „Benchmaxxing".'}),g.jsxs(Vf,{children:["Dein Line-up via llama-swap: ",g.jsx(pn,{children:"fast"})," (Alltag/Vision/MoE) · ",g.jsx(pn,{children:"heavy"})," (schwere Logik) ·",g.jsx(pn,{children:"coder"})," · ",g.jsx(pn,{children:"scout"})," · ",g.jsx(pn,{children:"vision"})," · ",g.jsx(pn,{children:"embed"})," (fürs Gedächtnis) ·",g.jsx(pn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",g.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),g.jsxs(mo,{id:"gateway",icon:$8,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[g.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",g.jsx("strong",{children:"OpenAI-Format"})," (",g.jsx(pn,{children:"/v1/chat/completions"}),"). Ein",g.jsx("strong",{children:" Gateway"})," davor gibt dir ",g.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",g.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),g.jsxs("p",{children:["Die ",g.jsx(pn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),g.jsxs(Vf,{children:["Dein Gateway: ",g.jsx(pn,{children:"http://192.168.178.151:9001/v1"}),", Model ",g.jsx(pn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",g.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),g.jsxs(mo,{id:"mcp",icon:IT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[g.jsxs("p",{children:["Das ",g.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",g.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),g.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),g.jsxs("div",{className:"flex items-start gap-1.5 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-2.5 text-[11px]",children:[g.jsx(H8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),g.jsxs("span",{children:[g.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),g.jsxs(mo,{id:"skills",icon:Y8,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[g.jsxs("p",{children:["Ein ",g.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",g.jsx(pn,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),g.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- +`);Y=pe.pop()||"";for(const ae of pe){const le=ae.split(` +`).find(Ke=>Ke.startsWith("data:"));if(!le)continue;const be=le.slice(5).trim();if(be==="[DONE]")continue;let Se;try{Se=JSON.parse(be)}catch{continue}if(Se.error)throw new Error(Se.error);const qe=((se=(he=(te=Se.choices)==null?void 0:te[0])==null?void 0:he.delta)==null?void 0:se.content)||"";if(!qe)continue;D+=qe,F+=qe,a.current=iSe(D),r(Ke=>{const ce=Ke.slice();return ce[ce.length-1]={role:"assistant",text:D},ce});const{sentences:Me,rest:$e}=lSe(F);F=$e,Me.forEach(H)}}if(F.trim()&&H(F),await G,!D.trim()){e("idle");return}k||(e("error"),s(U?"Sprachausgabe fehlgeschlagen — Engine/Stimme prüfen.":"Keine Sprachausgabe erzeugt."))}catch(fe){e("error"),s(`Agent-Antwort fehlgeschlagen: ${fe.message}`)}},[d]),{recording:m,start:y,stop:x}=nSe(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),w=R.useCallback(()=>{x()},[x]),_=R.useCallback(()=>{var E;(E=l.current)==null||E.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=IU()},[]);return R.useEffect(()=>{!m&&t==="listening"&&e("transcribing")},[m,t]),{status:t,messages:n,error:i,recording:m,audioLevel:o,emotion:a,pressStart:S,pressEnd:w,reset:_}}const uSe="/avatar.vrm";function dSe(t){return t.split(/(\*\*[^*\n]+\*\*)/g).map((e,n)=>{const r=e.match(/^\*\*([^*]+)\*\*$/);return r?g.jsx("strong",{className:"font-semibold text-foreground",children:r[1]},n):g.jsx("span",{children:e},n)})}function fSe(){return g.jsx("span",{className:"inline-flex items-center gap-1 align-middle",children:[0,1,2].map(t=>g.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-muted-foreground",style:{animationDelay:`${t*.15}s`}},t))})}const hSe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function pSe(){const{status:t,messages:e,error:n,recording:r,audioLevel:i,emotion:s,pressStart:o,pressEnd:a,reset:l}=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),x=w=>{w.code!=="Space"||w.repeat||c.current||y(w.target)||(w.preventDefault(),c.current=!0,o())},S=w=>{w.code!=="Space"||!c.current||(w.preventDefault(),c.current=!1,a())};return window.addEventListener("keydown",x),window.addEventListener("keyup",S),()=>{window.removeEventListener("keydown",x),window.removeEventListener("keyup",S)}},[o,a]);const f=t==="speaking",m=t==="transcribing"||t==="thinking";return g.jsxs("div",{className:"flex h-full gap-5",children:[g.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[g.jsx("div",{className:"flex-1 min-h-0",children:g.jsx(Q1e,{url:uSe,audioLevel:i,emotion:s})}),g.jsxs("div",{className:"shrink-0 flex flex-col items-center gap-3 border-t border-border/40 bg-background/30 py-5 backdrop-blur-sm",children:[g.jsxs("div",{className:nt("flex items-center gap-2 text-sm",t==="error"?"text-red-400":f?"text-primary":"text-muted-foreground"),children:[m&&g.jsx(_P,{className:"h-4 w-4 animate-spin"}),f&&g.jsx(DT,{className:"h-4 w-4 animate-pulse"}),g.jsx("span",{children:n||hSe[t]})]}),g.jsx("button",{onPointerDown:y=>{y.preventDefault(),c.current=!0,o()},onPointerUp:()=>{c.current&&(c.current=!1,a())},onPointerLeave:()=>{c.current&&(c.current=!1,a())},className:nt("flex h-20 w-20 items-center justify-center rounded-full border-2 transition-all select-none touch-none",r?"border-red-500 bg-red-500/20 scale-110 shadow-lg shadow-red-500/30":"border-primary/60 bg-primary/15 hover:bg-primary/25 hover:scale-105"),title:"Gedrückt halten zum Sprechen (oder Leertaste halten)",children:g.jsx(lF,{className:nt("h-8 w-8",r?"text-red-400":"text-primary")})}),g.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",g.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),g.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[g.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4",children:g.jsx(tSe,{})}),g.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[g.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),g.jsx("button",{onClick:l,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:g.jsx(Q8,{className:"h-3.5 w-3.5"})})]}),g.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4 scrollbar-thin",children:[e.length===0&&g.jsx("p",{className:"text-xs text-muted-foreground",children:"Halte den Knopf (oder die Leertaste) und sprich. Hermes hört zu, denkt mit seinem vollen Gedächtnis und seinen Werkzeugen — und antwortet hörbar."}),e.map((y,x)=>g.jsxs("div",{className:nt("flex flex-col gap-1",y.role==="user"?"items-end":"items-start"),children:[g.jsx("span",{className:"px-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:y.role==="user"?"Du":"Hermes"}),g.jsx("div",{className:nt("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?dSe(y.text):g.jsx(fSe,{})})]},x)),g.jsx("div",{ref:d})]})]})]})]})}const kU=[{id:"grundlagen",label:"Grundlagen"},{id:"moe",label:"MoE & Quant"},{id:"lokal",label:"Lokal betreiben"},{id:"modelle",label:"Modell-Landschaft"},{id:"gateway",label:"Gateway-Trick"},{id:"mcp",label:"MCP"},{id:"skills",label:"Skills"},{id:"memory",label:"Gedächtnis & RAG"},{id:"agents",label:"Agenten"},{id:"ide",label:"IDE anbinden"},{id:"tricks",label:"Tricks & Kniffe"},{id:"wartung",label:"Sicherheit & Wartung"},{id:"ressourcen",label:"Ressourcen"},{id:"troubleshooting",label:"Troubleshooting"}];function mSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function mo({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:o}){return g.jsxs("section",{id:t,className:nt("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",o&&"md:col-span-2"),children:[g.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[g.jsx(e,{className:nt("h-5 w-5 shrink-0",n)}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&g.jsx("span",{className:nt("text-[9px] font-mono",n),children:i})]})]}),g.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Vf({children:t}){return g.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[g.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[g.jsx(Gm,{className:"h-3 w-3"})," Bei dir konkret"]}),g.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function pn({children:t}){return g.jsx("code",{className:"rounded bg-background/40 border border-border/30 px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:t})}function Or({href:t,name:e,note:n}){return g.jsxs("li",{className:"leading-relaxed",children:[g.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,g.jsx(x8,{className:"h-3 w-3 opacity-60"})]}),g.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function gSe(){const[t,e]=R.useState(!1);return g.jsxs("div",{className:"space-y-7",children:[g.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 flex items-start gap-4",children:[g.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:g.jsx(PT,{className:"h-6 w-6 text-primary"})}),g.jsxs("div",{className:"space-y-1",children:[g.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Die AI-Bibel"}),g.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-2xl",children:["Allgemeines Nachschlagewerk für lokale & agentische AI — Konzepte, Tricks, Kniffe und kuratierte Quellen. ",g.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",g.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),g.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:g.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:g.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[g.jsx(NT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?kU:kU.slice(0,9)).map(n=>g.jsx("button",{onClick:()=>mSe(n.id),className:"rounded-lg px-2.5 py-1 text-[11px] font-semibold text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:n.label},n.id)),g.jsx("button",{onClick:()=>e(n=>!n),className:"rounded-lg px-2 py-1 text-[11px] font-semibold text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:t?"weniger":"+ mehr"})]})})}),g.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[g.jsxs(mo,{id:"grundlagen",icon:El,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[g.jsxs("p",{children:["Ein LLM ist im Kern ein ",g.jsx("strong",{children:"Wahrscheinlichkeits-Rechner für das nächste Token"}),' (Wortteil). Es „weiß" nichts — es setzt fort, was statistisch am plausibelsten ist. Daraus folgt fast alles andere.']}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),g.jsxs("li",{children:[g.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",g.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),g.jsxs(mo,{id:"moe",icon:$1,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",g.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",g.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),g.jsxs("p",{children:[g.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx(pn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),g.jsxs("li",{children:[g.jsx(pn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),g.jsxs("li",{children:[g.jsx(pn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),g.jsxs(Vf,{children:["VRAM/RAM ist die harte Grenze — ",g.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",g.jsx(pn,{children:"Q4_K_M"}),"/",g.jsx(pn,{children:"Q6_K"}),"."]})]}),g.jsxs(mo,{id:"lokal",icon:nw,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"llama-swap"})," — Proxy, der ",g.jsx("em",{children:"mehrere"})," Modelle hinter ",g.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),g.jsx("ul",{className:"list-disc pl-4 space-y-1",children:g.jsxs("li",{children:[g.jsx(pn,{children:"CUDA"})," NVIDIA · ",g.jsx(pn,{children:"ROCm"})," AMD · ",g.jsx(pn,{children:"Vulkan"})," herstellerübergreifend · ",g.jsx(pn,{children:"Metal"})," Apple"]})}),g.jsxs("p",{className:"pt-1",children:[g.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",g.jsx(pn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",g.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),g.jsxs(Vf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",g.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",g.jsx(pn,{children:"Vulkan/RADV"})," das offizielle ",g.jsx(pn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",g.jsx(pn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",g.jsx(pn,{children:"coder"})," nutzt Spec-Decoding."]})]}),g.jsxs(mo,{id:"modelle",icon:RT,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx("p",{children:g.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Llama"})," (Meta), ",g.jsx("strong",{children:"Gemma"})," (Google), ",g.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"DeepSeek"}),", ",g.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsx("p",{children:g.jsx("strong",{children:"Frontier (Cloud-API):"})}),g.jsx("ul",{className:"list-disc pl-4 space-y-1",children:g.jsxs("li",{children:[g.jsx("strong",{children:"Claude"})," (Anthropic), ",g.jsx("strong",{children:"GPT"})," (OpenAI), ",g.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),g.jsxs("p",{className:"pt-1",children:[g.jsx("strong",{children:"Modellwahl nach Aufgabe:"})," schnelles Alltags-Hirn · großes Logik-Hirn für harte Tasks · dediziertes Code-Modell · multimodal für Bilder · Embedding-Modell fürs Gedächtnis."]})]})]}),g.jsx("p",{className:"text-[11px] italic",children:'Leaderboards (HF, LMArena) sind grobe Orientierung — der einzige Benchmark, der zählt, ist deine eigene Aufgabe. Vorsicht vor „Benchmaxxing".'}),g.jsxs(Vf,{children:["Dein Line-up via llama-swap: ",g.jsx(pn,{children:"fast"})," (Alltag/Vision/MoE) · ",g.jsx(pn,{children:"heavy"})," (schwere Logik) ·",g.jsx(pn,{children:"coder"})," · ",g.jsx(pn,{children:"scout"})," · ",g.jsx(pn,{children:"vision"})," · ",g.jsx(pn,{children:"embed"})," (fürs Gedächtnis) ·",g.jsx(pn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",g.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),g.jsxs(mo,{id:"gateway",icon:X8,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[g.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",g.jsx("strong",{children:"OpenAI-Format"})," (",g.jsx(pn,{children:"/v1/chat/completions"}),"). Ein",g.jsx("strong",{children:" Gateway"})," davor gibt dir ",g.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",g.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),g.jsxs("p",{children:["Die ",g.jsx(pn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),g.jsxs(Vf,{children:["Dein Gateway: ",g.jsx(pn,{children:"http://192.168.178.151:9001/v1"}),", Model ",g.jsx(pn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",g.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),g.jsxs(mo,{id:"mcp",icon:kT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[g.jsxs("p",{children:["Das ",g.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",g.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),g.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),g.jsxs("div",{className:"flex items-start gap-1.5 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-2.5 text-[11px]",children:[g.jsx(V8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),g.jsxs("span",{children:[g.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),g.jsxs(mo,{id:"skills",icon:Z8,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[g.jsxs("p",{children:["Ein ",g.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",g.jsx(pn,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),g.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- name: tdd-pro description: Treibt Entwicklung mit strikter TDD-Praxis --- # Instructions -...`}),g.jsxs("p",{children:["Suchen & installieren über die ",g.jsx("strong",{children:"skills.sh"}),"-Registry: ",g.jsx(pn,{children:"npx skills find"})," /",g.jsx(pn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),g.jsxs(mo,{id:"memory",icon:R8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:["LLMs sind ",g.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",g.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:["extrahiert Fakten ",g.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),g.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),g.jsxs("li",{children:[g.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",g.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),g.jsxs(Vf,{children:["Dein Gedächtnis (Tab ",g.jsx("strong",{children:"Gedächtnis"}),") ist ",g.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",g.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",g.jsx(pn,{children:"Identität"})," · ",g.jsx(pn,{children:"Wissen"})," · ",g.jsx(pn,{children:"Regeln"})," · ",g.jsx(pn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",g.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",g.jsx("br",{}),g.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),g.jsxs(mo,{id:"agents",icon:Il,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:["Ein ",g.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",g.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Least Privilege:"})," gib einem Agenten nur die Tools, die er wirklich braucht. Kritische Aktionen (Shell auf dem Host, Löschen, Geld/Deploys) hinter menschliche Freigabe."]}),g.jsxs("p",{children:[g.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",g.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),g.jsxs(Vf,{children:[g.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",g.jsx(pn,{children:"fast"}),"). Reden tust du mit ihm im",g.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",g.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",g.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",g.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),g.jsxs(mo,{id:"ide",icon:oF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[g.jsxs("p",{children:["Jede ",g.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Cline"})," & ",g.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Continue"}),", ",g.jsx("strong",{children:"aider"})," (CLI), ",g.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),g.jsxs(Vf,{children:["Tipp den Kram nicht ab: der ",g.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",g.jsx(pn,{children:"…:9001/v1"}),", Model ",g.jsx(pn,{children:"auto"}),", Key beliebig."]})]}),g.jsx(mo,{id:"tricks",icon:z8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:g.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:[["Kontext sauber halten","Neue Session statt Mega-Historie. Drift, Tempo und Halluzination hängen direkt am Kontext-Müll."],["Plan-then-Act","Erst Plan/Vorgehen bestätigen lassen, dann ausführen. Spart teure Holzwege."],["Gezielte Edits","Nie ganze Dateien überschreiben für eine Zeile — Such-/Ersetz-Tools nutzen. Weniger Tokens, weniger Fehler."],["Non-interaktive Befehle","Keine interaktiven Prompts im Agent-Terminal; lange Tasks als Background-Job. Sonst hängt der Loop."],["DevTools koppeln","Browser-/Konsolen-Zugriff geben — der Agent liest echte Fehler statt blind zu raten."],["Richtige Modellwahl","Schnelles Hirn für Alltag, großes für harte Logik, Coder fürs Coden. Nicht alles mit der Kanone."],["Akzeptanzkriterien","Sag konkret, woran „fertig“ erkennbar ist. Vage Prompts → vage Ergebnisse."],["Verifizieren statt vertrauen","Tests/Live-Check fordern. „Sollte funktionieren“ ist kein Beweis."],["Regeln ins Gedächtnis","Wiederkehrende Vorlieben/Konventionen einmal ablegen — der Agent zieht sie selbst."]].map(([n,r])=>g.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[g.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[g.jsx(xh,{className:"h-3 w-3 text-amber-400"})," ",n]}),g.jsx("p",{className:"text-[11px]",children:r})]},n))})}),g.jsx(mo,{id:"wartung",icon:Zm,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[g.jsx(k8,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[g.jsx(nw,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",g.jsx(pn,{children:"restore.sh"})," (Doku in ",g.jsx(pn,{children:"docs/BACKUP.md"}),")."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",g.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",g.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),g.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),g.jsxs("section",{id:"ressourcen",className:"scroll-mt-20 md:col-span-2 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[g.jsx(RT,{className:"h-5 w-5 text-primary"}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),g.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),g.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(PT,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Or,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),g.jsx(Or,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),g.jsx(Or,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),g.jsx(Or,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),g.jsx(Or,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),g.jsx(Or,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(IT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Or,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),g.jsx(Or,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),g.jsx(Or,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),g.jsx(Or,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),g.jsx(Or,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(Il,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Or,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),g.jsx(Or,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),g.jsx(Or,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),g.jsx(Or,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),g.jsx(Or,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(CT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Or,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),g.jsx(Or,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),g.jsx(Or,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),g.jsx(Or,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),g.jsx(Or,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),g.jsx(mo,{id:"troubleshooting",icon:F8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:g.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",g.jsx(pn,{children:":9001"}),")? Backend-Status in der ",g.jsx("strong",{children:"Zentrale"})," prüfen."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",g.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",g.jsx(pn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",g.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",g.jsx(pn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),g.jsx("p",{className:"text-center text-[10px] text-muted-foreground/50 pt-2",children:"Mission Control 2 · AI-Bibel · Stand Juni 2026 — lebendes Dokument, wächst mit dem Stack."})]})}function gSe({title:t,hint:e}){return g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-xl font-semibold",children:t}),g.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),g.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[g.jsx(P8,{className:"h-8 w-8 text-muted-foreground"}),g.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const kU=[{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 L_({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:o,onAction:a}){return g.jsxs("div",{className:tt("flex items-center gap-3 rounded-lg border px-3 py-2",i?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[g.jsx(t,{className:tt("h-4 w-4 shrink-0",e)}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs text-foreground truncate",children:n}),g.jsx("div",{className:tt("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),g.jsx("button",{onClick:a,disabled:!i||s,className:tt("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:s?"…":o})]})}function vSe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return g.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[g.jsx("span",{className:tt("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),g.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&g.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),g.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:g.jsx(Vm,{className:tt("h-3.5 w-3.5",r&&"animate-spin")})}),g.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:g.jsx(N8,{className:"h-3.5 w-3.5"})})]})}function hT(t){return t==null?"":t>1024**3?`${(t/1024**3).toFixed(2)} GB`:`${(t/1024**2).toFixed(1)} MB`}function ySe({open:t,onClose:e,defaultTab:n="maintenance"}){var nt;const[r,i]=R.useState(null),[s,o]=R.useState([]),[a,l]=R.useState("llama-swap"),[c,d]=R.useState(""),[f,m]=R.useState(!1),[y,x]=R.useState(null),[S,w]=R.useState({}),[_,E]=R.useState("maintenance"),[T,C]=R.useState(!1),[O,N]=R.useState(""),[D,F]=R.useState(!1),[V,k]=R.useState(null),[U,H]=R.useState([]),[ne,te]=R.useState(!1),[he,oe]=R.useState(null),[fe,B]=R.useState(null);function q(se,rt,$e){B({type:"alert",title:se,message:rt,onConfirm:()=>{B(null),$e&&$e()}})}function K(se,rt,$e){B({type:"confirm",title:se,message:rt,onConfirm:()=>{B(null),$e()},onCancel:()=>B(null)})}function $(se){return se?new Date(se*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[Z,ge]=R.useState(""),[le,ue]=R.useState(""),[_e,Se]=R.useState(!1),[qe,Me]=R.useState(!1);R.useEffect(()=>{t&&(ge(localStorage.getItem("mc_sudo_password")||""),ue(localStorage.getItem("mc_hf_token")||""))},[t]),R.useEffect(()=>{t&&n&&E(n)},[t,n]);const We=R.useRef(null);function Ke(){Ft("/api/maintenance/updates").then(i).catch(se=>console.error("Error loading updates",se))}function ce(){Ft("/api/jobs").then(se=>o(se.jobs||[])).catch(se=>console.error("Error loading jobs",se))}function Q(){Ft("/api/system/services").then(k).catch(()=>{})}function Ge(){Ft("/api/system/backups").then(se=>H(se.backups||[])).catch(()=>{})}function De(se){m(!0),x(null),Ft(`/api/maintenance/logs?service=${se}&lines=150`).then(rt=>{rt.ok?d(rt.text):(d(`Fehler beim Laden der Logs: ${rt.err||"Unbekannter Fehler"}`),(rt.status==="incorrect_password"||rt.status==="password_required")&&x(rt.status))}).catch(rt=>d(`Fehler: ${rt.message}`)).finally(()=>{m(!1),setTimeout(()=>{We.current&&(We.current.scrollTop=We.current.scrollHeight)},50)})}R.useEffect(()=>{if(!t)return;Ke(),ce(),Q(),Ge();const se=setInterval(()=>{ce(),Ke(),Q()},3e3);return()=>clearInterval(se)},[t]),R.useEffect(()=>{!t||_!=="logs"||De(a)},[t,_,a]);async function Xe(){try{await Ft("/api/maintenance/os-update",{method:"POST"}),ce(),E("maintenance")}catch(se){q("Fehler",`Fehler beim Starten des OS-Updates: ${se.message}`)}}async function Je(){try{await Ft("/api/maintenance/engine-update",{method:"POST"}),ce(),E("maintenance")}catch(se){q("Fehler",`Fehler beim Engine-Update: ${se.message}`)}}async function bt(){te(!0);try{await Ft("/api/maintenance/hermes-update",{method:"POST"}),ce()}catch(se){q("Fehler",`Hermes-Update fehlgeschlagen: ${se.message}`)}finally{te(!1)}}async function at(se){oe({kind:se,loading:!0,data:null});try{const rt=await Ft(`/api/maintenance/update-details?kind=${se}`);oe({kind:se,loading:!1,data:rt})}catch(rt){oe({kind:se,loading:!1,data:{kind:se,error:rt.message}})}}function ee(){const se=he==null?void 0:he.kind;oe(null),se==="os"?Xe():se==="engine"?Je():se==="hermes"&&bt()}async function W(){C(!0);try{await Ft("/api/maintenance/check-updates",{method:"POST"}),ce(),E("maintenance")}catch(se){q("Fehler",`Fehler bei der Update-Suche: ${se.message}`)}finally{C(!1)}}async function Ee(se,rt){try{await Ft("/api/models/install",{method:"POST",body:JSON.stringify({repo:se,role:rt})}),q("Gestartet",`Modell-Upgrade für '${rt}' (${se}) gestartet.`),ce(),E("maintenance")}catch($e){q("Fehler",`Fehler beim Starten des Modell-Upgrades: ${$e.message}`)}}async function ze(){K("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await Ft("/api/maintenance/reboot",{method:"POST"}),q("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(se){q("Fehler",`Fehler beim Reboot: ${se.message}`)}})}async function He(){F(!0),N("Snapshot wird erzeugt...");try{const se=await Ft("/api/system/backup",{method:"POST"});N(se.ok?`Snapshot erzeugt: ${se.snapshot} (${se.files.length} Komponenten)`:"Backup fehlgeschlagen."),Ge()}catch(se){N(`Fehler: ${se.message}`)}finally{F(!1)}}async function Be(se){w(rt=>({...rt,[se]:!0}));try{const rt=await Ft("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:se})});rt.ok?q("Dienst neu gestartet",`Dienst ${se} wurde erfolgreich neu gestartet.`,()=>{_==="logs"&&a===se&&De(se)}):q("Fehler",`Fehler beim Neustart: ${rt.err||"Unbekannter Fehler"}`)}catch(rt){q("Fehler",`Fehler beim Neustart: ${rt.message}`)}finally{w(rt=>({...rt,[se]:!1}))}}async function pt(se){try{await Ft(`/api/jobs/${se}/cancel`,{method:"POST"}),ce()}catch(rt){q("Fehler",`Fehler beim Abbrechen: ${rt.message}`)}}return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:tt("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:e}),g.jsxs("div",{className:tt("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",t?"translate-x-0":"translate-x-full"),children:[g.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),g.jsx("button",{onClick:e,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[g.jsx("button",{onClick:()=>E("maintenance"),className:tt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),g.jsx("button",{onClick:()=>E("logs"),className:tt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),g.jsx("button",{onClick:()=>E("settings"),className:tt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[_==="maintenance"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"space-y-2.5",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),g.jsxs("button",{onClick:W,disabled:T,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[g.jsx(Vm,{className:tt("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&g.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",$(r.last_check)]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx(L_,{icon:Zm,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(r!=null&&r.os),status:r!=null&&r.os?`${r.os} verfügbar`:"aktuell",actionLabel:"Anzeigen",onAction:()=>at("os")}),g.jsx(L_,{icon:tw,iconClass:"text-violet-400",name:"Engine (llama.cpp)",available:!!(r!=null&&r.engine),status:r!=null&&r.engine?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>at("engine")}),(()=>{var rt;const se=(rt=r==null?void 0:r.components)==null?void 0:rt.find($e=>$e.key==="hermes_agent");return g.jsx(L_,{icon:Il,iconClass:"text-amber-400",name:"Hermes-Agent",available:(se==null?void 0:se.update)===!0,busy:ne,status:(se==null?void 0:se.update)===!0?`Update: ${se.latest}`:(se==null?void 0:se.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>at("hermes")})})(),(nt=r==null?void 0:r.model_list)==null?void 0:nt.map(se=>g.jsx(L_,{icon:x8,iconClass:"text-emerald-400",name:`Modell · ${se.role}`,available:!0,status:se.title,actionLabel:"Upgrade",onAction:()=>Ee(se.repo,se.role)},se.role))]})]}),g.jsxs("div",{className:"space-y-2.5",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),g.jsx("div",{className:"space-y-1.5",children:kU.map(se=>{var rt;return g.jsx(vSe,{label:se.label,system:se.type==="system",ok:(rt=V==null?void 0:V.services.find($e=>$e.name.toLowerCase().includes(se.reach)))==null?void 0:rt.ok,busy:S[se.id],onRestart:()=>Be(se.id),onLogs:()=>{l(se.id),E("logs")}},se.id)})})]}),g.jsxs("div",{className:"space-y-2.5",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),g.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs text-foreground truncate",children:U[0]?`Letztes: ${U[0].snapshot}`:"Noch kein Backup"}),g.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[U.length," Snapshots · Restore per CLI (restore.sh)"]})]}),g.jsxs("button",{onClick:He,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:[g.jsx(b8,{className:tt("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),O&&g.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:O})]}),g.jsxs("div",{className:"space-y-2.5",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),g.jsxs("button",{onClick:ze,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[g.jsx(K8,{className:"h-4.5 w-4.5"}),g.jsxs("div",{children:[g.jsx("div",{children:"Host-System neu starten"}),g.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),g.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(se=>se.state==="running"||se.state==="queued").length," Aktiv"]})]}),g.jsx("div",{className:"space-y-3",children:s.length===0?g.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):s.map(se=>{const rt=se.state==="running"||se.state==="queued";return g.jsxs("div",{className:tt("p-3 rounded-xl border transition-all duration-300",rt?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{className:"space-y-1",children:[g.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[rt&&g.jsxs("span",{className:"flex h-2 w-2 relative",children:[g.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),g.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),se.label]}),g.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[g.jsxs("span",{children:["ID: ",se.id]}),g.jsx("span",{children:"•"}),g.jsx("span",{className:tt(se.state==="done"&&"text-emerald-400",se.state==="failed"&&"text-red-400",se.state==="running"&&"text-primary",se.state==="queued"&&"text-amber-400",se.state==="canceled"&&"text-muted-foreground"),children:se.state})]})]}),rt&&g.jsx("button",{onClick:()=>pt(se.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"})]}),se.state==="running"&&g.jsxs("div",{className:"mt-3 space-y-1",children:[g.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:g.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${se.progress??0}%`}})}),g.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[g.jsxs("span",{children:[se.progress??0,"%"]}),se.done_bytes!=null&&se.total_bytes!=null&&g.jsxs("span",{children:[hT(se.done_bytes)," / ",hT(se.total_bytes),se.rate_bps!=null&&` (${hT(se.rate_bps)}/s)`]}),se.eta_s!=null&&g.jsxs("span",{children:["ETA: ",se.eta_s,"s"]})]})]})]},se.id)})})]})]}),_==="logs"&&g.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("select",{value:a,onChange:se=>l(se.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:kU.map(se=>g.jsxs("option",{value:se.id,children:[se.label," (",se.type==="system"?"systemd-root":"user",")"]},se.id))}),g.jsxs("button",{onClick:()=>Be(a),disabled:S[a],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[g.jsx(Vm,{className:tt("h-3.5 w-3.5",S[a]&&"animate-spin")}),"Restart"]})]}),g.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[g.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[g.jsx(cF,{className:"h-3 w-3 text-primary"}),g.jsxs("span",{children:["stdout/stderr - ",a]})]}),g.jsx("button",{onClick:()=>De(a),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:g.jsx(Vm,{className:tt("h-3 w-3",f&&"animate-spin")})})]}),g.jsx("pre",{ref:We,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:y==="password_required"||y==="incorrect_password"?g.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[g.jsx(_g,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),g.jsx("div",{className:"text-xs font-semibold text-amber-300",children:y==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),g.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",a," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),g.jsx("button",{onClick:()=>E("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):f&&!c?g.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||g.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),_==="settings"&&g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),g.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[g.jsx(Zm,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),g.jsxs("div",{className:"relative",children:[g.jsx("input",{type:_e?"text":"password",value:Z,onChange:se=>ge(se.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),g.jsx("button",{type:"button",onClick:()=>Se(!_e),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:_e?g.jsx(oI,{className:"h-4 w-4"}):g.jsx(NT,{className:"h-4 w-4"})})]}),g.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[g.jsx(D8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),g.jsxs("div",{className:"relative",children:[g.jsx("input",{type:qe?"text":"password",value:le,onChange:se=>ue(se.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),g.jsx("button",{type:"button",onClick:()=>Me(!qe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:qe?g.jsx(oI,{className:"h-4 w-4"}):g.jsx(NT,{className:"h-4 w-4"})})]}),g.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),g.jsxs("div",{className:"flex gap-3 pt-2",children:[g.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",Z),localStorage.setItem("mc_hf_token",le),q("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),g.jsx("button",{onClick:()=>{ge(""),ue(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),q("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),he&&(()=>{var Dt;const se=he.data,rt={os:{icon:Zm,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:tw,cls:"text-violet-400",title:"Engine (llama.cpp)"},hermes:{icon:Il,cls:"text-amber-400",title:"Hermes-Agent"}}[he.kind],$e=rt.icon,ut=se?he.kind==="os"?(se.count??0)===0:he.kind==="hermes"?(se.behind??0)===0:se.installed_build!=null&&se.latest_build!=null&&se.latest_build<=se.installed_build:!0;return g.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[g.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>oe(null)}),g.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-2xl border border-border/60 bg-card shadow-2xl font-sans text-foreground",children:[g.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-5",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx($e,{className:tt("h-4.5 w-4.5",rt.cls)}),g.jsx("h3",{className:"text-sm font-semibold",children:rt.title})]}),g.jsx("button",{onClick:()=>oe(null),className:"flex h-7 w-7 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:he.loading?g.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[g.jsx(Vm,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):se!=null&&se.error?g.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:se.error}):he.kind==="os"?((se==null?void 0:se.count)??0)===0?g.jsx("div",{className:"text-muted-foreground",children:"Keine Pakete zu aktualisieren — System ist aktuell."}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"text-muted-foreground",children:[se.count," Paket(e) werden aktualisiert:"]}),g.jsx("div",{className:"space-y-1",children:se.packages.map(Et=>g.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[g.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[g.jsx(X8,{className:"h-3 w-3 text-cyan-400 shrink-0"}),Et.name]}),g.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[g.jsx("span",{children:Et.current}),g.jsx(J_,{className:"h-3 w-3"}),g.jsx("span",{className:"text-emerald-400",children:Et.candidate})]})]},Et.name))})]}):he.kind==="engine"?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[g.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(se==null?void 0:se.installed_build)??"?"]}),g.jsx(J_,{className:"h-3.5 w-3.5 text-muted-foreground"}),g.jsxs("span",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/5 px-2 py-1 text-emerald-400",children:["Build ",(se==null?void 0:se.latest_build)??"?"]})]}),((se==null?void 0:se.name)||(se==null?void 0:se.latest_tag))&&g.jsxs("div",{className:"text-muted-foreground",children:["Release: ",g.jsx("span",{className:"text-foreground",children:se==null?void 0:se.name}),se!=null&&se.latest_tag?` (${se.latest_tag})`:""]}),(se==null?void 0:se.url)&&g.jsxs("a",{href:se.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Release-Notes auf GitHub ",g.jsx(bg,{className:"h-3 w-3"})]}),(se==null?void 0:se.body)&&g.jsx("pre",{className:"whitespace-pre-wrap rounded-lg border border-border/40 bg-background/30 p-3 text-[10px] leading-relaxed text-muted-foreground max-h-60 overflow-y-auto scrollbar-thin",children:se.body})]}):(((Dt=se==null?void 0:se.commits)==null?void 0:Dt.length)??0)===0?g.jsx("div",{className:"text-muted-foreground",children:"Keine neuen Commits — Hermes-Agent ist bereits aktuell."}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"text-muted-foreground",children:[se.behind," neue Commit(s) auf ",g.jsxs("span",{className:"font-mono text-foreground",children:["origin/",se.branch]}),":"]}),g.jsx("div",{className:"space-y-1",children:se.commits.map(Et=>g.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[g.jsx(O8,{className:"h-3.5 w-3.5 text-primary shrink-0 mt-0.5"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-[11px] truncate",children:Et.subject}),g.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[Et.hash," · ",Et.when]})]})]},Et.hash))}),g.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Vor dem Update wird automatisch ein Backup erstellt; danach startet der Hermes-Gateway neu."})]})}),g.jsxs("div",{className:"flex gap-3 border-t border-border/40 p-4 shrink-0",children:[g.jsx("button",{onClick:()=>oe(null),className:"h-9 flex-1 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold text-muted-foreground hover:bg-accent transition-colors cursor-pointer",children:"Schließen"}),g.jsx("button",{onClick:ee,disabled:he.loading||ut,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:"Jetzt aktualisieren"})]})]})]})})(),fe&&g.jsx(dV,{type:fe.type,title:fe.title,message:fe.message,onConfirm:fe.onConfirm,onCancel:fe.onCancel})]})}function xSe(){var f,m,y,x,S;aX();const[t,e]=R.useState("dashboard"),[n,r]=R.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[i,s]=R.useState(!1),[o,a]=R.useState("maintenance"),{data:l}=h7(),{data:c}=Z1(2e4);R.useEffect(()=>{document.documentElement.classList.add("dark")},[]),R.useEffect(()=>{const w=_=>{var T;a(((T=_.detail)==null?void 0:T.tab)||"maintenance"),s(!0)};return window.addEventListener("open-system-drawer",w),()=>window.removeEventListener("open-system-drawer",w)},[]),R.useEffect(()=>{const w=_=>{var T;const E=(T=_.detail)==null?void 0:T.view;E&&e(E)};return window.addEventListener("mc-navigate",w),()=>window.removeEventListener("mc-navigate",w)},[]);const d=DT.find(w=>w.id===t);return g.jsxs("div",{className:"flex h-full relative",children:[g.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[g.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),g.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),g.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),g.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),g.jsx(d7,{onNavigate:e}),g.jsx(ySe,{open:i,onClose:()=>s(!1),defaultTab:o}),g.jsxs("aside",{className:tt("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:[g.jsxs("div",{className:tt("flex items-center py-4 border-b border-border/40 shrink-0",n?"flex-col gap-3 px-2":"justify-between px-5"),children:[g.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[g.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!n&&g.jsxs("div",{className:"leading-tight",children:[g.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),g.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),g.jsx("button",{onClick:()=>{r(w=>{const _=!w;return localStorage.setItem("mc_sidebar_collapsed",_.toString()),_})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:n?"Maximieren":"Minimieren",children:n?g.jsx(sF,{className:"h-4 w-4"}):g.jsx(w8,{className:"h-4 w-4"})})]}),g.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:DT.map(w=>g.jsxs("button",{onClick:()=>e(w.id),className:tt("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",n?"justify-center p-2.5":"gap-3 px-3 py-2",t===w.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:n?w.label:void 0,children:[g.jsx(w.icon,{className:"h-4.5 w-4.5 shrink-0"}),!n&&g.jsx("span",{className:"truncate",children:w.label})]},w.id))}),g.jsx("div",{className:tt("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",n?"px-2 text-center":"px-5"),children:n?g.jsx("div",{className:"flex justify-center",children:g.jsx("span",{className:tt("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",l?l.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:l?`Engine ${l.engine_reachable?"online":"offline"}`:"Backend offline"})}):g.jsxs("div",{className:"space-y-2 text-left",children:[l?g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:tt("h-2 w-2 rounded-full animate-pulse",l.engine_reachable?"bg-emerald-500":"bg-amber-500")}),g.jsxs("span",{className:"truncate",children:["Engine ",l.engine_reachable?"online":"offline"]})]}):g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",g.jsx("span",{className:"truncate",children:"Backend offline"})]}),(c==null?void 0:c.versions)&&g.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[g.jsxs("div",{className:"truncate",title:c.versions.mc2?`${c.versions.mc2.branch}-${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""} (${c.versions.mc2.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"MC2:"})," ",c.versions.mc2?`${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""}`:"—"]}),g.jsxs("div",{className:"truncate",title:((f=c.versions.engine)==null?void 0:f.type)==="git"?`${c.versions.engine.branch}-${c.versions.engine.hash}${c.versions.engine.dirty?"*":""} (${c.versions.engine.date})`:((m=c.versions.engine)==null?void 0:m.version_text)||"unbekannt",children:[g.jsx("strong",{children:"Engine:"})," ",((y=c.versions.engine)==null?void 0:y.type)==="git"?`${c.versions.engine.hash}${c.versions.engine.dirty?"*":""}`:((S=(x=c.versions.engine)==null?void 0:x.version_text)==null?void 0:S.split(" ").pop())||"—"]}),g.jsxs("div",{className:"truncate",title:c.versions.hermes_ui?`${c.versions.hermes_ui.branch}-${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""} (${c.versions.hermes_ui.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"Hermes UI:"})," ",c.versions.hermes_ui?`${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""}`:"—"]}),g.jsxs("div",{className:"truncate",title:c.versions.hermes_agent?`${c.versions.hermes_agent.branch}-${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""} (${c.versions.hermes_agent.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"Hermes Agent:"})," ",c.versions.hermes_agent?`${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),g.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[g.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[g.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:d.hint}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),g.jsxs("button",{onClick:()=>{const w=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(w)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[g.jsx(C8,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:"Suchen"}),g.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),g.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&g.jsx(Rfe,{}),t==="models"&&g.jsx(jfe,{}),t==="connect"&&g.jsx(Ffe,{}),t==="memory"&&g.jsx($fe,{}),t==="agent"&&g.jsx(Xfe,{}),t==="terminal"&&g.jsx(qfe,{}),t==="voice"&&g.jsx(hSe,{}),t==="guide"&&g.jsx(mSe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&g.jsx(gSe,{title:d.label,hint:d.hint})]})]})]})}const bSe=new n8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});RW.createRoot(document.getElementById("root")).render(g.jsx(GU.StrictMode,{children:g.jsx(r8,{client:bSe,children:g.jsx(xSe,{})})}));export{Qt as B,dx as F,GU as R,Gm as S,OT as T,X as V,oP as _,Jt as a,R as b,Ym as c,sbe as d,MG as e,PW as f,H1 as g,g as h,e9 as i,Cbe as j,gz as l,Wh as r,Bbe as u}; +...`}),g.jsxs("p",{children:["Suchen & installieren über die ",g.jsx("strong",{children:"skills.sh"}),"-Registry: ",g.jsx(pn,{children:"npx skills find"})," /",g.jsx(pn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),g.jsxs(mo,{id:"memory",icon:N8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:["LLMs sind ",g.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",g.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:["extrahiert Fakten ",g.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),g.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),g.jsxs("li",{children:[g.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",g.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),g.jsxs(Vf,{children:["Dein Gedächtnis (Tab ",g.jsx("strong",{children:"Gedächtnis"}),") ist ",g.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",g.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",g.jsx(pn,{children:"Identität"})," · ",g.jsx(pn,{children:"Wissen"})," · ",g.jsx(pn,{children:"Regeln"})," · ",g.jsx(pn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",g.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",g.jsx("br",{}),g.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),g.jsxs(mo,{id:"agents",icon:Il,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:["Ein ",g.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",g.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Least Privilege:"})," gib einem Agenten nur die Tools, die er wirklich braucht. Kritische Aktionen (Shell auf dem Host, Löschen, Geld/Deploys) hinter menschliche Freigabe."]}),g.jsxs("p",{children:[g.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",g.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),g.jsxs(Vf,{children:[g.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",g.jsx(pn,{children:"fast"}),"). Reden tust du mit ihm im",g.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",g.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",g.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",g.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),g.jsxs(mo,{id:"ide",icon:aF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[g.jsxs("p",{children:["Jede ",g.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Cline"})," & ",g.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Continue"}),", ",g.jsx("strong",{children:"aider"})," (CLI), ",g.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),g.jsxs(Vf,{children:["Tipp den Kram nicht ab: der ",g.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",g.jsx(pn,{children:"…:9001/v1"}),", Model ",g.jsx(pn,{children:"auto"}),", Key beliebig."]})]}),g.jsx(mo,{id:"tricks",icon:B8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:g.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:[["Kontext sauber halten","Neue Session statt Mega-Historie. Drift, Tempo und Halluzination hängen direkt am Kontext-Müll."],["Plan-then-Act","Erst Plan/Vorgehen bestätigen lassen, dann ausführen. Spart teure Holzwege."],["Gezielte Edits","Nie ganze Dateien überschreiben für eine Zeile — Such-/Ersetz-Tools nutzen. Weniger Tokens, weniger Fehler."],["Non-interaktive Befehle","Keine interaktiven Prompts im Agent-Terminal; lange Tasks als Background-Job. Sonst hängt der Loop."],["DevTools koppeln","Browser-/Konsolen-Zugriff geben — der Agent liest echte Fehler statt blind zu raten."],["Richtige Modellwahl","Schnelles Hirn für Alltag, großes für harte Logik, Coder fürs Coden. Nicht alles mit der Kanone."],["Akzeptanzkriterien","Sag konkret, woran „fertig“ erkennbar ist. Vage Prompts → vage Ergebnisse."],["Verifizieren statt vertrauen","Tests/Live-Check fordern. „Sollte funktionieren“ ist kein Beweis."],["Regeln ins Gedächtnis","Wiederkehrende Vorlieben/Konventionen einmal ablegen — der Agent zieht sie selbst."]].map(([n,r])=>g.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[g.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[g.jsx(xh,{className:"h-3 w-3 text-amber-400"})," ",n]}),g.jsx("p",{className:"text-[11px]",children:r})]},n))})}),g.jsx(mo,{id:"wartung",icon:Zm,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:g.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[g.jsx(O8,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[g.jsx(rw,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",g.jsx(pn,{children:"restore.sh"})," (Doku in ",g.jsx(pn,{children:"docs/BACKUP.md"}),")."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",g.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",g.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),g.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),g.jsxs("section",{id:"ressourcen",className:"scroll-mt-20 md:col-span-2 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[g.jsx(NT,{className:"h-5 w-5 text-primary"}),g.jsxs("div",{children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),g.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),g.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(RT,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Or,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),g.jsx(Or,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),g.jsx(Or,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),g.jsx(Or,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),g.jsx(Or,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),g.jsx(Or,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(kT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Or,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),g.jsx(Or,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),g.jsx(Or,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),g.jsx(Or,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),g.jsx(Or,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(Il,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Or,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),g.jsx(Or,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),g.jsx(Or,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),g.jsx(Or,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),g.jsx(Or,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[g.jsx(PT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),g.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[g.jsx(Or,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),g.jsx(Or,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),g.jsx(Or,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),g.jsx(Or,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),g.jsx(Or,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),g.jsx(mo,{id:"troubleshooting",icon:z8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:g.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[g.jsxs("li",{children:[g.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",g.jsx(pn,{children:":9001"}),")? Backend-Status in der ",g.jsx("strong",{children:"Zentrale"})," prüfen."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",g.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",g.jsx(pn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",g.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),g.jsxs("li",{children:[g.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",g.jsx(pn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),g.jsx("p",{className:"text-center text-[10px] text-muted-foreground/50 pt-2",children:"Mission Control 2 · AI-Bibel · Stand Juni 2026 — lebendes Dokument, wächst mit dem Stack."})]})}function vSe({title:t,hint:e}){return g.jsxs("div",{className:"space-y-4",children:[g.jsxs("div",{children:[g.jsx("h1",{className:"text-xl font-semibold",children:t}),g.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),g.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[g.jsx(R8,{className:"h-8 w-8 text-muted-foreground"}),g.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const OU=[{id:"mission-control-2",label:"Mission Control",type:"user",reach:"gateway (integr"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user",reach:"hermes-gateway"},{id:"mem0-service",label:"Mem0 (Gedächtnis)",type:"user",reach:"mem0"},{id:"hermes-terminal",label:"Hermes Terminal",type:"user",reach:"hermes-terminal"},{id:"llama-swap",label:"Llama Swap",type:"system",reach:"llama-swap"}];function U0({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:o,onAction:a}){return g.jsxs("div",{className:nt("flex items-center gap-3 rounded-lg border px-3 py-2",i?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[g.jsx(t,{className:nt("h-4 w-4 shrink-0",e)}),g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs text-foreground truncate",children:n}),g.jsx("div",{className:nt("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),g.jsx("button",{onClick:a,disabled:!i||s,className:nt("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:s?"…":o})]})}function ySe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return g.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[g.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),g.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&g.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),g.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:g.jsx(Vm,{className:nt("h-3.5 w-3.5",r&&"animate-spin")})}),g.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:g.jsx(I8,{className:"h-3.5 w-3.5"})})]})}function pT(t){return t==null?"":t>1024**3?`${(t/1024**3).toFixed(2)} GB`:`${(t/1024**2).toFixed(1)} MB`}function xSe({open:t,onClose:e,defaultTab:n="maintenance"}){var dt;const[r,i]=R.useState(null),[s,o]=R.useState([]),[a,l]=R.useState("llama-swap"),[c,d]=R.useState(""),[f,m]=R.useState(!1),[y,x]=R.useState(null),[S,w]=R.useState({}),[_,E]=R.useState("maintenance"),[T,C]=R.useState(!1),[O,N]=R.useState(""),[D,F]=R.useState(!1),[G,k]=R.useState(null),[U,H]=R.useState([]),[ne,te]=R.useState(!1),[he,se]=R.useState(null),[fe,B]=R.useState(null);function J(de,Ne,tt){B({type:"alert",title:de,message:Ne,onConfirm:()=>{B(null),tt&&tt()}})}function Y(de,Ne,tt){B({type:"confirm",title:de,message:Ne,onConfirm:()=>{B(null),tt()},onCancel:()=>B(null)})}function V(de){return de?new Date(de*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[q,pe]=R.useState(""),[ae,le]=R.useState(""),[be,Se]=R.useState(!1),[qe,Me]=R.useState(!1);R.useEffect(()=>{t&&(pe(localStorage.getItem("mc_sudo_password")||""),le(localStorage.getItem("mc_hf_token")||""))},[t]),R.useEffect(()=>{t&&n&&E(n)},[t,n]);const $e=R.useRef(null);function Ke(){Ft("/api/maintenance/updates").then(i).catch(de=>console.error("Error loading updates",de))}function ce(){Ft("/api/jobs").then(de=>o(de.jobs||[])).catch(de=>console.error("Error loading jobs",de))}function Z(){Ft("/api/system/services").then(k).catch(()=>{})}function We(){Ft("/api/system/backups").then(de=>H(de.backups||[])).catch(()=>{})}function je(de){m(!0),x(null),Ft(`/api/maintenance/logs?service=${de}&lines=150`).then(Ne=>{Ne.ok?d(Ne.text):(d(`Fehler beim Laden der Logs: ${Ne.err||"Unbekannter Fehler"}`),(Ne.status==="incorrect_password"||Ne.status==="password_required")&&x(Ne.status))}).catch(Ne=>d(`Fehler: ${Ne.message}`)).finally(()=>{m(!1),setTimeout(()=>{$e.current&&($e.current.scrollTop=$e.current.scrollHeight)},50)})}R.useEffect(()=>{if(!t)return;Ke(),ce(),Z(),We();const de=setInterval(()=>{ce(),Ke(),Z()},3e3);return()=>clearInterval(de)},[t]),R.useEffect(()=>{!t||_!=="logs"||je(a)},[t,_,a]);async function Xe(){try{await Ft("/api/maintenance/os-update",{method:"POST"}),ce(),E("maintenance")}catch(de){J("Fehler",`Fehler beim Starten des OS-Updates: ${de.message}`)}}async function Je(){try{await Ft("/api/maintenance/engine-update",{method:"POST"}),ce(),E("maintenance")}catch(de){J("Fehler",`Fehler beim Engine-Update: ${de.message}`)}}async function bt(){try{await Ft("/api/maintenance/swap-update",{method:"POST"}),ce(),E("maintenance")}catch(de){J("Fehler",`Fehler beim Router-Update: ${de.message}`)}}async function ut(){te(!0);try{await Ft("/api/maintenance/hermes-update",{method:"POST"}),ce()}catch(de){J("Fehler",`Hermes-Update fehlgeschlagen: ${de.message}`)}finally{te(!1)}}async function ee(de){se({kind:de,loading:!0,data:null});try{const Ne=await Ft(`/api/maintenance/update-details?kind=${de}`);se({kind:de,loading:!1,data:Ne})}catch(Ne){se({kind:de,loading:!1,data:{kind:de,error:Ne.message}})}}function $(){const de=he==null?void 0:he.kind;se(null),de==="os"?Xe():de==="engine"?Je():de==="swap"?bt():de==="hermes"&&ut()}async function Ee(){C(!0);try{await Ft("/api/maintenance/check-updates",{method:"POST"}),ce(),E("maintenance")}catch(de){J("Fehler",`Fehler bei der Update-Suche: ${de.message}`)}finally{C(!1)}}async function Be(de,Ne){try{await Ft("/api/models/install",{method:"POST",body:JSON.stringify({repo:de,role:Ne})}),J("Gestartet",`Modell-Upgrade für '${Ne}' (${de}) gestartet.`),ce(),E("maintenance")}catch(tt){J("Fehler",`Fehler beim Starten des Modell-Upgrades: ${tt.message}`)}}async function Ve(){Y("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await Ft("/api/maintenance/reboot",{method:"POST"}),J("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(de){J("Fehler",`Fehler beim Reboot: ${de.message}`)}})}async function He(){F(!0),N("Snapshot wird erzeugt...");try{const de=await Ft("/api/system/backup",{method:"POST"});N(de.ok?`Snapshot erzeugt: ${de.snapshot} (${de.files.length} Komponenten)`:"Backup fehlgeschlagen."),We()}catch(de){N(`Fehler: ${de.message}`)}finally{F(!1)}}async function mt(de){w(Ne=>({...Ne,[de]:!0}));try{const Ne=await Ft("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:de})});Ne.ok?J("Dienst neu gestartet",`Dienst ${de} wurde erfolgreich neu gestartet.`,()=>{_==="logs"&&a===de&&je(de)}):J("Fehler",`Fehler beim Neustart: ${Ne.err||"Unbekannter Fehler"}`)}catch(Ne){J("Fehler",`Fehler beim Neustart: ${Ne.message}`)}finally{w(Ne=>({...Ne,[de]:!1}))}}async function rt(de){try{await Ft(`/api/jobs/${de}/cancel`,{method:"POST"}),ce()}catch(Ne){J("Fehler",`Fehler beim Abbrechen: ${Ne.message}`)}}return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:nt("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:e}),g.jsxs("div",{className:nt("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",t?"translate-x-0":"translate-x-full"),children:[g.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),g.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),g.jsx("button",{onClick:e,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[g.jsx("button",{onClick:()=>E("maintenance"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),g.jsx("button",{onClick:()=>E("logs"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),g.jsx("button",{onClick:()=>E("settings"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",_==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),g.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[_==="maintenance"&&g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"space-y-2.5",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),g.jsxs("button",{onClick:Ee,disabled:T,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[g.jsx(Vm,{className:nt("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&g.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",V(r.last_check)]}),g.jsxs("div",{className:"space-y-1.5",children:[g.jsx(U0,{icon:Zm,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(r!=null&&r.os),status:r!=null&&r.os?`${r.os} verfügbar`:"aktuell",actionLabel:"Anzeigen",onAction:()=>ee("os")}),g.jsx(U0,{icon:nw,iconClass:"text-violet-400",name:"Inferenz-Engine (llama.cpp)",available:!!(r!=null&&r.engine),status:r!=null&&r.engine?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>ee("engine")}),g.jsx(U0,{icon:cI,iconClass:"text-fuchsia-400",name:"Router (llama-swap)",available:!!(r!=null&&r.swap),status:r!=null&&r.swap?"Update verfügbar":"aktuell",actionLabel:"Anzeigen",onAction:()=>ee("swap")}),(()=>{var Ne;const de=(Ne=r==null?void 0:r.components)==null?void 0:Ne.find(tt=>tt.key==="hermes_agent");return g.jsx(U0,{icon:Il,iconClass:"text-amber-400",name:"Hermes-Agent",available:(de==null?void 0:de.update)===!0,busy:ne,status:(de==null?void 0:de.update)===!0?`Update: ${de.latest}`:(de==null?void 0:de.reachable)===!1?"offline":"aktuell",actionLabel:"Anzeigen",onAction:()=>ee("hermes")})})(),(dt=r==null?void 0:r.model_list)==null?void 0:dt.map(de=>g.jsx(U0,{icon:b8,iconClass:"text-emerald-400",name:`Modell · ${de.role}`,available:!0,status:de.title,actionLabel:"Upgrade",onAction:()=>Be(de.repo,de.role)},de.role))]})]}),g.jsxs("div",{className:"space-y-2.5",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),g.jsx("div",{className:"space-y-1.5",children:OU.map(de=>{var Ne;return g.jsx(ySe,{label:de.label,system:de.type==="system",ok:(Ne=G==null?void 0:G.services.find(tt=>tt.name.toLowerCase().includes(de.reach)))==null?void 0:Ne.ok,busy:S[de.id],onRestart:()=>mt(de.id),onLogs:()=>{l(de.id),E("logs")}},de.id)})})]}),g.jsxs("div",{className:"space-y-2.5",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),g.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[g.jsxs("div",{className:"flex-1 min-w-0",children:[g.jsx("div",{className:"text-xs text-foreground truncate",children:U[0]?`Letztes: ${U[0].snapshot}`:"Noch kein Backup"}),g.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[U.length," Snapshots · Restore per CLI (restore.sh)"]})]}),g.jsxs("button",{onClick:He,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:[g.jsx(_8,{className:nt("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),O&&g.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:O})]}),g.jsxs("div",{className:"space-y-2.5",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),g.jsxs("button",{onClick:Ve,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[g.jsx(Y8,{className:"h-4.5 w-4.5"}),g.jsxs("div",{children:[g.jsx("div",{children:"Host-System neu starten"}),g.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),g.jsxs("div",{className:"space-y-3",children:[g.jsxs("div",{className:"flex items-center justify-between",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),g.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(de=>de.state==="running"||de.state==="queued").length," Aktiv"]})]}),g.jsx("div",{className:"space-y-3",children:s.length===0?g.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):s.map(de=>{const Ne=de.state==="running"||de.state==="queued";return g.jsxs("div",{className:nt("p-3 rounded-xl border transition-all duration-300",Ne?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[g.jsxs("div",{className:"flex items-start justify-between gap-3",children:[g.jsxs("div",{className:"space-y-1",children:[g.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[Ne&&g.jsxs("span",{className:"flex h-2 w-2 relative",children:[g.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),g.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),de.label]}),g.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[g.jsxs("span",{children:["ID: ",de.id]}),g.jsx("span",{children:"•"}),g.jsx("span",{className:nt(de.state==="done"&&"text-emerald-400",de.state==="failed"&&"text-red-400",de.state==="running"&&"text-primary",de.state==="queued"&&"text-amber-400",de.state==="canceled"&&"text-muted-foreground"),children:de.state})]})]}),Ne&&g.jsx("button",{onClick:()=>rt(de.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"})]}),de.state==="running"&&g.jsxs("div",{className:"mt-3 space-y-1",children:[g.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:g.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${de.progress??0}%`}})}),g.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[g.jsxs("span",{children:[de.progress??0,"%"]}),de.done_bytes!=null&&de.total_bytes!=null&&g.jsxs("span",{children:[pT(de.done_bytes)," / ",pT(de.total_bytes),de.rate_bps!=null&&` (${pT(de.rate_bps)}/s)`]}),de.eta_s!=null&&g.jsxs("span",{children:["ETA: ",de.eta_s,"s"]})]})]})]},de.id)})})]})]}),_==="logs"&&g.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("select",{value:a,onChange:de=>l(de.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:OU.map(de=>g.jsxs("option",{value:de.id,children:[de.label," (",de.type==="system"?"systemd-root":"user",")"]},de.id))}),g.jsxs("button",{onClick:()=>mt(a),disabled:S[a],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[g.jsx(Vm,{className:nt("h-3.5 w-3.5",S[a]&&"animate-spin")}),"Restart"]})]}),g.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[g.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[g.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[g.jsx(uF,{className:"h-3 w-3 text-primary"}),g.jsxs("span",{children:["stdout/stderr - ",a]})]}),g.jsx("button",{onClick:()=>je(a),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:g.jsx(Vm,{className:nt("h-3 w-3",f&&"animate-spin")})})]}),g.jsx("pre",{ref:$e,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:y==="password_required"||y==="incorrect_password"?g.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[g.jsx(_g,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),g.jsx("div",{className:"text-xs font-semibold text-amber-300",children:y==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),g.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",a," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),g.jsx("button",{onClick:()=>E("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):f&&!c?g.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||g.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),_==="settings"&&g.jsxs("div",{className:"space-y-6",children:[g.jsxs("div",{className:"space-y-2",children:[g.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),g.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[g.jsx(Zm,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),g.jsxs("div",{className:"relative",children:[g.jsx("input",{type:be?"text":"password",value:q,onChange:de=>pe(de.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),g.jsx("button",{type:"button",onClick:()=>Se(!be),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:be?g.jsx(aI,{className:"h-4 w-4"}):g.jsx(IT,{className:"h-4 w-4"})})]}),g.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),g.jsxs("div",{className:"space-y-2",children:[g.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[g.jsx(j8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),g.jsxs("div",{className:"relative",children:[g.jsx("input",{type:qe?"text":"password",value:ae,onChange:de=>le(de.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),g.jsx("button",{type:"button",onClick:()=>Me(!qe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:qe?g.jsx(aI,{className:"h-4 w-4"}):g.jsx(IT,{className:"h-4 w-4"})})]}),g.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),g.jsxs("div",{className:"flex gap-3 pt-2",children:[g.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",q),localStorage.setItem("mc_hf_token",ae),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"}),g.jsx("button",{onClick:()=>{pe(""),le(""),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"})]})]})]})]}),he&&(()=>{var Lt;const de=he.data,Ne={os:{icon:Zm,cls:"text-cyan-400",title:"OS-Pakete (apt)"},engine:{icon:nw,cls:"text-violet-400",title:"Inferenz-Engine (llama.cpp)"},swap:{icon:cI,cls:"text-fuchsia-400",title:"Router (llama-swap)"},hermes:{icon:Il,cls:"text-amber-400",title:"Hermes-Agent"}}[he.kind],tt=Ne.icon,jt=de?he.kind==="os"?(de.count??0)===0:he.kind==="hermes"?(de.behind??0)===0:de.installed_build!=null&&de.latest_build!=null&&de.latest_build<=de.installed_build:!0;return g.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[g.jsx("div",{className:"absolute inset-0 bg-black/70 backdrop-blur-sm",onClick:()=>se(null)}),g.jsxs("div",{className:"relative w-full max-w-lg max-h-[80vh] flex flex-col rounded-2xl border border-border/60 bg-card shadow-2xl font-sans text-foreground",children:[g.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-5",children:[g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx(tt,{className:nt("h-4.5 w-4.5",Ne.cls)}),g.jsx("h3",{className:"text-sm font-semibold",children:Ne.title})]}),g.jsx("button",{onClick:()=>se(null),className:"flex h-7 w-7 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:g.jsx(Al,{className:"h-4 w-4"})})]}),g.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-xs space-y-3 scrollbar-thin",children:he.loading?g.jsxs("div",{className:"flex h-24 items-center justify-center gap-2 text-muted-foreground",children:[g.jsx(Vm,{className:"h-4 w-4 animate-spin"})," Details werden geladen…"]}):de!=null&&de.error?g.jsx("div",{className:"rounded-lg border border-red-500/30 bg-red-500/5 p-3 text-red-400",children:de.error}):he.kind==="os"?((de==null?void 0:de.count)??0)===0?g.jsx("div",{className:"text-muted-foreground",children:"Keine Pakete zu aktualisieren — System ist aktuell."}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"text-muted-foreground",children:[de.count," Paket(e) werden aktualisiert:"]}),g.jsx("div",{className:"space-y-1",children:de.packages.map(ct=>g.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[g.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[11px] truncate",children:[g.jsx(q8,{className:"h-3 w-3 text-cyan-400 shrink-0"}),ct.name]}),g.jsxs("span",{className:"flex items-center gap-1 font-mono text-[10px] text-muted-foreground shrink-0",children:[g.jsx("span",{children:ct.current}),g.jsx(ew,{className:"h-3 w-3"}),g.jsx("span",{className:"text-emerald-400",children:ct.candidate})]})]},ct.name))})]}):he.kind==="engine"||he.kind==="swap"?g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"flex items-center gap-2 font-mono text-[11px]",children:[g.jsxs("span",{className:"rounded-md border border-border/40 bg-background/30 px-2 py-1",children:["Build ",(de==null?void 0:de.installed_build)??"?"]}),g.jsx(ew,{className:"h-3.5 w-3.5 text-muted-foreground"}),g.jsxs("span",{className:"rounded-md border border-emerald-500/30 bg-emerald-500/5 px-2 py-1 text-emerald-400",children:["Build ",(de==null?void 0:de.latest_build)??"?"]})]}),((de==null?void 0:de.name)||(de==null?void 0:de.latest_tag))&&g.jsxs("div",{className:"text-muted-foreground",children:["Release: ",g.jsx("span",{className:"text-foreground",children:de==null?void 0:de.name}),de!=null&&de.latest_tag?` (${de.latest_tag})`:""]}),(de==null?void 0:de.url)&&g.jsxs("a",{href:de.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:["Release-Notes auf GitHub ",g.jsx(bg,{className:"h-3 w-3"})]}),(de==null?void 0:de.body)&&g.jsx("pre",{className:"whitespace-pre-wrap rounded-lg border border-border/40 bg-background/30 p-3 text-[10px] leading-relaxed text-muted-foreground max-h-60 overflow-y-auto scrollbar-thin",children:de.body})]}):(((Lt=de==null?void 0:de.commits)==null?void 0:Lt.length)??0)===0?g.jsx("div",{className:"text-muted-foreground",children:"Keine neuen Commits — Hermes-Agent ist bereits aktuell."}):g.jsxs(g.Fragment,{children:[g.jsxs("div",{className:"text-muted-foreground",children:[de.behind," neue Commit(s) auf ",g.jsxs("span",{className:"font-mono text-foreground",children:["origin/",de.branch]}),":"]}),g.jsx("div",{className:"space-y-1",children:de.commits.map(ct=>g.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-border/40 bg-background/30 px-2.5 py-1.5",children:[g.jsx(L8,{className:"h-3.5 w-3.5 text-primary shrink-0 mt-0.5"}),g.jsxs("div",{className:"min-w-0",children:[g.jsx("div",{className:"text-[11px] truncate",children:ct.subject}),g.jsxs("div",{className:"font-mono text-[9px] text-muted-foreground",children:[ct.hash," · ",ct.when]})]})]},ct.hash))}),g.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Vor dem Update wird automatisch ein Backup erstellt; danach startet der Hermes-Gateway neu."})]})}),g.jsxs("div",{className:"flex gap-3 border-t border-border/40 p-4 shrink-0",children:[g.jsx("button",{onClick:()=>se(null),className:"h-9 flex-1 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold text-muted-foreground hover:bg-accent transition-colors cursor-pointer",children:"Schließen"}),g.jsx("button",{onClick:$,disabled:he.loading||jt,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:"Jetzt aktualisieren"})]})]})]})})(),fe&&g.jsx(fV,{type:fe.type,title:fe.title,message:fe.message,onConfirm:fe.onConfirm,onCancel:fe.onCancel})]})}function bSe(){var f,m,y,x,S;lX();const[t,e]=R.useState("dashboard"),[n,r]=R.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[i,s]=R.useState(!1),[o,a]=R.useState("maintenance"),{data:l}=p7(),{data:c}=Q1(2e4);R.useEffect(()=>{document.documentElement.classList.add("dark")},[]),R.useEffect(()=>{const w=_=>{var T;a(((T=_.detail)==null?void 0:T.tab)||"maintenance"),s(!0)};return window.addEventListener("open-system-drawer",w),()=>window.removeEventListener("open-system-drawer",w)},[]),R.useEffect(()=>{const w=_=>{var T;const E=(T=_.detail)==null?void 0:T.view;E&&e(E)};return window.addEventListener("mc-navigate",w),()=>window.removeEventListener("mc-navigate",w)},[]);const d=jT.find(w=>w.id===t);return g.jsxs("div",{className:"flex h-full relative",children:[g.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[g.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),g.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),g.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),g.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),g.jsx(f7,{onNavigate:e}),g.jsx(xSe,{open:i,onClose:()=>s(!1),defaultTab:o}),g.jsxs("aside",{className:nt("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:[g.jsxs("div",{className:nt("flex items-center py-4 border-b border-border/40 shrink-0",n?"flex-col gap-3 px-2":"justify-between px-5"),children:[g.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[g.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!n&&g.jsxs("div",{className:"leading-tight",children:[g.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),g.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),g.jsx("button",{onClick:()=>{r(w=>{const _=!w;return localStorage.setItem("mc_sidebar_collapsed",_.toString()),_})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:n?"Maximieren":"Minimieren",children:n?g.jsx(oF,{className:"h-4 w-4"}):g.jsx(S8,{className:"h-4 w-4"})})]}),g.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:jT.map(w=>g.jsxs("button",{onClick:()=>e(w.id),className:nt("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",n?"justify-center p-2.5":"gap-3 px-3 py-2",t===w.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:n?w.label:void 0,children:[g.jsx(w.icon,{className:"h-4.5 w-4.5 shrink-0"}),!n&&g.jsx("span",{className:"truncate",children:w.label})]},w.id))}),g.jsx("div",{className:nt("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",n?"px-2 text-center":"px-5"),children:n?g.jsx("div",{className:"flex justify-center",children:g.jsx("span",{className:nt("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",l?l.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:l?`Engine ${l.engine_reachable?"online":"offline"}`:"Backend offline"})}):g.jsxs("div",{className:"space-y-2 text-left",children:[l?g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:nt("h-2 w-2 rounded-full animate-pulse",l.engine_reachable?"bg-emerald-500":"bg-amber-500")}),g.jsxs("span",{className:"truncate",children:["Engine ",l.engine_reachable?"online":"offline"]})]}):g.jsxs("span",{className:"flex items-center gap-2",children:[g.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",g.jsx("span",{className:"truncate",children:"Backend offline"})]}),(c==null?void 0:c.versions)&&g.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[g.jsxs("div",{className:"truncate",title:c.versions.mc2?`${c.versions.mc2.branch}-${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""} (${c.versions.mc2.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"MC2:"})," ",c.versions.mc2?`${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""}`:"—"]}),g.jsxs("div",{className:"truncate",title:((f=c.versions.engine)==null?void 0:f.type)==="git"?`${c.versions.engine.branch}-${c.versions.engine.hash}${c.versions.engine.dirty?"*":""} (${c.versions.engine.date})`:((m=c.versions.engine)==null?void 0:m.version_text)||"unbekannt",children:[g.jsx("strong",{children:"Engine:"})," ",((y=c.versions.engine)==null?void 0:y.type)==="git"?`${c.versions.engine.hash}${c.versions.engine.dirty?"*":""}`:((S=(x=c.versions.engine)==null?void 0:x.version_text)==null?void 0:S.split(" ").pop())||"—"]}),g.jsxs("div",{className:"truncate",title:c.versions.hermes_ui?`${c.versions.hermes_ui.branch}-${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""} (${c.versions.hermes_ui.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"Hermes UI:"})," ",c.versions.hermes_ui?`${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""}`:"—"]}),g.jsxs("div",{className:"truncate",title:c.versions.hermes_agent?`${c.versions.hermes_agent.branch}-${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""} (${c.versions.hermes_agent.date})`:"nicht gefunden",children:[g.jsx("strong",{children:"Hermes Agent:"})," ",c.versions.hermes_agent?`${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),g.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[g.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[g.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:d.hint}),g.jsxs("div",{className:"flex items-center gap-2",children:[g.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),g.jsxs("button",{onClick:()=>{const w=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(w)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[g.jsx(P8,{className:"h-3.5 w-3.5"}),g.jsx("span",{children:"Suchen"}),g.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),g.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&g.jsx(Nfe,{}),t==="models"&&g.jsx(Ufe,{}),t==="connect"&&g.jsx(zfe,{}),t==="memory"&&g.jsx(Xfe,{}),t==="agent"&&g.jsx(qfe,{}),t==="terminal"&&g.jsx(Kfe,{}),t==="voice"&&g.jsx(pSe,{}),t==="guide"&&g.jsx(gSe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&g.jsx(vSe,{title:d.label,hint:d.hint})]})]})]})}const _Se=new r8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});NW.createRoot(document.getElementById("root")).render(g.jsx(WU.StrictMode,{children:g.jsx(i8,{client:_Se,children:g.jsx(bSe,{})})}));export{Gm as S,LT as T,t9 as a,V1 as g,g as j,R as r}; diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 0930b5d..eda644e 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,8 +7,8 @@ Mission Control 2.0 - - + +
diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0b572ee..8e3d83a 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -14,11 +14,13 @@ "@tanstack/react-query": "^5.101.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", + "graphology": "^0.26.0", + "graphology-layout-forceatlas2": "^0.10.1", "lucide-react": "^0.460.0", "react": "^18.3.1", "react-dom": "^18.3.1", - "reagraph": "^4.22.0", "recharts": "^3.9.0", + "sigma": "^3.0.3", "tailwind-merge": "^2.5.5", "three": "^0.169.0" }, @@ -817,12 +819,6 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/@mediapipe/tasks-vision": { - "version": "0.10.8", - "resolved": "https://registry.npmjs.org/@mediapipe/tasks-vision/-/tasks-vision-0.10.8.tgz", - "integrity": "sha512-Rp7ll8BHrKB3wXaRFKhrltwZl1CiXGdibPxuWXvqGnKTnv8fqa/nvftYNuSbf+pbJWKYCXdBtYTITdAUTGGh0Q==", - "license": "Apache-2.0" - }, "node_modules/@monogrid/gainmap-js": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/@monogrid/gainmap-js/-/gainmap-js-3.4.0.tgz", @@ -1301,57 +1297,6 @@ } } }, - "node_modules/@react-spring/animated": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/@react-spring/animated/-/animated-9.6.1.tgz", - "integrity": "sha512-ls/rJBrAqiAYozjLo5EPPLLOb1LM0lNVQcXODTC1SMtS6DbuBCPaKco5svFUQFMP2dso3O+qcC4k9FsKc0KxMQ==", - "license": "MIT", - "dependencies": { - "@react-spring/shared": "~9.6.1", - "@react-spring/types": "~9.6.1" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, - "node_modules/@react-spring/core": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/@react-spring/core/-/core-9.6.1.tgz", - "integrity": "sha512-3HAAinAyCPessyQNNXe5W0OHzRfa8Yo5P748paPcmMowZ/4sMfaZ2ZB6e5x5khQI8NusOHj8nquoutd6FRY5WQ==", - "license": "MIT", - "dependencies": { - "@react-spring/animated": "~9.6.1", - "@react-spring/rafz": "~9.6.1", - "@react-spring/shared": "~9.6.1", - "@react-spring/types": "~9.6.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/react-spring/donate" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, - "node_modules/@react-spring/rafz": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/@react-spring/rafz/-/rafz-9.6.1.tgz", - "integrity": "sha512-v6qbgNRpztJFFfSE3e2W1Uz+g8KnIBs6SmzCzcVVF61GdGfGOuBrbjIcp+nUz301awVmREKi4eMQb2Ab2gGgyQ==", - "license": "MIT" - }, - "node_modules/@react-spring/shared": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/@react-spring/shared/-/shared-9.6.1.tgz", - "integrity": "sha512-PBFBXabxFEuF8enNLkVqMC9h5uLRBo6GQhRMQT/nRTnemVENimgRd+0ZT4yFnAQ0AxWNiJfX3qux+bW2LbG6Bw==", - "license": "MIT", - "dependencies": { - "@react-spring/rafz": "~9.6.1", - "@react-spring/types": "~9.6.1" - }, - "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0" - } - }, "node_modules/@react-spring/three": { "version": "9.7.5", "resolved": "https://registry.npmjs.org/@react-spring/three/-/three-9.7.5.tgz", @@ -1425,12 +1370,6 @@ "integrity": "sha512-HVj7LrZ4ReHWBimBvu2SKND3cDVUPWKLqRTmWe/fNY6o1owGOX0cAHbdPDTMelgBlVbrTKrre6lFkhqGZErK/g==", "license": "MIT" }, - "node_modules/@react-spring/types": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/@react-spring/types/-/types-9.6.1.tgz", - "integrity": "sha512-POu8Mk0hIU3lRXB3bGIGe4VHIwwDsQyoD1F394OK7STTiX9w4dG3cTLljjYswkQN+hDSHRrj4O36kuVa7KPU8Q==", - "license": "MIT" - }, "node_modules/@react-three/drei": { "version": "9.122.0", "resolved": "https://registry.npmjs.org/@react-three/drei/-/drei-9.122.0.tgz", @@ -2597,12 +2536,6 @@ "integrity": "sha512-mMy8/ODcKhab808co15eW+yN+HgXoQxRQHTiBV9Mrvl1r0ufnid7YOcI+gi4eUWSWl9ezD6TW2KXccrL8HCh2A==", "license": "BSD-3-Clause" }, - "node_modules/@yomguithereal/helpers": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@yomguithereal/helpers/-/helpers-1.1.1.tgz", - "integrity": "sha512-UYvAq/XCA7xoh1juWDYsq3W0WywOB+pz8cgVnE1b45ZfdMhBvHDrgmSFG3jXeZSr2tMTYLGHFHON+ekG05Jebg==", - "license": "MIT" - }, "node_modules/aria-hidden": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.6.tgz", @@ -2745,12 +2678,6 @@ ], "license": "CC-BY-4.0" }, - "node_modules/classnames": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz", - "integrity": "sha512-saHYOzhIQs6wy2sVxTM6bUDsQO4F50V9RQ22qBpEdCW+I+/Wmke2HOl6lS6dTpdxVhb88/I6+Hs+438c3lfUow==", - "license": "MIT" - }, "node_modules/clsx": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", @@ -2833,12 +2760,6 @@ "node": ">=12" } }, - "node_modules/d3-binarytree": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/d3-binarytree/-/d3-binarytree-1.0.2.tgz", - "integrity": "sha512-cElUNH+sHu95L04m92pG73t2MEJXKu+GeKUN1TJkFsu93E5W8E9Sc3kHEGJKgenGvj19m6upSn2EunvMgMD2Yw==", - "license": "MIT" - }, "node_modules/d3-color": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", @@ -2848,15 +2769,6 @@ "node": ">=12" } }, - "node_modules/d3-dispatch": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", - "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, "node_modules/d3-ease": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", @@ -2866,22 +2778,6 @@ "node": ">=12" } }, - "node_modules/d3-force-3d": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/d3-force-3d/-/d3-force-3d-3.0.6.tgz", - "integrity": "sha512-4tsKHUPLOVkyfEffZo1v6sFHvGFwAIIjt/W8IThbp08DYAsXZck+2pSHEG5W1+gQgEvFLdZkYvmJAbRM2EzMnA==", - "license": "MIT", - "dependencies": { - "d3-binarytree": "1", - "d3-dispatch": "1 - 3", - "d3-octree": "1", - "d3-quadtree": "1 - 3", - "d3-timer": "1 - 3" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/d3-format": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz", @@ -2891,15 +2787,6 @@ "node": ">=12" } }, - "node_modules/d3-hierarchy": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", - "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, "node_modules/d3-interpolate": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", @@ -2912,12 +2799,6 @@ "node": ">=12" } }, - "node_modules/d3-octree": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/d3-octree/-/d3-octree-1.1.0.tgz", - "integrity": "sha512-F8gPlqpP+HwRPMO/8uOu5wjH110+6q4cgJvgJT6vlpy3BEaDIKlTZrgHKZSp/i1InRpVfh4puY/kvL6MxK930A==", - "license": "MIT" - }, "node_modules/d3-path": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", @@ -2927,15 +2808,6 @@ "node": ">=12" } }, - "node_modules/d3-quadtree": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", - "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, "node_modules/d3-scale": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", @@ -3059,12 +2931,6 @@ "dev": true, "license": "ISC" }, - "node_modules/ellipsize": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/ellipsize/-/ellipsize-0.5.1.tgz", - "integrity": "sha512-0jEAyuIRU6U8MN0S5yUqIrkK/AQWkChh642N3zQuGV57s9bsUWYLc0jJOoDIUkZ2sbEL3ySq8xfq71BvG4q3hw==", - "license": "MIT" - }, "node_modules/enhanced-resolve": { "version": "5.21.6", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.21.6.tgz", @@ -3228,44 +3094,17 @@ "license": "ISC" }, "node_modules/graphology": { - "version": "0.25.4", - "resolved": "https://registry.npmjs.org/graphology/-/graphology-0.25.4.tgz", - "integrity": "sha512-33g0Ol9nkWdD6ulw687viS8YJQBxqG5LWII6FI6nul0pq6iM2t5EKquOTFDbyTblRB3O9I+7KX4xI8u5ffekAQ==", + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/graphology/-/graphology-0.26.0.tgz", + "integrity": "sha512-8SSImzgUUYC89Z042s+0r/vMibY7GX/Emz4LDO5e7jYXhuoWfHISPFJYjpRLUSJGq6UQ6xlenvX1p/hJdfXuXg==", "license": "MIT", "dependencies": { - "events": "^3.3.0", - "obliterator": "^2.0.2" + "events": "^3.3.0" }, "peerDependencies": { "graphology-types": ">=0.24.0" } }, - "node_modules/graphology-indices": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/graphology-indices/-/graphology-indices-0.17.0.tgz", - "integrity": "sha512-A7RXuKQvdqSWOpn7ZVQo4S33O0vCfPBnUSf7FwE0zNCasqwZVUaCXePuWo5HBpWw68KJcwObZDHpFk6HKH6MYQ==", - "license": "MIT", - "dependencies": { - "graphology-utils": "^2.4.2", - "mnemonist": "^0.39.0" - }, - "peerDependencies": { - "graphology-types": ">=0.20.0" - } - }, - "node_modules/graphology-layout": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/graphology-layout/-/graphology-layout-0.6.1.tgz", - "integrity": "sha512-m9aMvbd0uDPffUCFPng5ibRkb2pmfNvdKjQWeZrf71RS1aOoat5874+DcyNfMeCT4aQguKC7Lj9eCbqZj/h8Ag==", - "license": "MIT", - "dependencies": { - "graphology-utils": "^2.3.0", - "pandemonium": "^2.4.0" - }, - "peerDependencies": { - "graphology-types": ">=0.19.0" - } - }, "node_modules/graphology-layout-forceatlas2": { "version": "0.10.1", "resolved": "https://registry.npmjs.org/graphology-layout-forceatlas2/-/graphology-layout-forceatlas2-0.10.1.tgz", @@ -3278,49 +3117,6 @@ "graphology-types": ">=0.19.0" } }, - "node_modules/graphology-layout-noverlap": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/graphology-layout-noverlap/-/graphology-layout-noverlap-0.4.2.tgz", - "integrity": "sha512-13WwZSx96zim6l1dfZONcqLh3oqyRcjIBsqz2c2iJ3ohgs3605IDWjldH41Gnhh462xGB1j6VGmuGhZ2FKISXA==", - "license": "MIT", - "dependencies": { - "graphology-utils": "^2.3.0" - }, - "peerDependencies": { - "graphology-types": ">=0.19.0" - } - }, - "node_modules/graphology-metrics": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/graphology-metrics/-/graphology-metrics-2.4.0.tgz", - "integrity": "sha512-7WOfOP+mFLCaTJx55Qg4eY+211vr1/b3D/R3biz3SXGhAaCVcWYkfabnmO4O4WBNWANEHtVnFrGgJ0kj6MM6xw==", - "license": "MIT", - "dependencies": { - "graphology-indices": "^0.17.0", - "graphology-shortest-path": "^2.0.0", - "graphology-utils": "^2.4.4", - "mnemonist": "^0.39.0", - "pandemonium": "2.4.1" - }, - "peerDependencies": { - "graphology-types": ">=0.20.0" - } - }, - "node_modules/graphology-shortest-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/graphology-shortest-path/-/graphology-shortest-path-2.1.0.tgz", - "integrity": "sha512-KbT9CTkP/u72vGEJzyRr24xFC7usI9Es3LMmCPHGwQ1KTsoZjxwA9lMKxfU0syvT/w+7fZUdB/Hu2wWYcJBm6Q==", - "license": "MIT", - "dependencies": { - "@yomguithereal/helpers": "^1.1.1", - "graphology-indices": "^0.17.0", - "graphology-utils": "^2.4.3", - "mnemonist": "^0.39.0" - }, - "peerDependencies": { - "graphology-types": ">=0.20.0" - } - }, "node_modules/graphology-types": { "version": "0.24.8", "resolved": "https://registry.npmjs.org/graphology-types/-/graphology-types-0.24.8.tgz", @@ -3343,12 +3139,6 @@ "integrity": "sha512-VSIRpLfRwlAAdGL4wiTucx2ScRipo0ed1FBatWkyt832jC4CReKstga6yIhYVwGu9LOBjuX9wzmRMeQdBJtzEA==", "license": "Apache-2.0" }, - "node_modules/hold-event": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/hold-event/-/hold-event-0.2.0.tgz", - "integrity": "sha512-rko5P1XgHzy4B0NR0xVHEpWPgj0i23f8Mf8qsOugd1CHvfLR0PyIyy+8TAQQA9v8qAa1OZ4XuCKk04rxmPGHNQ==", - "license": "MIT" - }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -3817,15 +3607,6 @@ "integrity": "sha512-ZhoIoL7TNV4s5B6+rx5mC//fw8/POGyNxS/DZyCJeiZ12ScLfVwRE/GfsxwiTkMYYD5DmK2/JXnEVXqL4rF+Sw==", "license": "MIT" }, - "node_modules/mnemonist": { - "version": "0.39.8", - "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.39.8.tgz", - "integrity": "sha512-vyWo2K3fjrUw8YeeZ1zF0fy6Mu59RHokURlld8ymdUPjMlD9EC9ov1/YPqTgqRvUN9nTr3Gqfz29LYAmu0PHPQ==", - "license": "MIT", - "dependencies": { - "obliterator": "^2.0.1" - } - }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -3871,21 +3652,6 @@ "node": ">=0.10.0" } }, - "node_modules/obliterator": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.5.tgz", - "integrity": "sha512-42CPE9AhahZRsMNslczq0ctAEtqk8Eka26QofnqC346BZdHDySk3LWka23LI7ULIw11NmltpiLagIq8gBozxTw==", - "license": "MIT" - }, - "node_modules/pandemonium": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/pandemonium/-/pandemonium-2.4.1.tgz", - "integrity": "sha512-wRqjisUyiUfXowgm7MFH2rwJzKIr20rca5FsHXCMNm1W5YPP1hCtrZfgmQ62kP7OZ7Xt+cR858aB28lu5NX55g==", - "license": "MIT", - "dependencies": { - "mnemonist": "^0.39.2" - } - }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -4021,16 +3787,6 @@ "license": "MIT", "peer": true }, - "node_modules/react-merge-refs": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/react-merge-refs/-/react-merge-refs-1.1.0.tgz", - "integrity": "sha512-alTKsjEL0dKH/ru1Iyn7vliS2QRcBp9zZPGoWxUOvRGWPUYgjo+V01is7p04It6KhgrzhJGnIj9GgX8W4bZoCQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/gregberge" - } - }, "node_modules/react-reconciler": { "version": "0.27.0", "resolved": "https://registry.npmjs.org/react-reconciler/-/react-reconciler-0.27.0.tgz", @@ -4173,212 +3929,6 @@ } } }, - "node_modules/reagraph": { - "version": "4.22.0", - "resolved": "https://registry.npmjs.org/reagraph/-/reagraph-4.22.0.tgz", - "integrity": "sha512-opEQdl/xkaKJFIywkQTamNFzByd78szB8dZa57F3Yj69MwVgh7q7AGzv9S5sYlorqYrKA8O+Xm9rTpWXsFiQKg==", - "license": "Apache-2.0", - "dependencies": { - "@react-spring/three": "9.6.1", - "@react-three/fiber": "8.13.5", - "@use-gesture/react": "^10.3.1", - "camera-controls": "^2.8.3", - "classnames": "^2.5.1", - "d3-array": "^3.2.4", - "d3-force-3d": "^3.0.3", - "d3-hierarchy": "^3.1.2", - "d3-scale": "^4.0.2", - "ellipsize": "^0.5.1", - "glodrei": "^0.0.1", - "graphology": "^0.25.4", - "graphology-layout": "^0.6.1", - "graphology-layout-forceatlas2": "^0.10.1", - "graphology-layout-noverlap": "^0.4.2", - "graphology-metrics": "^2.1.0", - "graphology-shortest-path": "^2.0.2", - "hold-event": "^0.2.0", - "three": "^0.154.0", - "three-stdlib": "^2.23.13", - "zustand": "4.3.9" - }, - "peerDependencies": { - "react": ">=16", - "react-dom": ">=16" - } - }, - "node_modules/reagraph/node_modules/@react-spring/three": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/@react-spring/three/-/three-9.6.1.tgz", - "integrity": "sha512-Tyw2YhZPKJAX3t2FcqvpLRb71CyTe1GvT3V+i+xJzfALgpk10uPGdGaQQ5Xrzmok1340DAeg2pR/MCfaW7b8AA==", - "license": "MIT", - "dependencies": { - "@react-spring/animated": "~9.6.1", - "@react-spring/core": "~9.6.1", - "@react-spring/shared": "~9.6.1", - "@react-spring/types": "~9.6.1" - }, - "peerDependencies": { - "@react-three/fiber": ">=6.0", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "three": ">=0.126" - } - }, - "node_modules/reagraph/node_modules/@react-three/fiber": { - "version": "8.13.5", - "resolved": "https://registry.npmjs.org/@react-three/fiber/-/fiber-8.13.5.tgz", - "integrity": "sha512-x9QdsaB/Wm/6NGvRXQahPPWfn2dQce7Fg3C2r00NNzyDdqRKw32YavL+WEqjZOOd0nvFpzv7FtaKc+VCOTR59w==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.17.8", - "@types/react-reconciler": "^0.26.7", - "its-fine": "^1.0.6", - "react-reconciler": "^0.27.0", - "react-use-measure": "^2.1.1", - "scheduler": "^0.21.0", - "suspend-react": "^0.1.3", - "zustand": "^3.7.1" - }, - "peerDependencies": { - "expo": ">=43.0", - "expo-asset": ">=8.4", - "expo-gl": ">=11.0", - "react": ">=18.0", - "react-dom": ">=18.0", - "react-native": ">=0.64", - "three": ">=0.133" - }, - "peerDependenciesMeta": { - "expo": { - "optional": true - }, - "expo-asset": { - "optional": true - }, - "expo-gl": { - "optional": true - }, - "react-dom": { - "optional": true - }, - "react-native": { - "optional": true - } - } - }, - "node_modules/reagraph/node_modules/@react-three/fiber/node_modules/zustand": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/zustand/-/zustand-3.7.2.tgz", - "integrity": "sha512-PIJDIZKtokhof+9+60cpockVOq05sJzHCriyvaLBmEJixseQ1a5Kdov6fWZfWOu5SK9c+FhH1jU0tntLxRJYMA==", - "license": "MIT", - "engines": { - "node": ">=12.7.0" - }, - "peerDependencies": { - "react": ">=16.8" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - } - } - }, - "node_modules/reagraph/node_modules/glodrei": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/glodrei/-/glodrei-0.0.1.tgz", - "integrity": "sha512-DMx6ElCSwh1pR4IyDS3LvyFwZHSCCKCqdqo8P1G7klQtqH6PcOjleduCDsHehDtyYQ1E4dzVeoEzHIL1DIxjag==", - "license": "MIT", - "dependencies": { - "@babel/runtime": "^7.11.2", - "@mediapipe/tasks-vision": "0.10.8", - "@react-spring/three": "~9.6.1", - "@use-gesture/react": "^10.2.24", - "camera-controls": "^2.4.2", - "cross-env": "^7.0.3", - "detect-gpu": "^5.0.28", - "glsl-noise": "^0.0.0", - "maath": "^0.10.7", - "meshline": "^3.1.6", - "react-composer": "^5.0.3", - "react-merge-refs": "^1.1.0", - "stats-gl": "^2.0.0", - "stats.js": "^0.17.0", - "suspend-react": "^0.1.3", - "three-mesh-bvh": "^0.7.0", - "three-stdlib": "^2.29.4", - "troika-three-text": "^0.47.2", - "tunnel-rat": "^0.1.2", - "utility-types": "^3.10.0", - "uuid": "^9.0.1", - "zustand": "^3.7.1" - }, - "peerDependencies": { - "@react-three/fiber": ">=8.0", - "react": ">=18.0", - "react-dom": ">=18.0", - "three": ">=0.137" - }, - "peerDependenciesMeta": { - "react-dom": { - "optional": true - } - } - }, - "node_modules/reagraph/node_modules/glodrei/node_modules/troika-three-text": { - "version": "0.47.2", - "resolved": "https://registry.npmjs.org/troika-three-text/-/troika-three-text-0.47.2.tgz", - "integrity": "sha512-qylT0F+U7xGs+/PEf3ujBdJMYWbn0Qci0kLqI5BJG2kW1wdg4T1XSxneypnF05DxFqJhEzuaOR9S2SjiyknMng==", - "license": "MIT", - "dependencies": { - "bidi-js": "^1.0.2", - "troika-three-utils": "^0.47.2", - "troika-worker-utils": "^0.47.2", - "webgl-sdf-generator": "1.1.1" - }, - "peerDependencies": { - "three": ">=0.125.0" - } - }, - "node_modules/reagraph/node_modules/glodrei/node_modules/troika-three-text/node_modules/troika-three-utils": { - "version": "0.47.2", - "resolved": "https://registry.npmjs.org/troika-three-utils/-/troika-three-utils-0.47.2.tgz", - "integrity": "sha512-/28plhCxfKtH7MSxEGx8e3b/OXU5A0xlwl+Sbdp0H8FXUHKZDoksduEKmjQayXYtxAyuUiCRunYIv/8Vi7aiyg==", - "license": "MIT", - "peerDependencies": { - "three": ">=0.125.0" - } - }, - "node_modules/reagraph/node_modules/glodrei/node_modules/zustand": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/zustand/-/zustand-3.7.2.tgz", - "integrity": "sha512-PIJDIZKtokhof+9+60cpockVOq05sJzHCriyvaLBmEJixseQ1a5Kdov6fWZfWOu5SK9c+FhH1jU0tntLxRJYMA==", - "license": "MIT", - "engines": { - "node": ">=12.7.0" - }, - "peerDependencies": { - "react": ">=16.8" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - } - } - }, - "node_modules/reagraph/node_modules/scheduler": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.21.0.tgz", - "integrity": "sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==", - "license": "MIT", - "dependencies": { - "loose-envify": "^1.1.0" - } - }, - "node_modules/reagraph/node_modules/three": { - "version": "0.154.0", - "resolved": "https://registry.npmjs.org/three/-/three-0.154.0.tgz", - "integrity": "sha512-Uzz8C/5GesJzv8i+Y2prEMYUwodwZySPcNhuJUdsVMH2Yn4Nm8qlbQe6qRN5fOhg55XB0WiLfTPBxVHxpE60ug==", - "license": "MIT" - }, "node_modules/recharts": { "version": "3.9.0", "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.9.0.tgz", @@ -4524,6 +4074,16 @@ "node": ">=8" } }, + "node_modules/sigma": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/sigma/-/sigma-3.0.3.tgz", + "integrity": "sha512-5H0zFlx6/NTQpqBg4Rm569ZOpnBOXMaS25UQThIWMU3XyzI5AhmorK/gnl87BvJBLhQd0tW4C0LIp3enWzMoNw==", + "license": "MIT", + "dependencies": { + "events": "^3.3.0", + "graphology-utils": "^2.5.2" + } + }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -4686,12 +4246,6 @@ "three": ">=0.125.0" } }, - "node_modules/troika-worker-utils": { - "version": "0.47.2", - "resolved": "https://registry.npmjs.org/troika-worker-utils/-/troika-worker-utils-0.47.2.tgz", - "integrity": "sha512-mzss4MeyzUkYBppn4x5cdAqrhBHFEuVmMMgLMTyFV23x6GvQMyo+/R5E5Lsbrt7WSt5RfvewjcwD1DChRTA9lA==", - "license": "MIT" - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -4820,20 +4374,6 @@ "node": ">= 4" } }, - "node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/victory-vendor": { "version": "37.3.6", "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz", diff --git a/frontend/package.json b/frontend/package.json index 5dc76dd..1b28837 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -15,11 +15,13 @@ "@tanstack/react-query": "^5.101.1", "clsx": "^2.1.1", "cmdk": "^1.1.1", + "graphology": "^0.26.0", + "graphology-layout-forceatlas2": "^0.10.1", "lucide-react": "^0.460.0", "react": "^18.3.1", "react-dom": "^18.3.1", - "reagraph": "^4.22.0", "recharts": "^3.9.0", + "sigma": "^3.0.3", "tailwind-merge": "^2.5.5", "three": "^0.169.0" }, diff --git a/frontend/src/components/SystemDrawer.tsx b/frontend/src/components/SystemDrawer.tsx index 8bae4b4..30e1a47 100644 --- a/frontend/src/components/SystemDrawer.tsx +++ b/frontend/src/components/SystemDrawer.tsx @@ -1,5 +1,5 @@ import { useEffect, useState, useRef } from "react" -import { X, RefreshCw, Terminal, Cpu, Server, Shield, Power, Eye, EyeOff, Key, AlertTriangle, Camera, Bot, Box, FileText, Package, GitCommit, ExternalLink, ArrowRight } from "lucide-react" +import { X, RefreshCw, Terminal, Cpu, Server, Shield, Power, Eye, EyeOff, Key, AlertTriangle, Camera, Bot, Box, FileText, Package, GitCommit, ExternalLink, ArrowRight, Shuffle } from "lucide-react" import { api, type Job, type UpdatesResp, type ServicesResp, type UpdateDetails } from "@/lib/api" import { cn } from "@/lib/utils" import { CustomDialog } from "./CustomDialog" @@ -81,7 +81,7 @@ export function SystemDrawer({ open, onClose, defaultTab = "maintenance" }: Syst const [hermesUpdating, setHermesUpdating] = useState(false) // Update-Detail-Fenster: zeigt VOR dem Anwenden, was genau aktualisiert wird. - const [detail, setDetail] = useState<{ kind: "os" | "engine" | "hermes"; loading: boolean; data: UpdateDetails | null } | null>(null) + const [detail, setDetail] = useState<{ kind: "os" | "engine" | "swap" | "hermes"; loading: boolean; data: UpdateDetails | null } | null>(null) // Custom Dialog State const [dialog, setDialog] = useState<{ @@ -237,6 +237,16 @@ export function SystemDrawer({ open, onClose, defaultTab = "maintenance" }: Syst } } + async function triggerSwapUpdate() { + try { + await api<{ job_id: string }>("/api/maintenance/swap-update", { method: "POST" }) + loadJobs() + setActiveTab("maintenance") + } catch (e: any) { + showAlert("Fehler", `Fehler beim Router-Update: ${e.message}`) + } + } + async function doHermesUpdate() { setHermesUpdating(true) try { @@ -250,7 +260,7 @@ export function SystemDrawer({ open, onClose, defaultTab = "maintenance" }: Syst } // Öffnet das Detail-Fenster und lädt, was genau aktualisiert würde. - async function openUpdateDetails(kind: "os" | "engine" | "hermes") { + async function openUpdateDetails(kind: "os" | "engine" | "swap" | "hermes") { setDetail({ kind, loading: true, data: null }) try { const d = await api(`/api/maintenance/update-details?kind=${kind}`) @@ -266,6 +276,7 @@ export function SystemDrawer({ open, onClose, defaultTab = "maintenance" }: Syst setDetail(null) if (kind === "os") triggerOsUpdate() else if (kind === "engine") triggerEngineUpdate() + else if (kind === "swap") triggerSwapUpdate() else if (kind === "hermes") doHermesUpdate() } @@ -446,7 +457,8 @@ export function SystemDrawer({ open, onClose, defaultTab = "maintenance" }: Syst )}
openUpdateDetails("os")} /> - openUpdateDetails("engine")} /> + openUpdateDetails("engine")} /> + openUpdateDetails("swap")} /> {(() => { const h = updates?.components?.find((c) => c.key === "hermes_agent") return ( @@ -764,7 +776,8 @@ export function SystemDrawer({ open, onClose, defaultTab = "maintenance" }: Syst const d = detail.data const meta = { os: { icon: Shield, cls: "text-cyan-400", title: "OS-Pakete (apt)" }, - engine: { icon: Server, cls: "text-violet-400", title: "Engine (llama.cpp)" }, + engine: { icon: Server, cls: "text-violet-400", title: "Inferenz-Engine (llama.cpp)" }, + swap: { icon: Shuffle, cls: "text-fuchsia-400", title: "Router (llama-swap)" }, hermes: { icon: Bot, cls: "text-amber-400", title: "Hermes-Agent" }, }[detail.kind] const Icon = meta.icon @@ -815,7 +828,7 @@ export function SystemDrawer({ open, onClose, defaultTab = "maintenance" }: Syst
) - ) : detail.kind === "engine" ? ( + ) : detail.kind === "engine" || detail.kind === "swap" ? ( <>
Build {d?.installed_build ?? "?"} diff --git a/frontend/src/components/dashboard/UpdatesCard.tsx b/frontend/src/components/dashboard/UpdatesCard.tsx index ed5e61b..5b14b0d 100644 --- a/frontend/src/components/dashboard/UpdatesCard.tsx +++ b/frontend/src/components/dashboard/UpdatesCard.tsx @@ -41,8 +41,10 @@ export function UpdatesCard() {
0 ? "alert" : "muted"} value={updates.os > 0 ? `${updates.os} verfügbar` : "aktuell"} /> - 0 ? "alert" : "muted"} + 0 ? "alert" : "muted"} value={updates.engine > 0 ? "Update verfügbar" : "aktuell"} /> + 0 ? "alert" : "muted"} + value={updates.swap > 0 ? "Update verfügbar" : "aktuell"} /> 0 ? "accent" : "muted"} value={updates.models > 0 ? `${updates.models} verfügbar` : "aktuell"} /> {updates.components?.map((c) => ( diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index e79435a..e61e9e1 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -242,6 +242,7 @@ export interface ComponentUpdate { export interface UpdatesResp { os: number engine: number + swap: number models: number model_list: { role: string; title: string; repo: string }[] last_check?: number | null @@ -249,7 +250,7 @@ export interface UpdatesResp { } export interface UpdateDetails { - kind: "os" | "engine" | "hermes" + kind: "os" | "engine" | "swap" | "hermes" error?: string // os count?: number diff --git a/frontend/src/views/GraphView.tsx b/frontend/src/views/GraphView.tsx index 3b4596f..afa58bf 100644 --- a/frontend/src/views/GraphView.tsx +++ b/frontend/src/views/GraphView.tsx @@ -1,8 +1,13 @@ -import { useMemo, useState } from "react" -import { GraphCanvas, darkTheme } from "reagraph" +import { useEffect, useMemo, useRef, useState } from "react" +import Graph from "graphology" +import forceAtlas2 from "graphology-layout-forceatlas2" +import Sigma from "sigma" import { Trash2, Sparkles, Share2 } from "lucide-react" import { type MemoryGraph } from "@/lib/api" +// Sigma.js v3 + graphology: graph-optimiertes WebGL (kein three.js-Ballast) → skaliert auf tausende +// Fakten flüssig. Im App-Look gestylt; Hover hebt den Knoten + seine Nachbarn hervor, der Rest dimmt. + const CAT_COLOR: Record = { identity: "#22d3ee", knowledge: "#6366f1", rules: "#a78bfa", events: "#fbbf24", } @@ -10,9 +15,18 @@ const CAT_LABEL: Record = { identity: "Identität", knowledge: "Wissen", rules: "Regeln", events: "Ereignisse", } const AUTO = new Set(["auto", "agent", "hermes"]) +const DIM_NODE = "#1f2937" +const DIM_EDGE = "#0f172a" +const EDGE = "#243044" +const EDGE_HI = "#4b5563" export function GraphView({ data, onDelete }: { data: MemoryGraph; onDelete: (id: string) => void }) { const [selected, setSelected] = useState(null) + const containerRef = useRef(null) + const sigmaRef = useRef(null) + const graphRef = useRef(null) + const active = useRef(null) // hervorgehobener Knoten (hover oder Auswahl) + const selectedRef = useRef(null) // aktuelle Auswahl (für leaveNode ohne Effekt-Neulauf) const degree = useMemo(() => { const d: Record = {} @@ -20,19 +34,67 @@ export function GraphView({ data, onDelete }: { data: MemoryGraph; onDelete: (id return d }, [data]) - const nodes = useMemo(() => data.nodes.map((n) => ({ - id: n.id, - label: n.content.length > 26 ? n.content.slice(0, 25) + "…" : n.content, - fill: CAT_COLOR[n.category] || "#64748b", - size: 6 + Math.min(degree[n.id] || 0, 6) * 2, - })), [data, degree]) + // Graph (neu)bauen + Layout + Sigma rendern, wenn sich die Daten ändern. + useEffect(() => { + if (!containerRef.current || !data.nodes.length) return + const graph = new Graph() + const N = data.nodes.length + data.nodes.forEach((n, i) => { + const a = (2 * Math.PI * i) / N + graph.addNode(n.id, { + x: Math.cos(a), y: Math.sin(a), // Startposition (Kreis) für ForceAtlas2 + size: 4 + Math.min(degree[n.id] || 0, 12) * 1.4, + color: CAT_COLOR[n.category] || "#64748b", + label: n.content.length > 48 ? n.content.slice(0, 47) + "…" : n.content, + }) + }) + data.edges.forEach((e) => { + if (graph.hasNode(e.source) && graph.hasNode(e.target) && !graph.hasEdge(e.source, e.target)) + graph.addEdge(e.source, e.target, { size: 0.6 + (e.weight || 0), color: EDGE }) + }) + forceAtlas2.assign(graph, { iterations: 220, settings: forceAtlas2.inferSettings(graph) }) + graphRef.current = graph - const edges = useMemo(() => data.edges.map((e) => ({ - id: `${e.source}->${e.target}`, - source: e.source, - target: e.target, - size: 0.4 + e.weight, - })), [data]) + const renderer = new Sigma(graph, containerRef.current, { + renderLabels: true, + labelColor: { color: "#cbd5e1" }, + labelSize: 11, + labelWeight: "500", + labelDensity: 0.6, + labelRenderedSizeThreshold: N > 120 ? 12 : 0, // bei vielen Knoten nur große labeln (entklumpen) + defaultEdgeColor: EDGE, + minCameraRatio: 0.1, + maxCameraRatio: 4, + nodeReducer: (id, attrs) => { + const a = active.current + if (!a) return attrs + if (id === a || graph.areNeighbors(a, id)) return attrs + return { ...attrs, color: DIM_NODE, label: "" } + }, + edgeReducer: (edge, attrs) => { + const a = active.current + if (!a) return attrs + const ext = graph.extremities(edge) + if (ext[0] === a || ext[1] === a) return { ...attrs, color: EDGE_HI, size: (attrs.size || 1) * 1.6 } + return { ...attrs, color: DIM_EDGE } + }, + }) + sigmaRef.current = renderer + + renderer.on("clickNode", ({ node }) => setSelected(node)) + renderer.on("clickStage", () => setSelected(null)) + renderer.on("enterNode", ({ node }) => { active.current = node; renderer.refresh(); containerRef.current!.style.cursor = "pointer" }) + renderer.on("leaveNode", () => { active.current = selectedRef.current; renderer.refresh(); containerRef.current!.style.cursor = "default" }) + + return () => { renderer.kill(); sigmaRef.current = null; graphRef.current = null } + }, [data, degree]) + + // Auswahl spiegelt die Hervorhebung (auch ohne Hover). + useEffect(() => { + selectedRef.current = selected + active.current = selected + sigmaRef.current?.refresh() + }, [selected]) const sel = selected ? data.nodes.find((n) => n.id === selected) ?? null : null const neighbors = useMemo(() => { @@ -56,17 +118,15 @@ export function GraphView({ data, onDelete }: { data: MemoryGraph; onDelete: (id return (
- setSelected(n.id)} - onCanvasClick={() => setSelected(null)} - /> +
+ {/* Legende */} +
+ {Object.entries(CAT_LABEL).map(([k, l]) => ( + + {l} + + ))} +
@@ -87,20 +147,15 @@ export function GraphView({ data, onDelete }: { data: MemoryGraph; onDelete: (id
{neighbors.length ? neighbors.map((n) => ( - )) : }
- @@ -108,7 +163,7 @@ export function GraphView({ data, onDelete }: { data: MemoryGraph; onDelete: (id
- Einen Knoten wählen, um den Fakt und seine semantischen Nachbarn zu sehen. + Auf einen Knoten klicken, um den Fakt und seine semantischen Nachbarn zu sehen. Hover hebt das Netz hervor.
)} diff --git a/frontend/src/views/MemoryView.tsx b/frontend/src/views/MemoryView.tsx index 4635275..62315b3 100644 --- a/frontend/src/views/MemoryView.tsx +++ b/frontend/src/views/MemoryView.tsx @@ -9,7 +9,7 @@ import { useDialog } from "@/lib/useDialog" import { cn } from "@/lib/utils" import { GraphErrorBoundary } from "./GraphErrorBoundary" -// reagraph + three.js sind schwer → erst laden, wenn der Graph-Tab geöffnet wird. +// Sigma/graphology nur laden, wenn der Graph-Tab geöffnet wird (Code-Splitting). const GraphView = lazy(() => import("./GraphView").then((m) => ({ default: m.GraphView }))) const CATEGORIES = ["identity", "knowledge", "rules", "events"] @@ -48,7 +48,7 @@ export function MemoryView() { const [category, setCategory] = useState("knowledge") const [deduping, setDeduping] = useState(false) const [copied, setCopied] = useState(false) - const [view, setView] = useState<"liste" | "graph">("graph") + const [view, setView] = useState<"liste" | "graph">("liste") const [showAdd, setShowAdd] = useState(false) const qc = useQueryClient() @@ -80,6 +80,14 @@ export function MemoryView() { return { nodes: ns, edges: g.edges.filter((e) => ids.has(e.source) && ids.has(e.target)) } }, [graph, q]) + // Liste nach Kategorie gruppieren (skaliert: klare Sektionen statt einer flachen Wand). + const grouped = useMemo(() => { + const g: Record = {} + items.forEach((m) => { (g[m.category] ??= []).push(m) }) + return g + }, [items]) + const otherItems = useMemo(() => items.filter((m) => !CATEGORIES.includes(m.category)), [items]) + async function add() { if (!content.trim()) return await api("/api/memory", { method: "POST", body: JSON.stringify({ content, category, source: "ui" }) }) @@ -277,42 +285,56 @@ export function MemoryView() { })}
-
- {items.length === 0 ? ( -
- Keine Einträge für die aktuellen Filterkriterien gefunden. -
- ) : items.map((m) => { - const conf = CAT_CONFIG[m.category] || DEFAULT_CAT - const Icon = conf.icon - const isAuto = AUTO_SOURCES.has(m.source) - return ( -
-
- - {conf.label} - - {m.content} + {items.length === 0 ? ( +
+ Keine Einträge für die aktuellen Filterkriterien gefunden. +
+ ) : ( +
+ {[...CATEGORIES, "__other"].map((c) => { + const list = c === "__other" ? otherItems : (grouped[c] || []) + if (!list.length) return null + const conf = CAT_CONFIG[c] || DEFAULT_CAT + const Icon = conf.icon + return ( +
+ {/* Sektions-Kopf je Kategorie */} +
+ + {conf.label} + {list.length} +
+
+
+ {list.map((m) => { + const isAuto = AUTO_SOURCES.has(m.source) + return ( +
+ {m.content} +
+ {typeof m.score === "number" && ( + {Math.round(m.score * 100)}% + )} + + {isAuto && }{m.source} + + +
+
+ ) + })} +
-
- {typeof m.score === "number" && ( - {Math.round(m.score * 100)}% - )} - - {isAuto && }{m.source} - - -
-
- ) - })} -
+ ) + })} +
+ )} )}